1、struct file

这个结构体定义在  linuxsource/include/linux/fs.h 中第960行左右

具体成员如下:

 struct 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;
} f_u;
struct path f_path;
#define f_dentry f_path.dentry
#define f_vfsmnt f_path.mnt
const struct file_operations *f_op;
spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */
#ifdef CONFIG_SMP
int f_sb_list_cpu;
#endif
atomic_long_t f_count;
unsigned int f_flags;
fmode_t f_mode;
loff_t f_pos;
struct fown_struct f_owner;
const struct cred *f_cred;
struct file_ra_state f_ra; u64 f_version;
#ifdef CONFIG_SECURITY
void *f_security;
#endif
/* needed for tty driver, and maybe others */
void *private_data; #ifdef CONFIG_EPOLL
/* Used by fs/eventpoll.c to link all the hooks to this file */
struct list_head f_ep_links;
#endif /* #ifdef CONFIG_EPOLL */
struct address_space *f_mapping;
#ifdef CONFIG_DEBUG_WRITECOUNT
unsigned long f_mnt_write_state;
#endif
};

从内核来看,每一个打开的文件都需要有一个file结构体来描述它

具体查看

http://blog.csdn.net/wangchaoxjtuse/article/details/6036684

2、struct inode

  索引节点对象由inode结构体表示,定义文件在linux/fs.h中。

linux 中每一个文件都需要有一个inode节点来描述

 

 struct inode {
  struct hlist_node i_hash; 哈希表
  struct list_head i_list; 索引节点链表
  struct list_head i_dentry; 目录项链表
  unsigned long i_ino; 节点号
  atomic_t i_count; 引用记数
  umode_t i_mode; 访问权限控制
  unsigned int i_nlink; 硬链接数
  uid_t i_uid; 使用者id
  gid_t i_gid; 使用者id组
  kdev_t i_rdev; 实设备标识符
  loff_t i_size; 以字节为单位的文件大小
  struct timespec i_atime; 最后访问时间
  struct timespec i_mtime; 最后修改(modify)时间
  struct timespec i_ctime; 最后改变(change)时间
  unsigned int i_blkbits; 以位为单位的块大小
  unsigned long i_blksize; 以字节为单位的块大小
  unsigned long i_version; 版本号
  unsigned long i_blocks; 文件的块数
  unsigned short i_bytes; 使用的字节数
  spinlock_t i_lock; 自旋锁
  struct rw_semaphore i_alloc_sem; 索引节点信号量
  struct inode_operations *i_op; 索引节点操作表
  struct file_operations *i_fop; 默认的索引节点操作
  struct super_block *i_sb; 相关的超级块
  struct file_lock *i_flock; 文件锁链表
  struct address_space *i_mapping; 相关的地址映射
  struct address_space i_data; 设备地址映射
  struct dquot *i_dquot[MAXQUOTAS];节点的磁盘限额
  struct list_head i_devices; 块设备链表
  struct pipe_inode_info *i_pipe; 管道信息
  struct block_device *i_bdev; 块设备驱动
  unsigned long i_dnotify_mask;目录通知掩码
  struct dnotify_struct *i_dnotify; 目录通知
  unsigned long i_state; 状态标志
  unsigned long dirtied_when;首次修改时间
  unsigned int i_flags; 文件系统标志
  unsigned char i_sock; 套接字
  atomic_t i_writecount; 写者记数
  void *i_security; 安全模块
  __u32 i_generation; 索引节点版本号
  union {
  void *generic_ip;文件特殊信息
  } u;
  };

1、Linux驱动重要的数据结构的更多相关文章

  1. Linux驱动学习之常用的模块操作命令

    1.常用的模块操作命令 (1)lsmod(list module,将模块列表显示),功能是打印出当前内核中已经安装的模块列表 (2)insmod(install module,安装模块),功能是向当前 ...

  2. Linux驱动学习步骤(转载)

    1. 学会写简单的makefile 2. 编一应用程序,可以用makefile跑起来 3. 学会写驱动的makefile 4. 写一简单char驱动,makefile编译通过,可以insmod, ls ...

  3. 迅为4412开发板Linux驱动教程——总线_设备_驱动注册流程详解

    本文转自:http://www.topeetboard.com 视频下载地址: 驱动注册:http://pan.baidu.com/s/1i34HcDB 设备注册:http://pan.baidu.c ...

  4. 编写linux驱动所用到的头文件(转)

    转自:http://blog.csdn.net/lufeiop02/article/details/6448497 关于linux驱动(应用)程序头文件使用 收藏 驱动程序: #include < ...

  5. linux驱动之I2C

    include/linux/i2c.h struct i2c_msg;struct i2c_algorithm;struct i2c_adapter;struct i2c_client;struct ...

  6. linux驱动面试题目汇总

    http://blog.csdn.net/blueice8601/article/details/7666427 1.linux驱动分类 2.信号量与自旋锁 3.platform总线设备及总线设备如何 ...

  7. Linux驱动开发学习的一些必要步骤

      1. 学会写简单的makefile 2. 编一应用程序,可以用makefile跑起来 3. 学会写驱动的makefile 4. 写一简单char驱动,makefile编译通过,可以insmod, ...

  8. 【linux驱动】linux驱动总览

    欢迎转载,转载时需保留作者信息,谢谢. 邮箱:tangzhongp@163.com 博客园地址:http://www.cnblogs.com/embedded-tzp Csdn博客地址:http:// ...

  9. linux驱动之中断处理过程C程序部分

    当发生中断之后,linux系统在汇编阶段经过一系列跳转,最终跳转到asm_do_IRQ()函数,开始C程序阶段的处理.在汇编阶段,程序已经计算出发生中断的中断号irq,这个关键参数最终传递给asm_d ...

随机推荐

  1. jms的俩种模式

    package com.jiangchong.job; import java.util.Date; import javax.jms.Connection; import javax.jms.Con ...

  2. (分享)根据IP获取地理位置(百度API)

    说明: 本程序调用的百度地图接口 http://lbsyun.baidu.com/index.php?title=webapi/high-acc-ip#h. 使用C#语言+VS2015 IDE开发 效 ...

  3. oracle的over函数应用(转载)

    摘自: http://www.poluoluo.com/jzxy/201004/81921.html 百度文库也记载了Oracle中over()分析函数的用法 在泡坛子的时候中无意中发现了这个函数,才 ...

  4. YCSB测试Mysql,MongoDB,TokuMX,Couchbase性能

    测试是由同事完成的,这里只做收藏. 测试说明: 1.数据量为3kw记录,每条记录11个字段,一个为主键,主键为字符类型,类似:user****,后续为数值 其他10字段为字符类型,100字符,记录长度 ...

  5. delphi数据类型及占用的字节数 C++ 对应数据类型

    delphi byte:1个字节. int/Integer: long: long long:8字节,64位 shortInt:2字节,16位 LongInt:4字节,32位 Int64:8字节,64 ...

  6. DevExpress.XtraGrid.GridControl 实现自定义tooltip

    DevExpress.XtraGrid.GridControl 控件默认的tooltip显示的每一个单元格的文本值,但是实际工作中会出现各种需求.我这里就有一个列是折扣率显示的值是0-1之间的两位小数 ...

  7. asp.net mvc return file result

    asp.net mvc返回文件: public ActionResult ExportReflection(string accessToken) { var reflections = GetCms ...

  8. 使用JSONObject遇到的问题,java.lang.NoClassDefFoundError: net/sf/json/JSONObject

    先是报 java.lang.NoClassDefFoundError: net/sf/json/JSONObject 这个错误, 打开项目属性找到java build path中的libaries,找 ...

  9. 动态添加input标签

    <style type="text/css">        .delete_attach        {            padding-left: 18px ...

  10. 在做基于LBS应用的一些随笔

    公司做了一个基于LBS的APP,在做服务端的时候出现了一些注意事项,还是记录下把. 首先是关于坐标: 弧长公式:L=nπr/180°或l=|α|r.地球半径大致是6400千米.以纬度0.000001为 ...