summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordzwdz2024-02-23 22:06:12 +0100
committerdzwdz2024-02-23 22:06:12 +0100
commit8db20f6329a1417ef3f636ba82681a5764a757ab (patch)
tree8fe20f813abb74908a8148dcff1dbb0b7d77a1b0
parentdf889665b915d432e0205fad9cd8ccba609661c1 (diff)
kernel: knock off some simple vfsreq TODOs
-rw-r--r--src/kernel/syscalls.c5
-rw-r--r--src/kernel/vfs/request.c3
2 files changed, 4 insertions, 4 deletions
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) {