]> git.proxmox.com Git - grub2.git/blob - include/grub/gpt_partition.h
Import grub2_2.02+dfsg1.orig.tar.xz
[grub2.git] / include / grub / gpt_partition.h
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2002,2005,2006,2007,2008 Free Software Foundation, Inc.
4 *
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef GRUB_GPT_PARTITION_HEADER
20 #define GRUB_GPT_PARTITION_HEADER 1
21
22 #include <grub/types.h>
23 #include <grub/partition.h>
24
25 struct grub_gpt_part_type
26 {
27 grub_uint32_t data1;
28 grub_uint16_t data2;
29 grub_uint16_t data3;
30 grub_uint8_t data4[8];
31 } __attribute__ ((aligned(8)));
32 typedef struct grub_gpt_part_type grub_gpt_part_type_t;
33
34 #define GRUB_GPT_PARTITION_TYPE_EMPTY \
35 { 0x0, 0x0, 0x0, \
36 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } \
37 }
38
39 #define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \
40 { grub_cpu_to_le32_compile_time (0x21686148), \
41 grub_cpu_to_le16_compile_time (0x6449), \
42 grub_cpu_to_le16_compile_time (0x6e6f), \
43 { 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
44 }
45
46 #define GRUB_GPT_PARTITION_TYPE_LDM \
47 { grub_cpu_to_le32_compile_time (0x5808C8AAU),\
48 grub_cpu_to_le16_compile_time (0x7E8F), \
49 grub_cpu_to_le16_compile_time (0x42E0), \
50 { 0x85, 0xD2, 0xE1, 0xE9, 0x04, 0x34, 0xCF, 0xB3 } \
51 }
52
53 struct grub_gpt_header
54 {
55 grub_uint8_t magic[8];
56 grub_uint32_t version;
57 grub_uint32_t headersize;
58 grub_uint32_t crc32;
59 grub_uint32_t unused1;
60 grub_uint64_t primary;
61 grub_uint64_t backup;
62 grub_uint64_t start;
63 grub_uint64_t end;
64 grub_uint8_t guid[16];
65 grub_uint64_t partitions;
66 grub_uint32_t maxpart;
67 grub_uint32_t partentry_size;
68 grub_uint32_t partentry_crc32;
69 } GRUB_PACKED;
70
71 struct grub_gpt_partentry
72 {
73 grub_gpt_part_type_t type;
74 grub_uint8_t guid[16];
75 grub_uint64_t start;
76 grub_uint64_t end;
77 grub_uint64_t attrib;
78 char name[72];
79 } GRUB_PACKED;
80
81 grub_err_t
82 grub_gpt_partition_map_iterate (grub_disk_t disk,
83 grub_partition_iterate_hook_t hook,
84 void *hook_data);
85
86
87 #endif /* ! GRUB_GPT_PARTITION_HEADER */