1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

PartitionTable: Initial GPT Support, Adding Block Limit

Also added a script to handle creation of GPT partitioned disk (with
GRUB config file). Block limit will be used to disallow potential access
to other partitions.
This commit is contained in:
supercomputer7 2019-10-07 03:12:37 +03:00 committed by Andreas Kling
parent b5a043cf42
commit de49714f36
10 changed files with 273 additions and 13 deletions

View file

@ -37,6 +37,11 @@ bool MBRPartitionTable::initialize()
return true;
}
bool MBRPartitionTable::is_protective_mbr() const
{
return header().entry[0].type == MBR_PROTECTIVE;
}
RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
{
ASSERT(index >= 1 && index <= 4);
@ -55,7 +60,7 @@ RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
if (entry.offset == 0x00) {
#ifdef MBR_DEBUG
kprintf("MBRPartitionTable::partition: missing partition requested index=%d\n", index);
kprintf("MBRPartitionTable::partition: missing partition requested index=%d\n", index);
#endif
return nullptr;
@ -65,5 +70,5 @@ RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
kprintf("MBRPartitionTable::partition: found partition index=%d type=%x\n", index, entry.type);
#endif
return DiskPartition::create(m_device, entry.offset);
return DiskPartition::create(m_device, entry.offset, (entry.offset + entry.length));
}