vfs Rewrite IOCTL_STAT so that it doesnt require an already open handle

This commit is contained in:
2025-10-03 01:00:09 +02:00
parent 2cfd3ee2fa
commit de20efa0f3
7 changed files with 71 additions and 44 deletions

View File

@ -140,26 +140,21 @@ int32_t SYSCALL5(sys_ioctl, ioh1, cmd1, arg1, arg2, arg3) {
ret = E_INVALIDARGUMENT;
goto done;
}
IoctlStat *iostat = (IoctlStat *)arg1;
if (iostat == NULL) {
ret = E_INVALIDARGUMENT;
goto done;
}
char mp[IOCTL_MP_MAX];
char path[IOCTL_PATH_MAX];
path_parse(opath, mp, path);
VfsObj *vobj = vfs_open(mp, path, IOCTL_F_READ);
if (vobj == NULL) {
ret = E_NOENTRY;
goto done;
}
VfsStat stat1;
ret = vobj->stat(vobj, &stat1);
vfs_close(vobj);
IoctlStat *iostat = (IoctlStat *)arg1;
if (iostat == NULL) {
ret = E_INVALIDARGUMENT;
ret = vfs_stat(mp, path, &stat1);
if (ret != E_OK) {
goto done;
}