From fb7949549435e735acef3674b10f429fa4c4789e Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 14 Jul 2024 23:20:35 +0200 Subject: 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. --- src/kernel/vfs/request.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/kernel/vfs/request.c') 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 #include #include +#include #include #include @@ -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 -- cgit v1.2.3