blob: b2ec2dd2248582682d34c1cfcfa090d393ca9bcd (
plain)
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
|
#pragma once
#include <AK/RefPtr.h>
#include <AK/Vector.h>
#include <Kernel/Devices/DiskDevice.h>
#include <Kernel/Devices/DiskPartition.h>
#define GPT_SIGNATURE2 0x54524150
#define GPT_SIGNATURE 0x20494645
#define BytesPerSector 512
struct GPTPartitionEntry {
u32 partition_guid[4];
u32 unique_guid[4];
u32 first_lba[2];
u32 last_lba[2];
u64 attributes;
u8 partition_name[72];
} __attribute__((packed));
struct GPTPartitionHeader {
u32 sig[2];
u32 revision;
u32 header_size;
u32 crc32_header;
u32 reserved;
u64 current_lba;
u64 backup_lba;
u64 first_usable_lba;
u64 last_usable_lba;
u64 disk_guid1[2];
u64 partition_array_start_lba;
u32 entries_count;
u32 partition_entry_size;
u32 crc32_entries_array;
} __attribute__((packed));
class GPTPartitionTable {
public:
explicit GPTPartitionTable(DiskDevice&);
~GPTPartitionTable();
bool initialize();
RefPtr<DiskPartition> partition(unsigned index);
private:
NonnullRefPtr<DiskDevice> m_device;
const GPTPartitionHeader& header() const;
u8 m_cached_header[512];
};
|