summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/util.c
diff options
context:
space:
mode:
authordzwdz2024-07-14 19:19:35 +0200
committerdzwdz2024-07-14 19:19:35 +0200
commit6fe8073de975ad7722043f9173fec068178e2eac (patch)
tree9427bb0368e25609eea66fa52567b57522b0e0aa /src/kernel/arch/amd64/driver/util.c
parentb3a86647b644db30f5fd70bd651c44f681962a9b (diff)
kernel: rework postqueue
Keeping its old name for now to make things easier for myself. This might just be replaced by sys/queue.h soon.
Diffstat (limited to 'src/kernel/arch/amd64/driver/util.c')
-rw-r--r--src/kernel/arch/amd64/driver/util.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c
index 2b33849..f02c4e2 100644
--- a/src/kernel/arch/amd64/driver/util.c
+++ b/src/kernel/arch/amd64/driver/util.c
@@ -13,50 +13,6 @@ int req_readcopy(VfsReq *req, const void *buf, size_t len) {
return req->output.len;
}
-void postqueue_join(VfsReq **queue, VfsReq *req) {
- if (req->postqueue_next)
- panic_invalid_state();
-
- while (*queue)
- queue = &(*queue)->postqueue_next;
- *queue = req;
-}
-
-bool postqueue_pop(VfsReq **queue, void (*accept)(VfsReq *)) {
- VfsReq *req = *queue;
- if (req == NULL) return false;
- *queue = req->postqueue_next;
- req->postqueue_next = NULL;
- accept(req);
- return true;
-}
-
-void postqueue_ringreadall(VfsReq **queue, ring_t *r) {
- VfsReq *req;
- char tmp[64];
- size_t mlen = 0;
- if (ring_used(r) == 0) return;
-
- /* read as much as the biggest request wants */
- for (req = *queue; req; req = req->postqueue_next)
- mlen = max(mlen, req->output.len);
- mlen = min(mlen, sizeof tmp);
- mlen = ring_get(r, tmp, mlen);
-
- while (*queue) {
- req = *queue;
- *queue = req->postqueue_next;
- req->postqueue_next = NULL;
-
- size_t ret = min(mlen, req->output.len);
- assert(req->type == VFSOP_READ);
- if (req->caller) {
- pcpy_to(req->caller, req->output.buf, tmp, ret);
- }
- vfsreq_finish_short(req, ret);
- }
-}
-
size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max) {
char tmp[32];
if (max > sizeof tmp) max = sizeof tmp;