summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/amd64/driver/util.c')
-rw-r--r--src/kernel/arch/amd64/driver/util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c
index 11aecca..4eeaa0d 100644
--- a/src/kernel/arch/amd64/driver/util.c
+++ b/src/kernel/arch/amd64/driver/util.c
@@ -15,3 +15,20 @@ int req_readcopy(struct vfs_request *req, const void *buf, size_t len) {
/* read errors are ignored. TODO write a spec */
return req->output.len;
}
+
+void postqueue_join(struct vfs_request **queue, struct vfs_request *req) {
+ if (req->postqueue_next)
+ panic_invalid_state();
+
+ while (*queue)
+ queue = &(*queue)->postqueue_next;
+ *queue = req;
+}
+
+bool postqueue_pop(struct vfs_request **queue, void (*accept)(struct vfs_request *)) {
+ struct vfs_request *req = *queue;
+ if (req == NULL) return false;
+ *queue = req->postqueue_next;
+ accept(req);
+ return true;
+}