]> git.sesse.net Git - bcachefs-tools-debian/blob - bcache.h
Updates for backing devices
[bcachefs-tools-debian] / bcache.h
1 #ifndef _BCACHE_H
2 #define _BCACHE_H
3
4 static const char bcache_magic[] = {
5         0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
6         0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81 };
7
8 struct bkey {
9         uint64_t        header;
10         uint64_t        key;
11         uint64_t        ptr[];
12 };
13
14 struct cache_sb {
15         uint8_t         magic[16];
16         uint8_t         uuid[16];
17         uint8_t         set_uuid[16];
18         uint64_t        sequence;
19
20 #define CACHE_CLEAN             1
21 #define CACHE_SYNC              2
22 #define CACHE_BACKING_DEV       4
23         uint32_t        version;
24         uint16_t        block_size;     /* sectors */
25         uint16_t        bucket_size;    /* sectors */
26         uint32_t        journal_start;  /* buckets */
27         uint32_t        first_bucket;   /* start of data */
28         uint64_t        nbuckets;       /* device size */
29
30         union {
31                 struct bkey     btree_root;
32                 uint64_t        _pad[8];
33         };
34         uint16_t        btree_level;
35         uint16_t        nr_in_set;
36         uint16_t        nr_this_dev;
37         uint16_t        _pad[1];
38 };
39
40 struct bucket_disk {
41         uint16_t        priority;
42         uint8_t         generation;
43 } __attribute((packed));
44
45 #endif