blob: efe692cc882034da0f69302dfd99177770d007c6 [file] [log] [blame]
Christopher Ferris38062f92014-07-09 15:33:25 -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 _LINUX_BCACHE_H
20#define _LINUX_BCACHE_H
21#include <asm/types.h>
Tao Baod7db5942015-01-28 10:07:51 -080022#define BITMASK(name,type,field,offset,size) static inline __u64 name(const type * k) \
23{ return(k->field >> offset) & ~(~0ULL << size); } static inline void SET_ ##name(type * k, __u64 v) \
24{ k->field &= ~(~(~0ULL << size) << offset); k->field |= (v & ~(~0ULL << size)) << offset; \
25}
Christopher Ferris38062f92014-07-09 15:33:25 -070026/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
27struct bkey {
Tao Baod7db5942015-01-28 10:07:51 -080028 __u64 high;
29 __u64 low;
30 __u64 ptr[];
Christopher Ferris38062f92014-07-09 15:33:25 -070031/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
32};
Tao Baod7db5942015-01-28 10:07:51 -080033#define KEY_FIELD(name,field,offset,size) BITMASK(name, struct bkey, field, offset, size)
34#define PTR_FIELD(name,offset,size) static inline __u64 name(const struct bkey * k, unsigned i) \
35{ return(k->ptr[i] >> offset) & ~(~0ULL << size); } static inline void SET_ ##name(struct bkey * k, unsigned i, __u64 v) \
36{ k->ptr[i] &= ~(~(~0ULL << size) << offset); k->ptr[i] |= (v & ~(~0ULL << size)) << offset; \
37}
Christopher Ferris38062f92014-07-09 15:33:25 -070038#define KEY_SIZE_BITS 16
39/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
40#define KEY_MAX_U64S 8
Tao Baod7db5942015-01-28 10:07:51 -080041#define KEY(inode,offset,size) \
42((struct bkey) {.high = (1ULL << 63) | ((__u64) (size) << 20) | (inode),.low = (offset) \
43})
Christopher Ferris38062f92014-07-09 15:33:25 -070044#define ZERO_KEY KEY(0, 0, 0)
45#define MAX_KEY_INODE (~(~0 << 20))
46/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
47#define MAX_KEY_OFFSET (~0ULL >> 1)
48#define MAX_KEY KEY(MAX_KEY_INODE, MAX_KEY_OFFSET, 0)
49#define KEY_START(k) (KEY_OFFSET(k) - KEY_SIZE(k))
50#define START_KEY(k) KEY(KEY_INODE(k), KEY_START(k), 0)
51/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
52#define PTR_DEV_BITS 12
53#define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1)
Tao Baod7db5942015-01-28 10:07:51 -080054#define PTR(gen,offset,dev) ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
55#define bkey_copy(_dest,_src) memcpy(_dest, _src, bkey_bytes(_src))
Christopher Ferris38062f92014-07-09 15:33:25 -070056/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
57#define BKEY_PAD 8
Tao Baod7db5942015-01-28 10:07:51 -080058#define BKEY_PADDED(key) union { struct bkey key; __u64 key ##_pad[BKEY_PAD]; }
Christopher Ferris38062f92014-07-09 15:33:25 -070059#define BCACHE_SB_VERSION_CDEV 0
60#define BCACHE_SB_VERSION_BDEV 1
61/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
62#define BCACHE_SB_VERSION_CDEV_WITH_UUID 3
63#define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4
64#define BCACHE_SB_MAX_VERSION 4
65#define SB_SECTOR 8
66/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
67#define SB_SIZE 4096
68#define SB_LABEL_SIZE 32
69#define SB_JOURNAL_BUCKETS 256U
70#define MAX_CACHES_PER_SET 8
71/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
72#define BDEV_DATA_START_DEFAULT 16
73struct cache_sb {
Tao Baod7db5942015-01-28 10:07:51 -080074 __u64 csum;
75 __u64 offset;
Christopher Ferris38062f92014-07-09 15:33:25 -070076/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080077 __u64 version;
78 __u8 magic[16];
79 __u8 uuid[16];
80 union {
Christopher Ferris38062f92014-07-09 15:33:25 -070081/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080082 __u8 set_uuid[16];
83 __u64 set_magic;
84 };
85 __u8 label[SB_LABEL_SIZE];
Christopher Ferris38062f92014-07-09 15:33:25 -070086/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080087 __u64 flags;
88 __u64 seq;
89 __u64 pad[8];
90 union {
Christopher Ferris38062f92014-07-09 15:33:25 -070091/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080092 struct {
93 __u64 nbuckets;
94 __u16 block_size;
95 __u16 bucket_size;
Christopher Ferris38062f92014-07-09 15:33:25 -070096/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080097 __u16 nr_in_set;
98 __u16 nr_this_dev;
99 };
100 struct {
Christopher Ferris38062f92014-07-09 15:33:25 -0700101/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800102 __u64 data_offset;
103 };
104 };
105 __u32 last_mount;
Christopher Ferris38062f92014-07-09 15:33:25 -0700106/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800107 __u16 first_bucket;
108 union {
109 __u16 njournal_buckets;
110 __u16 keys;
Christopher Ferris38062f92014-07-09 15:33:25 -0700111/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800112 };
113 __u64 d[SB_JOURNAL_BUCKETS];
Christopher Ferris38062f92014-07-09 15:33:25 -0700114};
115#define CACHE_REPLACEMENT_LRU 0U
116/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
117#define CACHE_REPLACEMENT_FIFO 1U
118#define CACHE_REPLACEMENT_RANDOM 2U
119#define CACHE_MODE_WRITETHROUGH 0U
120#define CACHE_MODE_WRITEBACK 1U
121/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
122#define CACHE_MODE_WRITEAROUND 2U
123#define CACHE_MODE_NONE 3U
124#define BDEV_STATE_NONE 0U
125#define BDEV_STATE_CLEAN 1U
126/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
127#define BDEV_STATE_DIRTY 2U
128#define BDEV_STATE_STALE 3U
129#define JSET_MAGIC 0x245235c1a3625032ULL
130#define PSET_MAGIC 0x6750e15f87337f91ULL
131/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
132#define BSET_MAGIC 0x90135c78b99e07f5ULL
133#define BCACHE_JSET_VERSION_UUIDv1 1
134#define BCACHE_JSET_VERSION_UUID 1
135#define BCACHE_JSET_VERSION 1
136/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
137struct jset {
Tao Baod7db5942015-01-28 10:07:51 -0800138 __u64 csum;
139 __u64 magic;
140 __u64 seq;
Christopher Ferris38062f92014-07-09 15:33:25 -0700141/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800142 __u32 version;
143 __u32 keys;
144 __u64 last_seq;
145 BKEY_PADDED(uuid_bucket);
Christopher Ferris38062f92014-07-09 15:33:25 -0700146/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800147 BKEY_PADDED(btree_root);
148 __u16 btree_level;
149 __u16 pad[3];
150 __u64 prio_bucket[MAX_CACHES_PER_SET];
Christopher Ferris38062f92014-07-09 15:33:25 -0700151/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800152 union {
153 struct bkey start[0];
154 __u64 d[0];
155 };
Christopher Ferris38062f92014-07-09 15:33:25 -0700156/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
157};
158struct prio_set {
Tao Baod7db5942015-01-28 10:07:51 -0800159 __u64 csum;
160 __u64 magic;
Christopher Ferris38062f92014-07-09 15:33:25 -0700161/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800162 __u64 seq;
163 __u32 version;
164 __u32 pad;
165 __u64 next_bucket;
Christopher Ferris38062f92014-07-09 15:33:25 -0700166/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800167 struct bucket_disk {
168 __u16 prio;
169 __u8 gen;
170 } __attribute((packed)) data[];
Christopher Ferris38062f92014-07-09 15:33:25 -0700171/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
172};
173struct uuid_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800174 union {
175 struct {
Christopher Ferris38062f92014-07-09 15:33:25 -0700176/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800177 __u8 uuid[16];
178 __u8 label[32];
179 __u32 first_reg;
180 __u32 last_reg;
Christopher Ferris38062f92014-07-09 15:33:25 -0700181/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800182 __u32 invalidated;
183 __u32 flags;
184 __u64 sectors;
185 };
Christopher Ferris38062f92014-07-09 15:33:25 -0700186/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800187 __u8 pad[128];
188 };
Christopher Ferris38062f92014-07-09 15:33:25 -0700189};
190#define BCACHE_BSET_CSUM 1
191/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
192#define BCACHE_BSET_VERSION 1
193struct bset {
Tao Baod7db5942015-01-28 10:07:51 -0800194 __u64 csum;
195 __u64 magic;
Christopher Ferris38062f92014-07-09 15:33:25 -0700196/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800197 __u64 seq;
198 __u32 version;
199 __u32 keys;
200 union {
Christopher Ferris38062f92014-07-09 15:33:25 -0700201/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800202 struct bkey start[0];
203 __u64 d[0];
204 };
Christopher Ferris38062f92014-07-09 15:33:25 -0700205};
206/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
207struct uuid_entry_v0 {
Tao Baod7db5942015-01-28 10:07:51 -0800208 __u8 uuid[16];
209 __u8 label[32];
210 __u32 first_reg;
Christopher Ferris38062f92014-07-09 15:33:25 -0700211/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800212 __u32 last_reg;
213 __u32 invalidated;
214 __u32 pad;
Christopher Ferris38062f92014-07-09 15:33:25 -0700215};
216/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
217#endif