diff options
Diffstat (limited to 'lib9p_util/static.c')
-rw-r--r-- | lib9p_util/static.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/lib9p_util/static.c b/lib9p_util/static.c index d2413c6..1726319 100644 --- a/lib9p_util/static.c +++ b/lib9p_util/static.c @@ -33,30 +33,25 @@ static struct lib9p_qid util9p_static_dir_qid(struct util9p_static_dir *self) { }; } -static struct lib9p_stat util9p_static_dir_stat(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx) { +static struct lib9p_srv_stat util9p_static_dir_stat(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - return (struct lib9p_stat){ - .fstype = 0, - .fsdev = 0, + return (struct lib9p_srv_stat){ .qid = util9p_static_dir_qid(self), .mode = LIB9P_DM_DIR | (self->perm & 0555), - .atime = self->atime, - .mtime = self->mtime, - .length = 0, + .atime_sec = self->atime, + .mtime_sec = self->mtime, + .size = 0, .name = lib9p_str(self->name), - .owner_uname = lib9p_str(self->u_name), - .owner_unum = self->u_num, - .owner_gname = lib9p_str(self->g_name), - .owner_gnum = self->g_num, - .last_modifier_uname = lib9p_str(self->m_name), - .last_modifier_unum = self->m_num, + .owner_uid = { .name = lib9p_str(self->u_name), .num = self->u_num }, + .owner_gid = { .name = lib9p_str(self->g_name), .num = self->g_num }, + .last_modifier_uid = { .name = lib9p_str(self->m_name), .num = self->m_num }, .extension = lib9p_str(NULL), }; } static void util9p_static_dir_wstat(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx, - struct lib9p_stat) { + struct lib9p_srv_stat) { assert(self); assert(ctx); @@ -76,10 +71,10 @@ static lo_interface lib9p_srv_file util9p_static_dir_dwalk(struct util9p_static_ for (size_t i = 0; !LO_IS_NULL(self->members[i]); i++) { lo_interface lib9p_srv_file file = self->members[i]; - struct lib9p_stat stat = LO_CALL(file, stat, ctx); + struct lib9p_srv_stat stat = LO_CALL(file, stat, ctx); if (lib9p_ctx_has_error(&ctx->basectx)) break; - lib9p_stat_assert(stat); + lib9p_srv_stat_assert(stat); if (lib9p_str_eq(stat.name, childname)) return file; } @@ -118,10 +113,10 @@ static struct lib9p_srv_dirent util9p_static_dir_dread(struct util9p_static_dir if (LO_IS_NULL(file)) return (struct lib9p_srv_dirent){}; - struct lib9p_stat stat = LO_CALL(file, stat, ctx); + struct lib9p_srv_stat stat = LO_CALL(file, stat, ctx); if (lib9p_ctx_has_error(&ctx->basectx)) return (struct lib9p_srv_dirent){}; - lib9p_stat_assert(stat); + lib9p_srv_stat_assert(stat); return (struct lib9p_srv_dirent){ .qid = stat.qid, @@ -156,30 +151,25 @@ static inline size_t util9p_static_file_size(struct util9p_static_file *file) { } -static struct lib9p_stat util9p_static_file_stat(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx) { +static struct lib9p_srv_stat util9p_static_file_stat(struct util9p_static_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 = util9p_static_file_qid(self), .mode = self->perm & 0444, - .atime = self->atime, - .mtime = self->mtime, - .length = (uint64_t)util9p_static_file_size(self), + .atime_sec = self->atime, + .mtime_sec = self->mtime, + .size = (uint64_t)util9p_static_file_size(self), .name = lib9p_str(self->name), - .owner_uname = lib9p_str(self->u_name), - .owner_unum = self->u_num, - .owner_gname = lib9p_str(self->g_name), - .owner_gnum = self->g_num, - .last_modifier_uname = lib9p_str(self->m_name), - .last_modifier_unum = self->m_num, + .owner_uid = { .name = lib9p_str(self->u_name), .num = self->u_num }, + .owner_gid = { .name = lib9p_str(self->g_name), .num = self->g_num }, + .last_modifier_uid = { .name = lib9p_str(self->m_name), .num = self->m_num }, .extension = lib9p_str(NULL), }; } static void util9p_static_file_wstat(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx, - struct lib9p_stat) { + struct lib9p_srv_stat) { assert(self); assert(ctx); |