diff options
Diffstat (limited to 'lib9p_util')
-rw-r--r-- | lib9p_util/include/util9p/static.h | 24 | ||||
-rw-r--r-- | lib9p_util/static.c | 32 |
2 files changed, 28 insertions, 28 deletions
diff --git a/lib9p_util/include/util9p/static.h b/lib9p_util/include/util9p/static.h index 0b391b8..5454c24 100644 --- a/lib9p_util/include/util9p/static.h +++ b/lib9p_util/include/util9p/static.h @@ -20,7 +20,7 @@ /* Common *********************************************************************/ -typedef struct { +struct _util9p_static_common { char *u_name; uint32_t u_num; char *g_name; @@ -32,7 +32,7 @@ typedef struct { char *name; lib9p_dm_t perm; uint32_t atime, mtime; -} _util9p_static_common; +}; #define UTIL9P_STATIC_COMMON(PATH, STRNAME, MODE) \ { \ @@ -50,7 +50,7 @@ typedef struct { /* Dir ************************************************************************/ struct util9p_static_dir { - _util9p_static_common; + struct _util9p_static_common c; /* NULL-terminated */ lo_interface lib9p_srv_file members[]; @@ -58,16 +58,16 @@ struct util9p_static_dir { LO_IMPLEMENTATION_H(lib9p_srv_file, struct util9p_static_dir, util9p_static_dir); #define lo_box_util9p_static_dir_as_lib9p_srv_file(obj) util9p_box(util9p_static_dir, obj) -#define UTIL9P_STATIC_DIR(PATH, STRNAME, ...) \ - lo_box_util9p_static_dir_as_lib9p_srv_file(&((struct util9p_static_dir){ \ - ._util9p_static_common = UTIL9P_STATIC_COMMON(PATH, STRNAME, 0555), \ - .members = { __VA_ARGS__ LO_NULL(lib9p_srv_file) }, \ +#define UTIL9P_STATIC_DIR(PATH, STRNAME, ...) \ + lo_box_util9p_static_dir_as_lib9p_srv_file(&((struct util9p_static_dir){ \ + .c = UTIL9P_STATIC_COMMON(PATH, STRNAME, 0555), \ + .members = { __VA_ARGS__ LO_NULL(lib9p_srv_file) }, \ })) /* File ***********************************************************************/ struct util9p_static_file { - _util9p_static_common; + struct _util9p_static_common c; char *data_start; /* must not be NULL */ char *data_end; /* may be NULL, in which case data_size is used */ @@ -76,10 +76,10 @@ struct util9p_static_file { LO_IMPLEMENTATION_H(lib9p_srv_file, struct util9p_static_file, util9p_static_file); #define lo_box_util9p_static_file_as_lib9p_srv_file(obj) util9p_box(util9p_static_file, obj) -#define UTIL9P_STATIC_FILE(PATH, STRNAME, ...) \ - lo_box_util9p_static_file_as_lib9p_srv_file(&((struct util9p_static_file){ \ - ._util9p_static_common = UTIL9P_STATIC_COMMON(PATH, STRNAME, 0444), \ - __VA_ARGS__ \ +#define UTIL9P_STATIC_FILE(PATH, STRNAME, ...) \ + lo_box_util9p_static_file_as_lib9p_srv_file(&((struct util9p_static_file){ \ + .c = UTIL9P_STATIC_COMMON(PATH, STRNAME, 0444), \ + __VA_ARGS__ \ })) #endif /* _UTIL9P_STATIC_H_ */ diff --git a/lib9p_util/static.c b/lib9p_util/static.c index 1726319..c35d28c 100644 --- a/lib9p_util/static.c +++ b/lib9p_util/static.c @@ -29,7 +29,7 @@ static struct lib9p_qid util9p_static_dir_qid(struct util9p_static_dir *self) { return (struct lib9p_qid){ .type = LIB9P_QT_DIR, .vers = 1, - .path = self->pathnum, + .path = self->c.pathnum, }; } @@ -39,14 +39,14 @@ static struct lib9p_srv_stat util9p_static_dir_stat(struct util9p_static_dir *se return (struct lib9p_srv_stat){ .qid = util9p_static_dir_qid(self), - .mode = LIB9P_DM_DIR | (self->perm & 0555), - .atime_sec = self->atime, - .mtime_sec = self->mtime, + .mode = LIB9P_DM_DIR | (self->c.perm & 0555), + .atime_sec = self->c.atime, + .mtime_sec = self->c.mtime, .size = 0, - .name = lib9p_str(self->name), - .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 }, + .name = lib9p_str(self->c.name), + .owner_uid = { .name = lib9p_str(self->c.u_name), .num = self->c.u_num }, + .owner_gid = { .name = lib9p_str(self->c.g_name), .num = self->c.g_num }, + .last_modifier_uid = { .name = lib9p_str(self->c.m_name), .num = self->c.m_num }, .extension = lib9p_str(NULL), }; } @@ -135,7 +135,7 @@ static struct lib9p_qid util9p_static_file_qid(struct util9p_static_file *self) return (struct lib9p_qid){ .type = LIB9P_QT_FILE, .vers = 1, - .path = self->pathnum, + .path = self->c.pathnum, }; } @@ -157,14 +157,14 @@ static struct lib9p_srv_stat util9p_static_file_stat(struct util9p_static_file * return (struct lib9p_srv_stat){ .qid = util9p_static_file_qid(self), - .mode = self->perm & 0444, - .atime_sec = self->atime, - .mtime_sec = self->mtime, + .mode = self->c.perm & 0444, + .atime_sec = self->c.atime, + .mtime_sec = self->c.mtime, .size = (uint64_t)util9p_static_file_size(self), - .name = lib9p_str(self->name), - .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 }, + .name = lib9p_str(self->c.name), + .owner_uid = { .name = lib9p_str(self->c.u_name), .num = self->c.u_num }, + .owner_gid = { .name = lib9p_str(self->c.g_name), .num = self->c.g_num }, + .last_modifier_uid = { .name = lib9p_str(self->c.m_name), .num = self->c.m_num }, .extension = lib9p_str(NULL), }; } |