1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef _LINUX_EXT3_FS_H 13 #define _LINUX_EXT3_FS_H 14 15 #include <linux/types.h> 16 17 #undef EXT3FS_DEBUG 18 19 #define EXT3_DEFAULT_RESERVE_BLOCKS 8 20 21 #define EXT3_MAX_RESERVE_BLOCKS 1027 22 #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 23 24 #define CONFIG_EXT3_INDEX 25 26 #ifdef EXT3FS_DEBUG 27 #define ext3_debug(f, a...) do { printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", __FILE__, __LINE__, __FUNCTION__); printk (KERN_DEBUG f, ## a); } while (0) 28 #else 29 #define ext3_debug(f, a...) do {} while (0) 30 #endif 31 32 #define EXT3_BAD_INO 1 33 #define EXT3_ROOT_INO 2 34 #define EXT3_BOOT_LOADER_INO 5 35 #define EXT3_UNDEL_DIR_INO 6 36 #define EXT3_RESIZE_INO 7 37 #define EXT3_JOURNAL_INO 8 38 39 #define EXT3_GOOD_OLD_FIRST_INO 11 40 41 #define EXT3_SUPER_MAGIC 0xEF53 42 43 #define EXT3_LINK_MAX 32000 44 45 #define EXT3_MIN_BLOCK_SIZE 1024 46 #define EXT3_MAX_BLOCK_SIZE 4096 47 #define EXT3_MIN_BLOCK_LOG_SIZE 10 48 #define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size) 49 #define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32)) 50 #define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) 51 #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? EXT3_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) 52 #define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? EXT3_GOOD_OLD_FIRST_INO : (s)->s_first_ino) 53 54 #define EXT3_MIN_FRAG_SIZE 1024 55 #define EXT3_MAX_FRAG_SIZE 4096 56 #define EXT3_MIN_FRAG_LOG_SIZE 10 57 #define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size) 58 #define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s)) 59 60 struct ext3_group_desc 61 { 62 __le32 bg_block_bitmap; 63 __le32 bg_inode_bitmap; 64 __le32 bg_inode_table; 65 __le16 bg_free_blocks_count; 66 __le16 bg_free_inodes_count; 67 __le16 bg_used_dirs_count; 68 __u16 bg_pad; 69 __le32 bg_reserved[3]; 70 }; 71 72 #define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) 73 #define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc)) 74 #define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) 75 76 #define EXT3_NDIR_BLOCKS 12 77 #define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS 78 #define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1) 79 #define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1) 80 #define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1) 81 82 #define EXT3_SECRM_FL 0x00000001 83 #define EXT3_UNRM_FL 0x00000002 84 #define EXT3_COMPR_FL 0x00000004 85 #define EXT3_SYNC_FL 0x00000008 86 #define EXT3_IMMUTABLE_FL 0x00000010 87 #define EXT3_APPEND_FL 0x00000020 88 #define EXT3_NODUMP_FL 0x00000040 89 #define EXT3_NOATIME_FL 0x00000080 90 91 #define EXT3_DIRTY_FL 0x00000100 92 #define EXT3_COMPRBLK_FL 0x00000200 93 #define EXT3_NOCOMPR_FL 0x00000400 94 #define EXT3_ECOMPR_FL 0x00000800 95 96 #define EXT3_INDEX_FL 0x00001000 97 #define EXT3_IMAGIC_FL 0x00002000 98 #define EXT3_JOURNAL_DATA_FL 0x00004000 99 #define EXT3_NOTAIL_FL 0x00008000 100 #define EXT3_DIRSYNC_FL 0x00010000 101 #define EXT3_TOPDIR_FL 0x00020000 102 #define EXT3_RESERVED_FL 0x80000000 103 104 #define EXT3_FL_USER_VISIBLE 0x0003DFFF 105 #define EXT3_FL_USER_MODIFIABLE 0x000380FF 106 107 #define EXT3_STATE_JDATA 0x00000001 108 #define EXT3_STATE_NEW 0x00000002 109 #define EXT3_STATE_XATTR 0x00000004 110 111 struct ext3_new_group_input { 112 __u32 group; 113 __u32 block_bitmap; 114 __u32 inode_bitmap; 115 __u32 inode_table; 116 __u32 blocks_count; 117 __u16 reserved_blocks; 118 __u16 unused; 119 }; 120 121 struct ext3_new_group_data { 122 __u32 group; 123 __u32 block_bitmap; 124 __u32 inode_bitmap; 125 __u32 inode_table; 126 __u32 blocks_count; 127 __u16 reserved_blocks; 128 __u16 unused; 129 __u32 free_blocks_count; 130 }; 131 132 #define EXT3_IOC_GETFLAGS _IOR('f', 1, long) 133 #define EXT3_IOC_SETFLAGS _IOW('f', 2, long) 134 #define EXT3_IOC_GETVERSION _IOR('f', 3, long) 135 #define EXT3_IOC_SETVERSION _IOW('f', 4, long) 136 #define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) 137 #define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input) 138 #define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long) 139 #define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long) 140 #define EXT3_IOC_GETRSVSZ _IOR('f', 5, long) 141 #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) 142 143 struct ext3_mount_options { 144 unsigned long s_mount_opt; 145 uid_t s_resuid; 146 gid_t s_resgid; 147 unsigned long s_commit_interval; 148 }; 149 150 struct ext3_inode { 151 __le16 i_mode; 152 __le16 i_uid; 153 __le32 i_size; 154 __le32 i_atime; 155 __le32 i_ctime; 156 __le32 i_mtime; 157 __le32 i_dtime; 158 __le16 i_gid; 159 __le16 i_links_count; 160 __le32 i_blocks; 161 __le32 i_flags; 162 union { 163 struct { 164 __u32 l_i_reserved1; 165 } linux1; 166 struct { 167 __u32 h_i_translator; 168 } hurd1; 169 struct { 170 __u32 m_i_reserved1; 171 } masix1; 172 } osd1; 173 __le32 i_block[EXT3_N_BLOCKS]; 174 __le32 i_generation; 175 __le32 i_file_acl; 176 __le32 i_dir_acl; 177 __le32 i_faddr; 178 union { 179 struct { 180 __u8 l_i_frag; 181 __u8 l_i_fsize; 182 __u16 i_pad1; 183 __le16 l_i_uid_high; 184 __le16 l_i_gid_high; 185 __u32 l_i_reserved2; 186 } linux2; 187 struct { 188 __u8 h_i_frag; 189 __u8 h_i_fsize; 190 __u16 h_i_mode_high; 191 __u16 h_i_uid_high; 192 __u16 h_i_gid_high; 193 __u32 h_i_author; 194 } hurd2; 195 struct { 196 __u8 m_i_frag; 197 __u8 m_i_fsize; 198 __u16 m_pad1; 199 __u32 m_i_reserved2[2]; 200 } masix2; 201 } osd2; 202 __le16 i_extra_isize; 203 __le16 i_pad1; 204 }; 205 206 #define i_size_high i_dir_acl 207 208 #ifdef __linux__ 209 #define i_reserved1 osd1.linux1.l_i_reserved1 210 #define i_frag osd2.linux2.l_i_frag 211 #define i_fsize osd2.linux2.l_i_fsize 212 #define i_uid_low i_uid 213 #define i_gid_low i_gid 214 #define i_uid_high osd2.linux2.l_i_uid_high 215 #define i_gid_high osd2.linux2.l_i_gid_high 216 #define i_reserved2 osd2.linux2.l_i_reserved2 217 218 #elif defined(__GNU__) 219 220 #define i_translator osd1.hurd1.h_i_translator 221 #define i_frag osd2.hurd2.h_i_frag; 222 #define i_fsize osd2.hurd2.h_i_fsize; 223 #define i_uid_high osd2.hurd2.h_i_uid_high 224 #define i_gid_high osd2.hurd2.h_i_gid_high 225 #define i_author osd2.hurd2.h_i_author 226 227 #elif defined(__masix__) 228 229 #define i_reserved1 osd1.masix1.m_i_reserved1 230 #define i_frag osd2.masix2.m_i_frag 231 #define i_fsize osd2.masix2.m_i_fsize 232 #define i_reserved2 osd2.masix2.m_i_reserved2 233 234 #endif 235 236 #define EXT3_VALID_FS 0x0001 237 #define EXT3_ERROR_FS 0x0002 238 #define EXT3_ORPHAN_FS 0x0004 239 240 #define EXT3_MOUNT_CHECK 0x00001 241 #define EXT3_MOUNT_OLDALLOC 0x00002 242 #define EXT3_MOUNT_GRPID 0x00004 243 #define EXT3_MOUNT_DEBUG 0x00008 244 #define EXT3_MOUNT_ERRORS_CONT 0x00010 245 #define EXT3_MOUNT_ERRORS_RO 0x00020 246 #define EXT3_MOUNT_ERRORS_PANIC 0x00040 247 #define EXT3_MOUNT_MINIX_DF 0x00080 248 #define EXT3_MOUNT_NOLOAD 0x00100 249 #define EXT3_MOUNT_ABORT 0x00200 250 #define EXT3_MOUNT_DATA_FLAGS 0x00C00 251 #define EXT3_MOUNT_JOURNAL_DATA 0x00400 252 #define EXT3_MOUNT_ORDERED_DATA 0x00800 253 #define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 254 #define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 255 #define EXT3_MOUNT_NO_UID32 0x02000 256 #define EXT3_MOUNT_XATTR_USER 0x04000 257 #define EXT3_MOUNT_POSIX_ACL 0x08000 258 #define EXT3_MOUNT_RESERVATION 0x10000 259 #define EXT3_MOUNT_BARRIER 0x20000 260 #define EXT3_MOUNT_NOBH 0x40000 261 #define EXT3_MOUNT_QUOTA 0x80000 262 #define EXT3_MOUNT_USRQUOTA 0x100000 263 #define EXT3_MOUNT_GRPQUOTA 0x200000 264 265 #ifndef _LINUX_EXT2_FS_H 266 #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt 267 #define set_opt(o, opt) o |= EXT3_MOUNT_##opt 268 #define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_##opt) 269 #else 270 #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD 271 #define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT 272 #define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS 273 #endif 274 275 #define ext3_set_bit ext2_set_bit 276 #define ext3_set_bit_atomic ext2_set_bit_atomic 277 #define ext3_clear_bit ext2_clear_bit 278 #define ext3_clear_bit_atomic ext2_clear_bit_atomic 279 #define ext3_test_bit ext2_test_bit 280 #define ext3_find_first_zero_bit ext2_find_first_zero_bit 281 #define ext3_find_next_zero_bit ext2_find_next_zero_bit 282 283 #define EXT3_DFL_MAX_MNT_COUNT 20 284 #define EXT3_DFL_CHECKINTERVAL 0 285 286 #define EXT3_ERRORS_CONTINUE 1 287 #define EXT3_ERRORS_RO 2 288 #define EXT3_ERRORS_PANIC 3 289 #define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE 290 291 struct ext3_super_block { 292 __le32 s_inodes_count; 293 __le32 s_blocks_count; 294 __le32 s_r_blocks_count; 295 __le32 s_free_blocks_count; 296 __le32 s_free_inodes_count; 297 __le32 s_first_data_block; 298 __le32 s_log_block_size; 299 __le32 s_log_frag_size; 300 __le32 s_blocks_per_group; 301 __le32 s_frags_per_group; 302 __le32 s_inodes_per_group; 303 __le32 s_mtime; 304 __le32 s_wtime; 305 __le16 s_mnt_count; 306 __le16 s_max_mnt_count; 307 __le16 s_magic; 308 __le16 s_state; 309 __le16 s_errors; 310 __le16 s_minor_rev_level; 311 __le32 s_lastcheck; 312 __le32 s_checkinterval; 313 __le32 s_creator_os; 314 __le32 s_rev_level; 315 __le16 s_def_resuid; 316 __le16 s_def_resgid; 317 318 __le32 s_first_ino; 319 __le16 s_inode_size; 320 __le16 s_block_group_nr; 321 __le32 s_feature_compat; 322 __le32 s_feature_incompat; 323 __le32 s_feature_ro_compat; 324 __u8 s_uuid[16]; 325 char s_volume_name[16]; 326 char s_last_mounted[64]; 327 __le32 s_algorithm_usage_bitmap; 328 329 __u8 s_prealloc_blocks; 330 __u8 s_prealloc_dir_blocks; 331 __u16 s_reserved_gdt_blocks; 332 333 __u8 s_journal_uuid[16]; 334 __le32 s_journal_inum; 335 __le32 s_journal_dev; 336 __le32 s_last_orphan; 337 __le32 s_hash_seed[4]; 338 __u8 s_def_hash_version; 339 __u8 s_reserved_char_pad; 340 __u16 s_reserved_word_pad; 341 __le32 s_default_mount_opts; 342 __le32 s_first_meta_bg; 343 __u32 s_reserved[190]; 344 }; 345 346 #define EXT3_SB(sb) (sb) 347 348 #define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime 349 350 #define EXT3_OS_LINUX 0 351 #define EXT3_OS_HURD 1 352 #define EXT3_OS_MASIX 2 353 #define EXT3_OS_FREEBSD 3 354 #define EXT3_OS_LITES 4 355 356 #define EXT3_GOOD_OLD_REV 0 357 #define EXT3_DYNAMIC_REV 1 358 359 #define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV 360 #define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV 361 362 #define EXT3_GOOD_OLD_INODE_SIZE 128 363 364 #define EXT3_HAS_COMPAT_FEATURE(sb,mask) ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) 365 #define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) 366 #define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) 367 #define EXT3_SET_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) 368 #define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) 369 #define EXT3_SET_INCOMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) 370 #define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) 371 #define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) 372 #define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) 373 374 #define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001 375 #define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002 376 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 377 #define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008 378 #define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010 379 #define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020 380 381 #define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 382 #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 383 #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 384 385 #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001 386 #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002 387 #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 388 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 389 #define EXT3_FEATURE_INCOMPAT_META_BG 0x0010 390 391 #define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR 392 #define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| EXT3_FEATURE_INCOMPAT_RECOVER| EXT3_FEATURE_INCOMPAT_META_BG) 393 #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| EXT3_FEATURE_RO_COMPAT_LARGE_FILE| EXT3_FEATURE_RO_COMPAT_BTREE_DIR) 394 395 #define EXT3_DEF_RESUID 0 396 #define EXT3_DEF_RESGID 0 397 398 #define EXT3_DEFM_DEBUG 0x0001 399 #define EXT3_DEFM_BSDGROUPS 0x0002 400 #define EXT3_DEFM_XATTR_USER 0x0004 401 #define EXT3_DEFM_ACL 0x0008 402 #define EXT3_DEFM_UID16 0x0010 403 #define EXT3_DEFM_JMODE 0x0060 404 #define EXT3_DEFM_JMODE_DATA 0x0020 405 #define EXT3_DEFM_JMODE_ORDERED 0x0040 406 #define EXT3_DEFM_JMODE_WBACK 0x0060 407 408 #define EXT3_NAME_LEN 255 409 410 struct ext3_dir_entry { 411 __le32 inode; 412 __le16 rec_len; 413 __le16 name_len; 414 char name[EXT3_NAME_LEN]; 415 }; 416 417 struct ext3_dir_entry_2 { 418 __le32 inode; 419 __le16 rec_len; 420 __u8 name_len; 421 __u8 file_type; 422 char name[EXT3_NAME_LEN]; 423 }; 424 425 #define EXT3_FT_UNKNOWN 0 426 #define EXT3_FT_REG_FILE 1 427 #define EXT3_FT_DIR 2 428 #define EXT3_FT_CHRDEV 3 429 #define EXT3_FT_BLKDEV 4 430 #define EXT3_FT_FIFO 5 431 #define EXT3_FT_SOCK 6 432 #define EXT3_FT_SYMLINK 7 433 434 #define EXT3_FT_MAX 8 435 436 #define EXT3_DIR_PAD 4 437 #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) 438 #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & ~EXT3_DIR_ROUND) 439 440 #define is_dx(dir) 0 441 #define EXT3_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT3_LINK_MAX) 442 #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2) 443 444 #define DX_HASH_LEGACY 0 445 #define DX_HASH_HALF_MD4 1 446 #define DX_HASH_TEA 2 447 448 #endif 449