diff options
| -rw-r--r-- | kernel/devices/include/devices/storage/StorageManagement.hpp | 2 | ||||
| -rw-r--r-- | kernel/devices/src/storage/StorageManagement.cpp | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/kernel/devices/include/devices/storage/StorageManagement.hpp b/kernel/devices/include/devices/storage/StorageManagement.hpp index 632ff19..226fb28 100644 --- a/kernel/devices/include/devices/storage/StorageManagement.hpp +++ b/kernel/devices/include/devices/storage/StorageManagement.hpp @@ -17,7 +17,9 @@ namespace devices::storage auto static get() -> storage_management &; auto add_controller(storage_controller * controller) -> void; + auto device_by_major_minor(size_t major, size_t minor) -> block_device *; + auto determine_boot_device() -> block_device *; private: storage_management() = default; diff --git a/kernel/devices/src/storage/StorageManagement.cpp b/kernel/devices/src/storage/StorageManagement.cpp index 58d8510..1b0d2cc 100644 --- a/kernel/devices/src/storage/StorageManagement.cpp +++ b/kernel/devices/src/storage/StorageManagement.cpp @@ -16,7 +16,8 @@ namespace devices::storage namespace { constexpr size_t static MINORS_PER_DEVICE = 16; - constinit size_t static next_free_major = 1; + constexpr size_t static START_MAJOR = 1; + constinit size_t static next_free_major = START_MAJOR; constinit auto static active_storage_management = std::optional<storage_management>{}; constinit auto static active_ram_disk_controller = std::optional<ram_disk::ram_disk_controller>{}; @@ -68,4 +69,10 @@ namespace devices::storage return found; } + auto storage_management::determine_boot_device() -> block_device * + { + // TODO BA-FS26 better way? + return device_by_major_minor(START_MAJOR, 0); + } + } // namespace devices::storage
\ No newline at end of file |
