chiark / gitweb /
7bdf3fe139e8c064b90f23ce0f742509d2051e45
[elogind.git] / src / shared / btrfs-ctree.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 #include "sparse-endian.h"
6
7 /* Stolen from btrfs' ctree.h */
8
9 struct btrfs_timespec {
10         le64_t sec;
11         le32_t nsec;
12 } _packed_;
13
14 struct btrfs_disk_key {
15         le64_t objectid;
16         uint8_t type;
17         le64_t offset;
18 } _packed_;
19
20 struct btrfs_inode_item {
21         le64_t generation;
22         le64_t transid;
23         le64_t size;
24         le64_t nbytes;
25         le64_t block_group;
26         le32_t nlink;
27         le32_t uid;
28         le32_t gid;
29         le32_t mode;
30         le64_t rdev;
31         le64_t flags;
32         le64_t sequence;
33         le64_t reserved[4];
34         struct btrfs_timespec atime;
35         struct btrfs_timespec ctime;
36         struct btrfs_timespec mtime;
37         struct btrfs_timespec otime;
38 } _packed_;
39
40 struct btrfs_root_item {
41         struct btrfs_inode_item inode;
42         le64_t generation;
43         le64_t root_dirid;
44         le64_t bytenr;
45         le64_t byte_limit;
46         le64_t bytes_used;
47         le64_t last_snapshot;
48         le64_t flags;
49         le32_t refs;
50         struct btrfs_disk_key drop_progress;
51         uint8_t drop_level;
52         uint8_t level;
53         le64_t generation_v2;
54         uint8_t uuid[BTRFS_UUID_SIZE];
55         uint8_t parent_uuid[BTRFS_UUID_SIZE];
56         uint8_t received_uuid[BTRFS_UUID_SIZE];
57         le64_t ctransid;
58         le64_t otransid;
59         le64_t stransid;
60         le64_t rtransid;
61         struct btrfs_timespec ctime;
62         struct btrfs_timespec otime;
63         struct btrfs_timespec stime;
64         struct btrfs_timespec rtime;
65         le64_t reserved[8];
66 } _packed_;
67
68 #define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0)
69
70 struct btrfs_qgroup_info_item {
71         le64_t generation;
72         le64_t rfer;
73         le64_t rfer_cmpr;
74         le64_t excl;
75         le64_t excl_cmpr;
76 } _packed_;
77
78 #define BTRFS_QGROUP_LIMIT_MAX_RFER     (1ULL << 0)
79 #define BTRFS_QGROUP_LIMIT_MAX_EXCL     (1ULL << 1)
80 #define BTRFS_QGROUP_LIMIT_RSV_RFER     (1ULL << 2)
81 #define BTRFS_QGROUP_LIMIT_RSV_EXCL     (1ULL << 3)
82 #define BTRFS_QGROUP_LIMIT_RFER_CMPR    (1ULL << 4)
83 #define BTRFS_QGROUP_LIMIT_EXCL_CMPR    (1ULL << 5)
84
85 struct btrfs_qgroup_limit_item {
86         le64_t flags;
87         le64_t max_rfer;
88         le64_t max_excl;
89         le64_t rsv_rfer;
90         le64_t rsv_excl;
91 } _packed_;