summaryrefslogtreecommitdiff
path: root/lib9p_util/include
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p_util/include')
-rw-r--r--lib9p_util/include/util9p/static.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib9p_util/include/util9p/static.h b/lib9p_util/include/util9p/static.h
new file mode 100644
index 0000000..9ec03ef
--- /dev/null
+++ b/lib9p_util/include/util9p/static.h
@@ -0,0 +1,47 @@
+/* util9p/static.h - Serve static files over 9P
+ *
+ * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+#ifndef _UTIL9P_STATIC_H_
+#define _UTIL9P_STATIC_H_
+
+#include <lib9p/srv.h>
+
+typedef struct {
+ implements_lib9p_srv_file;
+
+ char *u_name;
+ uint32_t u_num;
+ char *g_name;
+ uint32_t g_num;
+ char *m_name;
+ uint32_t m_num;
+
+ uint64_t pathnum;
+ char *name;
+ lib9p_dm_t perm;
+ uint32_t atime, mtime;
+} _util9p_static_common;
+
+struct util9p_static_dir {
+ _util9p_static_common;
+
+ /* NULL-terminated */
+ implements_lib9p_srv_file *members[];
+};
+
+
+struct util9p_static_file {
+ _util9p_static_common;
+
+ char *data_start; /* must not be NULL */
+ char *data_end; /* may be NULL, in which case data_size is used */
+ size_t data_size; /* only used if .data_end==NULL */
+};
+
+extern struct lib9p_srv_file_vtable util9p_static_dir_vtable;
+extern struct lib9p_srv_file_vtable util9p_static_file_vtable;
+
+#endif /* _UTIL9P_STATIC_H_ */