Fetching directory entries
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user