blob: e000965f3e424f144d24500d1b3d3f6b3b2f6ccf (
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
47
48
|
/* -------------------------------------------
Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
#include <KernelKit/FileMgr.h>
#include <NeKit/Utils.h>
/***********************************************************************************/
/// @file FileMgr.cc
//! @brief File System Manager API.
/***********************************************************************************/
namespace Kernel {
STATIC IFilesystemMgr* kMountedFilesystem = nullptr;
/// @brief FilesystemMgr getter.
/// @return The mounted filesystem.
_Output IFilesystemMgr* IFilesystemMgr::GetMounted() {
return kMountedFilesystem;
}
/// @brief Unmount filesystem.
/// @return The unmounted filesystem.
_Output IFilesystemMgr* IFilesystemMgr::Unmount() {
if (kMountedFilesystem) {
auto mount = kMountedFilesystem;
kMountedFilesystem = nullptr;
return mount;
}
return nullptr;
}
/// @brief Mount filesystem.
/// @param mount_ptr The filesystem to mount.
/// @return if it succeeded true, otherwise false.
_Output Bool IFilesystemMgr::Mount(_Input IFilesystemMgr* mount_ptr) {
if (mount_ptr != nullptr) {
kMountedFilesystem = mount_ptr;
return Yes;
}
return No;
}
} // namespace Kernel
|