- 2
- 0
- 约7.91千字
- 约 6页
- 2016-02-25 发布于江苏
- 举报
Linux+2.6.17.9内核文件系统调用详解.doc
Linux 2.6.17.9内核文件系统调用详解本部分主要讲述的是文件I/O操作的2.6.17.9内核版本实现,包括了主要的数据结构、宏定义和函数流程。以下分别讲述open,create,close,read,write,lseek系统调用。1 重要数据结构1.1 struct filestruct file {? ? /*? ? * fu_list becomes invalid after file_free is called and queued via? ? * fu_rcuhead for RCU freeing? ? */? ? union {? ? ? ? struct list_head? ? fu_list; //文件链表指针? ? ? ? struct rcu_head? ? fu_rcuhead; //rcu链表? ? } f_u;? ? struct dentry? ? ? ? *f_dentry; // 文件对应的目录结构? ? struct vfsmount? ? ? ? *f_vfsmnt; // 虚拟文件系统挂载点? ? const struct file_operations? ? *f_op; // 文件操作函数指针? ? atomic_t? ? ? ? f_count; // 引用计数? ? unsigned int? ? ? ? f_flags;? ? mode_t? ? ? ? ? ? f_mode; // 文件模式? ? loff_t? ? ? ? ? ? f_pos; // 文件offset? ? struct fown_struct? ? f_owner; //文件owner 结构? ? unsigned int? ? ? ? f_uid, f_gid;//文件用户id,组id? ? struct file_ra_state? ? f_ra; // 跟踪上次文件操作状态的结构指针? ? unsigned long? ? ? ? f_version;? ? void? ? ? ? ? ? *f_security; // hook 文件操作的security结构指针? ? /* needed for tty driver, and maybe others */? ? void? ? ? ? ? ? *private_data; // tty 驱动器所需数据#ifdef CONFIG_EPOLL? ? /* Used by fs/eventpoll.c to link all the hooks to this file */? ? struct list_head? ? f_ep_links; // EPOLL 机制检测所需链表结构? ? spinlock_t? ? ? ? f_ep_lock; // 兼容早期gcc bug 的标志#endif /* #ifdef CONFIG_EPOLL */? ? struct address_space? ? *f_mapping; // 地址映射表};1.2 struct fown_structstruct fown_struct {? ? rwlock_t lock;? ? ? ? ? /* protects pid, uid, euid fields */? ? int pid;? ? ? ? /* pid or -pgrp where SIGIO should be sent */? ? uid_t uid, euid;? ? /* uid/euid of process setting the owner */? ? void *security; /*hook 文件操作的security结构指针*/? ? int signum;? ? ? ? /* posix.1b rt signal to be delivered on IO */};1.3 struct file_ra_state/** Track a single files readahead state*/struct file_ra_state {? ? unsigned long start;? ? ? ? /* Current window */? ? unsigned long size;? ? unsigned long flags;? ? ? ? /* ra flags RA_FLAG_xxx*/? ? unsigned long cache_hit;? ? /* cache hit count*/? ? unsigned long pr
您可能关注的文档
最近下载
- 2013年黑龙江省高考数学试卷(理科)(全国新课标Ⅱ).docx VIP
- 深度解析(2026)《SYT 5679-2017钻井液用降滤失剂 褐煤树脂 SPNH》.pptx VIP
- 12J201 平屋面建筑构造图集.docx VIP
- 社会调查研究计划书.docx VIP
- 深度解析(2026)《SYT 5092-2017钻井液用降滤失剂 磺化褐煤 SMC》.pptx VIP
- 倍的认识(刘松).ppt VIP
- 2021年黑龙江省龙东地区中考数学真题试卷(含答案解析).docx VIP
- 教学实录-倍的认识刘松.docx VIP
- 华为投资控股有限公司2023年年度报告-华为.pdf VIP
- 石墨电极制造性及使用.ppt VIP
原创力文档

文档评论(0)