blob: 0476733596d7c37fed49c55c867bd5287a2692d3 [file] [log] [blame]
Christopher Ferris106b3a82016-08-24 12:15:38 -07001/****************************************************************************
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 Ferris525ce912017-07-26 13:12:53 -070021#include <linux/btrfs.h>
22#include <linux/types.h>
Christopher Ferris32ff3f82020-12-14 13:10:04 -080023#include <stddef.h>
Christopher Ferris106b3a82016-08-24 12:15:38 -070024#define BTRFS_ROOT_TREE_OBJECTID 1ULL
25#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070026#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 Ferris106b3a82016-08-24 12:15:38 -070030#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 Ferris106b3a82016-08-24 12:15:38 -070034#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 Ferris106b3a82016-08-24 12:15:38 -070038#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 Ferris106b3a82016-08-24 12:15:38 -070042#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 Ferris106b3a82016-08-24 12:15:38 -070046#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 Ferris106b3a82016-08-24 12:15:38 -070050#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 Ferris106b3a82016-08-24 12:15:38 -070054#define BTRFS_INODE_EXTREF_KEY 13
55#define BTRFS_XATTR_ITEM_KEY 24
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070056#define BTRFS_VERITY_DESC_ITEM_KEY 36
57#define BTRFS_VERITY_MERKLE_ITEM_KEY 37
Christopher Ferris106b3a82016-08-24 12:15:38 -070058#define BTRFS_ORPHAN_ITEM_KEY 48
59#define BTRFS_DIR_LOG_ITEM_KEY 60
Christopher Ferris106b3a82016-08-24 12:15:38 -070060#define BTRFS_DIR_LOG_INDEX_KEY 72
61#define BTRFS_DIR_ITEM_KEY 84
62#define BTRFS_DIR_INDEX_KEY 96
63#define BTRFS_EXTENT_DATA_KEY 108
Christopher Ferris106b3a82016-08-24 12:15:38 -070064#define BTRFS_EXTENT_CSUM_KEY 128
65#define BTRFS_ROOT_ITEM_KEY 132
66#define BTRFS_ROOT_BACKREF_KEY 144
67#define BTRFS_ROOT_REF_KEY 156
Christopher Ferris106b3a82016-08-24 12:15:38 -070068#define BTRFS_EXTENT_ITEM_KEY 168
69#define BTRFS_METADATA_ITEM_KEY 169
70#define BTRFS_TREE_BLOCK_REF_KEY 176
71#define BTRFS_EXTENT_DATA_REF_KEY 178
Christopher Ferris106b3a82016-08-24 12:15:38 -070072#define BTRFS_EXTENT_REF_V0_KEY 180
73#define BTRFS_SHARED_BLOCK_REF_KEY 182
74#define BTRFS_SHARED_DATA_REF_KEY 184
75#define BTRFS_BLOCK_GROUP_ITEM_KEY 192
Christopher Ferris106b3a82016-08-24 12:15:38 -070076#define BTRFS_FREE_SPACE_INFO_KEY 198
77#define BTRFS_FREE_SPACE_EXTENT_KEY 199
78#define BTRFS_FREE_SPACE_BITMAP_KEY 200
79#define BTRFS_DEV_EXTENT_KEY 204
Christopher Ferris106b3a82016-08-24 12:15:38 -070080#define BTRFS_DEV_ITEM_KEY 216
81#define BTRFS_CHUNK_ITEM_KEY 228
82#define BTRFS_QGROUP_STATUS_KEY 240
83#define BTRFS_QGROUP_INFO_KEY 242
Christopher Ferris106b3a82016-08-24 12:15:38 -070084#define BTRFS_QGROUP_LIMIT_KEY 244
85#define BTRFS_QGROUP_RELATION_KEY 246
86#define BTRFS_BALANCE_ITEM_KEY 248
87#define BTRFS_TEMPORARY_ITEM_KEY 248
Christopher Ferris106b3a82016-08-24 12:15:38 -070088#define BTRFS_DEV_STATS_KEY 249
89#define BTRFS_PERSISTENT_ITEM_KEY 249
90#define BTRFS_DEV_REPLACE_KEY 250
91#if BTRFS_UUID_SIZE != 16
Christopher Ferris106b3a82016-08-24 12:15:38 -070092#error "UUID items require BTRFS_UUID_SIZE == 16!"
93#endif
94#define BTRFS_UUID_KEY_SUBVOL 251
95#define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252
Christopher Ferris106b3a82016-08-24 12:15:38 -070096#define BTRFS_STRING_ITEM_KEY 253
Christopher Ferris05667cd2021-02-16 16:01:34 -080097#define BTRFS_MAX_METADATA_BLOCKSIZE 65536
Christopher Ferris106b3a82016-08-24 12:15:38 -070098#define BTRFS_CSUM_SIZE 32
Christopher Ferris9584fa42019-12-09 15:36:13 -080099enum btrfs_csum_type {
100 BTRFS_CSUM_TYPE_CRC32 = 0,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800101 BTRFS_CSUM_TYPE_XXHASH = 1,
102 BTRFS_CSUM_TYPE_SHA256 = 2,
103 BTRFS_CSUM_TYPE_BLAKE2 = 3,
Christopher Ferris9584fa42019-12-09 15:36:13 -0800104};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700105#define BTRFS_FT_UNKNOWN 0
Christopher Ferris106b3a82016-08-24 12:15:38 -0700106#define BTRFS_FT_REG_FILE 1
107#define BTRFS_FT_DIR 2
108#define BTRFS_FT_CHRDEV 3
109#define BTRFS_FT_BLKDEV 4
Christopher Ferris106b3a82016-08-24 12:15:38 -0700110#define BTRFS_FT_FIFO 5
111#define BTRFS_FT_SOCK 6
112#define BTRFS_FT_SYMLINK 7
113#define BTRFS_FT_XATTR 8
Christopher Ferris106b3a82016-08-24 12:15:38 -0700114#define BTRFS_FT_MAX 9
115struct btrfs_disk_key {
116 __le64 objectid;
117 __u8 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700118 __le64 offset;
119} __attribute__((__packed__));
120struct btrfs_key {
121 __u64 objectid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700122 __u8 type;
123 __u64 offset;
124} __attribute__((__packed__));
125struct btrfs_dev_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700126 __le64 devid;
127 __le64 total_bytes;
128 __le64 bytes_used;
129 __le32 io_align;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700130 __le32 io_width;
131 __le32 sector_size;
132 __le64 type;
133 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700134 __le64 start_offset;
135 __le32 dev_group;
136 __u8 seek_speed;
137 __u8 bandwidth;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700138 __u8 uuid[BTRFS_UUID_SIZE];
139 __u8 fsid[BTRFS_UUID_SIZE];
140} __attribute__((__packed__));
141struct btrfs_stripe {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700142 __le64 devid;
143 __le64 offset;
144 __u8 dev_uuid[BTRFS_UUID_SIZE];
145} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700146struct btrfs_chunk {
147 __le64 length;
148 __le64 owner;
149 __le64 stripe_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700150 __le64 type;
151 __le32 io_align;
152 __le32 io_width;
153 __le32 sector_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700154 __le16 num_stripes;
155 __le16 sub_stripes;
156 struct btrfs_stripe stripe;
157} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700158#define BTRFS_FREE_SPACE_EXTENT 1
159#define BTRFS_FREE_SPACE_BITMAP 2
160struct btrfs_free_space_entry {
161 __le64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700162 __le64 bytes;
163 __u8 type;
164} __attribute__((__packed__));
165struct btrfs_free_space_header {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700166 struct btrfs_disk_key location;
167 __le64 generation;
168 __le64 num_entries;
169 __le64 num_bitmaps;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700170} __attribute__((__packed__));
171#define BTRFS_HEADER_FLAG_WRITTEN (1ULL << 0)
172#define BTRFS_HEADER_FLAG_RELOC (1ULL << 1)
173#define BTRFS_SUPER_FLAG_ERROR (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700174#define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32)
175#define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700176#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)
177#define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35)
Christopher Ferrisd842e432019-03-07 10:21:59 -0800178#define BTRFS_SUPER_FLAG_CHANGING_FSID_V2 (1ULL << 36)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700179struct btrfs_extent_item {
180 __le64 refs;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700181 __le64 generation;
182 __le64 flags;
183} __attribute__((__packed__));
184struct btrfs_extent_item_v0 {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700185 __le32 refs;
186} __attribute__((__packed__));
187#define BTRFS_EXTENT_FLAG_DATA (1ULL << 0)
188#define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700189#define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8)
190#define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48)
191struct btrfs_tree_block_info {
192 struct btrfs_disk_key key;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700193 __u8 level;
194} __attribute__((__packed__));
195struct btrfs_extent_data_ref {
196 __le64 root;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700197 __le64 objectid;
198 __le64 offset;
199 __le32 count;
200} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700201struct btrfs_shared_data_ref {
202 __le32 count;
203} __attribute__((__packed__));
204struct btrfs_extent_inline_ref {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700205 __u8 type;
206 __le64 offset;
207} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700208struct btrfs_dev_extent {
209 __le64 chunk_tree;
210 __le64 chunk_objectid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700211 __le64 chunk_offset;
212 __le64 length;
213 __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
214} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700215struct btrfs_inode_ref {
216 __le64 index;
217 __le16 name_len;
218} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700219struct btrfs_inode_extref {
220 __le64 parent_objectid;
221 __le64 index;
222 __le16 name_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700223 __u8 name[0];
224} __attribute__((__packed__));
225struct btrfs_timespec {
226 __le64 sec;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700227 __le32 nsec;
228} __attribute__((__packed__));
229struct btrfs_inode_item {
230 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700231 __le64 transid;
232 __le64 size;
233 __le64 nbytes;
234 __le64 block_group;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700235 __le32 nlink;
236 __le32 uid;
237 __le32 gid;
238 __le32 mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700239 __le64 rdev;
240 __le64 flags;
241 __le64 sequence;
242 __le64 reserved[4];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700243 struct btrfs_timespec atime;
244 struct btrfs_timespec ctime;
245 struct btrfs_timespec mtime;
246 struct btrfs_timespec otime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700247} __attribute__((__packed__));
248struct btrfs_dir_log_item {
249 __le64 end;
250} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700251struct btrfs_dir_item {
252 struct btrfs_disk_key location;
253 __le64 transid;
254 __le16 data_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700255 __le16 name_len;
256 __u8 type;
257} __attribute__((__packed__));
258#define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700259#define BTRFS_ROOT_SUBVOL_DEAD (1ULL << 48)
260struct btrfs_root_item {
261 struct btrfs_inode_item inode;
262 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700263 __le64 root_dirid;
264 __le64 bytenr;
265 __le64 byte_limit;
266 __le64 bytes_used;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700267 __le64 last_snapshot;
268 __le64 flags;
269 __le32 refs;
270 struct btrfs_disk_key drop_progress;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700271 __u8 drop_level;
272 __u8 level;
273 __le64 generation_v2;
274 __u8 uuid[BTRFS_UUID_SIZE];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700275 __u8 parent_uuid[BTRFS_UUID_SIZE];
276 __u8 received_uuid[BTRFS_UUID_SIZE];
277 __le64 ctransid;
278 __le64 otransid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700279 __le64 stransid;
280 __le64 rtransid;
281 struct btrfs_timespec ctime;
282 struct btrfs_timespec otime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700283 struct btrfs_timespec stime;
284 struct btrfs_timespec rtime;
285 __le64 reserved[8];
286} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700287struct btrfs_root_ref {
288 __le64 dirid;
289 __le64 sequence;
290 __le16 name_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700291} __attribute__((__packed__));
292struct btrfs_disk_balance_args {
293 __le64 profiles;
294 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700295 __le64 usage;
296 struct {
297 __le32 usage_min;
298 __le32 usage_max;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700299 };
300 };
301 __le64 devid;
302 __le64 pstart;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700303 __le64 pend;
304 __le64 vstart;
305 __le64 vend;
306 __le64 target;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700307 __le64 flags;
308 union {
309 __le64 limit;
310 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700311 __le32 limit_min;
312 __le32 limit_max;
313 };
314 };
Christopher Ferris106b3a82016-08-24 12:15:38 -0700315 __le32 stripes_min;
316 __le32 stripes_max;
317 __le64 unused[6];
318} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700319struct btrfs_balance_item {
320 __le64 flags;
321 struct btrfs_disk_balance_args data;
322 struct btrfs_disk_balance_args meta;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700323 struct btrfs_disk_balance_args sys;
324 __le64 unused[4];
325} __attribute__((__packed__));
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800326enum {
327 BTRFS_FILE_EXTENT_INLINE = 0,
328 BTRFS_FILE_EXTENT_REG = 1,
329 BTRFS_FILE_EXTENT_PREALLOC = 2,
330 BTRFS_NR_FILE_EXTENT_TYPES = 3,
331};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700332struct btrfs_file_extent_item {
333 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700334 __le64 ram_bytes;
335 __u8 compression;
336 __u8 encryption;
337 __le16 other_encoding;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700338 __u8 type;
339 __le64 disk_bytenr;
340 __le64 disk_num_bytes;
341 __le64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700342 __le64 num_bytes;
343} __attribute__((__packed__));
344struct btrfs_csum_item {
345 __u8 csum;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700346} __attribute__((__packed__));
347struct btrfs_dev_stats_item {
348 __le64 values[BTRFS_DEV_STAT_VALUES_MAX];
349} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700350#define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
351#define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700352struct btrfs_dev_replace_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700353 __le64 src_devid;
354 __le64 cursor_left;
355 __le64 cursor_right;
356 __le64 cont_reading_from_srcdev_mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700357 __le64 replace_state;
358 __le64 time_started;
359 __le64 time_stopped;
360 __le64 num_write_errors;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700361 __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 Ferris106b3a82016-08-24 12:15:38 -0700365#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 Ferris106b3a82016-08-24 12:15:38 -0700369#define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6)
370#define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7)
371#define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800372#define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
373#define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700374#define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | BTRFS_SPACE_INFO_GLOBAL_RSV)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700375enum btrfs_raid_types {
376 BTRFS_RAID_RAID10,
377 BTRFS_RAID_RAID1,
378 BTRFS_RAID_DUP,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700379 BTRFS_RAID_RAID0,
380 BTRFS_RAID_SINGLE,
381 BTRFS_RAID_RAID5,
382 BTRFS_RAID_RAID6,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800383 BTRFS_RAID_RAID1C3,
384 BTRFS_RAID_RAID1C4,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700385 BTRFS_NR_RAID_TYPES
386};
387#define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_SYSTEM | BTRFS_BLOCK_GROUP_METADATA)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800388#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 Ferris106b3a82016-08-24 12:15:38 -0700389#define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800390#define BTRFS_BLOCK_GROUP_RAID1_MASK (BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700391#define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48)
392#define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49)
393#define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | BTRFS_AVAIL_ALLOC_BIT_SINGLE)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700394struct btrfs_block_group_item {
395 __le64 used;
396 __le64 chunk_objectid;
397 __le64 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700398} __attribute__((__packed__));
399struct btrfs_free_space_info {
400 __le32 extent_count;
401 __le32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700402} __attribute__((__packed__));
403#define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0)
404#define BTRFS_QGROUP_LEVEL_SHIFT 48
405#define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700406#define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1)
407#define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2)
408#define BTRFS_QGROUP_STATUS_VERSION 1
409struct btrfs_qgroup_status_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700410 __le64 version;
411 __le64 generation;
412 __le64 flags;
413 __le64 rescan;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700414} __attribute__((__packed__));
415struct btrfs_qgroup_info_item {
416 __le64 generation;
417 __le64 rfer;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700418 __le64 rfer_cmpr;
419 __le64 excl;
420 __le64 excl_cmpr;
421} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700422struct btrfs_qgroup_limit_item {
423 __le64 flags;
424 __le64 max_rfer;
425 __le64 max_excl;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700426 __le64 rsv_rfer;
427 __le64 rsv_excl;
428} __attribute__((__packed__));
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700429struct btrfs_verity_descriptor_item {
430 __le64 size;
431 __le64 reserved[2];
432 __u8 encryption;
433} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700434#endif