From 880cd2194507c95449949f799d48a4b8ff3e0cd5 Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Tue, 3 Mar 2026 13:52:30 +0100 Subject: implement determine_boot_device --- kernel/devices/include/devices/storage/StorageManagement.hpp | 2 ++ kernel/devices/src/storage/StorageManagement.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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{}; constinit auto static active_ram_disk_controller = std::optional{}; @@ -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 -- cgit v1.2.3