]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/missing_btrfs_tree.h
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / src / basic / missing_btrfs_tree.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <linux/types.h>
5
6 #include "missing_btrfs.h"
7
8 /* linux@db6711600e27c885aed89751f04e727f3af26715 (4.7) */
9 #if HAVE_LINUX_BTRFS_TREE_H
10 #include <linux/btrfs_tree.h>
11 #else
12 #define BTRFS_ROOT_TREE_OBJECTID 1
13 #define BTRFS_QUOTA_TREE_OBJECTID 8
14 #define BTRFS_FIRST_FREE_OBJECTID 256
15 #define BTRFS_LAST_FREE_OBJECTID -256ULL
16
17 #define BTRFS_ROOT_ITEM_KEY 132
18 #define BTRFS_ROOT_BACKREF_KEY 144
19 #define BTRFS_QGROUP_STATUS_KEY 240
20 #define BTRFS_QGROUP_INFO_KEY 242
21 #define BTRFS_QGROUP_LIMIT_KEY 244
22 #define BTRFS_QGROUP_RELATION_KEY 246
23
24 struct btrfs_disk_key {
25 __le64 objectid;
26 __u8 type;
27 __le64 offset;
28 } __attribute__ ((__packed__));
29
30 struct btrfs_timespec {
31 __le64 sec;
32 __le32 nsec;
33 } __attribute__ ((__packed__));
34
35 struct btrfs_inode_item {
36 __le64 generation;
37 __le64 transid;
38 __le64 size;
39 __le64 nbytes;
40 __le64 block_group;
41 __le32 nlink;
42 __le32 uid;
43 __le32 gid;
44 __le32 mode;
45 __le64 rdev;
46 __le64 flags;
47 __le64 sequence;
48 __le64 reserved[4];
49 struct btrfs_timespec atime;
50 struct btrfs_timespec ctime;
51 struct btrfs_timespec mtime;
52 struct btrfs_timespec otime;
53 } __attribute__ ((__packed__));
54
55 #define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0)
56
57 struct btrfs_root_item {
58 struct btrfs_inode_item inode;
59 __le64 generation;
60 __le64 root_dirid;
61 __le64 bytenr;
62 __le64 byte_limit;
63 __le64 bytes_used;
64 __le64 last_snapshot;
65 __le64 flags;
66 __le32 refs;
67 struct btrfs_disk_key drop_progress;
68 __u8 drop_level;
69 __u8 level;
70
71 __le64 generation_v2;
72 __u8 uuid[BTRFS_UUID_SIZE];
73 __u8 parent_uuid[BTRFS_UUID_SIZE];
74 __u8 received_uuid[BTRFS_UUID_SIZE];
75 __le64 ctransid; /* updated when an inode changes */
76 __le64 otransid; /* trans when created */
77 __le64 stransid; /* trans when sent. non-zero for received subvol */
78 __le64 rtransid; /* trans when received. non-zero for received subvol */
79 struct btrfs_timespec ctime;
80 struct btrfs_timespec otime;
81 struct btrfs_timespec stime;
82 struct btrfs_timespec rtime;
83 __le64 reserved[8]; /* for future */
84 } __attribute__ ((__packed__));
85
86 struct btrfs_root_ref {
87 __le64 dirid;
88 __le64 sequence;
89 __le16 name_len;
90 } __attribute__ ((__packed__));
91
92 #define BTRFS_QGROUP_LEVEL_SHIFT 48
93
94 struct btrfs_qgroup_info_item {
95 __le64 generation;
96 __le64 rfer;
97 __le64 rfer_cmpr;
98 __le64 excl;
99 __le64 excl_cmpr;
100 } __attribute__ ((__packed__));
101
102 struct btrfs_qgroup_limit_item {
103 __le64 flags;
104 __le64 max_rfer;
105 __le64 max_excl;
106 __le64 rsv_rfer;
107 __le64 rsv_excl;
108 } __attribute__ ((__packed__));
109 #endif