bcache.h revision 38062f954c637861348dd8078cefb73554e6f12c
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 _LINUX_BCACHE_H
20#define _LINUX_BCACHE_H
21#include <asm/types.h>
22#define BITMASK(name, type, field, offset, size)  static inline __u64 name(const type *k)  { return (k->field >> offset) & ~(~0ULL << size); }    static inline void SET_##name(type *k, __u64 v)  {   k->field &= ~(~(~0ULL << size) << offset);   k->field |= (v & ~(~0ULL << size)) << offset;  }
23/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24struct bkey {
25 __u64 high;
26 __u64 low;
27 __u64 ptr[];
28/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29};
30#define KEY_FIELD(name, field, offset, size)   BITMASK(name, struct bkey, field, offset, size)
31#define PTR_FIELD(name, offset, size)  static inline __u64 name(const struct bkey *k, unsigned i)  { return (k->ptr[i] >> offset) & ~(~0ULL << size); }    static inline void SET_##name(struct bkey *k, unsigned i, __u64 v)  {   k->ptr[i] &= ~(~(~0ULL << size) << offset);   k->ptr[i] |= (v & ~(~0ULL << size)) << offset;  }
32#define KEY_SIZE_BITS 16
33/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34#define KEY_MAX_U64S 8
35#define KEY(inode, offset, size)  ((struct bkey) {   .high = (1ULL << 63) | ((__u64) (size) << 20) | (inode),   .low = (offset)  })
36#define ZERO_KEY KEY(0, 0, 0)
37#define MAX_KEY_INODE (~(~0 << 20))
38/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39#define MAX_KEY_OFFSET (~0ULL >> 1)
40#define MAX_KEY KEY(MAX_KEY_INODE, MAX_KEY_OFFSET, 0)
41#define KEY_START(k) (KEY_OFFSET(k) - KEY_SIZE(k))
42#define START_KEY(k) KEY(KEY_INODE(k), KEY_START(k), 0)
43/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44#define PTR_DEV_BITS 12
45#define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1)
46#define PTR(gen, offset, dev)   ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
47#define bkey_copy(_dest, _src) memcpy(_dest, _src, bkey_bytes(_src))
48/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49#define BKEY_PAD 8
50#define BKEY_PADDED(key)   union { struct bkey key; __u64 key ## _pad[BKEY_PAD]; }
51#define BCACHE_SB_VERSION_CDEV 0
52#define BCACHE_SB_VERSION_BDEV 1
53/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54#define BCACHE_SB_VERSION_CDEV_WITH_UUID 3
55#define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4
56#define BCACHE_SB_MAX_VERSION 4
57#define SB_SECTOR 8
58/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59#define SB_SIZE 4096
60#define SB_LABEL_SIZE 32
61#define SB_JOURNAL_BUCKETS 256U
62#define MAX_CACHES_PER_SET 8
63/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64#define BDEV_DATA_START_DEFAULT 16
65struct cache_sb {
66 __u64 csum;
67 __u64 offset;
68/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69 __u64 version;
70 __u8 magic[16];
71 __u8 uuid[16];
72 union {
73/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 __u8 set_uuid[16];
75 __u64 set_magic;
76 };
77 __u8 label[SB_LABEL_SIZE];
78/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79 __u64 flags;
80 __u64 seq;
81 __u64 pad[8];
82 union {
83/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84 struct {
85 __u64 nbuckets;
86 __u16 block_size;
87 __u16 bucket_size;
88/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89 __u16 nr_in_set;
90 __u16 nr_this_dev;
91 };
92 struct {
93/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94 __u64 data_offset;
95 };
96 };
97 __u32 last_mount;
98/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99 __u16 first_bucket;
100 union {
101 __u16 njournal_buckets;
102 __u16 keys;
103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104 };
105 __u64 d[SB_JOURNAL_BUCKETS];
106};
107#define CACHE_REPLACEMENT_LRU 0U
108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109#define CACHE_REPLACEMENT_FIFO 1U
110#define CACHE_REPLACEMENT_RANDOM 2U
111#define CACHE_MODE_WRITETHROUGH 0U
112#define CACHE_MODE_WRITEBACK 1U
113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114#define CACHE_MODE_WRITEAROUND 2U
115#define CACHE_MODE_NONE 3U
116#define BDEV_STATE_NONE 0U
117#define BDEV_STATE_CLEAN 1U
118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119#define BDEV_STATE_DIRTY 2U
120#define BDEV_STATE_STALE 3U
121#define JSET_MAGIC 0x245235c1a3625032ULL
122#define PSET_MAGIC 0x6750e15f87337f91ULL
123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124#define BSET_MAGIC 0x90135c78b99e07f5ULL
125#define BCACHE_JSET_VERSION_UUIDv1 1
126#define BCACHE_JSET_VERSION_UUID 1
127#define BCACHE_JSET_VERSION 1
128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129struct jset {
130 __u64 csum;
131 __u64 magic;
132 __u64 seq;
133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134 __u32 version;
135 __u32 keys;
136 __u64 last_seq;
137 BKEY_PADDED(uuid_bucket);
138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139 BKEY_PADDED(btree_root);
140 __u16 btree_level;
141 __u16 pad[3];
142 __u64 prio_bucket[MAX_CACHES_PER_SET];
143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144 union {
145 struct bkey start[0];
146 __u64 d[0];
147 };
148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149};
150struct prio_set {
151 __u64 csum;
152 __u64 magic;
153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154 __u64 seq;
155 __u32 version;
156 __u32 pad;
157 __u64 next_bucket;
158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159 struct bucket_disk {
160 __u16 prio;
161 __u8 gen;
162 } __attribute((packed)) data[];
163/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164};
165struct uuid_entry {
166 union {
167 struct {
168/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169 __u8 uuid[16];
170 __u8 label[32];
171 __u32 first_reg;
172 __u32 last_reg;
173/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174 __u32 invalidated;
175 __u32 flags;
176 __u64 sectors;
177 };
178/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179 __u8 pad[128];
180 };
181};
182#define BCACHE_BSET_CSUM 1
183/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184#define BCACHE_BSET_VERSION 1
185struct bset {
186 __u64 csum;
187 __u64 magic;
188/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189 __u64 seq;
190 __u32 version;
191 __u32 keys;
192 union {
193/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194 struct bkey start[0];
195 __u64 d[0];
196 };
197};
198/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199struct uuid_entry_v0 {
200 __u8 uuid[16];
201 __u8 label[32];
202 __u32 first_reg;
203/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204 __u32 last_reg;
205 __u32 invalidated;
206 __u32 pad;
207};
208/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209#endif
210