error : unknown field 'ioctl' specified in initializer

如題 奋斗


在搜尋引擎中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;


打完收工~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值