From 468ef8f1d57527af3fe8b67bbc73813e951a0ec5 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 17 Aug 2024 01:57:04 +0200 Subject: kernel: split the kernel/user inputs in VfsReq I think I've done this refactor in the opposite direction a few years ago. This is mostly meant to prepare me for setxattr, which requires two inputs - coincidentally, one is already going to be a kernel input, and the other will be an user input, so it works out. I also just didn't like the previous way it worked, this feels cleaner. --- src/kernel/vfs/procfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/kernel/vfs/procfs.c') diff --git a/src/kernel/vfs/procfs.c b/src/kernel/vfs/procfs.c index ab57628..b0ebbe0 100644 --- a/src/kernel/vfs/procfs.c +++ b/src/kernel/vfs/procfs.c @@ -99,8 +99,8 @@ procfs_accept(VfsReq *req) assert(root->pns == root); if (req->type == VFSOP_OPEN) { - assert(req->input.kern); - h = openpath(req->input.buf_kern, req->input.len, root); + assert(req->kin); + h = openpath(req->kin, req->kinlen, root); vfsreq_finish_short(req, h ? (long)h : -ENOENT); return; } else if (req->type == VFSOP_CLOSE) { @@ -143,16 +143,16 @@ procfs_accept(VfsReq *req) return; } size_t res = pcpy_bi( - req->caller, req->output.buf, + req->caller, req->out, p, (__user void*)req->offset, - req->output.len + req->outlen ); vfsreq_finish_short(req, res); } else if (req->type == VFSOP_WRITE && (h->type == PhIntr || h->type == PhIntrDown)) { - size_t len = min(sizeof buf, req->input.len); - len = pcpy_from(req->caller, buf, req->input.buf, len); + size_t len = min(sizeof buf, req->uinlen); + len = pcpy_from(req->caller, buf, req->uin, len); if (h->type == PhIntr) { proc_intr(p, buf, len); } else { @@ -160,7 +160,7 @@ procfs_accept(VfsReq *req) proc_intr(it, buf, len); } } - vfsreq_finish_short(req, req->input.len); + vfsreq_finish_short(req, req->uinlen); } else { vfsreq_finish_short(req, -ENOSYS); } -- cgit v1.2.3