Changeset View
Changeset View
Standalone View
Standalone View
fs/ext2fs/ext2fs.h
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
* In-Memory Superblock | * In-Memory Superblock | ||||
*/ | */ | ||||
struct m_ext2fs { | struct m_ext2fs { | ||||
struct ext2fs * e2fs; | struct ext2fs * e2fs; | ||||
char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */ | char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */ | ||||
char e2fs_ronly; /* mounted read-only flag */ | char e2fs_ronly; /* mounted read-only flag */ | ||||
char e2fs_fmod; /* super block modified flag */ | char e2fs_fmod; /* super block modified flag */ | ||||
uint64_t e2fs_bcount; /* blocks count */ | |||||
uint64_t e2fs_rbcount; /* reserved blocks count */ | |||||
uint64_t e2fs_fbcount; /* free blocks count */ | |||||
uint32_t e2fs_bsize; /* Block size */ | uint32_t e2fs_bsize; /* Block size */ | ||||
uint32_t e2fs_bshift; /* calc of logical block no */ | uint32_t e2fs_bshift; /* calc of logical block no */ | ||||
uint32_t e2fs_bpg; /* Number of blocks per group */ | uint32_t e2fs_bpg; /* Number of blocks per group */ | ||||
int64_t e2fs_qbmask; /* = s_blocksize -1 */ | int64_t e2fs_qbmask; /* = s_blocksize -1 */ | ||||
uint32_t e2fs_fsbtodb; /* Shift to get disk block */ | uint32_t e2fs_fsbtodb; /* Shift to get disk block */ | ||||
uint32_t e2fs_ipg; /* Number of inodes per group */ | uint32_t e2fs_ipg; /* Number of inodes per group */ | ||||
uint32_t e2fs_ipb; /* Number of inodes per block */ | uint32_t e2fs_ipb; /* Number of inodes per block */ | ||||
uint32_t e2fs_itpg; /* Number of inode table per group */ | uint32_t e2fs_itpg; /* Number of inode table per group */ | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#define EXT2F_COMPAT_SUPP EXT2F_COMPAT_DIRHASHINDEX | #define EXT2F_COMPAT_SUPP EXT2F_COMPAT_DIRHASHINDEX | ||||
#define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ | #define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ | ||||
EXT2F_ROCOMPAT_LARGEFILE | \ | EXT2F_ROCOMPAT_LARGEFILE | \ | ||||
EXT2F_ROCOMPAT_GDT_CSUM | \ | EXT2F_ROCOMPAT_GDT_CSUM | \ | ||||
EXT2F_ROCOMPAT_DIR_NLINK | \ | EXT2F_ROCOMPAT_DIR_NLINK | \ | ||||
EXT2F_ROCOMPAT_HUGE_FILE | \ | EXT2F_ROCOMPAT_HUGE_FILE | \ | ||||
EXT2F_ROCOMPAT_EXTRA_ISIZE) | EXT2F_ROCOMPAT_EXTRA_ISIZE) | ||||
#define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE | #define EXT2F_INCOMPAT_SUPP (EXT2F_INCOMPAT_FTYPE | \ | ||||
EXT2F_INCOMPAT_64BIT) | |||||
#define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_EXTENTS | \ | #define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_EXTENTS | \ | ||||
kevlo: Don't remove EXT2F_INCOMPAT_FLEX_BG. It still couldn't mount a ext4 file
system that is… | |||||
EXT2F_INCOMPAT_RECOVER | \ | EXT2F_INCOMPAT_RECOVER) | ||||
EXT2F_INCOMPAT_FLEX_BG | \ | |||||
EXT2F_INCOMPAT_META_BG ) | |||||
/* Assume that user mode programs are passing in an ext2fs superblock, not | /* Assume that user mode programs are passing in an ext2fs superblock, not | ||||
* a kernel struct super_block. This will allow us to call the feature-test | * a kernel struct super_block. This will allow us to call the feature-test | ||||
* macros from user land. */ | * macros from user land. */ | ||||
#define EXT2_SB(sb) (sb) | #define EXT2_SB(sb) (sb) | ||||
/* | /* | ||||
* Feature set definitions | * Feature set definitions | ||||
Show All 31 Lines | struct ext2_gd { | ||||
uint16_t ext2bgd_nifree; /* number of free inodes */ | uint16_t ext2bgd_nifree; /* number of free inodes */ | ||||
uint16_t ext2bgd_ndirs; /* number of directories */ | uint16_t ext2bgd_ndirs; /* number of directories */ | ||||
uint16_t ext4bgd_flags; /* block group flags */ | uint16_t ext4bgd_flags; /* block group flags */ | ||||
uint32_t ext4bgd_x_bitmap; /* snapshot exclusion bitmap loc. */ | uint32_t ext4bgd_x_bitmap; /* snapshot exclusion bitmap loc. */ | ||||
uint16_t ext4bgd_b_bmap_csum; /* block bitmap checksum */ | uint16_t ext4bgd_b_bmap_csum; /* block bitmap checksum */ | ||||
uint16_t ext4bgd_i_bmap_csum; /* inode bitmap checksum */ | uint16_t ext4bgd_i_bmap_csum; /* inode bitmap checksum */ | ||||
uint16_t ext4bgd_i_unused; /* unused inode count */ | uint16_t ext4bgd_i_unused; /* unused inode count */ | ||||
uint16_t ext4bgd_csum; /* group descriptor checksum */ | uint16_t ext4bgd_csum; /* group descriptor checksum */ | ||||
uint32_t ext4bgd_b_bitmap_hi; /* high bits of blocks bitmap block */ | |||||
uint32_t ext4bgd_i_bitmap_hi; /* high bits of inodes bitmap block */ | |||||
uint32_t ext4bgd_i_tables_hi; /* high bits of inodes table block */ | |||||
uint16_t ext4bgd_nbfree_hi; /* high bits of number of free blocks */ | |||||
uint16_t ext4bgd_nifree_hi; /* high bits of number of free inodes */ | |||||
uint16_t ext4bgd_ndirs_hi; /* high bits of number of directories */ | |||||
uint16_t ext4bgd_i_unused_hi; /* high bits of unused inode count */ | |||||
uint32_t ext4bgd_x_bitmap_hi; /* high bits of snapshot exclusion */ | |||||
uint16_t ext4bgd_b_bmap_csum_hi;/* high bits of block bitmap checksum */ | |||||
uint16_t ext4bgd_i_bmap_csum_hi;/* high bits of inode bitmap checksum */ | |||||
uint32_t ext4bgd_reserved; | |||||
}; | }; | ||||
/* EXT2FS metadata is stored in little-endian byte order. These macros | #define E2FS_REV0_GD_SIZE (sizeof(struct ext2_gd) / 2) | ||||
* help reading it. | |||||
*/ | |||||
#define e2fs_cgload(old, new, size) memcpy((new), (old), (size)); | |||||
#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size)); | |||||
/* | /* | ||||
* Macro-instructions used to manage several block sizes | * Macro-instructions used to manage several block sizes | ||||
*/ | */ | ||||
#define EXT2_MIN_BLOCK_LOG_SIZE 10 | #define EXT2_MIN_BLOCK_LOG_SIZE 10 | ||||
#define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize) | #define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize) | ||||
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(uint32_t)) | #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(uint32_t)) | ||||
#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->e2fs_isize) | #define EXT2_INODE_SIZE(s) (EXT2_SB(s)->e2fs_isize) | ||||
Show All 16 Lines |
Don't remove EXT2F_INCOMPAT_FLEX_BG. It still couldn't mount a ext4 file
system that is created from scratch because the flex_bg feature is enabled by
default. Works for me on amd64 apart from a EXT2F_INCOMPAT_FLEX_BG thing.