From 9047f1e3f502658de12808015179ab3881a4b03f Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 11 May 2024 20:24:17 +0200 Subject: kernel: refactor handle management out of proc.c --- src/kernel/vfs/request.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/kernel/vfs/request.c') diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 21eecb8..0c763b3 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -59,7 +59,8 @@ void vfsreq_finish(VfsReq *req, char __user *stored, long ret, } else { /* delegating - moving a handle to the caller */ assert(handler); - h = proc_hid_take(handler, ret); + h = hs_take(handler->hs, ret); + // TODO!!! no null check h->readable = h->readable && OPEN_READABLE(req->flags); h->writeable = h->writeable && OPEN_WRITEABLE(req->flags); } @@ -67,7 +68,7 @@ void vfsreq_finish(VfsReq *req, char __user *stored, long ret, if (h) { // TODO write tests for caller getting killed while opening a file if (!req->caller) panic_unimplemented(); - ret = proc_handle_put(req->caller, h); + ret = hs_put(req->caller->hs, h); if (ret < 0) ret = -EMFILE; } else { ret = -1; @@ -148,7 +149,7 @@ static void vfs_backend_user_accept(VfsReq *req) { } Handle *h; - hid_t hid = proc_handle_init(handler, HANDLE_FS_REQ, &h); + hid_t hid = hs_hinit(handler->hs, HANDLE_FS_REQ, &h); if (hid < 0) panic_unimplemented(); h->req = req; proc_setstate(handler, PS_RUNNING); -- cgit v1.2.3