ext4 笔记三(结构体描述)

本文是关于ext4文件系统的笔记,重点介绍了super block、group descriptor、inode和dir的结构体内容。super block在ext3基础上扩展以支持更大存储;group descriptor包含block bitmap、inode bitmap和inode table的块地址信息;inode用于存储每个节点的属性和块地址;dir结构体详细解析目录信息,根目录在inode表的第二个位置,子目录在根目录内容中定义。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Super block

只是在ext3的基础上扩展了一些字段,可以支持更大的硬盘和更大的文件。

如:s_blocks_count  修改为s_blocks_count_lo和s_blocks_count_hi

结构体如下:

/*
 *Structure of the super block
 */
struct ext4_super_block {
/*00*/ __le32  s_inodes_count;         /* Inodes count文件系统中inode的总数*/
       __le32  s_blocks_count_lo;      /* Blocks count文件系统中块的总数*/
       __le32  s_r_blocks_count_lo;    /* Reserved blocks count保留块的总数*/
       __le32  s_free_blocks_count_lo; /*Free blocks count未使用的块的总数(包括保留块)*/
/*10*/ __le32  s_free_inodes_count;    /* Free inodes count未使用的inode的总数*/
       __le32  s_first_data_block;     /* First Data Block第一块块ID,在小于1KB的文件系统中为0,大于1KB的文件系统中为1*/
       __le32  s_log_block_size;       /* Block size用以计算块的大小(1024算术左移该值即为块大小)(0=1K, 1=2K, 2=4K) */
       __le32  s_obso_log_frag_size;   /* Obsoleted fragment size用以计算段大小(为正则1024算术左移该值,否则右移)*/
/*20*/ __le32  s_blocks_per_group;     /* # Blocks per group每个块组中块的总数*/
       __le32  s_obso_frags_per_group; /*Obsoleted fragments per group每个块组中段的总数*/
       __le32  s_inodes_per_group;     /* # Inodes per group每个块组中inode的总数*/
       __le32  s_mtime;                /* Mount time POSIX中定义的文件系统装载时间*/
/*30*/ __le32  s_wtime;                /* Write time POSIX中定义的文件系统最近被写入的时间*/
       __le16  s_mnt_count;            /* Mount count最近一次完整校验后被装载的次数*/
       __le16  s_max_mnt_count;        /* Maximal mount count在进行完整校验前还能被装载的次数*/
       __le16  s_magic;                /* Magic signature文件系统标志*/
       __le16  s_state;                /* File system state文件系统的状态*/
       __le16  s_errors;               /* Behaviour when detectingerrors文件系统发生错误时驱动程序应该执行的操作*/
       __le16  s_minor_rev_level;      /* minor revision level局部修订级别*/
/*40*/ __le32  s_lastcheck;            /* time of last check POSIX中定义的文件系统最近一次检查的时间*/
       __le32  s_checkinterval;        /* max. time between checks POSIX中定义的文件系统最近检查的最大时间间隔*/
       __le32  s_creator_os;           /* OS生成该文件系统的操作系统*/
       __le32  s_rev_level;            /* Revision level修订级别*/
/*50*/ __le16  s_def_resuid;           /* Default uid for reserved blocks报留块的默认用户ID */
       __le16  s_def_resgid;           /* Default gid for reserved blocks保留块的默认组ID */
       /*
        * These fields are for EXT4_DYNAMIC_REV superblocks only.
        *
        * Note: the difference between the compatible feature set and
        * the incompatible feature set is that if there is a bit set
        * in the incompatible feature set tha
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值