From 8db20f6329a1417ef3f636ba82681a5764a757ab Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 23 Feb 2024 22:06:12 +0100 Subject: kernel: knock off some simple vfsreq TODOs --- src/kernel/syscalls.c | 5 ++--- src/kernel/vfs/request.c | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index de53062..5cec6c4 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -279,9 +279,8 @@ long _sys_fs_respond(hid_t hid, const void __user *buf, long ret, int flags) { VfsReq *req = h->req; if (req) { if (ret > 0 && req->type == VFSOP_READ) { - // if this vfsop outputs data and ret is positive, it's the length of the buffer - // TODO document - // TODO move to vfsreq_finish + /* vfsreq_finish can't copy this data, as it doesn't know where the + * buf argument came from */ ret = min(ret, capped_cast32(req->output.len)); ret = pcpy_bi( req->caller, req->output.buf, diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 5723201..3a42c2a 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -60,7 +60,8 @@ void vfsreq_finish(VfsReq *req, char __user *stored, long ret, /* delegating - moving a handle to the caller */ assert(handler); h = proc_hid_take(handler, ret); - // TODO don't ignore OPEN_RO + h->readable = h->readable && OPEN_READABLE(req->flags); + h->writeable = h->writeable && OPEN_WRITEABLE(req->flags); } if (h) { -- cgit v1.2.3