summaryrefslogtreecommitdiff
path: root/include/fs
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-06-06 15:05:45 +0200
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-06-06 15:08:36 +0200
commitddb15c409290ac5473ee36d5dc621a92f161cdfb (patch)
treec618b4aefd2f552a98521b645b986622d688022b /include/fs
parentd6d6d34e944e7a2a6d345e71750cfa35f94445f5 (diff)
basic gpt support
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'include/fs')
-rw-r--r--include/fs/gpt.h40
1 files changed, 40 insertions, 0 deletions
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 <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