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/vfs/request.h | |
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/vfs/request.h')
-rw-r--r-- | src/kernel/vfs/request.h | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h index 616c044..6786e72 100644 --- a/src/kernel/vfs/request.h +++ b/src/kernel/vfs/request.h @@ -4,6 +4,10 @@ #include <stdbool.h> #include <stddef.h> +struct ReqQueue { + VfsReq *head; +}; + struct VfsBackend { /* amount of using references * VfsMount @@ -11,17 +15,15 @@ struct VfsBackend { * Handle * once it reaches 0, it'll never increase */ size_t usehcnt; /* VfsMount */ - /* amount of providing references - * Proc - * 0 - orphaned, will never increase */ - // TODO move this into .user - size_t provhcnt; - VfsReq *queue; bool is_user; union { struct { Proc *handler; + ReqQueue queue; /* kernel backends keep their own queues */ + /* amount of processes that control this backend + * won't ever increase if it becomes 0 */ + size_t provhcnt; } user; struct { void (*accept)(VfsReq *); @@ -56,10 +58,7 @@ struct VfsReq { Proc *caller; VfsBackend *backend; - VfsReq *queue_next; - VfsReq *postqueue_next; /* used by kernel backends */ - /* only one of these queues is in use at a given moment, they could - * be merged into a single field */ + VfsReq *reqqueue_next; }; /** Assigns the vfs_request to the caller, and dispatches the call */ @@ -79,13 +78,10 @@ void vfsback_userdown(VfsBackend *); /** Decrements the "provider" reference count. */ void vfsback_provdown(VfsBackend *); -struct ReqQueue { - VfsReq *head; -}; -void postqueue_init(ReqQueue *q); -void postqueue_join(ReqQueue *q, VfsReq *req); -VfsReq *postqueue_pop(ReqQueue *q); +void reqqueue_init(ReqQueue *q); +void reqqueue_join(ReqQueue *q, VfsReq *req); +VfsReq *reqqueue_pop(ReqQueue *q); -/** If there are any pending read requests, and the ring buffer isn't empty, fulfill them - * all with a single read. */ -void postqueue_ringreadall(ReqQueue *q, ring_t *r); +/** If there are any pending read requests, and the ring buffer isn't empty, + * fulfill them all with a single read. */ +void reqqueue_ringreadall(ReqQueue *q, ring_t *r); |