summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/request.c
diff options
context:
space:
mode:
authordzwdz2022-05-05 22:12:55 +0200
committerdzwdz2022-05-05 22:12:55 +0200
commit9900cc737988f25db30b5876f066a78e73389205 (patch)
tree1bba6cfbe118855ba3d338aa3d881da3aa15ca9e /src/kernel/vfs/request.c
parent740cacba5befeba212935b00f8ae95008f564293 (diff)
kernel: syscalls now have to explicitly save the return value
thus they can opt out of doing that so the calls which might return immediately but can return later don't have to both regs_savereturn and return to the caller. and because of that, the return values of a lot of VFS things have just got way saner
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r--src/kernel/vfs/request.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index f463b86..3e7c9f0 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -6,7 +6,7 @@
#include <kernel/vfs/root.h>
#include <shared/mem.h>
-int vfsreq_create(struct vfs_request req_) {
+void vfsreq_create(struct vfs_request req_) {
struct vfs_request *req = kmalloc(sizeof *req); // freed in vfsreq_finish
memcpy(req, &req_, sizeof *req);
@@ -19,17 +19,17 @@ int vfsreq_create(struct vfs_request req_) {
}
if (!req->backend || !req->backend->potential_handlers)
- return vfsreq_finish(req, -1);
+ vfsreq_finish(req, -1);
struct vfs_request **iter = &req->backend->queue;
while (*iter != NULL) // find free spot in queue
iter = &(*iter)->queue_next;
*iter = req;
- return vfs_backend_tryaccept(req->backend);
+ vfs_backend_tryaccept(req->backend);
}
-int vfsreq_finish(struct vfs_request *req, int ret) {
+void vfsreq_finish(struct vfs_request *req, int ret) {
if (req->type == VFSOP_OPEN && ret >= 0) {
// open() calls need special handling
// we need to wrap the id returned by the VFS in a handle passed to
@@ -63,32 +63,32 @@ int vfsreq_finish(struct vfs_request *req, int ret) {
vfs_backend_refdown(req->backend);
kfree(req);
- return ret;
+ return;
}
-int vfs_backend_tryaccept(struct vfs_backend *backend) {
+void vfs_backend_tryaccept(struct vfs_backend *backend) {
struct vfs_request *req = backend->queue;
- if (!req) return -1;
+ if (!req) return;
/* ensure backend is ready to accept request */
if (backend->is_user) {
- if (!backend->user.handler) return -1;
+ if (!backend->user.handler) return;
} else {
assert(backend->kern.ready);
- if (!backend->kern.ready(backend)) return -1;
+ if (!backend->kern.ready(backend)) return;
}
backend->queue = req->queue_next;
if (backend->is_user) {
- return vfs_backend_user_accept(req);
+ vfs_backend_user_accept(req);
} else {
assert(backend->kern.accept);
- return backend->kern.accept(req);
+ backend->kern.accept(req);
}
}
-int vfs_backend_user_accept(struct vfs_request *req) {
+void vfs_backend_user_accept(struct vfs_request *req) {
struct process *handler;
struct fs_wait_response res = {0};
int len = 0;
@@ -123,7 +123,7 @@ int vfs_backend_user_accept(struct vfs_request *req) {
handler->handled_req = req;
req->backend->user.handler = NULL;
regs_savereturn(&handler->regs, 0);
- return 0;
+ return;
fail:
panic_unimplemented(); // TODO
}