]> git.neil.brown.name Git - mdadm.git/blob - part.h
Release mdadm-4.0
[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 #define MBR_SIGNATURE_MAGIC     __cpu_to_le16(0xAA55)
30 #define MBR_PARTITIONS               4
31
32 struct MBR_part_record {
33   __u8 bootable;
34   __u8 first_head;
35   __u8 first_sector;
36   __u8 first_cyl;
37   __u8 part_type;
38   __u8 last_head;
39   __u8 last_sector;
40   __u8 last_cyl;
41   __u32 first_sect_lba;
42   __u32 blocks_num;
43 } __attribute__((packed));
44
45 struct MBR {
46         __u8 pad[446];
47         struct MBR_part_record parts[MBR_PARTITIONS];
48         __u16 magic;
49 } __attribute__((packed));
50
51 #define GPT_SIGNATURE_MAGIC     __cpu_to_le64(0x5452415020494645ULL)
52 #define MBR_GPT_PARTITION_TYPE       0xEE
53
54 struct GPT_part_entry {
55         unsigned char type_guid[16];
56         unsigned char partition_guid[16];
57         __u64 starting_lba;
58         __u64 ending_lba;
59         unsigned char attr_bits[8];
60         unsigned char name[72];
61 } __attribute__((packed));
62
63 struct GPT {
64         __u64 magic;
65         __u32 revision;
66         __u32 header_size;
67         __u32 crc;
68         __u32 pad1;
69         __u64 current_lba;
70         __u64 backup_lba;
71         __u64 first_lba;
72         __u64 last_lba;
73         __u8 guid[16];
74         __u64 part_start;
75         __u32 part_cnt;
76         __u32 part_size;
77         __u32 part_crc;
78         __u8 pad2[420];
79 } __attribute__((packed));