⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ext2_fs.h.txt

📁 linux内核学习笔记 希望想看的人可以很快下载到
💻 TXT
字号:
any problems,send mails to sindybear@163.com


相关文件
	/linux/fs.h
	/linux/ext2_fs_sb.h


//ext2文件系统的最大块大小是4K,最小1K
#define EXT2_MIN_BLOCK_SIZE             1024
#define EXT2_MAX_BLOCK_SIZE             4096


#define EXT2_BAD_INO             1      /* Bad blocks inode */
#define EXT2_ROOT_INO            2      /* Root inode */
#define EXT2_ACL_IDX_INO         3      /* ACL inode */
#define EXT2_ACL_DATA_INO        4      /* ACL inode */
#define EXT2_BOOT_LOADER_INO     5      /* Boot loader inode */
#define EXT2_UNDEL_DIR_INO       6      /* Undelete directory inode */

/* 第一个非保留的inode节点的number号 */
#define EXT2_GOOD_OLD_FIRST_INO 11



/*
 * ext2文件系统的超级块,这个超级块是写在磁盘上的,当从磁盘上读出来以后,使用它可以填充ext2_sb_info
 * 结构。
 */
struct ext2_super_block {
        __u32   s_inodes_count;         /* 整个文件系统Inodes的总数量 */
        __u32   s_blocks_count;         /* 文件系统的所有块数量 */
        __u32   s_r_blocks_count;       /* 保留的块数 */
        __u32   s_free_blocks_count;    /* 空闲的块数 */
        __u32   s_free_inodes_count;    /* 空闲的inode节点数 */
        __u32   s_first_data_block;     /* 第一次使用的块号,一定是1,也就是0组的超级块号 */
        __u32   s_log_block_size;       /* 块大小 以1024字节为单位,2的s_log_block_size次方*/
        __s32   s_log_frag_size;        /* 片大小 同s_log_block_size,没实现 */
        __u32   s_blocks_per_group;     /* 每组中的块数,他和s_blocks_count不一样,那是实际的块数*/
        __u32   s_frags_per_group;      /* 每组中的片数 */
        __u32   s_inodes_per_group;     /* 每组中的inode节点数 一般是376个 */
        __u32   s_mtime;                /* 最后一次安装时间 */
        __u32   s_wtime;                /* 最后一次写操作的时间 */
        __u16   s_mnt_count;            /* 安装操作的次数 */
        __s16   s_max_mnt_count;        /* ??? */
        __u16   s_magic;                /* Magic signature */
        __u16   s_state;                /* File system state */
        __u16   s_errors;               /* Behaviour when detecting errors */
        __u16   s_minor_rev_level;      /* minor revision level */
        __u32   s_lastcheck;            /* time of last check */
        __u32   s_checkinterval;        /* max. time between checks */
        __u32   s_creator_os;           /* OS */
        __u32   s_rev_level;            /* 版本号 level */
        __u16   s_def_resuid;           /* Default uid for reserved blocks */
        __u16   s_def_resgid;           /* Default gid for reserved blocks */
        /*
         * These fields are for EXT2_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 that the kernel doesn't
         * know about, it should refuse to mount the filesystem.
         *
         * e2fsck's requirements are more strict; if it doesn't know
         * about a feature in either the compatible or incompatible
         * feature set, it must abort and not try to meddle with
         * things it doesn't understand...
         */
        __u32   s_first_ino;            /* First non-reserved inode */
        __u16   s_inode_size;           /* size of inode structure */
        __u16   s_block_group_nr;       /* block group # of this superblock */
        __u32   s_feature_compat;       /* compatible feature set */
        __u32   s_feature_incompat;     /* incompatible feature set */
        __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
        __u8    s_uuid[16];             /* 128-bit uuid for volume */
        char    s_volume_name[16];      /* volume name */
        char    s_last_mounted[64];     /* directory where last mounted */
        __u32   s_algorithm_usage_bitmap; /* For compression */
        /*
         * Performance hints.  Directory preallocation should only
         * happen if the EXT2_COMPAT_PREALLOC flag is on.
         */
        __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
        __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
        __u16   s_padding1;
        __u32   s_reserved[204];        /* Padding to the end of the block */
};


//ext2文件系统的组描述符结构
struct ext2_group_desc
{
        __u32   bg_block_bitmap;                /* 块位图的块号,可以直接定位块位图 */
        __u32   bg_inode_bitmap;                /* 存储inode位图的块号 */
        __u32   bg_inode_table;         /* 第一个索引节点表块的块号 */
        __u16   bg_free_blocks_count;   /* Free blocks count */
        __u16   bg_free_inodes_count;   /* Free inodes count */
        __u16   bg_used_dirs_count;     /* Directories count */
        __u16   bg_pad;			/* 字对齐填补 */
        __u32   bg_reserved[3];
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -