diff options
Diffstat (limited to 'lib9p/9p.generated.c')
-rw-r--r-- | lib9p/9p.generated.c | 2844 |
1 files changed, 0 insertions, 2844 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c deleted file mode 100644 index 536063a..0000000 --- a/lib9p/9p.generated.c +++ /dev/null @@ -1,2844 +0,0 @@ -/* Generated by `lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ - -#include <stdbool.h> -#include <stddef.h> /* for size_t */ -#include <inttypes.h> /* for PRI* macros */ -#include <string.h> /* for memset() */ - -#include <libmisc/assert.h> - -#include <lib9p/9p.h> - -#include "internal.h" - -/* strings ********************************************************************/ - -static const char *version_strs[LIB9P_VER_NUM] = { - [LIB9P_VER_unknown] = "unknown", -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = "9P2000", -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = "9P2000.e", -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = "9P2000.u", -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; - -const char *lib9p_version_str(enum lib9p_version ver) { - assert(0 <= ver && ver < LIB9P_VER_NUM); - return version_strs[ver]; -} - -/* validate_* *****************************************************************/ - -static ALWAYS_INLINE bool _validate_size_net(struct _validate_ctx *ctx, uint32_t n) { - if (__builtin_add_overflow(ctx->net_offset, n, &ctx->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->ctx, LINUX_EBADMSG, "message is too short for content"); - if (ctx->net_offset > ctx->net_size) - return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content"); - return false; -} - -static ALWAYS_INLINE bool _validate_size_host(struct _validate_ctx *ctx, size_t n) { - if (__builtin_add_overflow(ctx->host_extra, n, &ctx->host_extra)) - /* If needed-host-size overflowed size_t, then there's - * no way that actual-net-size will live up to - * that. */ - return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content"); - return false; -} - -static ALWAYS_INLINE bool _validate_list(struct _validate_ctx *ctx, - size_t cnt, - _validate_fn_t item_fn, size_t item_host_size) { - for (size_t i = 0; i < cnt; i++) - if (_validate_size_host(ctx, item_host_size) || item_fn(ctx)) - return true; - return false; -} - -#define validate_1(ctx) _validate_size_net(ctx, 1) -#define validate_2(ctx) _validate_size_net(ctx, 2) -#define validate_4(ctx) _validate_size_net(ctx, 4) -#define validate_8(ctx) _validate_size_net(ctx, 8) - -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u -static ALWAYS_INLINE bool validate_tag(struct _validate_ctx *ctx) { - return validate_2(ctx); -} - -static ALWAYS_INLINE bool validate_fid(struct _validate_ctx *ctx) { - return validate_4(ctx); -} - -static ALWAYS_INLINE bool validate_d(struct _validate_ctx *ctx) { - uint32_t base_offset = ctx->net_offset; - if (validate_4(ctx)) - return true; - uint32_t len = decode_u32le(&ctx->net_bytes[base_offset]); - return _validate_size_net(ctx, len) || _validate_size_host(ctx, len); -} - -static ALWAYS_INLINE bool validate_s(struct _validate_ctx *ctx) { - uint32_t base_offset = ctx->net_offset; - if (validate_2(ctx)) - return true; - uint16_t len = decode_u16le(&ctx->net_bytes[base_offset]); - if (_validate_size_net(ctx, len) || _validate_size_host(ctx, ((size_t)len)+1)) - return true; - if (!is_valid_utf8_without_nul(&ctx->net_bytes[base_offset+2], len)) - return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message contains invalid UTF-8"); - return false; -} - -static const lib9p_dm_t dm_masks[LIB9P_VER_NUM] = { -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b11101100000000000000000111111111, -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b11101100000000000000000111111111, -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b11101100101111000000000111111111, -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; -static ALWAYS_INLINE bool validate_dm(struct _validate_ctx *ctx) { - if (validate_4(ctx)) - return true; - lib9p_dm_t mask = dm_masks[ctx->ctx->version]; - lib9p_dm_t val = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); - if (val & ~mask) - return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in dm bitfield: %#04"PRIx32, val & ~mask); - return false; -} - -static const lib9p_qt_t qt_masks[LIB9P_VER_NUM] = { -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b11101100, -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b11101100, -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b11101110, -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; -static ALWAYS_INLINE bool validate_qt(struct _validate_ctx *ctx) { - if (validate_1(ctx)) - return true; - lib9p_qt_t mask = qt_masks[ctx->ctx->version]; - lib9p_qt_t val = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); - if (val & ~mask) - return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#01"PRIx8, val & ~mask); - return false; -} - -static ALWAYS_INLINE bool validate_qid(struct _validate_ctx *ctx) { - return false - || validate_qt(ctx) - || validate_4(ctx) - || validate_8(ctx) - ; -} - -static ALWAYS_INLINE bool validate_stat(struct _validate_ctx *ctx) { - uint16_t stat_size; - uint32_t _kern_type_offset; - return false - || (validate_2(ctx) || ({ stat_size = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; })) - || ({ _kern_type_offset = ctx->net_offset; validate_2(ctx); }) - || validate_4(ctx) - || validate_qid(ctx) - || validate_dm(ctx) - || validate_4(ctx) - || validate_4(ctx) - || validate_8(ctx) - || validate_s(ctx) - || validate_s(ctx) - || validate_s(ctx) - || validate_s(ctx) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_s(ctx) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ uint32_t exp = ctx->net_offset - _kern_type_offset; (((uint32_t)stat_size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "stat_size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)stat_size, exp); }) - ; -} - -static const lib9p_o_t o_masks[LIB9P_VER_NUM] = { -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = 0b01010011, -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = 0b01010011, -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = 0b01010011, -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; -static ALWAYS_INLINE bool validate_o(struct _validate_ctx *ctx) { - if (validate_1(ctx)) - return true; - lib9p_o_t mask = o_masks[ctx->ctx->version]; - lib9p_o_t val = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); - if (val & ~mask) - return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in o bitfield: %#01"PRIx8, val & ~mask); - return false; -} - -static FLATTEN bool validate_Tversion(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_4(ctx) - || validate_s(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 100; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rversion(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_4(ctx) - || validate_s(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 101; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tauth(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || validate_s(ctx) - || validate_s(ctx) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 102; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rauth(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_qid(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 103; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tattach(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || validate_fid(ctx) - || validate_s(ctx) - || validate_s(ctx) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 104; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rattach(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_qid(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 105; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rerror(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_s(ctx) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 107; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tflush(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_2(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 108; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rflush(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 109; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Twalk(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint16_t nwname; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || validate_fid(ctx) - || (validate_2(ctx) || ({ nwname = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; })) - || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s)) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 110; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - || ({ uint32_t max = 16; (((uint32_t)nwname) > max) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nwname value is too large (%"PRIu32" > %"PRIu32")", nwname, max); }) - ; -} - -static FLATTEN bool validate_Rwalk(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint16_t nwqid; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || (validate_2(ctx) || ({ nwqid = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; })) - || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_qid, sizeof(struct lib9p_qid)) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 111; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - || ({ uint32_t max = 16; (((uint32_t)nwqid) > max) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nwqid value is too large (%"PRIu32" > %"PRIu32")", nwqid, max); }) - ; -} - -static FLATTEN bool validate_Topen(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || validate_o(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 112; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Ropen(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_qid(ctx) - || validate_4(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 113; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tcreate(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || validate_s(ctx) - || validate_dm(ctx) - || validate_o(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 114; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rcreate(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_qid(ctx) - || validate_4(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 115; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tread(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || validate_8(ctx) - || validate_4(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 116; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rread(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_d(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 117; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Twrite(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || validate_8(ctx) - || validate_d(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 118; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rwrite(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_4(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 119; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tclunk(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 120; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rclunk(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 121; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tremove(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 122; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rremove(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 123; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tstat(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 124; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rstat(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint16_t nstat; - uint32_t _size_offset; - uint32_t _stat_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || (validate_2(ctx) || ({ nstat = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; })) - || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); }) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 125; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - || ({ uint32_t exp = ctx->net_offset - _stat_offset; (((uint32_t)nstat) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nstat value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)nstat, exp); }) - ; -} - -static FLATTEN bool validate_Twstat(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint16_t nstat; - uint32_t _size_offset; - uint32_t _stat_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || (validate_2(ctx) || ({ nstat = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; })) - || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); }) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 126; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - || ({ uint32_t exp = ctx->net_offset - _stat_offset; (((uint32_t)nstat) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nstat value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)nstat, exp); }) - ; -} - -static FLATTEN bool validate_Rwstat(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 127; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_e -static FLATTEN bool validate_Tsession(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_8(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 150; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rsession(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 151; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tsread(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_4(ctx) - || validate_2(ctx) - || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s)) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 152; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rsread(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_d(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 153; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Tswrite(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_4(ctx) - || validate_2(ctx) - || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s)) - || validate_d(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 154; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} - -static FLATTEN bool validate_Rswrite(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) - || validate_tag(ctx) - || validate_4(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint32_t exp = 155; (((uint32_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); }) - ; -} -#endif /* CONFIG_9P_ENABLE_9P2000_e */ - -/* unmarshal_* ****************************************************************/ - -static ALWAYS_INLINE void unmarshal_1(struct _unmarshal_ctx *ctx, uint8_t *out) { - *out = decode_u8le(&ctx->net_bytes[ctx->net_offset]); - ctx->net_offset += 1; -} - -static ALWAYS_INLINE void unmarshal_2(struct _unmarshal_ctx *ctx, uint16_t *out) { - *out = decode_u16le(&ctx->net_bytes[ctx->net_offset]); - ctx->net_offset += 2; -} - -static ALWAYS_INLINE void unmarshal_4(struct _unmarshal_ctx *ctx, uint32_t *out) { - *out = decode_u32le(&ctx->net_bytes[ctx->net_offset]); - ctx->net_offset += 4; -} - -static ALWAYS_INLINE void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out) { - *out = decode_u64le(&ctx->net_bytes[ctx->net_offset]); - ctx->net_offset += 8; -} - -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u -static ALWAYS_INLINE void unmarshal_tag(struct _unmarshal_ctx *ctx, lib9p_tag_t *out) { - unmarshal_2(ctx, (uint16_t *)out); -} - -static ALWAYS_INLINE void unmarshal_fid(struct _unmarshal_ctx *ctx, lib9p_fid_t *out) { - unmarshal_4(ctx, (uint32_t *)out); -} - -static ALWAYS_INLINE void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9p_d *out) { - memset(out, 0, sizeof(*out)); - unmarshal_4(ctx, &out->len); - out->dat = ctx->extra; - ctx->extra += sizeof(out->dat[0]) * out->len; - for (typeof(out->len) i = 0; i < out->len; i++) - unmarshal_1(ctx, (uint8_t *)&out->dat[i]); -} - -static ALWAYS_INLINE void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s *out) { - memset(out, 0, sizeof(*out)); - unmarshal_2(ctx, &out->len); - out->utf8 = ctx->extra; - ctx->extra += sizeof(out->utf8[0]) * out->len; - for (typeof(out->len) i = 0; i < out->len; i++) - unmarshal_1(ctx, (uint8_t *)&out->utf8[i]); - ctx->extra++; - out->utf8[out->len] = '\0'; -} - -static ALWAYS_INLINE void unmarshal_dm(struct _unmarshal_ctx *ctx, lib9p_dm_t *out) { - unmarshal_4(ctx, (uint32_t *)out); -} - -static ALWAYS_INLINE void unmarshal_qt(struct _unmarshal_ctx *ctx, lib9p_qt_t *out) { - unmarshal_1(ctx, (uint8_t *)out); -} - -static ALWAYS_INLINE void unmarshal_qid(struct _unmarshal_ctx *ctx, struct lib9p_qid *out) { - memset(out, 0, sizeof(*out)); - unmarshal_qt(ctx, &out->type); - unmarshal_4(ctx, &out->vers); - unmarshal_8(ctx, &out->path); -} - -static ALWAYS_INLINE void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 2; - unmarshal_2(ctx, &out->kern_type); - unmarshal_4(ctx, &out->kern_dev); - unmarshal_qid(ctx, &out->file_qid); - unmarshal_dm(ctx, &out->file_mode); - unmarshal_4(ctx, &out->file_atime); - unmarshal_4(ctx, &out->file_mtime); - unmarshal_8(ctx, &out->file_size); - unmarshal_s(ctx, &out->file_name); - unmarshal_s(ctx, &out->file_owner_uid); - unmarshal_s(ctx, &out->file_owner_gid); - unmarshal_s(ctx, &out->file_last_modified_uid); -#if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_s(ctx, &out->file_extension); - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_owner_n_uid); - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_owner_n_gid); - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_last_modified_n_uid); -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -} - -static ALWAYS_INLINE void unmarshal_o(struct _unmarshal_ctx *ctx, lib9p_o_t *out) { - unmarshal_1(ctx, (uint8_t *)out); -} - -static FLATTEN void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tversion *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_4(ctx, &out->max_msg_size); - unmarshal_s(ctx, &out->version); -} - -static FLATTEN void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rversion *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_4(ctx, &out->max_msg_size); - unmarshal_s(ctx, &out->version); -} - -static FLATTEN void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tauth *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->afid); - unmarshal_s(ctx, &out->uname); - unmarshal_s(ctx, &out->aname); -#if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->n_uname); -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -} - -static FLATTEN void unmarshal_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rauth *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_qid(ctx, &out->aqid); -} - -static FLATTEN void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - unmarshal_fid(ctx, &out->afid); - unmarshal_s(ctx, &out->uname); - unmarshal_s(ctx, &out->aname); -#if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->n_uname); -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -} - -static FLATTEN void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rattach *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_qid(ctx, &out->qid); -} - -static FLATTEN void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rerror *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_s(ctx, &out->ename); -#if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->errno); -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -} - -static FLATTEN void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_2(ctx, &out->oldtag); -} - -static FLATTEN void unmarshal_Rflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rflush *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); -} - -static FLATTEN void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twalk *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - unmarshal_fid(ctx, &out->newfid); - unmarshal_2(ctx, &out->nwname); - out->wname = ctx->extra; - ctx->extra += sizeof(out->wname[0]) * out->nwname; - for (typeof(out->nwname) i = 0; i < out->nwname; i++) - unmarshal_s(ctx, &out->wname[i]); -} - -static FLATTEN void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwalk *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_2(ctx, &out->nwqid); - out->wqid = ctx->extra; - ctx->extra += sizeof(out->wqid[0]) * out->nwqid; - for (typeof(out->nwqid) i = 0; i < out->nwqid; i++) - unmarshal_qid(ctx, &out->wqid[i]); -} - -static FLATTEN void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - unmarshal_o(ctx, &out->mode); -} - -static FLATTEN void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_qid(ctx, &out->qid); - unmarshal_4(ctx, &out->iounit); -} - -static FLATTEN void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tcreate *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - unmarshal_s(ctx, &out->name); - unmarshal_dm(ctx, &out->perm); - unmarshal_o(ctx, &out->mode); -} - -static FLATTEN void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rcreate *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_qid(ctx, &out->qid); - unmarshal_4(ctx, &out->iounit); -} - -static FLATTEN void unmarshal_Tread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tread *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - unmarshal_8(ctx, &out->offset); - unmarshal_4(ctx, &out->count); -} - -static FLATTEN void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_d(ctx, &out->data); -} - -static FLATTEN void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - unmarshal_8(ctx, &out->offset); - unmarshal_d(ctx, &out->data); -} - -static FLATTEN void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwrite *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_4(ctx, &out->count); -} - -static FLATTEN void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tclunk *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); -} - -static FLATTEN void unmarshal_Rclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rclunk *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); -} - -static FLATTEN void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tremove *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); -} - -static FLATTEN void unmarshal_Rremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rremove *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); -} - -static FLATTEN void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); -} - -static FLATTEN void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - ctx->net_offset += 2; - unmarshal_stat(ctx, &out->stat); -} - -static FLATTEN void unmarshal_Twstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twstat *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - ctx->net_offset += 2; - unmarshal_stat(ctx, &out->stat); -} - -static FLATTEN void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwstat *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); -} - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_e -static FLATTEN void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsession *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_8(ctx, &out->key); -} - -static FLATTEN void unmarshal_Rsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsession *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); -} - -static FLATTEN void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsread *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_4(ctx, &out->fid); - unmarshal_2(ctx, &out->nwname); - out->wname = ctx->extra; - ctx->extra += sizeof(out->wname[0]) * out->nwname; - for (typeof(out->nwname) i = 0; i < out->nwname; i++) - unmarshal_s(ctx, &out->wname[i]); -} - -static FLATTEN void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_d(ctx, &out->data); -} - -static FLATTEN void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tswrite *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_4(ctx, &out->fid); - unmarshal_2(ctx, &out->nwname); - out->wname = ctx->extra; - ctx->extra += sizeof(out->wname[0]) * out->nwname; - for (typeof(out->nwname) i = 0; i < out->nwname; i++) - unmarshal_s(ctx, &out->wname[i]); - unmarshal_d(ctx, &out->data); -} - -static FLATTEN void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rswrite *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_4(ctx, &out->count); -} -#endif /* CONFIG_9P_ENABLE_9P2000_e */ - -/* marshal_* ******************************************************************/ - -static ALWAYS_INLINE bool _marshal_too_large(struct _marshal_ctx *ctx) { - lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s too large to marshal into %s limit (limit=%"PRIu32")", - (ctx->net_bytes[4] % 2 == 0) ? "T-message" : "R-message", - ctx->ctx->version ? "negotiated" : ((ctx->net_bytes[4] % 2 == 0) ? "client" : "server"), - ctx->ctx->max_msg_size); - return true; -} - -static ALWAYS_INLINE bool marshal_1(struct _marshal_ctx *ctx, uint8_t *val) { - if (ctx->net_offset + 1 > ctx->ctx->max_msg_size) - return _marshal_too_large(ctx); - ctx->net_bytes[ctx->net_offset] = *val; - ctx->net_offset += 1; - return false; -} - -static ALWAYS_INLINE bool marshal_2(struct _marshal_ctx *ctx, uint16_t *val) { - if (ctx->net_offset + 2 > ctx->ctx->max_msg_size) - return _marshal_too_large(ctx); - encode_u16le(*val, &ctx->net_bytes[ctx->net_offset]); - ctx->net_offset += 2; - return false; -} - -static ALWAYS_INLINE bool marshal_4(struct _marshal_ctx *ctx, uint32_t *val) { - if (ctx->net_offset + 4 > ctx->ctx->max_msg_size) - return true; - encode_u32le(*val, &ctx->net_bytes[ctx->net_offset]); - ctx->net_offset += 4; - return false; -} - -static ALWAYS_INLINE bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) { - if (ctx->net_offset + 8 > ctx->ctx->max_msg_size) - return true; - encode_u64le(*val, &ctx->net_bytes[ctx->net_offset]); - ctx->net_offset += 8; - return false; -} - -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u -static ALWAYS_INLINE bool marshal_tag(struct _marshal_ctx *ctx, lib9p_tag_t *val) { - return marshal_2(ctx, (uint16_t *)val); -} - -static ALWAYS_INLINE bool marshal_fid(struct _marshal_ctx *ctx, lib9p_fid_t *val) { - return marshal_4(ctx, (uint32_t *)val); -} - -static ALWAYS_INLINE bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *val) { - return false - || marshal_4(ctx, &val->len) - || ({ bool err = false; - for (typeof(val->len) i = 0; i < val->len && !err; i++) - err = marshal_1(ctx, (uint8_t *)&val->dat[i]); - err; }) - ; -} - -static ALWAYS_INLINE bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *val) { - return false - || marshal_2(ctx, &val->len) - || ({ bool err = false; - for (typeof(val->len) i = 0; i < val->len && !err; i++) - err = marshal_1(ctx, (uint8_t *)&val->utf8[i]); - err; }) - ; -} - -static ALWAYS_INLINE bool marshal_dm(struct _marshal_ctx *ctx, lib9p_dm_t *val) { - lib9p_dm_t masked_val = *val & dm_masks[ctx->ctx->version]; - return marshal_4(ctx, (uint32_t *)&masked_val); -} - -static ALWAYS_INLINE bool marshal_qt(struct _marshal_ctx *ctx, lib9p_qt_t *val) { - lib9p_qt_t masked_val = *val & qt_masks[ctx->ctx->version]; - return marshal_1(ctx, (uint8_t *)&masked_val); -} - -static ALWAYS_INLINE bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) { - return false - || marshal_qt(ctx, &val->type) - || marshal_4(ctx, &val->vers) - || marshal_8(ctx, &val->path) - ; -} - -static ALWAYS_INLINE bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) { - uint32_t _stat_size_offset; - uint32_t _kern_type_offset; - return false - || ({ _stat_size_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); }) - || ({ _kern_type_offset = ctx->net_offset; marshal_2(ctx, &val->kern_type); }) - || marshal_4(ctx, &val->kern_dev) - || marshal_qid(ctx, &val->file_qid) - || marshal_dm(ctx, &val->file_mode) - || marshal_4(ctx, &val->file_atime) - || marshal_4(ctx, &val->file_mtime) - || marshal_8(ctx, &val->file_size) - || marshal_s(ctx, &val->file_name) - || marshal_s(ctx, &val->file_owner_uid) - || marshal_s(ctx, &val->file_owner_gid) - || marshal_s(ctx, &val->file_last_modified_uid) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_s(ctx, &val->file_extension) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_owner_n_uid) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_owner_n_gid) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_last_modified_n_uid) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ encode_u16le(ctx->net_offset - _kern_type_offset, &ctx->net_bytes[_stat_size_offset]); false; }) - ; -} - -static ALWAYS_INLINE bool marshal_o(struct _marshal_ctx *ctx, lib9p_o_t *val) { - lib9p_o_t masked_val = *val & o_masks[ctx->ctx->version]; - return marshal_1(ctx, (uint8_t *)&masked_val); -} - -static FLATTEN bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_4(ctx, &val->max_msg_size) - || marshal_s(ctx, &val->version) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(100, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_4(ctx, &val->max_msg_size) - || marshal_s(ctx, &val->version) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(101, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->afid) - || marshal_s(ctx, &val->uname) - || marshal_s(ctx, &val->aname) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->n_uname) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(102, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_qid(ctx, &val->aqid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(103, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || marshal_fid(ctx, &val->afid) - || marshal_s(ctx, &val->uname) - || marshal_s(ctx, &val->aname) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->n_uname) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(104, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_qid(ctx, &val->qid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(105, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_s(ctx, &val->ename) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->errno) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(107, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_2(ctx, &val->oldtag) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(108, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rflush *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(109, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || marshal_fid(ctx, &val->newfid) - || marshal_2(ctx, &val->nwname) - || ({ bool err = false; - for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++) - err = marshal_s(ctx, &val->wname[i]); - err; }) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(110, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_2(ctx, &val->nwqid) - || ({ bool err = false; - for (typeof(val->nwqid) i = 0; i < val->nwqid && !err; i++) - err = marshal_qid(ctx, &val->wqid[i]); - err; }) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(111, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || marshal_o(ctx, &val->mode) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(112, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_qid(ctx, &val->qid) - || marshal_4(ctx, &val->iounit) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(113, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || marshal_s(ctx, &val->name) - || marshal_dm(ctx, &val->perm) - || marshal_o(ctx, &val->mode) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(114, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_qid(ctx, &val->qid) - || marshal_4(ctx, &val->iounit) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(115, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || marshal_8(ctx, &val->offset) - || marshal_4(ctx, &val->count) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(116, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_d(ctx, &val->data) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(117, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || marshal_8(ctx, &val->offset) - || marshal_d(ctx, &val->data) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(118, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_4(ctx, &val->count) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(119, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(120, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(121, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(122, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(123, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(124, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - uint32_t _nstat_offset; - uint32_t _stat_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || ({ _nstat_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); }) - || ({ _stat_offset = ctx->net_offset; marshal_stat(ctx, &val->stat); }) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(125, &ctx->net_bytes[_typ_offset]); false; }) - || ({ encode_u16le(ctx->net_offset - _stat_offset, &ctx->net_bytes[_nstat_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - uint32_t _nstat_offset; - uint32_t _stat_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || ({ _nstat_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); }) - || ({ _stat_offset = ctx->net_offset; marshal_stat(ctx, &val->stat); }) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(126, &ctx->net_bytes[_typ_offset]); false; }) - || ({ encode_u16le(ctx->net_offset - _stat_offset, &ctx->net_bytes[_nstat_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(127, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_e -static FLATTEN bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_8(ctx, &val->key) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(150, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_Rsession *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(151, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_4(ctx, &val->fid) - || marshal_2(ctx, &val->nwname) - || ({ bool err = false; - for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++) - err = marshal_s(ctx, &val->wname[i]); - err; }) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(152, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_d(ctx, &val->data) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(153, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_4(ctx, &val->fid) - || marshal_2(ctx, &val->nwname) - || ({ bool err = false; - for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++) - err = marshal_s(ctx, &val->wname[i]); - err; }) - || marshal_d(ctx, &val->data) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(154, &ctx->net_bytes[_typ_offset]); false; }) - ; -} - -static FLATTEN bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_4(ctx, &val->count) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(155, &ctx->net_bytes[_typ_offset]); false; }) - ; -} -#endif /* CONFIG_9P_ENABLE_9P2000_e */ - -/* tables / exports ***********************************************************/ - -#define _MSG(typ) [LIB9P_TYP_##typ] = { \ - .name = #typ, \ - .basesize = sizeof(struct lib9p_msg_##typ), \ - .validate = validate_##typ, \ - .unmarshal = (_unmarshal_fn_t)unmarshal_##typ, \ - .marshal = (_marshal_fn_t)marshal_##typ, \ - } -#define _NONMSG(num) [num] = { \ - .name = #num, \ - } - -struct _table_version _lib9p_versions[LIB9P_VER_NUM] = { - [LIB9P_VER_unknown] = { .msgs = { - _NONMSG(0x00), - _NONMSG(0x01), - _NONMSG(0x02), - _NONMSG(0x03), - _NONMSG(0x04), - _NONMSG(0x05), - _NONMSG(0x06), - _NONMSG(0x07), - _NONMSG(0x08), - _NONMSG(0x09), - _NONMSG(0x0A), - _NONMSG(0x0B), - _NONMSG(0x0C), - _NONMSG(0x0D), - _NONMSG(0x0E), - _NONMSG(0x0F), - _NONMSG(0x10), - _NONMSG(0x11), - _NONMSG(0x12), - _NONMSG(0x13), - _NONMSG(0x14), - _NONMSG(0x15), - _NONMSG(0x16), - _NONMSG(0x17), - _NONMSG(0x18), - _NONMSG(0x19), - _NONMSG(0x1A), - _NONMSG(0x1B), - _NONMSG(0x1C), - _NONMSG(0x1D), - _NONMSG(0x1E), - _NONMSG(0x1F), - _NONMSG(0x20), - _NONMSG(0x21), - _NONMSG(0x22), - _NONMSG(0x23), - _NONMSG(0x24), - _NONMSG(0x25), - _NONMSG(0x26), - _NONMSG(0x27), - _NONMSG(0x28), - _NONMSG(0x29), - _NONMSG(0x2A), - _NONMSG(0x2B), - _NONMSG(0x2C), - _NONMSG(0x2D), - _NONMSG(0x2E), - _NONMSG(0x2F), - _NONMSG(0x30), - _NONMSG(0x31), - _NONMSG(0x32), - _NONMSG(0x33), - _NONMSG(0x34), - _NONMSG(0x35), - _NONMSG(0x36), - _NONMSG(0x37), - _NONMSG(0x38), - _NONMSG(0x39), - _NONMSG(0x3A), - _NONMSG(0x3B), - _NONMSG(0x3C), - _NONMSG(0x3D), - _NONMSG(0x3E), - _NONMSG(0x3F), - _NONMSG(0x40), - _NONMSG(0x41), - _NONMSG(0x42), - _NONMSG(0x43), - _NONMSG(0x44), - _NONMSG(0x45), - _NONMSG(0x46), - _NONMSG(0x47), - _NONMSG(0x48), - _NONMSG(0x49), - _NONMSG(0x4A), - _NONMSG(0x4B), - _NONMSG(0x4C), - _NONMSG(0x4D), - _NONMSG(0x4E), - _NONMSG(0x4F), - _NONMSG(0x50), - _NONMSG(0x51), - _NONMSG(0x52), - _NONMSG(0x53), - _NONMSG(0x54), - _NONMSG(0x55), - _NONMSG(0x56), - _NONMSG(0x57), - _NONMSG(0x58), - _NONMSG(0x59), - _NONMSG(0x5A), - _NONMSG(0x5B), - _NONMSG(0x5C), - _NONMSG(0x5D), - _NONMSG(0x5E), - _NONMSG(0x5F), - _NONMSG(0x60), - _NONMSG(0x61), - _NONMSG(0x62), - _NONMSG(0x63), - _MSG(Tversion), - _MSG(Rversion), - _NONMSG(0x66), - _NONMSG(0x67), - _NONMSG(0x68), - _NONMSG(0x69), - _NONMSG(0x6A), - _MSG(Rerror), - _NONMSG(0x6C), - _NONMSG(0x6D), - _NONMSG(0x6E), - _NONMSG(0x6F), - _NONMSG(0x70), - _NONMSG(0x71), - _NONMSG(0x72), - _NONMSG(0x73), - _NONMSG(0x74), - _NONMSG(0x75), - _NONMSG(0x76), - _NONMSG(0x77), - _NONMSG(0x78), - _NONMSG(0x79), - _NONMSG(0x7A), - _NONMSG(0x7B), - _NONMSG(0x7C), - _NONMSG(0x7D), - _NONMSG(0x7E), - _NONMSG(0x7F), - _NONMSG(0x80), - _NONMSG(0x81), - _NONMSG(0x82), - _NONMSG(0x83), - _NONMSG(0x84), - _NONMSG(0x85), - _NONMSG(0x86), - _NONMSG(0x87), - _NONMSG(0x88), - _NONMSG(0x89), - _NONMSG(0x8A), - _NONMSG(0x8B), - _NONMSG(0x8C), - _NONMSG(0x8D), - _NONMSG(0x8E), - _NONMSG(0x8F), - _NONMSG(0x90), - _NONMSG(0x91), - _NONMSG(0x92), - _NONMSG(0x93), - _NONMSG(0x94), - _NONMSG(0x95), - _NONMSG(0x96), - _NONMSG(0x97), - _NONMSG(0x98), - _NONMSG(0x99), - _NONMSG(0x9A), - _NONMSG(0x9B), - _NONMSG(0x9C), - _NONMSG(0x9D), - _NONMSG(0x9E), - _NONMSG(0x9F), - _NONMSG(0xA0), - _NONMSG(0xA1), - _NONMSG(0xA2), - _NONMSG(0xA3), - _NONMSG(0xA4), - _NONMSG(0xA5), - _NONMSG(0xA6), - _NONMSG(0xA7), - _NONMSG(0xA8), - _NONMSG(0xA9), - _NONMSG(0xAA), - _NONMSG(0xAB), - _NONMSG(0xAC), - _NONMSG(0xAD), - _NONMSG(0xAE), - _NONMSG(0xAF), - _NONMSG(0xB0), - _NONMSG(0xB1), - _NONMSG(0xB2), - _NONMSG(0xB3), - _NONMSG(0xB4), - _NONMSG(0xB5), - _NONMSG(0xB6), - _NONMSG(0xB7), - _NONMSG(0xB8), - _NONMSG(0xB9), - _NONMSG(0xBA), - _NONMSG(0xBB), - _NONMSG(0xBC), - _NONMSG(0xBD), - _NONMSG(0xBE), - _NONMSG(0xBF), - _NONMSG(0xC0), - _NONMSG(0xC1), - _NONMSG(0xC2), - _NONMSG(0xC3), - _NONMSG(0xC4), - _NONMSG(0xC5), - _NONMSG(0xC6), - _NONMSG(0xC7), - _NONMSG(0xC8), - _NONMSG(0xC9), - _NONMSG(0xCA), - _NONMSG(0xCB), - _NONMSG(0xCC), - _NONMSG(0xCD), - _NONMSG(0xCE), - _NONMSG(0xCF), - _NONMSG(0xD0), - _NONMSG(0xD1), - _NONMSG(0xD2), - _NONMSG(0xD3), - _NONMSG(0xD4), - _NONMSG(0xD5), - _NONMSG(0xD6), - _NONMSG(0xD7), - _NONMSG(0xD8), - _NONMSG(0xD9), - _NONMSG(0xDA), - _NONMSG(0xDB), - _NONMSG(0xDC), - _NONMSG(0xDD), - _NONMSG(0xDE), - _NONMSG(0xDF), - _NONMSG(0xE0), - _NONMSG(0xE1), - _NONMSG(0xE2), - _NONMSG(0xE3), - _NONMSG(0xE4), - _NONMSG(0xE5), - _NONMSG(0xE6), - _NONMSG(0xE7), - _NONMSG(0xE8), - _NONMSG(0xE9), - _NONMSG(0xEA), - _NONMSG(0xEB), - _NONMSG(0xEC), - _NONMSG(0xED), - _NONMSG(0xEE), - _NONMSG(0xEF), - _NONMSG(0xF0), - _NONMSG(0xF1), - _NONMSG(0xF2), - _NONMSG(0xF3), - _NONMSG(0xF4), - _NONMSG(0xF5), - _NONMSG(0xF6), - _NONMSG(0xF7), - _NONMSG(0xF8), - _NONMSG(0xF9), - _NONMSG(0xFA), - _NONMSG(0xFB), - _NONMSG(0xFC), - _NONMSG(0xFD), - _NONMSG(0xFE), - _NONMSG(0xFF), - }}, -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = { .msgs = { - _NONMSG(0x00), - _NONMSG(0x01), - _NONMSG(0x02), - _NONMSG(0x03), - _NONMSG(0x04), - _NONMSG(0x05), - _NONMSG(0x06), - _NONMSG(0x07), - _NONMSG(0x08), - _NONMSG(0x09), - _NONMSG(0x0A), - _NONMSG(0x0B), - _NONMSG(0x0C), - _NONMSG(0x0D), - _NONMSG(0x0E), - _NONMSG(0x0F), - _NONMSG(0x10), - _NONMSG(0x11), - _NONMSG(0x12), - _NONMSG(0x13), - _NONMSG(0x14), - _NONMSG(0x15), - _NONMSG(0x16), - _NONMSG(0x17), - _NONMSG(0x18), - _NONMSG(0x19), - _NONMSG(0x1A), - _NONMSG(0x1B), - _NONMSG(0x1C), - _NONMSG(0x1D), - _NONMSG(0x1E), - _NONMSG(0x1F), - _NONMSG(0x20), - _NONMSG(0x21), - _NONMSG(0x22), - _NONMSG(0x23), - _NONMSG(0x24), - _NONMSG(0x25), - _NONMSG(0x26), - _NONMSG(0x27), - _NONMSG(0x28), - _NONMSG(0x29), - _NONMSG(0x2A), - _NONMSG(0x2B), - _NONMSG(0x2C), - _NONMSG(0x2D), - _NONMSG(0x2E), - _NONMSG(0x2F), - _NONMSG(0x30), - _NONMSG(0x31), - _NONMSG(0x32), - _NONMSG(0x33), - _NONMSG(0x34), - _NONMSG(0x35), - _NONMSG(0x36), - _NONMSG(0x37), - _NONMSG(0x38), - _NONMSG(0x39), - _NONMSG(0x3A), - _NONMSG(0x3B), - _NONMSG(0x3C), - _NONMSG(0x3D), - _NONMSG(0x3E), - _NONMSG(0x3F), - _NONMSG(0x40), - _NONMSG(0x41), - _NONMSG(0x42), - _NONMSG(0x43), - _NONMSG(0x44), - _NONMSG(0x45), - _NONMSG(0x46), - _NONMSG(0x47), - _NONMSG(0x48), - _NONMSG(0x49), - _NONMSG(0x4A), - _NONMSG(0x4B), - _NONMSG(0x4C), - _NONMSG(0x4D), - _NONMSG(0x4E), - _NONMSG(0x4F), - _NONMSG(0x50), - _NONMSG(0x51), - _NONMSG(0x52), - _NONMSG(0x53), - _NONMSG(0x54), - _NONMSG(0x55), - _NONMSG(0x56), - _NONMSG(0x57), - _NONMSG(0x58), - _NONMSG(0x59), - _NONMSG(0x5A), - _NONMSG(0x5B), - _NONMSG(0x5C), - _NONMSG(0x5D), - _NONMSG(0x5E), - _NONMSG(0x5F), - _NONMSG(0x60), - _NONMSG(0x61), - _NONMSG(0x62), - _NONMSG(0x63), - _MSG(Tversion), - _MSG(Rversion), - _MSG(Tauth), - _MSG(Rauth), - _MSG(Tattach), - _MSG(Rattach), - _NONMSG(0x6A), - _MSG(Rerror), - _MSG(Tflush), - _MSG(Rflush), - _MSG(Twalk), - _MSG(Rwalk), - _MSG(Topen), - _MSG(Ropen), - _MSG(Tcreate), - _MSG(Rcreate), - _MSG(Tread), - _MSG(Rread), - _MSG(Twrite), - _MSG(Rwrite), - _MSG(Tclunk), - _MSG(Rclunk), - _MSG(Tremove), - _MSG(Rremove), - _MSG(Tstat), - _MSG(Rstat), - _MSG(Twstat), - _MSG(Rwstat), - _NONMSG(0x80), - _NONMSG(0x81), - _NONMSG(0x82), - _NONMSG(0x83), - _NONMSG(0x84), - _NONMSG(0x85), - _NONMSG(0x86), - _NONMSG(0x87), - _NONMSG(0x88), - _NONMSG(0x89), - _NONMSG(0x8A), - _NONMSG(0x8B), - _NONMSG(0x8C), - _NONMSG(0x8D), - _NONMSG(0x8E), - _NONMSG(0x8F), - _NONMSG(0x90), - _NONMSG(0x91), - _NONMSG(0x92), - _NONMSG(0x93), - _NONMSG(0x94), - _NONMSG(0x95), - _NONMSG(0x96), - _NONMSG(0x97), - _NONMSG(0x98), - _NONMSG(0x99), - _NONMSG(0x9A), - _NONMSG(0x9B), - _NONMSG(0x9C), - _NONMSG(0x9D), - _NONMSG(0x9E), - _NONMSG(0x9F), - _NONMSG(0xA0), - _NONMSG(0xA1), - _NONMSG(0xA2), - _NONMSG(0xA3), - _NONMSG(0xA4), - _NONMSG(0xA5), - _NONMSG(0xA6), - _NONMSG(0xA7), - _NONMSG(0xA8), - _NONMSG(0xA9), - _NONMSG(0xAA), - _NONMSG(0xAB), - _NONMSG(0xAC), - _NONMSG(0xAD), - _NONMSG(0xAE), - _NONMSG(0xAF), - _NONMSG(0xB0), - _NONMSG(0xB1), - _NONMSG(0xB2), - _NONMSG(0xB3), - _NONMSG(0xB4), - _NONMSG(0xB5), - _NONMSG(0xB6), - _NONMSG(0xB7), - _NONMSG(0xB8), - _NONMSG(0xB9), - _NONMSG(0xBA), - _NONMSG(0xBB), - _NONMSG(0xBC), - _NONMSG(0xBD), - _NONMSG(0xBE), - _NONMSG(0xBF), - _NONMSG(0xC0), - _NONMSG(0xC1), - _NONMSG(0xC2), - _NONMSG(0xC3), - _NONMSG(0xC4), - _NONMSG(0xC5), - _NONMSG(0xC6), - _NONMSG(0xC7), - _NONMSG(0xC8), - _NONMSG(0xC9), - _NONMSG(0xCA), - _NONMSG(0xCB), - _NONMSG(0xCC), - _NONMSG(0xCD), - _NONMSG(0xCE), - _NONMSG(0xCF), - _NONMSG(0xD0), - _NONMSG(0xD1), - _NONMSG(0xD2), - _NONMSG(0xD3), - _NONMSG(0xD4), - _NONMSG(0xD5), - _NONMSG(0xD6), - _NONMSG(0xD7), - _NONMSG(0xD8), - _NONMSG(0xD9), - _NONMSG(0xDA), - _NONMSG(0xDB), - _NONMSG(0xDC), - _NONMSG(0xDD), - _NONMSG(0xDE), - _NONMSG(0xDF), - _NONMSG(0xE0), - _NONMSG(0xE1), - _NONMSG(0xE2), - _NONMSG(0xE3), - _NONMSG(0xE4), - _NONMSG(0xE5), - _NONMSG(0xE6), - _NONMSG(0xE7), - _NONMSG(0xE8), - _NONMSG(0xE9), - _NONMSG(0xEA), - _NONMSG(0xEB), - _NONMSG(0xEC), - _NONMSG(0xED), - _NONMSG(0xEE), - _NONMSG(0xEF), - _NONMSG(0xF0), - _NONMSG(0xF1), - _NONMSG(0xF2), - _NONMSG(0xF3), - _NONMSG(0xF4), - _NONMSG(0xF5), - _NONMSG(0xF6), - _NONMSG(0xF7), - _NONMSG(0xF8), - _NONMSG(0xF9), - _NONMSG(0xFA), - _NONMSG(0xFB), - _NONMSG(0xFC), - _NONMSG(0xFD), - _NONMSG(0xFE), - _NONMSG(0xFF), - }}, -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = { .msgs = { - _NONMSG(0x00), - _NONMSG(0x01), - _NONMSG(0x02), - _NONMSG(0x03), - _NONMSG(0x04), - _NONMSG(0x05), - _NONMSG(0x06), - _NONMSG(0x07), - _NONMSG(0x08), - _NONMSG(0x09), - _NONMSG(0x0A), - _NONMSG(0x0B), - _NONMSG(0x0C), - _NONMSG(0x0D), - _NONMSG(0x0E), - _NONMSG(0x0F), - _NONMSG(0x10), - _NONMSG(0x11), - _NONMSG(0x12), - _NONMSG(0x13), - _NONMSG(0x14), - _NONMSG(0x15), - _NONMSG(0x16), - _NONMSG(0x17), - _NONMSG(0x18), - _NONMSG(0x19), - _NONMSG(0x1A), - _NONMSG(0x1B), - _NONMSG(0x1C), - _NONMSG(0x1D), - _NONMSG(0x1E), - _NONMSG(0x1F), - _NONMSG(0x20), - _NONMSG(0x21), - _NONMSG(0x22), - _NONMSG(0x23), - _NONMSG(0x24), - _NONMSG(0x25), - _NONMSG(0x26), - _NONMSG(0x27), - _NONMSG(0x28), - _NONMSG(0x29), - _NONMSG(0x2A), - _NONMSG(0x2B), - _NONMSG(0x2C), - _NONMSG(0x2D), - _NONMSG(0x2E), - _NONMSG(0x2F), - _NONMSG(0x30), - _NONMSG(0x31), - _NONMSG(0x32), - _NONMSG(0x33), - _NONMSG(0x34), - _NONMSG(0x35), - _NONMSG(0x36), - _NONMSG(0x37), - _NONMSG(0x38), - _NONMSG(0x39), - _NONMSG(0x3A), - _NONMSG(0x3B), - _NONMSG(0x3C), - _NONMSG(0x3D), - _NONMSG(0x3E), - _NONMSG(0x3F), - _NONMSG(0x40), - _NONMSG(0x41), - _NONMSG(0x42), - _NONMSG(0x43), - _NONMSG(0x44), - _NONMSG(0x45), - _NONMSG(0x46), - _NONMSG(0x47), - _NONMSG(0x48), - _NONMSG(0x49), - _NONMSG(0x4A), - _NONMSG(0x4B), - _NONMSG(0x4C), - _NONMSG(0x4D), - _NONMSG(0x4E), - _NONMSG(0x4F), - _NONMSG(0x50), - _NONMSG(0x51), - _NONMSG(0x52), - _NONMSG(0x53), - _NONMSG(0x54), - _NONMSG(0x55), - _NONMSG(0x56), - _NONMSG(0x57), - _NONMSG(0x58), - _NONMSG(0x59), - _NONMSG(0x5A), - _NONMSG(0x5B), - _NONMSG(0x5C), - _NONMSG(0x5D), - _NONMSG(0x5E), - _NONMSG(0x5F), - _NONMSG(0x60), - _NONMSG(0x61), - _NONMSG(0x62), - _NONMSG(0x63), - _MSG(Tversion), - _MSG(Rversion), - _MSG(Tauth), - _MSG(Rauth), - _MSG(Tattach), - _MSG(Rattach), - _NONMSG(0x6A), - _MSG(Rerror), - _MSG(Tflush), - _MSG(Rflush), - _MSG(Twalk), - _MSG(Rwalk), - _MSG(Topen), - _MSG(Ropen), - _MSG(Tcreate), - _MSG(Rcreate), - _MSG(Tread), - _MSG(Rread), - _MSG(Twrite), - _MSG(Rwrite), - _MSG(Tclunk), - _MSG(Rclunk), - _MSG(Tremove), - _MSG(Rremove), - _MSG(Tstat), - _MSG(Rstat), - _MSG(Twstat), - _MSG(Rwstat), - _NONMSG(0x80), - _NONMSG(0x81), - _NONMSG(0x82), - _NONMSG(0x83), - _NONMSG(0x84), - _NONMSG(0x85), - _NONMSG(0x86), - _NONMSG(0x87), - _NONMSG(0x88), - _NONMSG(0x89), - _NONMSG(0x8A), - _NONMSG(0x8B), - _NONMSG(0x8C), - _NONMSG(0x8D), - _NONMSG(0x8E), - _NONMSG(0x8F), - _NONMSG(0x90), - _NONMSG(0x91), - _NONMSG(0x92), - _NONMSG(0x93), - _NONMSG(0x94), - _NONMSG(0x95), - _MSG(Tsession), - _MSG(Rsession), - _MSG(Tsread), - _MSG(Rsread), - _MSG(Tswrite), - _MSG(Rswrite), - _NONMSG(0x9C), - _NONMSG(0x9D), - _NONMSG(0x9E), - _NONMSG(0x9F), - _NONMSG(0xA0), - _NONMSG(0xA1), - _NONMSG(0xA2), - _NONMSG(0xA3), - _NONMSG(0xA4), - _NONMSG(0xA5), - _NONMSG(0xA6), - _NONMSG(0xA7), - _NONMSG(0xA8), - _NONMSG(0xA9), - _NONMSG(0xAA), - _NONMSG(0xAB), - _NONMSG(0xAC), - _NONMSG(0xAD), - _NONMSG(0xAE), - _NONMSG(0xAF), - _NONMSG(0xB0), - _NONMSG(0xB1), - _NONMSG(0xB2), - _NONMSG(0xB3), - _NONMSG(0xB4), - _NONMSG(0xB5), - _NONMSG(0xB6), - _NONMSG(0xB7), - _NONMSG(0xB8), - _NONMSG(0xB9), - _NONMSG(0xBA), - _NONMSG(0xBB), - _NONMSG(0xBC), - _NONMSG(0xBD), - _NONMSG(0xBE), - _NONMSG(0xBF), - _NONMSG(0xC0), - _NONMSG(0xC1), - _NONMSG(0xC2), - _NONMSG(0xC3), - _NONMSG(0xC4), - _NONMSG(0xC5), - _NONMSG(0xC6), - _NONMSG(0xC7), - _NONMSG(0xC8), - _NONMSG(0xC9), - _NONMSG(0xCA), - _NONMSG(0xCB), - _NONMSG(0xCC), - _NONMSG(0xCD), - _NONMSG(0xCE), - _NONMSG(0xCF), - _NONMSG(0xD0), - _NONMSG(0xD1), - _NONMSG(0xD2), - _NONMSG(0xD3), - _NONMSG(0xD4), - _NONMSG(0xD5), - _NONMSG(0xD6), - _NONMSG(0xD7), - _NONMSG(0xD8), - _NONMSG(0xD9), - _NONMSG(0xDA), - _NONMSG(0xDB), - _NONMSG(0xDC), - _NONMSG(0xDD), - _NONMSG(0xDE), - _NONMSG(0xDF), - _NONMSG(0xE0), - _NONMSG(0xE1), - _NONMSG(0xE2), - _NONMSG(0xE3), - _NONMSG(0xE4), - _NONMSG(0xE5), - _NONMSG(0xE6), - _NONMSG(0xE7), - _NONMSG(0xE8), - _NONMSG(0xE9), - _NONMSG(0xEA), - _NONMSG(0xEB), - _NONMSG(0xEC), - _NONMSG(0xED), - _NONMSG(0xEE), - _NONMSG(0xEF), - _NONMSG(0xF0), - _NONMSG(0xF1), - _NONMSG(0xF2), - _NONMSG(0xF3), - _NONMSG(0xF4), - _NONMSG(0xF5), - _NONMSG(0xF6), - _NONMSG(0xF7), - _NONMSG(0xF8), - _NONMSG(0xF9), - _NONMSG(0xFA), - _NONMSG(0xFB), - _NONMSG(0xFC), - _NONMSG(0xFD), - _NONMSG(0xFE), - _NONMSG(0xFF), - }}, -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = { .msgs = { - _NONMSG(0x00), - _NONMSG(0x01), - _NONMSG(0x02), - _NONMSG(0x03), - _NONMSG(0x04), - _NONMSG(0x05), - _NONMSG(0x06), - _NONMSG(0x07), - _NONMSG(0x08), - _NONMSG(0x09), - _NONMSG(0x0A), - _NONMSG(0x0B), - _NONMSG(0x0C), - _NONMSG(0x0D), - _NONMSG(0x0E), - _NONMSG(0x0F), - _NONMSG(0x10), - _NONMSG(0x11), - _NONMSG(0x12), - _NONMSG(0x13), - _NONMSG(0x14), - _NONMSG(0x15), - _NONMSG(0x16), - _NONMSG(0x17), - _NONMSG(0x18), - _NONMSG(0x19), - _NONMSG(0x1A), - _NONMSG(0x1B), - _NONMSG(0x1C), - _NONMSG(0x1D), - _NONMSG(0x1E), - _NONMSG(0x1F), - _NONMSG(0x20), - _NONMSG(0x21), - _NONMSG(0x22), - _NONMSG(0x23), - _NONMSG(0x24), - _NONMSG(0x25), - _NONMSG(0x26), - _NONMSG(0x27), - _NONMSG(0x28), - _NONMSG(0x29), - _NONMSG(0x2A), - _NONMSG(0x2B), - _NONMSG(0x2C), - _NONMSG(0x2D), - _NONMSG(0x2E), - _NONMSG(0x2F), - _NONMSG(0x30), - _NONMSG(0x31), - _NONMSG(0x32), - _NONMSG(0x33), - _NONMSG(0x34), - _NONMSG(0x35), - _NONMSG(0x36), - _NONMSG(0x37), - _NONMSG(0x38), - _NONMSG(0x39), - _NONMSG(0x3A), - _NONMSG(0x3B), - _NONMSG(0x3C), - _NONMSG(0x3D), - _NONMSG(0x3E), - _NONMSG(0x3F), - _NONMSG(0x40), - _NONMSG(0x41), - _NONMSG(0x42), - _NONMSG(0x43), - _NONMSG(0x44), - _NONMSG(0x45), - _NONMSG(0x46), - _NONMSG(0x47), - _NONMSG(0x48), - _NONMSG(0x49), - _NONMSG(0x4A), - _NONMSG(0x4B), - _NONMSG(0x4C), - _NONMSG(0x4D), - _NONMSG(0x4E), - _NONMSG(0x4F), - _NONMSG(0x50), - _NONMSG(0x51), - _NONMSG(0x52), - _NONMSG(0x53), - _NONMSG(0x54), - _NONMSG(0x55), - _NONMSG(0x56), - _NONMSG(0x57), - _NONMSG(0x58), - _NONMSG(0x59), - _NONMSG(0x5A), - _NONMSG(0x5B), - _NONMSG(0x5C), - _NONMSG(0x5D), - _NONMSG(0x5E), - _NONMSG(0x5F), - _NONMSG(0x60), - _NONMSG(0x61), - _NONMSG(0x62), - _NONMSG(0x63), - _MSG(Tversion), - _MSG(Rversion), - _MSG(Tauth), - _MSG(Rauth), - _MSG(Tattach), - _MSG(Rattach), - _NONMSG(0x6A), - _MSG(Rerror), - _MSG(Tflush), - _MSG(Rflush), - _MSG(Twalk), - _MSG(Rwalk), - _MSG(Topen), - _MSG(Ropen), - _MSG(Tcreate), - _MSG(Rcreate), - _MSG(Tread), - _MSG(Rread), - _MSG(Twrite), - _MSG(Rwrite), - _MSG(Tclunk), - _MSG(Rclunk), - _MSG(Tremove), - _MSG(Rremove), - _MSG(Tstat), - _MSG(Rstat), - _MSG(Twstat), - _MSG(Rwstat), - _NONMSG(0x80), - _NONMSG(0x81), - _NONMSG(0x82), - _NONMSG(0x83), - _NONMSG(0x84), - _NONMSG(0x85), - _NONMSG(0x86), - _NONMSG(0x87), - _NONMSG(0x88), - _NONMSG(0x89), - _NONMSG(0x8A), - _NONMSG(0x8B), - _NONMSG(0x8C), - _NONMSG(0x8D), - _NONMSG(0x8E), - _NONMSG(0x8F), - _NONMSG(0x90), - _NONMSG(0x91), - _NONMSG(0x92), - _NONMSG(0x93), - _NONMSG(0x94), - _NONMSG(0x95), - _NONMSG(0x96), - _NONMSG(0x97), - _NONMSG(0x98), - _NONMSG(0x99), - _NONMSG(0x9A), - _NONMSG(0x9B), - _NONMSG(0x9C), - _NONMSG(0x9D), - _NONMSG(0x9E), - _NONMSG(0x9F), - _NONMSG(0xA0), - _NONMSG(0xA1), - _NONMSG(0xA2), - _NONMSG(0xA3), - _NONMSG(0xA4), - _NONMSG(0xA5), - _NONMSG(0xA6), - _NONMSG(0xA7), - _NONMSG(0xA8), - _NONMSG(0xA9), - _NONMSG(0xAA), - _NONMSG(0xAB), - _NONMSG(0xAC), - _NONMSG(0xAD), - _NONMSG(0xAE), - _NONMSG(0xAF), - _NONMSG(0xB0), - _NONMSG(0xB1), - _NONMSG(0xB2), - _NONMSG(0xB3), - _NONMSG(0xB4), - _NONMSG(0xB5), - _NONMSG(0xB6), - _NONMSG(0xB7), - _NONMSG(0xB8), - _NONMSG(0xB9), - _NONMSG(0xBA), - _NONMSG(0xBB), - _NONMSG(0xBC), - _NONMSG(0xBD), - _NONMSG(0xBE), - _NONMSG(0xBF), - _NONMSG(0xC0), - _NONMSG(0xC1), - _NONMSG(0xC2), - _NONMSG(0xC3), - _NONMSG(0xC4), - _NONMSG(0xC5), - _NONMSG(0xC6), - _NONMSG(0xC7), - _NONMSG(0xC8), - _NONMSG(0xC9), - _NONMSG(0xCA), - _NONMSG(0xCB), - _NONMSG(0xCC), - _NONMSG(0xCD), - _NONMSG(0xCE), - _NONMSG(0xCF), - _NONMSG(0xD0), - _NONMSG(0xD1), - _NONMSG(0xD2), - _NONMSG(0xD3), - _NONMSG(0xD4), - _NONMSG(0xD5), - _NONMSG(0xD6), - _NONMSG(0xD7), - _NONMSG(0xD8), - _NONMSG(0xD9), - _NONMSG(0xDA), - _NONMSG(0xDB), - _NONMSG(0xDC), - _NONMSG(0xDD), - _NONMSG(0xDE), - _NONMSG(0xDF), - _NONMSG(0xE0), - _NONMSG(0xE1), - _NONMSG(0xE2), - _NONMSG(0xE3), - _NONMSG(0xE4), - _NONMSG(0xE5), - _NONMSG(0xE6), - _NONMSG(0xE7), - _NONMSG(0xE8), - _NONMSG(0xE9), - _NONMSG(0xEA), - _NONMSG(0xEB), - _NONMSG(0xEC), - _NONMSG(0xED), - _NONMSG(0xEE), - _NONMSG(0xEF), - _NONMSG(0xF0), - _NONMSG(0xF1), - _NONMSG(0xF2), - _NONMSG(0xF3), - _NONMSG(0xF4), - _NONMSG(0xF5), - _NONMSG(0xF6), - _NONMSG(0xF7), - _NONMSG(0xF8), - _NONMSG(0xF9), - _NONMSG(0xFA), - _NONMSG(0xFB), - _NONMSG(0xFC), - _NONMSG(0xFD), - _NONMSG(0xFE), - _NONMSG(0xFF), - }}, -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; - -FLATTEN bool _lib9p_validate_stat(struct _validate_ctx *ctx) { - return validate_stat(ctx); -} -FLATTEN void _lib9p_unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) { - unmarshal_stat(ctx, out); -} -FLATTEN bool _lib9p_marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) { - return marshal_stat(ctx, val); -} |