fix(kernel/vfs): 🎉 a complete rewrite of the vfs

This is the fourth time re-writing the VFS, hope this will be the last. Tried to make it as modular as possible so this won't be necessary in the future. 🙏

This change required the entire kernel code to be modified.
This commit is contained in:
2025-05-13 15:59:12 +00:00
parent 83a7f83f81
commit 557c7e6235
83 changed files with 3252 additions and 2487 deletions

View File

@ -15,7 +15,7 @@
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
*/
#include <filesystem/ramfs.hpp>
#include <fs/ramfs.hpp>
#include "../../kernel.h"
@ -23,25 +23,30 @@ namespace Subsystem::Windows
{
bool Initialized = false;
void __CreateStubRoot()
{
Node root = fs->GetRoot(0);
Node nmnt = fs->Lookup(root, "/mnt");
assert(MountAndRootRAMFS(nmnt, "windows", 2));
Node win = fs->GetRoot(2);
Node windows = fs->Create(win, "Windows", 0755);
Node programFiles = fs->Create(windows, "Program Files", 0755);
Node programFilesX86 = fs->Create(windows, "Program Files (x86)", 0755);
Node programData = fs->Create(windows, "ProgramData", 0755);
Node users = fs->Create(windows, "Users", 0755);
UNUSED(windows);
UNUSED(programFiles);
UNUSED(programFilesX86);
UNUSED(programData);
UNUSED(users);
}
void InitializeSubSystem()
{
if (fs->RootExists(2) == false)
{
FileNode *nmnt = fs->GetByPath("/mnt", fs->GetRoot(0));
assert(MountRAMFS(nmnt, "windows", 2));
FileNode *win = fs->GetRoot(2);
FileNode *windows = fs->ForceCreate(win, "Windows", 0755);
FileNode *programFiles = fs->ForceCreate(windows, "Program Files", 0755);
FileNode *programFilesX86 = fs->ForceCreate(windows, "Program Files (x86)", 0755);
FileNode *programData = fs->ForceCreate(windows, "ProgramData", 0755);
FileNode *users = fs->ForceCreate(windows, "Users", 0755);
UNUSED(windows);
UNUSED(programFiles);
UNUSED(programFilesX86);
UNUSED(programData);
UNUSED(users);
}
}
}