summaryrefslogtreecommitdiff
path: root/cmd/srv9p/main.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-07 16:47:42 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-07 16:47:42 -0600
commitb1b07aea8841d78e935e7de13d693a267709e711 (patch)
treea189167728221e0eb0e4c5dc96ea250e013691e7 /cmd/srv9p/main.c
parent28486154a1b3763992548bc085070f3f09e4bf09 (diff)
wip
Diffstat (limited to 'cmd/srv9p/main.c')
-rw-r--r--cmd/srv9p/main.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/cmd/srv9p/main.c b/cmd/srv9p/main.c
index 2c403df..f62617d 100644
--- a/cmd/srv9p/main.c
+++ b/cmd/srv9p/main.c
@@ -5,16 +5,44 @@
#include <libnetio/netio.h>
#include <lib9p/srv.h>
+#include "static.h"
+
#define USE_CONFIG_COROUTINE
#include "config.h"
+#define UNUSED(name) /* name __attribute__((unused)) */
+
+static struct static_dir_data root = {
+ .u_name = "root", .u_num = 0, /* owner user */
+ .g_name = "root", .g_num = 0, /* owner group */
+ .m_name = "root", .m_num = 0, /* last-modified-by user */
+
+ .pathnum = __COUNTER__,
+ .name = "",
+ .perm = 0555,
+ .atime = 1728337904,
+ .mtime = 1728337904,
+
+ .members = {
+ NULL,
+ },
+};
+
+struct lib9p_srv_file fs_root(struct lib9p_srv_ctx *UNUSED(ctx), char *UNUSED(treename)) {
+ return (struct lib9p_srv_file){
+ .vtable = static_dir_vtable,
+ .impldata = &root,
+ };
+}
+
int main() {
int sock = netio_listen(9000);
if (sock < 0)
error(1, -sock, "netio_listen");
struct lib9p_srv srv = {
- .sockfd = sock,
+ .sockfd = sock,
+ .rootdir = fs_root,
};
for (int i = 0; i < CONFIG_NETIO_NUM_CONNS; i++)