From: Takashi Iwai Subject: Re: [PATCH] alsa-lib: issues in snd_seq_change_bit and some enhancements Date: Thu, 21 Feb 2008 12:36:27 +0100 Message-ID: References: <1203577712.13752.33.camel@localhost> <47BD2F61.7070103@ladisch.de> <17eedd8a0802210112k548c1e0fx4c6cf04bfc9ae780@mail.gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (ns.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 553C32444E for ; Thu, 21 Feb 2008 12:36:29 +0100 (CET) In-Reply-To: <17eedd8a0802210112k548c1e0fx4c6cf04bfc9ae780@mail.gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Aldrin Martoq Cc: alsa-devel , Clemens Ladisch List-Id: alsa-devel@alsa-project.org At Thu, 21 Feb 2008 06:12:19 -0300, Aldrin Martoq wrote: > > On Thu, Feb 21, 2008 at 4:59 AM, Clemens Ladisch wrote: > > Aldrin Martoq wrote: > > > 2) There is no sane way to clear the event_filter of > > > snd_seq_client_info_t structure. Because the structure is opaque, we > > > cannot memset to zero because the user doesn't know the size of the > > > bitmap. > > The event type is an 8-bit quantity; this is part of the sequencer API. > > The bitmap has exactly 256 bits, i.e., 32 bytes. > > It would be nice if this were actually documented ... > > Yup, I traced it to the sndrv_seq_client_info definition, but... > > I think Takashi explicitly undocumented that stuff. The client_info > and many other types/structures are hidden, the explanation is in the > following link: > typedef struct _snd_seq_client_info snd_seq_client_info_t; > http://www.alsa-project.org/~tiwai/alsa.html#NewSeqAPI > > So, my proposal follows the same spirit of hidding internal > structures, which is kind of boring in C. But it's not boring if you > are using some higher language (like python alsaseq, which I'm > currently working on). Yes, that looks nice to me. > Another way to "resolve" this is to create a type instead of the raw > pointer "unsigned char *". Something like: > typedef struct snd_seq_client_info_event_filter { > unsigned char d[32]; > } snd_seq_client_info_event_filter_t; > > and use the snd_seq_*_bit functions (btw, I added snd_seq_unset_bit); > but in my opinion, creating functions instead of structures is more in > the spirit of encapsulating the API for future extensions. It's better to add new APIs rather than re-defining the type. Could you split the patches? I applied the fix for snd_seq_change_bit() to HG tree now, as it's an obvious bug. The others are rather extensions. - a patch to add snd_seq_unset_bit() - a patch to add new *_event_filter_*() APIs - a patch to add new test code Don't forget to give a proper changelog for each. Thanks, Takashi