/* * Copyright (c) 2020, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include namespace Kernel { class PartitionTable; class StorageManagement { AK_MAKE_ETERNAL; public: StorageManagement(String boot_argument, bool force_pio); static bool initialized(); static void initialize(String boot_argument, bool force_pio); static StorageManagement& the(); NonnullRefPtr root_filesystem() const; static int major_number(); static int minor_number(); private: bool boot_argument_contains_partition_uuid(); NonnullRefPtrVector enumerate_controllers(bool force_pio) const; NonnullRefPtrVector enumerate_storage_devices() const; NonnullRefPtrVector enumerate_disk_partitions() const; void determine_boot_device(); void determine_boot_device_with_partition_uuid(); OwnPtr try_to_initialize_partition_table(const StorageDevice&) const; RefPtr boot_block_device() const; String m_boot_argument; RefPtr m_boot_block_device { nullptr }; NonnullRefPtrVector m_controllers; NonnullRefPtrVector m_storage_devices; NonnullRefPtrVector m_disk_partitions; }; }