19f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 29f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * linux/include/linux/ext2_fs.h 39f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * 49f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Copyright (C) 1992, 1993, 1994, 1995 59f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Remy Card (card@masi.ibp.fr) 69f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Laboratoire MASI - Institut Blaise Pascal 79f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Universite Pierre et Marie Curie (Paris VI) 89f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * 99f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * from 109f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * 119f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * linux/include/linux/minix_fs.h 129f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * 139f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Copyright (C) 1991, 1992 Linus Torvalds 149f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 159f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 169f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#ifndef _LINUX_EXT2_FS_H 179f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define _LINUX_EXT2_FS_H 189f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 19797f5ef14e92294b329e52971d467d7af5b2993eTheodore Ts'o#include <ext2fs/ext2_types.h> /* Changed from linux/types.h */ 209f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 219f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 229f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * The second extended filesystem constants/structures 239f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 249f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 259f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 269f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Define EXT2FS_DEBUG to produce debug messages 279f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 289f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#undef EXT2FS_DEBUG 299f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 309f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 319f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files 329f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 339f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_PREALLOCATE 349f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_DEFAULT_PREALLOC_BLOCKS 8 359f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 369f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 379f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * The second extended file system version 389f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 399f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2FS_DATE "95/08/09" 409f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2FS_VERSION "0.5b" 419f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 429f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 430fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger * Special inode numbers 449f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 450fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_BAD_INO 1 /* Bad blocks inode */ 469f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_ROOT_INO 2 /* Root inode */ 47e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_USR_QUOTA_INO 3 /* User quota inode */ 48e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */ 499f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ 509f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ 519f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */ 529f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_JOURNAL_INO 8 /* Journal inode */ 536d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT2_EXCLUDE_INO 9 /* The "exclude" inode, for snapshots */ 54e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_REPLICA_INO 10 /* Used by non-upstream feature */ 559f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 569f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* First non-reserved inode for old ext2 filesystems */ 579f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_GOOD_OLD_FIRST_INO 11 589f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 599f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 609f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * The second extended file system magic number 619f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 629f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_SUPER_MAGIC 0xEF53 639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 640fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#ifdef __KERNEL__ 650fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_SB(sb) (&((sb)->u.ext2_sb)) 660fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#else 670fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger/* Assume that user mode programs are passing in an ext2fs superblock, not 680fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger * a kernel struct super_block. This will allow us to call the feature-test 690fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger * macros from user land. */ 700fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_SB(sb) (sb) 710fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#endif 720fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger 739f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 749f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Maximal count of links to a file 759f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 76bec6f49a46ec78a4c5928a22214848a7ea654704Theodore Ts'o#define EXT2_LINK_MAX 65000 779f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 789f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 799f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Macro-instructions used to manage several block sizes 809f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 81932a489cdf6bc83d69e59d3f8e0a57b733799ce1Andreas Dilger#define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */ 8239dc1c45cb41ce37a56d364103bb852d0b62c835Theodore Ts'o#define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */ 837da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE) 847da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE) 859f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#ifdef __KERNEL__ 867da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) 877da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) 880fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits) 897da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) 907da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) 919f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#else 927da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) 937da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) 949f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ 957da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) 969f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ 977da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino) 989f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#endif 997da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32)) 1009f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 1019f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 102e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Macro-instructions used to manage allocation clusters 103e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */ 104e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MIN_CLUSTER_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE 105e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MAX_CLUSTER_LOG_SIZE 29 /* 512MB */ 106e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MIN_CLUSTER_SIZE EXT2_MIN_BLOCK_SIZE 107e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MAX_CLUSTER_SIZE (1 << EXT2_MAX_CLUSTER_LOG_SIZE) 108e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_CLUSTER_SIZE(s) (EXT2_MIN_BLOCK_SIZE << \ 109e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall (s)->s_log_cluster_size) 110e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_CLUSTER_SIZE_BITS(s) ((s)->s_log_cluster_size + 10) 111e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall 112e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* 1133fbfad558e01ffbacc14e5a536c4dfec0a0af4f5Theodore Ts'o * Macro-instructions used to manage fragments 114e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * 115e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Note: for backwards compatibility only, for the dump program. 116e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Ext2/3/4 will never support fragments.... 1173fbfad558e01ffbacc14e5a536c4dfec0a0af4f5Theodore Ts'o */ 118e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE 119e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE 120e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE 121e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_FRAG_SIZE(s) EXT2_BLOCK_SIZE(s) 122e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_FRAGS_PER_BLOCK(s) 1 1233fbfad558e01ffbacc14e5a536c4dfec0a0af4f5Theodore Ts'o 1243fbfad558e01ffbacc14e5a536c4dfec0a0af4f5Theodore Ts'o/* 1259f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * ACL structures 1269f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 1279f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'ostruct ext2_acl_header /* Header of Access Control Lists */ 1289f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o{ 1299f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 aclh_size; 1309f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 aclh_file_count; 1319f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 aclh_acle_count; 1329f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 aclh_first_acle; 1339f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o}; 1349f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 1359f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'ostruct ext2_acl_entry /* Access Control List Entry */ 1369f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o{ 1379f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 acle_size; 1389f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 acle_perms; /* Access permissions */ 1399f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 acle_type; /* Type of entry */ 1409f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 acle_tag; /* User or group identity */ 1419f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 acle_pad1; 1429f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 acle_next; /* Pointer on next entry for the */ 1439f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o /* same inode or on next free entry */ 1449f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o}; 1459f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 1469f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 1479f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Structure of a blocks group descriptor 1489f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 1499f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'ostruct ext2_group_desc 1509f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o{ 1518061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_block_bitmap; /* Blocks bitmap block */ 1528061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_inode_bitmap; /* Inodes bitmap block */ 1539f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 bg_inode_table; /* Inodes table block */ 1549f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 bg_free_blocks_count; /* Free blocks count */ 1559f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 bg_free_inodes_count; /* Free inodes count */ 1569f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 bg_used_dirs_count; /* Directories count */ 157f5fa20078bfc05b554294fe9c5505375d7913e8cTheodore Ts'o __u16 bg_flags; 158e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ 159e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ 160e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ 1618815fb8a00f5a441eb62f035353db9e0cca90b38Theodore Ts'o __u16 bg_itable_unused; /* Unused inodes count */ 162e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_checksum; /* crc16(s_uuid+group_num+group_desc)*/ 1639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o}; 1649f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 165e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* 166e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Structure of a blocks group descriptor 167e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */ 1688061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'ostruct ext4_group_desc 1698061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o{ 1708061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_block_bitmap; /* Blocks bitmap block */ 1718061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_inode_bitmap; /* Inodes bitmap block */ 1728061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_inode_table; /* Inodes table block */ 1738061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 bg_free_blocks_count; /* Free blocks count */ 1748061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 bg_free_inodes_count; /* Free inodes count */ 1758061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 bg_used_dirs_count; /* Directories count */ 176e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ 177e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ 178e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ 179e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ 1808061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 bg_itable_unused; /* Unused inodes count */ 181e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_checksum; /* crc16(sb_uuid+group+desc) */ 1828061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ 1838061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ 1848061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 bg_inode_table_hi; /* Inodes table block MSB */ 1858061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */ 1868061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */ 1878061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 bg_used_dirs_count_hi; /* Directories count MSB */ 188e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_itable_unused_hi; /* Unused inodes count MSB */ 189e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */ 190e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */ 191e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */ 192e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 bg_reserved; 1938061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o}; 1948061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o 195f5fa20078bfc05b554294fe9c5505375d7913e8cTheodore Ts'o#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */ 196f5fa20078bfc05b554294fe9c5505375d7913e8cTheodore Ts'o#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */ 197ca2634a46ab9da85a3a015a7772770d9dbe5848eJose R. Santos#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ 198f5fa20078bfc05b554294fe9c5505375d7913e8cTheodore Ts'o 1999f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 200df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o * Data structures used by the directory indexing feature 201df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o * 202df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o * Note: all of the multibyte integer fields are little endian. 203df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o */ 204df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o 205df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o/* 206df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o * Note: dx_root_info is laid out so that if it should somehow get 207df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o * overlaid by a dirent the two low bits of the hash version will be 208df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o * zero. Therefore, the hash version mod 4 should never be 0. 209df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o * Sincerely, the paranoia department. 210df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o */ 211df614db6ef79c767745b8154c26d69398b571605Theodore Ts'ostruct ext2_dx_root_info { 212df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u32 reserved_zero; 213df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u8 hash_version; /* 0 now, 1 at release */ 214df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u8 info_length; /* 8 */ 215df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u8 indirect_levels; 216df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u8 unused_flags; 217df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o}; 218df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o 219f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_HASH_LEGACY 0 220f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_HASH_HALF_MD4 1 221f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_HASH_TEA 2 222f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_HASH_LEGACY_UNSIGNED 3 /* reserved for userspace lib */ 223f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_HASH_HALF_MD4_UNSIGNED 4 /* reserved for userspace lib */ 224f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_HASH_TEA_UNSIGNED 5 /* reserved for userspace lib */ 225503f9e7f6eb331c5b75d7f1ad126f71bcdcfb4e3Theodore Ts'o 226503f9e7f6eb331c5b75d7f1ad126f71bcdcfb4e3Theodore Ts'o#define EXT2_HASH_FLAG_INCOMPAT 0x1 227503f9e7f6eb331c5b75d7f1ad126f71bcdcfb4e3Theodore Ts'o 228df614db6ef79c767745b8154c26d69398b571605Theodore Ts'ostruct ext2_dx_entry { 229df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u32 hash; 230df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u32 block; 231df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o}; 232df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o 233df614db6ef79c767745b8154c26d69398b571605Theodore Ts'ostruct ext2_dx_countlimit { 234df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u16 limit; 235df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o __u16 count; 236df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o}; 237df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o 238df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o 239df614db6ef79c767745b8154c26d69398b571605Theodore Ts'o/* 2409f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Macro-instructions used to manage group descriptors 2419f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 242f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement#define EXT2_MIN_DESC_SIZE 32 243f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement#define EXT2_MIN_DESC_SIZE_64BIT 64 244f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement#define EXT2_MAX_DESC_SIZE EXT2_MIN_BLOCK_SIZE 245f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement#define EXT2_DESC_SIZE(s) \ 246f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement ((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \ 247f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement (s)->s_desc_size : EXT2_MIN_DESC_SIZE) 248f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement 249b21bf267783274683a432eea6e5c589eab94123eAndreas Dilger#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group) 250b21bf267783274683a432eea6e5c589eab94123eAndreas Dilger#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group) 251e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group) 252b21bf267783274683a432eea6e5c589eab94123eAndreas Dilger#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) 253b21bf267783274683a432eea6e5c589eab94123eAndreas Dilger/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */ 254e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \ 255e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall (EXT2_CLUSTER_SIZE(s) / \ 256e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall EXT2_BLOCK_SIZE(s))) 257e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8) 258e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \ 259e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall EXT2_INODES_PER_BLOCK(s)) 2609f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#ifdef __KERNEL__ 261b21bf267783274683a432eea6e5c589eab94123eAndreas Dilger#define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block) 262b21bf267783274683a432eea6e5c589eab94123eAndreas Dilger#define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) 2639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#else 264f2de1d38d0819b17895977fabc52d81d0ea6ec00Valerie Clement#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s)) 2659f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#endif 2669f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 2679f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 2689f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Constants relative to the data blocks 2699f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 2700fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_NDIR_BLOCKS 12 2710fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS 2720fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) 2730fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) 2740fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) 2759f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 2769f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 2779f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Inode flags 2789f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 2790fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */ 2800fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_UNRM_FL 0x00000002 /* Undelete */ 2810fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_COMPR_FL 0x00000004 /* Compress file */ 2829f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */ 2839f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */ 2849f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */ 2859f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */ 2869f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */ 2879f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* Reserved for compression usage... */ 2889f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_DIRTY_FL 0x00000100 2899f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ 2900fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */ 2919f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */ 2920fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger/* End compression flags --- maybe not all used */ 2939f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_BTREE_FL 0x00001000 /* btree format dir */ 294b10820cdcd5f007894b81cf716cf1fdd8523bbcaTheodore Ts'o#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */ 2959f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_IMAGIC_FL 0x00002000 2969f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ 297b3f5b4c22939daba86465d05842bce76053bc3cfTheodore Ts'o#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 29888372d5c4b2ebd0405446b42de65bf2b0ebb2408Theodore Ts'o#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ 29915f9011add4013d32ea2f7ca7dbf860f95b8ec53Theodore Ts'o#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 3001ca1059fd0126fd2c065f272a566c18f14bab16dTheodore Ts'o#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */ 3018fe81a3d53fbaa1670ece5fb7fd11dd5ae45b8daAndreas Dilger#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ 302cff9690f4e114d95c9031a7468c99fda0ddcb3ecAndreas Dilger#define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */ 303e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* EXT4_EOFBLOCKS_FL 0x00400000 was here */ 304e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define FS_NOCOW_FL 0x00800000 /* Do not cow file */ 3056d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */ 3066d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */ 3076d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */ 3089f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 3099f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 3104ffafee26cf791c0c651c08d3dcefcdd363bf127Eric Sandeen#define EXT2_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */ 3114ffafee26cf791c0c651c08d3dcefcdd363bf127Eric Sandeen#define EXT2_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */ 3129f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 3139f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 3149f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * ioctl commands 3159f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 316bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o 317bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o/* Used for online resize */ 318bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'ostruct ext2_new_group_input { 319bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o __u32 group; /* Group number for this data */ 320bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o __u32 block_bitmap; /* Absolute block number of block bitmap */ 321bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o __u32 inode_bitmap; /* Absolute block number of inode bitmap */ 322bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o __u32 inode_table; /* Absolute block number of inode table start */ 323bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o __u32 blocks_count; /* Total number of blocks in this group */ 324bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o __u16 reserved_blocks; /* Number of reserved blocks in this group */ 325bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o __u16 unused; /* Number of reserved GDT blocks in group */ 326bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o}; 327bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o 3285c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'ostruct ext4_new_group_input { 3295c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o __u32 group; /* Group number for this data */ 3305c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o __u64 block_bitmap; /* Absolute block number of block bitmap */ 3315c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o __u64 inode_bitmap; /* Absolute block number of inode bitmap */ 3325c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o __u64 inode_table; /* Absolute block number of inode table start */ 3335c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o __u32 blocks_count; /* Total number of blocks in this group */ 3345c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o __u16 reserved_blocks; /* Number of reserved blocks in this group */ 3355c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o __u16 unused; 3365c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o}; 3375c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o 3383166c58dc0e2be55c9414e019607902c85485e83Theodore Ts'o#ifdef __GNU__ /* Needed for the Hurd */ 3393166c58dc0e2be55c9414e019607902c85485e83Theodore Ts'o#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0) 3403166c58dc0e2be55c9414e019607902c85485e83Theodore Ts'o#endif 3413166c58dc0e2be55c9414e019607902c85485e83Theodore Ts'o 3420fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_IOC_GETFLAGS _IOR('f', 1, long) 3430fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_IOC_SETFLAGS _IOW('f', 2, long) 3440fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_IOC_GETVERSION _IOR('v', 1, long) 3450fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_IOC_SETVERSION _IOW('v', 2, long) 346bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o#define EXT2_IOC_GETVERSION_NEW _IOR('f', 3, long) 347bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o#define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long) 348bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o#define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) 349bf69235ad0073c80386b70caba0e1b58e5f85697Theodore Ts'o#define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input) 3505c4f8d674845095050f94ea95f3c73072cbe34b5Theodore Ts'o#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) 351e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) 3529f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 3539f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 3549f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Structure of an inode on the disk 3559f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 3569f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'ostruct ext2_inode { 3579f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 i_mode; /* File mode */ 3589f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 i_uid; /* Low 16 bits of Owner Uid */ 3599f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_size; /* Size in bytes */ 3609f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_atime; /* Access time */ 3616b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u32 i_ctime; /* Inode change time */ 3629f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_mtime; /* Modification time */ 3639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_dtime; /* Deletion Time */ 3649f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 i_gid; /* Low 16 bits of Group Id */ 3659f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 i_links_count; /* Links count */ 3669f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_blocks; /* Blocks count */ 3679f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_flags; /* File flags */ 3689f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o union { 3699f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o struct { 370d362a3fb7ec1a2b46601f55f4dbae83563c27717Theodore Ts'o __u32 l_i_version; /* was l_i_reserved1 */ 3719f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o } linux1; 3729f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o struct { 3739f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 h_i_translator; 3749f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o } hurd1; 3759f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o } osd1; /* OS dependent 1 */ 3769f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ 3779f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_generation; /* File version (for NFS) */ 3789f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_file_acl; /* File ACL */ 379e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */ 3809f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 i_faddr; /* Fragment address */ 3819f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o union { 3829f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o struct { 3835d17119d14fe1276936c85d7986695a4543b1aa1Theodore Ts'o __u16 l_i_blocks_hi; 384bb767b2fc3b4420f566df6f563574fd8e5c856b1Theodore Ts'o __u16 l_i_file_acl_high; 3859f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 l_i_uid_high; /* these 2 fields */ 3869f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 l_i_gid_high; /* were reserved2[0] */ 387e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */ 388e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 l_i_reserved; 3899f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o } linux2; 3909f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o struct { 3919f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 h_i_frag; /* Fragment number */ 3929f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 h_i_fsize; /* Fragment size */ 3939f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 h_i_mode_high; 3949f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 h_i_uid_high; 3959f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 h_i_gid_high; 3969f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 h_i_author; 3979f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o } hurd2; 3989f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o } osd2; /* OS dependent 2 */ 3999f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o}; 4009f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 4017331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o/* 4027331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o * Permanent part of an large inode on the disk 4037331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o */ 4047331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'ostruct ext2_inode_large { 4057331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 i_mode; /* File mode */ 4067331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 i_uid; /* Low 16 bits of Owner Uid */ 4077331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_size; /* Size in bytes */ 4087331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_atime; /* Access time */ 4096b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u32 i_ctime; /* Inode Change time */ 4107331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_mtime; /* Modification time */ 4117331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_dtime; /* Deletion Time */ 4127331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 i_gid; /* Low 16 bits of Group Id */ 4137331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 i_links_count; /* Links count */ 4147331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_blocks; /* Blocks count */ 4157331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_flags; /* File flags */ 4167331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o union { 4177331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o struct { 418d362a3fb7ec1a2b46601f55f4dbae83563c27717Theodore Ts'o __u32 l_i_version; /* was l_i_reserved1 */ 4197331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o } linux1; 4207331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o struct { 4217331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 h_i_translator; 4227331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o } hurd1; 4237331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o } osd1; /* OS dependent 1 */ 4247331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ 4257331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_generation; /* File version (for NFS) */ 4267331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_file_acl; /* File ACL */ 427e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */ 4287331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 i_faddr; /* Fragment address */ 4297331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o union { 4307331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o struct { 4315d17119d14fe1276936c85d7986695a4543b1aa1Theodore Ts'o __u16 l_i_blocks_hi; 432bb767b2fc3b4420f566df6f563574fd8e5c856b1Theodore Ts'o __u16 l_i_file_acl_high; 4337331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 l_i_uid_high; /* these 2 fields */ 4347331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 l_i_gid_high; /* were reserved2[0] */ 435e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */ 436e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 l_i_reserved; 4377331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o } linux2; 4387331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o struct { 4397331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u8 h_i_frag; /* Fragment number */ 4407331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u8 h_i_fsize; /* Fragment size */ 4417331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 h_i_mode_high; 4427331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 h_i_uid_high; 4437331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 h_i_gid_high; 4447331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u32 h_i_author; 4457331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o } hurd2; 4467331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o } osd2; /* OS dependent 2 */ 4477331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o __u16 i_extra_isize; 448e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */ 4496b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ 4506b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */ 4516b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ 4526b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u32 i_crtime; /* File creation time */ 4536b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/ 454bb767b2fc3b4420f566df6f563574fd8e5c856b1Theodore Ts'o __u32 i_version_hi; /* high 32 bits for 64-bit version */ 4557331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o}; 4567331196a16e57ef80dd6ae40eeeab14747ce2f5dTheodore Ts'o 457e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define i_dir_acl i_size_high 4589f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 4599f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#if defined(__KERNEL__) || defined(__linux__) 4609f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_reserved1 osd1.linux1.l_i_reserved1 4619f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_frag osd2.linux2.l_i_frag 4629f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_fsize osd2.linux2.l_i_fsize 4639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_uid_low i_uid 4649f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_gid_low i_gid 4659f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_uid_high osd2.linux2.l_i_uid_high 4669f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_gid_high osd2.linux2.l_i_gid_high 46748e6e81362f264aee4f3945c14928efaf71a06c9Theodore Ts'o#else 46848e6e81362f264aee4f3945c14928efaf71a06c9Theodore Ts'o#if defined(__GNU__) 4699f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 4709f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_translator osd1.hurd1.h_i_translator 4719f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_frag osd2.hurd2.h_i_frag; 4729f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_fsize osd2.hurd2.h_i_fsize; 4739f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_uid_high osd2.hurd2.h_i_uid_high 4749f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_gid_high osd2.hurd2.h_i_gid_high 4759f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define i_author osd2.hurd2.h_i_author 4769f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 47748e6e81362f264aee4f3945c14928efaf71a06c9Theodore Ts'o#endif /* __GNU__ */ 4787da78ff17df7d2c1eeebbc2b0727106b63c08a68Andreas Dilger#endif /* defined(__KERNEL__) || defined(__linux__) */ 4799f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 4807132d48d83f79992773b6d9f1cace8d96366f08bTheodore Ts'o#define inode_uid(inode) ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16) 4817132d48d83f79992773b6d9f1cace8d96366f08bTheodore Ts'o#define inode_gid(inode) ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16) 482153439222e6a16e40be324408d8d19361bc1e65eTheodore Ts'o#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x)) 483153439222e6a16e40be324408d8d19361bc1e65eTheodore Ts'o#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x)) 4843306861158a1ca27b7ec83bb33fb8fbbf043d24cTheodore Ts'o 4859f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 4869f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * File system states 4879f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 4880fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */ 4890fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_ERROR_FS 0x0002 /* Errors detected */ 490a80f3694a7b99756e747683f01ab8a5bca022251Theodore Ts'o#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ 4919f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 4929f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 493f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o * Misc. filesystem flags 494f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o */ 495f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */ 496f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */ 4976cb27404f51f97e2665fa0e0c4c0f7bc47e698ecTheodore Ts'o#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* OK for use on development code */ 4986d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT2_FLAGS_IS_SNAPSHOT 0x0010 /* This is a snapshot image */ 4996d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT2_FLAGS_FIX_SNAPSHOT 0x0020 /* Snapshot inodes corrupted */ 5006d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT2_FLAGS_FIX_EXCLUDE 0x0040 /* Exclude bitmaps corrupted */ 501f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o 502f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o/* 5039f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Mount flags 5049f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 5059f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */ 5069f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */ 5079f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */ 5089f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ 5099f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ 5109f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ 5119f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */ 5129f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */ 5139f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 5149f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt 5159f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define set_opt(o, opt) o |= EXT2_MOUNT_##opt 5160fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \ 5179f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o EXT2_MOUNT_##opt) 5189f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 5199f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Maximal mount counts between two filesystem checks 5209f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 5219f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ 5229f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */ 5239f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 5249f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 5259f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Behaviour when detecting errors 5269f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 5279f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */ 5289f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_ERRORS_RO 2 /* Remount fs read-only */ 5299f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_ERRORS_PANIC 3 /* Panic */ 5309f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE 5319f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 532993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o#if (__GNUC__ >= 4) 533993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o#define ext4_offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER) 534993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o#else 535993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o#define ext4_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 536993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o#endif 537993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o 5389f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 5399f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Structure of the super block 5409f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 5419f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'ostruct ext2_super_block { 5429f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_inodes_count; /* Inodes count */ 5439f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_blocks_count; /* Blocks count */ 5449f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_r_blocks_count; /* Reserved blocks count */ 5459f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_free_blocks_count; /* Free blocks count */ 5469f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_free_inodes_count; /* Free inodes count */ 5479f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_first_data_block; /* First Data Block */ 5489f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_log_block_size; /* Block size */ 549e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 s_log_cluster_size; /* Allocation cluster size */ 5509f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_blocks_per_group; /* # Blocks per group */ 551e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 s_clusters_per_group; /* # Fragments per group */ 5529f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_inodes_per_group; /* # Inodes per group */ 5539f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_mtime; /* Mount time */ 5549f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_wtime; /* Write time */ 5559f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 s_mnt_count; /* Mount count */ 5569f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __s16 s_max_mnt_count; /* Maximal mount count */ 5579f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 s_magic; /* Magic signature */ 5589f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 s_state; /* File system state */ 5599f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 s_errors; /* Behaviour when detecting errors */ 5600fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger __u16 s_minor_rev_level; /* minor revision level */ 5619f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_lastcheck; /* time of last check */ 5629f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_checkinterval; /* max. time between checks */ 5639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_creator_os; /* OS */ 5649f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_rev_level; /* Revision level */ 5659f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 s_def_resuid; /* Default uid for reserved blocks */ 5669f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 s_def_resgid; /* Default gid for reserved blocks */ 5679f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o /* 5689f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * These fields are for EXT2_DYNAMIC_REV superblocks only. 5699f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * 5709f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Note: the difference between the compatible feature set and 5719f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * the incompatible feature set is that if there is a bit set 5729f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * in the incompatible feature set that the kernel doesn't 5739f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * know about, it should refuse to mount the filesystem. 5740fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger * 5759f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * e2fsck's requirements are more strict; if it doesn't know 5769f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * about a feature in either the compatible or incompatible 5779f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * feature set, it must abort and not try to meddle with 5789f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * things it doesn't understand... 5799f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 5800fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger __u32 s_first_ino; /* First non-reserved inode */ 5810fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger __u16 s_inode_size; /* size of inode structure */ 5820fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger __u16 s_block_group_nr; /* block group # of this superblock */ 5830fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger __u32 s_feature_compat; /* compatible feature set */ 5840fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger __u32 s_feature_incompat; /* incompatible feature set */ 5850fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger __u32 s_feature_ro_compat; /* readonly-compatible feature set */ 5869f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 s_uuid[16]; /* 128-bit uuid for volume */ 5870fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger char s_volume_name[16]; /* volume name */ 5880fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger char s_last_mounted[64]; /* directory where last mounted */ 5899f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_algorithm_usage_bitmap; /* For compression */ 5909f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o /* 5919f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Performance hints. Directory preallocation should only 5929f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. 5939f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 5949f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 5959f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 5969e6c5dd73e7bc1a946b2b8b6c5a15c1f9d3534c0Theodore Ts'o __u16 s_reserved_gdt_blocks; /* Per group table for online growth */ 5970fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger /* 5989f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. 5999f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 6009f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 s_journal_uuid[16]; /* uuid of journal superblock */ 6019f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_journal_inum; /* inode number of journal file */ 6029f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_journal_dev; /* device number of journal file */ 6039f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 s_last_orphan; /* start of list of inodes to delete */ 604b7a00563b22b0ea47ddc7117508c0b8e0d65df43Theodore Ts'o __u32 s_hash_seed[4]; /* HTREE hash seed */ 605b7a00563b22b0ea47ddc7117508c0b8e0d65df43Theodore Ts'o __u8 s_def_hash_version; /* Default hash version to use */ 606a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o __u8 s_jnl_backup_type; /* Default type of journal backup */ 6078061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */ 608a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o __u32 s_default_mount_opts; 609c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o __u32 s_first_meta_bg; /* First metablock group */ 6109d2aefb3bc0a48b1540d06e1983aa96c56d39e17Theodore Ts'o __u32 s_mkfs_time; /* When the filesystem was created */ 6111ba7a2f2b6a9b152828a06443955a7fb1d139930Theodore Ts'o __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ 6128061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 s_blocks_count_hi; /* Blocks count high 32bits */ 6138061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/ 6148061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o __u32 s_free_blocks_hi; /* Free blocks count */ 6156b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u16 s_min_extra_isize; /* All inodes have at least # bytes */ 6166b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o __u16 s_want_extra_isize; /* New inodes should reserve # bytes */ 617f77704e416fca7dbe4cc91abba674d2ae3c14f6fTheodore Ts'o __u32 s_flags; /* Miscellaneous flags */ 61896c6a3acd377698cb99ffd9925bec9b20ca4f6f9Theodore Ts'o __u16 s_raid_stride; /* RAID stride */ 619e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */ 620b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger __u64 s_mmp_block; /* Block for multi-mount protection */ 621decb2a5b3a1e346ddb725a3ba01b759d8c9ee4e6Theodore Ts'o __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ 622494a1daad37a8098e7db166d558aab3e9e37ac48Theodore Ts'o __u8 s_log_groups_per_flex; /* FLEX_BG group size */ 623494a1daad37a8098e7db166d558aab3e9e37ac48Theodore Ts'o __u8 s_reserved_char_pad; 624494a1daad37a8098e7db166d558aab3e9e37ac48Theodore Ts'o __u16 s_reserved_pad; /* Padding to next 32bits */ 625b7c5b4030870b31d73019d9d9ec55d550772590bTheodore Ts'o __u64 s_kbytes_written; /* nr of lifetime kilobytes written */ 6266d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o __u32 s_snapshot_inum; /* Inode number of active snapshot */ 6276d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o __u32 s_snapshot_id; /* sequential ID of active snapshot */ 6286d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o __u64 s_snapshot_r_blocks_count; /* reserved blocks for active 6296d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o snapshot's future use */ 6306d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o __u32 s_snapshot_list; /* inode number of the head of the on-disk snapshot list */ 631993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o#define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count) 632993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u32 s_error_count; /* number of fs errors */ 633993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u32 s_first_error_time; /* first time an error happened */ 634993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u32 s_first_error_ino; /* inode involved in first error */ 635993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u64 s_first_error_block; /* block involved of first error */ 636993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u8 s_first_error_func[32]; /* function where the error happened */ 637993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u32 s_first_error_line; /* line number where error happened */ 638993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u32 s_last_error_time; /* most recent time of an error */ 639993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u32 s_last_error_ino; /* inode involved in last error */ 640993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u32 s_last_error_line; /* line number where error happened */ 641993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u64 s_last_error_block; /* block involved of last error */ 642993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o __u8 s_last_error_func[32]; /* function where the error happened */ 6439345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts) 6449345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o __u8 s_mount_opts[64]; 645e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 s_usr_quota_inum; /* inode number of user quota file */ 646e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 s_grp_quota_inum; /* inode number of group quota file */ 647e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 s_overhead_blocks; /* overhead blocks/clusters in fs */ 648e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 s_reserved[108]; /* Padding to the end of the block */ 649e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 s_checksum; /* crc32c(superblock) */ 6509f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o}; 6519f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 652993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o#define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) 653993988f65527e5665181b3e4a6161f317e396489Theodore Ts'o 6549f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 6559f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Codes for operating systems 6569f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 6579f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_OS_LINUX 0 6589f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_OS_HURD 1 659c9548bc37e5d0f55308ebbb74b1e19ce7f88ada1Coly Li#define EXT2_OBSO_OS_MASIX 2 6609f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_OS_FREEBSD 3 6619f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_OS_LITES 4 6629f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 6639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 6649f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Revision levels 6659f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 6669f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ 6670fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ 6689f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 6699f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV 6709f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV 6719f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 6729f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_GOOD_OLD_INODE_SIZE 128 6739f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 6749f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 675a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o * Journal inode backup types 676a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o */ 677a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o#define EXT3_JNL_BACKUP_BLOCKS 1 678a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o 679a435ec3449694a8fa299337197cc09624960a3a6Theodore Ts'o/* 6809f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Feature set definitions 6819f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 6829f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 6839f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \ 6849f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o ( EXT2_SB(sb)->s_feature_compat & (mask) ) 6859f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \ 6869f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o ( EXT2_SB(sb)->s_feature_ro_compat & (mask) ) 6879f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \ 6889f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o ( EXT2_SB(sb)->s_feature_incompat & (mask) ) 6899f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 6909f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 6919f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 6929f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 693b10820cdcd5f007894b81cf716cf1fdd8523bbcaTheodore Ts'o#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 6949f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010 695b10820cdcd5f007894b81cf716cf1fdd8523bbcaTheodore Ts'o#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 696f5fa20078bfc05b554294fe9c5505375d7913e8cTheodore Ts'o#define EXT2_FEATURE_COMPAT_LAZY_BG 0x0040 697e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE 0x0080 not used, legacy */ 698e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP 0x0100 699e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall 7009f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7019f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 7029f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 7032c93113e6ac1384abd1935af7217b783fdcb3023Theodore Ts'o/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */ 7045d17119d14fe1276936c85d7986695a4543b1aa1Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 7058815fb8a00f5a441eb62f035353db9e0cca90b38Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 706bec6f49a46ec78a4c5928a22214848a7ea654704Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 7076b3ce9871c3424d0b41e0c7227ddc116d2e0de1aTheodore Ts'o#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 7086d0ed6780285e79360353d4b06b339c00712d754Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT 0x0080 709e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 710e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 711e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 712e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_FEATURE_RO_COMPAT_REPLICA 0x0800 7139f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7149f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 7159f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 7169f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ 7179f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ 718c046ac7f2e4c53e20cf1e909bbe511f91074b396Theodore Ts'o#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 71939dc1c45cb41ce37a56d364103bb852d0b62c835Theodore Ts'o#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040 7208061d2c144bf22ce3e170e40a194932da4baf8fbTheodore Ts'o#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 721b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 722cf0eeec0159b1af67fad9bccce220402cf08dff0Jose R. Santos#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 723cff9690f4e114d95c9031a7468c99fda0ddcb3ecAndreas Dilger#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 72430a7610edfc0c22cb6b5ad9f76f65700fb6ffe98Andreas Dilger#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 725e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* 0x2000 was EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM but this was never used */ 726e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */ 727e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_FEATURE_INCOMPAT_INLINEDATA 0x8000 /* data in inode */ 72839dc1c45cb41ce37a56d364103bb852d0b62c835Theodore Ts'o 7299f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_COMPAT_SUPP 0 730e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ 731e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall EXT4_FEATURE_INCOMPAT_MMP) 7329f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ 7339f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ 734a7c9cb7d0dc464eda26958595b728a6c3a4cacbcAndreas Dilger EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \ 7359f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o EXT2_FEATURE_RO_COMPAT_BTREE_DIR) 7369f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7379f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 7389f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Default values for user and/or group using reserved blocks 7399f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 7400fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_DEF_RESUID 0 7410fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_DEF_RESGID 0 7429f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7439f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 744a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o * Default mount options 745a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o */ 746a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#define EXT2_DEFM_DEBUG 0x0001 747a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#define EXT2_DEFM_BSDGROUPS 0x0002 748a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#define EXT2_DEFM_XATTR_USER 0x0004 749a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#define EXT2_DEFM_ACL 0x0008 750a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o#define EXT2_DEFM_UID16 0x0010 751efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o#define EXT3_DEFM_JMODE 0x0060 7524a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o#define EXT3_DEFM_JMODE_DATA 0x0020 7534a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o#define EXT3_DEFM_JMODE_ORDERED 0x0040 7544a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'o#define EXT3_DEFM_JMODE_WBACK 0x0060 7559345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o#define EXT4_DEFM_NOBARRIER 0x0100 7569345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o#define EXT4_DEFM_BLOCK_VALIDITY 0x0200 7579345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o#define EXT4_DEFM_DISCARD 0x0400 7589345f02671fd39cad69338080b62e12e8b86671dTheodore Ts'o#define EXT4_DEFM_NODELALLOC 0x0800 759a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o 760a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o/* 7619f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Structure of a directory entry 7629f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 7639f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_NAME_LEN 255 7649f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7659f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'ostruct ext2_dir_entry { 7669f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 inode; /* Inode number */ 7679f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 rec_len; /* Directory entry length */ 7689f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 name_len; /* Name length */ 7699f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o char name[EXT2_NAME_LEN]; /* File name */ 7709f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o}; 7719f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7729f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 7739f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * The new version of the directory entry. Since EXT2 structures are 7749f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * stored in intel byte order, and the name_len field could never be 7759f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * bigger than 255 chars, it's safe to reclaim the extra byte for the 7769f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * file_type field. 7779f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 7789f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'ostruct ext2_dir_entry_2 { 7799f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u32 inode; /* Inode number */ 7809f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u16 rec_len; /* Directory entry length */ 7819f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 name_len; /* Name length */ 7829f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o __u8 file_type; 7839f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o char name[EXT2_NAME_LEN]; /* File name */ 7849f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o}; 7859f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7869f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 7879f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * Ext2 directory file types. Only the low 3 bits are used. The 7889f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * other bits are reserved for now. 7899f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 7909f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_UNKNOWN 0 7919f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_REG_FILE 1 7929f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_DIR 2 7939f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_CHRDEV 3 7940fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_FT_BLKDEV 4 7959f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_FIFO 5 7969f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_SOCK 6 7979f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_SYMLINK 7 7989f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 7999f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_FT_MAX 8 8009f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 8019f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o/* 8029f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * EXT2_DIR_PAD defines the directory entries boundaries 8039f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * 8049f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o * NOTE: It must be a multiple of 4 8059f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o */ 8060fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_DIR_PAD 4 8070fbd1a8a9a2ef697927f886559344ffa1bb2eefaAndreas Dilger#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) 8089f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ 8099f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o ~EXT2_DIR_ROUND) 8109f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o 811b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger/* 812e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * This structure is used for multiple mount protection. It is written 813e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * into the block number saved in the s_mmp_block field in the superblock. 814e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Programs that check MMP should assume that if SEQ_FSCK (or any unknown 815e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * code above SEQ_MAX) is present then it is NOT safe to use the filesystem, 816e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * regardless of how old the timestamp is. 817e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * 818e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * The timestamp in the MMP structure will be updated by e2fsck at some 819e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * arbitary intervals (start of passes, after every few groups of inodes 820e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * in pass1 and pass1b). There is no guarantee that e2fsck is updating 821e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * the MMP block in a timely manner, and the updates it does are purely 822e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * for the convenience of the sysadmin and not for automatic validation. 823e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * 824e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Note: Only the mmp_seq value is used to determine whether the MMP block 825e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * is being updated. The mmp_time, mmp_nodename, and mmp_bdevname 826e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * fields are only for informational purposes for the administrator, 827e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * due to clock skew between nodes and hostname HA service takeover. 828b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger */ 829e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */ 830e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */ 831e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */ 832e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */ 833b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger 834b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilgerstruct mmp_struct { 835e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 mmp_magic; /* Magic number for MMP */ 836e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 mmp_seq; /* Sequence no. updated periodically */ 837e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u64 mmp_time; /* Time last updated */ 838e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall char mmp_nodename[64]; /* Node which last updated MMP block */ 839e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall char mmp_bdevname[32]; /* Bdev which last updated MMP block */ 840e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u16 mmp_check_interval; /* Changed mmp_check_interval */ 841b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger __u16 mmp_pad1; 842e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall __u32 mmp_pad2[227]; 843b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger}; 844b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger 845b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger/* 846e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Default interval for MMP update in seconds. 847e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */ 848e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_MMP_UPDATE_INTERVAL 5 849e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall 850e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* 851e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Maximum interval for MMP update in seconds. 852e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */ 853e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_MMP_MAX_UPDATE_INTERVAL 300 854e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall 855e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* 856e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Minimum interval for MMP checking in seconds. 857b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger */ 858e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_MMP_MIN_CHECK_INTERVAL 5 859b62e88af6a1be97b224a3e5c1fea43fa173567eaAndreas Dilger 8609f8046fc6dfc13eee2f5c363214e60b533872cacTheodore Ts'o#endif /* _LINUX_EXT2_FS_H */ 861