summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src/FS/HeFS+FileMgr.cc
blob: 6b559cf43c133565b1833e62a38ca224d1eff2a3 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/* -------------------------------------------

  Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.

------------------------------------------- */

#ifndef __NE_MINIMAL_OS__
#ifdef __FSKIT_INCLUDES_HEFS__

#include <KernelKit/FileMgr.h>
#include <KernelKit/HeapMgr.h>

/// @brief HeFS File System Manager.
/// BUGS: 0

namespace Kernel {
/// @brief C++ constructor
HeFileSystemMgr::HeFileSystemMgr() {
  mParser = new HeFileSystemParser();
  MUST_PASS(mParser);

  kout << "We are done allocating NeFileSystemParser...\n";
}

HeFileSystemMgr::~HeFileSystemMgr() {
  if (mParser) {
    kout << "Destroying NeFileSystemParser...\n";
    delete mParser;
    mParser = nullptr;
  }
}

/// @brief Removes a node from the filesystem.
/// @param path The filename
/// @return If it was deleted or not.
bool HeFileSystemMgr::Remove(_Input const Char* path) {
  if (path == nullptr || *path == 0) {
    kout << "HeFS: Remove called with null or empty path\n";
    return false;
  }

  return NO;
}

/// @brief Creates a node with the specified.
/// @param path The filename path.
/// @return The Node pointer.
NodePtr HeFileSystemMgr::Create(_Input const Char* path) {
  if (!path || *path == 0) {
    kout << "HeFS: Create called with null or empty path\n";
    return nullptr;
  }
  return nullptr;
}

/// @brief Creates a node which is a directory.
/// @param path The filename path.
/// @return The Node pointer.
NodePtr HeFileSystemMgr::CreateDirectory(const Char* path) {
  if (!path || *path == 0) {
    kout << "HeFS: CreateDirectory called with null or empty path\n";
    return nullptr;
  }
  return nullptr;
}

/// @brief Creates a node which is an alias.
/// @param path The filename path.
/// @return The Node pointer.
NodePtr HeFileSystemMgr::CreateAlias(const Char* path) {
  if (!path || *path == 0) {
    kout << "HeFS: CreateAlias called with null or empty path\n";
    return nullptr;
  }
  return nullptr;
}

NodePtr HeFileSystemMgr::CreateSwapFile(const Char* path) {
  if (!path || *path == 0) {
    kout << "HeFS: CreateSwapFile called with null or empty path\n";
    return nullptr;
  }
  return nullptr;
}

/// @brief Gets the root directory.
/// @return
const Char* NeFileSystemHelper::Root() {
  return kHeFSRootDirectory;
}

/// @brief Gets the up-dir directory.
/// @return
const Char* NeFileSystemHelper::UpDir() {
  return kHeFSUpDir;
}

/// @brief Gets the separator character.
/// @return
Char NeFileSystemHelper::Separator() {
  return kHeFSSeparator;
}

/// @brief Gets the metafile character.
/// @return
Char NeFileSystemHelper::MetaFile() {
  return 0;
}

/// @brief Opens a new file.
/// @param path
/// @param r
/// @return
_Output NodePtr HeFileSystemMgr::Open(_Input const Char* path, _Input const Char* r) {
  if (!path || *path == 0) {
    kout << "HeFS: Open called with null or empty path\n";
    return nullptr;
  }
  if (!r || *r == 0) {
    kout << "HeFS: Open called with null or empty mode string\n";
    return nullptr;
  }
  return nullptr;
}

Void HeFileSystemMgr::Write(_Input NodePtr node, _Input VoidPtr data, _Input Int32 flags,
                            _Input SizeT size) {}

_Output VoidPtr HeFileSystemMgr::Read(_Input NodePtr node, _Input Int32 flags, _Input SizeT size) {
  return nullptr;
}

Void HeFileSystemMgr::Write(_Input const Char* name, _Input NodePtr node, _Input VoidPtr data,
                            _Input Int32 flags, _Input SizeT size) {}

_Output VoidPtr HeFileSystemMgr::Read(_Input const Char* name, _Input NodePtr node,
                                      _Input Int32 flags, _Input SizeT sz) {
  return nullptr;
}

_Output Bool HeFileSystemMgr::Seek(NodePtr node, SizeT off) {
  return false;
}

/// @brief Tell current offset within catalog.
/// @param node
/// @return kFileMgrNPos if invalid, else current offset.
_Output SizeT HeFileSystemMgr::Tell(NodePtr node) {
  return kFileMgrNPos;
}

/// @brief Rewinds the catalog
/// @param node
/// @return False if invalid, nah? calls Seek(node, 0).
_Output Bool HeFileSystemMgr::Rewind(NodePtr node) {
  return kFileMgrNPos;
}

/// @brief Returns the parser of HeFS.
_Output HeFileSystemParser* HeFileSystemMgr::GetParser() noexcept {
  return mParser;
}
}  // namespace Kernel

#endif  // ifdef __FSKIT_INCLUDES_HEFS__
#endif  // ifndef __NE_MINIMAL_OS__