feat: vfs - add dynamic filesystem mounts and safe unmount lifecycle

This commit is contained in:
daniel committed 2026-08-04 08:58:50 +02:00
1 parent b1c55073c7
commit ca5331c9db
12 files changed
+520 -259

No files matched your search

+31 -12
View File
@@ -54,19 +54,38 @@ namespace Fs {
return hasRamdisk;
}
// The ramdisk is a singleton, so it has no per-mount state and ignores
// ctx. These shims exist only to match the FsDriver signature.
int RdOpen(void*, const char* p) { return Ramdisk::Open(p); }
int RdRead(void*, int h, uint8_t* b, uint64_t o, uint64_t s) { return Ramdisk::Read(h, b, o, s); }
uint64_t RdGetSize(void*, int h) { return Ramdisk::GetSize(h); }
void RdClose(void*, int h) { Ramdisk::Close(h); }
int RdReadDir(void*, const char* p, const char** o, int m) { return Ramdisk::ReadDir(p, o, m); }
int RdWrite(void*, int h, const uint8_t* b, uint64_t o, uint64_t s) { return Ramdisk::Write(h, b, o, s); }
int RdCreate(void*, const char* p) { return Ramdisk::Create(p); }
int RdDelete(void*, const char* p) { return Ramdisk::Delete(p); }
int RdMkdir(void*, const char* p) { return Ramdisk::Mkdir(p); }
int RdRename(void*, const char* o, const char* n) { return Ramdisk::Rename(o, n); }
const char* RdGetLabel(void*) { return Ramdisk::GetLabel(); }
int RdReadDirAt(void*, const char* p, const char** o, int m, int s) { return Ramdisk::ReadDirAt(p, o, m, s); }
Vfs::FsDriver g_ramdiskDriver = {
Ramdisk::Open,
Ramdisk::Read,
Ramdisk::GetSize,
Ramdisk::Close,
Ramdisk::ReadDir,
Ramdisk::Write,
Ramdisk::Create,
Ramdisk::Delete,
Ramdisk::Mkdir,
Ramdisk::Rename,
Ramdisk::GetLabel,
Ramdisk::ReadDirAt,
.ctx = nullptr,
.Open = RdOpen,
.Read = RdRead,
.GetSize = RdGetSize,
.Close = RdClose,
.ReadDir = RdReadDir,
.Write = RdWrite,
.Create = RdCreate,
.Delete = RdDelete,
.Mkdir = RdMkdir,
.Rename = RdRename,
.GetLabel = RdGetLabel,
.ReadDirAt = RdReadDirAt,
.Stat = nullptr,
// Statically allocated: nothing to release.
.Unmount = nullptr,
};
}