error : unknown field 'ioctl' specified in initializer

来源:互联网 发布:淘宝卖家必备软件排名 编辑:程序博客网 时间:2024/05/05 06:12

如題 奋斗


在搜尋引擎中Survey的結果,ioctl 此一成員在 Linux 2.6.36 之後被修改過了。

ioctl可形成的問題相當的多,在此僅先針對compile產生的問題去進行記錄,若有更多的error,歡迎分享。


先看一下 ioctl 原先設定

static int ***_ioctl(Struct inode *in,struct file *filp,unsigned int cmd,unsigned long arg){}static struct file_operations  ***_fops={.open = ***_open,.read = ***_read,.ioctl  = ***_ioctl,}



ioctl 在2.6.36之後修改如下

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


將code修改如下

static struct file_operations lpm_fops = {    .owner =    THIS_MODULE,    //.ioctl =    lpm_ioctl,    .unlocked_ioctl =    lpm_ioctl,    .open =     lpm_open,    .release =  lpm_release,};

原先inode的宣告可採用

struct inode *inode = filp->f_dentry->d_inode;


打完收工~

原创粉丝点击