Re: [PATCH] synclink_gt add compat_ioctl

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

 



On Saturday 05 May 2007, Paul Fulghum wrote:

> That declaration will need to be duplicated in each driver that
> uses it (4 drivers in my case). In that sense (a structure declaration
> used by multiple code modules) it does seem like an interface definition.
> 
> If that is what is needed, I will do it.

Now that you mention the duplication, this sounds wrong as well. The easiest
solution is probably to just put the definition of your data structure
inside of #ifdef CONFIG_COMPAT in the header file.

Or you could go really fancy and write a new file that does the synclink
compat_ioctl handling in a generic way end in the end just calls the
fops->{unlocked_,}ioctl() function.

Which reminds me that I have been meaning to do a patch that creates
a new generic_compat_ioctl() [1] function for some time, and convert
drivers to this if their handlers are all compatible.

	Arnd <><

[1]
/*
 * Can be used as the ->compat_ioctl method in the file_operations
 * for any driver that does not need any conversion in its ioctl
 * handler
 */
long generic_file_compat_ioctl(struct file *file, unsigned int cmd,
				unsigned long arg)
{
	int ret;
	arg = (unsigned long)compat_ptr(arg);

	if (file->f_ops->unlocked_ioctl)
		ret = file->f_ops->unlocked_ioctl(file, cmd, arg);
	else {
		lock_kernel();
		ret = file->f_ops->ioctl(file, cmd, arg);
		unlock_kernel();
	} else
		ret = -ENOIOCTLCMD;

	return ret;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux