On Monday 19 September 2011, Rob Clark wrote:
> > * If you use structures, try very hard to avoid pointers in them,
> >  it messes up all sorts of tools.
> >
> > * If you use structures, make all members naturally aligned, and pad
> >  the size of the structures to a multiple of the maximum member size.
> >
> > * Never put sub-command numbers into a structure.
> 
> I didn't get this comment.. what is special about sub-command #'s?

It's mostly general interface cleanliness. We have the ioctl command
multiplexer nested inside the syscall command multiplexer, which is
both the reason its convenience and for most of the problems
associated with ioctl.

Nesting another multiplexor inside a single ioctl command gives
you more ugliness and more problems without any added convenience
(ioctl numbers are cheap). Specifically for 32 bit compat ioctls,
you don't want to have to handle sub-commands in different ways
but instead have some commands go directly to the native function
while only the ones whose author screwed up go through a compat
conversion.

        Arnd

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to