diff options
Diffstat (limited to 'lib9p/tests/test_server/main.c')
-rw-r--r-- | lib9p/tests/test_server/main.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c index 71c6cc2..07fc74b 100644 --- a/lib9p/tests/test_server/main.c +++ b/lib9p/tests/test_server/main.c @@ -47,23 +47,30 @@ struct api_file { uint64_t pathnum; }; -static implements_lib9p_srv_file *api_clone(implements_lib9p_srv_file *self, struct lib9p_srv_ctx *) { return self; } -static void api_free(implements_lib9p_srv_file *, struct lib9p_srv_ctx *) {} +static void api_free(implements_lib9p_srv_file *) {} +static uint32_t api_chio(implements_lib9p_srv_file *, struct lib9p_srv_ctx *, bool, bool, bool) { return 0; } -static uint32_t api_io(implements_lib9p_srv_file *, struct lib9p_srv_ctx *, lib9p_o_t) { return 0; } static void api_wstat(implements_lib9p_srv_file *, struct lib9p_srv_ctx *ctx, struct lib9p_stat) { lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot wstat API file"); } static void api_remove(implements_lib9p_srv_file *, struct lib9p_srv_ctx *ctx) { lib9p_error(&ctx->basectx, LINUX_EROFS, "cannot remove API file"); } +static struct lib9p_qid api_qid(implements_lib9p_srv_file *_self) { + struct api_file *self = VCALL_SELF(struct api_file, implements_lib9p_srv_file, _self); + assert(self); + + return (struct lib9p_qid){ + .type = LIB9P_QT_FILE, + .vers = 1, + .path = self->pathnum, + }; +} static struct lib9p_stat api_stat(implements_lib9p_srv_file *_self, struct lib9p_srv_ctx *) { struct api_file *self = VCALL_SELF(struct api_file, implements_lib9p_srv_file, _self); + assert(self); + return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = { - .type = LIB9P_QT_FILE, - .vers = 1, - .path = self->pathnum, - }, + .kern_type = 0, + .kern_dev = 0, + .file_qid = api_qid(self), .file_mode = 0222, .file_atime = 1728337905, .file_mtime = 1728337904, @@ -87,10 +94,10 @@ static uint32_t api_pwrite(implements_lib9p_srv_file *, struct lib9p_srv_ctx *, } static struct lib9p_srv_file_vtable api_file_vtable = { - .clone = api_clone, .free = api_free, + .qid = api_qid, + .chio = api_chio, - .io = api_io, .stat = api_stat, .wstat = api_wstat, .remove = api_remove, |