* Structure of the super block
*/
struct ext4_sblock {
- uint32_t inodes_count; /* I-nodes count */
- uint32_t blocks_count_lo; /* Blocks count */
- uint32_t reserved_blocks_count_lo; /* Reserved blocks count */
- uint32_t free_blocks_count_lo; /* Free blocks count */
- uint32_t free_inodes_count; /* Free inodes count */
- uint32_t first_data_block; /* First Data Block */
- uint32_t log_block_size; /* Block size */
- uint32_t log_frag_size; /* Obsoleted fragment size */
- uint32_t blocks_per_group; /* Number of blocks per group */
- uint32_t frags_per_group; /* Obsoleted fragments per group */
- uint32_t inodes_per_group; /* Number of inodes per group */
- uint32_t mount_time; /* Mount time */
- uint32_t write_time; /* Write time */
- uint16_t mount_count; /* Mount count */
- uint16_t max_mount_count; /* Maximal mount count */
- uint16_t magic; /* Magic signature */
- uint16_t state; /* File system state */
- uint16_t errors; /* Behaviour when detecting errors */
- uint16_t minor_rev_level; /* Minor revision level */
- uint32_t last_check_time; /* Time of last check */
- uint32_t check_interval; /* Maximum time between checks */
- uint32_t creator_os; /* Creator OS */
- uint32_t rev_level; /* Revision level */
- uint16_t def_resuid; /* Default uid for reserved blocks */
- uint16_t def_resgid; /* Default gid for reserved blocks */
-
- /* Fields for EXT4_DYNAMIC_REV superblocks only. */
- uint32_t first_inode; /* First non-reserved inode */
- uint16_t inode_size; /* Size of inode structure */
- uint16_t block_group_index; /* Block group index of this superblock */
- uint32_t features_compatible; /* Compatible feature set */
- uint32_t features_incompatible; /* Incompatible feature set */
- uint32_t features_read_only; /* Readonly-compatible feature set */
- uint8_t uuid[16]; /* 128-bit uuid for volume */
- char volume_name[16]; /* Volume name */
- char last_mounted[64]; /* Directory where last mounted */
- uint32_t algorithm_usage_bitmap; /* For compression */
-
- /*
- * Performance hints. Directory preallocation should only
- * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
- */
- uint8_t s_prealloc_blocks; /* Number of blocks to try to preallocate */
- uint8_t s_prealloc_dir_blocks; /* Number to preallocate for dirs */
- uint16_t s_reserved_gdt_blocks; /* Per group desc for online growth */
-
- /*
- * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
- */
- uint8_t journal_uuid[16]; /* UUID of journal superblock */
- uint32_t journal_inode_number; /* Inode number of journal file */
- uint32_t journal_dev; /* Device number of journal file */
- uint32_t last_orphan; /* Head of list of inodes to delete */
- uint32_t hash_seed[4]; /* HTREE hash seed */
- uint8_t default_hash_version; /* Default hash version to use */
- uint8_t journal_backup_type;
- uint16_t desc_size; /* Size of group descriptor */
- uint32_t default_mount_opts; /* Default mount options */
- uint32_t first_meta_bg; /* First metablock block group */
- uint32_t mkfs_time; /* When the filesystem was created */
- uint32_t journal_blocks[17]; /* Backup of the journal inode */
-
- /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
- uint32_t blocks_count_hi; /* Blocks count */
- uint32_t reserved_blocks_count_hi; /* Reserved blocks count */
- uint32_t free_blocks_count_hi; /* Free blocks count */
- uint16_t min_extra_isize; /* All inodes have at least # bytes */
- uint16_t want_extra_isize; /* New inodes should reserve # bytes */
- uint32_t flags; /* Miscellaneous flags */
- uint16_t raid_stride; /* RAID stride */
- uint16_t mmp_interval; /* # seconds to wait in MMP checking */
- uint64_t mmp_block; /* Block for multi-mount protection */
- uint32_t raid_stripe_width; /* Blocks on all data disks (N * stride) */
- uint8_t log_groups_per_flex; /* FLEX_BG group size */
- uint8_t reserved_char_pad;
- uint16_t reserved_pad;
- uint64_t kbytes_written; /* Number of lifetime kilobytes written */
- uint32_t snapshot_inum; /* I-node number of active snapshot */
- uint32_t snapshot_id; /* Sequential ID of active snapshot */
- uint64_t snapshot_r_blocks_count; /* Reserved blocks for active snapshot's future use */
- uint32_t snapshot_list; /* I-node number of the head of the on-disk snapshot list */
- uint32_t error_count; /* Number of file system errors */
- uint32_t first_error_time; /* First time an error happened */
- uint32_t first_error_ino; /* I-node involved in first error */
- uint64_t first_error_block; /* Block involved of first error */
- uint8_t first_error_func[32]; /* Function where the error happened */
- uint32_t first_error_line; /* Line number where error happened */
- uint32_t last_error_time; /* Most recent time of an error */
- uint32_t last_error_ino; /* I-node involved in last error */
- uint32_t last_error_line; /* Line number where error happened */
- uint64_t last_error_block; /* Block involved of last error */
- uint8_t last_error_func[32]; /* Function where the error happened */
- uint8_t mount_opts[64];
- uint32_t padding[112]; /* Padding to the end of the block */
+ uint32_t inodes_count; /* I-nodes count */
+ uint32_t blocks_count_lo; /* Blocks count */
+ uint32_t reserved_blocks_count_lo; /* Reserved blocks count */
+ uint32_t free_blocks_count_lo; /* Free blocks count */
+ uint32_t free_inodes_count; /* Free inodes count */
+ uint32_t first_data_block; /* First Data Block */
+ uint32_t log_block_size; /* Block size */
+ uint32_t log_frag_size; /* Obsoleted fragment size */
+ uint32_t blocks_per_group; /* Number of blocks per group */
+ uint32_t frags_per_group; /* Obsoleted fragments per group */
+ uint32_t inodes_per_group; /* Number of inodes per group */
+ uint32_t mount_time; /* Mount time */
+ uint32_t write_time; /* Write time */
+ uint16_t mount_count; /* Mount count */
+ uint16_t max_mount_count; /* Maximal mount count */
+ uint16_t magic; /* Magic signature */
+ uint16_t state; /* File system state */
+ uint16_t errors; /* Behaviour when detecting errors */
+ uint16_t minor_rev_level; /* Minor revision level */
+ uint32_t last_check_time; /* Time of last check */
+ uint32_t check_interval; /* Maximum time between checks */
+ uint32_t creator_os; /* Creator OS */
+ uint32_t rev_level; /* Revision level */
+ uint16_t def_resuid; /* Default uid for reserved blocks */
+ uint16_t def_resgid; /* Default gid for reserved blocks */
+
+ /* Fields for EXT4_DYNAMIC_REV superblocks only. */
+ uint32_t first_inode; /* First non-reserved inode */
+ uint16_t inode_size; /* Size of inode structure */
+ uint16_t block_group_index; /* Block group index of this superblock */
+ uint32_t features_compatible; /* Compatible feature set */
+ uint32_t features_incompatible; /* Incompatible feature set */
+ uint32_t features_read_only; /* Readonly-compatible feature set */
+ uint8_t uuid[16]; /* 128-bit uuid for volume */
+ char volume_name[16]; /* Volume name */
+ char last_mounted[64]; /* Directory where last mounted */
+ uint32_t algorithm_usage_bitmap; /* For compression */
+
+ /*
+ * Performance hints. Directory preallocation should only
+ * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
+ */
+ uint8_t s_prealloc_blocks; /* Number of blocks to try to preallocate */
+ uint8_t s_prealloc_dir_blocks; /* Number to preallocate for dirs */
+ uint16_t s_reserved_gdt_blocks; /* Per group desc for online growth */
+
+ /*
+ * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
+ */
+ uint8_t journal_uuid[16]; /* UUID of journal superblock */
+ uint32_t journal_inode_number; /* Inode number of journal file */
+ uint32_t journal_dev; /* Device number of journal file */
+ uint32_t last_orphan; /* Head of list of inodes to delete */
+ uint32_t hash_seed[4]; /* HTREE hash seed */
+ uint8_t default_hash_version; /* Default hash version to use */
+ uint8_t journal_backup_type;
+ uint16_t desc_size; /* Size of group descriptor */
+ uint32_t default_mount_opts; /* Default mount options */
+ uint32_t first_meta_bg; /* First metablock block group */
+ uint32_t mkfs_time; /* When the filesystem was created */
+ uint32_t journal_blocks[17]; /* Backup of the journal inode */
+
+ /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
+ uint32_t blocks_count_hi; /* Blocks count */
+ uint32_t reserved_blocks_count_hi; /* Reserved blocks count */
+ uint32_t free_blocks_count_hi; /* Free blocks count */
+ uint16_t min_extra_isize; /* All inodes have at least # bytes */
+ uint16_t want_extra_isize; /* New inodes should reserve # bytes */
+ uint32_t flags; /* Miscellaneous flags */
+ uint16_t raid_stride; /* RAID stride */
+ uint16_t mmp_interval; /* # seconds to wait in MMP checking */
+ uint64_t mmp_block; /* Block for multi-mount protection */
+ uint32_t raid_stripe_width; /* Blocks on all data disks (N * stride) */
+ uint8_t log_groups_per_flex; /* FLEX_BG group size */
+ uint8_t reserved_char_pad;
+ uint16_t reserved_pad;
+ uint64_t kbytes_written; /* Number of lifetime kilobytes written */
+ uint32_t snapshot_inum; /* I-node number of active snapshot */
+ uint32_t snapshot_id; /* Sequential ID of active snapshot */
+ uint64_t snapshot_r_blocks_count; /* Reserved blocks for active snapshot's future use */
+ uint32_t snapshot_list; /* I-node number of the head of the on-disk snapshot list */
+ uint32_t error_count; /* Number of file system errors */
+ uint32_t first_error_time; /* First time an error happened */
+ uint32_t first_error_ino; /* I-node involved in first error */
+ uint64_t first_error_block; /* Block involved of first error */
+ uint8_t first_error_func[32]; /* Function where the error happened */
+ uint32_t first_error_line; /* Line number where error happened */
+ uint32_t last_error_time; /* Most recent time of an error */
+ uint32_t last_error_ino; /* I-node involved in last error */
+ uint32_t last_error_line; /* Line number where error happened */
+ uint64_t last_error_block; /* Block involved of last error */
+ uint8_t last_error_func[32]; /* Function where the error happened */
+ uint8_t mount_opts[64];
+ uint32_t padding[112]; /* Padding to the end of the block */
} __attribute__((packed));
#define EXT4_FEATURE_COMPAT_SUPP (EXT4_FEATURE_COMPAT_DIR_INDEX)
#define EXT4_FEATURE_INCOMPAT_SUPP \
- (EXT4_FEATURE_INCOMPAT_FILETYPE | \
- EXT4_FEATURE_INCOMPAT_EXTENTS | \
- EXT4_FEATURE_INCOMPAT_64BIT)
+ (EXT4_FEATURE_INCOMPAT_FILETYPE | \
+ EXT4_FEATURE_INCOMPAT_EXTENTS | \
+ EXT4_FEATURE_INCOMPAT_64BIT)
#define EXT4_FEATURE_RO_COMPAT_SUPP \
- (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
- EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
- EXT4_FEATURE_RO_COMPAT_HUGE_FILE | \
- EXT4_FEATURE_RO_COMPAT_LARGE_FILE | \
- EXT4_FEATURE_RO_COMPAT_GDT_CSUM | \
- EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
+ (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
+ EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
+ EXT4_FEATURE_RO_COMPAT_HUGE_FILE | \
+ EXT4_FEATURE_RO_COMPAT_LARGE_FILE | \
+ EXT4_FEATURE_RO_COMPAT_GDT_CSUM | \
+ EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
struct ext4_fs {
- struct ext4_blockdev *bdev;
- struct ext4_sblock sb;
+ struct ext4_blockdev *bdev;
+ struct ext4_sblock sb;
- uint64_t inode_block_limits[4];
- uint64_t inode_blocks_per_level[4];
+ uint64_t inode_block_limits[4];
+ uint64_t inode_blocks_per_level[4];
};
* Structure of a blocks group descriptor
*/
struct ext4_bgroup {
- uint32_t block_bitmap_lo; /* Blocks bitmap block */
- uint32_t inode_bitmap_lo; /* Inodes bitmap block */
- uint32_t inode_table_first_block_lo; /* Inodes table block */
- uint16_t free_blocks_count_lo; /* Free blocks count */
- uint16_t free_inodes_count_lo; /* Free inodes count */
- uint16_t used_dirs_count_lo; /* Directories count */
- uint16_t flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
- uint32_t reserved[2]; /* Likely block/inode bitmap checksum */
- uint16_t itable_unused_lo; /* Unused inodes count */
- uint16_t checksum; /* crc16(sb_uuid+group+desc) */
-
- uint32_t block_bitmap_hi; /* Blocks bitmap block MSB */
- uint32_t inode_bitmap_hi; /* I-nodes bitmap block MSB */
- uint32_t inode_table_first_block_hi; /* I-nodes table block MSB */
- uint16_t free_blocks_count_hi; /* Free blocks count MSB */
- uint16_t free_inodes_count_hi; /* Free i-nodes count MSB */
- uint16_t used_dirs_count_hi; /* Directories count MSB */
- uint16_t itable_unused_hi; /* Unused inodes count MSB */
- uint32_t reserved2[3]; /* Padding */
+ uint32_t block_bitmap_lo; /* Blocks bitmap block */
+ uint32_t inode_bitmap_lo; /* Inodes bitmap block */
+ uint32_t inode_table_first_block_lo; /* Inodes table block */
+ uint16_t free_blocks_count_lo; /* Free blocks count */
+ uint16_t free_inodes_count_lo; /* Free inodes count */
+ uint16_t used_dirs_count_lo; /* Directories count */
+ uint16_t flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
+ uint32_t reserved[2]; /* Likely block/inode bitmap checksum */
+ uint16_t itable_unused_lo; /* Unused inodes count */
+ uint16_t checksum; /* crc16(sb_uuid+group+desc) */
+
+ uint32_t block_bitmap_hi; /* Blocks bitmap block MSB */
+ uint32_t inode_bitmap_hi; /* I-nodes bitmap block MSB */
+ uint32_t inode_table_first_block_hi; /* I-nodes table block MSB */
+ uint16_t free_blocks_count_hi; /* Free blocks count MSB */
+ uint16_t free_inodes_count_hi; /* Free i-nodes count MSB */
+ uint16_t used_dirs_count_hi; /* Directories count MSB */
+ uint16_t itable_unused_hi; /* Unused inodes count MSB */
+ uint32_t reserved2[3]; /* Padding */
} ;
struct ext4_block_group_ref {
- struct ext4_block block;
- struct ext4_bgroup *block_group;
- struct ext4_fs *fs;
- uint32_t index;
- bool dirty;
+ struct ext4_block block;
+ struct ext4_bgroup *block_group;
+ struct ext4_fs *fs;
+ uint32_t index;
+ bool dirty;
};
#define EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE 32
* Structure of an inode on the disk
*/
struct ext4_inode {
- uint16_t mode; /* File mode */
- uint16_t uid; /* Low 16 bits of owner uid */
- uint32_t size_lo; /* Size in bytes */
- uint32_t access_time; /* Access time */
- uint32_t change_inode_time; /* I-node change time */
- uint32_t modification_time; /* Modification time */
- uint32_t deletion_time; /* Deletion time */
- uint16_t gid; /* Low 16 bits of group id */
- uint16_t links_count; /* Links count */
- uint32_t blocks_count_lo; /* Blocks count */
- uint32_t flags; /* File flags */
- uint32_t unused_osd1; /* OS dependent - not used in HelenOS */
- uint32_t blocks[EXT4_INODE_BLOCKS]; /* Pointers to blocks */
- uint32_t generation; /* File version (for NFS) */
- uint32_t file_acl_lo; /* File ACL */
- uint32_t size_hi;
- uint32_t obso_faddr; /* Obsoleted fragment address */
-
- union {
- struct {
- uint16_t blocks_high;
- uint16_t file_acl_high;
- uint16_t uid_high;
- uint16_t gid_high;
- uint32_t reserved2;
- } linux2;
- struct {
- uint16_t reserved1;
- uint16_t mode_high;
- uint16_t uid_high;
- uint16_t gid_high;
- uint32_t author;
- } hurd2;
- } __attribute__ ((packed)) osd2;
-
- uint16_t extra_isize;
- uint16_t pad1;
- uint32_t ctime_extra; /* Extra change time (nsec << 2 | epoch) */
- uint32_t mtime_extra; /* Extra Modification time (nsec << 2 | epoch) */
- uint32_t atime_extra; /* Extra Access time (nsec << 2 | epoch) */
- uint32_t crtime; /* File creation time */
- uint32_t crtime_extra; /* Extra file creation time (nsec << 2 | epoch) */
- uint32_t version_hi; /* High 32 bits for 64-bit version */
+ uint16_t mode; /* File mode */
+ uint16_t uid; /* Low 16 bits of owner uid */
+ uint32_t size_lo; /* Size in bytes */
+ uint32_t access_time; /* Access time */
+ uint32_t change_inode_time; /* I-node change time */
+ uint32_t modification_time; /* Modification time */
+ uint32_t deletion_time; /* Deletion time */
+ uint16_t gid; /* Low 16 bits of group id */
+ uint16_t links_count; /* Links count */
+ uint32_t blocks_count_lo; /* Blocks count */
+ uint32_t flags; /* File flags */
+ uint32_t unused_osd1; /* OS dependent - not used in HelenOS */
+ uint32_t blocks[EXT4_INODE_BLOCKS]; /* Pointers to blocks */
+ uint32_t generation; /* File version (for NFS) */
+ uint32_t file_acl_lo; /* File ACL */
+ uint32_t size_hi;
+ uint32_t obso_faddr; /* Obsoleted fragment address */
+
+ union {
+ struct {
+ uint16_t blocks_high;
+ uint16_t file_acl_high;
+ uint16_t uid_high;
+ uint16_t gid_high;
+ uint32_t reserved2;
+ } linux2;
+ struct {
+ uint16_t reserved1;
+ uint16_t mode_high;
+ uint16_t uid_high;
+ uint16_t gid_high;
+ uint32_t author;
+ } hurd2;
+ } __attribute__ ((packed)) osd2;
+
+ uint16_t extra_isize;
+ uint16_t pad1;
+ uint32_t ctime_extra; /* Extra change time (nsec << 2 | epoch) */
+ uint32_t mtime_extra; /* Extra Modification time (nsec << 2 | epoch) */
+ uint32_t atime_extra; /* Extra Access time (nsec << 2 | epoch) */
+ uint32_t crtime; /* File creation time */
+ uint32_t crtime_extra; /* Extra file creation time (nsec << 2 | epoch) */
+ uint32_t version_hi; /* High 32 bits for 64-bit version */
} __attribute__ ((packed)) ;
#define EXT4_INODE_MODE_FIFO 0x1000
#define EXT4_INODE_ROOT_INDEX 2
struct ext4_inode_ref {
- struct ext4_block block;
- struct ext4_inode *inode;
- struct ext4_fs *fs;
- uint32_t index;
- bool dirty;
+ struct ext4_block block;
+ struct ext4_inode *inode;
+ struct ext4_fs *fs;
+ uint32_t index;
+ bool dirty;
} ;
* Linked list directory entry structure
*/
struct ext4_directory_entry_ll {
- uint32_t inode; /* I-node for the entry */
- uint16_t entry_length; /* Distance to the next directory entry */
- uint8_t name_length; /* Lower 8 bits of name length */
+ uint32_t inode; /* I-node for the entry */
+ uint16_t entry_length; /* Distance to the next directory entry */
+ uint8_t name_length; /* Lower 8 bits of name length */
- union {
- uint8_t name_length_high; /* Higher 8 bits of name length */
- uint8_t inode_type; /* Type of referenced inode (in rev >= 0.5) */
- } __attribute__ ((packed));
+ union {
+ uint8_t name_length_high; /* Higher 8 bits of name length */
+ uint8_t inode_type; /* Type of referenced inode (in rev >= 0.5) */
+ } __attribute__ ((packed));
- uint8_t name[EXT4_DIRECTORY_FILENAME_LEN]; /* Entry name */
+ uint8_t name[EXT4_DIRECTORY_FILENAME_LEN]; /* Entry name */
} __attribute__((packed)) ;
struct ext4_directory_iterator {
- struct ext4_inode_ref *inode_ref;
- struct ext4_block current_block;
- uint64_t current_offset;
- struct ext4_directory_entry_ll *current;
+ struct ext4_inode_ref *inode_ref;
+ struct ext4_block current_block;
+ uint64_t current_offset;
+ struct ext4_directory_entry_ll *current;
};
struct ext4_directory_search_result {
- struct ext4_block block;
- struct ext4_directory_entry_ll *dentry;
+ struct ext4_block block;
+ struct ext4_directory_entry_ll *dentry;
};
/* Structures for indexed directory */
struct ext4_directory_dx_countlimit {
- uint16_t limit;
- uint16_t count;
+ uint16_t limit;
+ uint16_t count;
} ;
struct ext4_directory_dx_dot_entry {
- uint32_t inode;
- uint16_t entry_length;
- uint8_t name_length;
- uint8_t inode_type;
- uint8_t name[4];
+ uint32_t inode;
+ uint16_t entry_length;
+ uint8_t name_length;
+ uint8_t inode_type;
+ uint8_t name[4];
} ;
struct ext4_directory_dx_root_info {
- uint32_t reserved_zero;
- uint8_t hash_version;
- uint8_t info_length;
- uint8_t indirect_levels;
- uint8_t unused_flags;
+ uint32_t reserved_zero;
+ uint8_t hash_version;
+ uint8_t info_length;
+ uint8_t indirect_levels;
+ uint8_t unused_flags;
} ;
struct ext4_directory_dx_entry {
- uint32_t hash;
- uint32_t block;
+ uint32_t hash;
+ uint32_t block;
} ;
struct ext4_directory_dx_root {
- struct ext4_directory_dx_dot_entry dots[2];
- struct ext4_directory_dx_root_info info;
- struct ext4_directory_dx_entry entries[0];
+ struct ext4_directory_dx_dot_entry dots[2];
+ struct ext4_directory_dx_root_info info;
+ struct ext4_directory_dx_entry entries[0];
};
struct ext4_fake_directory_entry {
- uint32_t inode;
- uint16_t entry_length;
- uint8_t name_length;
- uint8_t inode_type;
+ uint32_t inode;
+ uint16_t entry_length;
+ uint8_t name_length;
+ uint8_t inode_type;
};
struct ext4_directory_dx_node {
- struct ext4_fake_directory_entry fake;
- struct ext4_directory_dx_entry entries[0];
+ struct ext4_fake_directory_entry fake;
+ struct ext4_directory_dx_entry entries[0];
};
struct ext4_directory_dx_block {
- struct ext4_block block;
- struct ext4_directory_dx_entry *entries;
- struct ext4_directory_dx_entry *position;
+ struct ext4_block block;
+ struct ext4_directory_dx_entry *entries;
+ struct ext4_directory_dx_entry *position;
} ;
#define EXT4_ERR_BAD_DX_DIR (-75000)
* It's used at the bottom of the tree.
*/
struct ext4_extent {
- uint32_t first_block; /* First logical block extent covers */
- uint16_t block_count; /* Number of blocks covered by extent */
- uint16_t start_hi; /* High 16 bits of physical block */
- uint32_t start_lo; /* Low 32 bits of physical block */
+ uint32_t first_block; /* First logical block extent covers */
+ uint16_t block_count; /* Number of blocks covered by extent */
+ uint16_t start_hi; /* High 16 bits of physical block */
+ uint32_t start_lo; /* Low 32 bits of physical block */
} ;
/*
* It's used at all the levels except the bottom.
*/
struct ext4_extent_index {
- uint32_t first_block; /* Index covers logical blocks from 'block' */
-
- /**
- * Pointer to the physical block of the next
- * level. leaf or next index could be there
- * high 16 bits of physical block
- */
- uint32_t leaf_lo;
- uint16_t leaf_hi;
- uint16_t padding;
+ uint32_t first_block; /* Index covers logical blocks from 'block' */
+
+ /**
+ * Pointer to the physical block of the next
+ * level. leaf or next index could be there
+ * high 16 bits of physical block
+ */
+ uint32_t leaf_lo;
+ uint16_t leaf_hi;
+ uint16_t padding;
} ;
/*
* Each block (leaves and indexes), even inode-stored has header.
*/
struct ext4_extent_header {
- uint16_t magic;
- uint16_t entries_count; /* Number of valid entries */
- uint16_t max_entries_count; /* Capacity of store in entries */
- uint16_t depth; /* Has tree real underlying blocks? */
- uint32_t generation; /* generation of the tree */
+ uint16_t magic;
+ uint16_t entries_count; /* Number of valid entries */
+ uint16_t max_entries_count; /* Capacity of store in entries */
+ uint16_t depth; /* Has tree real underlying blocks? */
+ uint32_t generation; /* generation of the tree */
} ;
struct ext4_extent_path {
- struct ext4_block block;
- uint16_t depth;
- struct ext4_extent_header *header;
- struct ext4_extent_index *index;
- struct ext4_extent *extent;
+ struct ext4_block block;
+ uint16_t depth;
+ struct ext4_extent_header *header;
+ struct ext4_extent_index *index;
+ struct ext4_extent *extent;
} ;
#define EXT4_EXTENT_MAGIC 0xF30A
#define EXT4_EXTENT_FIRST(header) \
- ((struct ext4_extent *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
+ ((struct ext4_extent *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
#define EXT4_EXTENT_FIRST_INDEX(header) \
- ((struct ext4_extent_index *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
+ ((struct ext4_extent_index *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
/* EXT3 HTree directory indexing */
struct ext4_hash_info {
- uint32_t hash;
- uint32_t minor_hash;
- uint32_t hash_version;
- const uint32_t *seed;
+ uint32_t hash;
+ uint32_t minor_hash;
+ uint32_t hash_version;
+ const uint32_t *seed;
};
/*****************************************************************************/
#ifdef CONFIG_BIG_ENDIAN
static inline uint64_t to_le64(uint64_t n)
{
- return ((n & 0xff) << 56) |
- ((n & 0xff00) << 40) |
- ((n & 0xff0000) << 24) |
- ((n & 0xff000000LL) << 8) |
- ((n & 0xff00000000LL) >> 8) |
- ((n & 0xff0000000000LL) >> 24) |
- ((n & 0xff000000000000LL) >> 40) |
- ((n & 0xff00000000000000LL) >> 56);
+ return ((n & 0xff) << 56) |
+ ((n & 0xff00) << 40) |
+ ((n & 0xff0000) << 24) |
+ ((n & 0xff000000LL) << 8) |
+ ((n & 0xff00000000LL) >> 8) |
+ ((n & 0xff0000000000LL) >> 24) |
+ ((n & 0xff000000000000LL) >> 40) |
+ ((n & 0xff00000000000000LL) >> 56);
}
static inline uint32_t to_le32(uint32_t n)
{
- return ((n & 0xff) << 24) |
- ((n & 0xff00) << 8) |
- ((n & 0xff0000) >> 8) |
- ((n & 0xff000000) >> 24);
+ return ((n & 0xff) << 24) |
+ ((n & 0xff00) << 8) |
+ ((n & 0xff0000) >> 8) |
+ ((n & 0xff000000) >> 24);
}
static inline uint16_t to_le16(uint16_t n)
{
- return ((n & 0xff) << 8) |
- ((n & 0xff00) >> 8);
+ return ((n & 0xff) << 8) |
+ ((n & 0xff00) >> 8);
}