在源/arch/x86/内核/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不是作为参数传递的,所以我猜这是由于复制/粘贴,还是有更深层次的含义?
发布于 2013-09-09 18:16:36
inode是传统Unix类型文件系统(如UFS或ext3 )上的数据结构。inode存储有关常规文件、目录或其他文件系统对象的基本信息。- http://www.cyberciti.biz/tips/understanding-unixlinux-filesystem-inodes.html
同样的交易。
https://stackoverflow.com/questions/18701789
复制相似问题