diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/srv9p/static.c | 33 |
1 files changed, 24 insertions, 9 deletions
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, }; |