diff options
Diffstat (limited to 'cmd/srv9p/main.c')
-rw-r--r-- | cmd/srv9p/main.c | 30 |
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++) |