file结构体
2016-05-29 23:20
169 查看
定义在include/linux/fs.h
f_pos:loff_t 在所有平台都是 64 位,驱动可以读这个值,如果它需要知道文件中的当前位置,但是正常地不应该改变它
private_data:驱动调用 open 方法之前,你可自由使用这个成员或者忽略它
struct file { union { struct list_head fu_list; //文件对象链表指针linux/include/linux/list.h struct rcu_head fu_rcuhead; //RCU(Read-Copy Update)是Linux 2.6内核中新的锁机制 } f_u; struct path f_path; //包含dentry和mnt两个成员,用于确定文件路径 #define f_dentry f_path.dentry //f_path的成员之一,当前文件的dentry结构 #define f_vfsmnt f_path.mnt //表示当前文件所在文件系统的挂载根目录 const struct file_operations *f_op; //与该文件相关联的操作函数 atomic_t f_count; //文件的引用计数(有多少进程打开该文件) unsigned int f_flags; //对应于open时指定的flag mode_t f_mode; //读写模式:open的mod_t mode参数 off_t f_pos; //该文件在当前进程中的文件偏移量 struct fown_struct f_owner; //该结构的作用是通过信号进行I/O时间通知的数据。 unsigned int f_uid, f_gid; //文件所有者id,所有者组id struct file_ra_state f_ra; //在linux/include/linux/fs.h中定义,文件预读相关 unsigned long f_version; #ifdef CONFIG_SECURITY void *f_security; #endif void *private_data; #ifdef CONFIG_EPOLL struct list_head f_ep_links; spinlock_t f_ep_lock; #endif struct address_space *f_mapping; };
f_pos:loff_t 在所有平台都是 64 位,驱动可以读这个值,如果它需要知道文件中的当前位置,但是正常地不应该改变它
private_data:驱动调用 open 方法之前,你可自由使用这个成员或者忽略它
相关文章推荐
- 小组项目第三周(20145101、20145102、20145124、20145203)
- 新的征途
- 软件工程(二十二)
- 自动生成字母编号
- 【CodeForces】[621B]Wet Shark and Bishops
- 几种不同的分类器
- EventBus的使用(基于EventBus3.0,开发必备)
- 【Codeforces】 -673B - Problems for Round
- 差分约束<基础题练习><我是图论渣TAT>
- 强悍的 Linux —— 权限管理(组及用户管理)
- XTU 1247 Robb's Problem
- CoordinatorLayout配合AppBarLayout,Toolbar和TabLayout的使用
- Linux驱动之Kobject、Kset (二)uevent mdev ktype type
- 2015-2016-2《Java程序设计》团队博客3
- AppCan_3 传统的流式布局 与 弹性盒子
- absolute与relative
- PHP接口简介及使用
- 专业值得信赖——MSDN
- oracle存储过程游标
- 如何使用Maven scope