blob: bbe7d30b659c0df4656f1866c9adba86bd9a4875 (
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
|
/* -------------------------------------------
Copyright Mahrouss Logic
------------------------------------------- */
#include <KernelKit/FileManager.hpp>
#include <NewKit/ErrorID.hpp>
#include <NewKit/Utils.hpp>
/// BUGS: 0
//! @brief File manager for NewOS.
namespace NewOS {
static FilesystemManagerInterface* kMounted = nullptr;
/// @brief FilesystemManager getter.
/// @return The mounted filesystem.
FilesystemManagerInterface* FilesystemManagerInterface::GetMounted() { return kMounted; }
/// @brief Unmount filesystem.
/// @return the unmounted filesystem.
FilesystemManagerInterface* FilesystemManagerInterface::Unmount() {
if (kMounted) {
auto mount = kMounted;
kMounted = nullptr;
return mount;
}
return nullptr;
}
/// @brief Mount filesystem.
/// @param mountPtr the filesystem to mount.
/// @return if it succeeded true, otherwise false.
bool FilesystemManagerInterface::Mount(FilesystemManagerInterface* mountPtr) {
if (kMounted == nullptr) {
kMounted = mountPtr;
return true;
}
return false;
}
} // namespace NewOS
|