aboutsummaryrefslogtreecommitdiff
path: root/kernel/devices/src/storage/storage_controller.cpp
diff options
context:
space:
mode:
authorLukas Oesch <lukasoesch20@gmail.com>2026-03-15 16:49:07 +0100
committerLukas Oesch <lukasoesch20@gmail.com>2026-03-17 16:43:07 +0100
commit2af1bbc99e2a8fc4b86bb31023dbbb077b1cbc97 (patch)
tree9946202a366b39893dede294d51e6b684ab730ba /kernel/devices/src/storage/storage_controller.cpp
parent8eed4d31cf1d07d43e99d53da0fe3a401ce9e85e (diff)
downloadkernel-2af1bbc99e2a8fc4b86bb31023dbbb077b1cbc97.tar.xz
kernel-2af1bbc99e2a8fc4b86bb31023dbbb077b1cbc97.zip
move m_devices from ram_disk_controller to storage_controller, store point to devices
Diffstat (limited to 'kernel/devices/src/storage/storage_controller.cpp')
-rw-r--r--kernel/devices/src/storage/storage_controller.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/devices/src/storage/storage_controller.cpp b/kernel/devices/src/storage/storage_controller.cpp
index f95f533..d127a8c 100644
--- a/kernel/devices/src/storage/storage_controller.cpp
+++ b/kernel/devices/src/storage/storage_controller.cpp
@@ -1,5 +1,8 @@
#include "devices/storage/storage_controller.hpp"
+#include "devices/device.hpp"
+
+#include <algorithm>
#include <cstddef>
namespace devices::storage
@@ -14,4 +17,20 @@ namespace devices::storage
{
return m_major;
}
+
+ auto storage_controller::device_by_minor(size_t minor) -> device *
+ {
+ auto it = std::ranges::find_if(m_devices, [minor](auto const & device) { return device->minor() == minor; });
+
+ if (it != m_devices.end())
+ {
+ return *it;
+ }
+ return nullptr;
+ }
+
+ auto storage_controller::devices_count() -> size_t
+ {
+ return m_devices.size();
+ }
} // namespace devices::storage \ No newline at end of file