您的位置:首页 > 其它

error: unknown field 'ioctl' specified in initializer (1)

2012-03-20 13:30 489 查看
linux2.6.29和linux2.6.38的内核在file_operations结构发生了变化,否则在linux2.6.38内核中,继续使用.ioctl成员,编译时就会报错:error: unknown field 'ioctl' specified in initializer,struct file_operations结构体定义在include/linux/fs.h文件中。

linux2.6.38内核取消了原有的ioctl成员,添加来新的成员

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

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

2> warning: initialization from incompatible pointer type

出现此种warnning 的原因
“不兼容的指针类型初始化”

是你定义的函数类型与接口函数的类型不一样,如把返回值 long 定义成了 int

这两个问题都对驱动有影响。

static const struct file_operations 。。。 = {

。。。。。。

.unlocked_ioctl = 。。。,

。。。。。。

};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: