Linux:inode和file\u inode(file)之间的区别?
在source/arch/x86/kernel/msr.c中,字符设备的msr_open回调使用以下构造来提取所用字符设备文件的次要编号:Linux:inode和file\u inode(file)之间的区别?,linux,file,kernel,character,inode,Linux,File,Kernel,Character,Inode,在source/arch/x86/kernel/msr.c中,字符设备的msr_open回调使用以下构造来提取所用字符设备文件的次要编号: static int msr_open(struct inode *inode, struct file *file) { unsigned int cpu = iminor(file_inode(file)); [...] } 我的问题是: 为什么不使用函数的第一个参数直接调用iminor,如: unsigned int cpu = i
static int msr_open(struct inode *inode, struct file *file)
{
unsigned int cpu = iminor(file_inode(file));
[...]
}
我的问题是:
为什么不使用函数的第一个参数直接调用iminor,如:
unsigned int cpu = iminor(inode);
该构造也用于其他回调(例如读和写),其中inode没有作为参数传递,因此我猜这是由于复制/粘贴,还是有更深的含义
inode是传统Unix风格文件系统(如UFS或ext3)上的数据结构。inode存储有关常规文件、目录或其他文件系统对象的基本信息。
-
同样的交易