diff options
author | dzwdz | 2024-07-14 23:20:35 +0200 |
---|---|---|
committer | dzwdz | 2024-07-15 00:12:54 +0200 |
commit | fb7949549435e735acef3674b10f429fa4c4789e (patch) | |
tree | e9822bd08a806897e042c48a6279db5ad14cc175 /src/kernel/vfs/request.c | |
parent | ad99cc4245dd2dfda37e40146609e09cf2e409c6 (diff) |
kernel: new queue abstraction
The postqueue functions remain as-is, as that's a more "specialized" interface.
They're mostly wrappers around queue.h, though.
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r-- | src/kernel/vfs/request.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 8a80f04..8e6f14a 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -3,6 +3,7 @@ #include <kernel/malloc.h> #include <kernel/panic.h> #include <kernel/proc.h> +#include <kernel/queue.h> #include <kernel/vfs/request.h> #include <shared/mem.h> @@ -236,32 +237,19 @@ vfsback_provdown(VfsBackend *b) void reqqueue_init(ReqQueue *q) { - q->head = NULL; - q->slot = &q->head; + QUEUE_INIT(q); } void reqqueue_join(ReqQueue *q, VfsReq *req) { - assert(req->reqqueue_next == NULL); - assert(q->slot != NULL); - assert(*q->slot == NULL); - *q->slot = req; - q->slot = &req->reqqueue_next; + QUEUE_APPEND(q, reqqueue, req); } VfsReq * reqqueue_pop(ReqQueue *q) { - VfsReq *req = q->head; - if (req) { - q->head = req->reqqueue_next; - req->reqqueue_next = NULL; - if (q->slot == &req->reqqueue_next) { - q->slot = &q->head; - } - } - return req; + return QUEUE_POP(q, reqqueue); } void |