On Sun, 07 Aug 2016 16:26:35 +0200, Takashi Sakamoto wrote: > > Hi Clemens, > > On Aug 7 2016 19:15, Clemens Ladisch wrote: > > Takashi Sakamoto wrote: > >> Data from user space is once copied to kernel stack, then operated and > >> copied to user space, in a consistent manner. This manner forces all ioctl > >> operations to copy the data from/to user space, even if it's read-only or > >> write-only. Thus, it has an overhead for simpler ioctl commands. > > > > The ioctl code itself already contains information about the direction > > and size of the data to be copied (and in theory, these values are > > correct). See dispatch_ioctl() in drivers/firewire/core-cdev.c for an > > example. > > A nice idea. > > _IOC_SIZE macro pick up 13 or 14 bits (architecture-dependent) in ioctl > command, which represents the size of argument. In my patch, the size of > 'union ioctl_arg' is 188 (x86/x32) or 192 (x86_64) and there's enough > rest of the size field. So we can pick up the size from ioctl command by > the macro because the size represents the maximum bytes of argument for > all of sequencer ioctls. It's not only about the size. It contains the r/w bits, so you can avoid the unnecessary user-copy calls, too. Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel