zoukankan      html  css  js  c++  java
  • inode结构体

    参考: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;

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

     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 };
  • 相关阅读:
    Python 远程开机
    Python 爬虫利器 Selenium
    Python爬虫——Python 岗位分析报告
    Python 爬虫入门(二)——爬取妹子图
    Python 爬虫入门(一)——爬取糗百
    边缘计算—你了解吗?
    关于图片适配不同尺寸的image View(实战)
    HTML页面转换为Sharepoint母版页(实战)
    SharePoint中你不知道的图片库(实战)
    Sharepoint 2013搜索服务配置总结(实战)
  • 原文地址:https://www.cnblogs.com/yangjiguang/p/6030489.html
Copyright © 2011-2022 走看看