summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/request.c
diff options
context:
space:
mode:
authordzwdz2022-05-01 20:09:52 +0200
committerdzwdz2022-05-01 20:09:52 +0200
commitd996f88bfda890df5d2b76e7c06cae329e04ab00 (patch)
treeeebe7b88bc48960a78648001adf38b5c66ffcfe3 /src/kernel/vfs/request.c
parent7c62817193517f298bc566f3803c00d53a9a2b94 (diff)
kernel/proc: make handles separate refcounted objects
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r--src/kernel/vfs/request.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index b3769cf..5ee1678 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -75,16 +75,14 @@ int vfs_request_finish(struct vfs_request *req, int ret) {
// open() calls need special handling
// we need to wrap the id returned by the VFS in a handle passed to
// the client
- handle_t handle = process_find_handle(req->caller);
+ handle_t handle = process_find_handle(req->caller, 0);
if (handle < 0)
panic_invalid_state(); // we check for free handles before the open() call
- req->caller->handles[handle] = (struct handle){
- .type = HANDLE_FILE,
- .file = {
- .backend = req->backend,
- .id = ret,
- },
- };
+
+ struct handle *backing = handle_init(HANDLE_FILE);
+ backing->file.backend = req->backend;
+ backing->file.id = ret;
+ req->caller->handles[handle] = backing;
ret = handle;
}