summaryrefslogtreecommitdiff
path: root/src/user/lib/include
diff options
context:
space:
mode:
authordzwdz2022-12-25 21:47:23 +0100
committerdzwdz2022-12-25 21:47:23 +0100
commitf6bc1ccf2462642383d1644321a101e62105c2a7 (patch)
tree98b78da8a9f155adaaffdb92235572c222c97371 /src/user/lib/include
parentfb6f520e0b65c08d0c01eee75e5216540786ac6b (diff)
user/lib: reorganize a few header files
Diffstat (limited to 'src/user/lib/include')
-rw-r--r--src/user/lib/include/camellia/compat.h6
-rw-r--r--src/user/lib/include/camellia/fs/dir.h17
-rw-r--r--src/user/lib/include/camellia/fs/misc.h23
3 files changed, 46 insertions, 0 deletions
diff --git a/src/user/lib/include/camellia/compat.h b/src/user/lib/include/camellia/compat.h
new file mode 100644
index 0000000..a7c6f1f
--- /dev/null
+++ b/src/user/lib/include/camellia/compat.h
@@ -0,0 +1,6 @@
+#pragma once
+#include <camellia/types.h>
+
+/* c0 - fs_wait returning a handle */
+long c0_fs_wait(char *buf, long len, struct ufs_request *res);
+long c0_fs_respond(void *buf, long ret, int flags);
diff --git a/src/user/lib/include/camellia/fs/dir.h b/src/user/lib/include/camellia/fs/dir.h
new file mode 100644
index 0000000..c3bbfe7
--- /dev/null
+++ b/src/user/lib/include/camellia/fs/dir.h
@@ -0,0 +1,17 @@
+#pragma once
+#include <camellia/types.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+struct dirbuild {
+ long offset;
+ char *buf;
+ long bpos, blen;
+ long error;
+};
+
+void dir_start(struct dirbuild *db, long offset, char *buf, size_t buflen);
+bool dir_append(struct dirbuild *db, const char *name);
+bool dir_appendl(struct dirbuild *db, const char *name, size_t len);
+bool dir_append_from(struct dirbuild *db, handle_t h);
+long dir_finish(struct dirbuild *db);
diff --git a/src/user/lib/include/camellia/fs/misc.h b/src/user/lib/include/camellia/fs/misc.h
new file mode 100644
index 0000000..35184e1
--- /dev/null
+++ b/src/user/lib/include/camellia/fs/misc.h
@@ -0,0 +1,23 @@
+#pragma once
+#include <stdbool.h>
+#include <stdlib.h>
+
+bool fork2_n_mount(const char *path);
+
+void forward_open(handle_t reqh, const char *path, long len, int flags);
+
+void fs_passthru(const char *prefix);
+void fs_whitelist(const char **list);
+void fs_union(const char **list);
+
+void fs_dir_inject(const char *path);
+
+bool mount_at_pred(const char *path);
+
+// TODO separate fs drivers and wrappers around syscalls
+
+/** like _syscall_fs_wait, but ensures *buf is a null terminated string on VFSOP_OPEN */
+handle_t ufs_wait(char *buf, size_t len, struct ufs_request *req);
+
+/** Mounts something and injects its path into the fs */
+#define MOUNT_AT(path) for (; mount_at_pred(path); exit(1))