diff options
author | dzwdz | 2021-09-12 18:02:12 +0200 |
---|---|---|
committer | dzwdz | 2021-09-12 18:02:12 +0200 |
commit | badde3808a8a2ef512ae52af5d91f419585e27fd (patch) | |
tree | 4c5864717f75df4ac140c881b42c18dceb5352f3 /src/kernel/vfs | |
parent | 3ea9657aaaf02709c8f216285b095af29e76491c (diff) |
allow vfs_request_finish to return
thanks to this, the fs provider can continue executing until the next
fs_wait() call. that should speed things up a bit
Diffstat (limited to 'src/kernel/vfs')
-rw-r--r-- | src/kernel/vfs/request.c | 10 | ||||
-rw-r--r-- | src/kernel/vfs/request.h | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index a8f2fc0..9f0a14f 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -6,7 +6,7 @@ #include <kernel/vfs/root.h> // dispatches a VFS operation to the correct process -_Noreturn void vfs_request_create(struct vfs_request req_) { +int vfs_request_create(struct vfs_request req_) { struct vfs_request *req; int ret; process_current->state = PS_WAITS4FS; @@ -18,7 +18,8 @@ _Noreturn void vfs_request_create(struct vfs_request req_) { switch (req->backend->type) { case VFS_BACK_ROOT: ret = vfs_root_handler(req); - vfs_request_finish(req, ret); + ret = vfs_request_finish(req, ret); + return ret; case VFS_BACK_USER: if (req->backend->handler == NULL) { // backend isn't ready yet, join the queue @@ -69,8 +70,7 @@ fail: panic(); // TODO } -// returns from a VFS operation to the calling process -_Noreturn void vfs_request_finish(struct vfs_request *req, int ret) { +int vfs_request_finish(struct vfs_request *req, int ret) { struct process *caller = req->caller; if (req->type == VFSOP_OPEN && ret >= 0) { @@ -95,5 +95,5 @@ _Noreturn void vfs_request_finish(struct vfs_request *req, int ret) { req->caller->state = PS_RUNNING; regs_savereturn(&req->caller->regs, ret); kfree(req); - process_switch(caller); + return ret; } diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h index 52af544..8f5cf92 100644 --- a/src/kernel/vfs/request.h +++ b/src/kernel/vfs/request.h @@ -45,6 +45,8 @@ struct vfs_request { struct vfs_backend *backend; }; -_Noreturn void vfs_request_create(struct vfs_request); +/** Assigns the vfs_request to the caller, and calls the backend. Might not + * return - can switch processes! */ +int vfs_request_create(struct vfs_request); _Noreturn void vfs_request_pass2handler(struct vfs_request *); -_Noreturn void vfs_request_finish(struct vfs_request *, int ret); +int vfs_request_finish(struct vfs_request *, int ret); |