diff options
author | dzwdz | 2022-08-12 00:30:14 +0200 |
---|---|---|
committer | dzwdz | 2022-08-12 00:30:14 +0200 |
commit | 215aa95c8d8c85985c1dcc5a994ad164823b39e6 (patch) | |
tree | a8346262dea6d5d32b552c8ccf407256d370e086 /src/kernel/vfs/request.c | |
parent | d170ceb6c9f26f222558012ccbb75614ec2a6b8f (diff) |
vfs: OPEN_RO flag, read-only whitelist entries
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r-- | src/kernel/vfs/request.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 82f4731..f4db0db 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -1,5 +1,5 @@ #include <camellia/errno.h> -#include <kernel/arch/amd64/driver/fsroot.h> +#include <camellia/flags.h> #include <kernel/mem/alloc.h> #include <kernel/mem/virt.h> #include <kernel/panic.h> @@ -19,9 +19,10 @@ void vfsreq_create(struct vfs_request req_) { req = kmalloc(sizeof *req); } memcpy(req, &req_, sizeof *req); + if (req->backend) req->backend->refcount++; - if (req->backend) - req->backend->refcount++; + if (req->type == VFSOP_OPEN && (req->flags & OPEN_RO)) + req->flags &= ~OPEN_CREATE; if (req->backend && req->backend->potential_handlers) { struct vfs_request **iter = &req->backend->queue; @@ -51,6 +52,7 @@ void vfsreq_finish(struct vfs_request *req, char __user *stored, long ret, backing->backend = req->backend; req->backend->refcount++; backing->file_id = stored; + backing->ro = req->flags & OPEN_RO; req->caller->handles[handle] = backing; } else { /* delegating - moving a handle to the caller */ |