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