Linux:inode和file_inode(文件)之间的区别?

时间:2013-09-09 15:28:53

标签: 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 = iminor(inode);

该构造还用于其他回调(例如读取和写入),其中inode不作为参数传递,所以我猜这是由于复制/粘贴,还是有更深层次的含义?

1 个答案:

答案 0 :(得分:0)

  

inode是传统Unix风格文件系统(如UFS或ext3)上的数据结构。 inode存储有关常规文件,目录或其他文件系统对象的基本信息。    - http://www.cyberciti.biz/tips/understanding-unixlinux-filesystem-inodes.html

同样的交易。

相关问题