diff options
author | dzwdz | 2024-07-14 19:40:31 +0200 |
---|---|---|
committer | dzwdz | 2024-07-14 19:40:31 +0200 |
commit | 881be872675e4cff153c27c641980451c4a3f479 (patch) | |
tree | a374913fc7f1fcbd1d380719d695bf5f67b83e56 /src/kernel/syscalls.c | |
parent | 6fe8073de975ad7722043f9173fec068178e2eac (diff) |
kernel: make the adhoc VfsQueue queues use ReqQueue instead
I'm still not sure if I should use sys/queue.h for this.
But yeah, this is more consistent, and it will also let me switch over to O(1)
insertions later on.
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 39115e7..1e1cd2f 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -39,11 +39,11 @@ long _sys_fork(int flags, hid_t __user *fs_front) { } h->backend = kzalloc(sizeof *h->backend, "user fs"); - h->backend->is_user = true; - h->backend->provhcnt = 1; /* child */ h->backend->usehcnt = 1; /* handle */ + h->backend->is_user = true; + h->backend->user.provhcnt = 1; h->backend->user.handler = NULL; - h->backend->queue = NULL; + reqqueue_init(&h->backend->user.queue); child->controlled = h->backend; if (fs_front) { @@ -261,6 +261,7 @@ hid_t _sys_fs_wait(char __user *buf, long max_len, struct ufs_request __user *re /* nothing on the other end. EPIPE seems fitting */ SYSCALL_RETURN(-EPIPE); } + assert(backend->is_user); proc_setstate(proc_cur, PS_WAITS4REQUEST); if (backend->user.handler) @@ -270,11 +271,8 @@ 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; - // 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; + VfsReq *req = reqqueue_pop(&backend->user.queue); + if (req) { vfsback_useraccept(req); } |