Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6499

Linux: Difference between inode and file_inode(file)?

$
0
0

in source/arch/x86/kernel/msr.c, the msr_open callback for the character device uses the following construct to extract the minor number of the character device file used:

static int msr_open(struct inode *inode, struct file *file){    unsigned int cpu = iminor(file_inode(file));    [...]}

My question is:Why not directly call iminor with the first argument of the function, like:

unsigned int cpu = iminor(inode);

The construct is used in other callbacks (e.g. read and write) as well,, where the inode is not passed as an argument, so I guess this is due to copy/paste, or is there a deeper meaning to it?


Viewing all articles
Browse latest Browse all 6499

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>