1、compat_ioctl:当有32bit的userspace application call 64bit kernel的IOCTL的时候,这个callback会被调用到。
2、如果是64位的用户程序运行在64位的kernel上,调用的是unlocked_ioctl,如果是32位的APP运行在32位的kernel上,调用的也是unlocked_ioctl
example:
long drv_ioctl(struct file * file, unsigned int ioctl_code, unsigned long arg)
{
/* */
return 0;
}
static struct file_operations file_operations =
{
.owner = THIS_MODULE,
.open = drv_open,
.release = drv_release,
.read = drv_read,
.unlocked_ioctl = drv_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = drv_ioctl,
#endif
.mmap = drv_mmap,
};