Luna/kernel/src/fs/MBR.h

36 lines
661 B
C
Raw Normal View History

#pragma once
#include "fs/VFS.h"
#include <luna/Types.h>
#define MBR_BOOTABLE 0x80
#define MBR_SIGNATURE_1 0x55
#define MBR_SIGNATURE_2 0xAA
namespace MBR
{
struct [[gnu::packed]] PartitionHeader
{
u8 attributes;
u8 chs_start[3];
u8 partition_type;
u8 chs_end[3];
u32 start_lba;
u32 num_sectors;
};
struct [[gnu::packed]] DiskHeader
{
u8 mbr_code[440];
u8 disk_id[4];
u8 reserved[2];
PartitionHeader partitions[4];
u8 signature[2];
};
static_assert(sizeof(DiskHeader) == 512ul);
Result<bool> identify(SharedPtr<VFS::Inode> inode);
};