参考:Linux字符设备中的两个重要结构体(file、inode)

inode分为内存中的inode和文件系统中的inode,为了避免混淆,我们称前者为VFS inode, 而后者以EXT2为代表,我们称为Ext2 inod。这里说明的是VFS inode。

重要成员:

1. struct cdev *i_cdev;

若是字符设备,为其对应的cdev结构体指针。

2. struct block_device *i_bdev;

若是块设备,为其对应的block_device结构体指针

3. dev_t i_rdev;

若是设备文件,此成员记录设备的设备号

 struct inode {
/* RCU path lookup touches following: */
umode_t i_mode;
uid_t i_uid;
gid_t i_gid;
const struct inode_operations *i_op;
struct super_block *i_sb; spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
unsigned int i_flags;
unsigned long i_state;
#ifdef CONFIG_SECURITY
void *i_security;
#endif
struct mutex i_mutex; unsigned long dirtied_when; /* jiffies of first dirtying */ struct hlist_node i_hash;
struct list_head i_wb_list; /* backing dev IO list */
struct list_head i_lru; /* inode LRU list */
struct list_head i_sb_list;
union {
struct list_head i_dentry;
struct rcu_head i_rcu;
};
unsigned long i_ino;
atomic_t i_count;
unsigned int i_nlink;
dev_t i_rdev;
unsigned int i_blkbits;
u64 i_version;
loff_t i_size;
#ifdef __NEED_I_SIZE_ORDERED
seqcount_t i_size_seqcount;
#endif
struct timespec i_atime;
struct timespec i_mtime;
struct timespec i_ctime;
blkcnt_t i_blocks;
unsigned short i_bytes;
struct rw_semaphore i_alloc_sem;
const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
struct file_lock *i_flock;
struct address_space *i_mapping;
struct address_space i_data;
#ifdef CONFIG_QUOTA
struct dquot *i_dquot[MAXQUOTAS];
#endif
struct list_head i_devices;
union {
struct pipe_inode_info *i_pipe;
struct block_device *i_bdev;
struct cdev *i_cdev;
}; __u32 i_generation; #ifdef CONFIG_FSNOTIFY
__u32 i_fsnotify_mask; /* all events this inode cares about */
struct hlist_head i_fsnotify_marks;
#endif #ifdef CONFIG_IMA
atomic_t i_readcount; /* struct files open RO */
#endif
atomic_t i_writecount;
#ifdef CONFIG_FS_POSIX_ACL
struct posix_acl *i_acl;
struct posix_acl *i_default_acl;
#endif
void *i_private; /* fs or device private pointer */
};

最新文章

  1. Windows 10 安装双系统 CentOS 7
  2. SharePoint远程发布Solution
  3. 【Java学习笔记】函数的可变参数
  4. js的动态加载、缓存、更新以及复用(一)
  5. ActiveX 技术疑点 一
  6. CentOS-6.5安装配置JDK-7和JDK-8
  7. Binder机制
  8. android:onKeyDown
  9. 【原创】1、简单理解微信小程序
  10. (一)MYSQL ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.10.210' (111) 解决方法
  11. css的继承和层叠
  12. (第十三周)评论Final发布I
  13. SpringBoot 中 JPA 的使用
  14. HTML5 ----- deviceorientation API
  15. Django:环境搭建
  16. vue全家桶+Koa2开发笔记(4)--redis
  17. weex官方demo weex-hackernews代码解读(上)
  18. 多线程sshd爆破程序代码
  19. 【zzuli-2259】matrix
  20. 測試 battery capacity curve 的負載

热门文章

  1. 抛出异常-throws和throw
  2. c#学习系列之字段(静态,常量,只读)
  3. 我的NopCommerce之旅(4): 定时任务之邮件
  4. 在switch中的case语句中声明变量会被提前
  5. PL/SQL 多表关联UPDATE
  6. STL使用迭代器逆向删除
  7. Web 前端开发代码规范(基础)
  8. 介绍hadoop的好文章
  9. 洛谷 P2068 统计和
  10. kvc to nsdata