Re: ioctl cleanups: enable sg_io and serial stuff to be shared

Arnd Bergmann
2003-05-08T15:15:20Z

Gerd Knorr wrote:

> ioctl struct size and the ioctl number (which has the size encoded)
> should end up being different too. Anyone aware of corner cases where
> this isn't going to work?

About half of the ioctls that need special care have fixed numbers
instead of using _IOR() etc, see e.g. include/linux/sockios.h,
or they get the definition wrong in some way.

The way you do it in your patch could work for many cases, but it
won't be enough to eliminate HANDLE_IOCTL(), if that is desired.

Adding fops->compat_ioctl() makes it possible to eventually replace
all HANDLE_IOCTL() and keep only COMPATIBLE_IOCTL(), which in turn
would become simpler to deal with.
If we don't add fops->compat_ioctl(), the ioctl handlers could
however look at (current_thread_info()->flags & _TIF_32BIT) to find
out if which user data structure they should expect. Is that reliable?
Do we already have a macro to do it?