Fetching directory entries

This commit is contained in:
2025-10-03 19:50:10 +02:00
parent de20efa0f3
commit 443cf0e4ff
6 changed files with 107 additions and 1 deletions

View File

@ -161,6 +161,29 @@ int32_t SYSCALL5(sys_ioctl, ioh1, cmd1, arg1, arg2, arg3) {
iostat->size = stat1.size;
iostat->type = stat1.type;
} break;
case IOCTL_FETCHDIRENT: {
const char *opath = (const char *)arg1;
if (opath == NULL) {
ret = E_INVALIDARGUMENT;
goto done;
}
IoctlDirent *direntbuf = (IoctlDirent *)arg2;
if (direntbuf == NULL) {
ret = E_INVALIDARGUMENT;
goto done;
}
size_t idx = (size_t)arg3;
char mp[IOCTL_MP_MAX];
char path[IOCTL_PATH_MAX];
path_parse(opath, mp, path);
ret = vfs_fetchdirent(mp, path, direntbuf, idx);
} break;
default: {
ret = E_INVALIDARGUMENT;
goto done;