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 _MD_P_H
20 #define _MD_P_H
21 #include <linux/types.h>
22 #include <asm/byteorder.h>
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24 #define MD_RESERVED_BYTES (64 * 1024)
25 #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
26 #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)
27 #define MD_SB_BYTES 4096
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 #define MD_SB_WORDS (MD_SB_BYTES / 4)
30 #define MD_SB_SECTORS (MD_SB_BYTES / 512)
31 #define MD_SB_GENERIC_OFFSET 0
32 #define MD_SB_PERSONALITY_OFFSET 64
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 #define MD_SB_DISKS_OFFSET 128
35 #define MD_SB_DESCRIPTOR_OFFSET 992
36 #define MD_SB_GENERIC_CONSTANT_WORDS 32
37 #define MD_SB_GENERIC_STATE_WORDS 32
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39 #define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS)
40 #define MD_SB_PERSONALITY_WORDS 64
41 #define MD_SB_DESCRIPTOR_WORDS 32
42 #define MD_SB_DISKS 27
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44 #define MD_SB_DISKS_WORDS (MD_SB_DISKS * MD_SB_DESCRIPTOR_WORDS)
45 #define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS)
46 #define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS)
47 #define MD_DISK_FAULTY 0
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49 #define MD_DISK_ACTIVE 1
50 #define MD_DISK_SYNC 2
51 #define MD_DISK_REMOVED 3
52 #define MD_DISK_CLUSTER_ADD 4
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54 #define MD_DISK_CANDIDATE 5
55 #define MD_DISK_FAILFAST 10
56 #define MD_DISK_WRITEMOSTLY 9
57 #define MD_DISK_JOURNAL 18
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59 #define MD_DISK_ROLE_SPARE 0xffff
60 #define MD_DISK_ROLE_FAULTY 0xfffe
61 #define MD_DISK_ROLE_JOURNAL 0xfffd
62 #define MD_DISK_ROLE_MAX 0xff00
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 typedef struct mdp_device_descriptor_s {
65   __u32 number;
66   __u32 major;
67   __u32 minor;
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69   __u32 raid_disk;
70   __u32 state;
71   __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5];
72 } mdp_disk_t;
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 #define MD_SB_MAGIC 0xa92b4efc
75 #define MD_SB_CLEAN 0
76 #define MD_SB_ERRORS 1
77 #define MD_SB_CLUSTERED 5
78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79 #define MD_SB_BITMAP_PRESENT 8
80 typedef struct mdp_superblock_s {
81   __u32 md_magic;
82   __u32 major_version;
83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84   __u32 minor_version;
85   __u32 patch_version;
86   __u32 gvalid_words;
87   __u32 set_uuid0;
88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89   __u32 ctime;
90   __u32 level;
91   __u32 size;
92   __u32 nr_disks;
93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94   __u32 raid_disks;
95   __u32 md_minor;
96   __u32 not_persistent;
97   __u32 set_uuid1;
98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99   __u32 set_uuid2;
100   __u32 set_uuid3;
101   __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16];
102   __u32 utime;
103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104   __u32 state;
105   __u32 active_disks;
106   __u32 working_disks;
107   __u32 failed_disks;
108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109   __u32 spare_disks;
110   __u32 sb_csum;
111 #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
112   __u32 events_hi;
113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114   __u32 events_lo;
115   __u32 cp_events_hi;
116   __u32 cp_events_lo;
117 #elif defined(__BYTE_ORDER)?__BYTE_ORDER==__LITTLE_ENDIAN:defined(__LITTLE_ENDIAN)
118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119   __u32 events_lo;
120   __u32 events_hi;
121   __u32 cp_events_lo;
122   __u32 cp_events_hi;
123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124 #else
125 #error unspecified endianness
126 #endif
127   __u32 recovery_cp;
128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129   __u64 reshape_position;
130   __u32 new_level;
131   __u32 delta_disks;
132   __u32 new_layout;
133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134   __u32 new_chunk;
135   __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
136   __u32 layout;
137   __u32 chunk_size;
138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139   __u32 root_pv;
140   __u32 root_block;
141   __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4];
142   mdp_disk_t disks[MD_SB_DISKS];
143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144   __u32 reserved[MD_SB_RESERVED_WORDS];
145   mdp_disk_t this_disk;
146 } mdp_super_t;
147 #define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL << 40) - 1)
148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149 struct mdp_superblock_1 {
150   __le32 magic;
151   __le32 major_version;
152   __le32 feature_map;
153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154   __le32 pad0;
155   __u8 set_uuid[16];
156   char set_name[32];
157   __le64 ctime;
158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159   __le32 level;
160   __le32 layout;
161   __le64 size;
162   __le32 chunksize;
163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164   __le32 raid_disks;
165   __le32 bitmap_offset;
166   __le32 new_level;
167   __le64 reshape_position;
168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169   __le32 delta_disks;
170   __le32 new_layout;
171   __le32 new_chunk;
172   __le32 new_offset;
173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174   __le64 data_offset;
175   __le64 data_size;
176   __le64 super_offset;
177   union {
178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179     __le64 recovery_offset;
180     __le64 journal_tail;
181   };
182   __le32 dev_number;
183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184   __le32 cnt_corrected_read;
185   __u8 device_uuid[16];
186   __u8 devflags;
187 #define WriteMostly1 1
188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189 #define FailFast1 2
190   __u8 bblog_shift;
191   __le16 bblog_size;
192   __le32 bblog_offset;
193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194   __le64 utime;
195   __le64 events;
196   __le64 resync_offset;
197   __le32 sb_csum;
198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199   __le32 max_dev;
200   __u8 pad3[64 - 32];
201   __le16 dev_roles[0];
202 };
203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204 #define MD_FEATURE_BITMAP_OFFSET 1
205 #define MD_FEATURE_RECOVERY_OFFSET 2
206 #define MD_FEATURE_RESHAPE_ACTIVE 4
207 #define MD_FEATURE_BAD_BLOCKS 8
208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209 #define MD_FEATURE_REPLACEMENT 16
210 #define MD_FEATURE_RESHAPE_BACKWARDS 32
211 #define MD_FEATURE_NEW_OFFSET 64
212 #define MD_FEATURE_RECOVERY_BITMAP 128
213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214 #define MD_FEATURE_CLUSTERED 256
215 #define MD_FEATURE_JOURNAL 512
216 #define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET | MD_FEATURE_RECOVERY_OFFSET | MD_FEATURE_RESHAPE_ACTIVE | MD_FEATURE_BAD_BLOCKS | MD_FEATURE_REPLACEMENT | MD_FEATURE_RESHAPE_BACKWARDS | MD_FEATURE_NEW_OFFSET | MD_FEATURE_RECOVERY_BITMAP | MD_FEATURE_CLUSTERED | MD_FEATURE_JOURNAL)
217 struct r5l_payload_header {
218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219   __le16 type;
220   __le16 flags;
221 } __attribute__((__packed__));
222 enum r5l_payload_type {
223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224   R5LOG_PAYLOAD_DATA = 0,
225   R5LOG_PAYLOAD_PARITY = 1,
226   R5LOG_PAYLOAD_FLUSH = 2,
227 };
228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
229 struct r5l_payload_data_parity {
230   struct r5l_payload_header header;
231   __le32 size;
232   __le64 location;
233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
234   __le32 checksum[];
235 } __attribute__((__packed__));
236 enum r5l_payload_data_parity_flag {
237   R5LOG_PAYLOAD_FLAG_DISCARD = 1,
238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
239   R5LOG_PAYLOAD_FLAG_RESHAPED = 2,
240   R5LOG_PAYLOAD_FLAG_RESHAPING = 3,
241 };
242 struct r5l_payload_flush {
243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
244   struct r5l_payload_header header;
245   __le32 size;
246   __le64 flush_stripes[];
247 } __attribute__((__packed__));
248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
249 enum r5l_payload_flush_flag {
250   R5LOG_PAYLOAD_FLAG_FLUSH_STRIPE = 1,
251 };
252 struct r5l_meta_block {
253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
254   __le32 magic;
255   __le32 checksum;
256   __u8 version;
257   __u8 __zero_pading_1;
258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
259   __le16 __zero_pading_2;
260   __le32 meta_size;
261   __le64 seq;
262   __le64 position;
263 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
264   struct r5l_payload_header payloads[];
265 } __attribute__((__packed__));
266 #define R5LOG_VERSION 0x1
267 #define R5LOG_MAGIC 0x6433c509
268 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
269 #endif
270