Re: [RFC][PATCH] input: Introduce device information ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 07 December 2010, Kay Sievers wrote:
> On Tue, Dec 7, 2010 at 11:56, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote:
> > On Tue, Dec 07, 2010 at 11:48:28AM +0100, Kay Sievers wrote:
> 
> >> Please don't add new ioctls which are not extensible. The ioctl should
> >> carry the length or the version of the structure it asks for, so it
> >> can be extended in the future.
> >
> > Size of ioctl data is encoded in ioctl, it can be extended easily. For
> > examples take a look at how EVIOCGKEYCODE and EVIOCGSKEYCODE are handled
> > in recent kernels.
> 
> Oh, how does that work? With the ioctl call, userspace has to supply
> the size it expects to be returned from the kernel. How does the
> kernel otherwise know how much it is allowed to copy to the user?

The ioctl command number itself is calculated from the size of the
data that gets passed:

#define EVIOCGDEVINFO          _IOR('E', 0x09, struct input_devinfo)

If struct input_devinfo ever changes (which it can, but should not),
the command changes as well.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux