vfs_delete() implement deleting files

This commit is contained in:
2025-10-15 20:10:00 +02:00
parent a81d4e0c3b
commit 371d777a7c
4 changed files with 32 additions and 4 deletions

View File

@ -44,11 +44,12 @@ void vfs_init_littlefs(VfsMountPoint *mp, bool format) {
ERR("vfs", "Little FS mount failed %d\n", err);
}
mp->cleanup = &littlefs_cleanup;
mp->open = &littlefs_open;
mp->stat = &littlefs_stat;
mp->cleanup = &littlefs_cleanup;
mp->open = &littlefs_open;
mp->stat = &littlefs_stat;
mp->fetchdirent = &littlefs_fetchdirent;
mp->mkdir = &littlefs_mkdir;
mp->mkdir = &littlefs_mkdir;
mp->delete = &littlefs_delete;
}
int32_t vfs_stat(char *mountpoint, const char *path, FsStat *stat) {
@ -93,6 +94,20 @@ int32_t vfs_fetchdirent(char *mountpoint, const char *path, FsDirent *direntbuf,
return mp->fetchdirent(mp, path, direntbuf, idx);
}
int32_t vfs_delete(char *mountpoint, const char *path) {
VfsMountPoint *mp = NULL;
spinlock_acquire(&VFS_TABLE.spinlock);
HSHTB_GET(VFS_TABLE.mountpoints, label, mountpoint, mp);
spinlock_release(&VFS_TABLE.spinlock);
if (mp == NULL) {
return E_NOENTRY;
}
return mp->delete(mp, path);
}
int32_t vfs_mount(char *mountpoint, int32_t fstype, StoreDev *backingsd, bool format) {
VfsMountPoint *mp = NULL;