diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-08 12:01:03 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-08 12:01:03 -0600 |
commit | a7a64e15987ddbb7feae6cf2ff1aaaeb71dbed82 (patch) | |
tree | cd96f2fe551984802824c75bacfe8ed1a8f58af1 /cmd | |
parent | 9c7f19c46d8fb58b6bcfe0d1d026c05657ffba96 (diff) |
wip
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, }; |