1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 09:47:35 +00:00

Kernel: Use global mechanism to determine minor number of Storage Device

This commit is contained in:
Liav A 2021-02-25 19:36:49 +02:00 committed by Andreas Kling
parent 566c10b8b8
commit b59e45e65c
7 changed files with 31 additions and 8 deletions

View file

@ -40,6 +40,7 @@
namespace Kernel {
static StorageManagement* s_the;
static size_t s_device_minor_number;
UNMAP_AFTER_INIT StorageManagement::StorageManagement(String boot_argument, bool force_pio)
: m_boot_argument(boot_argument)
@ -47,6 +48,7 @@ UNMAP_AFTER_INIT StorageManagement::StorageManagement(String boot_argument, bool
, m_storage_devices(enumerate_storage_devices())
, m_disk_partitions(enumerate_disk_partitions())
{
s_device_minor_number = 0;
if (!boot_argument_contains_partition_uuid()) {
determine_boot_device();
return;
@ -177,6 +179,15 @@ RefPtr<BlockDevice> StorageManagement::boot_block_device() const
return m_boot_block_device;
}
int StorageManagement::major_number()
{
return 3;
}
int StorageManagement::minor_number()
{
return s_device_minor_number++;
}
NonnullRefPtr<FS> StorageManagement::root_filesystem() const
{
auto boot_device_description = boot_block_device();