Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux:inode和file\u inode(file)之间的区别?_Linux_File_Kernel_Character_Inode - Fatal编程技术网

Linux:inode和file\u inode(file)之间的区别?

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

在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没有作为参数传递,因此我猜这是由于复制/粘贴,还是有更深的含义

inode是传统Unix风格文件系统(如UFS或ext3)上的数据结构。inode存储有关常规文件、目录或其他文件系统对象的基本信息。 -

同样的交易