diff options
| author | Lukas Oesch <lukasoesch20@gmail.com> | 2026-03-03 13:52:30 +0100 |
|---|---|---|
| committer | Lukas Oesch <lukasoesch20@gmail.com> | 2026-03-17 16:42:37 +0100 |
| commit | 880cd2194507c95449949f799d48a4b8ff3e0cd5 (patch) | |
| tree | 526de3bb5f6ebd1e1cfb3db3a5454d932589689a | |
| parent | e9839b25356c420193cf8b90ed5043eb07aabff0 (diff) | |
| download | teachos-880cd2194507c95449949f799d48a4b8ff3e0cd5.tar.xz teachos-880cd2194507c95449949f799d48a4b8ff3e0cd5.zip | |
implement determine_boot_device
| -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 |
