首页 > 代码库 > error: unknown field 'ioctl' specified in initializer

error: unknown field 'ioctl' specified in initializer

error message:

原因: 从2.6.36开始,file_operations结构发生了重大变化

具体看  xx../include/linux/fs.h定义:

取消了原先的

 int (*ioctl)(struct inode*, struct file*, unsigned int, unsigned long);

添加来新的成员

long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);原来的ioctl 但是返回值变为long

long (*compat_ioctl) (struct file *, unsigned int, unsigned long);内核空间64位,用户空间32位

所以:

1,取消inode:

2,使用unlocked_ioctl

OK.