summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-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