feat: real stat metadata across all filesystems, plus mkdir and rmdir

This commit is contained in:
daniel committed 2026-08-04 13:03:08 +02:00
1 parent ca5331c9db
commit edc3452d61
14 files changed
+557 -25

No files matched your search

+18 -1
View File
@@ -69,6 +69,23 @@ namespace Fs {
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); }
int RdStat(void*, const char* p, Vfs::StatInfo* out) {
if (out == nullptr) return -1;
Ramdisk::StatResult st;
if (Ramdisk::Stat(p, &st) != 0) return -1;
out->size = st.size;
// The USTAR header carries a single timestamp; report it for all
// three rather than leaving ctime/atime at the epoch.
out->mtime = st.mtime;
out->ctime = st.mtime;
out->atime = st.mtime;
out->mode = (st.isDirectory ? Vfs::ModeDir : Vfs::ModeReg) | (st.mode & 07777);
out->isDir = st.isDirectory;
return 0;
}
Vfs::FsDriver g_ramdiskDriver = {
.ctx = nullptr,
.Open = RdOpen,
@@ -83,7 +100,7 @@ namespace Fs {
.Rename = RdRename,
.GetLabel = RdGetLabel,
.ReadDirAt = RdReadDirAt,
.Stat = nullptr,
.Stat = RdStat,
// Statically allocated: nothing to release.
.Unmount = nullptr,
};