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