From a7a64e15987ddbb7feae6cf2ff1aaaeb71dbed82 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 8 Oct 2024 12:01:03 -0600 Subject: wip --- cmd/srv9p/static.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'cmd') diff --git a/cmd/srv9p/static.c b/cmd/srv9p/static.c index 920daf2..e89c478 100644 --- a/cmd/srv9p/static.c +++ b/cmd/srv9p/static.c @@ -3,6 +3,26 @@ #include "static.h" #define UNUSED(name) /* name __attribute__((unused)) */ +#define p9_str(cstr) ((struct lib9p_s){ .len = strlen(cstr), .utf8 = cstr }) +#define p9_nulstr ((struct lib9p_s){ .len = 0, .utf8 = NULL }) + +/******************************************************************************/ + +static struct lib9p_srv_file *static_dir_clone(struct lib9p_srv_ctx *ctx, struct lib9p_srv_file *_file) { + assert(ctx); + struct static_dir *file = (struct static_dir *)_file; + assert(file); + + return &file->header; +} + +static void static_dir_free(struct lib9p_srv_ctx *ctx, struct lib9p_srv_file *_file) { + assert(ctx); + struct static_dir *file = (struct static_dir *)_file; + assert(file); + + /* do nothing */ +} static struct lib9p_srv_io *static_dir_io(struct lib9p_srv_ctx *ctx, struct lib9p_srv_file *_file, lib9p_o_t UNUSED(flags)) { assert(ctx); @@ -13,9 +33,6 @@ static struct lib9p_srv_io *static_dir_io(struct lib9p_srv_ctx *ctx, struct lib9 return NULL; } -#define p9_str(cstr) ((struct lib9p_s){ .len = strlen(cstr), .utf8 = cstr }) -#define p9_nulstr ((struct lib9p_s){ .len = 0, .utf8 = NULL }) - static struct lib9p_stat static_dir_stat(struct lib9p_srv_ctx *ctx, struct lib9p_srv_file *_file) { assert(ctx); struct static_dir *file = (struct static_dir *)_file; @@ -61,11 +78,6 @@ static void static_dir_remove(struct lib9p_srv_ctx *ctx, struct lib9p_srv_file * lib9p_error(&ctx->basectx, LINUX_EROFS, "read-only part of filesystem"); } -static void static_dir_free(struct lib9p_srv_ctx *ctx, struct lib9p_srv_file *_file) { - assert(ctx); - struct static_dir *file = (struct static_dir *)_file; - assert(file); -} static struct lib9p_srv_file *static_dir_dopen(struct lib9p_srv_ctx *ctx, struct lib9p_srv_file *_dir, char *UNUSED(childname)) { @@ -89,11 +101,14 @@ static struct lib9p_srv_file *static_dir_dcreate(struct lib9p_srv_ctx *ctx, stru } struct lib9p_srv_file_vtable static_dir_vtable = { + .clone = static_dir_clone, + .free = static_dir_free, + .io = static_dir_io, .stat = static_dir_stat, .wstat = static_dir_wstat, .remove = static_dir_remove, - .free = static_dir_free, + .dopen = static_dir_dopen, .dcreate = static_dir_dcreate, }; -- cgit v1.2.3-2-g168b