Add fs_delete() syscall

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

View File

@ -224,3 +224,23 @@ int32_t SYSCALL1(sys_fs_mkdir, opath1) {
done:
return ret;
}
int32_t SYSCALL1(sys_fs_delete, opath1) {
int32_t ret = E_BADIO;
const char *opath = (const char *)opath1;
if (opath == NULL) {
ret = E_INVALIDARGUMENT;
goto done;
}
char mp[_MP_MAX];
char path[_PATH_MAX];
path_parse(opath, mp, path);
ret = vfs_delete(mp, path);
done:
return ret;
}

View File

@ -12,5 +12,6 @@ int32_t SYSCALL4(sys_fs_read, fsh1, buffer1, len1, off1);
int32_t SYSCALL2(sys_fs_stat, opath1, fsstat1);
int32_t SYSCALL3(sys_fs_fetchdirent, opath1, direntbuf1, idx1);
int32_t SYSCALL1(sys_fs_mkdir, opath1);
int32_t SYSCALL1(sys_fs_delete, opath1);
#endif // SYSCALL_FS_H_

View File

@ -47,6 +47,7 @@ SyscallFn SYSCALL_TABLE[SYSCALLS_MAX] = {
[SYS_FS_STAT] = &sys_fs_stat,
[SYS_FS_FETCHDIRENT] = &sys_fs_fetchdirent,
[SYS_FS_MKDIR] = &sys_fs_mkdir,
[SYS_FS_DELETE] = &sys_fs_delete,
[SYS_DEV_GETHANDLE] = &sys_dev_gethandle,
[SYS_DEV_LISTSIZE] = &sys_dev_listsize,
[SYS_DEV_STAT] = &sys_dev_stat,