mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
Kernel: Introduce a new partitioning subsystem
The partitioning code was very outdated, and required a full refactor. The new subsystem removes duplicated code and uses more AK containers. The most important change is that all implementations of the PartitionTable class conform to one interface, which made it possible to remove unnecessary code in the EBRPartitionTable class. Finding partitions is now done in the StorageManagement singleton, instead of doing so in init.cpp. Also, now we don't try to find partitions on demand - the kernel will try to detect if a StorageDevice is partitioned, and if so, will check what is the partition table, which could be MBR, GUID or EBR. Then, it will create DiskPartitionMetadata object for each partition that is available in the partition table. This object will be used by the partition enumeration code to create a DiskPartition with the correct minor number.
This commit is contained in:
parent
bc18712adf
commit
72b1998f0d
20 changed files with 639 additions and 561 deletions
|
@ -45,6 +45,12 @@ DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Byt
|
|||
ASSERT(!m_partition_type.is_empty());
|
||||
ASSERT(!m_unique_guid.is_empty());
|
||||
}
|
||||
|
||||
DiskPartitionMetadata DiskPartitionMetadata::offset(u64 blocks_count) const
|
||||
{
|
||||
return DiskPartitionMetadata({ blocks_count + m_start_block, blocks_count + m_end_block, m_partition_type });
|
||||
}
|
||||
|
||||
u64 DiskPartitionMetadata::start_block() const
|
||||
{
|
||||
return m_start_block;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue