blob: b803253d9649f26e00e4b6f53f0f3c453f282432 (
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
49
50
51
52
|
/* -------------------------------------------
Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
------------------------------------------- */
#include <KernelKit/FileMgr.h>
#include <NewKit/Utils.h>
/// @file FileMgr.cc
//! @brief File System Manager API.
namespace NeOS
{
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 NeOS
|