kernel/inc/drivers/builtin/fs/gpt.h

51 lines
1.5 KiB
C

// This file is part of noxos and licensed under the MIT open source license
#ifndef NOXOS_GPT_H
#define NOXOS_GPT_H
#include "utils/stdtypes.h"
#include "utils/string.h"
typedef enum {
GPT_PARTITION_GUID_UNUSED,
GPT_PARTITION_GUID_UNKNOWN,
GPT_PARTITION_GUID_PRIMARY,
GPT_PARTITION_GUID_EFI_SYSTEM,
GPT_PARTITION_GUID_ENUM_END
} gpt_partition_type_guids_E;
typedef struct {
uint8_t signature [8];
uint32_t revision;
uint32_t header_size;
uint32_t checksum_crc32;
uint32_t reserved;
uint64_t current_lba;
uint64_t backup_lba;
uint64_t first_usable_lba;
uint64_t last_usable_lba;
uint8_t disk_guid [16];
uint64_t starting_lba;
uint32_t num_partitions;
uint32_t partition_entry_size;
uint32_t partition_entry_crc32;
uint8_t reserved2 [0x1A4];
}__attribute__((packed)) gpt_table_header_T;
typedef struct {
uint8_t partition_type_guid [16];
uint8_t partition_guid [16];
uint64_t starting_lba;
uint64_t ending_lba;
uint64_t attributes;
uint16_t name [36]; // UTF-16 encoded
}__attribute__((packed)) gpt_partition_entry_T;
gpt_partition_type_guids_E gpt_get_partition_type (uint8_t guid[16]);
string_t gpt_partition_type_to_string(gpt_partition_type_guids_E type);
extern uint8_t g_gpt_partition_type_guides[GPT_PARTITION_GUID_ENUM_END][16];
#endif //NOXOS_GPT_H