diff options
author | dzwdz | 2022-04-07 22:21:31 +0200 |
---|---|---|
committer | dzwdz | 2022-04-07 22:21:31 +0200 |
commit | 6a71c766e60a9ac12876a0ea8a10c997df2507a3 (patch) | |
tree | 9678d02c2727741f38393edfffb856dffd0548cf /src/kernel/vfs/request.c | |
parent | 85dfa7d1434aec965513414e36d6bbb300830512 (diff) |
kernel/vfs: implement a vfs request queue
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r-- | src/kernel/vfs/request.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 45a7ae7..0214ca7 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -10,10 +10,11 @@ int vfs_request_create(struct vfs_request req_) { struct vfs_request *req; int ret; process_current->state = PS_WAITS4FS; + process_current->waits4fs.queue_next = NULL; // the request is owned by the caller - process_current->pending_req = req_; - req = &process_current->pending_req; + process_current->waits4fs.req = req_; + req = &process_current->waits4fs.req; if (!req->backend) return vfs_request_finish(req, -1); @@ -26,8 +27,10 @@ int vfs_request_create(struct vfs_request req_) { case VFS_BACK_USER: if (req->backend->handler == NULL) { // backend isn't ready yet, join the queue - assert(req->backend->queue == NULL); // TODO implement a proper queue - req->backend->queue = process_current; + struct process **iter = &req->backend->queue; + while (*iter != NULL) + iter = &(*iter)->waits4fs.queue_next; + *iter = process_current; process_switch_any(); } else { vfs_request_pass2handler(req); |