Add fs_delete() syscall
This commit is contained in:
@ -224,3 +224,23 @@ int32_t SYSCALL1(sys_fs_mkdir, opath1) {
|
|||||||
done:
|
done:
|
||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@ -12,5 +12,6 @@ int32_t SYSCALL4(sys_fs_read, fsh1, buffer1, len1, off1);
|
|||||||
int32_t SYSCALL2(sys_fs_stat, opath1, fsstat1);
|
int32_t SYSCALL2(sys_fs_stat, opath1, fsstat1);
|
||||||
int32_t SYSCALL3(sys_fs_fetchdirent, opath1, direntbuf1, idx1);
|
int32_t SYSCALL3(sys_fs_fetchdirent, opath1, direntbuf1, idx1);
|
||||||
int32_t SYSCALL1(sys_fs_mkdir, opath1);
|
int32_t SYSCALL1(sys_fs_mkdir, opath1);
|
||||||
|
int32_t SYSCALL1(sys_fs_delete, opath1);
|
||||||
|
|
||||||
#endif // SYSCALL_FS_H_
|
#endif // SYSCALL_FS_H_
|
||||||
|
|||||||
@ -47,6 +47,7 @@ SyscallFn SYSCALL_TABLE[SYSCALLS_MAX] = {
|
|||||||
[SYS_FS_STAT] = &sys_fs_stat,
|
[SYS_FS_STAT] = &sys_fs_stat,
|
||||||
[SYS_FS_FETCHDIRENT] = &sys_fs_fetchdirent,
|
[SYS_FS_FETCHDIRENT] = &sys_fs_fetchdirent,
|
||||||
[SYS_FS_MKDIR] = &sys_fs_mkdir,
|
[SYS_FS_MKDIR] = &sys_fs_mkdir,
|
||||||
|
[SYS_FS_DELETE] = &sys_fs_delete,
|
||||||
[SYS_DEV_GETHANDLE] = &sys_dev_gethandle,
|
[SYS_DEV_GETHANDLE] = &sys_dev_gethandle,
|
||||||
[SYS_DEV_LISTSIZE] = &sys_dev_listsize,
|
[SYS_DEV_LISTSIZE] = &sys_dev_listsize,
|
||||||
[SYS_DEV_STAT] = &sys_dev_stat,
|
[SYS_DEV_STAT] = &sys_dev_stat,
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
#define SYS_FS_WRITE 30
|
#define SYS_FS_WRITE 30
|
||||||
#define SYS_FS_FETCHDIRENT 31
|
#define SYS_FS_FETCHDIRENT 31
|
||||||
#define SYS_FS_MKDIR 32
|
#define SYS_FS_MKDIR 32
|
||||||
|
#define SYS_FS_DELETE 37
|
||||||
#define SYS_DEV_GETHANDLE 33
|
#define SYS_DEV_GETHANDLE 33
|
||||||
#define SYS_DEV_LISTSIZE 34
|
#define SYS_DEV_LISTSIZE 34
|
||||||
#define SYS_DEV_STAT 35
|
#define SYS_DEV_STAT 35
|
||||||
|
|||||||
Reference in New Issue
Block a user