diff options
-rw-r--r-- | .editorconfig | 2 | ||||
-rw-r--r-- | GNUmakefile | 4 | ||||
-rw-r--r-- | cmd/sbc_harness/fs_harness_flash_bin.c | 10 | ||||
-rw-r--r-- | cmd/sbc_harness/fs_harness_uptime_txt.c | 8 | ||||
-rw-r--r-- | lib9p/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib9p/core.c | 34 | ||||
-rw-r--r-- | lib9p/core_gen/c_marshal.py | 2 | ||||
-rw-r--r-- | lib9p/core_gen/c_validate.py | 14 | ||||
-rw-r--r-- | lib9p/core_generated.c | 566 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/core.h | 28 | ||||
-rw-r--r-- | lib9p/srv.c | 88 | ||||
-rw-r--r-- | lib9p/srv_errno.h | 14 | ||||
-rw-r--r-- | lib9p/srv_generated.c | 91 | ||||
-rwxr-xr-x | lib9p/srv_generated.c.gen | 30 | ||||
-rw-r--r-- | lib9p/srv_include/lib9p/srv.h | 10 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_flush.c | 6 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_shutdown.c | 4 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_whoami.c | 6 | ||||
-rw-r--r-- | lib9p_util/static.c | 16 |
19 files changed, 533 insertions, 401 deletions
diff --git a/.editorconfig b/.editorconfig index 903f473..42c5a67 100644 --- a/.editorconfig +++ b/.editorconfig @@ -70,7 +70,7 @@ _mode = 9p-log [lib9p/tests/test_server/static.h.gen] _mode = sh -[{lib9p/linux-errno.txt.gen,lib9p/tests/test_compile.c.gen,lib9p/tests/runtest,lib9p/tests/testclient-p9p}] +[{lib9p/linux-errno.txt.gen,lib9p/srv_generated.c.gen,lib9p/tests/test_compile.c.gen,lib9p/tests/runtest,lib9p/tests/testclient-p9p}] _mode = bash [{lib9p/core.gen,lib9p/idl/2010-9P2000.L.9p.gen}] diff --git a/GNUmakefile b/GNUmakefile index 5eb67f5..51f01aa 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -49,6 +49,10 @@ generate/files += lib9p/core_generated.c lib9p/core_include/lib9p/_core_generate lib9p/core_generated.c lib9p/core_include/lib9p/_core_generated.h &: lib9p/core.gen lib9p/idl/__init__.py lib9p/core_gen lib9p/core_gen/*.py lib9p/idl lib9p/idl/2010-9P2000.L.9p lib9p/idl/*.9p $< $(sort $(filter %.9p,$^)) +generate/files += lib9p/srv_generated.c +lib9p/srv_generated.c: %: %.gen libmisc/include/libmisc/error.h + $^ $@ + generate/files += lib9p/tests/test_compile.c lib9p/tests/test_compile.c: %: %.gen lib9p/core_include/lib9p/_core_generated.h $^ $@ diff --git a/cmd/sbc_harness/fs_harness_flash_bin.c b/cmd/sbc_harness/fs_harness_flash_bin.c index 8bd144e..0a7364a 100644 --- a/cmd/sbc_harness/fs_harness_flash_bin.c +++ b/cmd/sbc_harness/fs_harness_flash_bin.c @@ -170,13 +170,13 @@ static void flash_file_wstat(struct flash_file *self, struct lib9p_srv_ctx *ctx, assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } static void flash_file_remove(struct flash_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } LIB9P_SRV_NOTDIR(struct flash_file, flash_file); @@ -230,7 +230,7 @@ static void flash_file_pread(struct flash_file *self, struct lib9p_srv_ctx *ctx, if (byte_offset > DATA_SIZE) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "offset is past the chip size"); + E_POSIX_EINVAL, "offset is past the chip size"); return; } @@ -276,14 +276,14 @@ static uint32_t flash_file_pwrite(struct flash_file *self, struct lib9p_srv_ctx if (byte_offset > DATA_HSIZE) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "offset is past half the chip size"); + E_POSIX_EINVAL, "offset is past half the chip size"); return 0; } if (byte_count == 0) return 0; if (byte_offset == DATA_HSIZE) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "offset is at half the chip size"); + E_POSIX_EINVAL, "offset is at half the chip size"); return 0; } diff --git a/cmd/sbc_harness/fs_harness_uptime_txt.c b/cmd/sbc_harness/fs_harness_uptime_txt.c index 23ac9d4..848c34f 100644 --- a/cmd/sbc_harness/fs_harness_uptime_txt.c +++ b/cmd/sbc_harness/fs_harness_uptime_txt.c @@ -69,13 +69,13 @@ static void uptime_file_wstat(struct uptime_file *self, struct lib9p_srv_ctx *ct assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } static void uptime_file_remove(struct uptime_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } LIB9P_SRV_NOTDIR(struct uptime_file, uptime_file); @@ -124,7 +124,7 @@ static void uptime_fio_pread(struct uptime_fio *self, struct lib9p_srv_ctx *ctx, if (byte_offset > (uint64_t)self->buf_len) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "offset is past end-of-file length"); + E_POSIX_EINVAL, "offset is past end-of-file length"); return; } @@ -145,6 +145,6 @@ static uint32_t uptime_fio_pwrite(struct uptime_fio *self, struct lib9p_srv_ctx assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); return 0; } diff --git a/lib9p/CMakeLists.txt b/lib9p/CMakeLists.txt index 3433417..e81e7b9 100644 --- a/lib9p/CMakeLists.txt +++ b/lib9p/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(lib9p_srv INTERFACE) target_include_directories(lib9p_srv PUBLIC INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/srv_include) target_sources(lib9p_srv INTERFACE srv.c + srv_generated.c ) target_link_libraries(lib9p_srv INTERFACE lib9p_core diff --git a/lib9p/core.c b/lib9p/core.c index d64e23a..f638c12 100644 --- a/lib9p/core.c +++ b/lib9p/core.c @@ -49,9 +49,7 @@ bool lib9p_str_eq(struct lib9p_s a, struct lib9p_s b) { void lib9p_ctx_clear_error(struct lib9p_ctx *ctx) { assert(ctx); -#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L ctx->err_num = 0; -#endif ctx->err_msg[0] = '\0'; } @@ -109,22 +107,22 @@ void fmt_print_lib9p_msg(lo_interface fmt_dest w, struct lib9p_ctx *ctx, enum li _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); \ +#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, E_POSIX_EBADMSG, "message is impossibly short"); \ + uint8_t typ = net_bytes[4]; \ + if (typ % 2 != LOW_TYP_BIT) \ + return lib9p_error(ctx, E_POSIX_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, E_POSIX_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_marshal.py b/lib9p/core_gen/c_marshal.py index bddf55f..6321837 100644 --- a/lib9p/core_gen/c_marshal.py +++ b/lib9p/core_gen/c_marshal.py @@ -381,7 +381,7 @@ 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_error(ctx, {c9util.IDENT("ERRNO_L_ERANGE")}, "{typ.typname} message too large to marshal into ",\n' + ret += f'\t\tlib9p_error(ctx, E_POSIX_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" diff --git a/lib9p/core_gen/c_validate.py b/lib9p/core_gen/c_validate.py index 8997237..29567ae 100644 --- a/lib9p/core_gen/c_validate.py +++ b/lib9p/core_gen/c_validate.py @@ -57,9 +57,9 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str: "\t\t/* If needed-net-size overflowed uint32_t, then\n" "\t\t * there's no way that actual-net-size will live up to\n" "\t\t * that. */\n" - f'\t\treturn lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "message is too short for content");\n' + '\t\treturn lib9p_error(ctx, E_POSIX_EBADMSG, "message is too short for content");\n' "\tif (net_offset > net_size)\n" - f'\t\treturn lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "message is too short for content (", net_offset, " > ", net_size, ")");\n' + '\t\treturn lib9p_error(ctx, E_POSIX_EBADMSG, "message is too short for content (", net_offset, " > ", net_size, ")");\n' ) ret += cutil.macro( "#define VALIDATE_NET_UTF8(n)\n" @@ -67,7 +67,7 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str: "\t\tsize_t len = n;\n" "\t\tVALIDATE_NET_BYTES(len);\n" "\t\tif (!utf8_is_valid_without_nul(&net_bytes[net_offset-len], len))\n" - f'\t\t\treturn lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EILSEQ")}, "message contains invalid UTF-8");\n' + '\t\t\treturn lib9p_error(ctx, E_POSIX_EILSEQ, "message contains invalid UTF-8");\n' "\t}\n" ) ret += cutil.macro( @@ -76,7 +76,7 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str: "\t\t/* If needed-host-size overflowed ssize_t, then there's\n" "\t\t * no way that actual-net-size will live up to\n" "\t\t * that. */\n" - f'\t\treturn lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "message is too short for content");\n' + '\t\treturn lib9p_error(ctx, E_POSIX_EBADMSG, "message is too short for content");\n' ) ret += "#define GET_U8LE(off) (net_bytes[off])\n" @@ -193,7 +193,7 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str: 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_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "{path} value is wrong: actual:", (base10, {act}), " != correct:", (base10, {exp}));\n' + ret += f'{"\t"*(indent_lvl()+1)}return lib9p_error(ctx, E_POSIX_EBADMSG, "{path} value is wrong: actual:", (base10, {act}), " != correct:", (base10, {exp}));\n' if child.max: incr_flush() assert child.typ.static_size @@ -207,14 +207,14 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str: 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_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "{path} value is too large: ", (base10, {act}), " > ", (base10, {exp}));\n' + ret += f'{"\t"*(indent_lvl()+1)}return lib9p_error(ctx, E_POSIX_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_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "unknown bits in {child.typ.typname} bitfield: ",\n' + ret += f'{"\t"*(indent_lvl()+1)}return lib9p_error(ctx, E_POSIX_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( diff --git a/lib9p/core_generated.c b/lib9p/core_generated.c index ad7b210..493bbc2 100644 --- a/lib9p/core_generated.c +++ b/lib9p/core_generated.c @@ -221,27 +221,27 @@ static const lib9p_lock_flags_t lock_flags_masks[LIB9P_VER_NUM] = { /* validate_* *****************************************************************/ -#define VALIDATE_NET_BYTES(n) \ - if (__builtin_add_overflow(net_offset, n, &net_offset)) \ - /* If needed-net-size overflowed uint32_t, then \ - * there's no way that actual-net-size will live up to \ - * that. */ \ - return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "message is too short for content"); \ - if (net_offset > net_size) \ - 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; \ - VALIDATE_NET_BYTES(len); \ - if (!utf8_is_valid_without_nul(&net_bytes[net_offset-len], len)) \ - return lib9p_error(ctx, LIB9P_ERRNO_L_EILSEQ, "message contains invalid UTF-8"); \ +#define VALIDATE_NET_BYTES(n) \ + if (__builtin_add_overflow(net_offset, n, &net_offset)) \ + /* If needed-net-size overflowed uint32_t, then \ + * there's no way that actual-net-size will live up to \ + * that. */ \ + return lib9p_error(ctx, E_POSIX_EBADMSG, "message is too short for content"); \ + if (net_offset > net_size) \ + return lib9p_error(ctx, E_POSIX_EBADMSG, "message is too short for content (", net_offset, " > ", net_size, ")"); +#define VALIDATE_NET_UTF8(n) \ + { \ + size_t len = n; \ + VALIDATE_NET_BYTES(len); \ + if (!utf8_is_valid_without_nul(&net_bytes[net_offset-len], len)) \ + return lib9p_error(ctx, E_POSIX_EILSEQ, "message contains invalid UTF-8"); \ } #define RESERVE_HOST_BYTES(n) \ if (__builtin_add_overflow(host_size, n, &host_size)) \ /* If needed-host-size overflowed ssize_t, then there's \ * no way that actual-net-size will live up to \ * that. */ \ - return lib9p_error(ctx, LIB9P_ERRNO_L_EBADMSG, "message is too short for content"); + return lib9p_error(ctx, E_POSIX_EBADMSG, "message is too short for content"); #define GET_U8LE(off) (net_bytes[off]) #define GET_U16LE(off) uint16le_decode(&net_bytes[off]) #define GET_U32LE(off) uint32le_decode(&net_bytes[off]) @@ -260,7 +260,7 @@ 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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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); @@ -280,9 +280,9 @@ 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 (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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ", + return lib9p_error(ctx, E_POSIX_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; @@ -300,9 +300,9 @@ static ssize_t validate_Tversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8 VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tversion->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 100)); return (ssize_t)host_size; } @@ -315,9 +315,9 @@ static ssize_t validate_Rversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8 VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rversion->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 101)); return (ssize_t)host_size; } @@ -339,9 +339,9 @@ 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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tauth->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 102)); return (ssize_t)host_size; } @@ -353,13 +353,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rauth->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 103)); return (ssize_t)host_size; } @@ -379,9 +379,9 @@ 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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tattach->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 104)); return (ssize_t)host_size; } @@ -393,13 +393,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rattach->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 105)); return (ssize_t)host_size; } @@ -419,9 +419,9 @@ 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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rerror->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 107)); return (ssize_t)host_size; } @@ -435,9 +435,9 @@ static ssize_t validate_Tflush(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 9; VALIDATE_NET_BYTES(9); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tflush->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 108)); return (ssize_t)host_size; } @@ -449,9 +449,9 @@ static ssize_t validate_Rflush(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rflush->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 109)); return (ssize_t)host_size; } @@ -469,11 +469,11 @@ static ssize_t validate_Twalk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t } uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Twalk->nwname value is too large: ", (base10, GET_U16LE(offsetof_nwname)), " > ", (base10, 16)); return (ssize_t)host_size; } @@ -489,16 +489,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rwalk->nwqid value is too large: ", (base10, GET_U16LE(offsetof_nwqid)), " > ", (base10, 16)); return (ssize_t)host_size; } @@ -513,11 +513,11 @@ static ssize_t validate_Topen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 12; VALIDATE_NET_BYTES(12); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in o bitfield: ", (base16_u8_, GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])); return (ssize_t)host_size; } @@ -530,14 +530,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Ropen->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 113)); return (ssize_t)host_size; } @@ -553,14 +553,14 @@ static ssize_t validate_Tcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 5; VALIDATE_NET_BYTES(5); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ", + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in o bitfield: ", (base16_u8_, GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])); return (ssize_t)host_size; } @@ -573,14 +573,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 115)); return (ssize_t)host_size; } @@ -596,13 +596,13 @@ static ssize_t validate_Tread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 23; VALIDATE_NET_BYTES(23); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tread->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX)); return (ssize_t)host_size; } @@ -616,11 +616,11 @@ static ssize_t validate_Rread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t VALIDATE_NET_BYTES(LAST_U32LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rread->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX)); return (ssize_t)host_size; } @@ -635,13 +635,13 @@ static ssize_t validate_Twrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t VALIDATE_NET_BYTES(LAST_U32LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Twrite->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX)); return (ssize_t)host_size; } @@ -654,11 +654,11 @@ static ssize_t validate_Rwrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rwrite->count value is too large: ", (base10, GET_U32LE(offsetof_count)), " > ", (base10, INT32_MAX)); return (ssize_t)host_size; } @@ -670,9 +670,9 @@ static ssize_t validate_Tclunk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tclunk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 120)); return (ssize_t)host_size; } @@ -684,9 +684,9 @@ static ssize_t validate_Rclunk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rclunk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 121)); return (ssize_t)host_size; } @@ -698,9 +698,9 @@ static ssize_t validate_Tremove(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tremove->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 122)); return (ssize_t)host_size; } @@ -712,9 +712,9 @@ static ssize_t validate_Rremove(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rremove->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 123)); return (ssize_t)host_size; } @@ -728,9 +728,9 @@ static ssize_t validate_Tstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tstat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 124)); return (ssize_t)host_size; } @@ -746,7 +746,7 @@ 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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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); @@ -766,17 +766,17 @@ 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 (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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rstat->nstat value is wrong: actual:", (base10, GET_U32LE(offsetof_nstat)), " != correct:", (base10, offsetof_end - offsetof_stat)); return (ssize_t)host_size; } @@ -792,7 +792,7 @@ 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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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); @@ -812,17 +812,17 @@ 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 (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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in dm bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Twstat->nstat value is wrong: actual:", (base10, GET_U32LE(offsetof_nstat)), " != correct:", (base10, offsetof_end - offsetof_stat)); return (ssize_t)host_size; } @@ -834,9 +834,9 @@ static ssize_t validate_Rwstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rwstat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 127)); return (ssize_t)host_size; } @@ -851,11 +851,11 @@ static ssize_t validate_Topenfd(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 12; VALIDATE_NET_BYTES(12); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in o bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in o bitfield: ", (base16_u8_, GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])); return (ssize_t)host_size; } @@ -868,14 +868,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Ropenfd->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 99)); return (ssize_t)host_size; } @@ -889,9 +889,9 @@ static ssize_t validate_Rlerror(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rlerror->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 7)); return (ssize_t)host_size; } @@ -903,9 +903,9 @@ static ssize_t validate_Tstatfs(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tstatfs->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 8)); return (ssize_t)host_size; } @@ -917,9 +917,9 @@ static ssize_t validate_Rstatfs(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 67; VALIDATE_NET_BYTES(67); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rstatfs->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 9)); return (ssize_t)host_size; } @@ -932,11 +932,11 @@ static ssize_t validate_Tlopen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 15; VALIDATE_NET_BYTES(15); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lo bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in lo bitfield: ", (base16_u32_, GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version])); return (ssize_t)host_size; } @@ -949,14 +949,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rlopen->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 13)); return (ssize_t)host_size; } @@ -972,14 +972,14 @@ static ssize_t validate_Tlcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 12; VALIDATE_NET_BYTES(12); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lo bitfield: ", + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in mode bitfield: ", (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])); return (ssize_t)host_size; } @@ -992,14 +992,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rlcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 15)); return (ssize_t)host_size; } @@ -1015,9 +1015,9 @@ static ssize_t validate_Tsymlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 4; VALIDATE_NET_BYTES(4); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tsymlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 16)); return (ssize_t)host_size; } @@ -1029,13 +1029,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rsymlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 17)); return (ssize_t)host_size; } @@ -1050,11 +1050,11 @@ static ssize_t validate_Tmknod(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 16; VALIDATE_NET_BYTES(16); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in mode bitfield: ", (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])); return (ssize_t)host_size; } @@ -1067,13 +1067,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rmknod->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 19)); return (ssize_t)host_size; } @@ -1086,9 +1086,9 @@ static ssize_t validate_Trename(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Trename->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 20)); return (ssize_t)host_size; } @@ -1100,9 +1100,9 @@ static ssize_t validate_Rrename(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rrename->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 21)); return (ssize_t)host_size; } @@ -1114,9 +1114,9 @@ static ssize_t validate_Treadlink(struct lib9p_ctx *ctx, uint32_t net_size, uint uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Treadlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 22)); return (ssize_t)host_size; } @@ -1129,9 +1129,9 @@ static ssize_t validate_Rreadlink(struct lib9p_ctx *ctx, uint32_t net_size, uint VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rreadlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 23)); return (ssize_t)host_size; } @@ -1144,11 +1144,11 @@ static ssize_t validate_Tgetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 19; VALIDATE_NET_BYTES(19); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in getattr bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in getattr bitfield: ", (base16_u64_, GET_U64LE(offsetof_request_mask) & ~getattr_masks[ctx->version])); return (ssize_t)host_size; } @@ -1162,20 +1162,20 @@ 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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in getattr bitfield: ", + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in mode bitfield: ", (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])); return (ssize_t)host_size; } @@ -1190,14 +1190,14 @@ static ssize_t validate_Tsetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 67; VALIDATE_NET_BYTES(67); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in setattr bitfield: ", + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in mode bitfield: ", (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])); return (ssize_t)host_size; } @@ -1210,9 +1210,9 @@ static ssize_t validate_Rsetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rsetattr->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 27)); return (ssize_t)host_size; } @@ -1225,9 +1225,9 @@ static ssize_t validate_Txattrwalk(struct lib9p_ctx *ctx, uint32_t net_size, uin VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Txattrwalk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 30)); return (ssize_t)host_size; } @@ -1239,9 +1239,9 @@ static ssize_t validate_Rxattrwalk(struct lib9p_ctx *ctx, uint32_t net_size, uin uint32_t offsetof_end = net_offset + 15; VALIDATE_NET_BYTES(15); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rxattrwalk->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 31)); return (ssize_t)host_size; } @@ -1255,9 +1255,9 @@ static ssize_t validate_Txattrcreate(struct lib9p_ctx *ctx, uint32_t net_size, u uint32_t offsetof_end = net_offset + 12; VALIDATE_NET_BYTES(12); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Txattrcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 32)); return (ssize_t)host_size; } @@ -1269,9 +1269,9 @@ static ssize_t validate_Rxattrcreate(struct lib9p_ctx *ctx, uint32_t net_size, u uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rxattrcreate->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 33)); return (ssize_t)host_size; } @@ -1283,9 +1283,9 @@ static ssize_t validate_Treaddir(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 23; VALIDATE_NET_BYTES(23); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Treaddir->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 40)); return (ssize_t)host_size; } @@ -1298,9 +1298,9 @@ static ssize_t validate_Rreaddir(struct lib9p_ctx *ctx, uint32_t net_size, uint8 VALIDATE_NET_BYTES(LAST_U32LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rreaddir->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 41)); return (ssize_t)host_size; } @@ -1312,9 +1312,9 @@ static ssize_t validate_Tfsync(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 15; VALIDATE_NET_BYTES(15); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tfsync->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 50)); return (ssize_t)host_size; } @@ -1326,9 +1326,9 @@ static ssize_t validate_Rfsync(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rfsync->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 51)); return (ssize_t)host_size; } @@ -1342,11 +1342,11 @@ static ssize_t validate_Tlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in lock_flags bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in lock_flags bitfield: ", (base16_u32_, GET_U32LE(offsetof_flags) & ~lock_flags_masks[ctx->version])); return (ssize_t)host_size; } @@ -1359,9 +1359,9 @@ static ssize_t validate_Rlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 8; VALIDATE_NET_BYTES(8); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rlock->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 53)); return (ssize_t)host_size; } @@ -1374,9 +1374,9 @@ static ssize_t validate_Tgetlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8 VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tgetlock->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 54)); return (ssize_t)host_size; } @@ -1389,9 +1389,9 @@ static ssize_t validate_Rgetlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8 VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rgetlock->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 55)); return (ssize_t)host_size; } @@ -1404,9 +1404,9 @@ static ssize_t validate_Tlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 70)); return (ssize_t)host_size; } @@ -1418,9 +1418,9 @@ static ssize_t validate_Rlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rlink->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 71)); return (ssize_t)host_size; } @@ -1435,11 +1435,11 @@ static ssize_t validate_Tmkdir(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t uint32_t offsetof_end = net_offset + 8; VALIDATE_NET_BYTES(8); 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)); + return lib9p_error(ctx, E_POSIX_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)); + return lib9p_error(ctx, E_POSIX_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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in mode bitfield: ", + return lib9p_error(ctx, E_POSIX_EBADMSG, "unknown bits in mode bitfield: ", (base16_u32_, GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])); return (ssize_t)host_size; } @@ -1452,13 +1452,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_error(ctx, LIB9P_ERRNO_L_EBADMSG, "unknown bits in qt bitfield: ", + return lib9p_error(ctx, E_POSIX_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 (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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rmkdir->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 73)); return (ssize_t)host_size; } @@ -1473,9 +1473,9 @@ static ssize_t validate_Trenameat(struct lib9p_ctx *ctx, uint32_t net_size, uint VALIDATE_NET_UTF8(LAST_U16LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Trenameat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 74)); return (ssize_t)host_size; } @@ -1487,9 +1487,9 @@ static ssize_t validate_Rrenameat(struct lib9p_ctx *ctx, uint32_t net_size, uint uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rrenameat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 75)); return (ssize_t)host_size; } @@ -1503,9 +1503,9 @@ static ssize_t validate_Tunlinkat(struct lib9p_ctx *ctx, uint32_t net_size, uint uint32_t offsetof_end = net_offset + 4; VALIDATE_NET_BYTES(4); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tunlinkat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 76)); return (ssize_t)host_size; } @@ -1517,9 +1517,9 @@ static ssize_t validate_Runlinkat(struct lib9p_ctx *ctx, uint32_t net_size, uint uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Runlinkat->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 77)); return (ssize_t)host_size; } @@ -1533,9 +1533,9 @@ static ssize_t validate_Tsession(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 15; VALIDATE_NET_BYTES(15); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tsession->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 150)); return (ssize_t)host_size; } @@ -1547,9 +1547,9 @@ static ssize_t validate_Rsession(struct lib9p_ctx *ctx, uint32_t net_size, uint8 uint32_t offsetof_end = net_offset + 7; VALIDATE_NET_BYTES(7); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rsession->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 151)); return (ssize_t)host_size; } @@ -1566,9 +1566,9 @@ static ssize_t validate_Tsread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t } uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tsread->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 152)); return (ssize_t)host_size; } @@ -1581,9 +1581,9 @@ static ssize_t validate_Rsread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t VALIDATE_NET_BYTES(LAST_U32LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Rsread->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 153)); return (ssize_t)host_size; } @@ -1602,9 +1602,9 @@ static ssize_t validate_Tswrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ VALIDATE_NET_BYTES(LAST_U32LE()); uint32_t offsetof_end = net_offset + 0; 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_EBADMSG, "Tswrite->typ value is wrong: actual:", (base10, GET_U8LE(offsetof_typ)), " != correct:", (base10, 154)); return (ssize_t)host_size; } @@ -1616,9 +1616,9 @@ static ssize_t validate_Rswrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_ uint32_t offsetof_end = net_offset + 11; VALIDATE_NET_BYTES(11); 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)); + return lib9p_error(ctx, E_POSIX_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 lib9p_error(ctx, E_POSIX_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 */ @@ -2769,7 +2769,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tversion message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tversion message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2788,7 +2788,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rversion message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rversion message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2814,7 +2814,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tauth message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tauth message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2840,7 +2840,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rauth message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rauth message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2864,7 +2864,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tattach message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tattach message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2891,7 +2891,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rattach message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rattach message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2917,7 +2917,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rerror message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rerror message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2942,7 +2942,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tflush message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tflush message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2959,7 +2959,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rflush message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rflush message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -2978,7 +2978,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Twalk message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Twalk message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3001,7 +3001,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rwalk message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rwalk message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3025,7 +3025,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Topen message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Topen message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3043,7 +3043,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Ropen message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Ropen message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3063,7 +3063,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tcreate message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tcreate message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3084,7 +3084,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rcreate message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rcreate message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3106,7 +3106,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tread message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tread message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3125,7 +3125,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rread message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rread message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3143,7 +3143,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Twrite message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Twrite message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3163,7 +3163,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rwrite message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rwrite message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3180,7 +3180,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tclunk message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tclunk message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3197,7 +3197,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rclunk message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rclunk message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3213,7 +3213,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tremove message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tremove message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3230,7 +3230,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rremove message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rremove message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3248,7 +3248,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tstat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tstat message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3270,7 +3270,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rstat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rstat message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3327,7 +3327,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Twstat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Twstat message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3380,7 +3380,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rwstat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rwstat message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3398,7 +3398,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Topenfd message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Topenfd message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3416,7 +3416,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Ropenfd message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Ropenfd message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3439,7 +3439,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlerror message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rlerror message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3456,7 +3456,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tstatfs message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tstatfs message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3473,7 +3473,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rstatfs message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rstatfs message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3498,7 +3498,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlopen message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tlopen message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3516,7 +3516,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlopen message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rlopen message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3536,7 +3536,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlcreate message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tlcreate message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3558,7 +3558,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlcreate message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rlcreate message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3578,7 +3578,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsymlink message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tsymlink message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3600,7 +3600,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsymlink message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rsymlink message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3619,7 +3619,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tmknod message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tmknod message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3642,7 +3642,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rmknod message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rmknod message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3661,7 +3661,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Trename message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Trename message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3681,7 +3681,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rrename message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rrename message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3697,7 +3697,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Treadlink message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Treadlink message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3714,7 +3714,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rreadlink message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rreadlink message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3732,7 +3732,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tgetattr message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tgetattr message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3750,7 +3750,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rgetattr message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rgetattr message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3788,7 +3788,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsetattr message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tsetattr message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3814,7 +3814,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsetattr message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rsetattr message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3830,7 +3830,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Txattrwalk message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Txattrwalk message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3850,7 +3850,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rxattrwalk message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rxattrwalk message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3867,7 +3867,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Txattrcreate message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Txattrcreate message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3888,7 +3888,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rxattrcreate message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rxattrcreate message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3904,7 +3904,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Treaddir message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Treaddir message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3923,7 +3923,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rreaddir message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rreaddir message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3941,7 +3941,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tfsync message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tfsync message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3959,7 +3959,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rfsync message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rfsync message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3975,7 +3975,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlock message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tlock message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -3999,7 +3999,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlock message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rlock message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4016,7 +4016,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tgetlock message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tgetlock message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4039,7 +4039,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rgetlock message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rgetlock message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4061,7 +4061,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tlink message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tlink message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4081,7 +4081,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rlink message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rlink message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4097,7 +4097,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tmkdir message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tmkdir message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4118,7 +4118,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rmkdir message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rmkdir message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4137,7 +4137,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Trenameat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Trenameat message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4159,7 +4159,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rrenameat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rrenameat message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4175,7 +4175,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tunlinkat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tunlinkat message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4195,7 +4195,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Runlinkat message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Runlinkat message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4213,7 +4213,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsession message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tsession message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4230,7 +4230,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsession message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rsession message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4249,7 +4249,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tsread message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tsread message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4271,7 +4271,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rsread message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rsread message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4292,7 +4292,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Tswrite message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Tswrite message too large to marshal into ", ctx->version ? "negotiated" : "client", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; @@ -4316,7 +4316,7 @@ 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_error(ctx, LIB9P_ERRNO_L_ERANGE, "Rswrite message too large to marshal into ", + lib9p_error(ctx, E_POSIX_ERANGE, "Rswrite message too large to marshal into ", ctx->version ? "negotiated" : "server", " limit", " (", needed_size, " > ", ctx->max_msg_size, ")"); return true; diff --git a/lib9p/core_include/lib9p/core.h b/lib9p/core_include/lib9p/core.h index 27553a3..7bee2f1 100644 --- a/lib9p/core_include/lib9p/core.h +++ b/lib9p/core_include/lib9p/core.h @@ -51,9 +51,7 @@ struct lib9p_ctx { uint32_t max_msg_size; /* state */ -#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L - lib9p_errno_t err_num; -#endif + _errnum err_num; [[gnu::nonstring]] char err_msg[CONFIG_9P_MAX_ERR_SIZE]; }; @@ -61,16 +59,10 @@ void lib9p_ctx_clear_error(struct lib9p_ctx *ctx); bool lib9p_ctx_has_error(struct lib9p_ctx *ctx); -#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L - #define _lib9p_set_err_num(ctx, linux_errno) do { (ctx)->err_num = linux_errno; } while (0) -#else - #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, ...) ({ \ +#define lib9p_error(ctx, libmisc_errno, ...) ({ \ if (!lib9p_ctx_has_error(ctx)) { \ - _lib9p_set_err_num(ctx, linux_errno); \ + (ctx)->err_num = libmisc_errno; \ struct fmt_buf _w = { \ .dat = (ctx)->err_msg, \ .cap = sizeof((ctx)->err_msg), \ @@ -105,12 +97,12 @@ void fmt_print_lib9p_msg(lo_interface fmt_dest w, struct lib9p_ctx *ctx, enum li * * @return required size, or -1 on error * - * @errno L_EOPNOTSUPP: message is an R-message - * @errno L_EOPNOTSUPP: message has unknown type - * @errno L_EBADMSG: message is wrong size for content - * @errno L_EILSEQ: message contains invalid UTF-8, or the UTF-8 contains a nul-byte - * @errno L_EBADMSG: message contains a bitfield with unknown bits - * @errno L_EMSGSIZE: would-be return value overflows SSIZE_MAX + * @errno E_POSIX_EOPNOTSUPP: message is an R-message + * @errno E_POSIX_EOPNOTSUPP: message has unknown type + * @errno E_POSIX_EBADMSG: message is wrong size for content + * @errno E_POSIX_EILSEQ: message contains invalid UTF-8, or the UTF-8 contains a nul-byte + * @errno E_POSIX_EBADMSG: message contains a bitfield with unknown bits + * @errno E_POSIX_EMSGSIZE: would-be return value overflows SSIZE_MAX */ ssize_t lib9p_Tmsg_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes); @@ -145,7 +137,7 @@ void lib9p_Tmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, * @return ret : the buffer to encode to * @return whether there was an error (false=success, true=error) * - * @errno L_ERANGE: reply does not fit in ctx->max_msg_size + * @errno E_POSIX_ERANGE: reply does not fit in ctx->max_msg_size */ bool lib9p_Tmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, struct lib9p_Tmsg_send_buf *ret); diff --git a/lib9p/srv.c b/lib9p/srv.c index 7785e4d..d29479f 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -27,6 +27,8 @@ #define IMPLEMENTATION_FOR_LIB9P_SRV_H YES #include <lib9p/srv.h> +#include "srv_errno.h" + /* config *********************************************************************/ #include "config.h" @@ -342,7 +344,7 @@ static inline struct srv_fidinfo *srv_fid_store(struct srv_req *ctx, lib9p_fid_t map_del(&ctx->parent_sess->fids, fid); } else { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "FID already in use"); + E_POSIX_EBADF, "FID already in use"); return NULL; } } @@ -388,7 +390,7 @@ static void srv_respond_error(struct srv_req *req) { .errstr = lib9p_strn(req->basectx.err_msg, CONFIG_9P_MAX_ERR_SIZE), #if CONFIG_9P_ENABLE_9P2000_u - .errnum = req->basectx.err_num, + .errnum = libmisc_to_linuxgeneric_errno(req->basectx.err_num), #endif }; @@ -397,7 +399,7 @@ static void srv_respond_error(struct srv_req *req) { uint32_t overhead = lib9p_version_min_Rerror_size(sess->version); /* Truncate the error-string if necessary to avoid needing to - * return LIB9P_ERRNO_L_ERANGE. */ + * return E_POSIX_ERANGE. */ if (((uint32_t)host.errstr.len) + overhead > sess->max_msg_size) host.errstr.len = sess->max_msg_size - overhead; @@ -497,7 +499,7 @@ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn _conn) { .net_bytes = buf, }; if (goal > sess.max_msg_size) { - lib9p_error(&req.basectx, LIB9P_ERRNO_L_EMSGSIZE, + lib9p_error(&req.basectx, E_POSIX_EMSGSIZE, "T-message larger than ", sess.initialized ? "negotiated" : "server", " limit", " (", goal, " > ", sess.max_msg_size, ")"); srv_respond_error(&req); @@ -760,7 +762,7 @@ static void handle_Tversion(struct srv_req *ctx, lib9p_version_min_Rread_size(ctx->basectx.version)+1); if (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), + E_POSIX_EDOM, "requested max_msg_size is less than minimum for ", lib9p_version_str(version), " (", req->max_msg_size, " < ", min_msg_size, ")"); goto tversion_return; } @@ -814,7 +816,7 @@ static void handle_Tauth(struct srv_req *ctx, struct lib9p_srv *srv = ctx->parent_sess->parent_conn->parent_srv; if (!srv->auth) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "authentication not required"); + E_POSIX_EOPNOTSUPP, "authentication not required"); goto tauth_return; } @@ -823,7 +825,7 @@ static void handle_Tauth(struct srv_req *ctx, srv->auth(ctx, req->aname); lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "TODO: auth not implemented"); + E_POSIX_EOPNOTSUPP, "TODO: auth not implemented"); if (lib9p_ctx_has_error(&ctx->basectx)) ctx->user = srv_userid_decref(ctx->user); @@ -838,7 +840,7 @@ static void handle_Tattach(struct srv_req *ctx, if (req->fid == LIB9P_FID_NOFID) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "cannot assign to NOFID"); + E_POSIX_EBADF, "cannot assign to NOFID"); goto tattach_return; } @@ -847,37 +849,37 @@ static void handle_Tattach(struct srv_req *ctx, struct srv_fidinfo *afid = map_load(&ctx->parent_sess->fids, req->afid); if (!afid) lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, "FID provided as auth-file is not a valid FID"); + E_POSIX_EACCES, "FID provided as auth-file is not a valid FID"); else if (afid->type != SRV_FILETYPE_AUTH) lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, "FID provided as auth-file is not an auth-file"); + E_POSIX_EACCES, "FID provided as auth-file is not an auth-file"); else if (!lib9p_str_eq(afid->user->name, req->uname)) lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, + E_POSIX_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_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, + E_POSIX_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_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, + E_POSIX_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"); + E_POSIX_EACCES, "FID provided as auth-file has not completed authentication"); if (lib9p_ctx_has_error(&ctx->basectx)) goto tattach_return; ctx->user = srv_userid_incref(afid->user); } else { if (req->afid != LIB9P_FID_NOFID) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, "FID provided as auth-file, but no auth-file is required"); + E_POSIX_EACCES, "FID provided as auth-file, but no auth-file is required"); goto tattach_return; } ctx->user = srv_userid_new(req->uname, req->unum); @@ -937,19 +939,19 @@ static void handle_Twalk(struct srv_req *ctx, if (req->newfid == LIB9P_FID_NOFID) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "cannot assign to NOFID"); + E_POSIX_EBADF, "cannot assign to NOFID"); goto twalk_return; } struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid); + E_POSIX_EBADF, "bad file number ", req->fid); goto twalk_return; } if (fidinfo->flags & FIDFLAG_OPEN) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EALREADY, "cannot walk on FID open for I/O"); + E_POSIX_EALREADY, "cannot walk on FID open for I/O"); goto twalk_return; } ctx->user = srv_userid_incref(fidinfo->user); @@ -963,7 +965,7 @@ static void handle_Twalk(struct srv_req *ctx, for (resp.nwqid = 0; resp.nwqid < req->nwname; resp.nwqid++) { if (pathinfo->type != SRV_FILETYPE_DIR) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_ENOTDIR, "not a directory"); + E_POSIX_ENOTDIR, "not a directory"); break; } @@ -988,7 +990,7 @@ static void handle_Twalk(struct srv_req *ctx, lib9p_srv_stat_assert(stat); if (!srv_check_perm(ctx, &stat, 0b001)) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, "you do not have execute permission on that directory"); + E_POSIX_EACCES, "you do not have execute permission on that directory"); srv_path_decref(ctx, LO_CALL(new_pathinfo->file, qid).path); break; } @@ -1022,12 +1024,12 @@ static void handle_Topen(struct srv_req *ctx, struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid); + E_POSIX_EBADF, "bad file number ", req->fid); goto topen_return; } if (fidinfo->flags & FIDFLAG_OPEN) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EALREADY, "FID is already open"); + E_POSIX_EALREADY, "FID is already open"); goto topen_return; } if (fidinfo->type == SRV_FILETYPE_DIR) { @@ -1035,7 +1037,7 @@ static void handle_Topen(struct srv_req *ctx, (req->mode & LIB9P_O_TRUNC) || (req->mode & LIB9P_O_RCLOSE) ) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EISDIR, "directories cannot be written, executed, truncated, or removed-on-close"); + E_POSIX_EISDIR, "directories cannot be written, executed, truncated, or removed-on-close"); goto topen_return; } } @@ -1057,7 +1059,7 @@ static void handle_Topen(struct srv_req *ctx, lib9p_srv_stat_assert(parent_stat); if (!srv_check_perm(ctx, &parent_stat, 0b010)) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, "permission denied to remove-on-close"); + E_POSIX_EACCES, "permission denied to remove-on-close"); goto topen_return; } fidflags |= FIDFLAG_RCLOSE; @@ -1068,7 +1070,7 @@ static void handle_Topen(struct srv_req *ctx, lib9p_srv_stat_assert(stat); if ((stat.mode & LIB9P_DM_EXCL) && pathinfo->io_refcount) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EEXIST, "exclusive file is already opened"); + E_POSIX_EEXIST, "exclusive file is already opened"); goto topen_return; } if (stat.mode & LIB9P_DM_APPEND) { @@ -1097,7 +1099,7 @@ static void handle_Topen(struct srv_req *ctx, } if (!srv_check_perm(ctx, &stat, perm_bits)) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, "permission denied"); + E_POSIX_EACCES, "permission denied"); goto topen_return; } @@ -1153,7 +1155,7 @@ static void handle_Tcreate(struct srv_req *ctx, srv_handler_common(ctx, create, req); lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "create not (yet?) implemented"); + E_POSIX_EOPNOTSUPP, "create not (yet?) implemented"); srv_respond(ctx, create, &resp); } @@ -1192,12 +1194,12 @@ static void handle_Tread(struct srv_req *ctx, struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid); + E_POSIX_EBADF, "bad file number ", req->fid); goto tread_return; } if (!(fidinfo->flags & FIDFLAG_OPEN_R)) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "FID not open for reading"); + E_POSIX_EINVAL, "FID not open for reading"); goto tread_return; } @@ -1213,7 +1215,7 @@ static void handle_Tread(struct srv_req *ctx, fidinfo->dir.buffered_dirent = (struct lib9p_srv_dirent){}; } else if (req->offset != fidinfo->dir.off) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "invalid offset (must be 0 or ", fidinfo->dir.off, "): ", req->offset); + E_POSIX_EINVAL, "invalid offset (must be 0 or ", fidinfo->dir.off, "): ", req->offset); goto tread_return; } /* Read. */ @@ -1266,7 +1268,7 @@ static void handle_Tread(struct srv_req *ctx, if (!nbytes) { if (!resp.count) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_ERANGE, "stat object does not fit into negotiated max message size"); + E_POSIX_ERANGE, "stat object does not fit into negotiated max message size"); goto tread_return; } fidinfo->dir.buffered_dirent = member_dirent; @@ -1313,12 +1315,12 @@ static void handle_Twrite(struct srv_req *ctx, struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid); + E_POSIX_EBADF, "bad file number ", req->fid); goto twrite_return; } if (!(fidinfo->flags & FIDFLAG_OPEN_W)) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "FID not open for writing"); + E_POSIX_EINVAL, "FID not open for writing"); goto twrite_return; } if (fidinfo->flags & FIDFLAG_APPEND) @@ -1340,7 +1342,7 @@ static void handle_Tclunk(struct srv_req *ctx, struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid); + E_POSIX_EBADF, "bad file number ", req->fid); goto tclunk_return; } @@ -1357,7 +1359,7 @@ static void handle_Tremove(struct srv_req *ctx, struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid); + E_POSIX_EBADF, "bad file number ", req->fid); goto tremove_return; } @@ -1366,7 +1368,7 @@ static void handle_Tremove(struct srv_req *ctx, assert(pathinfo); if (pathinfo->parent_dir == fidinfo->path) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBUSY, "cannot remove root"); + E_POSIX_EBUSY, "cannot remove root"); remove = false; goto tremove_main; } @@ -1375,7 +1377,7 @@ static void handle_Tremove(struct srv_req *ctx, struct lib9p_srv_stat parent_stat = LO_CALL(parent->file, stat, ctx); if (!lib9p_ctx_has_error(&ctx->basectx) && !srv_check_perm(ctx, &parent_stat, 0b010)) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EACCES, "you do not have write permission on the parent directory"); + E_POSIX_EACCES, "you do not have write permission on the parent directory"); remove = false; goto tremove_main; } @@ -1393,7 +1395,7 @@ static void handle_Tstat(struct srv_req *ctx, struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EBADF, "bad file number ", req->fid); + E_POSIX_EBADF, "bad file number ", req->fid); goto tstat_return; } struct srv_pathinfo *pathinfo = map_load(&ctx->parent_sess->paths, fidinfo->path); @@ -1416,7 +1418,7 @@ static void handle_Twstat(struct srv_req *ctx, srv_handler_common(ctx, wstat, req); lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "wstat not (yet?) implemented"); + E_POSIX_EOPNOTSUPP, "wstat not (yet?) implemented"); srv_respond(ctx, wstat, &resp); } @@ -1428,7 +1430,7 @@ static void handle_Topenfd(struct srv_req *ctx, srv_handler_common(ctx, openfd, req); lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "openfd not (yet?) implemented"); + E_POSIX_EOPNOTSUPP, "openfd not (yet?) implemented"); srv_respond(ctx, openfd, &resp); } @@ -1440,7 +1442,7 @@ static void handle_Tsession(struct srv_req *ctx, srv_handler_common(ctx, session, req); lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "session not (yet?) implemented"); + E_POSIX_EOPNOTSUPP, "session not (yet?) implemented"); srv_respond(ctx, session, &resp); } @@ -1450,7 +1452,7 @@ static void handle_Tsread(struct srv_req *ctx, srv_handler_common(ctx, sread, req); lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "sread not (yet?) implemented"); + E_POSIX_EOPNOTSUPP, "sread not (yet?) implemented"); srv_respond(ctx, sread, &resp); } @@ -1460,7 +1462,7 @@ static void handle_Tswrite(struct srv_req *ctx, srv_handler_common(ctx, swrite, req); lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EOPNOTSUPP, "swrite not (yet?) implemented"); + E_POSIX_EOPNOTSUPP, "swrite not (yet?) implemented"); srv_respond(ctx, swrite, &resp); } diff --git a/lib9p/srv_errno.h b/lib9p/srv_errno.h new file mode 100644 index 0000000..1384f97 --- /dev/null +++ b/lib9p/srv_errno.h @@ -0,0 +1,14 @@ +/* lib9p/srv_errno.h - TODO + * + * Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com> + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +#ifndef _LIB9P_SRV_ERRNO_H_ +#define _LIB9P_SRV_ERRNO_H_ + +#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L +lib9p_errno_t libmisc_to_linuxgeneric_errno(_errnum); +#endif + +#endif /* _LIB9P_SRV_ERRNO_H_ */ diff --git a/lib9p/srv_generated.c b/lib9p/srv_generated.c new file mode 100644 index 0000000..26989c5 --- /dev/null +++ b/lib9p/srv_generated.c @@ -0,0 +1,91 @@ +/* lib9p/srv_generated.c - Generated by lib9p/srv_generated.c.gen. DO NOT EDIT! */ + +#include <libmisc/error.h> +#include <lib9p/core.h> +#include "srv_errno.h" + +#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L +lib9p_errno_t libmisc_to_linuxgeneric_errno(_errnum errnum) { + LM_PARTIAL_SWITCH (errnum) { + case E_POSIX_E2BIG: return LIB9P_ERRNO_L_E2BIG; + case E_POSIX_EACCES: return LIB9P_ERRNO_L_EACCES; + case E_POSIX_EADDRINUSE: return LIB9P_ERRNO_L_EADDRINUSE; + case E_POSIX_EADDRNOTAVAIL: return LIB9P_ERRNO_L_EADDRNOTAVAIL; + case E_POSIX_EAFNOSUPPORT: return LIB9P_ERRNO_L_EAFNOSUPPORT; + case E_POSIX_EAGAIN: return LIB9P_ERRNO_L_EAGAIN; + case E_POSIX_EALREADY: return LIB9P_ERRNO_L_EALREADY; + case E_POSIX_EBADF: return LIB9P_ERRNO_L_EBADF; + case E_POSIX_EBADMSG: return LIB9P_ERRNO_L_EBADMSG; + case E_POSIX_EBUSY: return LIB9P_ERRNO_L_EBUSY; + case E_POSIX_ECANCELED: return LIB9P_ERRNO_L_ECANCELED; + case E_POSIX_ECHILD: return LIB9P_ERRNO_L_ECHILD; + case E_POSIX_ECONNABORTED: return LIB9P_ERRNO_L_ECONNABORTED; + case E_POSIX_ECONNREFUSED: return LIB9P_ERRNO_L_ECONNREFUSED; + case E_POSIX_ECONNRESET: return LIB9P_ERRNO_L_ECONNRESET; + case E_POSIX_EDEADLK: return LIB9P_ERRNO_L_EDEADLK; + case E_POSIX_EDESTADDRREQ: return LIB9P_ERRNO_L_EDESTADDRREQ; + case E_POSIX_EDOM: return LIB9P_ERRNO_L_EDOM; + case E_POSIX_EDQUOT: return LIB9P_ERRNO_L_EDQUOT; + case E_POSIX_EEXIST: return LIB9P_ERRNO_L_EEXIST; + case E_POSIX_EFAULT: return LIB9P_ERRNO_L_EFAULT; + case E_POSIX_EFBIG: return LIB9P_ERRNO_L_EFBIG; + case E_POSIX_EHOSTUNREACH: return LIB9P_ERRNO_L_EHOSTUNREACH; + case E_POSIX_EIDRM: return LIB9P_ERRNO_L_EIDRM; + case E_POSIX_EILSEQ: return LIB9P_ERRNO_L_EILSEQ; + case E_POSIX_EINPROGRESS: return LIB9P_ERRNO_L_EINPROGRESS; + case E_POSIX_EINTR: return LIB9P_ERRNO_L_EINTR; + case E_POSIX_EINVAL: return LIB9P_ERRNO_L_EINVAL; + case E_POSIX_EIO: return LIB9P_ERRNO_L_EIO; + case E_POSIX_EISCONN: return LIB9P_ERRNO_L_EISCONN; + case E_POSIX_EISDIR: return LIB9P_ERRNO_L_EISDIR; + case E_POSIX_ELOOP: return LIB9P_ERRNO_L_ELOOP; + case E_POSIX_EMFILE: return LIB9P_ERRNO_L_EMFILE; + case E_POSIX_EMLINK: return LIB9P_ERRNO_L_EMLINK; + case E_POSIX_EMSGSIZE: return LIB9P_ERRNO_L_EMSGSIZE; + case E_POSIX_EMULTIHOP: return LIB9P_ERRNO_L_EMULTIHOP; + case E_POSIX_ENAMETOOLONG: return LIB9P_ERRNO_L_ENAMETOOLONG; + case E_POSIX_ENETDOWN: return LIB9P_ERRNO_L_ENETDOWN; + case E_POSIX_ENETRESET: return LIB9P_ERRNO_L_ENETRESET; + case E_POSIX_ENETUNREACH: return LIB9P_ERRNO_L_ENETUNREACH; + case E_POSIX_ENFILE: return LIB9P_ERRNO_L_ENFILE; + case E_POSIX_ENOBUFS: return LIB9P_ERRNO_L_ENOBUFS; + case E_POSIX_ENODEV: return LIB9P_ERRNO_L_ENODEV; + case E_POSIX_ENOENT: return LIB9P_ERRNO_L_ENOENT; + case E_POSIX_ENOEXEC: return LIB9P_ERRNO_L_ENOEXEC; + case E_POSIX_ENOLCK: return LIB9P_ERRNO_L_ENOLCK; + case E_POSIX_ENOLINK: return LIB9P_ERRNO_L_ENOLINK; + case E_POSIX_ENOMEM: return LIB9P_ERRNO_L_ENOMEM; + case E_POSIX_ENOMSG: return LIB9P_ERRNO_L_ENOMSG; + case E_POSIX_ENOPROTOOPT: return LIB9P_ERRNO_L_ENOPROTOOPT; + case E_POSIX_ENOSPC: return LIB9P_ERRNO_L_ENOSPC; + case E_POSIX_ENOSYS: return LIB9P_ERRNO_L_ENOSYS; + case E_POSIX_ENOTCONN: return LIB9P_ERRNO_L_ENOTCONN; + case E_POSIX_ENOTDIR: return LIB9P_ERRNO_L_ENOTDIR; + case E_POSIX_ENOTEMPTY: return LIB9P_ERRNO_L_ENOTEMPTY; + case E_POSIX_ENOTRECOVERABLE: return LIB9P_ERRNO_L_ENOTRECOVERABLE; + case E_POSIX_ENOTSOCK: return LIB9P_ERRNO_L_ENOTSOCK; + case E_POSIX_ENOTTY: return LIB9P_ERRNO_L_ENOTTY; + case E_POSIX_ENXIO: return LIB9P_ERRNO_L_ENXIO; + case E_POSIX_EOPNOTSUPP: return LIB9P_ERRNO_L_EOPNOTSUPP; + case E_POSIX_EOVERFLOW: return LIB9P_ERRNO_L_EOVERFLOW; + case E_POSIX_EOWNERDEAD: return LIB9P_ERRNO_L_EOWNERDEAD; + case E_POSIX_EPERM: return LIB9P_ERRNO_L_EPERM; + case E_POSIX_EPIPE: return LIB9P_ERRNO_L_EPIPE; + case E_POSIX_EPROTO: return LIB9P_ERRNO_L_EPROTO; + case E_POSIX_EPROTONOSUPPORT: return LIB9P_ERRNO_L_EPROTONOSUPPORT; + case E_POSIX_EPROTOTYPE: return LIB9P_ERRNO_L_EPROTOTYPE; + case E_POSIX_ERANGE: return LIB9P_ERRNO_L_ERANGE; + case E_POSIX_EROFS: return LIB9P_ERRNO_L_EROFS; + case E_POSIX_ESOCKTNOSUPPORT: return LIB9P_ERRNO_L_ESOCKTNOSUPPORT; + case E_POSIX_ESPIPE: return LIB9P_ERRNO_L_ESPIPE; + case E_POSIX_ESRCH: return LIB9P_ERRNO_L_ESRCH; + case E_POSIX_ESTALE: return LIB9P_ERRNO_L_ESTALE; + case E_POSIX_ETIMEDOUT: return LIB9P_ERRNO_L_ETIMEDOUT; + case E_POSIX_ETXTBSY: return LIB9P_ERRNO_L_ETXTBSY; + case E_POSIX_EXDEV: return LIB9P_ERRNO_L_EXDEV; + case E_POSIX_ENOTSUP: return LIB9P_ERRNO_L_EOPNOTSUPP; + case E_POSIX_EWOULDBLOCK: return LIB9P_ERRNO_L_EAGAIN; + default: return LIB9P_ERRNO_L_EIO; + } +} +#endif diff --git a/lib9p/srv_generated.c.gen b/lib9p/srv_generated.c.gen new file mode 100755 index 0000000..6a6335a --- /dev/null +++ b/lib9p/srv_generated.c.gen @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# lib9p/srv_generated.c.gen - Generate errno translation tables +# +# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com> +# SPDX-License-Identifier: AGPL-3.0-or-later + +error_h=$1 +outfile=$2 + +{ + echo "/* ${outfile} - Generated by $0. DO NOT EDIT! */" + echo + echo '#include <libmisc/error.h>' + echo '#include <lib9p/core.h>' + echo '#include "srv_errno.h"' + echo + echo '#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L' + echo 'lib9p_errno_t libmisc_to_linuxgeneric_errno(_errnum errnum) {' + echo $'\tLM_PARTIAL_SWITCH (errnum) {' + sed -nE \ + -e 's@^(#define)?\s+(E_POSIX_([_A-Z0-9]+))[ ,][^/]*/\* ([^*(]+) (\*/|\().*@'$'\tcase \\2: return LIB9P_ERRNO_L_\\3;''@p' \ + -- "$error_h" | + grep -v -e '_ENOTSUP' -e '_EWOULDBLOCK' + echo $'\tcase E_POSIX_ENOTSUP: return LIB9P_ERRNO_L_EOPNOTSUPP;' + echo $'\tcase E_POSIX_EWOULDBLOCK: return LIB9P_ERRNO_L_EAGAIN;' + echo $'\tdefault: return LIB9P_ERRNO_L_EIO;' + echo $'\t}' + echo '}' + echo '#endif' +} >"$outfile" diff --git a/lib9p/srv_include/lib9p/srv.h b/lib9p/srv_include/lib9p/srv.h index 89dc986..349a413 100644 --- a/lib9p/srv_include/lib9p/srv.h +++ b/lib9p/srv_include/lib9p/srv.h @@ -263,10 +263,10 @@ void lib9p_srv_accept_and_read_loop(struct lib9p_srv *srv, lo_interface net_stre * * Errors that this function itself may send to clients: * - * @errno L_EMSGSIZE T-message has size[4] bigger than max_msg_size - * @errno L_EDOM Tversion specified an impossibly small max_msg_size - * @errno L_EOPNOTSUPP T-message has an R-message type, or an unrecognized T-message type - * @errno L_EBADMSG T-message has wrong size[4] for its content, or has invalid UTF-8 + * @errno E_POSIX_EMSGSIZE T-message has size[4] bigger than max_msg_size + * @errno E_POSIX_EDOM Tversion specified an impossibly small max_msg_size + * @errno E_POSIX_EOPNOTSUPP T-message has an R-message type, or an unrecognized T-message type + * @errno E_POSIX_EBADMSG T-message has wrong size[4] for its content, or has invalid UTF-8 */ void lib9p_srv_read(struct lib9p_srv *srv, lo_interface net_stream_conn conn); @@ -291,7 +291,7 @@ void lib9p_srv_worker_loop(struct lib9p_srv *srv); * * Errors that this function itself may send to clients: * - * @errno L_ERANGE R-message does not fit into max_msg_size + * @errno E_POSIX_ERANGE R-message does not fit into max_msg_size */ void lib9p_srv_worker(struct lib9p_srv_ctx *req); diff --git a/lib9p/tests/test_server/fs_flush.c b/lib9p/tests/test_server/fs_flush.c index fade0a1..6b677ea 100644 --- a/lib9p/tests/test_server/fs_flush.c +++ b/lib9p/tests/test_server/fs_flush.c @@ -50,12 +50,12 @@ static struct lib9p_srv_stat flush_file_stat(struct flush_file *self, struct lib static void flush_file_wstat(struct flush_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "cannot wstat API file"); } static void flush_file_remove(struct flush_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot remove API file"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "cannot remove API file"); } LIB9P_SRV_NOTDIR(struct flush_file, flush_file) @@ -121,7 +121,7 @@ static void flush_fio_pread(struct flush_fio *self, struct lib9p_srv_ctx *ctx, break; case FLUSH_ERROR: lib9p_srv_acknowledge_flush(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_ECANCELED, "request canceled by flush"); + lib9p_error(&ctx->basectx, E_POSIX_ECANCELED, "request canceled by flush"); break; case FLUSH_SILENT: lib9p_srv_acknowledge_flush(ctx); diff --git a/lib9p/tests/test_server/fs_shutdown.c b/lib9p/tests/test_server/fs_shutdown.c index 0dd473d..11a941f 100644 --- a/lib9p/tests/test_server/fs_shutdown.c +++ b/lib9p/tests/test_server/fs_shutdown.c @@ -49,12 +49,12 @@ static struct lib9p_srv_stat shutdown_file_stat(struct shutdown_file *self, stru static void shutdown_file_wstat(struct shutdown_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "cannot wstat API file"); } static void shutdown_file_remove(struct shutdown_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot remove API file"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "cannot remove API file"); } LIB9P_SRV_NOTDIR(struct shutdown_file, shutdown_file) diff --git a/lib9p/tests/test_server/fs_whoami.c b/lib9p/tests/test_server/fs_whoami.c index 6cc46ac..273d659 100644 --- a/lib9p/tests/test_server/fs_whoami.c +++ b/lib9p/tests/test_server/fs_whoami.c @@ -73,12 +73,12 @@ static struct lib9p_srv_stat whoami_file_stat(struct whoami_file *self, struct l static void whoami_file_wstat(struct whoami_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "cannot wstat API file"); } static void whoami_file_remove(struct whoami_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot remove API file"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "cannot remove API file"); } LIB9P_SRV_NOTDIR(struct whoami_file, whoami_file) @@ -138,7 +138,7 @@ static void whoami_fio_pread(struct whoami_fio *self, struct lib9p_srv_ctx *ctx, if (byte_offset > (uint64_t)data_size) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "offset is past end-of-file length"); + E_POSIX_EINVAL, "offset is past end-of-file length"); return; } diff --git a/lib9p_util/static.c b/lib9p_util/static.c index 40810b5..7196813 100644 --- a/lib9p_util/static.c +++ b/lib9p_util/static.c @@ -55,13 +55,13 @@ static void util9p_static_dir_wstat(struct util9p_static_dir *self, struct lib9p assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } static void util9p_static_dir_remove(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } static lo_interface lib9p_srv_file util9p_static_dir_dwalk(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx, @@ -79,7 +79,7 @@ static lo_interface lib9p_srv_file util9p_static_dir_dwalk(struct util9p_static_ return file; } lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_ENOENT, "no such file or directory"); + E_POSIX_ENOENT, "no such file or directory"); return LO_NULL(lib9p_srv_file); } @@ -91,7 +91,7 @@ static lo_interface lib9p_srv_file util9p_static_dir_dcreate(struct util9p_stati assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); return LO_NULL(lib9p_srv_file); } @@ -173,13 +173,13 @@ static void util9p_static_file_wstat(struct util9p_static_file *self, struct lib assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } static void util9p_static_file_remove(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); } LIB9P_SRV_NOTDIR(struct util9p_static_file, util9p_static_file); @@ -211,7 +211,7 @@ static void util9p_static_file_pread(struct util9p_static_file *self, struct lib if (byte_offset > (uint64_t)data_size) { lib9p_error(&ctx->basectx, - LIB9P_ERRNO_L_EINVAL, "offset is past end-of-file length"); + E_POSIX_EINVAL, "offset is past end-of-file length"); return; } @@ -229,6 +229,6 @@ static uint32_t util9p_static_file_pwrite(struct util9p_static_file *self, struc assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); return 0; } |