首页 > 代码库 > inode结构体
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;
若是设备文件,此成员记录设备的设备号
1 struct inode { 2 /* RCU path lookup touches following: */ 3 umode_t i_mode; 4 uid_t i_uid; 5 gid_t i_gid; 6 const struct inode_operations *i_op; 7 struct super_block *i_sb; 8 9 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 10 unsigned int i_flags; 11 unsigned long i_state; 12 #ifdef CONFIG_SECURITY 13 void *i_security; 14 #endif 15 struct mutex i_mutex; 16 17 18 unsigned long dirtied_when; /* jiffies of first dirtying */ 19 20 struct hlist_node i_hash; 21 struct list_head i_wb_list; /* backing dev IO list */ 22 struct list_head i_lru; /* inode LRU list */ 23 struct list_head i_sb_list; 24 union { 25 struct list_head i_dentry; 26 struct rcu_head i_rcu; 27 }; 28 unsigned long i_ino; 29 atomic_t i_count; 30 unsigned int i_nlink; 31 dev_t i_rdev; 32 unsigned int i_blkbits; 33 u64 i_version; 34 loff_t i_size; 35 #ifdef __NEED_I_SIZE_ORDERED 36 seqcount_t i_size_seqcount; 37 #endif 38 struct timespec i_atime; 39 struct timespec i_mtime; 40 struct timespec i_ctime; 41 blkcnt_t i_blocks; 42 unsigned short i_bytes; 43 struct rw_semaphore i_alloc_sem; 44 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 45 struct file_lock *i_flock; 46 struct address_space *i_mapping; 47 struct address_space i_data; 48 #ifdef CONFIG_QUOTA 49 struct dquot *i_dquot[MAXQUOTAS]; 50 #endif 51 struct list_head i_devices; 52 union { 53 struct pipe_inode_info *i_pipe; 54 struct block_device *i_bdev; 55 struct cdev *i_cdev; 56 }; 57 58 __u32 i_generation; 59 60 #ifdef CONFIG_FSNOTIFY 61 __u32 i_fsnotify_mask; /* all events this inode cares about */ 62 struct hlist_head i_fsnotify_marks; 63 #endif 64 65 #ifdef CONFIG_IMA 66 atomic_t i_readcount; /* struct files open RO */ 67 #endif 68 atomic_t i_writecount; 69 #ifdef CONFIG_FS_POSIX_ACL 70 struct posix_acl *i_acl; 71 struct posix_acl *i_default_acl; 72 #endif 73 void *i_private; /* fs or device private pointer */ 74 };
inode结构体
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。