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