loff_t f_pos:這是用來記錄文件的偏移量。在應用程序中,打開文件時偏移量為0,每次的讀寫操作都會使偏移量增加;
void *private_data:
struct file_operations *fops:打開文件後,內核會把fops存放在這裡,以後的操作就在這裡在這裡找函數了
unsigned int f_flags : 文件標志,如阻塞非阻塞等;
struct dentry *f_dentry:文件對應的目錄項。可以用filp->f_dentry->d_inode的方式來訪問索引節點。
[code]/** * container_of - cast a member of a structure out to the containing structure * @ptr: the pointer to the member.成員的指針 * @type: the type of the container struct this is embedded in.結構體類型 * @member: the name of the member within the struct.成員 * */ #define container_of(ptr, type, member) ({ \ const typeof(((type *)0)->member) * __mptr = (ptr); \ (type *)((char *)__mptr - offsetof(type, member)); })通過一個結構體成員的指針,獲得這個結構體的指針