summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-aux/measurestack/app_main.py4
-rw-r--r--build-aux/measurestack/app_plugins.py14
-rw-r--r--build-aux/measurestack/test_app_plugins.py101
-rw-r--r--lib9p/CMakeLists.txt1
-rw-r--r--lib9p/core.c90
-rw-r--r--lib9p/core_gen/c.py19
-rw-r--r--lib9p/core_gen/c_fmt_print.py (renamed from lib9p/core_gen/c_format.py)96
-rw-r--r--lib9p/core_gen/c_marshal.py7
-rw-r--r--lib9p/core_gen/c_validate.py20
-rw-r--r--lib9p/core_gen/h.py10
-rw-r--r--lib9p/core_generated.c5047
-rw-r--r--lib9p/core_include/lib9p/_core_generated.h100
-rw-r--r--lib9p/core_include/lib9p/core.h42
-rw-r--r--lib9p/core_tables.h6
-rw-r--r--lib9p/srv.c109
-rw-r--r--lib9p/tests/test_server/main.c34
16 files changed, 2524 insertions, 3176 deletions
diff --git a/build-aux/measurestack/app_main.py b/build-aux/measurestack/app_main.py
index c5b5a79..69247ed 100644
--- a/build-aux/measurestack/app_main.py
+++ b/build-aux/measurestack/app_main.py
@@ -28,7 +28,7 @@ def main(
# sbc-harness ####################################################
libmisc_plugin = app_plugins.LibMiscPlugin(arg_c_fnames)
- lib9p_plugin = app_plugins.Lib9PPlugin(arg_base_dir, arg_c_fnames, libmisc_plugin)
+ lib9p_plugin = app_plugins.Lib9PPlugin(arg_base_dir, arg_c_fnames)
def sbc_is_thread(name: QName) -> int:
if str(name).endswith("_cr") and name.base() != BaseName("lib9p_srv_read_cr"):
@@ -48,7 +48,7 @@ def main(
plugins += [
app_plugins.CmdPlugin(),
libmisc_plugin,
- app_plugins.PicoFmtPlugin(arg_pico_platform, lib9p_plugin.formatters),
+ app_plugins.PicoFmtPlugin(arg_pico_platform, []),
app_plugins.LibHWPlugin(arg_pico_platform, libmisc_plugin),
app_plugins.LibCRPlugin(),
app_plugins.LibCRIPCPlugin(),
diff --git a/build-aux/measurestack/app_plugins.py b/build-aux/measurestack/app_plugins.py
index 8009c0c..26eb66d 100644
--- a/build-aux/measurestack/app_plugins.py
+++ b/build-aux/measurestack/app_plugins.py
@@ -260,20 +260,12 @@ class Lib9PPlugin:
lib9p_msgs: set[str]
_CONFIG_9P_MAX_CONNS: int | None
_CONFIG_9P_MAX_REQS: int | None
- formatters: typing.Collection[BaseName]
def __init__(
self,
arg_base_dir: str,
arg_c_fnames: typing.Collection[str],
- libmisc_plugin: LibMiscPlugin,
) -> None:
- self.formatters = {
- x.base()
- for x in libmisc_plugin.objcalls["format"]
- if str(x.base()).startswith("lib9p_")
- }
-
# Find filenames #######################################################
def _is_config_h(fname: str) -> bool:
@@ -347,7 +339,7 @@ class Lib9PPlugin:
re_table_call = re.compile(
r"\s*_lib9p_(?P<meth>validate|unmarshal|marshal)\(.*(?P<grp>[RT])msg.*\);\s*"
)
- re_print_call = re.compile(r".*lib9p_table_msg.*\.box_as_fmt_formatter\(.*")
+ re_print_call = re.compile(r".*lib9p_table_msg.*\.print\(.*")
def indirect_callees(
self, loc: str, line: str
@@ -366,9 +358,7 @@ class Lib9PPlugin:
], True
if self.re_print_call.fullmatch(line):
# Functions for disabled protocol extensions will be missing.
- return [
- QName(f"lib9p_msg_{msg}_format") for msg in self.lib9p_msgs
- ], True
+ return [QName(f"fmt_print_{msg}") for msg in self.lib9p_msgs], True
if "lib9p/srv.c:" in loc:
if "srv->msglog(" in line:
# Actual ROMs shouldn't set this, and so will be missing on rp2040 builds.
diff --git a/build-aux/measurestack/test_app_plugins.py b/build-aux/measurestack/test_app_plugins.py
index 808d55a..3e281b7 100644
--- a/build-aux/measurestack/test_app_plugins.py
+++ b/build-aux/measurestack/test_app_plugins.py
@@ -8,7 +8,7 @@
import typing
from . import analyze, app_plugins, testutil, util
-from .analyze import BaseName, QName
+from .analyze import QName
def test_fct() -> None:
@@ -70,102 +70,3 @@ def test_fct() -> None:
graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("a")].nstatic, exp_a)
graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("b")].nstatic, exp_b)
-
-
-def test_assert_formatter() -> None:
- # _____________________________________________________
- # | |
- # | |
- # | main |
- # | | |
- # | __wrap_vprintf |
- # | | _______________ |
- # | fmt_vfctprintf / \ |
- # | \ fmt_state_printf | |
- # | \____ ____/ | |
- # | \ / | |
- # | _vfctprintf | |
- # | ____/ \____ ^ |
- # | / ?<---snip | |
- # | conv_builtin \ | |
- # | | libfmt_conv_formatter | |
- # | | | | |
- # | \ lib9p_msg_Rread_format | |
- # | \___________ __/ \___________/ |
- # | \ / |
- # | fmt_state_putchar |
- # | | |
- # | stdio_buffered_printer |
- # | |
- # |_____________________________________________________|
- #
- graph: typing.Sequence[tuple[str, typing.Collection[str]]] = [
- ("main", {"vprintf"}),
- ("__wrap_vprintf", {"fmt_vfctprintf"}),
- ("fmt_vfctprintf", {"_vfctprintf"}),
- ("fmt_state_printf", {"_vfctprintf"}),
- ("_vfctprintf", {"conv_builtin", "libfmt_conv_formatter"}),
- ("conv_builtin", {"fmt_state_putchar"}),
- ("libfmt_conv_formatter", {"lib9p_msg_Rread_format"}),
- ("lib9p_msg_Rread_format", {"fmt_state_putchar", "fmt_state_printf"}),
- ("fmt_state_putchar", {"stdio_buffered_printer", "_out_buffer"}),
- ("stdio_buffered_printer", {}),
- ("_out_buffer", {}), # wrong fct
- ]
-
- # 1 2 3 4 5 6 7 8 9 10 11 <= call_depth
- # - main() ; +
- # - __wrap__vprintf() ; +
- # - fmt_vfctprintf() ; +
- # - _vfctprintf() ; +
- # - conv_builtin() ;
- # - fmt_state_putchar() ;
- # - stdio_buffered_printer() ;
- # - libfmt_conv_formatter() ; +
- # - lib9p_msg_Rread_format() ; +
- # - fmt_state_putchar() ;
- # - stdio_buffered_printer() ;
- # - fmt_state_printf() ; +
- # - _vfctprintf() ; +
- # - conv_builtin() ; +
- # - fmt_state_putchar() ; +
- # - stdio_buffered_printer() ; +
- # - libfmt_conv_formatter() ; skip (formatter won't use %v)
- max_call_depth = 11
- exp = [
- "main",
- "__wrap_vprintf",
- "fmt_vfctprintf",
- "_vfctprintf",
- "libfmt_conv_formatter",
- "lib9p_msg_Rread_format",
- "fmt_state_printf",
- "_vfctprintf",
- "conv_builtin",
- "fmt_state_putchar",
- "stdio_buffered_printer",
- ]
-
- graph_plugin = testutil.GraphProviderPlugin(max_call_depth, graph)
-
- plugins: list[util.Plugin] = [
- graph_plugin,
- app_plugins.LibMiscPlugin(arg_c_fnames=[]),
- app_plugins.PicoFmtPlugin("rp2040", [BaseName("lib9p_msg_Rread_format")]),
- ]
-
- def test_filter(name: QName) -> tuple[int, bool]:
- if name.base() == BaseName("main"):
- return 1, True
- return 0, False
-
- result = analyze.analyze(
- ci_fnames=[],
- app_func_filters={
- "Main": test_filter,
- },
- app=util.PluginApplication(testutil.nop_location_xform, plugins),
- cfg_max_call_depth=max_call_depth,
- )
-
- graph_plugin.assert_nstatic(result.groups["Main"].rows[QName("main")].nstatic, exp)
diff --git a/lib9p/CMakeLists.txt b/lib9p/CMakeLists.txt
index cff07ad..2a2f858 100644
--- a/lib9p/CMakeLists.txt
+++ b/lib9p/CMakeLists.txt
@@ -10,7 +10,6 @@ target_sources(lib9p_core INTERFACE
core_generated.c
)
target_link_libraries(lib9p_core INTERFACE
- libfmt
libhw_generic
libmisc
)
diff --git a/lib9p/core.c b/lib9p/core.c
index a44bab6..464b31d 100644
--- a/lib9p/core.c
+++ b/lib9p/core.c
@@ -7,7 +7,6 @@
#include <stdarg.h> /* for va_* */
#include <string.h> /* for strlen(), strnlen(), strncpy(), memcmp(), memset() */
-#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() */
@@ -62,46 +61,6 @@ bool lib9p_ctx_has_error(struct lib9p_ctx *ctx) {
return ctx->err_msg[0];
}
-int _lib9p_error(struct lib9p_ctx *ctx,
-#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
- lib9p_errno_t linux_errno,
-#endif
- char const *msg) {
- if (lib9p_ctx_has_error(ctx))
- return -1;
- strncpy(ctx->err_msg, msg, sizeof(ctx->err_msg));
- ctx->err_msg[sizeof(ctx->err_msg)-1] = '\0';
-
-#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
- ctx->err_num = linux_errno;
-#endif
-
- 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, ...) {
- int n;
- va_list args;
-
- if (lib9p_ctx_has_error(ctx))
- return -1;
- va_start(args, fmt);
- n = fmt_vsnprintf(ctx->err_msg, sizeof(ctx->err_msg), fmt, args);
- va_end(args);
- if ((size_t)(n+1) < sizeof(ctx->err_msg))
- memset(&ctx->err_msg[n+1], 0, sizeof(ctx->err_msg)-(n+1));
-
-#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
- ctx->err_num = linux_errno;
-#endif
-
- return -1;
-}
-
/* bounds checks **************************************************************/
static inline void assert_ver(enum lib9p_version ver) {
@@ -141,33 +100,32 @@ const char *lib9p_msgtype_str(enum lib9p_version ver, enum lib9p_msg_type 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 *****************************************************/
-#define _lib9p_validate(LOW_TYP_BIT, ERRMSG, TABLE) do { \
- 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 != LOW_TYP_BIT) \
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EOPNOTSUPP, ERRMSG ": message_type=%s", \
- lib9p_msgtype_str(ctx->version, typ)); \
- struct _lib9p_recv_tentry tentry = 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); \
+void fmt_print_lib9p_msg(lo_interface fmt_dest w, 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].print);
+ _lib9p_table_msg[ctx->version][typ].print(w, ctx, body);
+}
+
+#define _lib9p_validate(LOW_TYP_BIT, ERRMSG, TABLE) do { \
+ 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 != LOW_TYP_BIT) \
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EOPNOTSUPP, ERRMSG ": message_type=", lib9p_msgtype_str(ctx->version, typ)); \
+ struct _lib9p_recv_tentry tentry = TABLE[ctx->version][typ/2]; \
+ if (!tentry.validate) \
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EOPNOTSUPP, "unknown message type: ", lib9p_msgtype_str(ctx->version, typ), \
+ " (protocol_version=", 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); \
} while (0)
ssize_t lib9p_Tmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes) {
diff --git a/lib9p/core_gen/c.py b/lib9p/core_gen/c.py
index 393766b..60ceb70 100644
--- a/lib9p/core_gen/c.py
+++ b/lib9p/core_gen/c.py
@@ -7,7 +7,7 @@ import sys
import idl
-from . import c9util, c_format, c_marshal, c_unmarshal, c_validate, cutil
+from . import c9util, c_fmt_print, c_marshal, c_unmarshal, c_validate, cutil
# This strives to be "general-purpose" in that it just acts on the
# *.9p inputs; but (unfortunately?) there are a few special-cases in
@@ -35,15 +35,6 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str:
#include "core_tables.h"
#include "core_utf8.h"
"""
- # libmisc/obj.h vtables ####################################################
- ret += """
-/* libmisc/obj.h vtables ******************************************************/
-"""
- for typ in typs:
- ret += cutil.ifdef_push(1, c9util.ver_ifdef(typ.in_versions))
- ret += f"LO_IMPLEMENTATION_C(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)}, static);\n"
- ret += cutil.ifdef_pop(0)
-
# utilities ################################################################
ret += """
/* utilities ******************************************************************/
@@ -111,8 +102,8 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str:
# marshal_* ################################################################
ret += c_marshal.gen_c_marshal(versions, typs)
- # *_format #################################################################
- ret += c_format.gen_c_format(versions, typs)
+ # fmt_print_* ##############################################################
+ ret += c_fmt_print.gen_c_fmt_print(versions, typs)
# tables.h #################################################################
ret += """
@@ -156,8 +147,8 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str:
ret += "\n"
ret += cutil.macro(
f"#define _MSG(typ) [{c9util.Ident('TYP_')}##typ] = {{\n"
- f"\t\t.name = #typ,\n"
- f"\t\t.box_as_fmt_formatter = (_box_as_fmt_formatter_fn_t)lo_box_{c9util.ident('msg_')}##typ##_as_fmt_formatter,\n"
+ f"\t\t.name = #typ,\n"
+ f"\t\t.print = (_print_fn_t)fmt_print_##typ,\n"
f"\t}}\n"
)
ret += msg_table("_msg_tentry", "_table_msg", "_MSG", (0, 0x100, 1))
diff --git a/lib9p/core_gen/c_format.py b/lib9p/core_gen/c_fmt_print.py
index c633fbb..eaacddb 100644
--- a/lib9p/core_gen/c_format.py
+++ b/lib9p/core_gen/c_fmt_print.py
@@ -1,4 +1,4 @@
-# lib9p/core_gen/c_format.py - Generate C pretty-print functions
+# lib9p/core_gen/c_fmt_print.py - Generate C pretty-print functions
#
# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
@@ -6,14 +6,14 @@
import idl
-from . import c9util, cutil
+from . import c9util, cutil, idlutil
# This strives to be "general-purpose" in that it just acts on the
# *.9p inputs; but (unfortunately?) there are a few special-cases in
# this script, marked with "SPECIAL".
# pylint: disable=unused-variable
-__all__ = ["gen_c_format"]
+__all__ = ["gen_c_fmt_print"]
def bf_numname(typ: idl.Bitfield, num: idl.BitNum, base: str) -> str:
@@ -21,46 +21,34 @@ def bf_numname(typ: idl.Bitfield, num: idl.BitNum, base: str) -> str:
return c9util.Ident(c9util.add_prefix(prefix, base))
-def ext_printf(line: str) -> str:
- assert line.startswith("\t")
- assert line.endswith("\n")
- # It sucks that %v trips -Wformat and -Wformat-extra-args
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781
- ret = "#pragma GCC diagnostic push\n"
- ret += '#pragma GCC diagnostic ignored "-Wformat"\n'
- ret += '#pragma GCC diagnostic ignored "-Wformat-extra-args"\n'
- ret += line
- ret += "#pragma GCC diagnostic pop\n"
- return ret
-
-
-def gen_c_format(versions: set[str], typs: list[idl.UserType]) -> str:
+def gen_c_fmt_print(versions: set[str], typs: list[idl.UserType]) -> str:
ret = """
-/* *_format *******************************************************************/
+/* fmt_print_* ****************************************************************/
"""
- for typ in typs:
+ for typ in idlutil.topo_sorted(typs):
ret += "\n"
ret += cutil.ifdef_push(1, c9util.ver_ifdef(typ.in_versions))
- ret += f"static void {c9util.basename(typ)}_format({c9util.typename(typ)} *self, struct fmt_state *state) {{\n"
+ storage = "" if typ.typname == "stat" else "static " # SPECIAL (stat is public)
+ ret += f"[[maybe_unused]] {storage}void fmt_print_{typ.typname}(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, {c9util.typename(typ)} *self) {{\n"
match typ:
case idl.Number():
if typ.vals:
ret += "\tswitch (*self) {\n"
for name in typ.vals:
ret += f"\tcase {c9util.Ident(c9util.add_prefix(f'{typ.typname}_'.upper(), name))}:\n"
- ret += f'\t\tfmt_state_puts(state, "{name}");\n'
+ ret += f'\t\tfmt_print_str(w, "{name}");\n'
ret += "\t\tbreak;\n"
ret += "\tdefault:\n"
- ret += f'\t\tfmt_state_printf(state, "%"PRIu{typ.static_size*8}, *self);\n'
+ ret += "\t\tfmt_print_base10(w, *self);\n"
ret += "\t}\n"
else:
- ret += f'\t\tfmt_state_printf(state, "%"PRIu{typ.static_size*8}, *self);\n'
+ ret += "\t\tfmt_print_base10(w, *self);\n"
case idl.Bitfield():
val = "*self"
if typ.typname == "dm": # SPECIAL (pretty file permissions)
val = f"(*self & ~(({c9util.typename(typ)})0777))"
ret += "\tbool empty = true;\n"
- ret += "\tfmt_state_putchar(state, '(');\n"
+ ret += "\tfmt_print_byte(w, '(');\n"
nums: set[str] = set()
for bit in reversed(typ.bits):
@@ -72,8 +60,8 @@ def gen_c_format(versions: set[str], typs: list[idl.UserType]) -> str:
bitname = bit.bitname
ret += f"\tif ({val} & (UINT{typ.static_size*8}_C(1)<<{bit.num})) {{\n"
ret += "\t\tif (!empty)\n"
- ret += "\t\t\tfmt_state_putchar(state, '|');\n"
- ret += f'\t\tfmt_state_puts(state, "{bitname}");\n'
+ ret += "\t\t\tfmt_print_byte(w, '|');\n"
+ ret += f'\t\tfmt_print_str(w, "{bitname}");\n'
ret += "\t\tempty = false;\n"
ret += "\t}\n"
case idl.BitNum():
@@ -86,34 +74,32 @@ def gen_c_format(versions: set[str], typs: list[idl.UserType]) -> str:
f"{bit.cat.numname}_".upper(), name
)
ret += "\t\tif (!empty)\n"
- ret += "\t\t\tfmt_state_putchar(state, '|');\n"
- ret += f'\t\tfmt_state_puts(state, "{bitname}");\n'
+ ret += "\t\t\tfmt_print_byte(w, '|');\n"
+ ret += f'\t\tfmt_print_str(w, "{bitname}");\n'
ret += "\t\tempty = false;\n"
ret += "\t\tbreak;\n"
ret += "\tdefault:\n"
ret += "\t\tif (!empty)\n"
- ret += "\t\t\tfmt_state_putchar(state, '|');\n"
- ret += f'\t\tfmt_state_printf(state, "%"PRIu{typ.static_size*8}, {val} & {bf_numname(typ, bit.cat, 'MASK')});\n'
+ ret += "\t\t\tfmt_print_byte(w, '|');\n"
+ ret += f"\t\tfmt_print_base10(w, {val} & {bf_numname(typ, bit.cat, 'MASK')});\n"
ret += "\t\tempty = false;\n"
ret += "\t}\n"
nums.add(bit.cat.numname)
if typ.typname == "dm": # SPECIAL (pretty file permissions)
ret += "\tif (!empty)\n"
- ret += "\t\tfmt_state_putchar(state, '|');\n"
- ret += f'\tfmt_state_printf(state, "%#04"PRIo{typ.static_size*8}, *self & 0777);\n'
+ ret += "\t\tfmt_print_byte(w, '|');\n"
+ ret += "\tfmt_print(w, (rjust, 4, '0', (base8, *self & 0777)));\n"
else:
ret += "\tif (empty)\n"
- ret += "\t\tfmt_state_putchar(state, '0');\n"
- ret += "\tfmt_state_putchar(state, ')');\n"
+ ret += "\t\tfmt_print_byte(w, '0');\n"
+ ret += "\tfmt_print_byte(w, ')');\n"
case idl.Struct(typname="s"): # SPECIAL (string)
- ret += ext_printf(
- '\tfmt_state_printf(state, "%.*q", self->len, self->utf8);\n'
- )
+ ret += "\tfmt_print_qmem(w, self->utf8, self->len);\n"
case idl.Struct(): # and idl.Message():
if isinstance(typ, idl.Message):
- ret += f'\tfmt_state_puts(state, "{typ.typname} {{");\n'
+ ret += f'\tfmt_print_str(w, "{typ.typname} {{");\n'
else:
- ret += "\tfmt_state_putchar(state, '{');\n"
+ ret += "\tfmt_print_byte(w, '{');\n"
for member in typ.members:
if member.val:
continue
@@ -127,35 +113,33 @@ def gen_c_format(versions: set[str], typs: list[idl.UserType]) -> str:
cnt_typ = c9util.typename(member.cnt.typ)
if member.typ.static_size == 1: # SPECIAL (data)
ret += f"\tif (is_valid_utf8_without_nul((uint8_t *)self->{member.membname}, (size_t){cnt_str})) {{\n"
- ret += ext_printf(
- f'\t\tfmt_state_printf(state, " {member.membname}=%.*q%s",\n'
- f"\t\t\t(int)({cnt_str} < 50 ? {cnt_str} : 50),\n"
- f"\t\t\t(char *)self->{member.membname},\n"
- f'\t\t\t{cnt_str} < 50 ? "" : "...");\n'
- )
+ ret += f'\t\tfmt_print_str(w, " {member.membname}=");\n'
+ ret += f"\t\tfmt_print_qmem(w, self->{member.membname}, {cnt_str} < 50 ? {cnt_str} : 50);\n"
+ ret += f"\t\tif ({cnt_str} > 50)\n"
+ ret += '\t\t\tfmt_print_str(w, "...");\n'
ret += "\t} else {\n"
- ret += f'\t\tfmt_state_puts(state, " {member.membname}=<bytedata>");\n'
+ ret += f'\t\tfmt_print_str(w, " {member.membname}=<bytedata>");\n'
ret += "\t}\n"
continue
- ret += f'\tfmt_state_puts(state, " {member.membname}=[");\n'
+ ret += f'\tfmt_print_str(w, " {member.membname}=[");\n'
ret += f"\tfor ({cnt_typ} i = 0; i < {cnt_str}; i++) {{\n"
ret += "\t\tif (i)\n"
- ret += "\t\t\tfmt_state_putchar(state, ',');\n"
- ret += "\t\tfmt_state_putchar(state, ' ');\n"
+ ret += "\t\t\tfmt_print_byte(w, ',');\n"
+ ret += "\t\tfmt_print_byte(w, ' ');\n"
if isinstance(member.typ, idl.Primitive):
- ret += f'\t\tfmt_state_printf(state, "%"PRIu{member.typ.static_size*8}, self->{member.membname}[i]);\n'
+ ret += f"\t\tfmt_print_base10(w, self->{member.membname}[i]);\n"
else:
- ret += f"\t\t{c9util.basename(member.typ)}_format(&self->{member.membname}[i], state);\n"
+ ret += f"\t\tfmt_print_{member.typ.typname}(w, ctx, &self->{member.membname}[i]);\n"
ret += "\t}\n"
- ret += '\tfmt_state_puts(state, " ]");\n'
+ ret += '\tfmt_print_str(w, " ]");\n'
else:
- ret += f'\tfmt_state_puts(state, " {member.membname}=");\n'
+ ret += f'\tfmt_print_str(w, " {member.membname}=");\n'
if isinstance(member.typ, idl.Primitive):
- ret += f'\tfmt_state_printf(state, "%"PRIu{member.typ.static_size*8}, self->{member.membname});\n'
+ ret += f"\tfmt_print_base10(w, self->{member.membname});\n"
else:
- ret += f"\t{c9util.basename(member.typ)}_format(&self->{member.membname}, state);\n"
+ ret += f"\tfmt_print_{member.typ.typname}(w, ctx, &self->{member.membname});\n"
ret += cutil.ifdef_pop(1)
- ret += '\tfmt_state_puts(state, " }");\n'
+ ret += '\tfmt_print_str(w, " }");\n'
ret += "}\n"
ret += cutil.ifdef_pop(0)
diff --git a/lib9p/core_gen/c_marshal.py b/lib9p/core_gen/c_marshal.py
index 322e1ef..bddf55f 100644
--- a/lib9p/core_gen/c_marshal.py
+++ b/lib9p/core_gen/c_marshal.py
@@ -381,10 +381,9 @@ def gen_c_marshal(versions: set[str], typs: list[idl.UserType]) -> str:
else:
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 (%"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\tneeded_size, ctx->max_msg_size);\n"
+ ret += f'\t\tlib9p_error(ctx, {c9util.IDENT("ERRNO_L_ERANGE")}, "{typ.typname} message too large to marshal into ",\n'
+ ret += f'\t\t\tctx->version ? "negotiated" : "{'client' if typ.msgid % 2 == 0 else 'server'}", " limit",\n'
+ ret += '\t\t\t" (", needed_size, " > ", ctx->max_msg_size, ")");\n'
ret += "\t\treturn true;\n"
ret += "\t}\n"
diff --git a/lib9p/core_gen/c_validate.py b/lib9p/core_gen/c_validate.py
index 3073ed0..9c55d8d 100644
--- a/lib9p/core_gen/c_validate.py
+++ b/lib9p/core_gen/c_validate.py
@@ -59,7 +59,7 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str:
"\t\t * that. */\n"
f'\t\treturn lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "message is too short for content");\n'
"\tif (net_offset > net_size)\n"
- f'\t\treturn lib9p_errorf(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "message is too short for content (%"PRIu32" > %"PRIu32") @ %d", net_offset, net_size, __LINE__);\n'
+ f'\t\treturn lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "message is too short for content (", net_offset, " > ", net_size, ")");\n'
)
ret += cutil.macro(
"#define VALIDATE_NET_UTF8(n)\n"
@@ -190,11 +190,10 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str:
for tok in child.val.tokens
):
nbits = 32
- act = f"(uint{nbits}_t)GET_U{nbits}LE({lookup_sym(f'&{child.membname}')})"
- exp = f"(uint{nbits}_t)({c9util.idl_expr(child.val, lookup_sym)})"
+ act = f"GET_U{nbits}LE({lookup_sym(f'&{child.membname}')})"
+ exp = f"{c9util.idl_expr(child.val, lookup_sym)}"
ret += f"{'\t'*indent_lvl()}if ({act} != {exp})\n"
- ret += f'{"\t"*(indent_lvl()+1)}return lib9p_errorf(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "{path} value is wrong: actual: %"PRIu{nbits}" != correct:%"PRIu{nbits},\n'
- ret += f"{'\t'*(indent_lvl()+2)}{act}, {exp});\n"
+ ret += f'{"\t"*(indent_lvl()+1)}return lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "{path} value is wrong: actual:", (base10, {act}), " != correct:", (base10, {exp}));\n'
if child.max:
incr_flush()
assert child.typ.static_size
@@ -205,19 +204,18 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str:
for tok in child.max.tokens
):
nbits = 32
- act = f"(uint{nbits}_t)GET_U{nbits}LE({lookup_sym(f'&{child.membname}')})"
- exp = f"(uint{nbits}_t)({c9util.idl_expr(child.max, lookup_sym)})"
+ act = f"GET_U{nbits}LE({lookup_sym(f'&{child.membname}')})"
+ exp = f"{c9util.idl_expr(child.max, lookup_sym)}"
ret += f"{'\t'*indent_lvl()}if ({act} > {exp})\n"
- ret += f'{"\t"*(indent_lvl()+1)}return lib9p_errorf(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "{path} value is too large: %"PRIu{nbits}" > %"PRIu{nbits},\n'
- ret += f"{'\t'*(indent_lvl()+2)}{act}, {exp});\n"
+ ret += f'{"\t"*(indent_lvl()+1)}return lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "{path} value is too large: ", (base10, {act}), " > ", (base10, {exp}));\n'
if isinstance(child.typ, idl.Bitfield):
incr_flush()
nbytes = child.typ.static_size
nbits = nbytes * 8
act = f"GET_U{nbits}LE({lookup_sym(f'&{child.membname}')})"
ret += f"{'\t'*indent_lvl()}if ({act} & ~{child.typ.typname}_masks[ctx->version])\n"
- ret += f'{"\t"*(indent_lvl()+1)}return lib9p_errorf(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "unknown bits in {child.typ.typname} bitfield: %#0{nbytes*2}"PRIx{nbits},\n'
- ret += f"{'\t'*(indent_lvl()+2)}{act} & ~{child.typ.typname}_masks[ctx->version]);\n"
+ ret += f'{"\t"*(indent_lvl()+1)}return lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "unknown bits in {child.typ.typname} bitfield: ",\n'
+ ret += f"{'\t'*(indent_lvl()+2)}(base16_u{nbits}_, {act} & ~{child.typ.typname}_masks[ctx->version]));\n"
def handle(
path: idlutil.Path,
diff --git a/lib9p/core_gen/h.py b/lib9p/core_gen/h.py
index 3c857c1..acf8415 100644
--- a/lib9p/core_gen/h.py
+++ b/lib9p/core_gen/h.py
@@ -163,12 +163,7 @@ def gen_h(versions: set[str], typs: list[idl.UserType]) -> str:
\t#error Do not include <lib9p/_core_generated.h> directly; include <lib9p/core.h> instead
#endif
-#include <stdint.h> /* for uint{{n}}_t types */
-
-#include <libfmt/fmt.h> /* for fmt_formatter */
-#include <libhw/generic/io.h> /* for struct iovec */
"""
-
id2typ: dict[int, idl.Message] = {}
for msg in [msg for msg in typs if isinstance(msg, idl.Message)]:
id2typ[msg.msgid] = msg
@@ -214,7 +209,6 @@ enum {c9util.ident('version')} {{
ret += cutil.ifdef_pop(0)
ret += f"\t{c9util.ver_enum('NUM')},\n"
ret += "};\n"
- ret += f"LO_IMPLEMENTATION_H(fmt_formatter, enum {c9util.ident('version')}, {c9util.ident('version')});\n"
ret += """
/* enum msg_type **************************************************************/
@@ -230,7 +224,6 @@ enum {c9util.ident('version')} {{
ret += f"\t{c9util.Ident(f'TYP_{msg.typname:<{namewidth}}')} = {msg.msgid},\n"
ret += cutil.ifdef_pop(0)
ret += "};\n"
- ret += f"LO_IMPLEMENTATION_H(fmt_formatter, enum {c9util.ident('msg_type')}, {c9util.ident('msg_type')});\n"
ret += """
/* payload types **************************************************************/
@@ -371,7 +364,6 @@ enum {c9util.ident('version')} {{
def gen_number(typ: idl.Number) -> str:
ret = f"typedef {c9util.typename(typ.prim)} {c9util.typename(typ)};\n"
- ret += f"LO_IMPLEMENTATION_H(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)});\n"
def lookup_sym(sym: str) -> str:
assert False
@@ -390,7 +382,6 @@ def gen_number(typ: idl.Number) -> str:
def gen_bitfield(typ: idl.Bitfield) -> str:
ret = f"typedef {c9util.typename(typ.prim)} {c9util.typename(typ)};\n"
- ret += f"LO_IMPLEMENTATION_H(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)});\n"
def lookup_sym(sym: str) -> str:
assert False
@@ -538,5 +529,4 @@ def gen_struct(typ: idl.Struct) -> str: # and idl.Message
ret += f"\t{c9util.typename(member.typ, member):<{typewidth}} {'*' if member.cnt else ' '}{member.membname};\n"
ret += cutil.ifdef_pop(1)
ret += "};\n"
- ret += f"LO_IMPLEMENTATION_H(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)});\n"
return ret
diff --git a/lib9p/core_generated.c b/lib9p/core_generated.c
index 2532d12..81ace7d 100644
--- a/lib9p/core_generated.c
+++ b/lib9p/core_generated.c
@@ -12,132 +12,6 @@
#include "core_tables.h"
#include "core_utf8.h"
-/* libmisc/obj.h 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_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_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_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_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_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_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_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_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);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Twalk, lib9p_msg_Twalk, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rwalk, lib9p_msg_Rwalk, 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
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Topen, lib9p_msg_Topen, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Ropen, lib9p_msg_Ropen, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tcreate, lib9p_msg_Tcreate, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rcreate, lib9p_msg_Rcreate, 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
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tread, lib9p_msg_Tread, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rread, lib9p_msg_Rread, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Twrite, lib9p_msg_Twrite, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rwrite, lib9p_msg_Rwrite, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tclunk, lib9p_msg_Tclunk, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rclunk, lib9p_msg_Rclunk, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tremove, lib9p_msg_Tremove, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rremove, lib9p_msg_Rremove, 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
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tstat, lib9p_msg_Tstat, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rstat, lib9p_msg_Rstat, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rwstat, lib9p_msg_Rwstat, 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_p9p
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Topenfd, lib9p_msg_Topenfd, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Ropenfd, lib9p_msg_Ropenfd, static);
-#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
-#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_nuid_t, lib9p_nuid, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_errno_t, lib9p_errno, static);
-#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_super_magic_t, lib9p_super_magic, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lo_t, lib9p_lo, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_dt_t, lib9p_dt, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_mode_t, lib9p_mode, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_b4_t, lib9p_b4, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_getattr_t, lib9p_getattr, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_setattr_t, lib9p_setattr, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lock_type_t, lib9p_lock_type, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lock_flags_t, lib9p_lock_flags, static);
-LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lock_status_t, lib9p_lock_status, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlerror, lib9p_msg_Rlerror, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tstatfs, lib9p_msg_Tstatfs, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rstatfs, lib9p_msg_Rstatfs, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlopen, lib9p_msg_Tlopen, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlopen, lib9p_msg_Rlopen, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlcreate, lib9p_msg_Tlcreate, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlcreate, lib9p_msg_Rlcreate, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsymlink, lib9p_msg_Tsymlink, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsymlink, lib9p_msg_Rsymlink, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tmknod, lib9p_msg_Tmknod, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rmknod, lib9p_msg_Rmknod, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Trename, lib9p_msg_Trename, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rrename, lib9p_msg_Rrename, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Treadlink, lib9p_msg_Treadlink, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rreadlink, lib9p_msg_Rreadlink, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tgetattr, lib9p_msg_Tgetattr, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rgetattr, lib9p_msg_Rgetattr, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsetattr, lib9p_msg_Tsetattr, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsetattr, lib9p_msg_Rsetattr, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Txattrwalk, lib9p_msg_Txattrwalk, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rxattrwalk, lib9p_msg_Rxattrwalk, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Txattrcreate, lib9p_msg_Txattrcreate, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rxattrcreate, lib9p_msg_Rxattrcreate, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Treaddir, lib9p_msg_Treaddir, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rreaddir, lib9p_msg_Rreaddir, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tfsync, lib9p_msg_Tfsync, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rfsync, lib9p_msg_Rfsync, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlock, lib9p_msg_Tlock, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlock, lib9p_msg_Rlock, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tgetlock, lib9p_msg_Tgetlock, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rgetlock, lib9p_msg_Rgetlock, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlink, lib9p_msg_Tlink, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlink, lib9p_msg_Rlink, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tmkdir, lib9p_msg_Tmkdir, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rmkdir, lib9p_msg_Rmkdir, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Trenameat, lib9p_msg_Trenameat, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rrenameat, lib9p_msg_Rrenameat, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tunlinkat, lib9p_msg_Tunlinkat, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Runlinkat, lib9p_msg_Runlinkat, static);
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsession, lib9p_msg_Tsession, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsession, lib9p_msg_Rsession, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsread, lib9p_msg_Tsread, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsread, lib9p_msg_Rsread, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tswrite, lib9p_msg_Tswrite, static);
-LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rswrite, lib9p_msg_Rswrite, static);
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
-
/* utilities ******************************************************************/
#if CONFIG_9P_ENABLE_9P2000
#define _is_ver_9P2000(v) (v == LIB9P_VER_9P2000)
@@ -355,7 +229,7 @@ static const lib9p_lock_flags_t lock_flags_masks[LIB9P_VER_NUM] = {
* that. */ \
return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "message is too short for content"); \
if (net_offset > net_size) \
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "message is too short for content (%"PRIu32" > %"PRIu32") @ %d", net_offset, net_size, __LINE__);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "message is too short for content (", net_offset, " > ", net_size, ")");
#define VALIDATE_NET_UTF8(n) \
{ \
size_t len = n; \
@@ -387,8 +261,8 @@ static ssize_t validate_stat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *
uint32_t offsetof_qid_type = net_offset + 8;
VALIDATE_NET_BYTES(21);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_mode = net_offset + 0;
VALIDATE_NET_BYTES(22);
VALIDATE_NET_UTF8(LAST_U16LE());
@@ -406,12 +280,11 @@ static ssize_t validate_stat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof__stat_size) != (uint32_t)(offsetof_end - offsetof_fstype))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "stat->_stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof__stat_size), (uint32_t)(offsetof_end - offsetof_fstype));
+ if (GET_U32LE(offsetof__stat_size) != offsetof_end - offsetof_fstype)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "stat->_stat_size value is wrong: actual:", (base10, GET_U32LE(offsetof__stat_size)), " != correct:", (base10, offsetof_end - offsetof_fstype));
if (GET_U32LE(offsetof_mode) & ~dm_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_mode) & ~dm_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_mode) & ~dm_masks[ctx->version]));
if (ret_net_size)
*ret_net_size = net_offset;
return (ssize_t)host_size;
@@ -427,12 +300,10 @@ static ssize_t validate_Tversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8
VALIDATE_NET_BYTES(13);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tversion->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(100))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tversion->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(100));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tversion->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 100)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tversion->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 100));
return (ssize_t)host_size;
}
@@ -444,12 +315,10 @@ static ssize_t validate_Rversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8
VALIDATE_NET_BYTES(13);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rversion->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(101))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rversion->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(101));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rversion->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 101)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rversion->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 101));
return (ssize_t)host_size;
}
@@ -470,12 +339,10 @@ static ssize_t validate_Tauth(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
}
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tauth->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(102))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tauth->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(102));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tauth->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 102)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tauth->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 102));
return (ssize_t)host_size;
}
@@ -487,15 +354,13 @@ static ssize_t validate_Rauth(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_aqid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_aqid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_aqid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_aqid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rauth->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(103))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rauth->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(103));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rauth->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 103)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rauth->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 103));
return (ssize_t)host_size;
}
@@ -514,12 +379,10 @@ static ssize_t validate_Tattach(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
}
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tattach->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(104))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tattach->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(104));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tattach->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 104)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tattach->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 104));
return (ssize_t)host_size;
}
@@ -531,15 +394,13 @@ static ssize_t validate_Rattach(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rattach->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(105))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rattach->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(105));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rattach->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 105)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rattach->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 105));
return (ssize_t)host_size;
}
@@ -558,12 +419,10 @@ static ssize_t validate_Rerror(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rerror->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(107))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rerror->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(107));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rerror->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 107)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rerror->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 107));
return (ssize_t)host_size;
}
@@ -576,12 +435,10 @@ static ssize_t validate_Tflush(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 9;
VALIDATE_NET_BYTES(9);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tflush->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(108))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tflush->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(108));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tflush->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 108)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tflush->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 108));
return (ssize_t)host_size;
}
@@ -592,12 +449,10 @@ static ssize_t validate_Rflush(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rflush->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(109))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rflush->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(109));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rflush->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 109)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rflush->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 109));
return (ssize_t)host_size;
}
@@ -614,15 +469,12 @@ static ssize_t validate_Twalk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
VALIDATE_NET_UTF8(LAST_U16LE());
}
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(110))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(110));
- if ((uint16_t)GET_U16LE(offsetof_nwname) > (uint16_t)(16))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twalk->nwname value is too large: %"PRIu16" > %"PRIu16,
- (uint16_t)GET_U16LE(offsetof_nwname), (uint16_t)(16));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twalk->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 110)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twalk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 110));
+ if (GET_U16LE(offsetof_nwname) > 16)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twalk->nwname value is too large: ", (base10, GET_U16LE(offsetof_nwname)), " > ", (base10, 16));
return (ssize_t)host_size;
}
@@ -638,19 +490,16 @@ static ssize_t validate_Rwalk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_wqid_type = net_offset + 0;
VALIDATE_NET_BYTES(13);
if (GET_U8LE(offsetof_wqid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_wqid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_wqid_type) & ~qt_masks[ctx->version]));
}
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(111))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(111));
- if ((uint16_t)GET_U16LE(offsetof_nwqid) > (uint16_t)(16))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwalk->nwqid value is too large: %"PRIu16" > %"PRIu16,
- (uint16_t)GET_U16LE(offsetof_nwqid), (uint16_t)(16));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwalk->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 111)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwalk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 111));
+ if (GET_U16LE(offsetof_nwqid) > 16)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwalk->nwqid value is too large: ", (base10, GET_U16LE(offsetof_nwqid)), " > ", (base10, 16));
return (ssize_t)host_size;
}
@@ -664,15 +513,13 @@ static ssize_t validate_Topen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_mode = net_offset + 11;
uint32_t offsetof_end = net_offset + 12;
VALIDATE_NET_BYTES(12);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Topen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(112))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Topen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(112));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Topen->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 112)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Topen->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 112));
if (GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -684,16 +531,14 @@ static ssize_t validate_Ropen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 4;
VALIDATE_NET_BYTES(4);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(113))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(113));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropen->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 113)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropen->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 113));
return (ssize_t)host_size;
}
@@ -708,18 +553,16 @@ static ssize_t validate_Tcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_mode = net_offset + 4;
uint32_t offsetof_end = net_offset + 5;
VALIDATE_NET_BYTES(5);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(114))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(114));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tcreate->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 114)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 114));
if (GET_U32LE(offsetof_perm) & ~dm_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_perm) & ~dm_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_perm) & ~dm_masks[ctx->version]));
if (GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -731,16 +574,14 @@ static ssize_t validate_Rcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 4;
VALIDATE_NET_BYTES(4);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(115))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(115));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rcreate->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 115)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 115));
return (ssize_t)host_size;
}
@@ -755,18 +596,14 @@ static ssize_t validate_Tread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_count = net_offset + 19;
uint32_t offsetof_end = net_offset + 23;
VALIDATE_NET_BYTES(23);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(116))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(116));
- if ((uint64_t)GET_U64LE(offsetof_offset) > (uint64_t)(INT64_MAX))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->offset value is too large: %"PRIu64" > %"PRIu64,
- (uint64_t)GET_U64LE(offsetof_offset), (uint64_t)(INT64_MAX));
- if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->count value is too large: %"PRIu32" > %"PRIu32,
- (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 116)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 116));
+ if (GET_U64LE(offsetof_offset) > INT64_MAX)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->offset value is too large: ", (base10, GET_U64LE(offsetof_offset)), " > ", (base10, INT64_MAX));
+ if (GET_U32LE(offsetof_count) > INT32_MAX)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tread->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX));
return (ssize_t)host_size;
}
@@ -779,15 +616,12 @@ static ssize_t validate_Rread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
VALIDATE_NET_BYTES(11);
VALIDATE_NET_BYTES(LAST_U32LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(117))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(117));
- if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rread->count value is too large: %"PRIu32" > %"PRIu32,
- (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rread->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 117)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rread->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 117));
+ if (GET_U32LE(offsetof_count) > INT32_MAX)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rread->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX));
return (ssize_t)host_size;
}
@@ -801,18 +635,14 @@ static ssize_t validate_Twrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
VALIDATE_NET_BYTES(23);
VALIDATE_NET_BYTES(LAST_U32LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(118))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(118));
- if ((uint64_t)GET_U64LE(offsetof_offset) > (uint64_t)(INT64_MAX))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->offset value is too large: %"PRIu64" > %"PRIu64,
- (uint64_t)GET_U64LE(offsetof_offset), (uint64_t)(INT64_MAX));
- if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->count value is too large: %"PRIu32" > %"PRIu32,
- (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 118)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 118));
+ if (GET_U64LE(offsetof_offset) > INT64_MAX)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->offset value is too large: ", (base10, GET_U64LE(offsetof_offset)), " > ", (base10, INT64_MAX));
+ if (GET_U32LE(offsetof_count) > INT32_MAX)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twrite->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX));
return (ssize_t)host_size;
}
@@ -824,15 +654,12 @@ static ssize_t validate_Rwrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_count = net_offset + 7;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(119))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(119));
- if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwrite->count value is too large: %"PRIu32" > %"PRIu32,
- (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwrite->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 119)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwrite->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 119));
+ if (GET_U32LE(offsetof_count) > INT32_MAX)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwrite->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX));
return (ssize_t)host_size;
}
@@ -843,12 +670,10 @@ static ssize_t validate_Tclunk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tclunk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(120))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tclunk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(120));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tclunk->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 120)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tclunk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 120));
return (ssize_t)host_size;
}
@@ -859,12 +684,10 @@ static ssize_t validate_Rclunk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rclunk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(121))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rclunk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(121));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rclunk->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 121)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rclunk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 121));
return (ssize_t)host_size;
}
@@ -875,12 +698,10 @@ static ssize_t validate_Tremove(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tremove->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(122))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tremove->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(122));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tremove->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 122)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tremove->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 122));
return (ssize_t)host_size;
}
@@ -891,12 +712,10 @@ static ssize_t validate_Rremove(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rremove->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(123))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rremove->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(123));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rremove->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 123)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rremove->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 123));
return (ssize_t)host_size;
}
@@ -909,12 +728,10 @@ static ssize_t validate_Tstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(124))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(124));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 124)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 124));
return (ssize_t)host_size;
}
@@ -930,8 +747,8 @@ static ssize_t validate_Rstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_stat_qid_type = net_offset + 17;
VALIDATE_NET_BYTES(30);
if (GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_stat_mode = net_offset + 0;
VALIDATE_NET_BYTES(22);
VALIDATE_NET_UTF8(LAST_U16LE());
@@ -949,22 +766,18 @@ static ssize_t validate_Rstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
uint32_t offsetof_stat_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_stat__stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_fstype))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->stat._stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_stat__stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_fstype));
+ if (GET_U32LE(offsetof_stat__stat_size) != offsetof_stat_end - offsetof_stat_fstype)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->stat._stat_size value is wrong: actual:", (base10, GET_U32LE(offsetof_stat__stat_size)), " != correct:", (base10, offsetof_stat_end - offsetof_stat_fstype));
if (GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(125))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(125));
- if ((uint32_t)GET_U32LE(offsetof_nstat) != (uint32_t)(offsetof_end - offsetof_stat))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->nstat value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_nstat), (uint32_t)(offsetof_end - offsetof_stat));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 125)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 125));
+ if (GET_U32LE(offsetof_nstat) != offsetof_end - offsetof_stat)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstat->nstat value is wrong: actual:", (base10, GET_U32LE(offsetof_nstat)), " != correct:", (base10, offsetof_end - offsetof_stat));
return (ssize_t)host_size;
}
@@ -980,8 +793,8 @@ static ssize_t validate_Twstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_stat_qid_type = net_offset + 21;
VALIDATE_NET_BYTES(34);
if (GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_stat_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_stat_mode = net_offset + 0;
VALIDATE_NET_BYTES(22);
VALIDATE_NET_UTF8(LAST_U16LE());
@@ -999,22 +812,18 @@ static ssize_t validate_Twstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
uint32_t offsetof_stat_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_stat__stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_fstype))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->stat._stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_stat__stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_fstype));
+ if (GET_U32LE(offsetof_stat__stat_size) != offsetof_stat_end - offsetof_stat_fstype)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->stat._stat_size value is wrong: actual:", (base10, GET_U32LE(offsetof_stat__stat_size)), " != correct:", (base10, offsetof_stat_end - offsetof_stat_fstype));
if (GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_stat_mode) & ~dm_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(126))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(126));
- if ((uint32_t)GET_U32LE(offsetof_nstat) != (uint32_t)(offsetof_end - offsetof_stat))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->nstat value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_nstat), (uint32_t)(offsetof_end - offsetof_stat));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 126)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 126));
+ if (GET_U32LE(offsetof_nstat) != offsetof_end - offsetof_stat)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Twstat->nstat value is wrong: actual:", (base10, GET_U32LE(offsetof_nstat)), " != correct:", (base10, offsetof_end - offsetof_stat));
return (ssize_t)host_size;
}
@@ -1025,12 +834,10 @@ static ssize_t validate_Rwstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(127))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(127));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwstat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 127)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rwstat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 127));
return (ssize_t)host_size;
}
@@ -1044,15 +851,13 @@ static ssize_t validate_Topenfd(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_mode = net_offset + 11;
uint32_t offsetof_end = net_offset + 12;
VALIDATE_NET_BYTES(12);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Topenfd->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(98))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Topenfd->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(98));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Topenfd->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 98)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Topenfd->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 98));
if (GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1064,16 +869,14 @@ static ssize_t validate_Ropenfd(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 8;
VALIDATE_NET_BYTES(8);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropenfd->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(99))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropenfd->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(99));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropenfd->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 99)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Ropenfd->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 99));
return (ssize_t)host_size;
}
@@ -1086,12 +889,10 @@ static ssize_t validate_Rlerror(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlerror->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(7))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlerror->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(7));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlerror->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 7)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlerror->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 7));
return (ssize_t)host_size;
}
@@ -1102,12 +903,10 @@ static ssize_t validate_Tstatfs(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstatfs->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(8))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstatfs->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(8));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstatfs->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 8)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tstatfs->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 8));
return (ssize_t)host_size;
}
@@ -1118,12 +917,10 @@ static ssize_t validate_Rstatfs(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 67;
VALIDATE_NET_BYTES(67);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstatfs->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(9))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstatfs->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(9));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstatfs->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 9)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rstatfs->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 9));
return (ssize_t)host_size;
}
@@ -1135,15 +932,13 @@ static ssize_t validate_Tlopen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_flags = net_offset + 11;
uint32_t offsetof_end = net_offset + 15;
VALIDATE_NET_BYTES(15);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlopen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(12))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlopen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(12));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlopen->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 12)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlopen->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 12));
if (GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lo bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lo bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1155,16 +950,14 @@ static ssize_t validate_Rlopen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 4;
VALIDATE_NET_BYTES(4);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlopen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(13))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlopen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(13));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlopen->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 13)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlopen->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 13));
return (ssize_t)host_size;
}
@@ -1179,18 +972,16 @@ static ssize_t validate_Tlcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_mode = net_offset + 4;
uint32_t offsetof_end = net_offset + 12;
VALIDATE_NET_BYTES(12);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(14))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(14));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlcreate->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 14)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 14));
if (GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lo bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lo bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version]));
if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1202,16 +993,14 @@ static ssize_t validate_Rlcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 4;
VALIDATE_NET_BYTES(4);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(15))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(15));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlcreate->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 15)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 15));
return (ssize_t)host_size;
}
@@ -1226,12 +1015,10 @@ static ssize_t validate_Tsymlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 4;
VALIDATE_NET_BYTES(4);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsymlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(16))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsymlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(16));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsymlink->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 16)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsymlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 16));
return (ssize_t)host_size;
}
@@ -1243,15 +1030,13 @@ static ssize_t validate_Rsymlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsymlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(17))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsymlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(17));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsymlink->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 17)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsymlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 17));
return (ssize_t)host_size;
}
@@ -1265,15 +1050,13 @@ static ssize_t validate_Tmknod(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_mode = net_offset + 0;
uint32_t offsetof_end = net_offset + 16;
VALIDATE_NET_BYTES(16);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmknod->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(18))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmknod->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(18));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmknod->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 18)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmknod->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 18));
if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1285,15 +1068,13 @@ static ssize_t validate_Rmknod(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmknod->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(19))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmknod->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(19));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmknod->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 19)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmknod->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 19));
return (ssize_t)host_size;
}
@@ -1305,12 +1086,10 @@ static ssize_t validate_Trename(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
VALIDATE_NET_BYTES(17);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Trename->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(20))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Trename->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(20));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Trename->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 20)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Trename->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 20));
return (ssize_t)host_size;
}
@@ -1321,12 +1100,10 @@ static ssize_t validate_Rrename(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrename->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(21))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrename->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(21));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrename->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 21)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrename->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 21));
return (ssize_t)host_size;
}
@@ -1337,12 +1114,10 @@ static ssize_t validate_Treadlink(struct lib9p_ctx *ctx, uint32_t net_size, uint
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Treadlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(22))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Treadlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(22));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Treadlink->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 22)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Treadlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 22));
return (ssize_t)host_size;
}
@@ -1354,12 +1129,10 @@ static ssize_t validate_Rreadlink(struct lib9p_ctx *ctx, uint32_t net_size, uint
VALIDATE_NET_BYTES(9);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreadlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(23))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreadlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(23));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreadlink->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 23)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreadlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 23));
return (ssize_t)host_size;
}
@@ -1371,15 +1144,13 @@ static ssize_t validate_Tgetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_request_mask = net_offset + 11;
uint32_t offsetof_end = net_offset + 19;
VALIDATE_NET_BYTES(19);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(24))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(24));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetattr->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 24)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetattr->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 24));
if (GET_U64LE(offsetof_request_mask) & ~getattr_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in getattr bitfield: %#016"PRIx64,
- GET_U64LE(offsetof_request_mask) & ~getattr_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in getattr bitfield: ",
+ (base16_u64_, GET_U64LE(offsetof_request_mask) & ~getattr_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1392,23 +1163,21 @@ static ssize_t validate_Rgetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_qid_type = net_offset + 15;
VALIDATE_NET_BYTES(28);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_mode = net_offset + 0;
uint32_t offsetof_end = net_offset + 132;
VALIDATE_NET_BYTES(132);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(25))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(25));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetattr->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 25)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetattr->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 25));
if (GET_U64LE(offsetof_valid) & ~getattr_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in getattr bitfield: %#016"PRIx64,
- GET_U64LE(offsetof_valid) & ~getattr_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in getattr bitfield: ",
+ (base16_u64_, GET_U64LE(offsetof_valid) & ~getattr_masks[ctx->version]));
if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1421,18 +1190,16 @@ static ssize_t validate_Tsetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_mode = net_offset + 15;
uint32_t offsetof_end = net_offset + 67;
VALIDATE_NET_BYTES(67);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(26))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(26));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsetattr->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 26)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsetattr->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 26));
if (GET_U32LE(offsetof_valid) & ~setattr_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in setattr bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_valid) & ~setattr_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in setattr bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_valid) & ~setattr_masks[ctx->version]));
if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1443,12 +1210,10 @@ static ssize_t validate_Rsetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(27))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(27));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsetattr->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 27)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsetattr->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 27));
return (ssize_t)host_size;
}
@@ -1460,12 +1225,10 @@ static ssize_t validate_Txattrwalk(struct lib9p_ctx *ctx, uint32_t net_size, uin
VALIDATE_NET_BYTES(17);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrwalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(30))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrwalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(30));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrwalk->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 30)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrwalk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 30));
return (ssize_t)host_size;
}
@@ -1476,12 +1239,10 @@ static ssize_t validate_Rxattrwalk(struct lib9p_ctx *ctx, uint32_t net_size, uin
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 15;
VALIDATE_NET_BYTES(15);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrwalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(31))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrwalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(31));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrwalk->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 31)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrwalk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 31));
return (ssize_t)host_size;
}
@@ -1494,12 +1255,10 @@ static ssize_t validate_Txattrcreate(struct lib9p_ctx *ctx, uint32_t net_size, u
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 12;
VALIDATE_NET_BYTES(12);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(32))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(32));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrcreate->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 32)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Txattrcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 32));
return (ssize_t)host_size;
}
@@ -1510,12 +1269,10 @@ static ssize_t validate_Rxattrcreate(struct lib9p_ctx *ctx, uint32_t net_size, u
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(33))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(33));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrcreate->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 33)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rxattrcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 33));
return (ssize_t)host_size;
}
@@ -1526,12 +1283,10 @@ static ssize_t validate_Treaddir(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 23;
VALIDATE_NET_BYTES(23);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Treaddir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(40))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Treaddir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(40));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Treaddir->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 40)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Treaddir->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 40));
return (ssize_t)host_size;
}
@@ -1543,12 +1298,10 @@ static ssize_t validate_Rreaddir(struct lib9p_ctx *ctx, uint32_t net_size, uint8
VALIDATE_NET_BYTES(11);
VALIDATE_NET_BYTES(LAST_U32LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreaddir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(41))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreaddir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(41));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreaddir->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 41)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rreaddir->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 41));
return (ssize_t)host_size;
}
@@ -1559,12 +1312,10 @@ static ssize_t validate_Tfsync(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 15;
VALIDATE_NET_BYTES(15);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tfsync->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(50))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tfsync->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(50));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tfsync->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 50)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tfsync->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 50));
return (ssize_t)host_size;
}
@@ -1575,12 +1326,10 @@ static ssize_t validate_Rfsync(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rfsync->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(51))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rfsync->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(51));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rfsync->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 51)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rfsync->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 51));
return (ssize_t)host_size;
}
@@ -1593,15 +1342,13 @@ static ssize_t validate_Tlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
VALIDATE_NET_BYTES(38);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(52))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(52));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlock->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 52)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlock->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 52));
if (GET_U32LE(offsetof_flags) & ~lock_flags_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lock_flags bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_flags) & ~lock_flags_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lock_flags bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_flags) & ~lock_flags_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1612,12 +1359,10 @@ static ssize_t validate_Rlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 8;
VALIDATE_NET_BYTES(8);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(53))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(53));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlock->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 53)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlock->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 53));
return (ssize_t)host_size;
}
@@ -1629,12 +1374,10 @@ static ssize_t validate_Tgetlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8
VALIDATE_NET_BYTES(34);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(54))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(54));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetlock->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 54)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tgetlock->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 54));
return (ssize_t)host_size;
}
@@ -1646,12 +1389,10 @@ static ssize_t validate_Rgetlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8
VALIDATE_NET_BYTES(30);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(55))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(55));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetlock->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 55)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rgetlock->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 55));
return (ssize_t)host_size;
}
@@ -1663,12 +1404,10 @@ static ssize_t validate_Tlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
VALIDATE_NET_BYTES(17);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(70))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(70));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlink->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 70)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 70));
return (ssize_t)host_size;
}
@@ -1679,12 +1418,10 @@ static ssize_t validate_Rlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(71))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(71));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlink->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 71)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 71));
return (ssize_t)host_size;
}
@@ -1698,15 +1435,13 @@ static ssize_t validate_Tmkdir(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_mode = net_offset + 0;
uint32_t offsetof_end = net_offset + 8;
VALIDATE_NET_BYTES(8);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmkdir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(72))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmkdir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(72));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmkdir->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 72)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tmkdir->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 72));
if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
- GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ",
+ (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]));
return (ssize_t)host_size;
}
@@ -1718,15 +1453,13 @@ static ssize_t validate_Rmkdir(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
uint32_t offsetof_qid_type = net_offset + 7;
VALIDATE_NET_BYTES(20);
if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
- GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ",
+ (base16_u8_, GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]));
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmkdir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(73))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmkdir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(73));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmkdir->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 73)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rmkdir->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 73));
return (ssize_t)host_size;
}
@@ -1740,12 +1473,10 @@ static ssize_t validate_Trenameat(struct lib9p_ctx *ctx, uint32_t net_size, uint
VALIDATE_NET_BYTES(6);
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Trenameat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(74))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Trenameat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(74));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Trenameat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 74)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Trenameat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 74));
return (ssize_t)host_size;
}
@@ -1756,12 +1487,10 @@ static ssize_t validate_Rrenameat(struct lib9p_ctx *ctx, uint32_t net_size, uint
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrenameat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(75))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrenameat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(75));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrenameat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 75)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rrenameat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 75));
return (ssize_t)host_size;
}
@@ -1774,12 +1503,10 @@ static ssize_t validate_Tunlinkat(struct lib9p_ctx *ctx, uint32_t net_size, uint
VALIDATE_NET_UTF8(LAST_U16LE());
uint32_t offsetof_end = net_offset + 4;
VALIDATE_NET_BYTES(4);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tunlinkat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(76))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tunlinkat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(76));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tunlinkat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 76)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tunlinkat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 76));
return (ssize_t)host_size;
}
@@ -1790,12 +1517,10 @@ static ssize_t validate_Runlinkat(struct lib9p_ctx *ctx, uint32_t net_size, uint
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Runlinkat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(77))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Runlinkat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(77));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Runlinkat->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 77)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Runlinkat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 77));
return (ssize_t)host_size;
}
@@ -1808,12 +1533,10 @@ static ssize_t validate_Tsession(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 15;
VALIDATE_NET_BYTES(15);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsession->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(150))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsession->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(150));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsession->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 150)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsession->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 150));
return (ssize_t)host_size;
}
@@ -1824,12 +1547,10 @@ static ssize_t validate_Rsession(struct lib9p_ctx *ctx, uint32_t net_size, uint8
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 7;
VALIDATE_NET_BYTES(7);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsession->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(151))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsession->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(151));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsession->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 151)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsession->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 151));
return (ssize_t)host_size;
}
@@ -1845,12 +1566,10 @@ static ssize_t validate_Tsread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
VALIDATE_NET_UTF8(LAST_U16LE());
}
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(152))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(152));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsread->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 152)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tsread->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 152));
return (ssize_t)host_size;
}
@@ -1862,12 +1581,10 @@ static ssize_t validate_Rsread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t
VALIDATE_NET_BYTES(11);
VALIDATE_NET_BYTES(LAST_U32LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(153))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(153));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsread->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 153)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rsread->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 153));
return (ssize_t)host_size;
}
@@ -1885,12 +1602,10 @@ static ssize_t validate_Tswrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
VALIDATE_NET_BYTES(4);
VALIDATE_NET_BYTES(LAST_U32LE());
uint32_t offsetof_end = net_offset + 0;
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tswrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(154))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Tswrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(154));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tswrite->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 154)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Tswrite->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 154));
return (ssize_t)host_size;
}
@@ -1901,12 +1616,10 @@ static ssize_t validate_Rswrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_
uint32_t offsetof_typ = net_offset + 4;
uint32_t offsetof_end = net_offset + 11;
VALIDATE_NET_BYTES(11);
- if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rswrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
- (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
- if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(155))
- return lib9p_errorf(ctx, LIB9P_ERRNO_L_EBADMSG, "Rswrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
- (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(155));
+ if (GET_U32LE(offsetof_size) != offsetof_end - offsetof_size)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rswrite->size value is wrong: actual:", (base10, GET_U32LE(offsetof_size)), " != correct:", (base10, offsetof_end - offsetof_size));
+ if (GET_U8LE(offsetof_typ) != 155)
+ return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "Rswrite->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 155));
return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000_e */
@@ -3057,10 +2770,9 @@ static bool marshal_stat(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _
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 (%"PRIu32" > %"PRIu32")",
- "Tversion",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tversion message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3077,10 +2789,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rversion",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rversion message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3104,10 +2815,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tauth",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tauth message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3131,10 +2841,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rauth",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rauth message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3156,10 +2865,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tattach",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tattach message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3184,10 +2892,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rattach",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rattach message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3211,10 +2918,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rerror",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rerror message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3237,10 +2943,9 @@ static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val,
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 (%"PRIu32" > %"PRIu32")",
- "Tflush",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tflush message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3255,10 +2960,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rflush",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rflush message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3275,10 +2979,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Twalk",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Twalk message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3299,10 +3002,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rwalk",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rwalk message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3324,10 +3026,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Topen",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Topen message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3343,10 +3044,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Ropen",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Ropen message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3364,10 +3064,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tcreate",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tcreate message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3386,10 +3085,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rcreate",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rcreate message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3409,10 +3107,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tread",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tread message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3429,10 +3126,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rread",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rread message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3448,10 +3144,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Twrite",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Twrite message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3469,10 +3164,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rwrite",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rwrite message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3487,10 +3181,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tclunk",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tclunk message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3505,10 +3198,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rclunk",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rclunk message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3522,10 +3214,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tremove",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tremove message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3540,10 +3231,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rremove",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rremove message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3559,10 +3249,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tstat",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tstat message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3582,10 +3271,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rstat",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rstat message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3640,10 +3328,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Twstat",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Twstat message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3694,10 +3381,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rwstat",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rwstat message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3713,10 +3399,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Topenfd",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Topenfd message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3732,10 +3417,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Ropenfd",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Ropenfd message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3756,10 +3440,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rlerror",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlerror message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3774,10 +3457,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tstatfs",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tstatfs message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3792,10 +3474,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rstatfs",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rstatfs message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3818,10 +3499,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tlopen",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlopen message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3837,10 +3517,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rlopen",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlopen message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3858,10 +3537,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tlcreate",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlcreate message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3881,10 +3559,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rlcreate",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlcreate message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3902,10 +3579,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tsymlink",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsymlink message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3925,10 +3601,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rsymlink",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsymlink message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3945,10 +3620,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tmknod",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tmknod message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3969,10 +3643,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rmknod",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rmknod message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3989,10 +3662,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Trename",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Trename message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4010,10 +3682,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rrename",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rrename message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4027,10 +3698,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Treadlink",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Treadlink message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4045,10 +3715,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rreadlink",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rreadlink message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4064,10 +3733,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tgetattr",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tgetattr message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4083,10 +3751,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rgetattr",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rgetattr message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4122,10 +3789,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tsetattr",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsetattr message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4149,10 +3815,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rsetattr",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsetattr message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4166,10 +3831,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Txattrwalk",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Txattrwalk message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4187,10 +3851,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rxattrwalk",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rxattrwalk message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4205,10 +3868,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Txattrcreate",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Txattrcreate message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4227,10 +3889,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rxattrcreate",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rxattrcreate message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4244,10 +3905,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Treaddir",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Treaddir message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4264,10 +3924,9 @@ 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 (%"PRIu64" > %"PRIu32")",
- "Rreaddir",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rreaddir message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4283,10 +3942,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tfsync",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tfsync message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4302,10 +3960,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rfsync",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rfsync message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4319,10 +3976,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tlock",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlock message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4344,10 +4000,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rlock",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlock message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4362,10 +4017,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tgetlock",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tgetlock message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4386,10 +4040,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rgetlock",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rgetlock message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4409,10 +4062,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tlink",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlink message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4430,10 +4082,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rlink",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlink message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4447,10 +4098,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tmkdir",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tmkdir message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4469,10 +4119,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rmkdir",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rmkdir message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4489,10 +4138,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Trenameat",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Trenameat message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4512,10 +4160,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rrenameat",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rrenameat message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4529,10 +4176,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tunlinkat",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tunlinkat message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4550,10 +4196,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Runlinkat",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Runlinkat message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4569,10 +4214,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Tsession",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsession message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4587,10 +4231,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rsession",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsession message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4607,10 +4250,9 @@ 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 (%"PRIu64" > %"PRIu32")",
- "Tsread",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsread message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4630,10 +4272,9 @@ 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 (%"PRIu64" > %"PRIu32")",
- "Rsread",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsread message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4652,10 +4293,9 @@ 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 (%"PRIu64" > %"PRIu32")",
- "Tswrite",
- ctx->version ? "negotiated" : "client",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tswrite message too large to marshal into ",
+ ctx->version ? "negotiated" : "client", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4677,10 +4317,9 @@ 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 (%"PRIu32" > %"PRIu32")",
- "Rswrite",
- ctx->version ? "negotiated" : "server",
- needed_size, ctx->max_msg_size);
+ lib9p_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rswrite message too large to marshal into ",
+ ctx->version ? "negotiated" : "server", " limit",
+ " (", needed_size, " > ", ctx->max_msg_size, ")");
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4693,3158 +4332,3152 @@ static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val
}
#endif /* CONFIG_9P_ENABLE_9P2000_e */
-/* *_format *******************************************************************/
+/* fmt_print_* ****************************************************************/
#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) {
+[[maybe_unused]] static void fmt_print_tag(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_tag_t *self) {
switch (*self) {
case LIB9P_TAG_NOTAG:
- fmt_state_puts(state, "NOTAG");
+ fmt_print_str(w, "NOTAG");
break;
default:
- fmt_state_printf(state, "%"PRIu16, *self);
+ fmt_print_base10(w, *self);
}
}
-static void lib9p_fid_format(lib9p_fid_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_fid(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_fid_t *self) {
switch (*self) {
case LIB9P_FID_NOFID:
- fmt_state_puts(state, "NOFID");
+ fmt_print_str(w, "NOFID");
break;
default:
- fmt_state_printf(state, "%"PRIu32, *self);
+ fmt_print_base10(w, *self);
}
}
-static void lib9p_s_format(struct lib9p_s *self, struct fmt_state *state) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- fmt_state_printf(state, "%.*q", self->len, self->utf8);
-#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_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) {
+[[maybe_unused]] static void fmt_print_dm(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_dm_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<31)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "DIR");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "DIR");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<30)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "APPEND");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "APPEND");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<29)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "EXCL");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "EXCL");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<28)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "_PLAN9_MOUNT");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "_PLAN9_MOUNT");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<27)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "AUTH");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "AUTH");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<26)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "TMP");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "TMP");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<25)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<25");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<25");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<24)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<24");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<24");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<23)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "DEVICE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "DEVICE");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<22)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<22");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<22");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<21)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PIPE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PIPE");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<20)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "SOCKET");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "SOCKET");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<19)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "SETUID");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "SETUID");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<18)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "SETGID");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "SETGID");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<17)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<17");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<17");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<16)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<16");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<16");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<15)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<15");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<15");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<14)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<14");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<14");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<13)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<13");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<13");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<12)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<12");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<12");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<11)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<11");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<11");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<10)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<10");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<10");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<9)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<9");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<9");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<8)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "OWNER_R");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "OWNER_R");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "OWNER_W");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "OWNER_W");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "OWNER_X");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "OWNER_X");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "GROUP_R");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "GROUP_R");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "GROUP_W");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "GROUP_W");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "GROUP_X");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "GROUP_X");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "OTHER_R");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "OTHER_R");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<1)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "OTHER_W");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "OTHER_W");
empty = false;
}
if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<0)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "OTHER_X");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "OTHER_X");
empty = false;
}
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_printf(state, "%#04"PRIo32, *self & 0777);
- fmt_state_putchar(state, ')');
+ fmt_print_byte(w, '|');
+ fmt_print(w, (rjust, 4, '0', (base8, *self & 0777)));
+ fmt_print_byte(w, ')');
}
#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) {
+[[maybe_unused]] static void fmt_print_qt(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_qt_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if (*self & (UINT8_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "DIR");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "DIR");
empty = false;
}
if (*self & (UINT8_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "APPEND");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "APPEND");
empty = false;
}
if (*self & (UINT8_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "EXCL");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "EXCL");
empty = false;
}
if (*self & (UINT8_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "_PLAN9_MOUNT");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "_PLAN9_MOUNT");
empty = false;
}
if (*self & (UINT8_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "AUTH");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "AUTH");
empty = false;
}
if (*self & (UINT8_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "TMP");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "TMP");
empty = false;
}
if (*self & (UINT8_C(1)<<1)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "SYMLINK");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "SYMLINK");
empty = false;
}
if (*self & (UINT8_C(1)<<0)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<0");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<0");
empty = false;
}
if (empty)
- fmt_state_putchar(state, '0');
- fmt_state_putchar(state, ')');
-}
-
-static void lib9p_qid_format(struct lib9p_qid *self, struct fmt_state *state) {
- fmt_state_putchar(state, '{');
- fmt_state_puts(state, " type=");
- lib9p_qt_format(&self->type, state);
- fmt_state_puts(state, " vers=");
- fmt_state_printf(state, "%"PRIu32, self->vers);
- fmt_state_puts(state, " path=");
- fmt_state_printf(state, "%"PRIu64, self->path);
- fmt_state_puts(state, " }");
+ fmt_print_byte(w, '0');
+ fmt_print_byte(w, ')');
}
#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, '{');
- fmt_state_puts(state, " fstype=");
- fmt_state_printf(state, "%"PRIu16, self->fstype);
- fmt_state_puts(state, " fsdev=");
- fmt_state_printf(state, "%"PRIu32, self->fsdev);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " mode=");
- lib9p_dm_format(&self->mode, state);
- fmt_state_puts(state, " atime=");
- fmt_state_printf(state, "%"PRIu32, self->atime);
- fmt_state_puts(state, " mtime=");
- fmt_state_printf(state, "%"PRIu32, self->mtime);
- fmt_state_puts(state, " length=");
- fmt_state_printf(state, "%"PRIu64, self->length);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " owner_uname=");
- lib9p_s_format(&self->owner_uname, state);
- fmt_state_puts(state, " owner_gname=");
- lib9p_s_format(&self->owner_gname, state);
- fmt_state_puts(state, " last_modifier_uname=");
- lib9p_s_format(&self->last_modifier_uname, state);
-#if CONFIG_9P_ENABLE_9P2000_u
- fmt_state_puts(state, " extension=");
- lib9p_s_format(&self->extension, state);
- fmt_state_puts(state, " owner_unum=");
- lib9p_nuid_format(&self->owner_unum, state);
- fmt_state_puts(state, " owner_gnum=");
- lib9p_nuid_format(&self->owner_gnum, state);
- fmt_state_puts(state, " last_modifier_unum=");
- lib9p_nuid_format(&self->last_modifier_unum, state);
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_o_format(lib9p_o_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_o(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_o_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if (*self & (UINT8_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<7");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<7");
empty = false;
}
if (*self & (UINT8_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "RCLOSE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "RCLOSE");
empty = false;
}
if (*self & (UINT8_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "CEXEC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "CEXEC");
empty = false;
}
if (*self & (UINT8_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "TRUNC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "TRUNC");
empty = false;
}
if (*self & (UINT8_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<3");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<3");
empty = false;
}
if (*self & (UINT8_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<2");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<2");
empty = false;
}
switch (*self & LIB9P_O_MODE_MASK) {
case LIB9P_O_MODE_READ:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_READ");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_READ");
empty = false;
break;
case LIB9P_O_MODE_WRITE:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_WRITE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_WRITE");
empty = false;
break;
case LIB9P_O_MODE_RDWR:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_RDWR");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_RDWR");
empty = false;
break;
case LIB9P_O_MODE_EXEC:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_EXEC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_EXEC");
empty = false;
break;
default:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_printf(state, "%"PRIu8, *self & LIB9P_O_MODE_MASK);
+ fmt_print_byte(w, '|');
+ fmt_print_base10(w, *self & LIB9P_O_MODE_MASK);
empty = false;
}
if (empty)
- fmt_state_putchar(state, '0');
- fmt_state_putchar(state, ')');
+ fmt_print_byte(w, '0');
+ fmt_print_byte(w, ')');
}
#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_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=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " max_msg_size=");
- fmt_state_printf(state, "%"PRIu32, self->max_msg_size);
- fmt_state_puts(state, " version=");
- lib9p_s_format(&self->version, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rversion_format(struct lib9p_msg_Rversion *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rversion {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " max_msg_size=");
- fmt_state_printf(state, "%"PRIu32, self->max_msg_size);
- fmt_state_puts(state, " version=");
- lib9p_s_format(&self->version, 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_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 {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " afid=");
- lib9p_fid_format(&self->afid, state);
- fmt_state_puts(state, " uname=");
- lib9p_s_format(&self->uname, state);
- fmt_state_puts(state, " aname=");
- lib9p_s_format(&self->aname, state);
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
- fmt_state_puts(state, " unum=");
- lib9p_nuid_format(&self->unum, state);
-#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rauth_format(struct lib9p_msg_Rauth *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rauth {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " aqid=");
- lib9p_qid_format(&self->aqid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tattach_format(struct lib9p_msg_Tattach *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tattach {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " afid=");
- lib9p_fid_format(&self->afid, state);
- fmt_state_puts(state, " uname=");
- lib9p_s_format(&self->uname, state);
- fmt_state_puts(state, " aname=");
- lib9p_s_format(&self->aname, state);
-#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
- fmt_state_puts(state, " unum=");
- lib9p_nuid_format(&self->unum, state);
-#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rattach_format(struct lib9p_msg_Rattach *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rattach {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, 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 */
-#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=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " errstr=");
- lib9p_s_format(&self->errstr, state);
-#if CONFIG_9P_ENABLE_9P2000_u
- fmt_state_puts(state, " errnum=");
- lib9p_errno_format(&self->errnum, state);
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
- 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_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 {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " oldtag=");
- fmt_state_printf(state, "%"PRIu16, self->oldtag);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rflush_format(struct lib9p_msg_Rflush *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rflush {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Twalk_format(struct lib9p_msg_Twalk *self, struct fmt_state *state) {
- fmt_state_puts(state, "Twalk {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " newfid=");
- lib9p_fid_format(&self->newfid, state);
- fmt_state_puts(state, " nwname=");
- fmt_state_printf(state, "%"PRIu16, self->nwname);
- fmt_state_puts(state, " wname=[");
- for (uint16_t i = 0; i < self->nwname; i++) {
- if (i)
- fmt_state_putchar(state, ',');
- fmt_state_putchar(state, ' ');
- lib9p_s_format(&self->wname[i], state);
- }
- fmt_state_puts(state, " ]");
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rwalk_format(struct lib9p_msg_Rwalk *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rwalk {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " nwqid=");
- fmt_state_printf(state, "%"PRIu16, self->nwqid);
- fmt_state_puts(state, " wqid=[");
- for (uint16_t i = 0; i < self->nwqid; i++) {
- if (i)
- fmt_state_putchar(state, ',');
- fmt_state_putchar(state, ' ');
- lib9p_qid_format(&self->wqid[i], state);
- }
- fmt_state_puts(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 */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-static void lib9p_msg_Topen_format(struct lib9p_msg_Topen *self, struct fmt_state *state) {
- fmt_state_puts(state, "Topen {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " mode=");
- lib9p_o_format(&self->mode, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Ropen_format(struct lib9p_msg_Ropen *self, struct fmt_state *state) {
- fmt_state_puts(state, "Ropen {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " iounit=");
- fmt_state_printf(state, "%"PRIu32, self->iounit);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tcreate_format(struct lib9p_msg_Tcreate *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tcreate {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " perm=");
- lib9p_dm_format(&self->perm, state);
- fmt_state_puts(state, " mode=");
- lib9p_o_format(&self->mode, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rcreate_format(struct lib9p_msg_Rcreate *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rcreate {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " iounit=");
- fmt_state_printf(state, "%"PRIu32, self->iounit);
- fmt_state_puts(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
-static void lib9p_msg_Tread_format(struct lib9p_msg_Tread *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tread {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " offset=");
- fmt_state_printf(state, "%"PRIu64, self->offset);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rread_format(struct lib9p_msg_Rread *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rread {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
- if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- fmt_state_printf(state, " data=%.*q%s",
- (int)(self->count < 50 ? self->count : 50),
- (char *)self->data,
- self->count < 50 ? "" : "...");
-#pragma GCC diagnostic pop
- } else {
- fmt_state_puts(state, " data=<bytedata>");
- }
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Twrite_format(struct lib9p_msg_Twrite *self, struct fmt_state *state) {
- fmt_state_puts(state, "Twrite {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " offset=");
- fmt_state_printf(state, "%"PRIu64, self->offset);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
- if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- fmt_state_printf(state, " data=%.*q%s",
- (int)(self->count < 50 ? self->count : 50),
- (char *)self->data,
- self->count < 50 ? "" : "...");
-#pragma GCC diagnostic pop
- } else {
- fmt_state_puts(state, " data=<bytedata>");
- }
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rwrite_format(struct lib9p_msg_Rwrite *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rwrite {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tclunk_format(struct lib9p_msg_Tclunk *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tclunk {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rclunk_format(struct lib9p_msg_Rclunk *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rclunk {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tremove_format(struct lib9p_msg_Tremove *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tremove {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rremove_format(struct lib9p_msg_Rremove *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rremove {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, 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 */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-static void lib9p_msg_Tstat_format(struct lib9p_msg_Tstat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tstat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rstat_format(struct lib9p_msg_Rstat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rstat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " stat=");
- lib9p_stat_format(&self->stat, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Twstat_format(struct lib9p_msg_Twstat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Twstat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " stat=");
- lib9p_stat_format(&self->stat, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rwstat_format(struct lib9p_msg_Rwstat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rwstat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(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_p9p
-static void lib9p_msg_Topenfd_format(struct lib9p_msg_Topenfd *self, struct fmt_state *state) {
- fmt_state_puts(state, "Topenfd {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " mode=");
- lib9p_o_format(&self->mode, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Ropenfd_format(struct lib9p_msg_Ropenfd *self, struct fmt_state *state) {
- fmt_state_puts(state, "Ropenfd {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " iounit=");
- fmt_state_printf(state, "%"PRIu32, self->iounit);
- fmt_state_puts(state, " unixfd=");
- fmt_state_printf(state, "%"PRIu32, self->unixfd);
- fmt_state_puts(state, " }");
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
-#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
-static void lib9p_nuid_format(lib9p_nuid_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_nuid(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_nuid_t *self) {
switch (*self) {
case LIB9P_NUID_NONUID:
- fmt_state_puts(state, "NONUID");
+ fmt_print_str(w, "NONUID");
break;
default:
- fmt_state_printf(state, "%"PRIu32, *self);
+ fmt_print_base10(w, *self);
}
}
-static void lib9p_errno_format(lib9p_errno_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_errno(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_errno_t *self) {
switch (*self) {
case LIB9P_ERRNO_NOERROR:
- fmt_state_puts(state, "NOERROR");
+ fmt_print_str(w, "NOERROR");
break;
case LIB9P_ERRNO_L_EPERM:
- fmt_state_puts(state, "L_EPERM");
+ fmt_print_str(w, "L_EPERM");
break;
case LIB9P_ERRNO_L_ENOENT:
- fmt_state_puts(state, "L_ENOENT");
+ fmt_print_str(w, "L_ENOENT");
break;
case LIB9P_ERRNO_L_ESRCH:
- fmt_state_puts(state, "L_ESRCH");
+ fmt_print_str(w, "L_ESRCH");
break;
case LIB9P_ERRNO_L_EINTR:
- fmt_state_puts(state, "L_EINTR");
+ fmt_print_str(w, "L_EINTR");
break;
case LIB9P_ERRNO_L_EIO:
- fmt_state_puts(state, "L_EIO");
+ fmt_print_str(w, "L_EIO");
break;
case LIB9P_ERRNO_L_ENXIO:
- fmt_state_puts(state, "L_ENXIO");
+ fmt_print_str(w, "L_ENXIO");
break;
case LIB9P_ERRNO_L_E2BIG:
- fmt_state_puts(state, "L_E2BIG");
+ fmt_print_str(w, "L_E2BIG");
break;
case LIB9P_ERRNO_L_ENOEXEC:
- fmt_state_puts(state, "L_ENOEXEC");
+ fmt_print_str(w, "L_ENOEXEC");
break;
case LIB9P_ERRNO_L_EBADF:
- fmt_state_puts(state, "L_EBADF");
+ fmt_print_str(w, "L_EBADF");
break;
case LIB9P_ERRNO_L_ECHILD:
- fmt_state_puts(state, "L_ECHILD");
+ fmt_print_str(w, "L_ECHILD");
break;
case LIB9P_ERRNO_L_EAGAIN:
- fmt_state_puts(state, "L_EAGAIN");
+ fmt_print_str(w, "L_EAGAIN");
break;
case LIB9P_ERRNO_L_ENOMEM:
- fmt_state_puts(state, "L_ENOMEM");
+ fmt_print_str(w, "L_ENOMEM");
break;
case LIB9P_ERRNO_L_EACCES:
- fmt_state_puts(state, "L_EACCES");
+ fmt_print_str(w, "L_EACCES");
break;
case LIB9P_ERRNO_L_EFAULT:
- fmt_state_puts(state, "L_EFAULT");
+ fmt_print_str(w, "L_EFAULT");
break;
case LIB9P_ERRNO_L_ENOTBLK:
- fmt_state_puts(state, "L_ENOTBLK");
+ fmt_print_str(w, "L_ENOTBLK");
break;
case LIB9P_ERRNO_L_EBUSY:
- fmt_state_puts(state, "L_EBUSY");
+ fmt_print_str(w, "L_EBUSY");
break;
case LIB9P_ERRNO_L_EEXIST:
- fmt_state_puts(state, "L_EEXIST");
+ fmt_print_str(w, "L_EEXIST");
break;
case LIB9P_ERRNO_L_EXDEV:
- fmt_state_puts(state, "L_EXDEV");
+ fmt_print_str(w, "L_EXDEV");
break;
case LIB9P_ERRNO_L_ENODEV:
- fmt_state_puts(state, "L_ENODEV");
+ fmt_print_str(w, "L_ENODEV");
break;
case LIB9P_ERRNO_L_ENOTDIR:
- fmt_state_puts(state, "L_ENOTDIR");
+ fmt_print_str(w, "L_ENOTDIR");
break;
case LIB9P_ERRNO_L_EISDIR:
- fmt_state_puts(state, "L_EISDIR");
+ fmt_print_str(w, "L_EISDIR");
break;
case LIB9P_ERRNO_L_EINVAL:
- fmt_state_puts(state, "L_EINVAL");
+ fmt_print_str(w, "L_EINVAL");
break;
case LIB9P_ERRNO_L_ENFILE:
- fmt_state_puts(state, "L_ENFILE");
+ fmt_print_str(w, "L_ENFILE");
break;
case LIB9P_ERRNO_L_EMFILE:
- fmt_state_puts(state, "L_EMFILE");
+ fmt_print_str(w, "L_EMFILE");
break;
case LIB9P_ERRNO_L_ENOTTY:
- fmt_state_puts(state, "L_ENOTTY");
+ fmt_print_str(w, "L_ENOTTY");
break;
case LIB9P_ERRNO_L_ETXTBSY:
- fmt_state_puts(state, "L_ETXTBSY");
+ fmt_print_str(w, "L_ETXTBSY");
break;
case LIB9P_ERRNO_L_EFBIG:
- fmt_state_puts(state, "L_EFBIG");
+ fmt_print_str(w, "L_EFBIG");
break;
case LIB9P_ERRNO_L_ENOSPC:
- fmt_state_puts(state, "L_ENOSPC");
+ fmt_print_str(w, "L_ENOSPC");
break;
case LIB9P_ERRNO_L_ESPIPE:
- fmt_state_puts(state, "L_ESPIPE");
+ fmt_print_str(w, "L_ESPIPE");
break;
case LIB9P_ERRNO_L_EROFS:
- fmt_state_puts(state, "L_EROFS");
+ fmt_print_str(w, "L_EROFS");
break;
case LIB9P_ERRNO_L_EMLINK:
- fmt_state_puts(state, "L_EMLINK");
+ fmt_print_str(w, "L_EMLINK");
break;
case LIB9P_ERRNO_L_EPIPE:
- fmt_state_puts(state, "L_EPIPE");
+ fmt_print_str(w, "L_EPIPE");
break;
case LIB9P_ERRNO_L_EDOM:
- fmt_state_puts(state, "L_EDOM");
+ fmt_print_str(w, "L_EDOM");
break;
case LIB9P_ERRNO_L_ERANGE:
- fmt_state_puts(state, "L_ERANGE");
+ fmt_print_str(w, "L_ERANGE");
break;
case LIB9P_ERRNO_L_EDEADLK:
- fmt_state_puts(state, "L_EDEADLK");
+ fmt_print_str(w, "L_EDEADLK");
break;
case LIB9P_ERRNO_L_ENAMETOOLONG:
- fmt_state_puts(state, "L_ENAMETOOLONG");
+ fmt_print_str(w, "L_ENAMETOOLONG");
break;
case LIB9P_ERRNO_L_ENOLCK:
- fmt_state_puts(state, "L_ENOLCK");
+ fmt_print_str(w, "L_ENOLCK");
break;
case LIB9P_ERRNO_L_ENOSYS:
- fmt_state_puts(state, "L_ENOSYS");
+ fmt_print_str(w, "L_ENOSYS");
break;
case LIB9P_ERRNO_L_ENOTEMPTY:
- fmt_state_puts(state, "L_ENOTEMPTY");
+ fmt_print_str(w, "L_ENOTEMPTY");
break;
case LIB9P_ERRNO_L_ELOOP:
- fmt_state_puts(state, "L_ELOOP");
+ fmt_print_str(w, "L_ELOOP");
break;
case LIB9P_ERRNO_L_ENOMSG:
- fmt_state_puts(state, "L_ENOMSG");
+ fmt_print_str(w, "L_ENOMSG");
break;
case LIB9P_ERRNO_L_EIDRM:
- fmt_state_puts(state, "L_EIDRM");
+ fmt_print_str(w, "L_EIDRM");
break;
case LIB9P_ERRNO_L_ECHRNG:
- fmt_state_puts(state, "L_ECHRNG");
+ fmt_print_str(w, "L_ECHRNG");
break;
case LIB9P_ERRNO_L_EL2NSYNC:
- fmt_state_puts(state, "L_EL2NSYNC");
+ fmt_print_str(w, "L_EL2NSYNC");
break;
case LIB9P_ERRNO_L_EL3HLT:
- fmt_state_puts(state, "L_EL3HLT");
+ fmt_print_str(w, "L_EL3HLT");
break;
case LIB9P_ERRNO_L_EL3RST:
- fmt_state_puts(state, "L_EL3RST");
+ fmt_print_str(w, "L_EL3RST");
break;
case LIB9P_ERRNO_L_ELNRNG:
- fmt_state_puts(state, "L_ELNRNG");
+ fmt_print_str(w, "L_ELNRNG");
break;
case LIB9P_ERRNO_L_EUNATCH:
- fmt_state_puts(state, "L_EUNATCH");
+ fmt_print_str(w, "L_EUNATCH");
break;
case LIB9P_ERRNO_L_ENOCSI:
- fmt_state_puts(state, "L_ENOCSI");
+ fmt_print_str(w, "L_ENOCSI");
break;
case LIB9P_ERRNO_L_EL2HLT:
- fmt_state_puts(state, "L_EL2HLT");
+ fmt_print_str(w, "L_EL2HLT");
break;
case LIB9P_ERRNO_L_EBADE:
- fmt_state_puts(state, "L_EBADE");
+ fmt_print_str(w, "L_EBADE");
break;
case LIB9P_ERRNO_L_EBADR:
- fmt_state_puts(state, "L_EBADR");
+ fmt_print_str(w, "L_EBADR");
break;
case LIB9P_ERRNO_L_EXFULL:
- fmt_state_puts(state, "L_EXFULL");
+ fmt_print_str(w, "L_EXFULL");
break;
case LIB9P_ERRNO_L_ENOANO:
- fmt_state_puts(state, "L_ENOANO");
+ fmt_print_str(w, "L_ENOANO");
break;
case LIB9P_ERRNO_L_EBADRQC:
- fmt_state_puts(state, "L_EBADRQC");
+ fmt_print_str(w, "L_EBADRQC");
break;
case LIB9P_ERRNO_L_EBADSLT:
- fmt_state_puts(state, "L_EBADSLT");
+ fmt_print_str(w, "L_EBADSLT");
break;
case LIB9P_ERRNO_L_EBFONT:
- fmt_state_puts(state, "L_EBFONT");
+ fmt_print_str(w, "L_EBFONT");
break;
case LIB9P_ERRNO_L_ENOSTR:
- fmt_state_puts(state, "L_ENOSTR");
+ fmt_print_str(w, "L_ENOSTR");
break;
case LIB9P_ERRNO_L_ENODATA:
- fmt_state_puts(state, "L_ENODATA");
+ fmt_print_str(w, "L_ENODATA");
break;
case LIB9P_ERRNO_L_ETIME:
- fmt_state_puts(state, "L_ETIME");
+ fmt_print_str(w, "L_ETIME");
break;
case LIB9P_ERRNO_L_ENOSR:
- fmt_state_puts(state, "L_ENOSR");
+ fmt_print_str(w, "L_ENOSR");
break;
case LIB9P_ERRNO_L_ENONET:
- fmt_state_puts(state, "L_ENONET");
+ fmt_print_str(w, "L_ENONET");
break;
case LIB9P_ERRNO_L_ENOPKG:
- fmt_state_puts(state, "L_ENOPKG");
+ fmt_print_str(w, "L_ENOPKG");
break;
case LIB9P_ERRNO_L_EREMOTE:
- fmt_state_puts(state, "L_EREMOTE");
+ fmt_print_str(w, "L_EREMOTE");
break;
case LIB9P_ERRNO_L_ENOLINK:
- fmt_state_puts(state, "L_ENOLINK");
+ fmt_print_str(w, "L_ENOLINK");
break;
case LIB9P_ERRNO_L_EADV:
- fmt_state_puts(state, "L_EADV");
+ fmt_print_str(w, "L_EADV");
break;
case LIB9P_ERRNO_L_ESRMNT:
- fmt_state_puts(state, "L_ESRMNT");
+ fmt_print_str(w, "L_ESRMNT");
break;
case LIB9P_ERRNO_L_ECOMM:
- fmt_state_puts(state, "L_ECOMM");
+ fmt_print_str(w, "L_ECOMM");
break;
case LIB9P_ERRNO_L_EPROTO:
- fmt_state_puts(state, "L_EPROTO");
+ fmt_print_str(w, "L_EPROTO");
break;
case LIB9P_ERRNO_L_EMULTIHOP:
- fmt_state_puts(state, "L_EMULTIHOP");
+ fmt_print_str(w, "L_EMULTIHOP");
break;
case LIB9P_ERRNO_L_EDOTDOT:
- fmt_state_puts(state, "L_EDOTDOT");
+ fmt_print_str(w, "L_EDOTDOT");
break;
case LIB9P_ERRNO_L_EBADMSG:
- fmt_state_puts(state, "L_EBADMSG");
+ fmt_print_str(w, "L_EBADMSG");
break;
case LIB9P_ERRNO_L_EOVERFLOW:
- fmt_state_puts(state, "L_EOVERFLOW");
+ fmt_print_str(w, "L_EOVERFLOW");
break;
case LIB9P_ERRNO_L_ENOTUNIQ:
- fmt_state_puts(state, "L_ENOTUNIQ");
+ fmt_print_str(w, "L_ENOTUNIQ");
break;
case LIB9P_ERRNO_L_EBADFD:
- fmt_state_puts(state, "L_EBADFD");
+ fmt_print_str(w, "L_EBADFD");
break;
case LIB9P_ERRNO_L_EREMCHG:
- fmt_state_puts(state, "L_EREMCHG");
+ fmt_print_str(w, "L_EREMCHG");
break;
case LIB9P_ERRNO_L_ELIBACC:
- fmt_state_puts(state, "L_ELIBACC");
+ fmt_print_str(w, "L_ELIBACC");
break;
case LIB9P_ERRNO_L_ELIBBAD:
- fmt_state_puts(state, "L_ELIBBAD");
+ fmt_print_str(w, "L_ELIBBAD");
break;
case LIB9P_ERRNO_L_ELIBSCN:
- fmt_state_puts(state, "L_ELIBSCN");
+ fmt_print_str(w, "L_ELIBSCN");
break;
case LIB9P_ERRNO_L_ELIBMAX:
- fmt_state_puts(state, "L_ELIBMAX");
+ fmt_print_str(w, "L_ELIBMAX");
break;
case LIB9P_ERRNO_L_ELIBEXEC:
- fmt_state_puts(state, "L_ELIBEXEC");
+ fmt_print_str(w, "L_ELIBEXEC");
break;
case LIB9P_ERRNO_L_EILSEQ:
- fmt_state_puts(state, "L_EILSEQ");
+ fmt_print_str(w, "L_EILSEQ");
break;
case LIB9P_ERRNO_L_ERESTART:
- fmt_state_puts(state, "L_ERESTART");
+ fmt_print_str(w, "L_ERESTART");
break;
case LIB9P_ERRNO_L_ESTRPIPE:
- fmt_state_puts(state, "L_ESTRPIPE");
+ fmt_print_str(w, "L_ESTRPIPE");
break;
case LIB9P_ERRNO_L_EUSERS:
- fmt_state_puts(state, "L_EUSERS");
+ fmt_print_str(w, "L_EUSERS");
break;
case LIB9P_ERRNO_L_ENOTSOCK:
- fmt_state_puts(state, "L_ENOTSOCK");
+ fmt_print_str(w, "L_ENOTSOCK");
break;
case LIB9P_ERRNO_L_EDESTADDRREQ:
- fmt_state_puts(state, "L_EDESTADDRREQ");
+ fmt_print_str(w, "L_EDESTADDRREQ");
break;
case LIB9P_ERRNO_L_EMSGSIZE:
- fmt_state_puts(state, "L_EMSGSIZE");
+ fmt_print_str(w, "L_EMSGSIZE");
break;
case LIB9P_ERRNO_L_EPROTOTYPE:
- fmt_state_puts(state, "L_EPROTOTYPE");
+ fmt_print_str(w, "L_EPROTOTYPE");
break;
case LIB9P_ERRNO_L_ENOPROTOOPT:
- fmt_state_puts(state, "L_ENOPROTOOPT");
+ fmt_print_str(w, "L_ENOPROTOOPT");
break;
case LIB9P_ERRNO_L_EPROTONOSUPPORT:
- fmt_state_puts(state, "L_EPROTONOSUPPORT");
+ fmt_print_str(w, "L_EPROTONOSUPPORT");
break;
case LIB9P_ERRNO_L_ESOCKTNOSUPPORT:
- fmt_state_puts(state, "L_ESOCKTNOSUPPORT");
+ fmt_print_str(w, "L_ESOCKTNOSUPPORT");
break;
case LIB9P_ERRNO_L_EOPNOTSUPP:
- fmt_state_puts(state, "L_EOPNOTSUPP");
+ fmt_print_str(w, "L_EOPNOTSUPP");
break;
case LIB9P_ERRNO_L_EPFNOSUPPORT:
- fmt_state_puts(state, "L_EPFNOSUPPORT");
+ fmt_print_str(w, "L_EPFNOSUPPORT");
break;
case LIB9P_ERRNO_L_EAFNOSUPPORT:
- fmt_state_puts(state, "L_EAFNOSUPPORT");
+ fmt_print_str(w, "L_EAFNOSUPPORT");
break;
case LIB9P_ERRNO_L_EADDRINUSE:
- fmt_state_puts(state, "L_EADDRINUSE");
+ fmt_print_str(w, "L_EADDRINUSE");
break;
case LIB9P_ERRNO_L_EADDRNOTAVAIL:
- fmt_state_puts(state, "L_EADDRNOTAVAIL");
+ fmt_print_str(w, "L_EADDRNOTAVAIL");
break;
case LIB9P_ERRNO_L_ENETDOWN:
- fmt_state_puts(state, "L_ENETDOWN");
+ fmt_print_str(w, "L_ENETDOWN");
break;
case LIB9P_ERRNO_L_ENETUNREACH:
- fmt_state_puts(state, "L_ENETUNREACH");
+ fmt_print_str(w, "L_ENETUNREACH");
break;
case LIB9P_ERRNO_L_ENETRESET:
- fmt_state_puts(state, "L_ENETRESET");
+ fmt_print_str(w, "L_ENETRESET");
break;
case LIB9P_ERRNO_L_ECONNABORTED:
- fmt_state_puts(state, "L_ECONNABORTED");
+ fmt_print_str(w, "L_ECONNABORTED");
break;
case LIB9P_ERRNO_L_ECONNRESET:
- fmt_state_puts(state, "L_ECONNRESET");
+ fmt_print_str(w, "L_ECONNRESET");
break;
case LIB9P_ERRNO_L_ENOBUFS:
- fmt_state_puts(state, "L_ENOBUFS");
+ fmt_print_str(w, "L_ENOBUFS");
break;
case LIB9P_ERRNO_L_EISCONN:
- fmt_state_puts(state, "L_EISCONN");
+ fmt_print_str(w, "L_EISCONN");
break;
case LIB9P_ERRNO_L_ENOTCONN:
- fmt_state_puts(state, "L_ENOTCONN");
+ fmt_print_str(w, "L_ENOTCONN");
break;
case LIB9P_ERRNO_L_ESHUTDOWN:
- fmt_state_puts(state, "L_ESHUTDOWN");
+ fmt_print_str(w, "L_ESHUTDOWN");
break;
case LIB9P_ERRNO_L_ETOOMANYREFS:
- fmt_state_puts(state, "L_ETOOMANYREFS");
+ fmt_print_str(w, "L_ETOOMANYREFS");
break;
case LIB9P_ERRNO_L_ETIMEDOUT:
- fmt_state_puts(state, "L_ETIMEDOUT");
+ fmt_print_str(w, "L_ETIMEDOUT");
break;
case LIB9P_ERRNO_L_ECONNREFUSED:
- fmt_state_puts(state, "L_ECONNREFUSED");
+ fmt_print_str(w, "L_ECONNREFUSED");
break;
case LIB9P_ERRNO_L_EHOSTDOWN:
- fmt_state_puts(state, "L_EHOSTDOWN");
+ fmt_print_str(w, "L_EHOSTDOWN");
break;
case LIB9P_ERRNO_L_EHOSTUNREACH:
- fmt_state_puts(state, "L_EHOSTUNREACH");
+ fmt_print_str(w, "L_EHOSTUNREACH");
break;
case LIB9P_ERRNO_L_EALREADY:
- fmt_state_puts(state, "L_EALREADY");
+ fmt_print_str(w, "L_EALREADY");
break;
case LIB9P_ERRNO_L_EINPROGRESS:
- fmt_state_puts(state, "L_EINPROGRESS");
+ fmt_print_str(w, "L_EINPROGRESS");
break;
case LIB9P_ERRNO_L_ESTALE:
- fmt_state_puts(state, "L_ESTALE");
+ fmt_print_str(w, "L_ESTALE");
break;
case LIB9P_ERRNO_L_EUCLEAN:
- fmt_state_puts(state, "L_EUCLEAN");
+ fmt_print_str(w, "L_EUCLEAN");
break;
case LIB9P_ERRNO_L_ENOTNAM:
- fmt_state_puts(state, "L_ENOTNAM");
+ fmt_print_str(w, "L_ENOTNAM");
break;
case LIB9P_ERRNO_L_ENAVAIL:
- fmt_state_puts(state, "L_ENAVAIL");
+ fmt_print_str(w, "L_ENAVAIL");
break;
case LIB9P_ERRNO_L_EISNAM:
- fmt_state_puts(state, "L_EISNAM");
+ fmt_print_str(w, "L_EISNAM");
break;
case LIB9P_ERRNO_L_EREMOTEIO:
- fmt_state_puts(state, "L_EREMOTEIO");
+ fmt_print_str(w, "L_EREMOTEIO");
break;
case LIB9P_ERRNO_L_EDQUOT:
- fmt_state_puts(state, "L_EDQUOT");
+ fmt_print_str(w, "L_EDQUOT");
break;
case LIB9P_ERRNO_L_ENOMEDIUM:
- fmt_state_puts(state, "L_ENOMEDIUM");
+ fmt_print_str(w, "L_ENOMEDIUM");
break;
case LIB9P_ERRNO_L_EMEDIUMTYPE:
- fmt_state_puts(state, "L_EMEDIUMTYPE");
+ fmt_print_str(w, "L_EMEDIUMTYPE");
break;
case LIB9P_ERRNO_L_ECANCELED:
- fmt_state_puts(state, "L_ECANCELED");
+ fmt_print_str(w, "L_ECANCELED");
break;
case LIB9P_ERRNO_L_ENOKEY:
- fmt_state_puts(state, "L_ENOKEY");
+ fmt_print_str(w, "L_ENOKEY");
break;
case LIB9P_ERRNO_L_EKEYEXPIRED:
- fmt_state_puts(state, "L_EKEYEXPIRED");
+ fmt_print_str(w, "L_EKEYEXPIRED");
break;
case LIB9P_ERRNO_L_EKEYREVOKED:
- fmt_state_puts(state, "L_EKEYREVOKED");
+ fmt_print_str(w, "L_EKEYREVOKED");
break;
case LIB9P_ERRNO_L_EKEYREJECTED:
- fmt_state_puts(state, "L_EKEYREJECTED");
+ fmt_print_str(w, "L_EKEYREJECTED");
break;
case LIB9P_ERRNO_L_EOWNERDEAD:
- fmt_state_puts(state, "L_EOWNERDEAD");
+ fmt_print_str(w, "L_EOWNERDEAD");
break;
case LIB9P_ERRNO_L_ENOTRECOVERABLE:
- fmt_state_puts(state, "L_ENOTRECOVERABLE");
+ fmt_print_str(w, "L_ENOTRECOVERABLE");
break;
case LIB9P_ERRNO_L_ERFKILL:
- fmt_state_puts(state, "L_ERFKILL");
+ fmt_print_str(w, "L_ERFKILL");
break;
case LIB9P_ERRNO_L_EHWPOISON:
- fmt_state_puts(state, "L_EHWPOISON");
+ fmt_print_str(w, "L_EHWPOISON");
break;
default:
- fmt_state_printf(state, "%"PRIu32, *self);
+ fmt_print_base10(w, *self);
}
}
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_L
-static void lib9p_super_magic_format(lib9p_super_magic_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_super_magic(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_super_magic_t *self) {
switch (*self) {
case LIB9P_SUPER_MAGIC_V9FS_MAGIC:
- fmt_state_puts(state, "V9FS_MAGIC");
+ fmt_print_str(w, "V9FS_MAGIC");
break;
default:
- fmt_state_printf(state, "%"PRIu32, *self);
+ fmt_print_base10(w, *self);
}
}
-static void lib9p_lo_format(lib9p_lo_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_lo(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_lo_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if (*self & (UINT32_C(1)<<31)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<31");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<31");
empty = false;
}
if (*self & (UINT32_C(1)<<30)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<30");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<30");
empty = false;
}
if (*self & (UINT32_C(1)<<29)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<29");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<29");
empty = false;
}
if (*self & (UINT32_C(1)<<28)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<28");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<28");
empty = false;
}
if (*self & (UINT32_C(1)<<27)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<27");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<27");
empty = false;
}
if (*self & (UINT32_C(1)<<26)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<26");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<26");
empty = false;
}
if (*self & (UINT32_C(1)<<25)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<25");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<25");
empty = false;
}
if (*self & (UINT32_C(1)<<24)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<24");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<24");
empty = false;
}
if (*self & (UINT32_C(1)<<23)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<23");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<23");
empty = false;
}
if (*self & (UINT32_C(1)<<22)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<22");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<22");
empty = false;
}
if (*self & (UINT32_C(1)<<21)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<21");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<21");
empty = false;
}
if (*self & (UINT32_C(1)<<20)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "SYNC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "SYNC");
empty = false;
}
if (*self & (UINT32_C(1)<<19)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "CLOEXEC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "CLOEXEC");
empty = false;
}
if (*self & (UINT32_C(1)<<18)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "NOATIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "NOATIME");
empty = false;
}
if (*self & (UINT32_C(1)<<17)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "NOFOLLOW");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "NOFOLLOW");
empty = false;
}
if (*self & (UINT32_C(1)<<16)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "DIRECTORY");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "DIRECTORY");
empty = false;
}
if (*self & (UINT32_C(1)<<15)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "LARGEFILE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "LARGEFILE");
empty = false;
}
if (*self & (UINT32_C(1)<<14)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "DIRECT");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "DIRECT");
empty = false;
}
if (*self & (UINT32_C(1)<<13)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "BSD_FASYNC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "BSD_FASYNC");
empty = false;
}
if (*self & (UINT32_C(1)<<12)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "DSYNC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "DSYNC");
empty = false;
}
if (*self & (UINT32_C(1)<<11)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "NONBLOCK");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "NONBLOCK");
empty = false;
}
if (*self & (UINT32_C(1)<<10)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "APPEND");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "APPEND");
empty = false;
}
if (*self & (UINT32_C(1)<<9)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "TRUNC");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "TRUNC");
empty = false;
}
if (*self & (UINT32_C(1)<<8)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "NOCTTY");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "NOCTTY");
empty = false;
}
if (*self & (UINT32_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "EXCL");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "EXCL");
empty = false;
}
if (*self & (UINT32_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "CREATE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "CREATE");
empty = false;
}
if (*self & (UINT32_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<5");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<5");
empty = false;
}
if (*self & (UINT32_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<4");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<4");
empty = false;
}
if (*self & (UINT32_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<3");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<3");
empty = false;
}
if (*self & (UINT32_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<2");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<2");
empty = false;
}
switch (*self & LIB9P_LO_MODE_MASK) {
case LIB9P_LO_MODE_RDONLY:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_RDONLY");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_RDONLY");
empty = false;
break;
case LIB9P_LO_MODE_WRONLY:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_WRONLY");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_WRONLY");
empty = false;
break;
case LIB9P_LO_MODE_RDWR:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_RDWR");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_RDWR");
empty = false;
break;
case LIB9P_LO_MODE_NOACCESS:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE_NOACCESS");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE_NOACCESS");
empty = false;
break;
default:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_printf(state, "%"PRIu32, *self & LIB9P_LO_MODE_MASK);
+ fmt_print_byte(w, '|');
+ fmt_print_base10(w, *self & LIB9P_LO_MODE_MASK);
empty = false;
}
if (empty)
- fmt_state_putchar(state, '0');
- fmt_state_putchar(state, ')');
+ fmt_print_byte(w, '0');
+ fmt_print_byte(w, ')');
}
-static void lib9p_dt_format(lib9p_dt_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_dt(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_dt_t *self) {
switch (*self) {
case LIB9P_DT_UNKNOWN:
- fmt_state_puts(state, "UNKNOWN");
+ fmt_print_str(w, "UNKNOWN");
break;
case LIB9P_DT_PIPE:
- fmt_state_puts(state, "PIPE");
+ fmt_print_str(w, "PIPE");
break;
case LIB9P_DT_CHAR_DEV:
- fmt_state_puts(state, "CHAR_DEV");
+ fmt_print_str(w, "CHAR_DEV");
break;
case LIB9P_DT_DIRECTORY:
- fmt_state_puts(state, "DIRECTORY");
+ fmt_print_str(w, "DIRECTORY");
break;
case LIB9P_DT_BLOCK_DEV:
- fmt_state_puts(state, "BLOCK_DEV");
+ fmt_print_str(w, "BLOCK_DEV");
break;
case LIB9P_DT_REGULAR:
- fmt_state_puts(state, "REGULAR");
+ fmt_print_str(w, "REGULAR");
break;
case LIB9P_DT_SYMLINK:
- fmt_state_puts(state, "SYMLINK");
+ fmt_print_str(w, "SYMLINK");
break;
case LIB9P_DT_SOCKET:
- fmt_state_puts(state, "SOCKET");
+ fmt_print_str(w, "SOCKET");
break;
case _LIB9P_DT_WHITEOUT:
- fmt_state_puts(state, "_WHITEOUT");
+ fmt_print_str(w, "_WHITEOUT");
break;
default:
- fmt_state_printf(state, "%"PRIu8, *self);
+ fmt_print_base10(w, *self);
}
}
-static void lib9p_mode_format(lib9p_mode_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_mode(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_mode_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if (*self & (UINT32_C(1)<<31)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<31");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<31");
empty = false;
}
if (*self & (UINT32_C(1)<<30)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<30");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<30");
empty = false;
}
if (*self & (UINT32_C(1)<<29)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<29");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<29");
empty = false;
}
if (*self & (UINT32_C(1)<<28)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<28");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<28");
empty = false;
}
if (*self & (UINT32_C(1)<<27)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<27");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<27");
empty = false;
}
if (*self & (UINT32_C(1)<<26)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<26");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<26");
empty = false;
}
if (*self & (UINT32_C(1)<<25)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<25");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<25");
empty = false;
}
if (*self & (UINT32_C(1)<<24)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<24");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<24");
empty = false;
}
if (*self & (UINT32_C(1)<<23)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<23");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<23");
empty = false;
}
if (*self & (UINT32_C(1)<<22)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<22");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<22");
empty = false;
}
if (*self & (UINT32_C(1)<<21)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<21");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<21");
empty = false;
}
if (*self & (UINT32_C(1)<<20)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<20");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<20");
empty = false;
}
if (*self & (UINT32_C(1)<<19)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<19");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<19");
empty = false;
}
if (*self & (UINT32_C(1)<<18)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<18");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<18");
empty = false;
}
if (*self & (UINT32_C(1)<<17)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<17");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<17");
empty = false;
}
if (*self & (UINT32_C(1)<<16)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<16");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<16");
empty = false;
}
switch (*self & LIB9P_MODE_FMT_MASK) {
case LIB9P_MODE_FMT_PIPE:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "FMT_PIPE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "FMT_PIPE");
empty = false;
break;
case LIB9P_MODE_FMT_CHAR_DEV:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "FMT_CHAR_DEV");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "FMT_CHAR_DEV");
empty = false;
break;
case LIB9P_MODE_FMT_DIRECTORY:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "FMT_DIRECTORY");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "FMT_DIRECTORY");
empty = false;
break;
case LIB9P_MODE_FMT_BLOCK_DEV:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "FMT_BLOCK_DEV");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "FMT_BLOCK_DEV");
empty = false;
break;
case LIB9P_MODE_FMT_REGULAR:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "FMT_REGULAR");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "FMT_REGULAR");
empty = false;
break;
case LIB9P_MODE_FMT_SYMLINK:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "FMT_SYMLINK");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "FMT_SYMLINK");
empty = false;
break;
case LIB9P_MODE_FMT_SOCKET:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "FMT_SOCKET");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "FMT_SOCKET");
empty = false;
break;
default:
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_printf(state, "%"PRIu32, *self & LIB9P_MODE_FMT_MASK);
+ fmt_print_byte(w, '|');
+ fmt_print_base10(w, *self & LIB9P_MODE_FMT_MASK);
empty = false;
}
if (*self & (UINT32_C(1)<<11)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_SETGROUP");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_SETGROUP");
empty = false;
}
if (*self & (UINT32_C(1)<<10)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_SETUSER");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_SETUSER");
empty = false;
}
if (*self & (UINT32_C(1)<<9)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_STICKY");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_STICKY");
empty = false;
}
if (*self & (UINT32_C(1)<<8)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_OWNER_R");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_OWNER_R");
empty = false;
}
if (*self & (UINT32_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_OWNER_W");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_OWNER_W");
empty = false;
}
if (*self & (UINT32_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_OWNER_X");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_OWNER_X");
empty = false;
}
if (*self & (UINT32_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_GROUP_R");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_GROUP_R");
empty = false;
}
if (*self & (UINT32_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_GROUP_W");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_GROUP_W");
empty = false;
}
if (*self & (UINT32_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_GROUP_X");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_GROUP_X");
empty = false;
}
if (*self & (UINT32_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_OTHER_R");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_OTHER_R");
empty = false;
}
if (*self & (UINT32_C(1)<<1)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_OTHER_W");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_OTHER_W");
empty = false;
}
if (*self & (UINT32_C(1)<<0)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "PERM_OTHER_X");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "PERM_OTHER_X");
empty = false;
}
if (empty)
- fmt_state_putchar(state, '0');
- fmt_state_putchar(state, ')');
+ fmt_print_byte(w, '0');
+ fmt_print_byte(w, ')');
}
-static void lib9p_b4_format(lib9p_b4_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_b4(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_b4_t *self) {
switch (*self) {
case LIB9P_B4_FALSE:
- fmt_state_puts(state, "FALSE");
+ fmt_print_str(w, "FALSE");
break;
case LIB9P_B4_TRUE:
- fmt_state_puts(state, "TRUE");
+ fmt_print_str(w, "TRUE");
break;
default:
- fmt_state_printf(state, "%"PRIu32, *self);
+ fmt_print_base10(w, *self);
}
}
-static void lib9p_getattr_format(lib9p_getattr_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_getattr(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_getattr_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if (*self & (UINT64_C(1)<<63)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<63");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<63");
empty = false;
}
if (*self & (UINT64_C(1)<<62)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<62");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<62");
empty = false;
}
if (*self & (UINT64_C(1)<<61)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<61");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<61");
empty = false;
}
if (*self & (UINT64_C(1)<<60)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<60");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<60");
empty = false;
}
if (*self & (UINT64_C(1)<<59)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<59");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<59");
empty = false;
}
if (*self & (UINT64_C(1)<<58)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<58");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<58");
empty = false;
}
if (*self & (UINT64_C(1)<<57)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<57");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<57");
empty = false;
}
if (*self & (UINT64_C(1)<<56)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<56");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<56");
empty = false;
}
if (*self & (UINT64_C(1)<<55)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<55");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<55");
empty = false;
}
if (*self & (UINT64_C(1)<<54)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<54");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<54");
empty = false;
}
if (*self & (UINT64_C(1)<<53)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<53");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<53");
empty = false;
}
if (*self & (UINT64_C(1)<<52)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<52");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<52");
empty = false;
}
if (*self & (UINT64_C(1)<<51)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<51");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<51");
empty = false;
}
if (*self & (UINT64_C(1)<<50)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<50");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<50");
empty = false;
}
if (*self & (UINT64_C(1)<<49)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<49");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<49");
empty = false;
}
if (*self & (UINT64_C(1)<<48)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<48");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<48");
empty = false;
}
if (*self & (UINT64_C(1)<<47)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<47");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<47");
empty = false;
}
if (*self & (UINT64_C(1)<<46)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<46");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<46");
empty = false;
}
if (*self & (UINT64_C(1)<<45)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<45");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<45");
empty = false;
}
if (*self & (UINT64_C(1)<<44)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<44");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<44");
empty = false;
}
if (*self & (UINT64_C(1)<<43)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<43");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<43");
empty = false;
}
if (*self & (UINT64_C(1)<<42)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<42");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<42");
empty = false;
}
if (*self & (UINT64_C(1)<<41)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<41");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<41");
empty = false;
}
if (*self & (UINT64_C(1)<<40)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<40");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<40");
empty = false;
}
if (*self & (UINT64_C(1)<<39)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<39");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<39");
empty = false;
}
if (*self & (UINT64_C(1)<<38)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<38");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<38");
empty = false;
}
if (*self & (UINT64_C(1)<<37)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<37");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<37");
empty = false;
}
if (*self & (UINT64_C(1)<<36)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<36");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<36");
empty = false;
}
if (*self & (UINT64_C(1)<<35)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<35");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<35");
empty = false;
}
if (*self & (UINT64_C(1)<<34)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<34");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<34");
empty = false;
}
if (*self & (UINT64_C(1)<<33)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<33");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<33");
empty = false;
}
if (*self & (UINT64_C(1)<<32)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<32");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<32");
empty = false;
}
if (*self & (UINT64_C(1)<<31)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<31");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<31");
empty = false;
}
if (*self & (UINT64_C(1)<<30)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<30");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<30");
empty = false;
}
if (*self & (UINT64_C(1)<<29)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<29");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<29");
empty = false;
}
if (*self & (UINT64_C(1)<<28)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<28");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<28");
empty = false;
}
if (*self & (UINT64_C(1)<<27)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<27");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<27");
empty = false;
}
if (*self & (UINT64_C(1)<<26)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<26");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<26");
empty = false;
}
if (*self & (UINT64_C(1)<<25)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<25");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<25");
empty = false;
}
if (*self & (UINT64_C(1)<<24)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<24");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<24");
empty = false;
}
if (*self & (UINT64_C(1)<<23)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<23");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<23");
empty = false;
}
if (*self & (UINT64_C(1)<<22)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<22");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<22");
empty = false;
}
if (*self & (UINT64_C(1)<<21)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<21");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<21");
empty = false;
}
if (*self & (UINT64_C(1)<<20)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<20");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<20");
empty = false;
}
if (*self & (UINT64_C(1)<<19)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<19");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<19");
empty = false;
}
if (*self & (UINT64_C(1)<<18)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<18");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<18");
empty = false;
}
if (*self & (UINT64_C(1)<<17)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<17");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<17");
empty = false;
}
if (*self & (UINT64_C(1)<<16)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<16");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<16");
empty = false;
}
if (*self & (UINT64_C(1)<<15)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<15");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<15");
empty = false;
}
if (*self & (UINT64_C(1)<<14)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<14");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<14");
empty = false;
}
if (*self & (UINT64_C(1)<<13)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "DATA_VERSION");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "DATA_VERSION");
empty = false;
}
if (*self & (UINT64_C(1)<<12)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "GEN");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "GEN");
empty = false;
}
if (*self & (UINT64_C(1)<<11)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "BTIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "BTIME");
empty = false;
}
if (*self & (UINT64_C(1)<<10)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "BLOCKS");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "BLOCKS");
empty = false;
}
if (*self & (UINT64_C(1)<<9)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "SIZE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "SIZE");
empty = false;
}
if (*self & (UINT64_C(1)<<8)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "INO");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "INO");
empty = false;
}
if (*self & (UINT64_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "CTIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "CTIME");
empty = false;
}
if (*self & (UINT64_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MTIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MTIME");
empty = false;
}
if (*self & (UINT64_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "ATIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "ATIME");
empty = false;
}
if (*self & (UINT64_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "RDEV");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "RDEV");
empty = false;
}
if (*self & (UINT64_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "GID");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "GID");
empty = false;
}
if (*self & (UINT64_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "UID");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "UID");
empty = false;
}
if (*self & (UINT64_C(1)<<1)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "NLINK");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "NLINK");
empty = false;
}
if (*self & (UINT64_C(1)<<0)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE");
empty = false;
}
if (empty)
- fmt_state_putchar(state, '0');
- fmt_state_putchar(state, ')');
+ fmt_print_byte(w, '0');
+ fmt_print_byte(w, ')');
}
-static void lib9p_setattr_format(lib9p_setattr_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_setattr(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_setattr_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if (*self & (UINT32_C(1)<<31)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<31");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<31");
empty = false;
}
if (*self & (UINT32_C(1)<<30)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<30");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<30");
empty = false;
}
if (*self & (UINT32_C(1)<<29)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<29");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<29");
empty = false;
}
if (*self & (UINT32_C(1)<<28)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<28");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<28");
empty = false;
}
if (*self & (UINT32_C(1)<<27)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<27");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<27");
empty = false;
}
if (*self & (UINT32_C(1)<<26)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<26");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<26");
empty = false;
}
if (*self & (UINT32_C(1)<<25)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<25");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<25");
empty = false;
}
if (*self & (UINT32_C(1)<<24)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<24");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<24");
empty = false;
}
if (*self & (UINT32_C(1)<<23)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<23");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<23");
empty = false;
}
if (*self & (UINT32_C(1)<<22)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<22");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<22");
empty = false;
}
if (*self & (UINT32_C(1)<<21)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<21");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<21");
empty = false;
}
if (*self & (UINT32_C(1)<<20)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<20");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<20");
empty = false;
}
if (*self & (UINT32_C(1)<<19)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<19");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<19");
empty = false;
}
if (*self & (UINT32_C(1)<<18)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<18");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<18");
empty = false;
}
if (*self & (UINT32_C(1)<<17)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<17");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<17");
empty = false;
}
if (*self & (UINT32_C(1)<<16)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<16");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<16");
empty = false;
}
if (*self & (UINT32_C(1)<<15)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<15");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<15");
empty = false;
}
if (*self & (UINT32_C(1)<<14)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<14");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<14");
empty = false;
}
if (*self & (UINT32_C(1)<<13)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<13");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<13");
empty = false;
}
if (*self & (UINT32_C(1)<<12)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<12");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<12");
empty = false;
}
if (*self & (UINT32_C(1)<<11)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<11");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<11");
empty = false;
}
if (*self & (UINT32_C(1)<<10)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<10");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<10");
empty = false;
}
if (*self & (UINT32_C(1)<<9)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<9");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<9");
empty = false;
}
if (*self & (UINT32_C(1)<<8)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MTIME_SET");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MTIME_SET");
empty = false;
}
if (*self & (UINT32_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "ATIME_SET");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "ATIME_SET");
empty = false;
}
if (*self & (UINT32_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "CTIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "CTIME");
empty = false;
}
if (*self & (UINT32_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MTIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MTIME");
empty = false;
}
if (*self & (UINT32_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "ATIME");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "ATIME");
empty = false;
}
if (*self & (UINT32_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "SIZE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "SIZE");
empty = false;
}
if (*self & (UINT32_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "GID");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "GID");
empty = false;
}
if (*self & (UINT32_C(1)<<1)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "UID");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "UID");
empty = false;
}
if (*self & (UINT32_C(1)<<0)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "MODE");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "MODE");
empty = false;
}
if (empty)
- fmt_state_putchar(state, '0');
- fmt_state_putchar(state, ')');
+ fmt_print_byte(w, '0');
+ fmt_print_byte(w, ')');
}
-static void lib9p_lock_type_format(lib9p_lock_type_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_lock_type(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_lock_type_t *self) {
switch (*self) {
case LIB9P_LOCK_TYPE_RDLCK:
- fmt_state_puts(state, "RDLCK");
+ fmt_print_str(w, "RDLCK");
break;
case LIB9P_LOCK_TYPE_WRLCK:
- fmt_state_puts(state, "WRLCK");
+ fmt_print_str(w, "WRLCK");
break;
case LIB9P_LOCK_TYPE_UNLCK:
- fmt_state_puts(state, "UNLCK");
+ fmt_print_str(w, "UNLCK");
break;
default:
- fmt_state_printf(state, "%"PRIu8, *self);
+ fmt_print_base10(w, *self);
}
}
-static void lib9p_lock_flags_format(lib9p_lock_flags_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_lock_flags(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_lock_flags_t *self) {
bool empty = true;
- fmt_state_putchar(state, '(');
+ fmt_print_byte(w, '(');
if (*self & (UINT32_C(1)<<31)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<31");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<31");
empty = false;
}
if (*self & (UINT32_C(1)<<30)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<30");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<30");
empty = false;
}
if (*self & (UINT32_C(1)<<29)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<29");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<29");
empty = false;
}
if (*self & (UINT32_C(1)<<28)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<28");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<28");
empty = false;
}
if (*self & (UINT32_C(1)<<27)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<27");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<27");
empty = false;
}
if (*self & (UINT32_C(1)<<26)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<26");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<26");
empty = false;
}
if (*self & (UINT32_C(1)<<25)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<25");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<25");
empty = false;
}
if (*self & (UINT32_C(1)<<24)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<24");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<24");
empty = false;
}
if (*self & (UINT32_C(1)<<23)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<23");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<23");
empty = false;
}
if (*self & (UINT32_C(1)<<22)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<22");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<22");
empty = false;
}
if (*self & (UINT32_C(1)<<21)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<21");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<21");
empty = false;
}
if (*self & (UINT32_C(1)<<20)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<20");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<20");
empty = false;
}
if (*self & (UINT32_C(1)<<19)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<19");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<19");
empty = false;
}
if (*self & (UINT32_C(1)<<18)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<18");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<18");
empty = false;
}
if (*self & (UINT32_C(1)<<17)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<17");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<17");
empty = false;
}
if (*self & (UINT32_C(1)<<16)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<16");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<16");
empty = false;
}
if (*self & (UINT32_C(1)<<15)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<15");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<15");
empty = false;
}
if (*self & (UINT32_C(1)<<14)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<14");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<14");
empty = false;
}
if (*self & (UINT32_C(1)<<13)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<13");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<13");
empty = false;
}
if (*self & (UINT32_C(1)<<12)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<12");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<12");
empty = false;
}
if (*self & (UINT32_C(1)<<11)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<11");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<11");
empty = false;
}
if (*self & (UINT32_C(1)<<10)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<10");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<10");
empty = false;
}
if (*self & (UINT32_C(1)<<9)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<9");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<9");
empty = false;
}
if (*self & (UINT32_C(1)<<8)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<8");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<8");
empty = false;
}
if (*self & (UINT32_C(1)<<7)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<7");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<7");
empty = false;
}
if (*self & (UINT32_C(1)<<6)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<6");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<6");
empty = false;
}
if (*self & (UINT32_C(1)<<5)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<5");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<5");
empty = false;
}
if (*self & (UINT32_C(1)<<4)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<4");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<4");
empty = false;
}
if (*self & (UINT32_C(1)<<3)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<3");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<3");
empty = false;
}
if (*self & (UINT32_C(1)<<2)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "1<<2");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "1<<2");
empty = false;
}
if (*self & (UINT32_C(1)<<1)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "RECLAIM");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "RECLAIM");
empty = false;
}
if (*self & (UINT32_C(1)<<0)) {
if (!empty)
- fmt_state_putchar(state, '|');
- fmt_state_puts(state, "BLOCK");
+ fmt_print_byte(w, '|');
+ fmt_print_str(w, "BLOCK");
empty = false;
}
if (empty)
- fmt_state_putchar(state, '0');
- fmt_state_putchar(state, ')');
+ fmt_print_byte(w, '0');
+ fmt_print_byte(w, ')');
}
-static void lib9p_lock_status_format(lib9p_lock_status_t *self, struct fmt_state *state) {
+[[maybe_unused]] static void fmt_print_lock_status(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, lib9p_lock_status_t *self) {
switch (*self) {
case LIB9P_LOCK_STATUS_SUCCESS:
- fmt_state_puts(state, "SUCCESS");
+ fmt_print_str(w, "SUCCESS");
break;
case LIB9P_LOCK_STATUS_BLOCKED:
- fmt_state_puts(state, "BLOCKED");
+ fmt_print_str(w, "BLOCKED");
break;
case LIB9P_LOCK_STATUS_ERROR:
- fmt_state_puts(state, "ERROR");
+ fmt_print_str(w, "ERROR");
break;
case LIB9P_LOCK_STATUS_GRACE:
- fmt_state_puts(state, "GRACE");
+ fmt_print_str(w, "GRACE");
break;
default:
- fmt_state_printf(state, "%"PRIu8, *self);
- }
-}
-
-static void lib9p_msg_Rlerror_format(struct lib9p_msg_Rlerror *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rlerror {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " errnum=");
- lib9p_errno_format(&self->errnum, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tstatfs_format(struct lib9p_msg_Tstatfs *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tstatfs {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rstatfs_format(struct lib9p_msg_Rstatfs *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rstatfs {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " type=");
- lib9p_super_magic_format(&self->type, state);
- fmt_state_puts(state, " bsize=");
- fmt_state_printf(state, "%"PRIu32, self->bsize);
- fmt_state_puts(state, " blocks=");
- fmt_state_printf(state, "%"PRIu64, self->blocks);
- fmt_state_puts(state, " bfree=");
- fmt_state_printf(state, "%"PRIu64, self->bfree);
- fmt_state_puts(state, " bavail=");
- fmt_state_printf(state, "%"PRIu64, self->bavail);
- fmt_state_puts(state, " files=");
- fmt_state_printf(state, "%"PRIu64, self->files);
- fmt_state_puts(state, " ffree=");
- fmt_state_printf(state, "%"PRIu64, self->ffree);
- fmt_state_puts(state, " fsid=");
- fmt_state_printf(state, "%"PRIu64, self->fsid);
- fmt_state_puts(state, " namelen=");
- fmt_state_printf(state, "%"PRIu32, self->namelen);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tlopen_format(struct lib9p_msg_Tlopen *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tlopen {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " flags=");
- lib9p_lo_format(&self->flags, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rlopen_format(struct lib9p_msg_Rlopen *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rlopen {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " iounit=");
- fmt_state_printf(state, "%"PRIu32, self->iounit);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tlcreate_format(struct lib9p_msg_Tlcreate *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tlcreate {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " flags=");
- lib9p_lo_format(&self->flags, state);
- fmt_state_puts(state, " mode=");
- lib9p_mode_format(&self->mode, state);
- fmt_state_puts(state, " gid=");
- lib9p_nuid_format(&self->gid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rlcreate_format(struct lib9p_msg_Rlcreate *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rlcreate {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " iounit=");
- fmt_state_printf(state, "%"PRIu32, self->iounit);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tsymlink_format(struct lib9p_msg_Tsymlink *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tsymlink {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " symtgt=");
- lib9p_s_format(&self->symtgt, state);
- fmt_state_puts(state, " gid=");
- lib9p_nuid_format(&self->gid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rsymlink_format(struct lib9p_msg_Rsymlink *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rsymlink {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tmknod_format(struct lib9p_msg_Tmknod *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tmknod {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " dfid=");
- lib9p_fid_format(&self->dfid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " mode=");
- lib9p_mode_format(&self->mode, state);
- fmt_state_puts(state, " major=");
- fmt_state_printf(state, "%"PRIu32, self->major);
- fmt_state_puts(state, " minor=");
- fmt_state_printf(state, "%"PRIu32, self->minor);
- fmt_state_puts(state, " gid=");
- lib9p_nuid_format(&self->gid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rmknod_format(struct lib9p_msg_Rmknod *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rmknod {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Trename_format(struct lib9p_msg_Trename *self, struct fmt_state *state) {
- fmt_state_puts(state, "Trename {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " dfid=");
- lib9p_fid_format(&self->dfid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rrename_format(struct lib9p_msg_Rrename *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rrename {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Treadlink_format(struct lib9p_msg_Treadlink *self, struct fmt_state *state) {
- fmt_state_puts(state, "Treadlink {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rreadlink_format(struct lib9p_msg_Rreadlink *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rreadlink {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " target=");
- lib9p_s_format(&self->target, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tgetattr_format(struct lib9p_msg_Tgetattr *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tgetattr {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " request_mask=");
- lib9p_getattr_format(&self->request_mask, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rgetattr_format(struct lib9p_msg_Rgetattr *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rgetattr {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " valid=");
- lib9p_getattr_format(&self->valid, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " mode=");
- lib9p_mode_format(&self->mode, state);
- fmt_state_puts(state, " uid=");
- lib9p_nuid_format(&self->uid, state);
- fmt_state_puts(state, " gid=");
- lib9p_nuid_format(&self->gid, state);
- fmt_state_puts(state, " nlink=");
- fmt_state_printf(state, "%"PRIu64, self->nlink);
- fmt_state_puts(state, " rdev=");
- fmt_state_printf(state, "%"PRIu64, self->rdev);
- fmt_state_puts(state, " filesize=");
- fmt_state_printf(state, "%"PRIu64, self->filesize);
- fmt_state_puts(state, " blksize=");
- fmt_state_printf(state, "%"PRIu64, self->blksize);
- fmt_state_puts(state, " blocks=");
- fmt_state_printf(state, "%"PRIu64, self->blocks);
- fmt_state_puts(state, " atime_sec=");
- fmt_state_printf(state, "%"PRIu64, self->atime_sec);
- fmt_state_puts(state, " atime_nsec=");
- fmt_state_printf(state, "%"PRIu64, self->atime_nsec);
- fmt_state_puts(state, " mtime_sec=");
- fmt_state_printf(state, "%"PRIu64, self->mtime_sec);
- fmt_state_puts(state, " mtime_nsec=");
- fmt_state_printf(state, "%"PRIu64, self->mtime_nsec);
- fmt_state_puts(state, " ctime_sec=");
- fmt_state_printf(state, "%"PRIu64, self->ctime_sec);
- fmt_state_puts(state, " ctime_nsec=");
- fmt_state_printf(state, "%"PRIu64, self->ctime_nsec);
- fmt_state_puts(state, " btime_sec=");
- fmt_state_printf(state, "%"PRIu64, self->btime_sec);
- fmt_state_puts(state, " btime_nsec=");
- fmt_state_printf(state, "%"PRIu64, self->btime_nsec);
- fmt_state_puts(state, " gen=");
- fmt_state_printf(state, "%"PRIu64, self->gen);
- fmt_state_puts(state, " data_version=");
- fmt_state_printf(state, "%"PRIu64, self->data_version);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tsetattr_format(struct lib9p_msg_Tsetattr *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tsetattr {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " valid=");
- lib9p_setattr_format(&self->valid, state);
- fmt_state_puts(state, " mode=");
- lib9p_mode_format(&self->mode, state);
- fmt_state_puts(state, " uid=");
- lib9p_nuid_format(&self->uid, state);
- fmt_state_puts(state, " gid=");
- lib9p_nuid_format(&self->gid, state);
- fmt_state_puts(state, " filesize=");
- fmt_state_printf(state, "%"PRIu64, self->filesize);
- fmt_state_puts(state, " atime_sec=");
- fmt_state_printf(state, "%"PRIu64, self->atime_sec);
- fmt_state_puts(state, " atime_nsec=");
- fmt_state_printf(state, "%"PRIu64, self->atime_nsec);
- fmt_state_puts(state, " mtime_sec=");
- fmt_state_printf(state, "%"PRIu64, self->mtime_sec);
- fmt_state_puts(state, " mtime_nsec=");
- fmt_state_printf(state, "%"PRIu64, self->mtime_nsec);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rsetattr_format(struct lib9p_msg_Rsetattr *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rsetattr {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Txattrwalk_format(struct lib9p_msg_Txattrwalk *self, struct fmt_state *state) {
- fmt_state_puts(state, "Txattrwalk {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " newfid=");
- lib9p_fid_format(&self->newfid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rxattrwalk_format(struct lib9p_msg_Rxattrwalk *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rxattrwalk {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " attr_size=");
- fmt_state_printf(state, "%"PRIu64, self->attr_size);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Txattrcreate_format(struct lib9p_msg_Txattrcreate *self, struct fmt_state *state) {
- fmt_state_puts(state, "Txattrcreate {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " attr_size=");
- fmt_state_printf(state, "%"PRIu64, self->attr_size);
- fmt_state_puts(state, " flags=");
- fmt_state_printf(state, "%"PRIu32, self->flags);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rxattrcreate_format(struct lib9p_msg_Rxattrcreate *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rxattrcreate {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Treaddir_format(struct lib9p_msg_Treaddir *self, struct fmt_state *state) {
- fmt_state_puts(state, "Treaddir {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " offset=");
- fmt_state_printf(state, "%"PRIu64, self->offset);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rreaddir_format(struct lib9p_msg_Rreaddir *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rreaddir {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_print_base10(w, *self);
+ }
+}
+
+#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_uninitialized
+[[maybe_unused]] static void fmt_print_s(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_s *self) {
+ fmt_print_qmem(w, self->utf8, self->len);
+}
+
+[[maybe_unused]] static void fmt_print_qid(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_qid *self) {
+ fmt_print_byte(w, '{');
+ fmt_print_str(w, " type=");
+ fmt_print_qt(w, ctx, &self->type);
+ fmt_print_str(w, " vers=");
+ fmt_print_base10(w, self->vers);
+ fmt_print_str(w, " path=");
+ fmt_print_base10(w, self->path);
+ fmt_print_str(w, " }");
+}
+
+#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
+[[maybe_unused]] static void fmt_print_Tflush(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tflush *self) {
+ fmt_print_str(w, "Tflush {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " oldtag=");
+ fmt_print_base10(w, self->oldtag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rflush(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rflush *self) {
+ fmt_print_str(w, "Rflush {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+#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
+[[maybe_unused]] static void fmt_print_Topen(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Topen *self) {
+ fmt_print_str(w, "Topen {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " mode=");
+ fmt_print_o(w, ctx, &self->mode);
+ fmt_print_str(w, " }");
+}
+
+#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
+[[maybe_unused]] static void fmt_print_Tread(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tread *self) {
+ fmt_print_str(w, "Tread {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " offset=");
+ fmt_print_base10(w, self->offset);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rread(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rread *self) {
+ fmt_print_str(w, "Rread {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
+ if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
+ fmt_print_str(w, " data=");
+ fmt_print_qmem(w, self->data, self->count < 50 ? self->count : 50);
+ if (self->count > 50)
+ fmt_print_str(w, "...");
+ } else {
+ fmt_print_str(w, " data=<bytedata>");
+ }
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Twrite(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Twrite *self) {
+ fmt_print_str(w, "Twrite {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " offset=");
+ fmt_print_base10(w, self->offset);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
+ if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
+ fmt_print_str(w, " data=");
+ fmt_print_qmem(w, self->data, self->count < 50 ? self->count : 50);
+ if (self->count > 50)
+ fmt_print_str(w, "...");
+ } else {
+ fmt_print_str(w, " data=<bytedata>");
+ }
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rwrite(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rwrite *self) {
+ fmt_print_str(w, "Rwrite {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tclunk(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tclunk *self) {
+ fmt_print_str(w, "Tclunk {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rclunk(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rclunk *self) {
+ fmt_print_str(w, "Rclunk {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tremove(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tremove *self) {
+ fmt_print_str(w, "Tremove {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rremove(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rremove *self) {
+ fmt_print_str(w, "Rremove {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+#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
+[[maybe_unused]] static void fmt_print_Tstat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tstat *self) {
+ fmt_print_str(w, "Tstat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rwstat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rwstat *self) {
+ fmt_print_str(w, "Rwstat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+#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_p9p
+[[maybe_unused]] static void fmt_print_Topenfd(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Topenfd *self) {
+ fmt_print_str(w, "Topenfd {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " mode=");
+ fmt_print_o(w, ctx, &self->mode);
+ fmt_print_str(w, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
+#if CONFIG_9P_ENABLE_9P2000_L
+[[maybe_unused]] static void fmt_print_Rlerror(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rlerror *self) {
+ fmt_print_str(w, "Rlerror {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " errnum=");
+ fmt_print_errno(w, ctx, &self->errnum);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tstatfs(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tstatfs *self) {
+ fmt_print_str(w, "Tstatfs {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rstatfs(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rstatfs *self) {
+ fmt_print_str(w, "Rstatfs {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " type=");
+ fmt_print_super_magic(w, ctx, &self->type);
+ fmt_print_str(w, " bsize=");
+ fmt_print_base10(w, self->bsize);
+ fmt_print_str(w, " blocks=");
+ fmt_print_base10(w, self->blocks);
+ fmt_print_str(w, " bfree=");
+ fmt_print_base10(w, self->bfree);
+ fmt_print_str(w, " bavail=");
+ fmt_print_base10(w, self->bavail);
+ fmt_print_str(w, " files=");
+ fmt_print_base10(w, self->files);
+ fmt_print_str(w, " ffree=");
+ fmt_print_base10(w, self->ffree);
+ fmt_print_str(w, " fsid=");
+ fmt_print_base10(w, self->fsid);
+ fmt_print_str(w, " namelen=");
+ fmt_print_base10(w, self->namelen);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tlopen(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tlopen *self) {
+ fmt_print_str(w, "Tlopen {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " flags=");
+ fmt_print_lo(w, ctx, &self->flags);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rrename(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rrename *self) {
+ fmt_print_str(w, "Rrename {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Treadlink(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Treadlink *self) {
+ fmt_print_str(w, "Treadlink {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tgetattr(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tgetattr *self) {
+ fmt_print_str(w, "Tgetattr {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " request_mask=");
+ fmt_print_getattr(w, ctx, &self->request_mask);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tsetattr(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tsetattr *self) {
+ fmt_print_str(w, "Tsetattr {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " valid=");
+ fmt_print_setattr(w, ctx, &self->valid);
+ fmt_print_str(w, " mode=");
+ fmt_print_mode(w, ctx, &self->mode);
+ fmt_print_str(w, " uid=");
+ fmt_print_nuid(w, ctx, &self->uid);
+ fmt_print_str(w, " gid=");
+ fmt_print_nuid(w, ctx, &self->gid);
+ fmt_print_str(w, " filesize=");
+ fmt_print_base10(w, self->filesize);
+ fmt_print_str(w, " atime_sec=");
+ fmt_print_base10(w, self->atime_sec);
+ fmt_print_str(w, " atime_nsec=");
+ fmt_print_base10(w, self->atime_nsec);
+ fmt_print_str(w, " mtime_sec=");
+ fmt_print_base10(w, self->mtime_sec);
+ fmt_print_str(w, " mtime_nsec=");
+ fmt_print_base10(w, self->mtime_nsec);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rsetattr(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rsetattr *self) {
+ fmt_print_str(w, "Rsetattr {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rxattrwalk(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrwalk *self) {
+ fmt_print_str(w, "Rxattrwalk {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " attr_size=");
+ fmt_print_base10(w, self->attr_size);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rxattrcreate(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrcreate *self) {
+ fmt_print_str(w, "Rxattrcreate {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Treaddir(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Treaddir *self) {
+ fmt_print_str(w, "Treaddir {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " offset=");
+ fmt_print_base10(w, self->offset);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rreaddir(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rreaddir *self) {
+ fmt_print_str(w, "Rreaddir {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- fmt_state_printf(state, " data=%.*q%s",
- (int)(self->count < 50 ? self->count : 50),
- (char *)self->data,
- self->count < 50 ? "" : "...");
-#pragma GCC diagnostic pop
+ fmt_print_str(w, " data=");
+ fmt_print_qmem(w, self->data, self->count < 50 ? self->count : 50);
+ if (self->count > 50)
+ fmt_print_str(w, "...");
} else {
- fmt_state_puts(state, " data=<bytedata>");
- }
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tfsync_format(struct lib9p_msg_Tfsync *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tfsync {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " datasync=");
- lib9p_b4_format(&self->datasync, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rfsync_format(struct lib9p_msg_Rfsync *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rfsync {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tlock_format(struct lib9p_msg_Tlock *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tlock {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " type=");
- lib9p_lock_type_format(&self->type, state);
- fmt_state_puts(state, " flags=");
- lib9p_lock_flags_format(&self->flags, state);
- fmt_state_puts(state, " start=");
- fmt_state_printf(state, "%"PRIu64, self->start);
- fmt_state_puts(state, " length=");
- fmt_state_printf(state, "%"PRIu64, self->length);
- fmt_state_puts(state, " proc_id=");
- fmt_state_printf(state, "%"PRIu32, self->proc_id);
- fmt_state_puts(state, " client_id=");
- lib9p_s_format(&self->client_id, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rlock_format(struct lib9p_msg_Rlock *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rlock {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " status=");
- lib9p_lock_status_format(&self->status, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tgetlock_format(struct lib9p_msg_Tgetlock *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tgetlock {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " type=");
- lib9p_lock_type_format(&self->type, state);
- fmt_state_puts(state, " start=");
- fmt_state_printf(state, "%"PRIu64, self->start);
- fmt_state_puts(state, " length=");
- fmt_state_printf(state, "%"PRIu64, self->length);
- fmt_state_puts(state, " proc_id=");
- fmt_state_printf(state, "%"PRIu32, self->proc_id);
- fmt_state_puts(state, " client_id=");
- lib9p_s_format(&self->client_id, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rgetlock_format(struct lib9p_msg_Rgetlock *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rgetlock {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " type=");
- lib9p_lock_type_format(&self->type, state);
- fmt_state_puts(state, " start=");
- fmt_state_printf(state, "%"PRIu64, self->start);
- fmt_state_puts(state, " length=");
- fmt_state_printf(state, "%"PRIu64, self->length);
- fmt_state_puts(state, " proc_id=");
- fmt_state_printf(state, "%"PRIu32, self->proc_id);
- fmt_state_puts(state, " client_id=");
- lib9p_s_format(&self->client_id, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tlink_format(struct lib9p_msg_Tlink *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tlink {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " dfid=");
- lib9p_fid_format(&self->dfid, state);
- fmt_state_puts(state, " fid=");
- lib9p_fid_format(&self->fid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rlink_format(struct lib9p_msg_Rlink *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rlink {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tmkdir_format(struct lib9p_msg_Tmkdir *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tmkdir {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " dfid=");
- lib9p_fid_format(&self->dfid, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " mode=");
- lib9p_mode_format(&self->mode, state);
- fmt_state_puts(state, " gid=");
- lib9p_nuid_format(&self->gid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rmkdir_format(struct lib9p_msg_Rmkdir *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rmkdir {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " qid=");
- lib9p_qid_format(&self->qid, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Trenameat_format(struct lib9p_msg_Trenameat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Trenameat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " olddirfid=");
- lib9p_fid_format(&self->olddirfid, state);
- fmt_state_puts(state, " oldname=");
- lib9p_s_format(&self->oldname, state);
- fmt_state_puts(state, " newdirfid=");
- lib9p_fid_format(&self->newdirfid, state);
- fmt_state_puts(state, " newname=");
- lib9p_s_format(&self->newname, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rrenameat_format(struct lib9p_msg_Rrenameat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rrenameat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tunlinkat_format(struct lib9p_msg_Tunlinkat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tunlinkat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " dirfd=");
- lib9p_fid_format(&self->dirfd, state);
- fmt_state_puts(state, " name=");
- lib9p_s_format(&self->name, state);
- fmt_state_puts(state, " flags=");
- fmt_state_printf(state, "%"PRIu32, self->flags);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Runlinkat_format(struct lib9p_msg_Runlinkat *self, struct fmt_state *state) {
- fmt_state_puts(state, "Runlinkat {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
+ fmt_print_str(w, " data=<bytedata>");
+ }
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tfsync(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tfsync *self) {
+ fmt_print_str(w, "Tfsync {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " datasync=");
+ fmt_print_b4(w, ctx, &self->datasync);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rfsync(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rfsync *self) {
+ fmt_print_str(w, "Rfsync {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rlock(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rlock *self) {
+ fmt_print_str(w, "Rlock {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " status=");
+ fmt_print_lock_status(w, ctx, &self->status);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rlink(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rlink *self) {
+ fmt_print_str(w, "Rlink {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rrenameat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rrenameat *self) {
+ fmt_print_str(w, "Rrenameat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Runlinkat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Runlinkat *self) {
+ fmt_print_str(w, "Runlinkat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
}
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
-static void lib9p_msg_Tsession_format(struct lib9p_msg_Tsession *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tsession {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " key=");
- fmt_state_printf(state, "%"PRIu64, self->key);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Rsession_format(struct lib9p_msg_Rsession *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rsession {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " }");
-}
-
-static void lib9p_msg_Tsread_format(struct lib9p_msg_Tsread *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tsread {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- fmt_state_printf(state, "%"PRIu32, self->fid);
- fmt_state_puts(state, " nwname=");
- fmt_state_printf(state, "%"PRIu16, self->nwname);
- fmt_state_puts(state, " wname=[");
+[[maybe_unused]] static void fmt_print_Tsession(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tsession *self) {
+ fmt_print_str(w, "Tsession {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " key=");
+ fmt_print_base10(w, self->key);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rsession(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rsession *self) {
+ fmt_print_str(w, "Rsession {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rsread(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rsread *self) {
+ fmt_print_str(w, "Rsread {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
+ if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
+ fmt_print_str(w, " data=");
+ fmt_print_qmem(w, self->data, self->count < 50 ? self->count : 50);
+ if (self->count > 50)
+ fmt_print_str(w, "...");
+ } else {
+ fmt_print_str(w, " data=<bytedata>");
+ }
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rswrite(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *self) {
+ fmt_print_str(w, "Rswrite {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
+ fmt_print_str(w, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+[[maybe_unused]] void fmt_print_stat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_stat *self) {
+ fmt_print_byte(w, '{');
+ fmt_print_str(w, " fstype=");
+ fmt_print_base10(w, self->fstype);
+ fmt_print_str(w, " fsdev=");
+ fmt_print_base10(w, self->fsdev);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " mode=");
+ fmt_print_dm(w, ctx, &self->mode);
+ fmt_print_str(w, " atime=");
+ fmt_print_base10(w, self->atime);
+ fmt_print_str(w, " mtime=");
+ fmt_print_base10(w, self->mtime);
+ fmt_print_str(w, " length=");
+ fmt_print_base10(w, self->length);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " owner_uname=");
+ fmt_print_s(w, ctx, &self->owner_uname);
+ fmt_print_str(w, " owner_gname=");
+ fmt_print_s(w, ctx, &self->owner_gname);
+ fmt_print_str(w, " last_modifier_uname=");
+ fmt_print_s(w, ctx, &self->last_modifier_uname);
+#if CONFIG_9P_ENABLE_9P2000_u
+ fmt_print_str(w, " extension=");
+ fmt_print_s(w, ctx, &self->extension);
+ fmt_print_str(w, " owner_unum=");
+ fmt_print_nuid(w, ctx, &self->owner_unum);
+ fmt_print_str(w, " owner_gnum=");
+ fmt_print_nuid(w, ctx, &self->owner_gnum);
+ fmt_print_str(w, " last_modifier_unum=");
+ fmt_print_nuid(w, ctx, &self->last_modifier_unum);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ fmt_print_str(w, " }");
+}
+
+#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_uninitialized
+[[maybe_unused]] static void fmt_print_Tversion(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tversion *self) {
+ fmt_print_str(w, "Tversion {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " max_msg_size=");
+ fmt_print_base10(w, self->max_msg_size);
+ fmt_print_str(w, " version=");
+ fmt_print_s(w, ctx, &self->version);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rversion(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rversion *self) {
+ fmt_print_str(w, "Rversion {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " max_msg_size=");
+ fmt_print_base10(w, self->max_msg_size);
+ fmt_print_str(w, " version=");
+ fmt_print_s(w, ctx, &self->version);
+ fmt_print_str(w, " }");
+}
+
+#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
+[[maybe_unused]] static void fmt_print_Tauth(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *self) {
+ fmt_print_str(w, "Tauth {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " afid=");
+ fmt_print_fid(w, ctx, &self->afid);
+ fmt_print_str(w, " uname=");
+ fmt_print_s(w, ctx, &self->uname);
+ fmt_print_str(w, " aname=");
+ fmt_print_s(w, ctx, &self->aname);
+#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
+ fmt_print_str(w, " unum=");
+ fmt_print_nuid(w, ctx, &self->unum);
+#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rauth(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rauth *self) {
+ fmt_print_str(w, "Rauth {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " aqid=");
+ fmt_print_qid(w, ctx, &self->aqid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tattach(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *self) {
+ fmt_print_str(w, "Tattach {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " afid=");
+ fmt_print_fid(w, ctx, &self->afid);
+ fmt_print_str(w, " uname=");
+ fmt_print_s(w, ctx, &self->uname);
+ fmt_print_str(w, " aname=");
+ fmt_print_s(w, ctx, &self->aname);
+#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
+ fmt_print_str(w, " unum=");
+ fmt_print_nuid(w, ctx, &self->unum);
+#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rattach(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rattach *self) {
+ fmt_print_str(w, "Rattach {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " }");
+}
+
+#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_uninitialized
+[[maybe_unused]] static void fmt_print_Rerror(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *self) {
+ fmt_print_str(w, "Rerror {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " errstr=");
+ fmt_print_s(w, ctx, &self->errstr);
+#if CONFIG_9P_ENABLE_9P2000_u
+ fmt_print_str(w, " errnum=");
+ fmt_print_errno(w, ctx, &self->errnum);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ fmt_print_str(w, " }");
+}
+
+#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
+[[maybe_unused]] static void fmt_print_Twalk(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Twalk *self) {
+ fmt_print_str(w, "Twalk {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " newfid=");
+ fmt_print_fid(w, ctx, &self->newfid);
+ fmt_print_str(w, " nwname=");
+ fmt_print_base10(w, self->nwname);
+ fmt_print_str(w, " wname=[");
for (uint16_t i = 0; i < self->nwname; i++) {
if (i)
- fmt_state_putchar(state, ',');
- fmt_state_putchar(state, ' ');
- lib9p_s_format(&self->wname[i], state);
+ fmt_print_byte(w, ',');
+ fmt_print_byte(w, ' ');
+ fmt_print_s(w, ctx, &self->wname[i]);
}
- fmt_state_puts(state, " ]");
- fmt_state_puts(state, " }");
+ fmt_print_str(w, " ]");
+ fmt_print_str(w, " }");
}
-static void lib9p_msg_Rsread_format(struct lib9p_msg_Rsread *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rsread {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
- if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- fmt_state_printf(state, " data=%.*q%s",
- (int)(self->count < 50 ? self->count : 50),
- (char *)self->data,
- self->count < 50 ? "" : "...");
-#pragma GCC diagnostic pop
- } else {
- fmt_state_puts(state, " data=<bytedata>");
+[[maybe_unused]] static void fmt_print_Rwalk(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rwalk *self) {
+ fmt_print_str(w, "Rwalk {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " nwqid=");
+ fmt_print_base10(w, self->nwqid);
+ fmt_print_str(w, " wqid=[");
+ for (uint16_t i = 0; i < self->nwqid; i++) {
+ if (i)
+ fmt_print_byte(w, ',');
+ fmt_print_byte(w, ' ');
+ fmt_print_qid(w, ctx, &self->wqid[i]);
}
- fmt_state_puts(state, " }");
+ fmt_print_str(w, " ]");
+ fmt_print_str(w, " }");
+}
+
+#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
+[[maybe_unused]] static void fmt_print_Ropen(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Ropen *self) {
+ fmt_print_str(w, "Ropen {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " iounit=");
+ fmt_print_base10(w, self->iounit);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tcreate(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tcreate *self) {
+ fmt_print_str(w, "Tcreate {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " perm=");
+ fmt_print_dm(w, ctx, &self->perm);
+ fmt_print_str(w, " mode=");
+ fmt_print_o(w, ctx, &self->mode);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rcreate(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rcreate *self) {
+ fmt_print_str(w, "Rcreate {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " iounit=");
+ fmt_print_base10(w, self->iounit);
+ fmt_print_str(w, " }");
+}
+
+#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_p9p
+[[maybe_unused]] static void fmt_print_Ropenfd(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Ropenfd *self) {
+ fmt_print_str(w, "Ropenfd {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " iounit=");
+ fmt_print_base10(w, self->iounit);
+ fmt_print_str(w, " unixfd=");
+ fmt_print_base10(w, self->unixfd);
+ fmt_print_str(w, " }");
}
-static void lib9p_msg_Tswrite_format(struct lib9p_msg_Tswrite *self, struct fmt_state *state) {
- fmt_state_puts(state, "Tswrite {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " fid=");
- fmt_state_printf(state, "%"PRIu32, self->fid);
- fmt_state_puts(state, " nwname=");
- fmt_state_printf(state, "%"PRIu16, self->nwname);
- fmt_state_puts(state, " wname=[");
+#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
+#if CONFIG_9P_ENABLE_9P2000_L
+[[maybe_unused]] static void fmt_print_Rlopen(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rlopen *self) {
+ fmt_print_str(w, "Rlopen {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " iounit=");
+ fmt_print_base10(w, self->iounit);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tlcreate(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tlcreate *self) {
+ fmt_print_str(w, "Tlcreate {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " flags=");
+ fmt_print_lo(w, ctx, &self->flags);
+ fmt_print_str(w, " mode=");
+ fmt_print_mode(w, ctx, &self->mode);
+ fmt_print_str(w, " gid=");
+ fmt_print_nuid(w, ctx, &self->gid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rlcreate(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rlcreate *self) {
+ fmt_print_str(w, "Rlcreate {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " iounit=");
+ fmt_print_base10(w, self->iounit);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tsymlink(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tsymlink *self) {
+ fmt_print_str(w, "Tsymlink {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " symtgt=");
+ fmt_print_s(w, ctx, &self->symtgt);
+ fmt_print_str(w, " gid=");
+ fmt_print_nuid(w, ctx, &self->gid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rsymlink(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rsymlink *self) {
+ fmt_print_str(w, "Rsymlink {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tmknod(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tmknod *self) {
+ fmt_print_str(w, "Tmknod {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " dfid=");
+ fmt_print_fid(w, ctx, &self->dfid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " mode=");
+ fmt_print_mode(w, ctx, &self->mode);
+ fmt_print_str(w, " major=");
+ fmt_print_base10(w, self->major);
+ fmt_print_str(w, " minor=");
+ fmt_print_base10(w, self->minor);
+ fmt_print_str(w, " gid=");
+ fmt_print_nuid(w, ctx, &self->gid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rmknod(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rmknod *self) {
+ fmt_print_str(w, "Rmknod {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Trename(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Trename *self) {
+ fmt_print_str(w, "Trename {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " dfid=");
+ fmt_print_fid(w, ctx, &self->dfid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rreadlink(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rreadlink *self) {
+ fmt_print_str(w, "Rreadlink {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " target=");
+ fmt_print_s(w, ctx, &self->target);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rgetattr(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rgetattr *self) {
+ fmt_print_str(w, "Rgetattr {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " valid=");
+ fmt_print_getattr(w, ctx, &self->valid);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " mode=");
+ fmt_print_mode(w, ctx, &self->mode);
+ fmt_print_str(w, " uid=");
+ fmt_print_nuid(w, ctx, &self->uid);
+ fmt_print_str(w, " gid=");
+ fmt_print_nuid(w, ctx, &self->gid);
+ fmt_print_str(w, " nlink=");
+ fmt_print_base10(w, self->nlink);
+ fmt_print_str(w, " rdev=");
+ fmt_print_base10(w, self->rdev);
+ fmt_print_str(w, " filesize=");
+ fmt_print_base10(w, self->filesize);
+ fmt_print_str(w, " blksize=");
+ fmt_print_base10(w, self->blksize);
+ fmt_print_str(w, " blocks=");
+ fmt_print_base10(w, self->blocks);
+ fmt_print_str(w, " atime_sec=");
+ fmt_print_base10(w, self->atime_sec);
+ fmt_print_str(w, " atime_nsec=");
+ fmt_print_base10(w, self->atime_nsec);
+ fmt_print_str(w, " mtime_sec=");
+ fmt_print_base10(w, self->mtime_sec);
+ fmt_print_str(w, " mtime_nsec=");
+ fmt_print_base10(w, self->mtime_nsec);
+ fmt_print_str(w, " ctime_sec=");
+ fmt_print_base10(w, self->ctime_sec);
+ fmt_print_str(w, " ctime_nsec=");
+ fmt_print_base10(w, self->ctime_nsec);
+ fmt_print_str(w, " btime_sec=");
+ fmt_print_base10(w, self->btime_sec);
+ fmt_print_str(w, " btime_nsec=");
+ fmt_print_base10(w, self->btime_nsec);
+ fmt_print_str(w, " gen=");
+ fmt_print_base10(w, self->gen);
+ fmt_print_str(w, " data_version=");
+ fmt_print_base10(w, self->data_version);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Txattrwalk(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Txattrwalk *self) {
+ fmt_print_str(w, "Txattrwalk {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " newfid=");
+ fmt_print_fid(w, ctx, &self->newfid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Txattrcreate(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Txattrcreate *self) {
+ fmt_print_str(w, "Txattrcreate {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " attr_size=");
+ fmt_print_base10(w, self->attr_size);
+ fmt_print_str(w, " flags=");
+ fmt_print_base10(w, self->flags);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tlock(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tlock *self) {
+ fmt_print_str(w, "Tlock {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " type=");
+ fmt_print_lock_type(w, ctx, &self->type);
+ fmt_print_str(w, " flags=");
+ fmt_print_lock_flags(w, ctx, &self->flags);
+ fmt_print_str(w, " start=");
+ fmt_print_base10(w, self->start);
+ fmt_print_str(w, " length=");
+ fmt_print_base10(w, self->length);
+ fmt_print_str(w, " proc_id=");
+ fmt_print_base10(w, self->proc_id);
+ fmt_print_str(w, " client_id=");
+ fmt_print_s(w, ctx, &self->client_id);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tgetlock(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tgetlock *self) {
+ fmt_print_str(w, "Tgetlock {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " type=");
+ fmt_print_lock_type(w, ctx, &self->type);
+ fmt_print_str(w, " start=");
+ fmt_print_base10(w, self->start);
+ fmt_print_str(w, " length=");
+ fmt_print_base10(w, self->length);
+ fmt_print_str(w, " proc_id=");
+ fmt_print_base10(w, self->proc_id);
+ fmt_print_str(w, " client_id=");
+ fmt_print_s(w, ctx, &self->client_id);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rgetlock(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rgetlock *self) {
+ fmt_print_str(w, "Rgetlock {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " type=");
+ fmt_print_lock_type(w, ctx, &self->type);
+ fmt_print_str(w, " start=");
+ fmt_print_base10(w, self->start);
+ fmt_print_str(w, " length=");
+ fmt_print_base10(w, self->length);
+ fmt_print_str(w, " proc_id=");
+ fmt_print_base10(w, self->proc_id);
+ fmt_print_str(w, " client_id=");
+ fmt_print_s(w, ctx, &self->client_id);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tlink(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tlink *self) {
+ fmt_print_str(w, "Tlink {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " dfid=");
+ fmt_print_fid(w, ctx, &self->dfid);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tmkdir(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tmkdir *self) {
+ fmt_print_str(w, "Tmkdir {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " dfid=");
+ fmt_print_fid(w, ctx, &self->dfid);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " mode=");
+ fmt_print_mode(w, ctx, &self->mode);
+ fmt_print_str(w, " gid=");
+ fmt_print_nuid(w, ctx, &self->gid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Rmkdir(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rmkdir *self) {
+ fmt_print_str(w, "Rmkdir {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " qid=");
+ fmt_print_qid(w, ctx, &self->qid);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Trenameat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Trenameat *self) {
+ fmt_print_str(w, "Trenameat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " olddirfid=");
+ fmt_print_fid(w, ctx, &self->olddirfid);
+ fmt_print_str(w, " oldname=");
+ fmt_print_s(w, ctx, &self->oldname);
+ fmt_print_str(w, " newdirfid=");
+ fmt_print_fid(w, ctx, &self->newdirfid);
+ fmt_print_str(w, " newname=");
+ fmt_print_s(w, ctx, &self->newname);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tunlinkat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tunlinkat *self) {
+ fmt_print_str(w, "Tunlinkat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " dirfd=");
+ fmt_print_fid(w, ctx, &self->dirfd);
+ fmt_print_str(w, " name=");
+ fmt_print_s(w, ctx, &self->name);
+ fmt_print_str(w, " flags=");
+ fmt_print_base10(w, self->flags);
+ fmt_print_str(w, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000_L */
+#if CONFIG_9P_ENABLE_9P2000_e
+[[maybe_unused]] static void fmt_print_Tsread(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tsread *self) {
+ fmt_print_str(w, "Tsread {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_base10(w, self->fid);
+ fmt_print_str(w, " nwname=");
+ fmt_print_base10(w, self->nwname);
+ fmt_print_str(w, " wname=[");
+ for (uint16_t i = 0; i < self->nwname; i++) {
+ if (i)
+ fmt_print_byte(w, ',');
+ fmt_print_byte(w, ' ');
+ fmt_print_s(w, ctx, &self->wname[i]);
+ }
+ fmt_print_str(w, " ]");
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Tswrite(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Tswrite *self) {
+ fmt_print_str(w, "Tswrite {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_base10(w, self->fid);
+ fmt_print_str(w, " nwname=");
+ fmt_print_base10(w, self->nwname);
+ fmt_print_str(w, " wname=[");
for (uint16_t i = 0; i < self->nwname; i++) {
if (i)
- fmt_state_putchar(state, ',');
- fmt_state_putchar(state, ' ');
- lib9p_s_format(&self->wname[i], state);
+ fmt_print_byte(w, ',');
+ fmt_print_byte(w, ' ');
+ fmt_print_s(w, ctx, &self->wname[i]);
}
- fmt_state_puts(state, " ]");
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_print_str(w, " ]");
+ fmt_print_str(w, " count=");
+ fmt_print_base10(w, self->count);
if (is_valid_utf8_without_nul((uint8_t *)self->data, (size_t)self->count)) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- fmt_state_printf(state, " data=%.*q%s",
- (int)(self->count < 50 ? self->count : 50),
- (char *)self->data,
- self->count < 50 ? "" : "...");
-#pragma GCC diagnostic pop
+ fmt_print_str(w, " data=");
+ fmt_print_qmem(w, self->data, self->count < 50 ? self->count : 50);
+ if (self->count > 50)
+ fmt_print_str(w, "...");
} else {
- fmt_state_puts(state, " data=<bytedata>");
+ fmt_print_str(w, " data=<bytedata>");
}
- fmt_state_puts(state, " }");
+ fmt_print_str(w, " }");
}
-static void lib9p_msg_Rswrite_format(struct lib9p_msg_Rswrite *self, struct fmt_state *state) {
- fmt_state_puts(state, "Rswrite {");
- fmt_state_puts(state, " tag=");
- lib9p_tag_format(&self->tag, state);
- fmt_state_puts(state, " count=");
- fmt_state_printf(state, "%"PRIu32, self->count);
- fmt_state_puts(state, " }");
-}
#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+[[maybe_unused]] static void fmt_print_Rstat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *self) {
+ fmt_print_str(w, "Rstat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " stat=");
+ fmt_print_stat(w, ctx, &self->stat);
+ fmt_print_str(w, " }");
+}
+
+[[maybe_unused]] static void fmt_print_Twstat(lo_interface fmt_dest w, [[maybe_unused]] struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *self) {
+ fmt_print_str(w, "Twstat {");
+ fmt_print_str(w, " tag=");
+ fmt_print_tag(w, ctx, &self->tag);
+ fmt_print_str(w, " fid=");
+ fmt_print_fid(w, ctx, &self->fid);
+ fmt_print_str(w, " stat=");
+ fmt_print_stat(w, ctx, &self->stat);
+ fmt_print_str(w, " }");
+}
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
/* tables.h *******************************************************************/
@@ -7869,9 +7502,9 @@ const struct _lib9p_ver_tentry _lib9p_table_ver[LIB9P_VER_NUM] = {
#endif /* CONFIG_9P_ENABLE_uninitialized */
};
-#define _MSG(typ) [LIB9P_TYP_##typ] = { \
- .name = #typ, \
- .box_as_fmt_formatter = (_box_as_fmt_formatter_fn_t)lo_box_lib9p_msg_##typ##_as_fmt_formatter, \
+#define _MSG(typ) [LIB9P_TYP_##typ] = { \
+ .name = #typ, \
+ .print = (_print_fn_t)fmt_print_##typ, \
}
const struct _lib9p_msg_tentry _lib9p_table_msg[LIB9P_VER_NUM][0x100] = {
#if CONFIG_9P_ENABLE_9P2000
diff --git a/lib9p/core_include/lib9p/_core_generated.h b/lib9p/core_include/lib9p/_core_generated.h
index 9e6366f..5b9a67d 100644
--- a/lib9p/core_include/lib9p/_core_generated.h
+++ b/lib9p/core_include/lib9p/_core_generated.h
@@ -4,10 +4,6 @@
#error Do not include <lib9p/_core_generated.h> directly; include <lib9p/core.h> instead
#endif
-#include <stdint.h> /* for uint{n}_t types */
-
-#include <libfmt/fmt.h> /* for fmt_formatter */
-#include <libhw/generic/io.h> /* for struct iovec */
/* config *********************************************************************/
@@ -67,7 +63,6 @@ enum lib9p_version {
#endif /* CONFIG_9P_ENABLE_9P2000_u */
LIB9P_VER_NUM,
};
-LO_IMPLEMENTATION_H(fmt_formatter, enum lib9p_version, lib9p_version);
/* enum msg_type **************************************************************/
@@ -167,26 +162,22 @@ enum lib9p_msg_type { /* uint8_t */
LIB9P_TYP_Rswrite = 155,
#endif /* CONFIG_9P_ENABLE_9P2000_e */
};
-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_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);
#define LIB9P_TAG_NOTAG ((lib9p_tag_t)(UINT16_MAX))
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
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_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);
/* bits */
#define LIB9P_DM_DIR ((lib9p_dm_t)(UINT32_C(1)<<31))
#define LIB9P_DM_APPEND ((lib9p_dm_t)(UINT32_C(1)<<30))
@@ -231,7 +222,6 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_dm_t, lib9p_dm);
#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);
/* bits */
#define LIB9P_QT_DIR ((lib9p_qt_t)(UINT8_C(1)<<7))
#define LIB9P_QT_APPEND ((lib9p_qt_t)(UINT8_C(1)<<6))
@@ -250,7 +240,6 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_qt_t, lib9p_qt);
#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;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_o_t, lib9p_o);
/* bits */
#define _LIB9P_O_UNUSED_7 ((lib9p_o_t)(UINT8_C(1)<<7))
#define LIB9P_O_RCLOSE ((lib9p_o_t)(UINT8_C(1)<<6))
@@ -273,12 +262,10 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_o_t, lib9p_o);
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_nuid_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_nuid_t, lib9p_nuid);
#define LIB9P_NUID_NONUID ((lib9p_nuid_t)(UINT32_MAX))
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_errno_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_errno_t, lib9p_errno);
#define LIB9P_ERRNO_NOERROR ((lib9p_errno_t)(0))
#define LIB9P_ERRNO_L_EPERM ((lib9p_errno_t)(1))
#define LIB9P_ERRNO_L_ENOENT ((lib9p_errno_t)(2))
@@ -416,12 +403,10 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_errno_t, lib9p_errno);
#if CONFIG_9P_ENABLE_9P2000_L
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_super_magic_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_super_magic_t, lib9p_super_magic);
#define LIB9P_SUPER_MAGIC_V9FS_MAGIC ((lib9p_super_magic_t)(16914839))
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_lo_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lo_t, lib9p_lo);
/* bits */
#define _LIB9P_LO_UNUSED_31 ((lib9p_lo_t)(UINT32_C(1)<<31))
#define _LIB9P_LO_UNUSED_30 ((lib9p_lo_t)(UINT32_C(1)<<30))
@@ -466,7 +451,6 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lo_t, lib9p_lo);
/* size = 1 ; max_iov = 1 ; max_copy = 1 */
typedef uint8_t lib9p_dt_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_dt_t, lib9p_dt);
#define LIB9P_DT_UNKNOWN ((lib9p_dt_t)(0))
#define LIB9P_DT_PIPE ((lib9p_dt_t)(1))
#define LIB9P_DT_CHAR_DEV ((lib9p_dt_t)(2))
@@ -479,7 +463,6 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_dt_t, lib9p_dt);
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_mode_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_mode_t, lib9p_mode);
/* bits */
#define _LIB9P_MODE_UNUSED_31 ((lib9p_mode_t)(UINT32_C(1)<<31))
#define _LIB9P_MODE_UNUSED_30 ((lib9p_mode_t)(UINT32_C(1)<<30))
@@ -527,13 +510,11 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_mode_t, lib9p_mode);
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_b4_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_b4_t, lib9p_b4);
#define LIB9P_B4_FALSE ((lib9p_b4_t)(0))
#define LIB9P_B4_TRUE ((lib9p_b4_t)(1))
/* size = 8 ; max_iov = 1 ; max_copy = 8 */
typedef uint64_t lib9p_getattr_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_getattr_t, lib9p_getattr);
/* bits */
#define _LIB9P_GETATTR_UNUSED_63 ((lib9p_getattr_t)(UINT64_C(1)<<63))
#define _LIB9P_GETATTR_UNUSED_62 ((lib9p_getattr_t)(UINT64_C(1)<<62))
@@ -605,7 +586,6 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_getattr_t, lib9p_getattr);
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_setattr_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_setattr_t, lib9p_setattr);
/* bits */
#define _LIB9P_SETATTR_UNUSED_31 ((lib9p_setattr_t)(UINT32_C(1)<<31))
#define _LIB9P_SETATTR_UNUSED_30 ((lib9p_setattr_t)(UINT32_C(1)<<30))
@@ -642,14 +622,12 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_setattr_t, lib9p_setattr);
/* size = 1 ; max_iov = 1 ; max_copy = 1 */
typedef uint8_t lib9p_lock_type_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_type_t, lib9p_lock_type);
#define LIB9P_LOCK_TYPE_RDLCK ((lib9p_lock_type_t)(0))
#define LIB9P_LOCK_TYPE_WRLCK ((lib9p_lock_type_t)(1))
#define LIB9P_LOCK_TYPE_UNLCK ((lib9p_lock_type_t)(2))
/* size = 4 ; max_iov = 1 ; max_copy = 4 */
typedef uint32_t lib9p_lock_flags_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_flags_t, lib9p_lock_flags);
/* bits */
#define _LIB9P_LOCK_FLAGS_UNUSED_31 ((lib9p_lock_flags_t)(UINT32_C(1)<<31))
#define _LIB9P_LOCK_FLAGS_UNUSED_30 ((lib9p_lock_flags_t)(UINT32_C(1)<<30))
@@ -686,7 +664,6 @@ LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_flags_t, lib9p_lock_flags);
/* size = 1 ; max_iov = 1 ; max_copy = 1 */
typedef uint8_t lib9p_lock_status_t;
-LO_IMPLEMENTATION_H(fmt_formatter, lib9p_lock_status_t, lib9p_lock_status);
#define LIB9P_LOCK_STATUS_SUCCESS ((lib9p_lock_status_t)(0))
#define LIB9P_LOCK_STATUS_BLOCKED ((lib9p_lock_status_t)(1))
#define LIB9P_LOCK_STATUS_ERROR ((lib9p_lock_status_t)(2))
@@ -699,7 +676,6 @@ struct lib9p_s {
uint16_t len;
[[gnu::nonstring]] char *utf8;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_s, lib9p_s);
/* size = 13 ; max_iov = 1 ; max_copy = 13 */
struct lib9p_qid {
@@ -707,7 +683,6 @@ struct lib9p_qid {
uint32_t vers;
uint64_t path;
};
-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_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
@@ -716,13 +691,11 @@ struct lib9p_msg_Tflush {
lib9p_tag_t tag;
uint16_t oldtag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tflush, lib9p_msg_Tflush);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rflush {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rflush, lib9p_msg_Rflush);
#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
@@ -732,7 +705,6 @@ struct lib9p_msg_Topen {
lib9p_fid_t fid;
lib9p_o_t mode;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Topen, lib9p_msg_Topen);
#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
@@ -743,7 +715,6 @@ struct lib9p_msg_Tread {
uint64_t offset;
uint32_t count;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tread, lib9p_msg_Tread);
/* min_size = 11 ; exp_size = 8,203 ; max_size = 2,147,483,658 ; max_iov = 2 ; max_copy = 11 */
struct lib9p_msg_Rread {
@@ -751,7 +722,6 @@ struct lib9p_msg_Rread {
uint32_t count;
[[gnu::nonstring]] char *data;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rread, lib9p_msg_Rread);
/* min_size = 23 ; exp_size = 8,215 ; max_size = 2,147,483,670 ; max_iov = 2 ; max_copy = 23 */
struct lib9p_msg_Twrite {
@@ -761,40 +731,34 @@ struct lib9p_msg_Twrite {
uint32_t count;
[[gnu::nonstring]] char *data;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twrite, lib9p_msg_Twrite);
/* size = 11 ; max_iov = 1 ; max_copy = 11 */
struct lib9p_msg_Rwrite {
lib9p_tag_t tag;
uint32_t count;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rwrite, lib9p_msg_Rwrite);
/* size = 11 ; max_iov = 1 ; max_copy = 11 */
struct lib9p_msg_Tclunk {
lib9p_tag_t tag;
lib9p_fid_t fid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tclunk, lib9p_msg_Tclunk);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rclunk {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rclunk, lib9p_msg_Rclunk);
/* size = 11 ; max_iov = 1 ; max_copy = 11 */
struct lib9p_msg_Tremove {
lib9p_tag_t tag;
lib9p_fid_t fid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tremove, lib9p_msg_Tremove);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rremove {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rremove, lib9p_msg_Rremove);
#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
@@ -803,13 +767,11 @@ struct lib9p_msg_Tstat {
lib9p_tag_t tag;
lib9p_fid_t fid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tstat, lib9p_msg_Tstat);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rwstat {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rwstat, lib9p_msg_Rwstat);
#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_p9p
@@ -819,7 +781,6 @@ struct lib9p_msg_Topenfd {
lib9p_fid_t fid;
lib9p_o_t mode;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Topenfd, lib9p_msg_Topenfd);
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_L
@@ -828,14 +789,12 @@ struct lib9p_msg_Rlerror {
lib9p_tag_t tag;
lib9p_errno_t errnum;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlerror, lib9p_msg_Rlerror);
/* size = 11 ; max_iov = 1 ; max_copy = 11 */
struct lib9p_msg_Tstatfs {
lib9p_tag_t tag;
lib9p_fid_t fid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tstatfs, lib9p_msg_Tstatfs);
/* size = 67 ; max_iov = 1 ; max_copy = 67 */
struct lib9p_msg_Rstatfs {
@@ -850,7 +809,6 @@ struct lib9p_msg_Rstatfs {
uint64_t fsid;
uint32_t namelen;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rstatfs, lib9p_msg_Rstatfs);
/* size = 15 ; max_iov = 1 ; max_copy = 15 */
struct lib9p_msg_Tlopen {
@@ -858,20 +816,17 @@ struct lib9p_msg_Tlopen {
lib9p_fid_t fid;
lib9p_lo_t flags;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlopen, lib9p_msg_Tlopen);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rrename {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rrename, lib9p_msg_Rrename);
/* size = 11 ; max_iov = 1 ; max_copy = 11 */
struct lib9p_msg_Treadlink {
lib9p_tag_t tag;
lib9p_fid_t fid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Treadlink, lib9p_msg_Treadlink);
/* size = 19 ; max_iov = 1 ; max_copy = 19 */
struct lib9p_msg_Tgetattr {
@@ -879,7 +834,6 @@ struct lib9p_msg_Tgetattr {
lib9p_fid_t fid;
lib9p_getattr_t request_mask;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tgetattr, lib9p_msg_Tgetattr);
/* size = 67 ; max_iov = 1 ; max_copy = 67 */
struct lib9p_msg_Tsetattr {
@@ -895,26 +849,22 @@ struct lib9p_msg_Tsetattr {
uint64_t mtime_sec;
uint64_t mtime_nsec;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsetattr, lib9p_msg_Tsetattr);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rsetattr {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsetattr, lib9p_msg_Rsetattr);
/* size = 15 ; max_iov = 1 ; max_copy = 15 */
struct lib9p_msg_Rxattrwalk {
lib9p_tag_t tag;
uint64_t attr_size;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rxattrwalk, lib9p_msg_Rxattrwalk);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rxattrcreate {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rxattrcreate, lib9p_msg_Rxattrcreate);
/* size = 23 ; max_iov = 1 ; max_copy = 23 */
struct lib9p_msg_Treaddir {
@@ -923,7 +873,6 @@ struct lib9p_msg_Treaddir {
uint64_t offset;
uint32_t count;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Treaddir, lib9p_msg_Treaddir);
/* min_size = 11 ; exp_size = 8,203 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) ; max_iov = 2 ; max_copy = 11 */
struct lib9p_msg_Rreaddir {
@@ -931,7 +880,6 @@ struct lib9p_msg_Rreaddir {
uint32_t count;
[[gnu::nonstring]] char *data;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rreaddir, lib9p_msg_Rreaddir);
/* size = 15 ; max_iov = 1 ; max_copy = 15 */
struct lib9p_msg_Tfsync {
@@ -939,38 +887,32 @@ struct lib9p_msg_Tfsync {
lib9p_fid_t fid;
lib9p_b4_t datasync;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tfsync, lib9p_msg_Tfsync);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rfsync {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rfsync, lib9p_msg_Rfsync);
/* size = 8 ; max_iov = 1 ; max_copy = 8 */
struct lib9p_msg_Rlock {
lib9p_tag_t tag;
lib9p_lock_status_t status;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlock, lib9p_msg_Rlock);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rlink {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlink, lib9p_msg_Rlink);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rrenameat {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rrenameat, lib9p_msg_Rrenameat);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Runlinkat {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Runlinkat, lib9p_msg_Runlinkat);
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
@@ -979,13 +921,11 @@ struct lib9p_msg_Tsession {
lib9p_tag_t tag;
uint64_t key;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsession, lib9p_msg_Tsession);
/* size = 7 ; max_iov = 1 ; max_copy = 7 */
struct lib9p_msg_Rsession {
lib9p_tag_t tag;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsession, lib9p_msg_Rsession);
/* min_size = 11 ; exp_size = 8,203 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) ; max_iov = 2 ; max_copy = 11 */
struct lib9p_msg_Rsread {
@@ -993,14 +933,12 @@ struct lib9p_msg_Rsread {
uint32_t count;
[[gnu::nonstring]] char *data;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsread, lib9p_msg_Rsread);
/* size = 11 ; max_iov = 1 ; max_copy = 11 */
struct lib9p_msg_Rswrite {
lib9p_tag_t tag;
uint32_t count;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rswrite, lib9p_msg_Rswrite);
#endif /* CONFIG_9P_ENABLE_9P2000_e */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
@@ -1027,7 +965,6 @@ struct lib9p_stat {
lib9p_nuid_t last_modifier_unum;
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-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_uninitialized
@@ -1037,7 +974,6 @@ struct lib9p_msg_Tversion {
uint32_t max_msg_size;
struct lib9p_s version;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tversion, lib9p_msg_Tversion);
/* min_size = 13 ; exp_size = 40 ; max_size = 65,548 ; max_iov = 2 ; max_copy = 13 */
struct lib9p_msg_Rversion {
@@ -1045,7 +981,6 @@ struct lib9p_msg_Rversion {
uint32_t max_msg_size;
struct lib9p_s version;
};
-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_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
@@ -1063,14 +998,12 @@ struct lib9p_msg_Tauth {
lib9p_nuid_t unum;
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tauth, lib9p_msg_Tauth);
/* size = 20 ; max_iov = 1 ; max_copy = 20 */
struct lib9p_msg_Rauth {
lib9p_tag_t tag;
struct lib9p_qid aqid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rauth, lib9p_msg_Rauth);
/* LIB9P_VER_9P2000 : min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 4 ; max_copy = 19 */
/* LIB9P_VER_9P2000_L : min_size = 23 ; exp_size = 77 ; max_size = 131,093 ; max_iov = 5 ; max_copy = 23 */
@@ -1087,14 +1020,12 @@ struct lib9p_msg_Tattach {
lib9p_nuid_t unum;
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tattach, lib9p_msg_Tattach);
/* size = 20 ; max_iov = 1 ; max_copy = 20 */
struct lib9p_msg_Rattach {
lib9p_tag_t tag;
struct lib9p_qid qid;
};
-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_uninitialized
@@ -1110,7 +1041,6 @@ struct lib9p_msg_Rerror {
lib9p_errno_t errnum;
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-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_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
@@ -1122,7 +1052,6 @@ struct lib9p_msg_Twalk {
uint16_t nwname;
struct lib9p_s *wname;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twalk, lib9p_msg_Twalk);
/* min_size = 9 ; exp_size = 217 ; max_size = 217 ; max_iov = 1 ; max_copy = 217 */
struct lib9p_msg_Rwalk {
@@ -1130,7 +1059,6 @@ struct lib9p_msg_Rwalk {
uint16_t nwqid;
struct lib9p_qid *wqid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rwalk, lib9p_msg_Rwalk);
#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
@@ -1140,7 +1068,6 @@ struct lib9p_msg_Ropen {
struct lib9p_qid qid;
uint32_t iounit;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Ropen, lib9p_msg_Ropen);
/* min_size = 18 ; exp_size = 45 ; max_size = 65,553 ; max_iov = 3 ; max_copy = 18 */
struct lib9p_msg_Tcreate {
@@ -1150,7 +1077,6 @@ struct lib9p_msg_Tcreate {
lib9p_dm_t perm;
lib9p_o_t mode;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tcreate, lib9p_msg_Tcreate);
/* size = 24 ; max_iov = 1 ; max_copy = 24 */
struct lib9p_msg_Rcreate {
@@ -1158,7 +1084,6 @@ struct lib9p_msg_Rcreate {
struct lib9p_qid qid;
uint32_t iounit;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rcreate, lib9p_msg_Rcreate);
#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_p9p
@@ -1169,7 +1094,6 @@ struct lib9p_msg_Ropenfd {
uint32_t iounit;
uint32_t unixfd;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Ropenfd, lib9p_msg_Ropenfd);
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_L
@@ -1179,7 +1103,6 @@ struct lib9p_msg_Rlopen {
struct lib9p_qid qid;
uint32_t iounit;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlopen, lib9p_msg_Rlopen);
/* min_size = 25 ; exp_size = 52 ; max_size = 65,560 ; max_iov = 3 ; max_copy = 25 */
struct lib9p_msg_Tlcreate {
@@ -1190,7 +1113,6 @@ struct lib9p_msg_Tlcreate {
lib9p_mode_t mode;
lib9p_nuid_t gid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlcreate, lib9p_msg_Tlcreate);
/* size = 24 ; max_iov = 1 ; max_copy = 24 */
struct lib9p_msg_Rlcreate {
@@ -1198,7 +1120,6 @@ struct lib9p_msg_Rlcreate {
struct lib9p_qid qid;
uint32_t iounit;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rlcreate, lib9p_msg_Rlcreate);
/* min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 5 ; max_copy = 19 */
struct lib9p_msg_Tsymlink {
@@ -1208,14 +1129,12 @@ struct lib9p_msg_Tsymlink {
struct lib9p_s symtgt;
lib9p_nuid_t gid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsymlink, lib9p_msg_Tsymlink);
/* size = 20 ; max_iov = 1 ; max_copy = 20 */
struct lib9p_msg_Rsymlink {
lib9p_tag_t tag;
struct lib9p_qid qid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rsymlink, lib9p_msg_Rsymlink);
/* min_size = 29 ; exp_size = 56 ; max_size = 65,564 ; max_iov = 3 ; max_copy = 29 */
struct lib9p_msg_Tmknod {
@@ -1227,14 +1146,12 @@ struct lib9p_msg_Tmknod {
uint32_t minor;
lib9p_nuid_t gid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tmknod, lib9p_msg_Tmknod);
/* size = 20 ; max_iov = 1 ; max_copy = 20 */
struct lib9p_msg_Rmknod {
lib9p_tag_t tag;
struct lib9p_qid qid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rmknod, lib9p_msg_Rmknod);
/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 2 ; max_copy = 17 */
struct lib9p_msg_Trename {
@@ -1243,14 +1160,12 @@ struct lib9p_msg_Trename {
lib9p_fid_t dfid;
struct lib9p_s name;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Trename, lib9p_msg_Trename);
/* min_size = 9 ; exp_size = 36 ; max_size = 65,544 ; max_iov = 2 ; max_copy = 9 */
struct lib9p_msg_Rreadlink {
lib9p_tag_t tag;
struct lib9p_s target;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rreadlink, lib9p_msg_Rreadlink);
/* size = 160 ; max_iov = 1 ; max_copy = 160 */
struct lib9p_msg_Rgetattr {
@@ -1276,7 +1191,6 @@ struct lib9p_msg_Rgetattr {
uint64_t gen;
uint64_t data_version;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rgetattr, lib9p_msg_Rgetattr);
/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 2 ; max_copy = 17 */
struct lib9p_msg_Txattrwalk {
@@ -1285,7 +1199,6 @@ struct lib9p_msg_Txattrwalk {
lib9p_fid_t newfid;
struct lib9p_s name;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Txattrwalk, lib9p_msg_Txattrwalk);
/* min_size = 25 ; exp_size = 52 ; max_size = 65,560 ; max_iov = 3 ; max_copy = 25 */
struct lib9p_msg_Txattrcreate {
@@ -1295,7 +1208,6 @@ struct lib9p_msg_Txattrcreate {
uint64_t attr_size;
uint32_t flags;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Txattrcreate, lib9p_msg_Txattrcreate);
/* min_size = 38 ; exp_size = 65 ; max_size = 65,573 ; max_iov = 2 ; max_copy = 38 */
struct lib9p_msg_Tlock {
@@ -1308,7 +1220,6 @@ struct lib9p_msg_Tlock {
uint32_t proc_id;
struct lib9p_s client_id;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlock, lib9p_msg_Tlock);
/* min_size = 34 ; exp_size = 61 ; max_size = 65,569 ; max_iov = 2 ; max_copy = 34 */
struct lib9p_msg_Tgetlock {
@@ -1320,7 +1231,6 @@ struct lib9p_msg_Tgetlock {
uint32_t proc_id;
struct lib9p_s client_id;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tgetlock, lib9p_msg_Tgetlock);
/* min_size = 30 ; exp_size = 57 ; max_size = 65,565 ; max_iov = 2 ; max_copy = 30 */
struct lib9p_msg_Rgetlock {
@@ -1331,7 +1241,6 @@ struct lib9p_msg_Rgetlock {
uint32_t proc_id;
struct lib9p_s client_id;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rgetlock, lib9p_msg_Rgetlock);
/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 2 ; max_copy = 17 */
struct lib9p_msg_Tlink {
@@ -1340,7 +1249,6 @@ struct lib9p_msg_Tlink {
lib9p_fid_t fid;
struct lib9p_s name;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tlink, lib9p_msg_Tlink);
/* min_size = 21 ; exp_size = 48 ; max_size = 65,556 ; max_iov = 3 ; max_copy = 21 */
struct lib9p_msg_Tmkdir {
@@ -1350,14 +1258,12 @@ struct lib9p_msg_Tmkdir {
lib9p_mode_t mode;
lib9p_nuid_t gid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tmkdir, lib9p_msg_Tmkdir);
/* size = 20 ; max_iov = 1 ; max_copy = 20 */
struct lib9p_msg_Rmkdir {
lib9p_tag_t tag;
struct lib9p_qid qid;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rmkdir, lib9p_msg_Rmkdir);
/* min_size = 19 ; exp_size = 73 ; max_size = 131,089 ; max_iov = 4 ; max_copy = 19 */
struct lib9p_msg_Trenameat {
@@ -1367,7 +1273,6 @@ struct lib9p_msg_Trenameat {
lib9p_fid_t newdirfid;
struct lib9p_s newname;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Trenameat, lib9p_msg_Trenameat);
/* min_size = 17 ; exp_size = 44 ; max_size = 65,552 ; max_iov = 3 ; max_copy = 17 */
struct lib9p_msg_Tunlinkat {
@@ -1376,7 +1281,6 @@ struct lib9p_msg_Tunlinkat {
struct lib9p_s name;
uint32_t flags;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tunlinkat, lib9p_msg_Tunlinkat);
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
@@ -1387,7 +1291,6 @@ struct lib9p_msg_Tsread {
uint16_t nwname;
struct lib9p_s *wname;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tsread, lib9p_msg_Tsread);
/* min_size = 17 ; exp_size = 8,673 ; max_size = 8,589,934,607 (warning: >UINT32_MAX) ; max_iov = 2 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2) ; max_copy = 17 + (CONFIG_9P_MAX_9P2000_e_WELEM * 2) */
struct lib9p_msg_Tswrite {
@@ -1398,7 +1301,6 @@ struct lib9p_msg_Tswrite {
uint32_t count;
[[gnu::nonstring]] char *data;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Tswrite, lib9p_msg_Tswrite);
#endif /* CONFIG_9P_ENABLE_9P2000_e */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
@@ -1410,7 +1312,6 @@ struct lib9p_msg_Rstat {
lib9p_tag_t tag;
struct lib9p_stat stat;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Rstat, lib9p_msg_Rstat);
/* LIB9P_VER_9P2000 : min_size = 62 ; exp_size = 170 ; max_size = 262,202 ; max_iov = 8 ; max_copy = 62 */
/* LIB9P_VER_9P2000_e : min_size = 62 ; exp_size = 170 ; max_size = 262,202 ; max_iov = 8 ; max_copy = 62 */
@@ -1421,7 +1322,6 @@ struct lib9p_msg_Twstat {
lib9p_fid_t fid;
struct lib9p_stat stat;
};
-LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat);
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
/* containers *****************************************************************/
diff --git a/lib9p/core_include/lib9p/core.h b/lib9p/core_include/lib9p/core.h
index aa470de..4941220 100644
--- a/lib9p/core_include/lib9p/core.h
+++ b/lib9p/core_include/lib9p/core.h
@@ -7,9 +7,13 @@
#ifndef _LIB9P_CORE_H_
#define _LIB9P_CORE_H_
+#include <stdint.h> /* for uint{n}_t */
+#include <string.h> /* for memset() */
#include <sys/types.h> /* for ssize_t */
+#include <libhw/generic/io.h> /* for struct iovec */
#include <libmisc/assert.h>
+#include <libmisc/fmt.h>
#define CONFIG_9P_ENABLE_uninitialized 1
#include <lib9p/_core_generated.h>
@@ -55,31 +59,34 @@ void lib9p_ctx_clear_error(struct lib9p_ctx *ctx);
bool lib9p_ctx_has_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
- 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__)
+ #define _lib9p_set_err_num(ctx, linux_errno) do { (ctx)->err_num = linux_errno; } while (0)
#else
- 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__)
+ #define _lib9p_set_err_num(ctx, linux_errno) do { } while (0)
#endif
+/** Write a <libmisc/fmt.h>-style error into ctx, return -1. */
+#define lib9p_error(ctx, linux_errno, ...) ({ \
+ if (!lib9p_ctx_has_error(ctx)) { \
+ _lib9p_set_err_num(ctx, linux_errno); \
+ struct fmt_buf _w = { \
+ .dat = (ctx)->err_msg, \
+ .cap = sizeof((ctx)->err_msg), \
+ }; \
+ lo_interface fmt_dest w = lo_box_fmt_buf_as_fmt_dest(&_w); \
+ fmt_print(w, __VA_ARGS__); \
+ if (_w.len < _w.cap) \
+ memset(_w.dat + _w.len, 0, _w.cap - _w.len); \
+ } \
+ -1; \
+})
+
/* misc utilities *************************************************************/
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);
+void fmt_print_lib9p_msg(lo_interface fmt_dest w, struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body);
/* main T-message functions ***************************************************/
@@ -159,6 +166,9 @@ bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *bo
/* `struct lib9p_stat` helpers ************************************************/
#if _LIB9P_ENABLE_stat
+
+void fmt_print_lib9p_stat(lo_interface fmt_dest w, struct lib9p_ctx *ctx, struct lib9p_stat *stat);
+
/**
* Validate a message's `stat` structure.
*
diff --git a/lib9p/core_tables.h b/lib9p/core_tables.h
index da2027a..e3dc8f4 100644
--- a/lib9p/core_tables.h
+++ b/lib9p/core_tables.h
@@ -21,10 +21,10 @@ extern const struct _lib9p_ver_tentry _lib9p_table_ver[LIB9P_VER_NUM];
/* message ********************************************************************/
-typedef lo_interface fmt_formatter (*_box_as_fmt_formatter_fn_t)(void *host_val);
+typedef void (*_print_fn_t)(lo_interface fmt_dest, struct lib9p_ctx *, void *);
struct _lib9p_msg_tentry {
- const char *name;
- _box_as_fmt_formatter_fn_t box_as_fmt_formatter;
+ const char *name;
+ _print_fn_t print;
};
typedef ssize_t (*_validate_fn_t)(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes);
diff --git a/lib9p/srv.c b/lib9p/srv.c
index dad1814..18165e0 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -54,12 +54,11 @@ void lib9p_srv_acknowledge_flush(struct lib9p_srv_ctx *ctx) {
ctx->flush_acknowledged = true;
}
-#define req_debugf(fmt, ...) \
- log_debugf("cid=%zu: %s(tag=%"PRIu16"): " fmt, \
- cr_getcid(), \
- lib9p_msgtype_str(ctx->basectx.version, ctx->net_bytes[4]), \
- ctx->tag \
- __VA_OPT__(,) __VA_ARGS__)
+#define req_debug(...) \
+ log_debugln( \
+ "cid=", cr_getcid(), ": ", \
+ lib9p_msgtype_str(ctx->basectx.version, ctx->net_bytes[4]), "(tag=", ctx->tag, "): ", \
+ __VA_ARGS__)
/* structs ********************************************************************/
@@ -356,13 +355,7 @@ static void srv_msglog(struct srv_req *req, enum lib9p_msg_type typ, void *hostm
srv->msglog(req, typ, hostmsg);
return;
}
- /* It sucks that %v trips -Wformat and -Wformat-extra-args
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781 */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- log_infof("%c %v", typ % 2 ? '<' : '>', lo_box_lib9p_msg_as_fmt_formatter(&req->basectx, typ, hostmsg));
-#pragma GCC diagnostic pop
+ log_infoln(typ % 2 ? "< " : "> ", (lib9p_msg, &req->basectx, typ, hostmsg));
}
static ssize_t srv_write_Rmsg(struct srv_req *req, struct lib9p_Rmsg_send_buf *resp) {
@@ -373,7 +366,7 @@ static ssize_t srv_write_Rmsg(struct srv_req *req, struct lib9p_Rmsg_send_buf *r
return r;
}
-#define srv_nonrespond_errorf log_errorf
+#define srv_nonrespond_error log_errorln
static void srv_respond_error(struct srv_req *req) {
#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
@@ -409,7 +402,7 @@ static void srv_respond_error(struct srv_req *req) {
srv_msglog(req, LIB9P_TYP_Rerror, &host);
r = srv_write_Rmsg(req, &net);
if (r < 0)
- srv_nonrespond_errorf("write: %s", net_strerror(-r));
+ srv_nonrespond_error("write: ", net_strerror(-r));
}
/* read coroutine *************************************************************/
@@ -421,11 +414,11 @@ static inline bool srv_read_exactly(lo_interface net_stream_conn fd, uint8_t *bu
while (*done < goal) {
ssize_t r = io_read(fd, &buf[*done], goal - *done);
if (r < 0) {
- srv_nonrespond_errorf("read: %s", net_strerror(-r));
+ srv_nonrespond_error("read: ", net_strerror(-r));
return true;
} else if (r == 0) {
if (*done != 0)
- srv_nonrespond_errorf("read: unexpected EOF");
+ srv_nonrespond_error("read: unexpected EOF");
return true;
}
*done += r;
@@ -443,7 +436,7 @@ void lib9p_srv_accept_and_read_loop(struct lib9p_srv *srv, lo_interface net_stre
for (;;) {
lo_interface net_stream_conn conn = LO_CALL(listener, accept);
if (LO_IS_NULL(conn)) {
- srv_nonrespond_errorf("accept: error");
+ srv_nonrespond_error("accept: error");
srv->readers--;
if (srv->readers == 0)
while (srv->writers > 0)
@@ -478,7 +471,7 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) {
break;
size_t goal = uint32le_decode(buf);
if (goal < 7) {
- srv_nonrespond_errorf("T-message is impossibly small");
+ srv_nonrespond_error("T-message is impossibly small");
break;
}
if (srv_read_exactly(conn.fd, buf, 7, &done))
@@ -494,11 +487,9 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) {
.net_bytes = buf,
};
if (goal > sess.max_msg_size) {
- lib9p_errorf(&req.basectx,
- LIB9P_ERRNO_L_EMSGSIZE, "T-message larger than %s limit (%zu > %"PRIu32")",
- sess.initialized ? "negotiated" : "server",
- goal,
- sess.max_msg_size);
+ lib9p_error(&req.basectx, LIB9P_ERRNO_L_EMSGSIZE,
+ "T-message larger than ", sess.initialized ? "negotiated" : "server", " limit",
+ " (", goal, " > ", sess.max_msg_size, ")");
srv_respond_error(&req);
continue;
}
@@ -541,7 +532,7 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) {
MAP_FOREACH(&sess.fids, fid, fidinfo) {
srv_fid_del(&pseudoreq, fid, fidinfo, false);
if (lib9p_ctx_has_error(&pseudoreq.basectx)) {
- srv_nonrespond_errorf("clunk: %.*s", CONFIG_9P_MAX_ERR_SIZE, pseudoreq.basectx.err_msg);
+ srv_nonrespond_error("clunk: ", (strn, pseudoreq.basectx.err_msg, CONFIG_9P_MAX_ERR_SIZE));
lib9p_ctx_clear_error(&pseudoreq.basectx);
}
}
@@ -746,9 +737,9 @@ static void handle_Tversion(struct srv_req *ctx,
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")",
- lib9p_version_str(version), req->max_msg_size, min_msg_size);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EDOM, "requested max_msg_size is less than minimum for ", lib9p_version_str(version),
+ " (", req->max_msg_size, " < ", min_msg_size,")");
goto tversion_return;
}
@@ -780,7 +771,7 @@ static void handle_Tversion(struct srv_req *ctx,
MAP_FOREACH(&ctx->parent_sess->fids, fid, fidinfo) {
srv_fid_del(ctx, fid, fidinfo, false);
if (lib9p_ctx_has_error(&ctx->basectx)) {
- srv_nonrespond_errorf("clunk: %.*s", CONFIG_9P_MAX_ERR_SIZE, ctx->basectx.err_msg);
+ srv_nonrespond_error("clunk: ", (strn, ctx->basectx.err_msg, CONFIG_9P_MAX_ERR_SIZE));
lib9p_ctx_clear_error(&ctx->basectx);
}
}
@@ -839,21 +830,22 @@ static void handle_Tattach(struct srv_req *ctx,
lib9p_error(&ctx->basectx,
LIB9P_ERRNO_L_EACCES, "FID provided as auth-file is not an auth-file");
else if (!lib9p_str_eq(afid->user->name, req->uname))
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EACCES, "FID provided as auth-file is for user=\"%.*s\" and cannot be used for user=\"%.*s\"",
- afid->user->name.len, afid->user->name.utf8,
- req->uname.len, req->uname.utf8);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EACCES,
+ "FID provided as auth-file is for user=", (qmem, afid->user->name.utf8, afid->user->name.len),
+ " and cannot be used for user=", (qmem, req->uname.utf8, req->uname.len));
#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
else if (afid->user->num != req->unum)
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EACCES, "FID provided as auth-file is for user=%"PRIu32" and cannot be used for user=%"PRIu32,
- afid->user->num, req->unum);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EACCES,
+ "FID provided as auth-file is for user=", afid->user->num,
+ " and cannot be used for user=", req->unum);
#endif
else if (!lib9p_str_eq(afid->auth.aname, req->aname))
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EACCES, "FID provided as auth-file is for tree=\"%.*s\" and cannot be used for tree=\"%.*s\"",
- afid->auth.aname.len, afid->auth.aname.utf8,
- req->aname.len, req->aname.utf8);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EACCES,
+ "FID provided as auth-file is for tree=", (qmem, afid->auth.aname.utf8, afid->auth.aname.len),
+ " and cannot be used for tree=", (qmem, req->aname.utf8, req->aname.len));
else if (!afid->auth.completed)
lib9p_error(&ctx->basectx,
LIB9P_ERRNO_L_EACCES, "FID provided as auth-file has not completed authentication");
@@ -905,11 +897,11 @@ static void handle_Tflush(struct srv_req *ctx,
switch (cr_select_l(CR_SELECT_RECV(&oldreq->flush_ch, &res),
CR_SELECT_SEND(&ctx->flush_ch, &res))) {
case 0: /* original request returned */
- req_debugf("original request (tag=%"PRIu16") returned", req->oldtag);
+ req_debug("original request (tag=", req->oldtag, ") returned");
ctx->flush_acknowledged = (res == _LIB9P_SRV_FLUSH_SILENT);
break;
case 1: /* flush itself got flushed */
- req_debugf("flush itself flushed");
+ req_debug("flush itself flushed");
ctx->flush_acknowledged = true;
break;
}
@@ -929,8 +921,8 @@ static void handle_Twalk(struct srv_req *ctx,
struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid);
if (!fidinfo) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EBADF, "bad file number %"PRIu32, req->fid);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid);
goto twalk_return;
}
if (fidinfo->flags & FIDFLAG_OPEN) {
@@ -1007,8 +999,8 @@ static void handle_Topen(struct srv_req *ctx,
/* Check that the FID is valid for this. */
struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid);
if (!fidinfo) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EBADF, "bad file number %"PRIu32, req->fid);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid);
goto topen_return;
}
if (fidinfo->flags & FIDFLAG_OPEN) {
@@ -1177,8 +1169,8 @@ static void handle_Tread(struct srv_req *ctx,
/* Check that the FID is valid for this. */
struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid);
if (!fidinfo) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EBADF, "bad file number %"PRIu32, req->fid);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid);
goto tread_return;
}
if (!(fidinfo->flags & FIDFLAG_OPEN_R)) {
@@ -1198,9 +1190,8 @@ static void handle_Tread(struct srv_req *ctx,
fidinfo->dir.off = 0;
fidinfo->dir.buffered_dirent = (struct lib9p_srv_dirent){};
} else if (req->offset != fidinfo->dir.off) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EINVAL, "invalid offset (must be 0 or %"PRIu64"): %"PRIu64,
- fidinfo->dir.off, req->offset);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EINVAL, "invalid offset (must be 0 or ", fidinfo->dir.off, "): ", req->offset);
goto tread_return;
}
/* Read. */
@@ -1299,8 +1290,8 @@ static void handle_Twrite(struct srv_req *ctx,
/* Check that the FID is valid for this. */
struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid);
if (!fidinfo) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EBADF, "bad file number %"PRIu32, req->fid);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid);
goto twrite_return;
}
if (!(fidinfo->flags & FIDFLAG_OPEN_W)) {
@@ -1326,8 +1317,8 @@ static void handle_Tclunk(struct srv_req *ctx,
struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid);
if (!fidinfo) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EBADF, "bad file number %"PRIu32, req->fid);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid);
goto tclunk_return;
}
@@ -1343,8 +1334,8 @@ static void handle_Tremove(struct srv_req *ctx,
struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid);
if (!fidinfo) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EBADF, "bad file number %"PRIu32, req->fid);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid);
goto tremove_return;
}
@@ -1379,8 +1370,8 @@ static void handle_Tstat(struct srv_req *ctx,
struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid);
if (!fidinfo) {
- lib9p_errorf(&ctx->basectx,
- LIB9P_ERRNO_L_EBADF, "bad file number %"PRIu32, req->fid);
+ lib9p_error(&ctx->basectx,
+ LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid);
goto tstat_return;
}
struct srv_pathinfo *pathinfo = map_load(&ctx->parent_sess->paths, fidinfo->path);
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index 9724e25..4caff16 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -128,22 +128,26 @@ static COROUTINE init_cr(void *) {
cr_exit();
}
-static void log_fct(char character, void *_stream) {
- FILE *stream = _stream;
- putc(character, stream);
- putchar(character);
+struct tstlog_stdout {};
+LO_IMPLEMENTATION_H(fmt_dest, struct tstlog_stdout, tstlog_stdout);
+LO_IMPLEMENTATION_C(fmt_dest, struct tstlog_stdout, tstlog_stdout, static);
+
+static size_t tstlog_bytes = 0;
+
+static void tstlog_stdout_putb(struct tstlog_stdout *, uint8_t b) {
+ putc(b, globals.logstream);
+ putchar(b);
+ tstlog_bytes++;
}
-static void log_msg(struct lib9p_srv_ctx *ctx, enum lib9p_msg_type typ, void *hostmsg) {
- /* It sucks that %v trips -Wformat and -Wformat-extra-args
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781 */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
- fmt_fctprintf(log_fct, globals.logstream,
- "%c %v\n", typ % 2 ? '<' : '>',
- lo_box_lib9p_msg_as_fmt_formatter(&ctx->basectx, typ, hostmsg));
-#pragma GCC diagnostic pop
+static size_t tstlog_stdout_tell(struct tstlog_stdout *) {
+ return tstlog_bytes;
+}
+
+static lo_interface fmt_dest tstlog_dest = { .vtable = &_lo_tstlog_stdout_fmt_dest_vtable };
+
+static void tstlog_msg(struct lib9p_srv_ctx *ctx, enum lib9p_msg_type typ, void *hostmsg) {
+ fmt_print(tstlog_dest, typ % 2 ? "< " : "> ", (lib9p_msg, &ctx->basectx, typ, hostmsg), "\n");
fflush(globals.logstream);
}
@@ -155,7 +159,7 @@ int main(int argc, char *argv[]) {
globals.logstream = fopen(argv[2], "w");
if (!globals.logstream)
error(2, errno, "fopen");
- globals.srv.msglog = log_msg;
+ globals.srv.msglog = tstlog_msg;
struct hostclock clock_monotonic = {
.clock_id = CLOCK_MONOTONIC,