From e65d58357aaff7c1d05c06753538383478c1b0e9 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 12 Sep 2021 12:47:51 +0200 Subject: vfs request refactor pt1 --- src/kernel/vfs/request.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/kernel/vfs/request.h (limited to 'src/kernel/vfs/request.h') 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); -- cgit v1.2.3