summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/request.c
diff options
context:
space:
mode:
authordzwdz2022-07-08 14:40:44 +0200
committerdzwdz2022-07-08 14:40:44 +0200
commit1f7e7501660123ff8f26e8c65e75c2b282b933ef (patch)
tree5ba6cee10ac656b20dcabc9c9f7b079dcd952a45 /src/kernel/vfs/request.c
parente567ebeee5ea196128f15adcf30cec5dd1137f90 (diff)
syscall/fs_respond: get the file id from the buf argument
Previously, file ids could only be positive integers, so their range was 31 bits - not enough to represent the entire memory. Now, pointers can be safely used as file ids.
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r--src/kernel/vfs/request.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index dfbd5cd..7c677cc 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -29,7 +29,9 @@ void vfsreq_create(struct vfs_request req_) {
vfs_backend_tryaccept(req->backend);
}
-void vfsreq_finish(struct vfs_request *req, int ret, int flags, struct process *handler) {
+void vfsreq_finish(struct vfs_request *req, char __user *stored, int ret,
+ int flags, struct process *handler)
+{
if (req->type == VFSOP_OPEN && ret >= 0) {
// TODO write tests for caller getting killed while opening a file
if (!req->caller) panic_unimplemented();
@@ -43,8 +45,7 @@ void vfsreq_finish(struct vfs_request *req, int ret, int flags, struct process *
struct handle *backing = handle_init(HANDLE_FILE);
backing->backend = req->backend;
req->backend->refcount++;
- // TODO file ids can only be 31bit long, so they can't be pointers
- backing->file_id = ret;
+ backing->file_id = stored;
req->caller->handles[handle] = backing;
} else {
/* delegating - moving a handle to the caller */