diff options
author | dzwdz | 2024-08-17 01:57:04 +0200 |
---|---|---|
committer | dzwdz | 2024-08-17 01:57:04 +0200 |
commit | 468ef8f1d57527af3fe8b67bbc73813e951a0ec5 (patch) | |
tree | 0e10641f6bc7548bdb0dbd77cd5c4737977a197b /src/kernel/syscalls.c | |
parent | 806eecd7a2fe12daccf2c7c7171ce52e3fd93799 (diff) |
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.
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index a6c807c..0b22770 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -96,11 +96,8 @@ hid_t _sys_open(const char __user *path, long len, int flags) { vfsreq_dispatchcopy((VfsReq) { .type = VFSOP_OPEN, - .input = { - .kern = true, - .buf_kern = path_buf, - .len = len, - }, + .kin = path_buf, + .kinlen = len, .caller = proc_cur, .backend = mount->backend, .flags = flags, @@ -198,12 +195,12 @@ static long simple_vfsop( .flags = flags, }; if (vfsop == VFSOP_READ) { - req.output.buf = buf; - req.output.len = len; + req.out = buf; + req.outlen = len; } if (vfsop == VFSOP_WRITE) { - req.input.buf = buf; - req.input.len = len; + req.uin = buf; + req.uinlen = len; } vfsreq_dispatchcopy(req); } else if (h->type == HANDLE_PIPE) { @@ -295,12 +292,8 @@ long _sys_fs_respond(hid_t hid, const void __user *buf, long ret, int flags) { if (ret > 0 && req->type == VFSOP_READ) { /* 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, - proc_cur, buf, - ret - ); + ret = min(ret, capped_cast32(req->outlen)); + ret = pcpy_bi(req->caller, req->out, proc_cur, buf, ret); } vfsreq_finish(req, (void __user *)buf, ret, flags, proc_cur); } |