diff options
author | dzwdz | 2024-07-11 21:43:50 +0200 |
---|---|---|
committer | dzwdz | 2024-07-11 21:43:50 +0200 |
commit | ed8ff1ff9c4c0f847ffc2ab4624bd999539a0890 (patch) | |
tree | 7dd5ad530f65fb09f6f0ce6c4d94efa2fc2d05d7 /src/kernel/syscalls.c | |
parent | 8138ba97608ff0cd4e443994390f277eca3d7b28 (diff) |
kernel: start cleaning up VfsRequest
* I'm being more strict about the linked list state to hopefully ensure
I'm not leaking any references.
* vfsreq_create was renamed to vfsreq_dispatchcopy as that name feels more
clear. It copies its argument, and dispatches it.
* Requests for user backends are now handled more like requests for kernel
backends - there's an accept() function that accepts a request.
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 9b0746a..5771b6a 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -85,7 +85,7 @@ hid_t _sys_open(const char __user *path, long len, int flags) { memcpy(path_buf, path_buf + mount->prefix_len, len); } - vfsreq_create((VfsReq) { + vfsreq_dispatchcopy((VfsReq) { .type = VFSOP_OPEN, .input = { .kern = true, @@ -198,7 +198,7 @@ static long simple_vfsop( req.input.buf = buf; req.input.len = len; } - vfsreq_create(req); + vfsreq_dispatchcopy(req); } else if (h->type == HANDLE_PIPE) { if (vfsop == VFSOP_READ || vfsop == VFSOP_WRITE) { /* already checked if this is the correct pipe end */ @@ -238,7 +238,7 @@ long _sys_remove(hid_t hid) { hs_close(proc_cur->hs, hid); SYSCALL_RETURN(-EACCES); } - vfsreq_create((VfsReq) { + vfsreq_dispatchcopy((VfsReq) { .type = VFSOP_REMOVE, .id = h->file_id, .caller = proc_cur, @@ -271,7 +271,14 @@ hid_t _sys_fs_wait(char __user *buf, long max_len, struct ufs_request __user *re proc_cur->awaited_req.max_len = max_len; proc_cur->awaited_req.res = res; - vfs_backend_tryaccept(backend); // sets return value + // TODO maybe i should use the postqueue stuff here + if (backend->queue) { + VfsReq *req = backend->queue; + backend->queue = req->queue_next; + req->queue_next = NULL; + vfsback_useraccept(req); + } + return -1; // dummy } |