summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/request.h
diff options
context:
space:
mode:
authordzwdz2021-09-12 12:47:51 +0200
committerdzwdz2021-09-12 12:47:51 +0200
commite65d58357aaff7c1d05c06753538383478c1b0e9 (patch)
tree524acff4943892d62cfcd33a26fc83cace6aef83 /src/kernel/vfs/request.h
parent8fe035d7d75d09f314f9e8aefe1dcaf1e10d1954 (diff)
vfs request refactor pt1
Diffstat (limited to 'src/kernel/vfs/request.h')
-rw-r--r--src/kernel/vfs/request.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h
new file mode 100644
index 0000000..3021c6f
--- /dev/null
+++ b/src/kernel/vfs/request.h
@@ -0,0 +1,43 @@
+#pragma once
+
+enum vfs_backend_type {
+ VFS_BACK_ROOT,
+ VFS_BACK_USER,
+};
+
+// describes something which can act as an access function
+struct vfs_backend {
+ enum vfs_backend_type type;
+
+ // only used with VFS_BACK_USER
+ struct process *handler;
+ struct process *queue;
+};
+
+enum vfs_operation {
+ VFSOP_OPEN,
+ VFSOP_WRITE,
+};
+
+// describes an in-process vfs call
+struct vfs_request {
+ enum vfs_operation type;
+ union {
+ struct {
+ char *path;
+ int path_len;
+ } open;
+ struct {
+ char __user *buf;
+ int buf_len;
+ int id; // filled in by the kernel
+ } rw;
+ };
+
+ struct process *caller;
+ struct vfs_backend *backend;
+};
+
+_Noreturn void vfs_request_create(struct vfs_request);
+_Noreturn void vfs_request_pass2handler(struct vfs_request *);
+_Noreturn void vfs_request_finish(struct vfs_request *, int ret);