From ddb15c409290ac5473ee36d5dc621a92f161cdfb Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Thu, 6 Jun 2024 15:05:45 +0200 Subject: basic gpt support Signed-off-by: Anna (navi) Figueiredo Gomes --- include/fs/gpt.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/fs/gpt.h (limited to 'include/fs/gpt.h') diff --git a/include/fs/gpt.h b/include/fs/gpt.h new file mode 100644 index 0000000..a1a8356 --- /dev/null +++ b/include/fs/gpt.h @@ -0,0 +1,40 @@ +#ifndef _GPT_H_ +#define _GPT_H_ + +#include +#include + +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 -- cgit v1.2.3