1 | /*
|
---|
2 | * Copyright (c) 2009 Jiri Svoboda
|
---|
3 | * Copyright (c) 2011, 2012, 2013 Dominik Taborsky
|
---|
4 | * All rights reserved.
|
---|
5 | *
|
---|
6 | * Redistribution and use in source and binary forms, with or without
|
---|
7 | * modification, are permitted provided that the following conditions
|
---|
8 | * are met:
|
---|
9 | *
|
---|
10 | * - Redistributions of source code must retain the above copyright
|
---|
11 | * notice, this list of conditions and the following disclaimer.
|
---|
12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
13 | * notice, this list of conditions and the following disclaimer in the
|
---|
14 | * documentation and/or other materials provided with the distribution.
|
---|
15 | * - The name of the author may not be used to endorse or promote products
|
---|
16 | * derived from this software without specific prior written permission.
|
---|
17 | *
|
---|
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
28 | */
|
---|
29 |
|
---|
30 | /** @addtogroup libgpt
|
---|
31 | * @{
|
---|
32 | */
|
---|
33 | /** @file
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef LIBGPT_GPT_H_
|
---|
37 | #define LIBGPT_GPT_H_
|
---|
38 |
|
---|
39 | typedef enum {
|
---|
40 | AT_REQ_PART = 0,
|
---|
41 | AT_NO_BLOCK_IO,
|
---|
42 | AT_LEGACY_BOOT,
|
---|
43 | AT_UNDEFINED,
|
---|
44 | AT_SPECIFIC = 48
|
---|
45 | } GPT_ATTR;
|
---|
46 |
|
---|
47 | /** GPT header
|
---|
48 | * - all in little endian.
|
---|
49 | */
|
---|
50 | typedef struct {
|
---|
51 | uint8_t efi_signature[8];
|
---|
52 | uint8_t revision[4];
|
---|
53 | uint32_t header_size;
|
---|
54 | uint32_t header_crc32;
|
---|
55 | uint32_t reserved;
|
---|
56 | uint64_t my_lba;
|
---|
57 | uint64_t alternate_lba;
|
---|
58 | uint64_t first_usable_lba;
|
---|
59 | uint64_t last_usable_lba;
|
---|
60 | uint8_t disk_guid[16];
|
---|
61 | uint64_t entry_lba;
|
---|
62 | uint32_t fillries;
|
---|
63 | uint32_t entry_size;
|
---|
64 | uint32_t pe_array_crc32;
|
---|
65 | } __attribute__((packed)) gpt_header_t;
|
---|
66 |
|
---|
67 | /** GPT partition entry */
|
---|
68 | typedef struct {
|
---|
69 | uint8_t part_type[16];
|
---|
70 | uint8_t part_id[16];
|
---|
71 | uint64_t start_lba;
|
---|
72 | uint64_t end_lba;
|
---|
73 | uint64_t attributes;
|
---|
74 | uint8_t part_name[72];
|
---|
75 | } __attribute__((packed)) gpt_entry_t;
|
---|
76 |
|
---|
77 | #endif
|
---|
78 |
|
---|
79 |
|
---|