summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/request.h
diff options
context:
space:
mode:
authordzwdz2024-08-17 01:57:04 +0200
committerdzwdz2024-08-17 01:57:04 +0200
commit468ef8f1d57527af3fe8b67bbc73813e951a0ec5 (patch)
tree0e10641f6bc7548bdb0dbd77cd5c4737977a197b /src/kernel/vfs/request.h
parent806eecd7a2fe12daccf2c7c7171ce52e3fd93799 (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/vfs/request.h')
-rw-r--r--src/kernel/vfs/request.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h
index d6facfd..484fdd7 100644
--- a/src/kernel/vfs/request.h
+++ b/src/kernel/vfs/request.h
@@ -37,20 +37,22 @@ struct VfsBackend {
/* describes an in-progress vfs call */
struct VfsReq {
enum vfs_op type;
- struct {
- bool kern; // if false: use .buf ; if true: use .buf_kern
- union {
- char __user *buf;
- char *buf_kern;
- };
- size_t len;
- } input;
- struct {
- char __user *buf;
- size_t len;
- } output;
-
- void __user *id, *id2; // handle.file.id
+
+ /* "kernel" input - an allocation owned by this struct, contains a NUL
+ * terminated string. the NUL isn't counted in the kinlen (for compat
+ * with old code). used for the path in open() */
+ char *kin;
+ size_t kinlen;
+
+ /* user inputs and outputs - just point to some buffer in the caller */
+ char __user *uin;
+ size_t uinlen;
+ char __user *out;
+ size_t outlen;
+
+ /* those correspond to handle.file.id
+ * id2 is used for duplex() */
+ void __user *id, *id2;
long offset;
int flags;