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 _EXT4_EXTENTS 13 #define _EXT4_EXTENTS 14 15 #include "ext4_utils/ext4.h" 16 17 #define AGGRESSIVE_TEST_ 18 19 #define EXTENTS_STATS__ 20 21 #define CHECK_BINSEARCH__ 22 23 #define EXT_DEBUG__ 24 #ifdef EXT_DEBUG 25 #define ext_debug(a...) printk(a) 26 #else 27 #define ext_debug(a...) 28 #endif 29 30 #define EXT_STATS_ 31 32 struct ext4_extent { 33 __le32 ee_block; 34 __le16 ee_len; 35 __le16 ee_start_hi; 36 __le32 ee_start_lo; 37 }; 38 39 struct ext4_extent_idx { 40 __le32 ei_block; 41 __le32 ei_leaf_lo; 42 __le16 ei_leaf_hi; 43 __u16 ei_unused; 44 }; 45 46 struct ext4_extent_header { 47 __le16 eh_magic; 48 __le16 eh_entries; 49 __le16 eh_max; 50 __le16 eh_depth; 51 __le32 eh_generation; 52 }; 53 54 #define EXT4_EXT_MAGIC 0xf30a 55 56 struct ext4_ext_path { 57 ext4_fsblk_t p_block; 58 __u16 p_depth; 59 struct ext4_extent *p_ext; 60 struct ext4_extent_idx *p_idx; 61 struct ext4_extent_header *p_hdr; 62 struct buffer_head *p_bh; 63 }; 64 65 #define EXT4_EXT_CACHE_NO 0 66 #define EXT4_EXT_CACHE_GAP 1 67 #define EXT4_EXT_CACHE_EXTENT 2 68 69 #define EXT_CONTINUE 0 70 #define EXT_BREAK 1 71 #define EXT_REPEAT 2 72 73 #define EXT_MAX_BLOCK 0xffffffff 74 75 #define EXT_INIT_MAX_LEN (1UL << 15) 76 #define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1) 77 78 #define EXT_FIRST_EXTENT(__hdr__) ((struct ext4_extent *) (((char *) (__hdr__)) + sizeof(struct ext4_extent_header))) 79 #define EXT_FIRST_INDEX(__hdr__) ((struct ext4_extent_idx *) (((char *) (__hdr__)) + sizeof(struct ext4_extent_header))) 80 #define EXT_HAS_FREE_INDEX(__path__) (le16_to_cpu((__path__)->p_hdr->eh_entries) < le16_to_cpu((__path__)->p_hdr->eh_max)) 81 #define EXT_LAST_EXTENT(__hdr__) (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) 82 #define EXT_LAST_INDEX(__hdr__) (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) 83 #define EXT_MAX_EXTENT(__hdr__) (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) 84 #define EXT_MAX_INDEX(__hdr__) (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) 85 86 #endif 87 88 89