From 3ae25b0b620ba0f71e5c91f0c28873be1ba68497 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 17 Apr 2025 02:49:53 -0600 Subject: lib9p_srv: Rename ->authinfo->{uname,uid} to ->userid->{name,num} --- lib9p/tests/test_server/fs_whoami.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib9p/tests/test_server/fs_whoami.c') diff --git a/lib9p/tests/test_server/fs_whoami.c b/lib9p/tests/test_server/fs_whoami.c index 653ac4b..b81e6c8 100644 --- a/lib9p/tests/test_server/fs_whoami.c +++ b/lib9p/tests/test_server/fs_whoami.c @@ -23,10 +23,10 @@ LO_IMPLEMENTATION_C(lib9p_srv_fio, struct whoami_fio, whoami_fio, static); size_t whoami_len(struct lib9p_srv_ctx *ctx) { assert(ctx); - assert(ctx->authinfo); + assert(ctx->user); size_t len = 0; - uint32_t uid = ctx->authinfo->uid; + uint32_t uid = ctx->user->num; while (uid) { len++; uid /= 10; @@ -34,7 +34,7 @@ size_t whoami_len(struct lib9p_srv_ctx *ctx) { if (!len) len++; len += 2; - len += ctx->authinfo->uname.len; + len += ctx->user->name.len; return len; } @@ -138,7 +138,7 @@ static void whoami_fio_pread(struct whoami_fio *self, struct lib9p_srv_ctx *ctx, self->buf_len = data_size+1; } snprintf(self->buf, self->buf_len, "%"PRIu32" %.*s\n", - ctx->authinfo->uid, ctx->authinfo->uname.len, ctx->authinfo->uname.utf8); + ctx->user->num, ctx->user->name.len, ctx->user->name.utf8); if (byte_offset > (uint64_t)data_size) { lib9p_error(&ctx->basectx, -- cgit v1.2.3-2-g168b From b85e0bd570de1245afa2738057925320789601c5 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 19 Apr 2025 09:14:20 -0600 Subject: lib9p_idl: Clean up struct stat and numeric user IDs --- lib9p/tests/test_server/fs_whoami.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'lib9p/tests/test_server/fs_whoami.c') diff --git a/lib9p/tests/test_server/fs_whoami.c b/lib9p/tests/test_server/fs_whoami.c index b81e6c8..c493000 100644 --- a/lib9p/tests/test_server/fs_whoami.c +++ b/lib9p/tests/test_server/fs_whoami.c @@ -57,21 +57,21 @@ static struct lib9p_stat whoami_file_stat(struct whoami_file *self, struct lib9p assert(ctx); return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = whoami_file_qid(self), - .file_mode = 0444, - .file_atime = UTIL9P_ATIME, - .file_mtime = UTIL9P_MTIME, - .file_size = whoami_len(ctx), - .file_name = lib9p_str(self->name), - .file_owner_uid = lib9p_str("root"), - .file_owner_gid = lib9p_str("root"), - .file_last_modified_uid = lib9p_str("root"), - .file_extension = lib9p_str(NULL), - .file_owner_n_uid = 0, - .file_owner_n_gid = 0, - .file_last_modified_n_uid = 0, + .fstype = 0, + .fsdev = 0, + .qid = whoami_file_qid(self), + .mode = 0444, + .atime = UTIL9P_ATIME, + .mtime = UTIL9P_MTIME, + .length = whoami_len(ctx), + .name = lib9p_str(self->name), + .owner_uname = lib9p_str("root"), + .owner_unum = 0, + .owner_gname = lib9p_str("root"), + .owner_gnum = 0, + .last_modifier_uname = lib9p_str("root"), + .last_modifier_unum = 0, + .extension = lib9p_str(NULL), }; } static void whoami_file_wstat(struct whoami_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) { -- cgit v1.2.3-2-g168b From 09cac1d04e106b70ad4afde3b24df6d294d191b1 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 19 Apr 2025 09:14:20 -0600 Subject: lib9p_srv: Separate the stat API from the network format --- lib9p/tests/test_server/fs_whoami.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'lib9p/tests/test_server/fs_whoami.c') diff --git a/lib9p/tests/test_server/fs_whoami.c b/lib9p/tests/test_server/fs_whoami.c index c493000..8d9752a 100644 --- a/lib9p/tests/test_server/fs_whoami.c +++ b/lib9p/tests/test_server/fs_whoami.c @@ -52,29 +52,24 @@ static struct lib9p_qid whoami_file_qid(struct whoami_file *self) { }; } -static struct lib9p_stat whoami_file_stat(struct whoami_file *self, struct lib9p_srv_ctx *ctx) { +static struct lib9p_srv_stat whoami_file_stat(struct whoami_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - return (struct lib9p_stat){ - .fstype = 0, - .fsdev = 0, + return (struct lib9p_srv_stat){ .qid = whoami_file_qid(self), .mode = 0444, - .atime = UTIL9P_ATIME, - .mtime = UTIL9P_MTIME, - .length = whoami_len(ctx), + .atime_sec = UTIL9P_ATIME, + .mtime_sec = UTIL9P_MTIME, + .size = whoami_len(ctx), .name = lib9p_str(self->name), - .owner_uname = lib9p_str("root"), - .owner_unum = 0, - .owner_gname = lib9p_str("root"), - .owner_gnum = 0, - .last_modifier_uname = lib9p_str("root"), - .last_modifier_unum = 0, + .owner_uid = { .name=lib9p_str("root"), .num=0 }, + .owner_gid = { .name=lib9p_str("root"), .num=0 }, + .last_modifier_uid = { .name=lib9p_str("root"), .num=0 }, .extension = lib9p_str(NULL), }; } -static void whoami_file_wstat(struct whoami_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) { +static void whoami_file_wstat(struct whoami_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { assert(self); assert(ctx); lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file"); -- cgit v1.2.3-2-g168b