[go: up one dir, main page]

Menu

[9e1265]: / refind / gpt.h  Maximize  Restore  History

Download this file

90 lines (78 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* refind/gpt.h
* Functions related to GPT data structures
*
* Copyright (c) 2014-2015 Roderick W. Smith
* All rights reserved.
*
* This program is distributed under the terms of the GNU General Public
* License (GPL) version 3 (GPLv3), a copy of which must be distributed
* with this source code or binaries made from it.
*
*/
#include "global.h"
#ifndef __GPT_H_
#define __GPT_H_
#ifdef __MAKEWITH_GNUEFI
#include "efi.h"
#include "efilib.h"
#else
#include "../include/tiano_includes.h"
#endif
#pragma pack(1)
typedef struct {
UINT8 flags;
UINT8 start_chs[3];
UINT8 type;
UINT8 end_chs[3];
UINT32 start_lba;
UINT32 size;
} MBR_PART_INFO;
// A 512-byte data structure into which the MBR can be loaded in one
// go. Also used when loading logical partitions.
typedef struct {
UINT8 code[440];
UINT32 diskSignature;
UINT16 nulls;
MBR_PART_INFO partitions[4];
UINT16 MBRSignature;
} MBR_RECORD;
typedef struct {
UINT64 signature;
UINT32 spec_revision;
UINT32 header_size;
UINT32 header_crc32;
UINT32 reserved;
UINT64 header_lba;
UINT64 alternate_header_lba;
UINT64 first_usable_lba;
UINT64 last_usable_lba;
UINT8 disk_guid[16];
UINT64 entry_lba;
UINT32 entry_count;
UINT32 entry_size;
UINT32 entry_crc32;
UINT8 reserved2[420];
} GPT_HEADER;
typedef struct {
UINT8 type_guid[16];
UINT8 partition_guid[16];
UINT64 start_lba;
UINT64 end_lba;
UINT64 attributes;
CHAR16 name[36];
} GPT_ENTRY;
typedef struct _gpt_data {
MBR_RECORD *ProtectiveMBR;
GPT_HEADER *Header;
GPT_ENTRY *Entries;
struct _gpt_data *NextEntry;
} GPT_DATA;
#pragma pack(0)
VOID ClearGptData(GPT_DATA *Data);
EFI_STATUS ReadGptData(REFIT_VOLUME *Volume, GPT_DATA **Data);
// CHAR16 * PartNameFromGuid(EFI_GUID *Guid);
GPT_ENTRY * FindPartWithGuid(EFI_GUID *Guid);
VOID ForgetPartitionTables(VOID);
VOID AddPartitionTable(REFIT_VOLUME *Volume);
#endif