Linux的虚拟文件系统

1.几个重要的数据结构:
<超级块>: 一个已安装的文件系统对应一个超级块

1318struct super_block {
1319        struct list_head        s_list;         /* Keep this first */
1320        dev_t                   s_dev;          /* search index; _not_ kdev_t */
1321        unsigned char           s_dirt;
1322        unsigned char           s_blocksize_bits;
1323        unsigned long           s_blocksize;
1324        loff_t                  s_maxbytes;     /* Max file size */
1325        struct file_system_type *s_type;
1326        const struct super_operations   *s_op;
…… ……
1330        unsigned long           s_flags;
1332        struct dentry           *s_root;
1335        int                     s_count;
1342        struct list_head        s_inodes;       /* all inodes */
1347        struct list_head        s_files;
1353        struct block_device     *s_bdev;
1357        struct quota_info       s_dquot;        /* Diskquota specific options */
1362        char s_id[32];                          /* Informational name */
…… ……
1388};

字段解释:
s_list: 系统中所有的超级块组成的双向链表
s_dev:  超级块所描述的系统所在的设备号
s_type: 超级块所描述的文件系统的系统类型
s_op:   操作函数指针
s_root: 超级块所描述的系统的根目录目录项
s_count:超级块的引用计数
s_inodes: 该文件系统的所有索引结点组成的链表的链表头
s_files: 该文件系统所有打开文件的文件描述符链表, 3.13版本中没有看见
s_id: 超级块的名称

<索引结点>:磁盘中的一个文件对应一个索引结点

 725struct inode {
 726        struct hlist_node       i_hash;
 727        struct list_head        i_list;         /* backing dev IO list */
 729        struct list_head        i_dentry;
 730        unsigned long           i_ino;
 731        atomic_t                i_count;
 732        unsigned int            i_nlink;
 733        uid_t                   i_uid;
 734        gid_t                   i_gid;
 735        dev_t                   i_rdev;
 736        unsigned int            i_blkbits;
 737        u64                     i_version;
 738        loff_t                  i_size;
…… ……
 742        struct timespec         i_atime;
 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值