diff options
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index c1ba47a..fdf4b84 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -75,7 +75,7 @@ handle_t _syscall_open(const char __user *path, int len) { return -1; // copy the path to the kernel - // path_buf gets freed in vfs_backend_finish + // path_buf gets freed in vfs_request_finish path_buf = kmalloc(len); if (!virt_cpy_from(process_current->pages, path_buf, path, len)) goto fail; @@ -86,12 +86,15 @@ handle_t _syscall_open(const char __user *path, int len) { mount = vfs_mount_resolve(process_current->mount, path_buf, len); if (!mount) goto fail; - vfs_backend_dispatch(mount->backend, (struct vfs_op) { + vfs_request_create((struct vfs_request) { .type = VFSOP_OPEN, .open = { .path = &path_buf[mount->prefix_len], .path_len = len - mount->prefix_len, - } + }, + + .caller = process_current, + .backend = mount->backend, }); // doesn't return / fallthrough to fail @@ -141,13 +144,15 @@ int _syscall_write(handle_t handle_num, const char __user *buf, int len) { struct handle *handle = &process_current->handles[handle_num]; if (handle_num < 0 || handle_num >= HANDLE_MAX) return -1; if (handle->type != HANDLE_FILE) return -1; - vfs_backend_dispatch(handle->file.backend, (struct vfs_op) { + vfs_request_create((struct vfs_request) { .type = VFSOP_WRITE, .rw = { .buf = (userptr_t) buf, .buf_len = len, .id = handle->file.id, - } + }, + .caller = process_current, + .backend = handle->file.backend, }); return -1; } @@ -206,7 +211,7 @@ int _syscall_fs_wait(handle_t back, void __user *info) { // handle queued requests struct process *queued = back_handle->fs.backend->queue; back_handle->fs.backend->queue = NULL; // TODO get the next queued proc - vfs_request_pass2handler(queued->pending_req); + vfs_request_pass2handler(&queued->pending_req); } else { process_switch_any(); } |