Re: [PATCH v3 2/2] ALSA: control: add ioctl to retrieve full card components

From: Maciej Strozek

Date: Thu Mar 05 2026 - 05:12:44 EST


W dniu czw, 05.03.2026 o godzinie 11∶04 +0100, użytkownik Takashi Iwai
napisał:
> On Thu, 05 Mar 2026 10:54:35 +0100,
> Maciej Strozek wrote:
> >
> > W dniu wto, 03.03.2026 o godzinie 16∶47 +0100, użytkownik Takashi
> > Iwai
> > napisał:
> > > >
> > > > + */
> > > > +struct snd_ctl_card_components {
> > > > + int card;
> > > > + unsigned int length;
> > > > + unsigned char *components;
> > > > +};
> > >
> > > And the ioctl can serve for two purposes:
> > >
> > > - When length=0 is set, the kernel stores the current number of
> > > bytes
> > >   and returns without copying.  User-space can use this mode for
> > >   allocating the buffer.
> > >
> > In alsa-lib all data must be allocated beforehand, so this
> > length==0
> > query is not very useful there, it will just go into a [512] array
> > anyway. Are there any other users that may benefit from this?
>
> My suggested API can work even with the fixed size 512, too, if 512
> is
> hight enough.  It's just more flexible.  And there is no restriction
> about alsa-lib data allocation; the function can query the size then
> allocate, too.
>
>
> Takashi

OK, will prepare v4 with this, thanks

--
Regards,
Maciej