【发布时间】:2012-08-30 05:45:40
【问题描述】:
我有一些 linux 驱动程序正在尝试从 linux 2.4 移植到 3.0。在这段漫长的时间里,ioctl(现在为unlocked_ioctl)的参数列表发生了一些变化:
-static int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long can_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
代码使用 inode 获取次要版本并将其传递给其他一些命令。现在 inode 不是 ioctl 参数列表中给出的“free-be”,我怎样才能得到它?
是否可以从文件指针派生?或者当它出现在 _open() 方法中时,我应该“保存”一个指向它的全局指针吗?如果有更好的方法,我宁愿避免这种情况。
【问题讨论】:
标签: c linux linux-kernel ioctl inode