summaryrefslogtreecommitdiff
path: root/include/fs/gpt.h
blob: a1a8356770adc13e087a78281f8bc191ae2c2fff (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
#ifndef _GPT_H_
#define _GPT_H_

#include <stddef.h>
#include <stdint.h>

struct gpt_header {
	char sig[8];
	uint32_t revision;
	uint32_t size;
	uint32_t crc32;
	uint32_t res;
	uint64_t lba;
	uint64_t lba_mirror;
	uint64_t first_block;
	uint64_t last_block;
	uint8_t guid[16];
	uint64_t first_lba;
	uint32_t number_partitions;
	uint32_t size_partitions;
	uint32_t crc32_entry;
};

struct gpt_entry {
	uint8_t type[16];
	uint8_t guid[16];
	struct {
	uint64_t start;
	uint64_t end;
	} lba;
	uint64_t attrs;
	char name[72];
};

struct disk;
struct gpt_header *read_gpt_disk(struct disk *disk);
struct gpt_entry *get_gpt_entry(struct disk *disk, struct gpt_header *header, size_t num);
char *read_gpt_entry(struct disk *disk, struct gpt_entry *entry);

#endif