Add mbr pseudo metadata handler.
[thirdparty/mdadm.git] / part.h
1 /*
2 * mdadm - manage Linux "md" devices aka RAID arrays.
3 *
4 * Copyright (C) 2010 Neil Brown <neilb@suse.de>
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Author: Neil Brown
22 * Email: <neil@brown.name>
23 *
24 */
25
26 /* Structure definitions ext for MBR and GPT partition tables
27 */
28
29
30 #define MBR_SIGNATURE_MAGIC __cpu_to_le16(0xAA55)
31 #define MBR_PARTITIONS 4
32
33 struct MBR_part_record {
34 __u8 bootable;
35 __u8 first_head;
36 __u8 first_sector;
37 __u8 first_cyl;
38 __u8 part_type;
39 __u8 last_head;
40 __u8 last_sector;
41 __u8 last_cyl;
42 __u32 first_sect_lba;
43 __u32 blocks_num;
44 };
45
46 struct MBR {
47 __u8 pad[446];
48 struct MBR_part_record parts[MBR_PARTITIONS];
49 __u16 magic;
50 } __attribute__((packed));
51
52
53
54 #define GPT_SIGNATURE_MAGIC __cpu_to_le64(0x5452415020494645ULL)
55 #define MBR_GPT_PARTITION_TYPE 0xEE
56
57 struct GPT_part_entry {
58 unsigned char type_guid[16];
59 unsigned char partition_guid[16];
60 __u64 starting_lba;
61 __u64 ending_lba;
62 unsigned char attr_bits[8];
63 unsigned char name[72];
64 } __attribute__((packed));
65
66 struct GPT {
67 __u64 magic;
68 __u32 revision;
69 __u32 header_size;
70 __u32 crc;
71 __u32 pad1;
72 __u64 current_lba;
73 __u64 backup_lba;
74 __u64 first_lba;
75 __u64 last_lba;
76 __u8 guid[16];
77 __u64 part_start;
78 __u32 part_cnt;
79 __u32 part_size;
80 __u32 part_crc;
81 __u8 pad2[420];
82 } __attribute__((packed));