| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 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 | ***   To edit the content of this header, modify the corresponding | 
|  | 11 | ***   source file (e.g. under external/kernel-headers/original/) then | 
|  | 12 | ***   run bionic/libc/kernel/tools/update_all.py | 
|  | 13 | *** | 
|  | 14 | ***   Any manual change here will be lost the next time this script will | 
|  | 15 | ***   be run. You've been warned! | 
|  | 16 | *** | 
|  | 17 | **************************************************************************** | 
|  | 18 | ****************************************************************************/ | 
|  | 19 | #ifndef _BTRFS_CTREE_H_ | 
|  | 20 | #define _BTRFS_CTREE_H_ | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 21 | #include <linux/btrfs.h> | 
|  | 22 | #include <linux/types.h> | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 23 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL | 
|  | 24 | #define BTRFS_EXTENT_TREE_OBJECTID 2ULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 25 | #define BTRFS_CHUNK_TREE_OBJECTID 3ULL | 
|  | 26 | #define BTRFS_DEV_TREE_OBJECTID 4ULL | 
|  | 27 | #define BTRFS_FS_TREE_OBJECTID 5ULL | 
|  | 28 | #define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 29 | #define BTRFS_CSUM_TREE_OBJECTID 7ULL | 
|  | 30 | #define BTRFS_QUOTA_TREE_OBJECTID 8ULL | 
|  | 31 | #define BTRFS_UUID_TREE_OBJECTID 9ULL | 
|  | 32 | #define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 33 | #define BTRFS_DEV_STATS_OBJECTID 0ULL | 
|  | 34 | #define BTRFS_BALANCE_OBJECTID - 4ULL | 
|  | 35 | #define BTRFS_ORPHAN_OBJECTID - 5ULL | 
|  | 36 | #define BTRFS_TREE_LOG_OBJECTID - 6ULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 37 | #define BTRFS_TREE_LOG_FIXUP_OBJECTID - 7ULL | 
|  | 38 | #define BTRFS_TREE_RELOC_OBJECTID - 8ULL | 
|  | 39 | #define BTRFS_DATA_RELOC_TREE_OBJECTID - 9ULL | 
|  | 40 | #define BTRFS_EXTENT_CSUM_OBJECTID - 10ULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 41 | #define BTRFS_FREE_SPACE_OBJECTID - 11ULL | 
|  | 42 | #define BTRFS_FREE_INO_OBJECTID - 12ULL | 
|  | 43 | #define BTRFS_MULTIPLE_OBJECTIDS - 255ULL | 
|  | 44 | #define BTRFS_FIRST_FREE_OBJECTID 256ULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 45 | #define BTRFS_LAST_FREE_OBJECTID - 256ULL | 
|  | 46 | #define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL | 
|  | 47 | #define BTRFS_DEV_ITEMS_OBJECTID 1ULL | 
|  | 48 | #define BTRFS_BTREE_INODE_OBJECTID 1 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 49 | #define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2 | 
|  | 50 | #define BTRFS_DEV_REPLACE_DEVID 0ULL | 
|  | 51 | #define BTRFS_INODE_ITEM_KEY 1 | 
|  | 52 | #define BTRFS_INODE_REF_KEY 12 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 53 | #define BTRFS_INODE_EXTREF_KEY 13 | 
|  | 54 | #define BTRFS_XATTR_ITEM_KEY 24 | 
|  | 55 | #define BTRFS_ORPHAN_ITEM_KEY 48 | 
|  | 56 | #define BTRFS_DIR_LOG_ITEM_KEY 60 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 57 | #define BTRFS_DIR_LOG_INDEX_KEY 72 | 
|  | 58 | #define BTRFS_DIR_ITEM_KEY 84 | 
|  | 59 | #define BTRFS_DIR_INDEX_KEY 96 | 
|  | 60 | #define BTRFS_EXTENT_DATA_KEY 108 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 61 | #define BTRFS_EXTENT_CSUM_KEY 128 | 
|  | 62 | #define BTRFS_ROOT_ITEM_KEY 132 | 
|  | 63 | #define BTRFS_ROOT_BACKREF_KEY 144 | 
|  | 64 | #define BTRFS_ROOT_REF_KEY 156 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 65 | #define BTRFS_EXTENT_ITEM_KEY 168 | 
|  | 66 | #define BTRFS_METADATA_ITEM_KEY 169 | 
|  | 67 | #define BTRFS_TREE_BLOCK_REF_KEY 176 | 
|  | 68 | #define BTRFS_EXTENT_DATA_REF_KEY 178 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 69 | #define BTRFS_EXTENT_REF_V0_KEY 180 | 
|  | 70 | #define BTRFS_SHARED_BLOCK_REF_KEY 182 | 
|  | 71 | #define BTRFS_SHARED_DATA_REF_KEY 184 | 
|  | 72 | #define BTRFS_BLOCK_GROUP_ITEM_KEY 192 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 73 | #define BTRFS_FREE_SPACE_INFO_KEY 198 | 
|  | 74 | #define BTRFS_FREE_SPACE_EXTENT_KEY 199 | 
|  | 75 | #define BTRFS_FREE_SPACE_BITMAP_KEY 200 | 
|  | 76 | #define BTRFS_DEV_EXTENT_KEY 204 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 77 | #define BTRFS_DEV_ITEM_KEY 216 | 
|  | 78 | #define BTRFS_CHUNK_ITEM_KEY 228 | 
|  | 79 | #define BTRFS_QGROUP_STATUS_KEY 240 | 
|  | 80 | #define BTRFS_QGROUP_INFO_KEY 242 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 81 | #define BTRFS_QGROUP_LIMIT_KEY 244 | 
|  | 82 | #define BTRFS_QGROUP_RELATION_KEY 246 | 
|  | 83 | #define BTRFS_BALANCE_ITEM_KEY 248 | 
|  | 84 | #define BTRFS_TEMPORARY_ITEM_KEY 248 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 85 | #define BTRFS_DEV_STATS_KEY 249 | 
|  | 86 | #define BTRFS_PERSISTENT_ITEM_KEY 249 | 
|  | 87 | #define BTRFS_DEV_REPLACE_KEY 250 | 
|  | 88 | #if BTRFS_UUID_SIZE != 16 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 89 | #error "UUID items require BTRFS_UUID_SIZE == 16!" | 
|  | 90 | #endif | 
|  | 91 | #define BTRFS_UUID_KEY_SUBVOL 251 | 
|  | 92 | #define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 93 | #define BTRFS_STRING_ITEM_KEY 253 | 
|  | 94 | #define BTRFS_CSUM_SIZE 32 | 
|  | 95 | #define BTRFS_CSUM_TYPE_CRC32 0 | 
|  | 96 | #define BTRFS_FT_UNKNOWN 0 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 97 | #define BTRFS_FT_REG_FILE 1 | 
|  | 98 | #define BTRFS_FT_DIR 2 | 
|  | 99 | #define BTRFS_FT_CHRDEV 3 | 
|  | 100 | #define BTRFS_FT_BLKDEV 4 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 101 | #define BTRFS_FT_FIFO 5 | 
|  | 102 | #define BTRFS_FT_SOCK 6 | 
|  | 103 | #define BTRFS_FT_SYMLINK 7 | 
|  | 104 | #define BTRFS_FT_XATTR 8 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 105 | #define BTRFS_FT_MAX 9 | 
|  | 106 | struct btrfs_disk_key { | 
|  | 107 | __le64 objectid; | 
|  | 108 | __u8 type; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 109 | __le64 offset; | 
|  | 110 | } __attribute__((__packed__)); | 
|  | 111 | struct btrfs_key { | 
|  | 112 | __u64 objectid; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 113 | __u8 type; | 
|  | 114 | __u64 offset; | 
|  | 115 | } __attribute__((__packed__)); | 
|  | 116 | struct btrfs_dev_item { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 117 | __le64 devid; | 
|  | 118 | __le64 total_bytes; | 
|  | 119 | __le64 bytes_used; | 
|  | 120 | __le32 io_align; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 121 | __le32 io_width; | 
|  | 122 | __le32 sector_size; | 
|  | 123 | __le64 type; | 
|  | 124 | __le64 generation; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 125 | __le64 start_offset; | 
|  | 126 | __le32 dev_group; | 
|  | 127 | __u8 seek_speed; | 
|  | 128 | __u8 bandwidth; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 129 | __u8 uuid[BTRFS_UUID_SIZE]; | 
|  | 130 | __u8 fsid[BTRFS_UUID_SIZE]; | 
|  | 131 | } __attribute__((__packed__)); | 
|  | 132 | struct btrfs_stripe { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 133 | __le64 devid; | 
|  | 134 | __le64 offset; | 
|  | 135 | __u8 dev_uuid[BTRFS_UUID_SIZE]; | 
|  | 136 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 137 | struct btrfs_chunk { | 
|  | 138 | __le64 length; | 
|  | 139 | __le64 owner; | 
|  | 140 | __le64 stripe_len; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 141 | __le64 type; | 
|  | 142 | __le32 io_align; | 
|  | 143 | __le32 io_width; | 
|  | 144 | __le32 sector_size; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 145 | __le16 num_stripes; | 
|  | 146 | __le16 sub_stripes; | 
|  | 147 | struct btrfs_stripe stripe; | 
|  | 148 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 149 | #define BTRFS_FREE_SPACE_EXTENT 1 | 
|  | 150 | #define BTRFS_FREE_SPACE_BITMAP 2 | 
|  | 151 | struct btrfs_free_space_entry { | 
|  | 152 | __le64 offset; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 153 | __le64 bytes; | 
|  | 154 | __u8 type; | 
|  | 155 | } __attribute__((__packed__)); | 
|  | 156 | struct btrfs_free_space_header { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 157 | struct btrfs_disk_key location; | 
|  | 158 | __le64 generation; | 
|  | 159 | __le64 num_entries; | 
|  | 160 | __le64 num_bitmaps; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 161 | } __attribute__((__packed__)); | 
|  | 162 | #define BTRFS_HEADER_FLAG_WRITTEN (1ULL << 0) | 
|  | 163 | #define BTRFS_HEADER_FLAG_RELOC (1ULL << 1) | 
|  | 164 | #define BTRFS_SUPER_FLAG_ERROR (1ULL << 2) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 165 | #define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32) | 
|  | 166 | #define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33) | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 167 | #define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34) | 
|  | 168 | #define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35) | 
| Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 169 | #define BTRFS_SUPER_FLAG_CHANGING_FSID_V2 (1ULL << 36) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 170 | struct btrfs_extent_item { | 
|  | 171 | __le64 refs; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 172 | __le64 generation; | 
|  | 173 | __le64 flags; | 
|  | 174 | } __attribute__((__packed__)); | 
|  | 175 | struct btrfs_extent_item_v0 { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 176 | __le32 refs; | 
|  | 177 | } __attribute__((__packed__)); | 
|  | 178 | #define BTRFS_EXTENT_FLAG_DATA (1ULL << 0) | 
|  | 179 | #define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 180 | #define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8) | 
|  | 181 | #define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48) | 
|  | 182 | struct btrfs_tree_block_info { | 
|  | 183 | struct btrfs_disk_key key; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 184 | __u8 level; | 
|  | 185 | } __attribute__((__packed__)); | 
|  | 186 | struct btrfs_extent_data_ref { | 
|  | 187 | __le64 root; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 188 | __le64 objectid; | 
|  | 189 | __le64 offset; | 
|  | 190 | __le32 count; | 
|  | 191 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 192 | struct btrfs_shared_data_ref { | 
|  | 193 | __le32 count; | 
|  | 194 | } __attribute__((__packed__)); | 
|  | 195 | struct btrfs_extent_inline_ref { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 196 | __u8 type; | 
|  | 197 | __le64 offset; | 
|  | 198 | } __attribute__((__packed__)); | 
|  | 199 | struct btrfs_extent_ref_v0 { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 200 | __le64 root; | 
|  | 201 | __le64 generation; | 
|  | 202 | __le64 objectid; | 
|  | 203 | __le32 count; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 204 | } __attribute__((__packed__)); | 
|  | 205 | struct btrfs_dev_extent { | 
|  | 206 | __le64 chunk_tree; | 
|  | 207 | __le64 chunk_objectid; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 208 | __le64 chunk_offset; | 
|  | 209 | __le64 length; | 
|  | 210 | __u8 chunk_tree_uuid[BTRFS_UUID_SIZE]; | 
|  | 211 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 212 | struct btrfs_inode_ref { | 
|  | 213 | __le64 index; | 
|  | 214 | __le16 name_len; | 
|  | 215 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 216 | struct btrfs_inode_extref { | 
|  | 217 | __le64 parent_objectid; | 
|  | 218 | __le64 index; | 
|  | 219 | __le16 name_len; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 220 | __u8 name[0]; | 
|  | 221 | } __attribute__((__packed__)); | 
|  | 222 | struct btrfs_timespec { | 
|  | 223 | __le64 sec; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 224 | __le32 nsec; | 
|  | 225 | } __attribute__((__packed__)); | 
|  | 226 | struct btrfs_inode_item { | 
|  | 227 | __le64 generation; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 228 | __le64 transid; | 
|  | 229 | __le64 size; | 
|  | 230 | __le64 nbytes; | 
|  | 231 | __le64 block_group; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 232 | __le32 nlink; | 
|  | 233 | __le32 uid; | 
|  | 234 | __le32 gid; | 
|  | 235 | __le32 mode; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 236 | __le64 rdev; | 
|  | 237 | __le64 flags; | 
|  | 238 | __le64 sequence; | 
|  | 239 | __le64 reserved[4]; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 240 | struct btrfs_timespec atime; | 
|  | 241 | struct btrfs_timespec ctime; | 
|  | 242 | struct btrfs_timespec mtime; | 
|  | 243 | struct btrfs_timespec otime; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 244 | } __attribute__((__packed__)); | 
|  | 245 | struct btrfs_dir_log_item { | 
|  | 246 | __le64 end; | 
|  | 247 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 248 | struct btrfs_dir_item { | 
|  | 249 | struct btrfs_disk_key location; | 
|  | 250 | __le64 transid; | 
|  | 251 | __le16 data_len; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 252 | __le16 name_len; | 
|  | 253 | __u8 type; | 
|  | 254 | } __attribute__((__packed__)); | 
|  | 255 | #define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 256 | #define BTRFS_ROOT_SUBVOL_DEAD (1ULL << 48) | 
|  | 257 | struct btrfs_root_item { | 
|  | 258 | struct btrfs_inode_item inode; | 
|  | 259 | __le64 generation; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 260 | __le64 root_dirid; | 
|  | 261 | __le64 bytenr; | 
|  | 262 | __le64 byte_limit; | 
|  | 263 | __le64 bytes_used; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 264 | __le64 last_snapshot; | 
|  | 265 | __le64 flags; | 
|  | 266 | __le32 refs; | 
|  | 267 | struct btrfs_disk_key drop_progress; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 268 | __u8 drop_level; | 
|  | 269 | __u8 level; | 
|  | 270 | __le64 generation_v2; | 
|  | 271 | __u8 uuid[BTRFS_UUID_SIZE]; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 272 | __u8 parent_uuid[BTRFS_UUID_SIZE]; | 
|  | 273 | __u8 received_uuid[BTRFS_UUID_SIZE]; | 
|  | 274 | __le64 ctransid; | 
|  | 275 | __le64 otransid; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 276 | __le64 stransid; | 
|  | 277 | __le64 rtransid; | 
|  | 278 | struct btrfs_timespec ctime; | 
|  | 279 | struct btrfs_timespec otime; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 280 | struct btrfs_timespec stime; | 
|  | 281 | struct btrfs_timespec rtime; | 
|  | 282 | __le64 reserved[8]; | 
|  | 283 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 284 | struct btrfs_root_ref { | 
|  | 285 | __le64 dirid; | 
|  | 286 | __le64 sequence; | 
|  | 287 | __le16 name_len; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 288 | } __attribute__((__packed__)); | 
|  | 289 | struct btrfs_disk_balance_args { | 
|  | 290 | __le64 profiles; | 
|  | 291 | union { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 292 | __le64 usage; | 
|  | 293 | struct { | 
|  | 294 | __le32 usage_min; | 
|  | 295 | __le32 usage_max; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 296 | }; | 
|  | 297 | }; | 
|  | 298 | __le64 devid; | 
|  | 299 | __le64 pstart; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 300 | __le64 pend; | 
|  | 301 | __le64 vstart; | 
|  | 302 | __le64 vend; | 
|  | 303 | __le64 target; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 304 | __le64 flags; | 
|  | 305 | union { | 
|  | 306 | __le64 limit; | 
|  | 307 | struct { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 308 | __le32 limit_min; | 
|  | 309 | __le32 limit_max; | 
|  | 310 | }; | 
|  | 311 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 312 | __le32 stripes_min; | 
|  | 313 | __le32 stripes_max; | 
|  | 314 | __le64 unused[6]; | 
|  | 315 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 316 | struct btrfs_balance_item { | 
|  | 317 | __le64 flags; | 
|  | 318 | struct btrfs_disk_balance_args data; | 
|  | 319 | struct btrfs_disk_balance_args meta; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 320 | struct btrfs_disk_balance_args sys; | 
|  | 321 | __le64 unused[4]; | 
|  | 322 | } __attribute__((__packed__)); | 
|  | 323 | #define BTRFS_FILE_EXTENT_INLINE 0 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 324 | #define BTRFS_FILE_EXTENT_REG 1 | 
|  | 325 | #define BTRFS_FILE_EXTENT_PREALLOC 2 | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 326 | #define BTRFS_FILE_EXTENT_TYPES 2 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 327 | struct btrfs_file_extent_item { | 
|  | 328 | __le64 generation; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 329 | __le64 ram_bytes; | 
|  | 330 | __u8 compression; | 
|  | 331 | __u8 encryption; | 
|  | 332 | __le16 other_encoding; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 333 | __u8 type; | 
|  | 334 | __le64 disk_bytenr; | 
|  | 335 | __le64 disk_num_bytes; | 
|  | 336 | __le64 offset; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 337 | __le64 num_bytes; | 
|  | 338 | } __attribute__((__packed__)); | 
|  | 339 | struct btrfs_csum_item { | 
|  | 340 | __u8 csum; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 341 | } __attribute__((__packed__)); | 
|  | 342 | struct btrfs_dev_stats_item { | 
|  | 343 | __le64 values[BTRFS_DEV_STAT_VALUES_MAX]; | 
|  | 344 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 345 | #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0 | 
|  | 346 | #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID 1 | 
|  | 347 | #define BTRFS_DEV_REPLACE_ITEM_STATE_NEVER_STARTED 0 | 
|  | 348 | #define BTRFS_DEV_REPLACE_ITEM_STATE_STARTED 1 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 349 | #define BTRFS_DEV_REPLACE_ITEM_STATE_SUSPENDED 2 | 
|  | 350 | #define BTRFS_DEV_REPLACE_ITEM_STATE_FINISHED 3 | 
|  | 351 | #define BTRFS_DEV_REPLACE_ITEM_STATE_CANCELED 4 | 
|  | 352 | struct btrfs_dev_replace_item { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 353 | __le64 src_devid; | 
|  | 354 | __le64 cursor_left; | 
|  | 355 | __le64 cursor_right; | 
|  | 356 | __le64 cont_reading_from_srcdev_mode; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 357 | __le64 replace_state; | 
|  | 358 | __le64 time_started; | 
|  | 359 | __le64 time_stopped; | 
|  | 360 | __le64 num_write_errors; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 361 | __le64 num_uncorrectable_read_errors; | 
|  | 362 | } __attribute__((__packed__)); | 
|  | 363 | #define BTRFS_BLOCK_GROUP_DATA (1ULL << 0) | 
|  | 364 | #define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 365 | #define BTRFS_BLOCK_GROUP_METADATA (1ULL << 2) | 
|  | 366 | #define BTRFS_BLOCK_GROUP_RAID0 (1ULL << 3) | 
|  | 367 | #define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4) | 
|  | 368 | #define BTRFS_BLOCK_GROUP_DUP (1ULL << 5) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 369 | #define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6) | 
|  | 370 | #define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7) | 
|  | 371 | #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8) | 
|  | 372 | #define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | BTRFS_SPACE_INFO_GLOBAL_RSV) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 373 | enum btrfs_raid_types { | 
|  | 374 | BTRFS_RAID_RAID10, | 
|  | 375 | BTRFS_RAID_RAID1, | 
|  | 376 | BTRFS_RAID_DUP, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 377 | BTRFS_RAID_RAID0, | 
|  | 378 | BTRFS_RAID_SINGLE, | 
|  | 379 | BTRFS_RAID_RAID5, | 
|  | 380 | BTRFS_RAID_RAID6, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 381 | BTRFS_NR_RAID_TYPES | 
|  | 382 | }; | 
|  | 383 | #define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_SYSTEM | BTRFS_BLOCK_GROUP_METADATA) | 
|  | 384 | #define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID10) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 385 | #define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6) | 
|  | 386 | #define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48) | 
|  | 387 | #define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49) | 
|  | 388 | #define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | BTRFS_AVAIL_ALLOC_BIT_SINGLE) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 389 | struct btrfs_block_group_item { | 
|  | 390 | __le64 used; | 
|  | 391 | __le64 chunk_objectid; | 
|  | 392 | __le64 flags; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 393 | } __attribute__((__packed__)); | 
|  | 394 | struct btrfs_free_space_info { | 
|  | 395 | __le32 extent_count; | 
|  | 396 | __le32 flags; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 397 | } __attribute__((__packed__)); | 
|  | 398 | #define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0) | 
|  | 399 | #define BTRFS_QGROUP_LEVEL_SHIFT 48 | 
|  | 400 | #define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 401 | #define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1) | 
|  | 402 | #define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2) | 
|  | 403 | #define BTRFS_QGROUP_STATUS_VERSION 1 | 
|  | 404 | struct btrfs_qgroup_status_item { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 405 | __le64 version; | 
|  | 406 | __le64 generation; | 
|  | 407 | __le64 flags; | 
|  | 408 | __le64 rescan; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 409 | } __attribute__((__packed__)); | 
|  | 410 | struct btrfs_qgroup_info_item { | 
|  | 411 | __le64 generation; | 
|  | 412 | __le64 rfer; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 413 | __le64 rfer_cmpr; | 
|  | 414 | __le64 excl; | 
|  | 415 | __le64 excl_cmpr; | 
|  | 416 | } __attribute__((__packed__)); | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 417 | struct btrfs_qgroup_limit_item { | 
|  | 418 | __le64 flags; | 
|  | 419 | __le64 max_rfer; | 
|  | 420 | __le64 max_excl; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 421 | __le64 rsv_rfer; | 
|  | 422 | __le64 rsv_excl; | 
|  | 423 | } __attribute__((__packed__)); | 
|  | 424 | #endif |