diff options
-rw-r--r-- | cmd/sbc_harness/fs_harness_flash_bin.c | 30 | ||||
-rw-r--r-- | cmd/sbc_harness/fs_harness_uptime_txt.c | 30 | ||||
-rw-r--r-- | lib9p/core_generated.c | 438 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/_core_generated.h | 34 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/core.h | 12 | ||||
-rw-r--r-- | lib9p/idl/2002-9P2000.9p | 32 | ||||
-rw-r--r-- | lib9p/idl/2005-9P2000.u.9p | 12 | ||||
-rw-r--r-- | lib9p/srv.c | 14 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_flush.c | 30 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_shutdown.c | 30 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_whoami.c | 30 | ||||
-rw-r--r-- | lib9p/tests/testclient-p9p.explog | 30 | ||||
-rw-r--r-- | lib9p/tests/testclient-sess.c | 4 | ||||
-rw-r--r-- | lib9p/tests/testclient-sess.explog | 10 | ||||
-rw-r--r-- | lib9p_util/static.c | 62 |
15 files changed, 403 insertions, 395 deletions
diff --git a/cmd/sbc_harness/fs_harness_flash_bin.c b/cmd/sbc_harness/fs_harness_flash_bin.c index bc3d061..fa4069f 100644 --- a/cmd/sbc_harness/fs_harness_flash_bin.c +++ b/cmd/sbc_harness/fs_harness_flash_bin.c @@ -153,21 +153,21 @@ static struct lib9p_stat flash_file_stat(struct flash_file *self, struct lib9p_s assert(ctx); return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = flash_file_qid(self), - .file_mode = LIB9P_DM_EXCL|0666, - .file_atime = UTIL9P_ATIME, - .file_mtime = UTIL9P_MTIME, - .file_size = DATA_SIZE, - .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 = flash_file_qid(self), + .mode = LIB9P_DM_EXCL|0666, + .atime = UTIL9P_ATIME, + .mtime = UTIL9P_MTIME, + .length = DATA_SIZE, + .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 flash_file_wstat(struct flash_file *self, struct lib9p_srv_ctx *ctx, diff --git a/cmd/sbc_harness/fs_harness_uptime_txt.c b/cmd/sbc_harness/fs_harness_uptime_txt.c index dd5c681..bfe1d98 100644 --- a/cmd/sbc_harness/fs_harness_uptime_txt.c +++ b/cmd/sbc_harness/fs_harness_uptime_txt.c @@ -53,21 +53,21 @@ static struct lib9p_stat uptime_file_stat(struct uptime_file *self, struct lib9p size += 3; return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = uptime_file_qid(self), - .file_mode = 0444, - .file_atime = UTIL9P_ATIME, - .file_mtime = UTIL9P_MTIME, - .file_size = size, - .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 = uptime_file_qid(self), + .mode = 0444, + .atime = UTIL9P_ATIME, + .mtime = UTIL9P_MTIME, + .length = size, + .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 uptime_file_wstat(struct uptime_file *self, struct lib9p_srv_ctx *ctx, diff --git a/lib9p/core_generated.c b/lib9p/core_generated.c index 1789bdc..393e8c0 100644 --- a/lib9p/core_generated.c +++ b/lib9p/core_generated.c @@ -352,14 +352,14 @@ static const lib9p_lock_flags_t lock_flags_masks[LIB9P_VER_NUM] = { static ssize_t validate_stat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, uint32_t *ret_net_size) { uint32_t net_offset = 0; ssize_t host_size = sizeof(struct lib9p_stat); - uint32_t offsetof_stat_size = net_offset + 0; - uint32_t offsetof_kern_type = net_offset + 2; - uint32_t offsetof_file_qid_type = net_offset + 8; + uint32_t offsetof__stat_size = net_offset + 0; + uint32_t offsetof_fstype = net_offset + 2; + uint32_t offsetof_qid_type = net_offset + 8; VALIDATE_NET_BYTES(21); - if (GET_U8LE(offsetof_file_qid_type) & ~qt_masks[ctx->version]) + if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8, - GET_U8LE(offsetof_file_qid_type) & ~qt_masks[ctx->version]); - uint32_t offsetof_file_mode = net_offset + 0; + GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]); + uint32_t offsetof_mode = net_offset + 0; VALIDATE_NET_BYTES(22); VALIDATE_NET_UTF8(LAST_U16LE()); VALIDATE_NET_BYTES(2); @@ -376,12 +376,12 @@ static ssize_t validate_stat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t * } #endif /* CONFIG_9P_ENABLE_9P2000_u */ uint32_t offsetof_end = net_offset + 0; - if ((uint32_t)GET_U32LE(offsetof_stat_size) != (uint32_t)(offsetof_end - offsetof_kern_type)) - return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "stat->stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, - (uint32_t)GET_U32LE(offsetof_stat_size), (uint32_t)(offsetof_end - offsetof_kern_type)); - if (GET_U32LE(offsetof_file_mode) & ~dm_masks[ctx->version]) + if ((uint32_t)GET_U32LE(offsetof__stat_size) != (uint32_t)(offsetof_end - offsetof_fstype)) + return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "stat->_stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, + (uint32_t)GET_U32LE(offsetof__stat_size), (uint32_t)(offsetof_end - offsetof_fstype)); + if (GET_U32LE(offsetof_mode) & ~dm_masks[ctx->version]) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32, - GET_U32LE(offsetof_file_mode) & ~dm_masks[ctx->version]); + GET_U32LE(offsetof_mode) & ~dm_masks[ctx->version]); if (ret_net_size) *ret_net_size = net_offset; return (ssize_t)host_size; @@ -893,14 +893,14 @@ static ssize_t validate_Rstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_typ = net_offset + 4; uint32_t offsetof_nstat = net_offset + 7; uint32_t offsetof_stat = net_offset + 9; - uint32_t offsetof_stat_stat_size = net_offset + 9; - uint32_t offsetof_stat_kern_type = net_offset + 11; - uint32_t offsetof_stat_file_qid_type = net_offset + 17; + uint32_t offsetof_stat__stat_size = net_offset + 9; + uint32_t offsetof_stat_fstype = net_offset + 11; + uint32_t offsetof_stat_qid_type = net_offset + 17; VALIDATE_NET_BYTES(30); - if (GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version]) + if (GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8, - GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version]); - uint32_t offsetof_stat_file_mode = net_offset + 0; + GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]); + uint32_t offsetof_stat_mode = net_offset + 0; VALIDATE_NET_BYTES(22); VALIDATE_NET_UTF8(LAST_U16LE()); VALIDATE_NET_BYTES(2); @@ -917,12 +917,12 @@ static ssize_t validate_Rstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t } #endif /* CONFIG_9P_ENABLE_9P2000_u */ uint32_t offsetof_stat_end = net_offset + 0; - if ((uint32_t)GET_U32LE(offsetof_stat_stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type)) - return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->stat.stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, - (uint32_t)GET_U32LE(offsetof_stat_stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type)); - if (GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version]) + if ((uint32_t)GET_U32LE(offsetof_stat__stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_fstype)) + return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->stat._stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, + (uint32_t)GET_U32LE(offsetof_stat__stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_fstype)); + if (GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32, - GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version]); + GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]); uint32_t offsetof_end = net_offset + 0; if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size)) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, @@ -943,14 +943,14 @@ static ssize_t validate_Twstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_typ = net_offset + 4; uint32_t offsetof_nstat = net_offset + 11; uint32_t offsetof_stat = net_offset + 13; - uint32_t offsetof_stat_stat_size = net_offset + 13; - uint32_t offsetof_stat_kern_type = net_offset + 15; - uint32_t offsetof_stat_file_qid_type = net_offset + 21; + uint32_t offsetof_stat__stat_size = net_offset + 13; + uint32_t offsetof_stat_fstype = net_offset + 15; + uint32_t offsetof_stat_qid_type = net_offset + 21; VALIDATE_NET_BYTES(34); - if (GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version]) + if (GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8, - GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version]); - uint32_t offsetof_stat_file_mode = net_offset + 0; + GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]); + uint32_t offsetof_stat_mode = net_offset + 0; VALIDATE_NET_BYTES(22); VALIDATE_NET_UTF8(LAST_U16LE()); VALIDATE_NET_BYTES(2); @@ -967,12 +967,12 @@ static ssize_t validate_Twstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t } #endif /* CONFIG_9P_ENABLE_9P2000_u */ uint32_t offsetof_stat_end = net_offset + 0; - if ((uint32_t)GET_U32LE(offsetof_stat_stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type)) - return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->stat.stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, - (uint32_t)GET_U32LE(offsetof_stat_stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type)); - if (GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version]) + if ((uint32_t)GET_U32LE(offsetof_stat__stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_fstype)) + return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->stat._stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, + (uint32_t)GET_U32LE(offsetof_stat__stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_fstype)); + if (GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32, - GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version]); + GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]); uint32_t offsetof_end = net_offset + 0; if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size)) return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32, @@ -1903,30 +1903,30 @@ static void unmarshal_stat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_b [[gnu::unused]] void *extra = &out[1]; uint32_t net_offset = 0; net_offset += 2; - UNMARSHAL_U16LE(ctx, out->kern_type); - UNMARSHAL_U32LE(ctx, out->kern_dev); - UNMARSHAL_U8LE(ctx, out->file_qid.type); - UNMARSHAL_U32LE(ctx, out->file_qid.vers); - UNMARSHAL_U64LE(ctx, out->file_qid.path); - UNMARSHAL_U32LE(ctx, out->file_mode); - UNMARSHAL_U32LE(ctx, out->file_atime); - UNMARSHAL_U32LE(ctx, out->file_mtime); - UNMARSHAL_U64LE(ctx, out->file_size); - UNMARSHAL_U16LE(ctx, out->file_name.len); - UNMARSHAL_BYTES(ctx, out->file_name.utf8, out->file_name.len); - UNMARSHAL_U16LE(ctx, out->file_owner_uid.len); - UNMARSHAL_BYTES(ctx, out->file_owner_uid.utf8, out->file_owner_uid.len); - UNMARSHAL_U16LE(ctx, out->file_owner_gid.len); - UNMARSHAL_BYTES(ctx, out->file_owner_gid.utf8, out->file_owner_gid.len); - UNMARSHAL_U16LE(ctx, out->file_last_modified_uid.len); - UNMARSHAL_BYTES(ctx, out->file_last_modified_uid.utf8, out->file_last_modified_uid.len); + UNMARSHAL_U16LE(ctx, out->fstype); + UNMARSHAL_U32LE(ctx, out->fsdev); + UNMARSHAL_U8LE(ctx, out->qid.type); + UNMARSHAL_U32LE(ctx, out->qid.vers); + UNMARSHAL_U64LE(ctx, out->qid.path); + UNMARSHAL_U32LE(ctx, out->mode); + UNMARSHAL_U32LE(ctx, out->atime); + UNMARSHAL_U32LE(ctx, out->mtime); + UNMARSHAL_U64LE(ctx, out->length); + UNMARSHAL_U16LE(ctx, out->name.len); + UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len); + UNMARSHAL_U16LE(ctx, out->owner_uname.len); + UNMARSHAL_BYTES(ctx, out->owner_uname.utf8, out->owner_uname.len); + UNMARSHAL_U16LE(ctx, out->owner_gname.len); + UNMARSHAL_BYTES(ctx, out->owner_gname.utf8, out->owner_gname.len); + UNMARSHAL_U16LE(ctx, out->last_modifier_uname.len); + UNMARSHAL_BYTES(ctx, out->last_modifier_uname.utf8, out->last_modifier_uname.len); #if CONFIG_9P_ENABLE_9P2000_u if (is_ver(ctx, 9P2000_u)) { - UNMARSHAL_U16LE(ctx, out->file_extension.len); - UNMARSHAL_BYTES(ctx, out->file_extension.utf8, out->file_extension.len); - UNMARSHAL_U32LE(ctx, out->file_owner_n_uid); - UNMARSHAL_U32LE(ctx, out->file_owner_n_gid); - UNMARSHAL_U32LE(ctx, out->file_last_modified_n_uid); + UNMARSHAL_U16LE(ctx, out->extension.len); + UNMARSHAL_BYTES(ctx, out->extension.utf8, out->extension.len); + UNMARSHAL_U32LE(ctx, out->owner_unum); + UNMARSHAL_U32LE(ctx, out->owner_gnum); + UNMARSHAL_U32LE(ctx, out->last_modifier_unum); } #endif /* CONFIG_9P_ENABLE_9P2000_u */ } @@ -1971,7 +1971,7 @@ static void unmarshal_Tauth([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_ UNMARSHAL_BYTES(ctx, out->aname.utf8, out->aname.len); #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) { - UNMARSHAL_U32LE(ctx, out->n_uid); + UNMARSHAL_U32LE(ctx, out->unum); } #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ } @@ -2003,7 +2003,7 @@ static void unmarshal_Tattach([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *ne UNMARSHAL_BYTES(ctx, out->aname.utf8, out->aname.len); #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) { - UNMARSHAL_U32LE(ctx, out->n_uid); + UNMARSHAL_U32LE(ctx, out->unum); } #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ } @@ -2254,30 +2254,30 @@ static void unmarshal_Rstat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_ UNMARSHAL_U16LE(ctx, out->tag); net_offset += 2; net_offset += 2; - UNMARSHAL_U16LE(ctx, out->stat.kern_type); - UNMARSHAL_U32LE(ctx, out->stat.kern_dev); - UNMARSHAL_U8LE(ctx, out->stat.file_qid.type); - UNMARSHAL_U32LE(ctx, out->stat.file_qid.vers); - UNMARSHAL_U64LE(ctx, out->stat.file_qid.path); - UNMARSHAL_U32LE(ctx, out->stat.file_mode); - UNMARSHAL_U32LE(ctx, out->stat.file_atime); - UNMARSHAL_U32LE(ctx, out->stat.file_mtime); - UNMARSHAL_U64LE(ctx, out->stat.file_size); - UNMARSHAL_U16LE(ctx, out->stat.file_name.len); - UNMARSHAL_BYTES(ctx, out->stat.file_name.utf8, out->stat.file_name.len); - UNMARSHAL_U16LE(ctx, out->stat.file_owner_uid.len); - UNMARSHAL_BYTES(ctx, out->stat.file_owner_uid.utf8, out->stat.file_owner_uid.len); - UNMARSHAL_U16LE(ctx, out->stat.file_owner_gid.len); - UNMARSHAL_BYTES(ctx, out->stat.file_owner_gid.utf8, out->stat.file_owner_gid.len); - UNMARSHAL_U16LE(ctx, out->stat.file_last_modified_uid.len); - UNMARSHAL_BYTES(ctx, out->stat.file_last_modified_uid.utf8, out->stat.file_last_modified_uid.len); + UNMARSHAL_U16LE(ctx, out->stat.fstype); + UNMARSHAL_U32LE(ctx, out->stat.fsdev); + UNMARSHAL_U8LE(ctx, out->stat.qid.type); + UNMARSHAL_U32LE(ctx, out->stat.qid.vers); + UNMARSHAL_U64LE(ctx, out->stat.qid.path); + UNMARSHAL_U32LE(ctx, out->stat.mode); + UNMARSHAL_U32LE(ctx, out->stat.atime); + UNMARSHAL_U32LE(ctx, out->stat.mtime); + UNMARSHAL_U64LE(ctx, out->stat.length); + UNMARSHAL_U16LE(ctx, out->stat.name.len); + UNMARSHAL_BYTES(ctx, out->stat.name.utf8, out->stat.name.len); + UNMARSHAL_U16LE(ctx, out->stat.owner_uname.len); + UNMARSHAL_BYTES(ctx, out->stat.owner_uname.utf8, out->stat.owner_uname.len); + UNMARSHAL_U16LE(ctx, out->stat.owner_gname.len); + UNMARSHAL_BYTES(ctx, out->stat.owner_gname.utf8, out->stat.owner_gname.len); + UNMARSHAL_U16LE(ctx, out->stat.last_modifier_uname.len); + UNMARSHAL_BYTES(ctx, out->stat.last_modifier_uname.utf8, out->stat.last_modifier_uname.len); #if CONFIG_9P_ENABLE_9P2000_u if (is_ver(ctx, 9P2000_u)) { - UNMARSHAL_U16LE(ctx, out->stat.file_extension.len); - UNMARSHAL_BYTES(ctx, out->stat.file_extension.utf8, out->stat.file_extension.len); - UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_uid); - UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_gid); - UNMARSHAL_U32LE(ctx, out->stat.file_last_modified_n_uid); + UNMARSHAL_U16LE(ctx, out->stat.extension.len); + UNMARSHAL_BYTES(ctx, out->stat.extension.utf8, out->stat.extension.len); + UNMARSHAL_U32LE(ctx, out->stat.owner_unum); + UNMARSHAL_U32LE(ctx, out->stat.owner_gnum); + UNMARSHAL_U32LE(ctx, out->stat.last_modifier_unum); } #endif /* CONFIG_9P_ENABLE_9P2000_u */ } @@ -2292,30 +2292,30 @@ static void unmarshal_Twstat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net UNMARSHAL_U32LE(ctx, out->fid); net_offset += 2; net_offset += 2; - UNMARSHAL_U16LE(ctx, out->stat.kern_type); - UNMARSHAL_U32LE(ctx, out->stat.kern_dev); - UNMARSHAL_U8LE(ctx, out->stat.file_qid.type); - UNMARSHAL_U32LE(ctx, out->stat.file_qid.vers); - UNMARSHAL_U64LE(ctx, out->stat.file_qid.path); - UNMARSHAL_U32LE(ctx, out->stat.file_mode); - UNMARSHAL_U32LE(ctx, out->stat.file_atime); - UNMARSHAL_U32LE(ctx, out->stat.file_mtime); - UNMARSHAL_U64LE(ctx, out->stat.file_size); - UNMARSHAL_U16LE(ctx, out->stat.file_name.len); - UNMARSHAL_BYTES(ctx, out->stat.file_name.utf8, out->stat.file_name.len); - UNMARSHAL_U16LE(ctx, out->stat.file_owner_uid.len); - UNMARSHAL_BYTES(ctx, out->stat.file_owner_uid.utf8, out->stat.file_owner_uid.len); - UNMARSHAL_U16LE(ctx, out->stat.file_owner_gid.len); - UNMARSHAL_BYTES(ctx, out->stat.file_owner_gid.utf8, out->stat.file_owner_gid.len); - UNMARSHAL_U16LE(ctx, out->stat.file_last_modified_uid.len); - UNMARSHAL_BYTES(ctx, out->stat.file_last_modified_uid.utf8, out->stat.file_last_modified_uid.len); + UNMARSHAL_U16LE(ctx, out->stat.fstype); + UNMARSHAL_U32LE(ctx, out->stat.fsdev); + UNMARSHAL_U8LE(ctx, out->stat.qid.type); + UNMARSHAL_U32LE(ctx, out->stat.qid.vers); + UNMARSHAL_U64LE(ctx, out->stat.qid.path); + UNMARSHAL_U32LE(ctx, out->stat.mode); + UNMARSHAL_U32LE(ctx, out->stat.atime); + UNMARSHAL_U32LE(ctx, out->stat.mtime); + UNMARSHAL_U64LE(ctx, out->stat.length); + UNMARSHAL_U16LE(ctx, out->stat.name.len); + UNMARSHAL_BYTES(ctx, out->stat.name.utf8, out->stat.name.len); + UNMARSHAL_U16LE(ctx, out->stat.owner_uname.len); + UNMARSHAL_BYTES(ctx, out->stat.owner_uname.utf8, out->stat.owner_uname.len); + UNMARSHAL_U16LE(ctx, out->stat.owner_gname.len); + UNMARSHAL_BYTES(ctx, out->stat.owner_gname.utf8, out->stat.owner_gname.len); + UNMARSHAL_U16LE(ctx, out->stat.last_modifier_uname.len); + UNMARSHAL_BYTES(ctx, out->stat.last_modifier_uname.utf8, out->stat.last_modifier_uname.len); #if CONFIG_9P_ENABLE_9P2000_u if (is_ver(ctx, 9P2000_u)) { - UNMARSHAL_U16LE(ctx, out->stat.file_extension.len); - UNMARSHAL_BYTES(ctx, out->stat.file_extension.utf8, out->stat.file_extension.len); - UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_uid); - UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_gid); - UNMARSHAL_U32LE(ctx, out->stat.file_last_modified_n_uid); + UNMARSHAL_U16LE(ctx, out->stat.extension.len); + UNMARSHAL_BYTES(ctx, out->stat.extension.utf8, out->stat.extension.len); + UNMARSHAL_U32LE(ctx, out->stat.owner_unum); + UNMARSHAL_U32LE(ctx, out->stat.owner_gnum); + UNMARSHAL_U32LE(ctx, out->stat.last_modifier_unum); } #endif /* CONFIG_9P_ENABLE_9P2000_u */ } @@ -2977,42 +2977,42 @@ static void unmarshal_Rswrite([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *ne #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static bool marshal_stat(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _marshal_ret *ret) { - uint32_t needed_size = 49 + val->file_name.len + val->file_owner_uid.len + val->file_owner_gid.len + val->file_last_modified_uid.len; + uint32_t needed_size = 49 + val->name.len + val->owner_uname.len + val->owner_gname.len + val->last_modifier_uname.len; #if CONFIG_9P_ENABLE_9P2000_u if is_ver(ctx, 9P2000_u) { - needed_size += 14 + val->file_extension.len; + needed_size += 14 + val->extension.len; } #endif /* CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { return true; } uint32_t offsetof_end = needed_size; - uint32_t offsetof_kern_type = 2; - MARSHAL_U16LE(ctx, offsetof_end - offsetof_kern_type); - MARSHAL_U16LE(ctx, val->kern_type); - MARSHAL_U32LE(ctx, val->kern_dev); - MARSHAL_U8LE(ctx, val->file_qid.type & qt_masks[ctx->version]); - MARSHAL_U32LE(ctx, val->file_qid.vers); - MARSHAL_U64LE(ctx, val->file_qid.path); - MARSHAL_U32LE(ctx, val->file_mode & dm_masks[ctx->version]); - MARSHAL_U32LE(ctx, val->file_atime); - MARSHAL_U32LE(ctx, val->file_mtime); - MARSHAL_U64LE(ctx, val->file_size); - MARSHAL_U16LE(ctx, val->file_name.len); - MARSHAL_BYTES(ctx, val->file_name.utf8, val->file_name.len); - MARSHAL_U16LE(ctx, val->file_owner_uid.len); - MARSHAL_BYTES(ctx, val->file_owner_uid.utf8, val->file_owner_uid.len); - MARSHAL_U16LE(ctx, val->file_owner_gid.len); - MARSHAL_BYTES(ctx, val->file_owner_gid.utf8, val->file_owner_gid.len); - MARSHAL_U16LE(ctx, val->file_last_modified_uid.len); - MARSHAL_BYTES(ctx, val->file_last_modified_uid.utf8, val->file_last_modified_uid.len); + uint32_t offsetof_fstype = 2; + MARSHAL_U16LE(ctx, offsetof_end - offsetof_fstype); + MARSHAL_U16LE(ctx, val->fstype); + MARSHAL_U32LE(ctx, val->fsdev); + MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]); + MARSHAL_U32LE(ctx, val->qid.vers); + MARSHAL_U64LE(ctx, val->qid.path); + MARSHAL_U32LE(ctx, val->mode & dm_masks[ctx->version]); + MARSHAL_U32LE(ctx, val->atime); + MARSHAL_U32LE(ctx, val->mtime); + MARSHAL_U64LE(ctx, val->length); + MARSHAL_U16LE(ctx, val->name.len); + MARSHAL_BYTES(ctx, val->name.utf8, val->name.len); + MARSHAL_U16LE(ctx, val->owner_uname.len); + MARSHAL_BYTES(ctx, val->owner_uname.utf8, val->owner_uname.len); + MARSHAL_U16LE(ctx, val->owner_gname.len); + MARSHAL_BYTES(ctx, val->owner_gname.utf8, val->owner_gname.len); + MARSHAL_U16LE(ctx, val->last_modifier_uname.len); + MARSHAL_BYTES(ctx, val->last_modifier_uname.utf8, val->last_modifier_uname.len); #if CONFIG_9P_ENABLE_9P2000_u if (is_ver(ctx, 9P2000_u)) { - MARSHAL_U16LE(ctx, val->file_extension.len); - MARSHAL_BYTES(ctx, val->file_extension.utf8, val->file_extension.len); - MARSHAL_U32LE(ctx, val->file_owner_n_uid); - MARSHAL_U32LE(ctx, val->file_owner_n_gid); - MARSHAL_U32LE(ctx, val->file_last_modified_n_uid); + MARSHAL_U16LE(ctx, val->extension.len); + MARSHAL_BYTES(ctx, val->extension.utf8, val->extension.len); + MARSHAL_U32LE(ctx, val->owner_unum); + MARSHAL_U32LE(ctx, val->owner_gnum); + MARSHAL_U32LE(ctx, val->last_modifier_unum); } #endif /* CONFIG_9P_ENABLE_9P2000_u */ return false; @@ -3086,7 +3086,7 @@ static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, st MARSHAL_BYTES_ZEROCOPY(ctx, val->aname.utf8, val->aname.len); #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) { - MARSHAL_U32LE(ctx, val->n_uid); + MARSHAL_U32LE(ctx, val->unum); } #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ return false; @@ -3139,7 +3139,7 @@ static bool marshal_Tattach(struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *val MARSHAL_BYTES_ZEROCOPY(ctx, val->aname.utf8, val->aname.len); #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) { - MARSHAL_U32LE(ctx, val->n_uid); + MARSHAL_U32LE(ctx, val->unum); } #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ return false; @@ -3539,10 +3539,10 @@ static bool marshal_Tstat(struct lib9p_ctx *ctx, struct lib9p_msg_Tstat *val, st } static bool marshal_Rstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *val, struct _marshal_ret *ret) { - uint32_t needed_size = 58 + val->stat.file_name.len + val->stat.file_owner_uid.len + val->stat.file_owner_gid.len + val->stat.file_last_modified_uid.len; + uint32_t needed_size = 58 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len; #if CONFIG_9P_ENABLE_9P2000_u if is_ver(ctx, 9P2000_u) { - needed_size += 14 + val->stat.file_extension.len; + needed_size += 14 + val->stat.extension.len; } #endif /* CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { @@ -3559,48 +3559,48 @@ static bool marshal_Rstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *val, st MARSHAL_U8LE(ctx, 125); MARSHAL_U16LE(ctx, val->tag); MARSHAL_U16LE(ctx, offsetof_end - offsetof_stat); - uint32_t offsetof_stat_end = 49 + val->stat.file_name.len + val->stat.file_owner_uid.len + val->stat.file_owner_gid.len + val->stat.file_last_modified_uid.len; + uint32_t offsetof_stat_end = 49 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len; #if CONFIG_9P_ENABLE_9P2000_u if is_ver(ctx, 9P2000_u) { - offsetof_stat_end += 14 + val->stat.file_extension.len; + offsetof_stat_end += 14 + val->stat.extension.len; } #endif /* CONFIG_9P_ENABLE_9P2000_u */ - uint32_t offsetof_stat_kern_type = 2; - MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_kern_type); - MARSHAL_U16LE(ctx, val->stat.kern_type); - MARSHAL_U32LE(ctx, val->stat.kern_dev); - MARSHAL_U8LE(ctx, val->stat.file_qid.type & qt_masks[ctx->version]); - MARSHAL_U32LE(ctx, val->stat.file_qid.vers); - MARSHAL_U64LE(ctx, val->stat.file_qid.path); - MARSHAL_U32LE(ctx, val->stat.file_mode & dm_masks[ctx->version]); - MARSHAL_U32LE(ctx, val->stat.file_atime); - MARSHAL_U32LE(ctx, val->stat.file_mtime); - MARSHAL_U64LE(ctx, val->stat.file_size); - MARSHAL_U16LE(ctx, val->stat.file_name.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_name.utf8, val->stat.file_name.len); - MARSHAL_U16LE(ctx, val->stat.file_owner_uid.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_owner_uid.utf8, val->stat.file_owner_uid.len); - MARSHAL_U16LE(ctx, val->stat.file_owner_gid.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_owner_gid.utf8, val->stat.file_owner_gid.len); - MARSHAL_U16LE(ctx, val->stat.file_last_modified_uid.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_last_modified_uid.utf8, val->stat.file_last_modified_uid.len); + uint32_t offsetof_stat_fstype = 2; + MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_fstype); + MARSHAL_U16LE(ctx, val->stat.fstype); + MARSHAL_U32LE(ctx, val->stat.fsdev); + MARSHAL_U8LE(ctx, val->stat.qid.type & qt_masks[ctx->version]); + MARSHAL_U32LE(ctx, val->stat.qid.vers); + MARSHAL_U64LE(ctx, val->stat.qid.path); + MARSHAL_U32LE(ctx, val->stat.mode & dm_masks[ctx->version]); + MARSHAL_U32LE(ctx, val->stat.atime); + MARSHAL_U32LE(ctx, val->stat.mtime); + MARSHAL_U64LE(ctx, val->stat.length); + MARSHAL_U16LE(ctx, val->stat.name.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.name.utf8, val->stat.name.len); + MARSHAL_U16LE(ctx, val->stat.owner_uname.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.owner_uname.utf8, val->stat.owner_uname.len); + MARSHAL_U16LE(ctx, val->stat.owner_gname.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.owner_gname.utf8, val->stat.owner_gname.len); + MARSHAL_U16LE(ctx, val->stat.last_modifier_uname.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.last_modifier_uname.utf8, val->stat.last_modifier_uname.len); #if CONFIG_9P_ENABLE_9P2000_u if (is_ver(ctx, 9P2000_u)) { - MARSHAL_U16LE(ctx, val->stat.file_extension.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_extension.utf8, val->stat.file_extension.len); - MARSHAL_U32LE(ctx, val->stat.file_owner_n_uid); - MARSHAL_U32LE(ctx, val->stat.file_owner_n_gid); - MARSHAL_U32LE(ctx, val->stat.file_last_modified_n_uid); + MARSHAL_U16LE(ctx, val->stat.extension.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.extension.utf8, val->stat.extension.len); + MARSHAL_U32LE(ctx, val->stat.owner_unum); + MARSHAL_U32LE(ctx, val->stat.owner_gnum); + MARSHAL_U32LE(ctx, val->stat.last_modifier_unum); } #endif /* CONFIG_9P_ENABLE_9P2000_u */ return false; } static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val, struct _marshal_ret *ret) { - uint32_t needed_size = 62 + val->stat.file_name.len + val->stat.file_owner_uid.len + val->stat.file_owner_gid.len + val->stat.file_last_modified_uid.len; + uint32_t needed_size = 62 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len; #if CONFIG_9P_ENABLE_9P2000_u if is_ver(ctx, 9P2000_u) { - needed_size += 14 + val->stat.file_extension.len; + needed_size += 14 + val->stat.extension.len; } #endif /* CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { @@ -3618,38 +3618,38 @@ static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val, MARSHAL_U16LE(ctx, val->tag); MARSHAL_U32LE(ctx, val->fid); MARSHAL_U16LE(ctx, offsetof_end - offsetof_stat); - uint32_t offsetof_stat_end = 49 + val->stat.file_name.len + val->stat.file_owner_uid.len + val->stat.file_owner_gid.len + val->stat.file_last_modified_uid.len; + uint32_t offsetof_stat_end = 49 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len; #if CONFIG_9P_ENABLE_9P2000_u if is_ver(ctx, 9P2000_u) { - offsetof_stat_end += 14 + val->stat.file_extension.len; + offsetof_stat_end += 14 + val->stat.extension.len; } #endif /* CONFIG_9P_ENABLE_9P2000_u */ - uint32_t offsetof_stat_kern_type = 2; - MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_kern_type); - MARSHAL_U16LE(ctx, val->stat.kern_type); - MARSHAL_U32LE(ctx, val->stat.kern_dev); - MARSHAL_U8LE(ctx, val->stat.file_qid.type & qt_masks[ctx->version]); - MARSHAL_U32LE(ctx, val->stat.file_qid.vers); - MARSHAL_U64LE(ctx, val->stat.file_qid.path); - MARSHAL_U32LE(ctx, val->stat.file_mode & dm_masks[ctx->version]); - MARSHAL_U32LE(ctx, val->stat.file_atime); - MARSHAL_U32LE(ctx, val->stat.file_mtime); - MARSHAL_U64LE(ctx, val->stat.file_size); - MARSHAL_U16LE(ctx, val->stat.file_name.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_name.utf8, val->stat.file_name.len); - MARSHAL_U16LE(ctx, val->stat.file_owner_uid.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_owner_uid.utf8, val->stat.file_owner_uid.len); - MARSHAL_U16LE(ctx, val->stat.file_owner_gid.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_owner_gid.utf8, val->stat.file_owner_gid.len); - MARSHAL_U16LE(ctx, val->stat.file_last_modified_uid.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_last_modified_uid.utf8, val->stat.file_last_modified_uid.len); + uint32_t offsetof_stat_fstype = 2; + MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_fstype); + MARSHAL_U16LE(ctx, val->stat.fstype); + MARSHAL_U32LE(ctx, val->stat.fsdev); + MARSHAL_U8LE(ctx, val->stat.qid.type & qt_masks[ctx->version]); + MARSHAL_U32LE(ctx, val->stat.qid.vers); + MARSHAL_U64LE(ctx, val->stat.qid.path); + MARSHAL_U32LE(ctx, val->stat.mode & dm_masks[ctx->version]); + MARSHAL_U32LE(ctx, val->stat.atime); + MARSHAL_U32LE(ctx, val->stat.mtime); + MARSHAL_U64LE(ctx, val->stat.length); + MARSHAL_U16LE(ctx, val->stat.name.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.name.utf8, val->stat.name.len); + MARSHAL_U16LE(ctx, val->stat.owner_uname.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.owner_uname.utf8, val->stat.owner_uname.len); + MARSHAL_U16LE(ctx, val->stat.owner_gname.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.owner_gname.utf8, val->stat.owner_gname.len); + MARSHAL_U16LE(ctx, val->stat.last_modifier_uname.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.last_modifier_uname.utf8, val->stat.last_modifier_uname.len); #if CONFIG_9P_ENABLE_9P2000_u if (is_ver(ctx, 9P2000_u)) { - MARSHAL_U16LE(ctx, val->stat.file_extension.len); - MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_extension.utf8, val->stat.file_extension.len); - MARSHAL_U32LE(ctx, val->stat.file_owner_n_uid); - MARSHAL_U32LE(ctx, val->stat.file_owner_n_gid); - MARSHAL_U32LE(ctx, val->stat.file_last_modified_n_uid); + MARSHAL_U16LE(ctx, val->stat.extension.len); + MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.extension.utf8, val->stat.extension.len); + MARSHAL_U32LE(ctx, val->stat.owner_unum); + MARSHAL_U32LE(ctx, val->stat.owner_gnum); + MARSHAL_U32LE(ctx, val->stat.last_modifier_unum); } #endif /* CONFIG_9P_ENABLE_9P2000_u */ return false; @@ -4964,37 +4964,37 @@ static void lib9p_qid_format(struct lib9p_qid *self, struct fmt_state *state) { #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static void lib9p_stat_format(struct lib9p_stat *self, struct fmt_state *state) { fmt_state_putchar(state, '{'); - fmt_state_puts(state, " kern_type="); - fmt_state_printf(state, "%"PRIu16, self->kern_type); - fmt_state_puts(state, " kern_dev="); - fmt_state_printf(state, "%"PRIu32, self->kern_dev); - fmt_state_puts(state, " file_qid="); - lib9p_qid_format(&self->file_qid, state); - fmt_state_puts(state, " file_mode="); - lib9p_dm_format(&self->file_mode, state); - fmt_state_puts(state, " file_atime="); - fmt_state_printf(state, "%"PRIu32, self->file_atime); - fmt_state_puts(state, " file_mtime="); - fmt_state_printf(state, "%"PRIu32, self->file_mtime); - fmt_state_puts(state, " file_size="); - fmt_state_printf(state, "%"PRIu64, self->file_size); - fmt_state_puts(state, " file_name="); - lib9p_s_format(&self->file_name, state); - fmt_state_puts(state, " file_owner_uid="); - lib9p_s_format(&self->file_owner_uid, state); - fmt_state_puts(state, " file_owner_gid="); - lib9p_s_format(&self->file_owner_gid, state); - fmt_state_puts(state, " file_last_modified_uid="); - lib9p_s_format(&self->file_last_modified_uid, state); + fmt_state_puts(state, " fstype="); + fmt_state_printf(state, "%"PRIu16, self->fstype); + fmt_state_puts(state, " fsdev="); + fmt_state_printf(state, "%"PRIu32, self->fsdev); + fmt_state_puts(state, " qid="); + lib9p_qid_format(&self->qid, state); + fmt_state_puts(state, " mode="); + lib9p_dm_format(&self->mode, state); + fmt_state_puts(state, " atime="); + fmt_state_printf(state, "%"PRIu32, self->atime); + fmt_state_puts(state, " mtime="); + fmt_state_printf(state, "%"PRIu32, self->mtime); + fmt_state_puts(state, " length="); + fmt_state_printf(state, "%"PRIu64, self->length); + fmt_state_puts(state, " name="); + lib9p_s_format(&self->name, state); + fmt_state_puts(state, " owner_uname="); + lib9p_s_format(&self->owner_uname, state); + fmt_state_puts(state, " owner_gname="); + lib9p_s_format(&self->owner_gname, state); + fmt_state_puts(state, " last_modifier_uname="); + lib9p_s_format(&self->last_modifier_uname, state); #if CONFIG_9P_ENABLE_9P2000_u - fmt_state_puts(state, " file_extension="); - lib9p_s_format(&self->file_extension, state); - fmt_state_puts(state, " file_owner_n_uid="); - lib9p_nuid_format(&self->file_owner_n_uid, state); - fmt_state_puts(state, " file_owner_n_gid="); - lib9p_nuid_format(&self->file_owner_n_gid, state); - fmt_state_puts(state, " file_last_modified_n_uid="); - lib9p_nuid_format(&self->file_last_modified_n_uid, state); + fmt_state_puts(state, " extension="); + lib9p_s_format(&self->extension, state); + fmt_state_puts(state, " owner_unum="); + lib9p_nuid_format(&self->owner_unum, state); + fmt_state_puts(state, " owner_gnum="); + lib9p_nuid_format(&self->owner_gnum, state); + fmt_state_puts(state, " last_modifier_unum="); + lib9p_nuid_format(&self->last_modifier_unum, state); #endif /* CONFIG_9P_ENABLE_9P2000_u */ fmt_state_puts(state, " }"); } @@ -5109,8 +5109,8 @@ static void lib9p_msg_Tauth_format(struct lib9p_msg_Tauth *self, struct fmt_stat fmt_state_puts(state, " aname="); lib9p_s_format(&self->aname, state); #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u - fmt_state_puts(state, " n_uid="); - lib9p_nuid_format(&self->n_uid, state); + fmt_state_puts(state, " unum="); + lib9p_nuid_format(&self->unum, state); #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ fmt_state_puts(state, " }"); } @@ -5137,8 +5137,8 @@ static void lib9p_msg_Tattach_format(struct lib9p_msg_Tattach *self, struct fmt_ fmt_state_puts(state, " aname="); lib9p_s_format(&self->aname, state); #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u - fmt_state_puts(state, " n_uid="); - lib9p_nuid_format(&self->n_uid, state); + fmt_state_puts(state, " unum="); + lib9p_nuid_format(&self->unum, state); #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ fmt_state_puts(state, " }"); } diff --git a/lib9p/core_include/lib9p/_core_generated.h b/lib9p/core_include/lib9p/_core_generated.h index 68eb636..705e608 100644 --- a/lib9p/core_include/lib9p/_core_generated.h +++ b/lib9p/core_include/lib9p/_core_generated.h @@ -999,22 +999,22 @@ LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rswrite, lib9p_msg_Rswrite); /* LIB9P_VER_9P2000_p9p: min_size = 49 ; exp_size = 157 ; max_size = 262,189 ; max_iov = 8 ; max_copy = 49 */ /* LIB9P_VER_9P2000_u : min_size = 63 ; exp_size = 198 ; max_size = 327,738 ; max_iov = 11 ; max_copy = 63 */ struct lib9p_stat { - uint16_t kern_type; - uint32_t kern_dev; - struct lib9p_qid file_qid; - lib9p_dm_t file_mode; - uint32_t file_atime; - uint32_t file_mtime; - uint64_t file_size; - struct lib9p_s file_name; - struct lib9p_s file_owner_uid; - struct lib9p_s file_owner_gid; - struct lib9p_s file_last_modified_uid; + uint16_t fstype; + uint32_t fsdev; + struct lib9p_qid qid; + lib9p_dm_t mode; + uint32_t atime; + uint32_t mtime; + uint64_t length; + struct lib9p_s name; + struct lib9p_s owner_uname; + struct lib9p_s owner_gname; + struct lib9p_s last_modifier_uname; #if CONFIG_9P_ENABLE_9P2000_u - struct lib9p_s file_extension; - lib9p_nuid_t file_owner_n_uid; - lib9p_nuid_t file_owner_n_gid; - lib9p_nuid_t file_last_modified_n_uid; + struct lib9p_s extension; + lib9p_nuid_t owner_unum; + lib9p_nuid_t owner_gnum; + lib9p_nuid_t last_modifier_unum; #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_stat, lib9p_stat); @@ -1048,7 +1048,7 @@ struct lib9p_msg_Tauth { struct lib9p_s uname; struct lib9p_s aname; #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u - lib9p_nuid_t n_uid; + lib9p_nuid_t unum; #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ }; LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tauth, lib9p_msg_Tauth); @@ -1072,7 +1072,7 @@ struct lib9p_msg_Tattach { struct lib9p_s uname; struct lib9p_s aname; #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u - lib9p_nuid_t n_uid; + lib9p_nuid_t unum; #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ }; LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tattach, lib9p_msg_Tattach); diff --git a/lib9p/core_include/lib9p/core.h b/lib9p/core_include/lib9p/core.h index 8f76c3b..a82252b 100644 --- a/lib9p/core_include/lib9p/core.h +++ b/lib9p/core_include/lib9p/core.h @@ -167,12 +167,12 @@ bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *bo /** Assert that a `struct lib9p_stat` object looks valid. */ static inline void lib9p_stat_assert(struct lib9p_stat stat) { - assert( ((bool)(stat.file_mode & LIB9P_DM_DIR )) == ((bool)(stat.file_qid.type & LIB9P_QT_DIR )) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_APPEND)) == ((bool)(stat.file_qid.type & LIB9P_QT_APPEND)) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_EXCL )) == ((bool)(stat.file_qid.type & LIB9P_QT_EXCL )) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_AUTH )) == ((bool)(stat.file_qid.type & LIB9P_QT_AUTH )) ); - assert( ((bool)(stat.file_mode & LIB9P_DM_TMP )) == ((bool)(stat.file_qid.type & LIB9P_QT_TMP )) ); - assert( (stat.file_size == 0) || !(stat.file_mode & LIB9P_DM_DIR) ); + assert( ((bool)(stat.mode & LIB9P_DM_DIR )) == ((bool)(stat.qid.type & LIB9P_QT_DIR )) ); + assert( ((bool)(stat.mode & LIB9P_DM_APPEND)) == ((bool)(stat.qid.type & LIB9P_QT_APPEND)) ); + assert( ((bool)(stat.mode & LIB9P_DM_EXCL )) == ((bool)(stat.qid.type & LIB9P_QT_EXCL )) ); + assert( ((bool)(stat.mode & LIB9P_DM_AUTH )) == ((bool)(stat.qid.type & LIB9P_QT_AUTH )) ); + assert( ((bool)(stat.mode & LIB9P_DM_TMP )) == ((bool)(stat.qid.type & LIB9P_QT_TMP )) ); + assert( (stat.length == 0) || !(stat.mode & LIB9P_DM_DIR) ); } /** diff --git a/lib9p/idl/2002-9P2000.9p b/lib9p/idl/2002-9P2000.9p index 13393c6..712ffea 100644 --- a/lib9p/idl/2002-9P2000.9p +++ b/lib9p/idl/2002-9P2000.9p @@ -91,18 +91,26 @@ bitfield qt = 1 struct qid = "type[qt] vers[4] path[8]" # stat - file status -struct stat = "stat_size[2,val=end-&kern_type]" - "kern_type[2]" - "kern_dev[4]" - "file_qid[qid]" - "file_mode[dm]" - "file_atime[4]" - "file_mtime[4]" - "file_size[8]" - "file_name[s]" - "file_owner_uid[s]" - "file_owner_gid[s]" - "file_last_modified_uid[s]" +struct stat = "_stat_size[2,val=end-&fstype]" + # fstype and fsdev are documented simply as "for kernel + # use". The are ignored by Plan 9's in-kernel 9P + # client; mntdirfix() overwrites them with fstype='M' + # and fsdev=nonce. Processes may observe values other + # than fstype='M', as 'M' is used for actual 9P servers, + # while other values are used for in-kernel device + # servers (such as '|' for pipes, or 'I' for the IP + # stack). + "fstype[2]" # filesystem type + "fsdev[4]" # filesystem instance/subtype + "qid[qid]" + "mode[dm]" + "atime[4]" + "mtime[4]" + "length[8]" # 0 for directories + "name[s]" + "owner_uname[s]" + "owner_gname[s]" + "last_modifier_uname[s]" # "O"pen flags (flags to pass to Topen and Tcreate) # Unused bits *must* be 0. diff --git a/lib9p/idl/2005-9P2000.u.9p b/lib9p/idl/2005-9P2000.u.9p index 1d630f9..446385c 100644 --- a/lib9p/idl/2005-9P2000.u.9p +++ b/lib9p/idl/2005-9P2000.u.9p @@ -17,13 +17,13 @@ num nuid = 4 num errno = 4 "NOERROR = 0" -struct stat += "file_extension[s]" - "file_owner_n_uid[nuid]" - "file_owner_n_gid[nuid]" - "file_last_modified_n_uid[nuid]" +struct stat += "extension[s]" + "owner_unum[nuid]" + "owner_gnum[nuid]" + "last_modifier_unum[nuid]" -msg Tauth += "n_uid[nuid]" -msg Tattach += "n_uid[nuid]" +msg Tauth += "unum[nuid]" +msg Tattach += "unum[nuid]" msg Rerror += "errnum[errno]" diff --git a/lib9p/srv.c b/lib9p/srv.c index 0196a0e..b5455e0 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -170,7 +170,7 @@ static inline bool srv_check_perm(struct srv_req *ctx, struct lib9p_stat *stat, assert(action); /* TODO actually check user and group instead of just assuming "other". */ - uint8_t mode = (uint8_t)(stat->file_mode & 07); + uint8_t mode = (uint8_t)(stat->mode & 07); return mode & action; } @@ -800,7 +800,7 @@ static void handle_Tauth(struct srv_req *ctx, goto tauth_return; } - ctx->user = srv_userid_new(req->uname, req->n_uid); + ctx->user = srv_userid_new(req->uname, req->unum); srv->auth(ctx, req->aname); @@ -839,10 +839,10 @@ static void handle_Tattach(struct srv_req *ctx, afid->user->name.len, afid->user->name.utf8, req->uname.len, req->uname.utf8); #if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L - else if (afid->user->num != req->n_uid) + else if (afid->user->num != req->unum) lib9p_errorf(&ctx->basectx, LIB9P_ERRNO_L_EACCES, "FID provided as auth-file is for user=%"PRIu32" and cannot be used for user=%"PRIu32, - afid->user->num, req->n_uid); + afid->user->num, req->unum); #endif else if (!lib9p_str_eq(afid->auth.aname, req->aname)) lib9p_errorf(&ctx->basectx, @@ -861,7 +861,7 @@ static void handle_Tattach(struct srv_req *ctx, LIB9P_ERRNO_L_EACCES, "FID provided as auth-file, but no auth-file is required"); goto tattach_return; } - ctx->user = srv_userid_new(req->uname, req->n_uid); + ctx->user = srv_userid_new(req->uname, req->unum); } /* 1. File object */ @@ -1047,12 +1047,12 @@ static void handle_Topen(struct srv_req *ctx, if (lib9p_ctx_has_error(&ctx->basectx)) goto topen_return; lib9p_stat_assert(stat); - if ((stat.file_mode & LIB9P_DM_EXCL) && pathinfo->io_refcount) { + if ((stat.mode & LIB9P_DM_EXCL) && pathinfo->io_refcount) { lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EEXIST, "exclusive file is already opened"); goto topen_return; } - if (stat.file_mode & LIB9P_DM_APPEND) { + if (stat.mode & LIB9P_DM_APPEND) { fidflags |= FIDFLAG_APPEND; reqmode = reqmode & ~LIB9P_O_TRUNC; } diff --git a/lib9p/tests/test_server/fs_flush.c b/lib9p/tests/test_server/fs_flush.c index 779eb91..821f32d 100644 --- a/lib9p/tests/test_server/fs_flush.c +++ b/lib9p/tests/test_server/fs_flush.c @@ -35,21 +35,21 @@ static struct lib9p_stat flush_file_stat(struct flush_file *self, struct lib9p_s assert(self); assert(ctx); return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = flush_file_qid(self), - .file_mode = 0444, - .file_atime = UTIL9P_ATIME, - .file_mtime = UTIL9P_MTIME, - .file_size = 6, - .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 = flush_file_qid(self), + .mode = 0444, + .atime = UTIL9P_ATIME, + .mtime = UTIL9P_MTIME, + .length = 6, + .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 flush_file_wstat(struct flush_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) { diff --git a/lib9p/tests/test_server/fs_shutdown.c b/lib9p/tests/test_server/fs_shutdown.c index af2a989..2c3137c 100644 --- a/lib9p/tests/test_server/fs_shutdown.c +++ b/lib9p/tests/test_server/fs_shutdown.c @@ -34,21 +34,21 @@ static struct lib9p_stat shutdown_file_stat(struct shutdown_file *self, struct l assert(self); assert(ctx); return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = shutdown_file_qid(self), - .file_mode = 0222 | LIB9P_DM_APPEND, - .file_atime = UTIL9P_ATIME, - .file_mtime = UTIL9P_MTIME, - .file_size = 0, - .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 = shutdown_file_qid(self), + .mode = 0222 | LIB9P_DM_APPEND, + .atime = UTIL9P_ATIME, + .mtime = UTIL9P_MTIME, + .length = 0, + .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 shutdown_file_wstat(struct shutdown_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) { 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) { diff --git a/lib9p/tests/testclient-p9p.explog b/lib9p/tests/testclient-p9p.explog index 8216297..54f1e4b 100644 --- a/lib9p/tests/testclient-p9p.explog +++ b/lib9p/tests/testclient-p9p.explog @@ -4,14 +4,14 @@ # SPDX-License-Identifier: AGPL-3.0-or-later > Tversion { tag=NOTAG max_msg_size=8192 version="9P2000" } < Rversion { tag=NOTAG max_msg_size=4120 version="9P2000" } -> Tauth { tag=0 afid=0 uname="nobody" aname="" n_uid=0 } +> Tauth { tag=0 afid=0 uname="nobody" aname="" unum=0 } < Rerror { tag=0 errstr="authentication not required" errnum=L_EOPNOTSUPP } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=1 nwname=0 wname=[ ] } < Rwalk { tag=0 nwqid=0 wqid=[ ] } > Tstat { tag=0 fid=1 } -< Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(DIR) vers=1 path=1 } file_mode=(DIR|0555) file_atime=1728337905 file_mtime=1728337904 file_size=0 file_name="" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } } +< Rstat { tag=0 stat={ fstype=0 fsdev=0 qid={ type=(DIR) vers=1 path=1 } mode=(DIR|0555) atime=1728337905 mtime=1728337904 length=0 name="" owner_uname="root" owner_gname="root" last_modifier_uname="root" extension="" owner_unum=0 owner_gnum=0 last_modifier_unum=0 } } > Tclunk { tag=0 fid=1 } < Rclunk { tag=0 } > Twalk { tag=0 fid=0 newfid=1 nwname=0 wname=[ ] } @@ -26,14 +26,14 @@ < Rclunk { tag=0 } > Tversion { tag=NOTAG max_msg_size=8192 version="9P2000" } < Rversion { tag=NOTAG max_msg_size=4120 version="9P2000" } -> Tauth { tag=0 afid=0 uname="nobody" aname="" n_uid=0 } +> Tauth { tag=0 afid=0 uname="nobody" aname="" unum=0 } < Rerror { tag=0 errstr="authentication not required" errnum=L_EOPNOTSUPP } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "Documentation" ] } < Rwalk { tag=0 nwqid=1 wqid=[ { type=(DIR) vers=1 path=2 } ] } > Tstat { tag=0 fid=1 } -< Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(DIR) vers=1 path=2 } file_mode=(DIR|0555) file_atime=1728337905 file_mtime=1728337904 file_size=0 file_name="Documentation" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } } +< Rstat { tag=0 stat={ fstype=0 fsdev=0 qid={ type=(DIR) vers=1 path=2 } mode=(DIR|0555) atime=1728337905 mtime=1728337904 length=0 name="Documentation" owner_uname="root" owner_gname="root" last_modifier_uname="root" extension="" owner_unum=0 owner_gnum=0 last_modifier_unum=0 } } > Tclunk { tag=0 fid=1 } < Rclunk { tag=0 } > Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "Documentation" ] } @@ -48,9 +48,9 @@ < Rclunk { tag=0 } > Tversion { tag=NOTAG max_msg_size=8192 version="9P2000" } < Rversion { tag=NOTAG max_msg_size=4120 version="9P2000" } -> Tauth { tag=0 afid=0 uname="nobody" aname="" n_uid=0 } +> Tauth { tag=0 afid=0 uname="nobody" aname="" unum=0 } < Rerror { tag=0 errstr="authentication not required" errnum=L_EOPNOTSUPP } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "README.md" ] } < Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=4 } ] } @@ -64,9 +64,9 @@ < Rclunk { tag=0 } > Tversion { tag=NOTAG max_msg_size=8192 version="9P2000" } < Rversion { tag=NOTAG max_msg_size=4120 version="9P2000" } -> Tauth { tag=0 afid=0 uname="nobody" aname="" n_uid=0 } +> Tauth { tag=0 afid=0 uname="nobody" aname="" unum=0 } < Rerror { tag=0 errstr="authentication not required" errnum=L_EOPNOTSUPP } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=[ "Documentation", "x" ] } < Rwalk { tag=0 nwqid=2 wqid=[ { type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] } @@ -80,21 +80,21 @@ < Rclunk { tag=0 } > Tversion { tag=NOTAG max_msg_size=8192 version="9P2000" } < Rversion { tag=NOTAG max_msg_size=4120 version="9P2000" } -> Tauth { tag=0 afid=0 uname="nobody" aname="" n_uid=0 } +> Tauth { tag=0 afid=0 uname="nobody" aname="" unum=0 } < Rerror { tag=0 errstr="authentication not required" errnum=L_EOPNOTSUPP } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=[ "Documentation", "x" ] } < Rwalk { tag=0 nwqid=2 wqid=[ { type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] } > Tstat { tag=0 fid=1 } -< Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(0) vers=1 path=3 } file_mode=(0444) file_atime=1728337905 file_mtime=1728337904 file_size=166 file_name="x" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } } +< Rstat { tag=0 stat={ fstype=0 fsdev=0 qid={ type=(0) vers=1 path=3 } mode=(0444) atime=1728337905 mtime=1728337904 length=166 name="x" owner_uname="root" owner_gname="root" last_modifier_uname="root" extension="" owner_unum=0 owner_gnum=0 last_modifier_unum=0 } } > Tclunk { tag=0 fid=1 } < Rclunk { tag=0 } > Tversion { tag=NOTAG max_msg_size=8192 version="9P2000" } < Rversion { tag=NOTAG max_msg_size=4120 version="9P2000" } -> Tauth { tag=0 afid=0 uname="nobody" aname="" n_uid=0 } +> Tauth { tag=0 afid=0 uname="nobody" aname="" unum=0 } < Rerror { tag=0 errstr="authentication not required" errnum=L_EOPNOTSUPP } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "shutdown" ] } < Rwalk { tag=0 nwqid=1 wqid=[ { type=(APPEND) vers=1 path=5 } ] } diff --git a/lib9p/tests/testclient-sess.c b/lib9p/tests/testclient-sess.c index 561c0c9..7cb7f97 100644 --- a/lib9p/tests/testclient-sess.c +++ b/lib9p/tests/testclient-sess.c @@ -95,9 +95,9 @@ int main(int argc, char *argv[]) { send9p(Tversion, .tag=0, .max_msg_size=(8*1024), .version=lib9p_str("9P2000.u")); recv9p(); /* Rversion */ ctx.version = LIB9P_VER_9P2000_u; - send9p(Tattach, .tag=0, .fid=0, .afid=LIB9P_FID_NOFID, .uname=lib9p_str("alice"), .n_uid=1000, .aname=lib9p_str("")); + send9p(Tattach, .tag=0, .fid=0, .afid=LIB9P_FID_NOFID, .uname=lib9p_str("alice"), .unum=1000, .aname=lib9p_str("")); recv9p(); /* Rattach */ - send9p(Tattach, .tag=0, .fid=1, .afid=LIB9P_FID_NOFID, .uname=lib9p_str("bob"), .n_uid=1001, .aname=lib9p_str("")); + send9p(Tattach, .tag=0, .fid=1, .afid=LIB9P_FID_NOFID, .uname=lib9p_str("bob"), .unum=1001, .aname=lib9p_str("")); recv9p(); /* Rattach */ wname[0] = lib9p_str("whoami"); send9p(Twalk, .tag=0, .fid=0, .newfid=2, .nwname=1, .wname=wname); recv9p(); /* Rwalk */ diff --git a/lib9p/tests/testclient-sess.explog b/lib9p/tests/testclient-sess.explog index f686045..a3838ac 100644 --- a/lib9p/tests/testclient-sess.explog +++ b/lib9p/tests/testclient-sess.explog @@ -14,9 +14,9 @@ # ext version, users ########################################################### > Tversion { tag=0 max_msg_size=8192 version="9P2000.u" } < Rversion { tag=0 max_msg_size=4120 version="9P2000.u" } -> Tattach { tag=0 fid=0 afid=NOFID uname="alice" aname="" n_uid=1000 } +> Tattach { tag=0 fid=0 afid=NOFID uname="alice" aname="" unum=1000 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Tattach { tag=0 fid=1 afid=NOFID uname="bob" aname="" n_uid=1001 } +> Tattach { tag=0 fid=1 afid=NOFID uname="bob" aname="" unum=1001 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=2 nwname=1 wname=[ "whoami" ] } < Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=8 } ] } @@ -34,7 +34,7 @@ # walk ######################################################################### > Tversion { tag=0 max_msg_size=8192 version="9P2000" } < Rversion { tag=0 max_msg_size=4120 version="9P2000" } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } # dup @@ -83,7 +83,7 @@ # flush ######################################################################## > Tversion { tag=0 max_msg_size=8192 version="9P2000" } < Rversion { tag=0 max_msg_size=4120 version="9P2000" } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } # flush, but original response comes back first @@ -146,7 +146,7 @@ # shutdown ##################################################################### > Tversion { tag=0 max_msg_size=8192 version="9P2000" } < Rversion { tag=0 max_msg_size=4120 version="9P2000" } -> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } +> Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" unum=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Twalk { tag=0 fid=0 newfid=0 nwname=1 wname=[ "shutdown" ] } < Rwalk { tag=0 nwqid=1 wqid=[ { type=(APPEND) vers=1 path=5 } ] } diff --git a/lib9p_util/static.c b/lib9p_util/static.c index 44b8242..e1df3ca 100644 --- a/lib9p_util/static.c +++ b/lib9p_util/static.c @@ -38,21 +38,21 @@ static struct lib9p_stat util9p_static_dir_stat(struct util9p_static_dir *self, assert(ctx); return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = util9p_static_dir_qid(self), - .file_mode = LIB9P_DM_DIR | (self->perm & 0555), - .file_atime = self->atime, - .file_mtime = self->mtime, - .file_size = 0, - .file_name = lib9p_str(self->name), - .file_owner_uid = lib9p_str(self->u_name), - .file_owner_gid = lib9p_str(self->g_name), - .file_last_modified_uid = lib9p_str(self->m_name), - .file_extension = lib9p_str(NULL), - .file_owner_n_uid = self->u_num, - .file_owner_n_gid = self->g_num, - .file_last_modified_n_uid = self->m_num, + .fstype = 0, + .fsdev = 0, + .qid = util9p_static_dir_qid(self), + .mode = LIB9P_DM_DIR | (self->perm & 0555), + .atime = self->atime, + .mtime = self->mtime, + .length = 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, + .extension = lib9p_str(NULL), }; } static void util9p_static_dir_wstat(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx, @@ -80,7 +80,7 @@ static lo_interface lib9p_srv_file util9p_static_dir_dwalk(struct util9p_static_ if (lib9p_ctx_has_error(&ctx->basectx)) break; lib9p_stat_assert(stat); - if (lib9p_str_eq(stat.file_name, childname)) + if (lib9p_str_eq(stat.name, childname)) return file; } lib9p_error(&ctx->basectx, @@ -171,21 +171,21 @@ static struct lib9p_stat util9p_static_file_stat(struct util9p_static_file *self assert(ctx); return (struct lib9p_stat){ - .kern_type = 0, - .kern_dev = 0, - .file_qid = util9p_static_file_qid(self), - .file_mode = self->perm & 0444, - .file_atime = self->atime, - .file_mtime = self->mtime, - .file_size = (uint64_t)util9p_static_file_size(self), - .file_name = lib9p_str(self->name), - .file_owner_uid = lib9p_str(self->u_name), - .file_owner_gid = lib9p_str(self->g_name), - .file_last_modified_uid = lib9p_str(self->m_name), - .file_extension = lib9p_str(NULL), - .file_owner_n_uid = self->u_num, - .file_owner_n_gid = self->g_num, - .file_last_modified_n_uid = self->m_num, + .fstype = 0, + .fsdev = 0, + .qid = util9p_static_file_qid(self), + .mode = self->perm & 0444, + .atime = self->atime, + .mtime = self->mtime, + .length = (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, + .extension = lib9p_str(NULL), }; } static void util9p_static_file_wstat(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx, |