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