diff options
Diffstat (limited to 'lib9p')
-rw-r--r-- | lib9p/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib9p/core.c | 202 | ||||
-rw-r--r-- | lib9p/core_gen/c.py | 21 | ||||
-rw-r--r-- | lib9p/core_gen/c_marshal.py | 16 | ||||
-rw-r--r-- | lib9p/core_gen/h.py | 8 | ||||
-rw-r--r-- | lib9p/core_generated.c | 540 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/_core_generated.h | 66 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/core.h | 43 | ||||
-rw-r--r-- | lib9p/core_tables.c | 190 | ||||
-rw-r--r-- | lib9p/core_tables.h | 3 | ||||
-rw-r--r-- | lib9p/idl/0000-uninitialized.9p | 2 | ||||
-rw-r--r-- | lib9p/srv.c | 20 | ||||
-rw-r--r-- | lib9p/srv_include/lib9p/srv.h | 22 |
13 files changed, 561 insertions, 573 deletions
diff --git a/lib9p/CMakeLists.txt b/lib9p/CMakeLists.txt index 0a5ea3e..cff07ad 100644 --- a/lib9p/CMakeLists.txt +++ b/lib9p/CMakeLists.txt @@ -8,7 +8,6 @@ target_include_directories(lib9p_core PUBLIC INTERFACE ${CMAKE_CURRENT_SOURCE_DI target_sources(lib9p_core INTERFACE core.c core_generated.c - core_tables.c ) target_link_libraries(lib9p_core INTERFACE libfmt diff --git a/lib9p/core.c b/lib9p/core.c index cb8ddee..03cdea5 100644 --- a/lib9p/core.c +++ b/lib9p/core.c @@ -4,14 +4,18 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -#include <inttypes.h> /* for PRIu{n} */ -#include <stdarg.h> /* for va_* */ -#include <string.h> /* for strncpy() */ +#include <stdarg.h> /* for va_* */ +#include <string.h> /* for strlen(), strnlen(), strncpy(), memcmp(), memset() */ -#include <libfmt/fmt.h> /* for fmt_vsnprintf() */ +#include <libfmt/fmt.h> /* for fmt_vsnprintf() */ +#include <libmisc/assert.h> /* for assert() */ +#include <libmisc/endian.h> /* for uint32le_decode() */ +#include <libmisc/log.h> /* for const_byte_str() */ #include <lib9p/core.h> +#include "core_tables.h" + /* strings ********************************************************************/ struct lib9p_s lib9p_str(char *s) { @@ -58,10 +62,7 @@ bool lib9p_ctx_has_error(struct lib9p_ctx *ctx) { return ctx->err_msg[0]; } -#undef lib9p_error -#undef lib9p_errorf - -int lib9p_error(struct lib9p_ctx *ctx, +int _lib9p_error(struct lib9p_ctx *ctx, #if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L lib9p_errno_t linux_errno, #endif @@ -78,7 +79,7 @@ int lib9p_error(struct lib9p_ctx *ctx, return -1; } -int lib9p_errorf(struct lib9p_ctx *ctx, +int _lib9p_errorf(struct lib9p_ctx *ctx, #if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L lib9p_errno_t linux_errno, #endif @@ -100,3 +101,186 @@ int lib9p_errorf(struct lib9p_ctx *ctx, return -1; } + +/* bounds checks **************************************************************/ + +static inline void assert_ver(enum lib9p_version ver) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" + assert(0 <= ver && ver < LIB9P_VER_NUM); +#pragma GCC diagnostic pop +} + +static inline void assert_typ(enum lib9p_msg_type typ) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" + assert(0 <= typ && typ < 0xFF); +#pragma GCC diagnostic pop +} + +/* simple lookups *************************************************************/ + +const char *lib9p_version_str(enum lib9p_version ver) { + assert_ver(ver); + return _lib9p_table_ver[ver].name; +} + +uint32_t lib9p_version_min_Rerror_size(enum lib9p_version ver) { + assert_ver(ver); + return _lib9p_table_ver[ver].min_Rerror_size; +} + +uint32_t lib9p_version_min_Rread_size(enum lib9p_version ver) { + assert_ver(ver); + return _lib9p_table_ver[ver].min_Rread_size; +} + +const char *lib9p_msgtype_str(enum lib9p_version ver, enum lib9p_msg_type typ) { + assert_ver(ver); + assert_typ(typ); + return _lib9p_table_msg[ver][typ].name ?: const_byte_str(typ); +} + +lo_interface fmt_formatter lo_box_lib9p_msg_as_fmt_formatter(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body) { + assert(ctx); + assert_ver(ctx->version); + assert_typ(typ); + assert(_lib9p_table_msg[ctx->version][typ].box_as_fmt_formatter); + return _lib9p_table_msg[ctx->version][typ].box_as_fmt_formatter(body); +} + +/* main message functions *****************************************************/ + +static +ssize_t _lib9p_validate(uint8_t xxx_low_typ_bit, + const char *xxx_errmsg, + const struct _lib9p_recv_tentry xxx_table[LIB9P_VER_NUM][0x80], + struct lib9p_ctx *ctx, uint8_t *net_bytes) { + assert_ver(ctx->version); + /* Inspect the first 5 bytes ourselves. */ + uint32_t net_size = uint32le_decode(net_bytes); + if (net_size < 5) + return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "message is impossibly short"); + uint8_t typ = net_bytes[4]; + if (typ % 2 != xxx_low_typ_bit) + return lib9p_errorf(ctx, LIB9P_ERRNO_L_EOPNOTSUPP, "%s: message_type=%s", xxx_errmsg, + lib9p_msgtype_str(ctx->version, typ)); + struct _lib9p_recv_tentry tentry = xxx_table[ctx->version][typ/2]; + if (!tentry.validate) + return lib9p_errorf(ctx, LIB9P_ERRNO_L_EOPNOTSUPP, "unknown message type: %s (protocol_version=%s)", + lib9p_msgtype_str(ctx->version, typ), lib9p_version_str(ctx->version)); + + /* Now use the message-type-specific tentry to process the whole thing. */ + return tentry.validate(ctx, net_size, net_bytes); +} + +ssize_t lib9p_Tmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes) { + return _lib9p_validate(0, "expected a T-message but got an R-message", _lib9p_table_Tmsg_recv, + ctx, net_bytes); +} + +ssize_t lib9p_Rmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes) { + return _lib9p_validate(1, "expected an R-message but got a T-message", _lib9p_table_Rmsg_recv, + ctx, net_bytes); +} + +static +void _lib9p_unmarshal(const struct _lib9p_recv_tentry xxx_table[LIB9P_VER_NUM][0x80], + struct lib9p_ctx *ctx, uint8_t *net_bytes, + enum lib9p_msg_type *ret_typ, void *ret_body) { + assert_ver(ctx->version); + enum lib9p_msg_type typ = net_bytes[4]; + *ret_typ = typ; + struct _lib9p_recv_tentry tentry = xxx_table[ctx->version][typ/2]; + assert(tentry.unmarshal); + + tentry.unmarshal(ctx, net_bytes, ret_body); +} + +void lib9p_Tmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, + enum lib9p_msg_type *ret_typ, void *ret_body) { + _lib9p_unmarshal(_lib9p_table_Tmsg_recv, + ctx, net_bytes, ret_typ, ret_body); +} + +void lib9p_Rmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, + enum lib9p_msg_type *ret_typ, void *ret_body) { + _lib9p_unmarshal(_lib9p_table_Rmsg_recv, + ctx, net_bytes, ret_typ, ret_body); +} + +static +bool _lib9p_marshal(const struct _lib9p_send_tentry xxx_table[LIB9P_VER_NUM][0x80], + struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, + size_t *ret_iov_cnt, struct iovec *ret_iov, uint8_t *ret_copied) { + assert_ver(ctx->version); + assert_typ(typ); + struct _marshal_ret ret = { + .net_iov_cnt = 1, + .net_iov = ret_iov, + .net_copied_size = 0, + .net_copied = ret_copied, + }; + struct _lib9p_send_tentry tentry = xxx_table[ctx->version][typ/2]; + assert(tentry.marshal); + + bool ret_erred = tentry.marshal(ctx, body, &ret); + if (ret_iov[ret.net_iov_cnt-1].iov_len == 0) + ret.net_iov_cnt--; + *ret_iov_cnt = ret.net_iov_cnt; + return ret_erred; +} + +bool lib9p_Tmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, + struct lib9p_Tmsg_send_buf *ret) { + assert(typ % 2 == 0); + memset(ret, 0, sizeof(*ret)); + return _lib9p_marshal(_lib9p_table_Tmsg_send, + ctx, typ, body, + &ret->iov_cnt, ret->iov, ret->copied); +} + +bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, + struct lib9p_Rmsg_send_buf *ret) { + assert(typ % 2 == 1); + memset(ret, 0, sizeof(*ret)); + return _lib9p_marshal(_lib9p_table_Rmsg_send, + ctx, typ, body, + &ret->iov_cnt, ret->iov, ret->copied); +} + +/* `struct lib9p_stat` helpers ************************************************/ + +#if _LIB9P_ENABLE_stat +bool lib9p_stat_validate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, + uint32_t *ret_net_size, size_t *ret_host_size) { + ssize_t host_size = _lib9p_stat_validate(ctx, net_size, net_bytes, ret_net_size); + if (host_size < 0) + return true; + if (ret_host_size) + *ret_host_size = (size_t)host_size; + return false; +} + +void lib9p_stat_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, + struct lib9p_stat *ret) { + _lib9p_stat_unmarshal(ctx, net_bytes, ret); +} + +uint32_t lib9p_stat_marshal(struct lib9p_ctx *ctx, uint32_t max_net_size, struct lib9p_stat *obj, + uint8_t *ret_bytes) { + struct lib9p_ctx _ctx = *ctx; + _ctx.max_msg_size = max_net_size; + + struct iovec iov = {0}; + struct _marshal_ret ret = { + .net_iov_cnt = 1, + .net_iov = &iov, + .net_copied_size = 0, + .net_copied = ret_bytes, + }; + if (_lib9p_stat_marshal(&_ctx, obj, &ret)) + return 0; + return ret.net_iov[0].iov_len; +} +#endif diff --git a/lib9p/core_gen/c.py b/lib9p/core_gen/c.py index a300404..b0ff871 100644 --- a/lib9p/core_gen/c.py +++ b/lib9p/core_gen/c.py @@ -79,9 +79,9 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str: if not isinstance(typ, idl.Bitfield): continue ret += "\n" - ret += cutil.ifdef_push( - 1, c9util.ver_ifdef(typ.in_versions - {"unknown"}) - ) # SPECIAL (initialization) + ret += cutil.ifdef_push( # SPECIAL (initialization) + 1, c9util.ver_ifdef(typ.in_versions - {"uninitialized"}) + ) ret += f"static const {c9util.typename(typ)} {typ.typname}_masks[{c9util.ver_enum('NUM')}] = {{\n" verwidth = max(len(ver) for ver in versions) for ver in sorted(versions): @@ -123,18 +123,15 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str: ret += "\n" ret += f"const struct {c9util.ident('_ver_tentry')} {c9util.ident('_table_ver')}[{c9util.ver_enum('NUM')}] = {{\n" rerror = next(typ for typ in typs if typ.typname == "Rerror") + rlerror = next(typ for typ in typs if typ.typname == "Rlerror") + rread = next(typ for typ in typs if typ.typname == "Rread") for ver in sorted(versions): - # XXX: There are good arguments that min_msg_size should be - # something larger than rerror.min_size(). - # srv.c:respond_error() assumes that min_msg_size is - # rerror.min_size(); if you do change min_msg_size to - # something larger, then be sure to update respond_error(). ret += cutil.ifdef_push(1, c9util.ver_ifdef({ver})) - min_msg_size = rerror.min_size(ver) + min_rerror_size = rerror.min_size(ver) if ver == "9P2000.L": # SPECIAL (9P2000.L) - rlerror = next(typ for typ in typs if typ.typname == "Rlerror") - min_msg_size = rlerror.min_size(ver) - ret += f'\t[{c9util.ver_enum(ver)}] = {{.name="{ver}", .min_msg_size={min_msg_size}}},\n' + min_rerror_size = rlerror.min_size(ver) + min_rread_size = rread.min_size(ver) + ret += f'\t[{c9util.ver_enum(ver)}] = {{.name="{ver}", .min_Rerror_size={min_rerror_size}, .min_Rread_size={min_rread_size}}},\n' ret += cutil.ifdef_pop(0) ret += "};\n" diff --git a/lib9p/core_gen/c_marshal.py b/lib9p/core_gen/c_marshal.py index 620bdea..322e1ef 100644 --- a/lib9p/core_gen/c_marshal.py +++ b/lib9p/core_gen/c_marshal.py @@ -370,21 +370,21 @@ def gen_c_marshal(versions: set[str], typs: list[idl.UserType]) -> str: # Pass 1 - check size max_size = max(typ.max_size(v) for v in typ.in_versions) + szbits = 32 if max_size > cutil.UINT32_MAX: # SPECIAL (9P2000.e) - ret += get_offset_expr(typ, go_to_end).gen_c( - "uint64_t", "needed_size", "val->", 1, 0 - ) + szbits = 64 + ret += get_offset_expr(typ, go_to_end).gen_c( + f"uint{szbits}_t", "needed_size", "val->", 1, 0 + ) + if szbits > 32: # SPECIAL (9P2000.e) ret += "\tif (needed_size > (uint64_t)(ctx->max_msg_size)) {\n" else: - ret += get_offset_expr(typ, go_to_end).gen_c( - "uint32_t", "needed_size", "val->", 1, 0 - ) ret += "\tif (needed_size > ctx->max_msg_size) {\n" if isinstance(typ, idl.Message): # SPECIAL (disable for stat) - ret += f'\t\tlib9p_errorf(ctx, {c9util.IDENT("ERRNO_L_ERANGE")}, "%s message too large to marshal into %s limit (limit=%"PRIu32")",\n' + ret += f'\t\tlib9p_errorf(ctx, {c9util.IDENT("ERRNO_L_ERANGE")}, "%s message too large to marshal into %s limit (%"PRIu{szbits}" > %"PRIu32")",\n' ret += f'\t\t\t"{typ.typname}",\n' ret += f'\t\t\tctx->version ? "negotiated" : "{'client' if typ.msgid % 2 == 0 else 'server'}",\n' - ret += "\t\t\tctx->max_msg_size);\n" + ret += "\t\t\tneeded_size, ctx->max_msg_size);\n" ret += "\t\treturn true;\n" ret += "\t}\n" diff --git a/lib9p/core_gen/h.py b/lib9p/core_gen/h.py index ff070c6..3c857c1 100644 --- a/lib9p/core_gen/h.py +++ b/lib9p/core_gen/h.py @@ -201,10 +201,10 @@ def gen_h(versions: set[str], typs: list[idl.UserType]) -> str: enum {c9util.ident('version')} {{ """ - xversions = [ - "unknown = 0", - *sorted(v for v in versions if v != "unknown"), - ] # SPECIAL (initialization) + xversions = [ # SPECIAL (initialization) + "uninitialized = 0", + *sorted(v for v in versions if v != "uninitialized"), + ] verwidth = max(len(v) for v in xversions) for ver in xversions: if ver in versions: diff --git a/lib9p/core_generated.c b/lib9p/core_generated.c index 8539fdf..1de7c67 100644 --- a/lib9p/core_generated.c +++ b/lib9p/core_generated.c @@ -14,35 +14,35 @@ #include "core_utf8.h" /* libobj vtables *************************************************************/ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized LO_IMPLEMENTATION_C(fmt_formatter, lib9p_tag_t, lib9p_tag, static); LO_IMPLEMENTATION_C(fmt_formatter, lib9p_fid_t, lib9p_fid, static); LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_s, lib9p_s, static); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized LO_IMPLEMENTATION_C(fmt_formatter, lib9p_dm_t, lib9p_dm, static); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized LO_IMPLEMENTATION_C(fmt_formatter, lib9p_qt_t, lib9p_qt, static); LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_qid, lib9p_qid, static); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_stat, lib9p_stat, static); LO_IMPLEMENTATION_C(fmt_formatter, lib9p_o_t, lib9p_o, static); #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tversion, lib9p_msg_Tversion, static); LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rversion, lib9p_msg_Rversion, static); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tauth, lib9p_msg_Tauth, static); LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rauth, lib9p_msg_Rauth, static); LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tattach, lib9p_msg_Tattach, static); LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rattach, lib9p_msg_Rattach, static); #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rerror, lib9p_msg_Rerror, static); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tflush, lib9p_msg_Tflush, static); LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rflush, lib9p_msg_Rflush, static); @@ -165,10 +165,10 @@ LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rswrite, lib9p_msg_Rswrite, #else #define _is_ver_9P2000_u(v) false #endif -#if CONFIG_9P_ENABLE_unknown - #define _is_ver_unknown(v) (v == LIB9P_VER_unknown) +#if CONFIG_9P_ENABLE_uninitialized + #define _is_ver_uninitialized(v) (v == LIB9P_VER_uninitialized) #else - #define _is_ver_unknown(v) false + #define _is_ver_uninitialized(v) false #endif /** @@ -184,166 +184,166 @@ LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rswrite, lib9p_msg_Rswrite, #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static const lib9p_dm_t dm_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b11111100000000000000000111111111, + [LIB9P_VER_9P2000] = 0b11111100000000000000000111111111, #endif /* CONFIG_9P_ENABLE_9P2000 */ #if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_L] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b11111100000000000000000111111111, + [LIB9P_VER_9P2000_e] = 0b11111100000000000000000111111111, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b11111100000000000000000111111111, + [LIB9P_VER_9P2000_p9p] = 0b11111100000000000000000111111111, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b11111100101111000000000111111111, + [LIB9P_VER_9P2000_u] = 0b11111100101111000000000111111111, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b11111100000000000000000111111111, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b11111100000000000000000111111111, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static const lib9p_qt_t qt_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b11111100, + [LIB9P_VER_9P2000] = 0b11111100, #endif /* CONFIG_9P_ENABLE_9P2000 */ #if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = 0b11111100, + [LIB9P_VER_9P2000_L] = 0b11111100, #endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b11111100, + [LIB9P_VER_9P2000_e] = 0b11111100, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b11111100, + [LIB9P_VER_9P2000_p9p] = 0b11111100, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b11111110, + [LIB9P_VER_9P2000_u] = 0b11111110, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b11111100, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b11111100, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static const lib9p_o_t o_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b01010011, + [LIB9P_VER_9P2000] = 0b01010011, #endif /* CONFIG_9P_ENABLE_9P2000 */ #if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = 0b00000000, + [LIB9P_VER_9P2000_L] = 0b00000000, #endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b01010011, + [LIB9P_VER_9P2000_e] = 0b01010011, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b01010011, + [LIB9P_VER_9P2000_p9p] = 0b01010011, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b01010011, + [LIB9P_VER_9P2000_u] = 0b01010011, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b00000000, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b00000000, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ #if CONFIG_9P_ENABLE_9P2000_L static const lib9p_lo_t lo_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000 */ - [LIB9P_VER_9P2000_L] = 0b00000000000111111111111111000011, + [LIB9P_VER_9P2000_L] = 0b00000000000111111111111111000011, #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b00000000000000000000000000000000, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; static const lib9p_mode_t mode_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000 */ - [LIB9P_VER_9P2000_L] = 0b00000000000000001111111111111111, + [LIB9P_VER_9P2000_L] = 0b00000000000000001111111111111111, #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b00000000000000000000000000000000, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; static const lib9p_getattr_t getattr_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b0000000000000000000000000000000000000000000000000000000000000000, + [LIB9P_VER_9P2000] = 0b0000000000000000000000000000000000000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000 */ - [LIB9P_VER_9P2000_L] = 0b0000000000000000000000000000000000000000000000000011111111111111, + [LIB9P_VER_9P2000_L] = 0b0000000000000000000000000000000000000000000000000011111111111111, #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b0000000000000000000000000000000000000000000000000000000000000000, + [LIB9P_VER_9P2000_e] = 0b0000000000000000000000000000000000000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b0000000000000000000000000000000000000000000000000000000000000000, + [LIB9P_VER_9P2000_p9p] = 0b0000000000000000000000000000000000000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b0000000000000000000000000000000000000000000000000000000000000000, + [LIB9P_VER_9P2000_u] = 0b0000000000000000000000000000000000000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b0000000000000000000000000000000000000000000000000000000000000000, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b0000000000000000000000000000000000000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; static const lib9p_setattr_t setattr_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000 */ - [LIB9P_VER_9P2000_L] = 0b00000000000000000000000111111111, + [LIB9P_VER_9P2000_L] = 0b00000000000000000000000111111111, #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b00000000000000000000000000000000, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; static const lib9p_lock_flags_t lock_flags_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000 */ - [LIB9P_VER_9P2000_L] = 0b00000000000000000000000000000011, + [LIB9P_VER_9P2000_L] = 0b00000000000000000000000000000011, #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_p9p] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, + [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = 0b00000000000000000000000000000000, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; #endif /* CONFIG_9P_ENABLE_9P2000_L */ @@ -419,7 +419,7 @@ static ssize_t validate_stat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t * } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static ssize_t validate_Tversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) { uint32_t net_offset = 0; ssize_t host_size = sizeof(struct lib9p_msg_Tversion); @@ -454,7 +454,7 @@ static ssize_t validate_Rversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8 return (ssize_t)host_size; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static ssize_t validate_Tauth(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) { uint32_t net_offset = 0; @@ -545,7 +545,7 @@ static ssize_t validate_Rattach(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static ssize_t validate_Rerror(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) { uint32_t net_offset = 0; ssize_t host_size = sizeof(struct lib9p_msg_Rerror); @@ -568,7 +568,7 @@ static ssize_t validate_Rerror(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t return (ssize_t)host_size; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static ssize_t validate_Tflush(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) { uint32_t net_offset = 0; @@ -1965,7 +1965,7 @@ static void unmarshal_stat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_b } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static void unmarshal_Tversion([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) { struct lib9p_msg_Tversion *out = out_buf; [[gnu::unused]] void *extra = &out[1]; @@ -1990,7 +1990,7 @@ static void unmarshal_Rversion([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *n UNMARSHAL_BYTES(ctx, out->version.utf8, out->version.len); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static void unmarshal_Tauth([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) { struct lib9p_msg_Tauth *out = out_buf; @@ -2056,7 +2056,7 @@ static void unmarshal_Rattach([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *ne } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static void unmarshal_Rerror([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) { struct lib9p_msg_Rerror *out = out_buf; [[gnu::unused]] void *extra = &out[1]; @@ -2073,7 +2073,7 @@ static void unmarshal_Rerror([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net #endif /* CONFIG_9P_ENABLE_9P2000_u */ } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static void unmarshal_Tflush([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) { struct lib9p_msg_Tflush *out = out_buf; @@ -3054,14 +3054,14 @@ static bool marshal_stat(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _ } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static bool marshal_Tversion(struct lib9p_ctx *ctx, struct lib9p_msg_Tversion *val, struct _marshal_ret *ret) { uint32_t needed_size = 13 + val->version.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tversion", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3078,10 +3078,10 @@ static bool marshal_Tversion(struct lib9p_ctx *ctx, struct lib9p_msg_Tversion *v static bool marshal_Rversion(struct lib9p_ctx *ctx, struct lib9p_msg_Rversion *val, struct _marshal_ret *ret) { uint32_t needed_size = 13 + val->version.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rversion", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3095,7 +3095,7 @@ static bool marshal_Rversion(struct lib9p_ctx *ctx, struct lib9p_msg_Rversion *v return false; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, struct _marshal_ret *ret) { uint32_t needed_size = 15 + val->uname.len + val->aname.len; @@ -3105,10 +3105,10 @@ static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, st } #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tauth", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3132,10 +3132,10 @@ static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, st static bool marshal_Rauth(struct lib9p_ctx *ctx, struct lib9p_msg_Rauth *val, struct _marshal_ret *ret) { uint32_t needed_size = 20; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rauth", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3157,10 +3157,10 @@ static bool marshal_Tattach(struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *val } #endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tattach", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3185,10 +3185,10 @@ static bool marshal_Tattach(struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *val static bool marshal_Rattach(struct lib9p_ctx *ctx, struct lib9p_msg_Rattach *val, struct _marshal_ret *ret) { uint32_t needed_size = 20; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rattach", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3203,7 +3203,7 @@ static bool marshal_Rattach(struct lib9p_ctx *ctx, struct lib9p_msg_Rattach *val } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val, struct _marshal_ret *ret) { uint32_t needed_size = 9 + val->errstr.len; #if CONFIG_9P_ENABLE_9P2000_u @@ -3212,10 +3212,10 @@ static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val, } #endif /* CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rerror", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3233,15 +3233,15 @@ static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val, return false; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static bool marshal_Tflush(struct lib9p_ctx *ctx, struct lib9p_msg_Tflush *val, struct _marshal_ret *ret) { uint32_t needed_size = 9; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tflush", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3256,10 +3256,10 @@ static bool marshal_Tflush(struct lib9p_ctx *ctx, struct lib9p_msg_Tflush *val, static bool marshal_Rflush(struct lib9p_ctx *ctx, struct lib9p_msg_Rflush *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rflush", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3276,10 +3276,10 @@ static bool marshal_Twalk(struct lib9p_ctx *ctx, struct lib9p_msg_Twalk *val, st needed_size += 2 + val->wname[i].len; } if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Twalk", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3300,10 +3300,10 @@ static bool marshal_Twalk(struct lib9p_ctx *ctx, struct lib9p_msg_Twalk *val, st static bool marshal_Rwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rwalk *val, struct _marshal_ret *ret) { uint32_t needed_size = 9 + (val->nwqid)*13; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rwalk", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3325,10 +3325,10 @@ static bool marshal_Rwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rwalk *val, st static bool marshal_Topen(struct lib9p_ctx *ctx, struct lib9p_msg_Topen *val, struct _marshal_ret *ret) { uint32_t needed_size = 12; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Topen", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3344,10 +3344,10 @@ static bool marshal_Topen(struct lib9p_ctx *ctx, struct lib9p_msg_Topen *val, st static bool marshal_Ropen(struct lib9p_ctx *ctx, struct lib9p_msg_Ropen *val, struct _marshal_ret *ret) { uint32_t needed_size = 24; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Ropen", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3365,10 +3365,10 @@ static bool marshal_Ropen(struct lib9p_ctx *ctx, struct lib9p_msg_Ropen *val, st static bool marshal_Tcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tcreate *val, struct _marshal_ret *ret) { uint32_t needed_size = 18 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tcreate", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3387,10 +3387,10 @@ static bool marshal_Tcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tcreate *val static bool marshal_Rcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rcreate *val, struct _marshal_ret *ret) { uint32_t needed_size = 24; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rcreate", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3410,10 +3410,10 @@ static bool marshal_Rcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rcreate *val static bool marshal_Tread(struct lib9p_ctx *ctx, struct lib9p_msg_Tread *val, struct _marshal_ret *ret) { uint32_t needed_size = 23; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tread", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3430,10 +3430,10 @@ static bool marshal_Tread(struct lib9p_ctx *ctx, struct lib9p_msg_Tread *val, st static bool marshal_Rread(struct lib9p_ctx *ctx, struct lib9p_msg_Rread *val, struct _marshal_ret *ret) { uint32_t needed_size = 11 + val->count; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rread", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3449,10 +3449,10 @@ static bool marshal_Rread(struct lib9p_ctx *ctx, struct lib9p_msg_Rread *val, st static bool marshal_Twrite(struct lib9p_ctx *ctx, struct lib9p_msg_Twrite *val, struct _marshal_ret *ret) { uint32_t needed_size = 23 + val->count; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Twrite", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3470,10 +3470,10 @@ static bool marshal_Twrite(struct lib9p_ctx *ctx, struct lib9p_msg_Twrite *val, static bool marshal_Rwrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rwrite *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rwrite", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3488,10 +3488,10 @@ static bool marshal_Rwrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rwrite *val, static bool marshal_Tclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Tclunk *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tclunk", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3506,10 +3506,10 @@ static bool marshal_Tclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Tclunk *val, static bool marshal_Rclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Rclunk *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rclunk", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3523,10 +3523,10 @@ static bool marshal_Rclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Rclunk *val, static bool marshal_Tremove(struct lib9p_ctx *ctx, struct lib9p_msg_Tremove *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tremove", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3541,10 +3541,10 @@ static bool marshal_Tremove(struct lib9p_ctx *ctx, struct lib9p_msg_Tremove *val static bool marshal_Rremove(struct lib9p_ctx *ctx, struct lib9p_msg_Rremove *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rremove", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3560,10 +3560,10 @@ static bool marshal_Rremove(struct lib9p_ctx *ctx, struct lib9p_msg_Rremove *val static bool marshal_Tstat(struct lib9p_ctx *ctx, struct lib9p_msg_Tstat *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tstat", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3583,10 +3583,10 @@ static bool marshal_Rstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *val, st } #endif /* CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rstat", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3641,10 +3641,10 @@ static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val, } #endif /* CONFIG_9P_ENABLE_9P2000_u */ if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Twstat", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3695,10 +3695,10 @@ static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val, static bool marshal_Rwstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rwstat *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rwstat", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3714,10 +3714,10 @@ static bool marshal_Rwstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rwstat *val, static bool marshal_Topenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Topenfd *val, struct _marshal_ret *ret) { uint32_t needed_size = 12; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Topenfd", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3733,10 +3733,10 @@ static bool marshal_Topenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Topenfd *val static bool marshal_Ropenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Ropenfd *val, struct _marshal_ret *ret) { uint32_t needed_size = 28; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Ropenfd", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3757,10 +3757,10 @@ static bool marshal_Ropenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Ropenfd *val static bool marshal_Rlerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rlerror *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rlerror", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3775,10 +3775,10 @@ static bool marshal_Rlerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rlerror *val static bool marshal_Tstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Tstatfs *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tstatfs", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3793,10 +3793,10 @@ static bool marshal_Tstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Tstatfs *val static bool marshal_Rstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Rstatfs *val, struct _marshal_ret *ret) { uint32_t needed_size = 67; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rstatfs", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3819,10 +3819,10 @@ static bool marshal_Rstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Rstatfs *val static bool marshal_Tlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Tlopen *val, struct _marshal_ret *ret) { uint32_t needed_size = 15; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tlopen", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3838,10 +3838,10 @@ static bool marshal_Tlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Tlopen *val, static bool marshal_Rlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Rlopen *val, struct _marshal_ret *ret) { uint32_t needed_size = 24; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rlopen", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3859,10 +3859,10 @@ static bool marshal_Rlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Rlopen *val, static bool marshal_Tlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tlcreate *val, struct _marshal_ret *ret) { uint32_t needed_size = 25 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tlcreate", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3882,10 +3882,10 @@ static bool marshal_Tlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tlcreate *v static bool marshal_Rlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rlcreate *val, struct _marshal_ret *ret) { uint32_t needed_size = 24; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rlcreate", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3903,10 +3903,10 @@ static bool marshal_Rlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rlcreate *v static bool marshal_Tsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tsymlink *val, struct _marshal_ret *ret) { uint32_t needed_size = 19 + val->name.len + val->symtgt.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tsymlink", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3926,10 +3926,10 @@ static bool marshal_Tsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tsymlink *v static bool marshal_Rsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rsymlink *val, struct _marshal_ret *ret) { uint32_t needed_size = 20; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rsymlink", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3946,10 +3946,10 @@ static bool marshal_Rsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rsymlink *v static bool marshal_Tmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Tmknod *val, struct _marshal_ret *ret) { uint32_t needed_size = 29 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tmknod", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3970,10 +3970,10 @@ static bool marshal_Tmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Tmknod *val, static bool marshal_Rmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Rmknod *val, struct _marshal_ret *ret) { uint32_t needed_size = 20; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rmknod", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -3990,10 +3990,10 @@ static bool marshal_Rmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Rmknod *val, static bool marshal_Trename(struct lib9p_ctx *ctx, struct lib9p_msg_Trename *val, struct _marshal_ret *ret) { uint32_t needed_size = 17 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Trename", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4011,10 +4011,10 @@ static bool marshal_Trename(struct lib9p_ctx *ctx, struct lib9p_msg_Trename *val static bool marshal_Rrename(struct lib9p_ctx *ctx, struct lib9p_msg_Rrename *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rrename", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4028,10 +4028,10 @@ static bool marshal_Rrename(struct lib9p_ctx *ctx, struct lib9p_msg_Rrename *val static bool marshal_Treadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Treadlink *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Treadlink", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4046,10 +4046,10 @@ static bool marshal_Treadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Treadlink static bool marshal_Rreadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rreadlink *val, struct _marshal_ret *ret) { uint32_t needed_size = 9 + val->target.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rreadlink", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4065,10 +4065,10 @@ static bool marshal_Rreadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rreadlink static bool marshal_Tgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetattr *val, struct _marshal_ret *ret) { uint32_t needed_size = 19; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tgetattr", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4084,10 +4084,10 @@ static bool marshal_Tgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetattr *v static bool marshal_Rgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetattr *val, struct _marshal_ret *ret) { uint32_t needed_size = 160; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rgetattr", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4123,10 +4123,10 @@ static bool marshal_Rgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetattr *v static bool marshal_Tsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tsetattr *val, struct _marshal_ret *ret) { uint32_t needed_size = 67; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tsetattr", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4150,10 +4150,10 @@ static bool marshal_Tsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tsetattr *v static bool marshal_Rsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rsetattr *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rsetattr", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4167,10 +4167,10 @@ static bool marshal_Rsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rsetattr *v static bool marshal_Txattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrwalk *val, struct _marshal_ret *ret) { uint32_t needed_size = 17 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Txattrwalk", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4188,10 +4188,10 @@ static bool marshal_Txattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrwal static bool marshal_Rxattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrwalk *val, struct _marshal_ret *ret) { uint32_t needed_size = 15; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rxattrwalk", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4206,10 +4206,10 @@ static bool marshal_Rxattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrwal static bool marshal_Txattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrcreate *val, struct _marshal_ret *ret) { uint32_t needed_size = 25 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Txattrcreate", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4228,10 +4228,10 @@ static bool marshal_Txattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrc static bool marshal_Rxattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrcreate *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rxattrcreate", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4245,10 +4245,10 @@ static bool marshal_Rxattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrc static bool marshal_Treaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Treaddir *val, struct _marshal_ret *ret) { uint32_t needed_size = 23; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Treaddir", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4265,10 +4265,10 @@ static bool marshal_Treaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Treaddir *v static bool marshal_Rreaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Rreaddir *val, struct _marshal_ret *ret) { uint64_t needed_size = 11 + val->count; if (needed_size > (uint64_t)(ctx->max_msg_size)) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu64" > %"PRIu32")", "Rreaddir", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = (uint32_t)needed_size; @@ -4284,10 +4284,10 @@ static bool marshal_Rreaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Rreaddir *v static bool marshal_Tfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Tfsync *val, struct _marshal_ret *ret) { uint32_t needed_size = 15; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tfsync", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4303,10 +4303,10 @@ static bool marshal_Tfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Tfsync *val, static bool marshal_Rfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Rfsync *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rfsync", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4320,10 +4320,10 @@ static bool marshal_Rfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Rfsync *val, static bool marshal_Tlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tlock *val, struct _marshal_ret *ret) { uint32_t needed_size = 38 + val->client_id.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tlock", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4345,10 +4345,10 @@ static bool marshal_Tlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tlock *val, st static bool marshal_Rlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rlock *val, struct _marshal_ret *ret) { uint32_t needed_size = 8; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rlock", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4363,10 +4363,10 @@ static bool marshal_Rlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rlock *val, st static bool marshal_Tgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetlock *val, struct _marshal_ret *ret) { uint32_t needed_size = 34 + val->client_id.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tgetlock", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4387,10 +4387,10 @@ static bool marshal_Tgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetlock *v static bool marshal_Rgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetlock *val, struct _marshal_ret *ret) { uint32_t needed_size = 30 + val->client_id.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rgetlock", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4410,10 +4410,10 @@ static bool marshal_Rgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetlock *v static bool marshal_Tlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tlink *val, struct _marshal_ret *ret) { uint32_t needed_size = 17 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tlink", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4431,10 +4431,10 @@ static bool marshal_Tlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tlink *val, st static bool marshal_Rlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rlink *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rlink", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4448,10 +4448,10 @@ static bool marshal_Rlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rlink *val, st static bool marshal_Tmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Tmkdir *val, struct _marshal_ret *ret) { uint32_t needed_size = 21 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tmkdir", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4470,10 +4470,10 @@ static bool marshal_Tmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Tmkdir *val, static bool marshal_Rmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Rmkdir *val, struct _marshal_ret *ret) { uint32_t needed_size = 20; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rmkdir", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4490,10 +4490,10 @@ static bool marshal_Rmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Rmkdir *val, static bool marshal_Trenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Trenameat *val, struct _marshal_ret *ret) { uint32_t needed_size = 19 + val->oldname.len + val->newname.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Trenameat", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4513,10 +4513,10 @@ static bool marshal_Trenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Trenameat static bool marshal_Rrenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Rrenameat *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rrenameat", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4530,10 +4530,10 @@ static bool marshal_Rrenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Rrenameat static bool marshal_Tunlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Tunlinkat *val, struct _marshal_ret *ret) { uint32_t needed_size = 17 + val->name.len; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tunlinkat", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4551,10 +4551,10 @@ static bool marshal_Tunlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Tunlinkat static bool marshal_Runlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Runlinkat *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Runlinkat", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4570,10 +4570,10 @@ static bool marshal_Runlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Runlinkat static bool marshal_Tsession(struct lib9p_ctx *ctx, struct lib9p_msg_Tsession *val, struct _marshal_ret *ret) { uint32_t needed_size = 15; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Tsession", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4588,10 +4588,10 @@ static bool marshal_Tsession(struct lib9p_ctx *ctx, struct lib9p_msg_Tsession *v static bool marshal_Rsession(struct lib9p_ctx *ctx, struct lib9p_msg_Rsession *val, struct _marshal_ret *ret) { uint32_t needed_size = 7; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rsession", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4608,10 +4608,10 @@ static bool marshal_Tsread(struct lib9p_ctx *ctx, struct lib9p_msg_Tsread *val, needed_size += 2 + val->wname[i].len; } if (needed_size > (uint64_t)(ctx->max_msg_size)) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu64" > %"PRIu32")", "Tsread", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = (uint32_t)needed_size; @@ -4631,10 +4631,10 @@ static bool marshal_Tsread(struct lib9p_ctx *ctx, struct lib9p_msg_Tsread *val, static bool marshal_Rsread(struct lib9p_ctx *ctx, struct lib9p_msg_Rsread *val, struct _marshal_ret *ret) { uint64_t needed_size = 11 + val->count; if (needed_size > (uint64_t)(ctx->max_msg_size)) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu64" > %"PRIu32")", "Rsread", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = (uint32_t)needed_size; @@ -4653,10 +4653,10 @@ static bool marshal_Tswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Tswrite *val needed_size += 2 + val->wname[i].len; } if (needed_size > (uint64_t)(ctx->max_msg_size)) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu64" > %"PRIu32")", "Tswrite", ctx->version ? "negotiated" : "client", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = (uint32_t)needed_size; @@ -4678,10 +4678,10 @@ static bool marshal_Tswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Tswrite *val static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val, struct _marshal_ret *ret) { uint32_t needed_size = 11; if (needed_size > ctx->max_msg_size) { - lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")", + lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")", "Rswrite", ctx->version ? "negotiated" : "server", - ctx->max_msg_size); + needed_size, ctx->max_msg_size); return true; } uint32_t offsetof_end = needed_size; @@ -4696,7 +4696,7 @@ static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val /* *_format *******************************************************************/ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static void lib9p_tag_format(lib9p_tag_t *self, struct fmt_state *state) { switch (*self) { case LIB9P_TAG_NOTAG: @@ -4725,8 +4725,8 @@ static void lib9p_s_format(struct lib9p_s *self, struct fmt_state *state) { #pragma GCC diagnostic pop } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static void lib9p_dm_format(lib9p_dm_t *self, struct fmt_state *state) { bool empty = true; fmt_state_putchar(state, '('); @@ -4928,8 +4928,8 @@ static void lib9p_dm_format(lib9p_dm_t *self, struct fmt_state *state) { fmt_state_putchar(state, ')'); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static void lib9p_qt_format(lib9p_qt_t *self, struct fmt_state *state) { bool empty = true; fmt_state_putchar(state, '('); @@ -4997,7 +4997,7 @@ static void lib9p_qid_format(struct lib9p_qid *self, struct fmt_state *state) { fmt_state_puts(state, " }"); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #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, '{'); @@ -5112,7 +5112,7 @@ static void lib9p_o_format(lib9p_o_t *self, struct fmt_state *state) { } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static void lib9p_msg_Tversion_format(struct lib9p_msg_Tversion *self, struct fmt_state *state) { fmt_state_puts(state, "Tversion {"); fmt_state_puts(state, " tag="); @@ -5135,7 +5135,7 @@ static void lib9p_msg_Rversion_format(struct lib9p_msg_Rversion *self, struct fm fmt_state_puts(state, " }"); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static void lib9p_msg_Tauth_format(struct lib9p_msg_Tauth *self, struct fmt_state *state) { fmt_state_puts(state, "Tauth {"); @@ -5192,7 +5192,7 @@ static void lib9p_msg_Rattach_format(struct lib9p_msg_Rattach *self, struct fmt_ } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized static void lib9p_msg_Rerror_format(struct lib9p_msg_Rerror *self, struct fmt_state *state) { fmt_state_puts(state, "Rerror {"); fmt_state_puts(state, " tag="); @@ -5206,7 +5206,7 @@ static void lib9p_msg_Rerror_format(struct lib9p_msg_Rerror *self, struct fmt_st fmt_state_puts(state, " }"); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u static void lib9p_msg_Tflush_format(struct lib9p_msg_Tflush *self, struct fmt_state *state) { fmt_state_puts(state, "Tflush {"); @@ -7851,23 +7851,23 @@ static void lib9p_msg_Rswrite_format(struct lib9p_msg_Rswrite *self, struct fmt_ const struct _lib9p_ver_tentry _lib9p_table_ver[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = {.name="9P2000", .min_msg_size=9}, + [LIB9P_VER_9P2000] = {.name="9P2000", .min_Rerror_size=9, .min_Rread_size=11}, #endif /* CONFIG_9P_ENABLE_9P2000 */ #if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = {.name="9P2000.L", .min_msg_size=11}, + [LIB9P_VER_9P2000_L] = {.name="9P2000.L", .min_Rerror_size=11, .min_Rread_size=11}, #endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = {.name="9P2000.e", .min_msg_size=9}, + [LIB9P_VER_9P2000_e] = {.name="9P2000.e", .min_Rerror_size=9, .min_Rread_size=11}, #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - [LIB9P_VER_9P2000_p9p] = {.name="9P2000.p9p", .min_msg_size=9}, + [LIB9P_VER_9P2000_p9p] = {.name="9P2000.p9p", .min_Rerror_size=9, .min_Rread_size=11}, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = {.name="9P2000.u", .min_msg_size=13}, + [LIB9P_VER_9P2000_u] = {.name="9P2000.u", .min_Rerror_size=13, .min_Rread_size=11}, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = {.name="unknown", .min_msg_size=9}, -#endif /* CONFIG_9P_ENABLE_unknown */ +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = {.name="uninitialized", .min_Rerror_size=9, .min_Rread_size=0}, +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; #define _MSG(typ) [LIB9P_TYP_##typ] = { \ @@ -8068,13 +8068,13 @@ const struct _lib9p_msg_tentry _lib9p_table_msg[LIB9P_VER_NUM][0x100] = { _MSG(Rwstat), }, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = { +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = { _MSG(Tversion), _MSG(Rversion), _MSG(Rerror), }, -#endif /* CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; #define _MSG_RECV(typ) [LIB9P_TYP_##typ/2] = { \ @@ -8190,11 +8190,11 @@ const struct _lib9p_recv_tentry _lib9p_table_Tmsg_recv[LIB9P_VER_NUM][0x80] = { _MSG_RECV(Twstat), }, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = { +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = { _MSG_RECV(Tversion), }, -#endif /* CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; const struct _lib9p_recv_tentry _lib9p_table_Rmsg_recv[LIB9P_VER_NUM][0x80] = { @@ -8307,12 +8307,12 @@ const struct _lib9p_recv_tentry _lib9p_table_Rmsg_recv[LIB9P_VER_NUM][0x80] = { _MSG_RECV(Rwstat), }, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = { +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = { _MSG_RECV(Rversion), _MSG_RECV(Rerror), }, -#endif /* CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; const struct _lib9p_send_tentry _lib9p_table_Tmsg_send[LIB9P_VER_NUM][0x80] = { @@ -8420,11 +8420,11 @@ const struct _lib9p_send_tentry _lib9p_table_Tmsg_send[LIB9P_VER_NUM][0x80] = { _MSG_SEND(Twstat), }, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = { +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = { _MSG_SEND(Tversion), }, -#endif /* CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; const struct _lib9p_send_tentry _lib9p_table_Rmsg_send[LIB9P_VER_NUM][0x80] = { @@ -8537,12 +8537,12 @@ const struct _lib9p_send_tentry _lib9p_table_Rmsg_send[LIB9P_VER_NUM][0x80] = { _MSG_SEND(Rwstat), }, #endif /* CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_unknown - [LIB9P_VER_unknown] = { +#if CONFIG_9P_ENABLE_uninitialized + [LIB9P_VER_uninitialized] = { _MSG_SEND(Rversion), _MSG_SEND(Rerror), }, -#endif /* CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_uninitialized */ }; #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u diff --git a/lib9p/core_include/lib9p/_core_generated.h b/lib9p/core_include/lib9p/_core_generated.h index 4c45b58..9e6366f 100644 --- a/lib9p/core_include/lib9p/_core_generated.h +++ b/lib9p/core_include/lib9p/_core_generated.h @@ -40,8 +40,8 @@ #error config.h must define CONFIG_9P_ENABLE_9P2000_u #endif -#ifndef CONFIG_9P_ENABLE_unknown - #error config.h must define CONFIG_9P_ENABLE_unknown +#ifndef CONFIG_9P_ENABLE_uninitialized + #error config.h must define CONFIG_9P_ENABLE_uninitialized #endif #define _LIB9P_ENABLE_stat CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u @@ -49,21 +49,21 @@ /* enum version ***************************************************************/ enum lib9p_version { - LIB9P_VER_unknown = 0, /* "unknown" */ + LIB9P_VER_uninitialized = 0, /* "uninitialized" */ #if CONFIG_9P_ENABLE_9P2000 - LIB9P_VER_9P2000, /* "9P2000" */ + LIB9P_VER_9P2000, /* "9P2000" */ #endif /* CONFIG_9P_ENABLE_9P2000 */ #if CONFIG_9P_ENABLE_9P2000_L - LIB9P_VER_9P2000_L, /* "9P2000.L" */ + LIB9P_VER_9P2000_L, /* "9P2000.L" */ #endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e - LIB9P_VER_9P2000_e, /* "9P2000.e" */ + LIB9P_VER_9P2000_e, /* "9P2000.e" */ #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000_p9p - LIB9P_VER_9P2000_p9p, /* "9P2000.p9p" */ + LIB9P_VER_9P2000_p9p, /* "9P2000.p9p" */ #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ #if CONFIG_9P_ENABLE_9P2000_u - LIB9P_VER_9P2000_u, /* "9P2000.u" */ + LIB9P_VER_9P2000_u, /* "9P2000.u" */ #endif /* CONFIG_9P_ENABLE_9P2000_u */ LIB9P_VER_NUM, }; @@ -117,19 +117,19 @@ enum lib9p_msg_type { /* uint8_t */ LIB9P_TYP_Topenfd = 98, LIB9P_TYP_Ropenfd = 99, #endif /* CONFIG_9P_ENABLE_9P2000_p9p */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized LIB9P_TYP_Tversion = 100, LIB9P_TYP_Rversion = 101, -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u LIB9P_TYP_Tauth = 102, LIB9P_TYP_Rauth = 103, LIB9P_TYP_Tattach = 104, LIB9P_TYP_Rattach = 105, #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized LIB9P_TYP_Rerror = 107, -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u LIB9P_TYP_Tflush = 108, LIB9P_TYP_Rflush = 109, @@ -171,7 +171,7 @@ LO_IMPLEMENTATION_H(fmt_formatter, enum lib9p_msg_type, lib9p_msg_type); /* payload types **************************************************************/ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized /* size = 2 ; max_iov = 1 ; max_copy = 2 */ typedef uint16_t lib9p_tag_t; LO_IMPLEMENTATION_H(fmt_formatter, lib9p_tag_t, lib9p_tag); @@ -182,8 +182,8 @@ typedef uint32_t lib9p_fid_t; LO_IMPLEMENTATION_H(fmt_formatter, lib9p_fid_t, lib9p_fid); #define LIB9P_FID_NOFID ((lib9p_fid_t)(UINT32_MAX)) -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized /* size = 4 ; max_iov = 1 ; max_copy = 4 */ typedef uint32_t lib9p_dm_t; LO_IMPLEMENTATION_H(fmt_formatter, lib9p_dm_t, lib9p_dm); @@ -227,8 +227,8 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_dm_t, lib9p_dm); /* masks */ #define LIB9P_DM_PERM_MASK ((lib9p_dm_t)(0b000000000000000000000111111111)) -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized /* size = 1 ; max_iov = 1 ; max_copy = 1 */ typedef uint8_t lib9p_qt_t; LO_IMPLEMENTATION_H(fmt_formatter, lib9p_qt_t, lib9p_qt); @@ -246,7 +246,7 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_qt_t, lib9p_qt); /* aliases */ #define LIB9P_QT_FILE ((lib9p_qt_t)(0)) -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u /* size = 1 ; max_iov = 1 ; max_copy = 1 */ typedef uint8_t lib9p_o_t; @@ -693,7 +693,7 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_status_t, lib9p_lock_status); #define LIB9P_LOCK_STATUS_GRACE ((lib9p_lock_status_t)(3)) #endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized /* min_size = 2 ; exp_size = 29 ; max_size = 65,537 ; max_iov = 2 ; max_copy = 2 */ struct lib9p_s { uint16_t len; @@ -709,7 +709,7 @@ struct lib9p_qid { }; LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_qid, lib9p_qid); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u /* size = 9 ; max_iov = 1 ; max_copy = 9 */ struct lib9p_msg_Tflush { @@ -1030,7 +1030,7 @@ struct lib9p_stat { LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_stat, lib9p_stat); #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized /* min_size = 13 ; exp_size = 40 ; max_size = 65,548 ; max_iov = 2 ; max_copy = 13 */ struct lib9p_msg_Tversion { lib9p_tag_t tag; @@ -1047,7 +1047,7 @@ struct lib9p_msg_Rversion { }; LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rversion, lib9p_msg_Rversion); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u /* LIB9P_VER_9P2000 : min_size = 15 ; exp_size = 69 ; max_size = 131,085 ; max_iov = 4 ; max_copy = 15 */ /* LIB9P_VER_9P2000_L : min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 5 ; max_copy = 19 */ @@ -1097,12 +1097,12 @@ struct lib9p_msg_Rattach { LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rattach, lib9p_msg_Rattach); #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown -/* LIB9P_VER_9P2000 : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -/* LIB9P_VER_9P2000_e : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -/* LIB9P_VER_9P2000_p9p: min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ -/* LIB9P_VER_9P2000_u : min_size = 13 ; exp_size = 40 ; max_size = 65,548 ; max_iov = 3 ; max_copy = 13 */ -/* LIB9P_VER_unknown : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized +/* LIB9P_VER_9P2000 : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ +/* LIB9P_VER_9P2000_e : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ +/* LIB9P_VER_9P2000_p9p : min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ +/* LIB9P_VER_9P2000_u : min_size = 13 ; exp_size = 40 ; max_size = 65,548 ; max_iov = 3 ; max_copy = 13 */ +/* LIB9P_VER_uninitialized: min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */ struct lib9p_msg_Rerror { lib9p_tag_t tag; struct lib9p_s errstr; @@ -1112,7 +1112,7 @@ struct lib9p_msg_Rerror { }; LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rerror, lib9p_msg_Rerror); -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_unknown */ +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u /* min_size = 17 ; exp_size = 481 ; max_size = 1,048,609 ; max_iov = 32 ; max_copy = 49 */ struct lib9p_msg_Twalk { @@ -1434,7 +1434,7 @@ LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat); #else #define LIB9P_TMSG_MAX_IOV 32 #endif -#elif CONFIG_9P_ENABLE_unknown +#elif CONFIG_9P_ENABLE_uninitialized #define LIB9P_TMSG_MAX_IOV 2 #endif @@ -1456,7 +1456,7 @@ LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat); #else #define LIB9P_TMSG_MAX_COPY 62 #endif -#elif CONFIG_9P_ENABLE_unknown +#elif CONFIG_9P_ENABLE_uninitialized #define LIB9P_TMSG_MAX_COPY 13 #endif @@ -1464,13 +1464,13 @@ LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat); #define LIB9P_RMSG_MAX_IOV 11 #elif CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p #define LIB9P_RMSG_MAX_IOV 8 -#elif CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_unknown +#elif CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_uninitialized #define LIB9P_RMSG_MAX_IOV 2 #endif #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u #define LIB9P_RMSG_MAX_COPY 217 -#elif CONFIG_9P_ENABLE_unknown +#elif CONFIG_9P_ENABLE_uninitialized #define LIB9P_RMSG_MAX_COPY 13 #endif diff --git a/lib9p/core_include/lib9p/core.h b/lib9p/core_include/lib9p/core.h index 38f3934..549411f 100644 --- a/lib9p/core_include/lib9p/core.h +++ b/lib9p/core_include/lib9p/core.h @@ -12,7 +12,7 @@ #include <libmisc/assert.h> -#define CONFIG_9P_ENABLE_unknown 1 +#define CONFIG_9P_ENABLE_uninitialized 1 #include <lib9p/_core_generated.h> #ifndef CONFIG_9P_MAX_ERR_SIZE @@ -56,36 +56,29 @@ void lib9p_ctx_clear_error(struct lib9p_ctx *ctx); bool lib9p_ctx_has_error(struct lib9p_ctx *ctx); -/** Write an static error into ctx, return -1. */ -int lib9p_error(struct lib9p_ctx *ctx, +/* NB: This __VA_ARGS__ definition of lib9p_errorf() is handy because it + * will produce an error if .../__VA_ARGS__ is empty; which means that + * it should be lib9p_error() instead! */ #if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L - lib9p_errno_t linux_errno, -#endif - char const *msg); -/** Write a printf-style error into ctx, return -1. */ -int lib9p_errorf(struct lib9p_ctx *ctx, -#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L - lib9p_errno_t linux_errno, -#endif - char const *fmt, ...) -#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L - [[gnu::format(printf, 3, 4)]] -#else - [[gnu::format(printf, 2, 3)]] -#endif - ; - -#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L -/* Detect things that should be just lib9p_error() */ -#define lib9p_errorf(ctx, errnum, fmt, ...) lib9p_errorf(ctx, errnum, fmt, __VA_ARGS__) + int _lib9p_error(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *msg); + int _lib9p_errorf(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *fmt, ...) [[gnu::format(printf, 3, 4)]]; + /** Write an static error into ctx, return -1. */ + #define lib9p_error(ctx, errnum, errmsg) _lib9p_error(ctx, errnum, errmsg) + /** Write a printf-style error into ctx, return -1. */ + #define lib9p_errorf(ctx, errnum, fmt, ...) _lib9p_errorf(ctx, errnum, fmt, __VA_ARGS__) #else -#define lib9p_errorf(ctx, errnum, fmt, ...) lib9p_errorf(ctx, fmt, __VA_ARGS__) -#define lib9p_error(ctx, errnum, errmsg) lib9p_error(ctx, errmsg) + int _lib9p_error(struct lib9p_ctx *ctx, char const *msg); + int _lib9p_errorf(struct lib9p_ctx *ctx, char const *fmt, ...) [[gnu::format(printf, 2, 3)]]; + /** Write an static error into ctx, return -1. */ + #define lib9p_error(ctx, errnum, errmsg) _lib9p_error(ctx, errmsg) + /** Write a printf-style error into ctx, return -1. */ + #define lib9p_errorf(ctx, errnum, fmt, ...) _lib9p_errorf(ctx, fmt, __VA_ARGS__) #endif /* misc utilities *************************************************************/ -uint32_t lib9p_version_min_msg_size(enum lib9p_version); +uint32_t lib9p_version_min_Rerror_size(enum lib9p_version); +uint32_t lib9p_version_min_Rread_size(enum lib9p_version); lo_interface fmt_formatter lo_box_lib9p_msg_as_fmt_formatter(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body); diff --git a/lib9p/core_tables.c b/lib9p/core_tables.c deleted file mode 100644 index bc452c7..0000000 --- a/lib9p/core_tables.c +++ /dev/null @@ -1,190 +0,0 @@ -/* lib9p/core_tables.c - Access tables of version and message information - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#include <string.h> - -#include <libmisc/endian.h> -#include <libmisc/log.h> /* for const_byte_str() */ - -#include "core_tables.h" - -/* bounds checks **************************************************************/ - -static inline void assert_ver(enum lib9p_version ver) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wtype-limits" - assert(0 <= ver && ver < LIB9P_VER_NUM); -#pragma GCC diagnostic pop -} - -static inline void assert_typ(enum lib9p_msg_type typ) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wtype-limits" - assert(0 <= typ && typ < 0xFF); -#pragma GCC diagnostic pop -} - -/* simple lookups *************************************************************/ - -const char *lib9p_version_str(enum lib9p_version ver) { - assert_ver(ver); - return _lib9p_table_ver[ver].name; -} - -uint32_t lib9p_version_min_msg_size(enum lib9p_version ver) { - assert_ver(ver); - return _lib9p_table_ver[ver].min_msg_size; -} - -const char *lib9p_msgtype_str(enum lib9p_version ver, enum lib9p_msg_type typ) { - assert_ver(ver); - assert_typ(typ); - return _lib9p_table_msg[ver][typ].name ?: const_byte_str(typ); -} - -lo_interface fmt_formatter lo_box_lib9p_msg_as_fmt_formatter(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body) { - assert(ctx); - assert_ver(ctx->version); - assert_typ(typ); - assert(_lib9p_table_msg[ctx->version][typ].box_as_fmt_formatter); - return _lib9p_table_msg[ctx->version][typ].box_as_fmt_formatter(body); -} - -/* main message functions *****************************************************/ - -static -ssize_t _lib9p_validate(uint8_t xxx_low_typ_bit, - const char *xxx_errmsg, - const struct _lib9p_recv_tentry xxx_table[LIB9P_VER_NUM][0x80], - struct lib9p_ctx *ctx, uint8_t *net_bytes) { - assert_ver(ctx->version); - /* Inspect the first 5 bytes ourselves. */ - uint32_t net_size = uint32le_decode(net_bytes); - if (net_size < 5) - return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "message is impossibly short"); - uint8_t typ = net_bytes[4]; - if (typ % 2 != xxx_low_typ_bit) - return lib9p_errorf(ctx, LIB9P_ERRNO_L_EOPNOTSUPP, "%s: message_type=%s", xxx_errmsg, - lib9p_msgtype_str(ctx->version, typ)); - struct _lib9p_recv_tentry tentry = xxx_table[ctx->version][typ/2]; - if (!tentry.validate) - return lib9p_errorf(ctx, LIB9P_ERRNO_L_EOPNOTSUPP, "unknown message type: %s (protocol_version=%s)", - lib9p_msgtype_str(ctx->version, typ), lib9p_version_str(ctx->version)); - - /* Now use the message-type-specific tentry to process the whole thing. */ - return tentry.validate(ctx, net_size, net_bytes); -} - -ssize_t lib9p_Tmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes) { - return _lib9p_validate(0, "expected a T-message but got an R-message", _lib9p_table_Tmsg_recv, - ctx, net_bytes); -} - -ssize_t lib9p_Rmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes) { - return _lib9p_validate(1, "expected an R-message but got a T-message", _lib9p_table_Rmsg_recv, - ctx, net_bytes); -} - -static -void _lib9p_unmarshal(const struct _lib9p_recv_tentry xxx_table[LIB9P_VER_NUM][0x80], - struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_type *ret_typ, void *ret_body) { - assert_ver(ctx->version); - enum lib9p_msg_type typ = net_bytes[4]; - *ret_typ = typ; - struct _lib9p_recv_tentry tentry = xxx_table[ctx->version][typ/2]; - assert(tentry.unmarshal); - - tentry.unmarshal(ctx, net_bytes, ret_body); -} - -void lib9p_Tmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_type *ret_typ, void *ret_body) { - _lib9p_unmarshal(_lib9p_table_Tmsg_recv, - ctx, net_bytes, ret_typ, ret_body); -} - -void lib9p_Rmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_type *ret_typ, void *ret_body) { - _lib9p_unmarshal(_lib9p_table_Rmsg_recv, - ctx, net_bytes, ret_typ, ret_body); -} - -static -bool _lib9p_marshal(const struct _lib9p_send_tentry xxx_table[LIB9P_VER_NUM][0x80], - struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, - size_t *ret_iov_cnt, struct iovec *ret_iov, uint8_t *ret_copied) { - assert_ver(ctx->version); - assert_typ(typ); - struct _marshal_ret ret = { - .net_iov_cnt = 1, - .net_iov = ret_iov, - .net_copied_size = 0, - .net_copied = ret_copied, - }; - struct _lib9p_send_tentry tentry = xxx_table[ctx->version][typ/2]; - assert(tentry.marshal); - - bool ret_erred = tentry.marshal(ctx, body, &ret); - if (ret_iov[ret.net_iov_cnt-1].iov_len == 0) - ret.net_iov_cnt--; - *ret_iov_cnt = ret.net_iov_cnt; - return ret_erred; -} - -bool lib9p_Tmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, - struct lib9p_Tmsg_send_buf *ret) { - assert(typ % 2 == 0); - memset(ret, 0, sizeof(*ret)); - return _lib9p_marshal(_lib9p_table_Tmsg_send, - ctx, typ, body, - &ret->iov_cnt, ret->iov, ret->copied); -} - -bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, - struct lib9p_Rmsg_send_buf *ret) { - assert(typ % 2 == 1); - memset(ret, 0, sizeof(*ret)); - return _lib9p_marshal(_lib9p_table_Rmsg_send, - ctx, typ, body, - &ret->iov_cnt, ret->iov, ret->copied); -} - -/* `struct lib9p_stat` helpers ************************************************/ - -#if _LIB9P_ENABLE_stat -bool lib9p_stat_validate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, - uint32_t *ret_net_size, size_t *ret_host_size) { - ssize_t host_size = _lib9p_stat_validate(ctx, net_size, net_bytes, ret_net_size); - if (host_size < 0) - return true; - if (ret_host_size) - *ret_host_size = (size_t)host_size; - return false; -} - -void lib9p_stat_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - struct lib9p_stat *ret) { - _lib9p_stat_unmarshal(ctx, net_bytes, ret); -} - -uint32_t lib9p_stat_marshal(struct lib9p_ctx *ctx, uint32_t max_net_size, struct lib9p_stat *obj, - uint8_t *ret_bytes) { - struct lib9p_ctx _ctx = *ctx; - _ctx.max_msg_size = max_net_size; - - struct iovec iov = {0}; - struct _marshal_ret ret = { - .net_iov_cnt = 1, - .net_iov = &iov, - .net_copied_size = 0, - .net_copied = ret_bytes, - }; - if (_lib9p_stat_marshal(&_ctx, obj, &ret)) - return 0; - return ret.net_iov[0].iov_len; -} -#endif diff --git a/lib9p/core_tables.h b/lib9p/core_tables.h index 17e9398..da2027a 100644 --- a/lib9p/core_tables.h +++ b/lib9p/core_tables.h @@ -13,7 +13,8 @@ struct _lib9p_ver_tentry { const char *name; - uint32_t min_msg_size; + uint32_t min_Rerror_size; + uint32_t min_Rread_size; }; extern const struct _lib9p_ver_tentry _lib9p_table_ver[LIB9P_VER_NUM]; diff --git a/lib9p/idl/0000-uninitialized.9p b/lib9p/idl/0000-uninitialized.9p index 9319b5e..193cb19 100644 --- a/lib9p/idl/0000-uninitialized.9p +++ b/lib9p/idl/0000-uninitialized.9p @@ -3,7 +3,7 @@ # Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later -version "unknown" +version "uninitialized" # For the actual protocol. from ./2002-9P2000.9p import s, tag diff --git a/lib9p/srv.c b/lib9p/srv.c index 08ccfc3..6d9d992 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -393,10 +393,7 @@ static void srv_respond_error(struct srv_req *req) { struct srv_sess *sess = req->parent_sess; - /* XXX: This assumes that a version's min_msg_size is the - * Rerror overhead. That's true for the current - * implementation of core_gen, but is a sneaky assumption. */ - uint32_t overhead = lib9p_version_min_msg_size(sess->version); + uint32_t overhead = lib9p_version_min_Rerror_size(sess->version); /* Truncate the error-string if necessary to avoid needing to * return LIB9P_ERRNO_L_ERANGE. */ @@ -469,7 +466,7 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) { }; struct srv_sess sess = { .parent_conn = &conn, - .version = LIB9P_VER_unknown, + .version = LIB9P_VER_uninitialized, .max_msg_size = CONFIG_9P_SRV_MAX_MSG_SIZE, .initialized = false, }; @@ -720,7 +717,7 @@ static void handle_Tversion(struct srv_req *ctx, struct lib9p_msg_Tversion *req) { srv_handler_common(ctx, version, req); - enum lib9p_version version = LIB9P_VER_unknown; + enum lib9p_version version = LIB9P_VER_uninitialized; if (req->version.len >= 6 && req->version.utf8[0] == '9' && @@ -748,7 +745,11 @@ static void handle_Tversion(struct srv_req *ctx, #endif } - uint32_t min_msg_size = lib9p_version_min_msg_size(version); + /* XXX: There are good arguments that min_msg_size should be + * something larger than max(rerror.min_size(), + * rread.min_size()+1). */ + uint32_t min_msg_size = _LIB9P_MAX(lib9p_version_min_Rerror_size(ctx->basectx.version), + lib9p_version_min_Rread_size(ctx->basectx.version)+1); if (req->max_msg_size < min_msg_size) { lib9p_errorf(&ctx->basectx, LIB9P_ERRNO_L_EDOM, "requested max_msg_size is less than minimum for %s (%"PRIu32" < %"PRIu32")", @@ -1175,6 +1176,9 @@ static void handle_Tread(struct srv_req *ctx, /* TODO: serialize simultaneous reads to the same FID */ + if (req->count > ctx->basectx.max_msg_size - lib9p_version_min_Rread_size(ctx->basectx.version)) + req->count = ctx->basectx.max_msg_size - lib9p_version_min_Rread_size(ctx->basectx.version); + /* Check that the FID is valid for this. */ struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { @@ -1205,7 +1209,7 @@ static void handle_Tread(struct srv_req *ctx, goto tread_return; } /* Read. */ - resp.data = heap = malloc(req->count); /* TODO: cap req->count */ + resp.data = heap = malloc(req->count); resp.count = 0; struct srv_pathinfo *dir_pathinfo = NULL; for (;;) { diff --git a/lib9p/srv_include/lib9p/srv.h b/lib9p/srv_include/lib9p/srv.h index c72aff5..ca80e7b 100644 --- a/lib9p/srv_include/lib9p/srv.h +++ b/lib9p/srv_include/lib9p/srv.h @@ -121,7 +121,7 @@ lo_interface lib9p_srv_dio; * * FIXME: It would be nice if pread() could return more than 1 iovec. */ -#define lib9p_srv_file_LO_IFACE \ +#define lib9p_srv_file_LO_IFACE /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ \ /* resource management **********************************************/ \ \ /** \ @@ -163,13 +163,13 @@ lo_interface lib9p_srv_dio; \ /* open() for I/O ***************************************************/ \ \ - LO_FUNC(lo_interface lib9p_srv_fio , fopen , struct lib9p_srv_ctx *, \ - bool rd, bool wr, \ - bool trunc) \ - LO_FUNC(lo_interface lib9p_srv_dio , dopen , struct lib9p_srv_ctx *) -LO_INTERFACE(lib9p_srv_file); + LO_FUNC(lo_interface lib9p_srv_fio , fopen , struct lib9p_srv_ctx *, \ + bool rd, bool wr, \ + bool trunc) \ + LO_FUNC(lo_interface lib9p_srv_dio , dopen , struct lib9p_srv_ctx *) +LO_INTERFACE(lib9p_srv_file); /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ -#define lib9p_srv_fio_LO_IFACE \ +#define lib9p_srv_fio_LO_IFACE /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ \ LO_FUNC(struct lib9p_qid , qid ) \ LO_FUNC(void , iofree ) \ LO_FUNC(uint32_t , iounit ) \ @@ -185,19 +185,19 @@ LO_INTERFACE(lib9p_srv_file); void *buf, \ uint32_t byte_count, \ uint64_t byte_offset) -LO_INTERFACE(lib9p_srv_fio); +LO_INTERFACE(lib9p_srv_fio); /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ -#define lib9p_srv_dio_LO_IFACE \ +#define lib9p_srv_dio_LO_IFACE /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ \ LO_FUNC(struct lib9p_qid , qid ) \ LO_FUNC(void , iofree ) \ /** \ * Return the idx-th dirent. idx will always be either 0 or \ - * prev_idx+1. A dirrent with an empty name signals EOF. The string + * prev_idx+1. A dirrent with an empty name signals EOF. The string \ * must remain valid until the next dread() call or iofree(). \ */ \ LO_FUNC(struct lib9p_srv_dirent , dread , struct lib9p_srv_ctx *, \ size_t idx) -LO_INTERFACE(lib9p_srv_dio); +LO_INTERFACE(lib9p_srv_dio); /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ #define LIB9P_SRV_NOTDIR(TYP, NAM) \ static lo_interface lib9p_srv_file NAM##_dwalk (TYP *, struct lib9p_srv_ctx *, struct lib9p_s) { assert_notreached("not a directory"); } \ |