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) \ 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 } 26 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 27 struct bkey { 28 __u64 high; 29 __u64 low; 30 __u64 ptr[]; 31 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 32 }; 33 #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 } 38 #define KEY_SIZE_BITS 16 39 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 40 #define KEY_MAX_U64S 8 41 #define KEY(inode,offset,size) \ 42 ((struct bkey) {.high = (1ULL << 63) | ((__u64) (size) << 20) | (inode),.low = (offset) \ 43 }) 44 #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) 54 #define PTR(gen,offset,dev) ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen) 55 #define bkey_copy(_dest,_src) memcpy(_dest, _src, bkey_bytes(_src)) 56 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 57 #define BKEY_PAD 8 58 #define BKEY_PADDED(key) union { struct bkey key; __u64 key ##_pad[BKEY_PAD]; } 59 #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 73 struct cache_sb { 74 __u64 csum; 75 __u64 offset; 76 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 77 __u64 version; 78 __u8 magic[16]; 79 __u8 uuid[16]; 80 union { 81 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 82 __u8 set_uuid[16]; 83 __u64 set_magic; 84 }; 85 __u8 label[SB_LABEL_SIZE]; 86 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 87 __u64 flags; 88 __u64 seq; 89 __u64 pad[8]; 90 union { 91 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 92 struct { 93 __u64 nbuckets; 94 __u16 block_size; 95 __u16 bucket_size; 96 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 97 __u16 nr_in_set; 98 __u16 nr_this_dev; 99 }; 100 struct { 101 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 102 __u64 data_offset; 103 }; 104 }; 105 __u32 last_mount; 106 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 107 __u16 first_bucket; 108 union { 109 __u16 njournal_buckets; 110 __u16 keys; 111 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 112 }; 113 __u64 d[SB_JOURNAL_BUCKETS]; 114 }; 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 */ 137 struct jset { 138 __u64 csum; 139 __u64 magic; 140 __u64 seq; 141 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 142 __u32 version; 143 __u32 keys; 144 __u64 last_seq; 145 BKEY_PADDED(uuid_bucket); 146 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 147 BKEY_PADDED(btree_root); 148 __u16 btree_level; 149 __u16 pad[3]; 150 __u64 prio_bucket[MAX_CACHES_PER_SET]; 151 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 152 union { 153 struct bkey start[0]; 154 __u64 d[0]; 155 }; 156 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 157 }; 158 struct prio_set { 159 __u64 csum; 160 __u64 magic; 161 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 162 __u64 seq; 163 __u32 version; 164 __u32 pad; 165 __u64 next_bucket; 166 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 167 struct bucket_disk { 168 __u16 prio; 169 __u8 gen; 170 } __attribute((packed)) data[]; 171 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 172 }; 173 struct uuid_entry { 174 union { 175 struct { 176 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 177 __u8 uuid[16]; 178 __u8 label[32]; 179 __u32 first_reg; 180 __u32 last_reg; 181 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 182 __u32 invalidated; 183 __u32 flags; 184 __u64 sectors; 185 }; 186 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 187 __u8 pad[128]; 188 }; 189 }; 190 #define BCACHE_BSET_CSUM 1 191 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 192 #define BCACHE_BSET_VERSION 1 193 struct bset { 194 __u64 csum; 195 __u64 magic; 196 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 197 __u64 seq; 198 __u32 version; 199 __u32 keys; 200 union { 201 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 202 struct bkey start[0]; 203 __u64 d[0]; 204 }; 205 }; 206 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 207 struct uuid_entry_v0 { 208 __u8 uuid[16]; 209 __u8 label[32]; 210 __u32 first_reg; 211 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 212 __u32 last_reg; 213 __u32 invalidated; 214 __u32 pad; 215 }; 216 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 217 #endif 218