blob: 14c59ac6d088cc6923e0dd4ef763e6bdcc4de5a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include "devices/storage/StorageManagement.hpp"
#include "kapi/system.hpp"
#include "devices/BlockDevice.hpp"
#include "devices/storage/StorageController.hpp"
#include <optional>
namespace devices::storage
{
namespace
{
constinit auto static active_storage_management = std::optional<storage_management>{};
} // namespace
auto storage_management::init() -> void
{
if (active_storage_management)
{
kapi::system::panic("[DEVICES] Storage management has already been initialized.");
}
active_storage_management.emplace(storage_management{});
}
auto storage_management::get() -> storage_management &
{
if (!active_storage_management)
{
kapi::system::panic("[DEVICES] Storage management has not been initialized.");
}
return *active_storage_management;
}
auto storage_management::add_controller(storage_controller * controller) -> void
{
m_controllers.at(0) = controller; // TODO BA-FS26 use push_back from kstd:vector
}
auto storage_management::add_device(block_device * device) -> void
{
m_devices.at(0) = device; // TODO BA-FS26 use push_back from kstd:vector
}
} // namespace devices::storage
|