ioctl函数与unlocked_ioctl函数的区别

Linux 内核从2.6.36版本后,

 已经完全删除了struct file_operations 中的ioctl 函数指针,取而代之的是unlocked_ioctl 

static struct file_operations hi_i2c_fops = {
    .owner      = THIS_MODULE,
   // .ioctl      = I2C_Ioctl  ,
    .unlocked_ioctl = I2C_Ioctl  ,
    .open       = I2C_Open   ,
    .release    = I2C_Close  ,
};

ioctl 函数原型为: int (*ioctl)(struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg)

unlocked_ioctl 函数原型为:long (*unlocked_ioctl)(struct *filp,unsigned int cmd,unsigned long arg)
 

unlocked_ioctl 函数相比于ioctl函数, 最大的区别是参数中少了inode

猜你喜欢

转载自blog.csdn.net/u014689845/article/details/88074826
今日推荐