summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/request.h
blob: 3021c6f011c7982c872895d4ab4cd07c877be103 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);