您的位置:首页 > 运维架构 > Linux

Linux驱动开发④--unknown field ‘ioctl’ specified in initializer .ioctl = xxx

2017-01-09 11:49 393 查看
在linux-2.6.36内核上加载编译驱动时,出现

error:unknown field 'ioctl' specified in initializer

原因是:在2.6.36内核上file_operations发生了重大的改变:

原先的

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

被改为了       

  long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
  long (*compat_ioctl) (struct file *, unsigned int, unsigned long);

因而在实际驱动中,我们需要将原先的写的ioctl函数头给改成下面的unlocked_ioctl,在file_operations结构体的填充中也是一样。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐