diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-01-19 15:53:46 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-01-19 15:53:46 -0700 |
commit | 104ea21b497171f5a1c4ba80d82337da3f7c2632 (patch) | |
tree | 9b5a167833b9caa4f8f829c9bc7a3711a1cd837a /lib9p/9p.generated.c | |
parent | a35db3be439c9a27f0763036cf3d4992ccf893eb (diff) | |
parent | 0ab9da9bc3c6cdaef00b7202ba03eff917b44c95 (diff) |
Merge branch 'lukeshu/9p-tidy'
Diffstat (limited to 'lib9p/9p.generated.c')
-rw-r--r-- | lib9p/9p.generated.c | 1205 |
1 files changed, 611 insertions, 594 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c index d809588..8d29a6d 100644 --- a/lib9p/9p.generated.c +++ b/lib9p/9p.generated.c @@ -12,14 +12,6 @@ #include "internal.h" /* utilities ******************************************************************/ - -/** - * is_ver(ctx, ver) is essentially `(ctx->ctx->version == LIB9P_VER_##ver)`, - * but compiles correctly (to `false`) even if `LIB9P_VER_##ver` isn't defined - * (because `!CONFIG_9P_ENABLE_##ver`). This is useful when `||`ing - * several version checks together. - */ -#define is_ver(ctx, ver) _is_ver_##ver(ctx->ctx->version) #if CONFIG_9P_ENABLE_9P2000 #define _is_ver_9P2000(v) (v == LIB9P_VER_9P2000) #else @@ -41,9 +33,17 @@ #define _is_ver_9P2000_u(v) false #endif +/** + * is_ver(ctx, ver) is essentially `(ctx->ctx->version == LIB9P_VER_##ver)`, + * but compiles correctly (to `false`) even if `LIB9P_VER_##ver` isn't defined + * (because `!CONFIG_9P_ENABLE_##ver`). This is useful when `||`ing + * several version checks together. + */ +#define is_ver(ctx, ver) _is_ver_##ver(ctx->ctx->version) + /* strings ********************************************************************/ -static const char *version_strs[LIB9P_VER_NUM] = { +const char *_lib9p_table_ver_name[LIB9P_VER_NUM] = { [LIB9P_VER_unknown] = "unknown", #if CONFIG_9P_ENABLE_9P2000 [LIB9P_VER_9P2000] = "9P2000", @@ -59,13 +59,172 @@ static const char *version_strs[LIB9P_VER_NUM] = { #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; -const char *lib9p_version_str(enum lib9p_version ver) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wtype-limits" - assert(0 <= ver && ver < LIB9P_VER_NUM); -#pragma GCC diagnostic pop - return version_strs[ver]; -} +#define _MSG_NAME(typ) [LIB9P_TYP_##typ] = #typ +const char * _lib9p_table_msg_name[LIB9P_VER_NUM][0x100] = { + [LIB9P_VER_unknown] = { + _MSG_NAME(Tversion), + _MSG_NAME(Rversion), + _MSG_NAME(Rerror), + }, +#if CONFIG_9P_ENABLE_9P2000 + [LIB9P_VER_9P2000] = { + _MSG_NAME(Tversion), + _MSG_NAME(Rversion), + _MSG_NAME(Tauth), + _MSG_NAME(Rauth), + _MSG_NAME(Tattach), + _MSG_NAME(Rattach), + _MSG_NAME(Rerror), + _MSG_NAME(Tflush), + _MSG_NAME(Rflush), + _MSG_NAME(Twalk), + _MSG_NAME(Rwalk), + _MSG_NAME(Topen), + _MSG_NAME(Ropen), + _MSG_NAME(Tcreate), + _MSG_NAME(Rcreate), + _MSG_NAME(Tread), + _MSG_NAME(Rread), + _MSG_NAME(Twrite), + _MSG_NAME(Rwrite), + _MSG_NAME(Tclunk), + _MSG_NAME(Rclunk), + _MSG_NAME(Tremove), + _MSG_NAME(Rremove), + _MSG_NAME(Tstat), + _MSG_NAME(Rstat), + _MSG_NAME(Twstat), + _MSG_NAME(Rwstat), + }, +#endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = { + _MSG_NAME(Rlerror), + _MSG_NAME(Tstatfs), + _MSG_NAME(Rstatfs), + _MSG_NAME(Tlopen), + _MSG_NAME(Rlopen), + _MSG_NAME(Tlcreate), + _MSG_NAME(Rlcreate), + _MSG_NAME(Tsymlink), + _MSG_NAME(Rsymlink), + _MSG_NAME(Tmknod), + _MSG_NAME(Rmknod), + _MSG_NAME(Trename), + _MSG_NAME(Rrename), + _MSG_NAME(Treadlink), + _MSG_NAME(Rreadlink), + _MSG_NAME(Tgetattr), + _MSG_NAME(Rgetattr), + _MSG_NAME(Tsetattr), + _MSG_NAME(Rsetattr), + _MSG_NAME(Txattrwalk), + _MSG_NAME(Rxattrwalk), + _MSG_NAME(Txattrcreate), + _MSG_NAME(Rxattrcreate), + _MSG_NAME(Treaddir), + _MSG_NAME(Rreaddir), + _MSG_NAME(Tfsync), + _MSG_NAME(Rfsync), + _MSG_NAME(Tlock), + _MSG_NAME(Rlock), + _MSG_NAME(Tgetlock), + _MSG_NAME(Rgetlock), + _MSG_NAME(Tlink), + _MSG_NAME(Rlink), + _MSG_NAME(Tmkdir), + _MSG_NAME(Trenameat), + _MSG_NAME(Rrenameat), + _MSG_NAME(Tunlinkat), + _MSG_NAME(Runlinkat), + _MSG_NAME(Tversion), + _MSG_NAME(Rversion), + _MSG_NAME(Tauth), + _MSG_NAME(Rauth), + _MSG_NAME(Tattach), + _MSG_NAME(Rattach), + _MSG_NAME(Tflush), + _MSG_NAME(Rflush), + _MSG_NAME(Twalk), + _MSG_NAME(Rwalk), + _MSG_NAME(Tread), + _MSG_NAME(Rread), + _MSG_NAME(Twrite), + _MSG_NAME(Rwrite), + _MSG_NAME(Tclunk), + _MSG_NAME(Tremove), + _MSG_NAME(Rremove), + }, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e + [LIB9P_VER_9P2000_e] = { + _MSG_NAME(Tversion), + _MSG_NAME(Rversion), + _MSG_NAME(Tauth), + _MSG_NAME(Rauth), + _MSG_NAME(Tattach), + _MSG_NAME(Rattach), + _MSG_NAME(Rerror), + _MSG_NAME(Tflush), + _MSG_NAME(Rflush), + _MSG_NAME(Twalk), + _MSG_NAME(Rwalk), + _MSG_NAME(Topen), + _MSG_NAME(Ropen), + _MSG_NAME(Tcreate), + _MSG_NAME(Rcreate), + _MSG_NAME(Tread), + _MSG_NAME(Rread), + _MSG_NAME(Twrite), + _MSG_NAME(Rwrite), + _MSG_NAME(Tclunk), + _MSG_NAME(Rclunk), + _MSG_NAME(Tremove), + _MSG_NAME(Rremove), + _MSG_NAME(Tstat), + _MSG_NAME(Rstat), + _MSG_NAME(Twstat), + _MSG_NAME(Rwstat), + _MSG_NAME(Tsession), + _MSG_NAME(Rsession), + _MSG_NAME(Tsread), + _MSG_NAME(Rsread), + _MSG_NAME(Tswrite), + _MSG_NAME(Rswrite), + }, +#endif /* CONFIG_9P_ENABLE_9P2000_e */ +#if CONFIG_9P_ENABLE_9P2000_u + [LIB9P_VER_9P2000_u] = { + _MSG_NAME(Tversion), + _MSG_NAME(Rversion), + _MSG_NAME(Tauth), + _MSG_NAME(Rauth), + _MSG_NAME(Tattach), + _MSG_NAME(Rattach), + _MSG_NAME(Rerror), + _MSG_NAME(Tflush), + _MSG_NAME(Rflush), + _MSG_NAME(Twalk), + _MSG_NAME(Rwalk), + _MSG_NAME(Topen), + _MSG_NAME(Ropen), + _MSG_NAME(Tcreate), + _MSG_NAME(Rcreate), + _MSG_NAME(Tread), + _MSG_NAME(Rread), + _MSG_NAME(Twrite), + _MSG_NAME(Rwrite), + _MSG_NAME(Tclunk), + _MSG_NAME(Rclunk), + _MSG_NAME(Tremove), + _MSG_NAME(Rremove), + _MSG_NAME(Tstat), + _MSG_NAME(Rstat), + _MSG_NAME(Twstat), + _MSG_NAME(Rwstat), + }, +#endif /* CONFIG_9P_ENABLE_9P2000_u */ +}; /* bitmasks *******************************************************************/ @@ -212,7 +371,7 @@ LM_ALWAYS_INLINE static 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]); + uint32_t len = uint32le_decode(&ctx->net_bytes[base_offset]); return _validate_size_net(ctx, len) || _validate_size_host(ctx, len); } @@ -222,8 +381,8 @@ LM_ALWAYS_INLINE static 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)) + uint16_t len = uint16le_decode(&ctx->net_bytes[base_offset]); + if (_validate_size_net(ctx, len) || _validate_size_host(ctx, ((size_t)len))) 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"); @@ -236,7 +395,7 @@ LM_ALWAYS_INLINE static 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]); + lib9p_dm_t val = uint32le_decode(&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; @@ -248,7 +407,7 @@ LM_ALWAYS_INLINE static 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]); + lib9p_qt_t val = 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; @@ -266,7 +425,7 @@ LM_ALWAYS_INLINE static 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]); + lib9p_o_t val = 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; @@ -278,7 +437,7 @@ LM_ALWAYS_INLINE static bool validate_getattr(struct _validate_ctx *ctx) { if (validate_8(ctx)) return true; lib9p_getattr_t mask = getattr_masks[ctx->ctx->version]; - lib9p_getattr_t val = decode_u64le(&ctx->net_bytes[ctx->net_offset-8]); + lib9p_getattr_t val = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]); if (val & ~mask) return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in getattr bitfield: %#08"PRIx64, val & ~mask); return false; @@ -288,7 +447,7 @@ LM_ALWAYS_INLINE static bool validate_setattr(struct _validate_ctx *ctx) { if (validate_4(ctx)) return true; lib9p_setattr_t mask = setattr_masks[ctx->ctx->version]; - lib9p_setattr_t val = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); + lib9p_setattr_t val = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); if (val & ~mask) return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in setattr bitfield: %#04"PRIx32, val & ~mask); return false; @@ -302,7 +461,7 @@ LM_ALWAYS_INLINE static bool validate_lock_flags(struct _validate_ctx *ctx) { if (validate_4(ctx)) return true; lib9p_lock_flags_t mask = lock_flags_masks[ctx->ctx->version]; - lib9p_lock_flags_t val = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); + lib9p_lock_flags_t val = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); if (val & ~mask) return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in lock_flags bitfield: %#04"PRIx32, val & ~mask); return false; @@ -313,14 +472,23 @@ LM_ALWAYS_INLINE static bool validate_lock_status(struct _validate_ctx *ctx) { } #endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e +LM_ALWAYS_INLINE static bool validate_d_e(struct _validate_ctx *ctx) { + return false + || validate_4(ctx) + || _validate_list(ctx, uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]), validate_1, sizeof(uint8_t)) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -335,8 +503,8 @@ LM_FLATTEN static bool validate_Rflush(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -350,8 +518,8 @@ LM_FLATTEN static bool validate_Rwrite(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -368,8 +536,8 @@ LM_FLATTEN static bool validate_Rclunk(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -385,8 +553,8 @@ LM_FLATTEN static bool validate_Rremove(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -402,8 +570,8 @@ LM_FLATTEN static bool validate_Rwstat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -419,8 +587,8 @@ LM_FLATTEN static bool validate_Rlerror(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -435,8 +603,8 @@ LM_FLATTEN static bool validate_Rstatfs(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_4(ctx) || validate_4(ctx) @@ -459,8 +627,8 @@ LM_FLATTEN static bool validate_Rrename(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -474,8 +642,8 @@ LM_FLATTEN static bool validate_Rsetattr(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -489,8 +657,8 @@ LM_FLATTEN static bool validate_Rxattrwalk(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -505,8 +673,8 @@ LM_FLATTEN static bool validate_Rxattrcreate(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -520,11 +688,11 @@ LM_FLATTEN static bool validate_Rreaddir(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_4(ctx) - || _validate_list(ctx, decode_u32le(&ctx->net_bytes[ctx->net_offset-4]), validate_1, sizeof(uint8_t)) + || _validate_list(ctx, uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]), validate_1, sizeof(uint8_t)) || ({ 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); }) || ({ uint8_t exp = 41; (((uint8_t)typ) != exp) && @@ -537,8 +705,8 @@ LM_FLATTEN static bool validate_Rfsync(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -552,8 +720,8 @@ LM_FLATTEN static bool validate_Rlink(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -567,8 +735,8 @@ LM_FLATTEN static bool validate_Rrenameat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -582,8 +750,8 @@ LM_FLATTEN static bool validate_Runlinkat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -599,8 +767,8 @@ LM_FLATTEN static bool validate_Tsession(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -615,8 +783,8 @@ LM_FLATTEN static bool validate_Rsession(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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); }) @@ -630,8 +798,8 @@ LM_FLATTEN static bool validate_Rswrite(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -650,12 +818,12 @@ LM_FLATTEN static bool validate_Tread(struct _validate_ctx *ctx) { uint32_t count; 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) - || (validate_8(ctx) || ({ offset = decode_u64le(&ctx->net_bytes[ctx->net_offset-8]); false; })) - || (validate_4(ctx) || ({ count = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_8(ctx) || ({ offset = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]); false; })) + || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) || ({ 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); }) || ({ uint8_t exp = 116; (((uint8_t)typ) != exp) && @@ -672,8 +840,8 @@ LM_FLATTEN static bool validate_Tclunk(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -688,8 +856,8 @@ LM_FLATTEN static bool validate_Tremove(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -706,8 +874,8 @@ LM_FLATTEN static bool validate_Tstat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -724,8 +892,8 @@ LM_FLATTEN static bool validate_Tstatfs(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -740,8 +908,8 @@ LM_FLATTEN static bool validate_Tlopen(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_4(ctx) @@ -757,8 +925,8 @@ LM_FLATTEN static bool validate_Treadlink(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -773,8 +941,8 @@ LM_FLATTEN static bool validate_Treaddir(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_8(ctx) @@ -791,8 +959,8 @@ LM_FLATTEN static bool validate_Tfsync(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_4(ctx) @@ -810,8 +978,8 @@ LM_FLATTEN static bool validate_Rread(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -827,11 +995,11 @@ LM_FLATTEN static bool validate_Twrite(struct _validate_ctx *ctx) { uint64_t offset; 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) - || (validate_8(ctx) || ({ offset = decode_u64le(&ctx->net_bytes[ctx->net_offset-8]); false; })) + || (validate_8(ctx) || ({ offset = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]); false; })) || 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); }) @@ -842,33 +1010,13 @@ LM_FLATTEN static bool validate_Twrite(struct _validate_ctx *ctx) { ; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_e -LM_FLATTEN static 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); }) - || ({ uint8_t exp = 153; (((uint8_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) - ; -} - -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_4(ctx) || validate_s(ctx) @@ -884,8 +1032,8 @@ LM_FLATTEN static bool validate_Rversion(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_4(ctx) || validate_s(ctx) @@ -903,8 +1051,8 @@ LM_FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_s(ctx) #if CONFIG_9P_ENABLE_9P2000_u @@ -925,13 +1073,13 @@ LM_FLATTEN static bool validate_Twalk(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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)) + || (validate_2(ctx) || ({ nwname = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; })) + || _validate_list(ctx, uint16le_decode(&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); }) || ({ uint8_t exp = 110; (((uint8_t)typ) != exp) && @@ -948,8 +1096,8 @@ LM_FLATTEN static bool validate_Trename(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_fid(ctx) @@ -966,8 +1114,8 @@ LM_FLATTEN static bool validate_Rreadlink(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_s(ctx) || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && @@ -982,8 +1130,8 @@ LM_FLATTEN static bool validate_Txattrwalk(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_fid(ctx) @@ -1000,8 +1148,8 @@ LM_FLATTEN static bool validate_Txattrcreate(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1019,8 +1167,8 @@ LM_FLATTEN static bool validate_Tgetlock(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_1(ctx) @@ -1040,8 +1188,8 @@ LM_FLATTEN static bool validate_Rgetlock(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_1(ctx) || validate_8(ctx) @@ -1060,8 +1208,8 @@ LM_FLATTEN static bool validate_Tlink(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_fid(ctx) @@ -1078,8 +1226,8 @@ LM_FLATTEN static bool validate_Trenameat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1097,8 +1245,8 @@ LM_FLATTEN static bool validate_Tunlinkat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1117,12 +1265,12 @@ LM_FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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_list(ctx, uint16le_decode(&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); }) || ({ uint8_t exp = 152; (((uint8_t)typ) != exp) && @@ -1130,25 +1278,6 @@ LM_FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) { ; } -LM_FLATTEN static 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); }) - || ({ uint8_t exp = 154; (((uint8_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) - ; -} - #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool validate_qid(struct _validate_ctx *ctx) { @@ -1164,8 +1293,8 @@ LM_FLATTEN static bool validate_Tauth(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1185,8 +1314,8 @@ LM_FLATTEN static bool validate_Tattach(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_fid(ctx) @@ -1209,8 +1338,8 @@ LM_FLATTEN static bool validate_Tlcreate(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1229,8 +1358,8 @@ LM_FLATTEN static bool validate_Tsymlink(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1248,8 +1377,8 @@ LM_FLATTEN static bool validate_Tmknod(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1271,8 +1400,8 @@ LM_FLATTEN static bool validate_Topen(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_o(ctx) @@ -1288,8 +1417,8 @@ LM_FLATTEN static bool validate_Tcreate(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_s(ctx) @@ -1309,8 +1438,8 @@ LM_FLATTEN static bool validate_Tgetattr(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_getattr(ctx) @@ -1326,8 +1455,8 @@ LM_FLATTEN static bool validate_Tsetattr(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_setattr(ctx) @@ -1351,8 +1480,8 @@ LM_FLATTEN static bool validate_Tlock(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_fid(ctx) || validate_lock_type(ctx) @@ -1373,8 +1502,8 @@ LM_FLATTEN static bool validate_Rlock(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_lock_status(ctx) || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && @@ -1385,12 +1514,49 @@ LM_FLATTEN static bool validate_Rlock(struct _validate_ctx *ctx) { } #endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e +LM_FLATTEN static 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 = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) + || validate_tag(ctx) + || validate_d_e(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); }) + || ({ uint8_t exp = 153; (((uint8_t)typ) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) + ; +} + +LM_FLATTEN static 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 = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) + || validate_tag(ctx) + || validate_4(ctx) + || validate_2(ctx) + || _validate_list(ctx, uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s)) + || validate_d_e(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); }) + || ({ uint8_t exp = 154; (((uint8_t)typ) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static 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; })) + || (validate_2(ctx) || ({ stat_size = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; })) || ({ _kern_type_offset = ctx->net_offset; validate_2(ctx); }) || validate_4(ctx) || validate_qid(ctx) @@ -1420,8 +1586,8 @@ LM_FLATTEN static bool validate_Rauth(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -1436,8 +1602,8 @@ LM_FLATTEN static bool validate_Rattach(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -1453,11 +1619,11 @@ LM_FLATTEN static bool validate_Rwalk(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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)) + || (validate_2(ctx) || ({ nwqid = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; })) + || _validate_list(ctx, uint16le_decode(&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); }) || ({ uint8_t exp = 111; (((uint8_t)typ) != exp) && @@ -1474,8 +1640,8 @@ LM_FLATTEN static bool validate_Ropen(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_qid(ctx) || validate_4(ctx) @@ -1491,8 +1657,8 @@ LM_FLATTEN static bool validate_Rcreate(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_qid(ctx) || validate_4(ctx) @@ -1510,8 +1676,8 @@ LM_FLATTEN static bool validate_Rlopen(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_qid(ctx) || validate_4(ctx) @@ -1527,8 +1693,8 @@ LM_FLATTEN static bool validate_Rlcreate(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_qid(ctx) || validate_4(ctx) @@ -1544,8 +1710,8 @@ LM_FLATTEN static bool validate_Rsymlink(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -1560,8 +1726,8 @@ LM_FLATTEN static bool validate_Rmknod(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -1576,8 +1742,8 @@ LM_FLATTEN static bool validate_Rgetattr(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) || validate_8(ctx) || validate_qid(ctx) @@ -1611,8 +1777,8 @@ LM_FLATTEN static bool validate_Tmkdir(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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) && @@ -1631,10 +1797,10 @@ LM_FLATTEN static bool validate_Rstat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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; })) + || (validate_2(ctx) || ({ nstat = uint16le_decode(&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); }) @@ -1652,11 +1818,11 @@ LM_FLATTEN static bool validate_Twstat(struct _validate_ctx *ctx) { 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; })) + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = 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; })) + || (validate_2(ctx) || ({ nstat = uint16le_decode(&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); }) @@ -1671,22 +1837,22 @@ LM_FLATTEN static bool validate_Twstat(struct _validate_ctx *ctx) { /* unmarshal_* ****************************************************************/ LM_ALWAYS_INLINE static void unmarshal_1(struct _unmarshal_ctx *ctx, uint8_t *out) { - *out = decode_u8le(&ctx->net_bytes[ctx->net_offset]); + *out = ctx->net_bytes[ctx->net_offset]; ctx->net_offset += 1; } LM_ALWAYS_INLINE static void unmarshal_2(struct _unmarshal_ctx *ctx, uint16_t *out) { - *out = decode_u16le(&ctx->net_bytes[ctx->net_offset]); + *out = uint16le_decode(&ctx->net_bytes[ctx->net_offset]); ctx->net_offset += 2; } LM_ALWAYS_INLINE static void unmarshal_4(struct _unmarshal_ctx *ctx, uint32_t *out) { - *out = decode_u32le(&ctx->net_bytes[ctx->net_offset]); + *out = uint32le_decode(&ctx->net_bytes[ctx->net_offset]); ctx->net_offset += 4; } LM_ALWAYS_INLINE static void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out) { - *out = decode_u64le(&ctx->net_bytes[ctx->net_offset]); + *out = uint64le_decode(&ctx->net_bytes[ctx->net_offset]); ctx->net_offset += 8; } @@ -1719,8 +1885,6 @@ LM_ALWAYS_INLINE static void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9 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'; } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ @@ -1770,6 +1934,17 @@ LM_ALWAYS_INLINE static void unmarshal_lock_status(struct _unmarshal_ctx *ctx, l } #endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e +LM_ALWAYS_INLINE static void unmarshal_d_e(struct _unmarshal_ctx *ctx, struct lib9p_d_e *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, &out->dat[i]); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) { memset(out, 0, sizeof(*out)); @@ -2045,18 +2220,6 @@ LM_FLATTEN static void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p unmarshal_d(ctx, &out->data); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_e -LM_FLATTEN static 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); -} - -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tversion *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -2216,20 +2379,6 @@ LM_FLATTEN static void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p unmarshal_s(ctx, &out->wname[i]); } -LM_FLATTEN static 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); -} - #endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static void unmarshal_qid(struct _unmarshal_ctx *ctx, struct lib9p_qid *out) { @@ -2377,6 +2526,30 @@ LM_FLATTEN static void unmarshal_Rlock(struct _unmarshal_ctx *ctx, struct lib9p_ } #endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e +LM_FLATTEN static 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_e(ctx, &out->data); +} + +LM_FLATTEN static 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_e(ctx, &out->data); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) { memset(out, 0, sizeof(*out)); @@ -2564,7 +2737,7 @@ LM_ALWAYS_INLINE static bool marshal_1(struct _marshal_ctx *ctx, uint8_t *val) { LM_ALWAYS_INLINE static 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]); + uint16le_encode(&ctx->net_bytes[ctx->net_offset], *val); ctx->net_offset += 2; return false; } @@ -2572,7 +2745,7 @@ LM_ALWAYS_INLINE static bool marshal_2(struct _marshal_ctx *ctx, uint16_t *val) LM_ALWAYS_INLINE static 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]); + uint32le_encode(&ctx->net_bytes[ctx->net_offset], *val); ctx->net_offset += 4; return false; } @@ -2580,7 +2753,7 @@ LM_ALWAYS_INLINE static bool marshal_4(struct _marshal_ctx *ctx, uint32_t *val) LM_ALWAYS_INLINE static 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]); + uint64le_encode(&ctx->net_bytes[ctx->net_offset], *val); ctx->net_offset += 8; return false; } @@ -2671,6 +2844,18 @@ LM_ALWAYS_INLINE static bool marshal_lock_status(struct _marshal_ctx *ctx, lib9p } #endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e +LM_ALWAYS_INLINE static bool marshal_d_e(struct _marshal_ctx *ctx, struct lib9p_d_e *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, &val->dat[i]); + err; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) { uint32_t _size_offset; @@ -2680,8 +2865,8 @@ LM_FLATTEN static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 108; false; }) ; } @@ -2692,8 +2877,8 @@ LM_FLATTEN static bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 109; false; }) ; } @@ -2705,8 +2890,8 @@ LM_FLATTEN static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 119; false; }) ; } @@ -2719,8 +2904,8 @@ LM_FLATTEN static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 121; false; }) ; } @@ -2733,8 +2918,8 @@ LM_FLATTEN static bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_ms || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 123; false; }) ; } @@ -2747,8 +2932,8 @@ LM_FLATTEN static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 127; false; }) ; } @@ -2762,8 +2947,8 @@ LM_FLATTEN static bool marshal_Rlerror(struct _marshal_ctx *ctx, struct lib9p_ms || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) || marshal_tag(ctx, &val->tag) || marshal_4(ctx, &val->ecode) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(7, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 7; false; }) ; } @@ -2783,8 +2968,8 @@ LM_FLATTEN static bool marshal_Rstatfs(struct _marshal_ctx *ctx, struct lib9p_ms || marshal_8(ctx, &val->ffree) || marshal_8(ctx, &val->fsid) || marshal_4(ctx, &val->namelen) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(9, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 9; false; }) ; } @@ -2795,8 +2980,8 @@ LM_FLATTEN static bool marshal_Rrename(struct _marshal_ctx *ctx, struct lib9p_ms || ({ _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(21, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 21; false; }) ; } @@ -2807,8 +2992,8 @@ LM_FLATTEN static bool marshal_Rsetattr(struct _marshal_ctx *ctx, struct lib9p_m || ({ _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(27, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 27; false; }) ; } @@ -2820,8 +3005,8 @@ LM_FLATTEN static bool marshal_Rxattrwalk(struct _marshal_ctx *ctx, struct lib9p || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) || marshal_tag(ctx, &val->tag) || marshal_8(ctx, &val->attr_size) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(31, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 31; false; }) ; } @@ -2832,8 +3017,8 @@ LM_FLATTEN static bool marshal_Rxattrcreate(struct _marshal_ctx *ctx, struct lib || ({ _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(33, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 33; false; }) ; } @@ -2849,8 +3034,8 @@ LM_FLATTEN static bool marshal_Rreaddir(struct _marshal_ctx *ctx, struct lib9p_m for (typeof(val->count) i = 0; i < val->count && !err; i++) err = marshal_1(ctx, &val->data[i]); err; }) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(41, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 41; false; }) ; } @@ -2861,8 +3046,8 @@ LM_FLATTEN static bool marshal_Rfsync(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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(51, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 51; false; }) ; } @@ -2873,8 +3058,8 @@ LM_FLATTEN static bool marshal_Rlink(struct _marshal_ctx *ctx, struct lib9p_msg_ || ({ _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(71, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 71; false; }) ; } @@ -2885,8 +3070,8 @@ LM_FLATTEN static bool marshal_Rrenameat(struct _marshal_ctx *ctx, struct lib9p_ || ({ _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(75, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 75; false; }) ; } @@ -2897,8 +3082,8 @@ LM_FLATTEN static bool marshal_Runlinkat(struct _marshal_ctx *ctx, struct lib9p_ || ({ _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(77, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 77; false; }) ; } @@ -2912,8 +3097,8 @@ LM_FLATTEN static bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_m || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 150; false; }) ; } @@ -2924,8 +3109,8 @@ LM_FLATTEN static bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_m || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 151; false; }) ; } @@ -2937,8 +3122,8 @@ LM_FLATTEN static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_ms || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 155; false; }) ; } @@ -2954,8 +3139,8 @@ LM_FLATTEN static bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_ || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 116; false; }) ; } @@ -2967,8 +3152,8 @@ LM_FLATTEN static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 120; false; }) ; } @@ -2980,8 +3165,8 @@ LM_FLATTEN static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_ms || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 122; false; }) ; } @@ -2995,8 +3180,8 @@ LM_FLATTEN static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_ || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 124; false; }) ; } @@ -3010,8 +3195,8 @@ LM_FLATTEN static bool marshal_Tstatfs(struct _marshal_ctx *ctx, struct lib9p_ms || ({ _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(8, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 8; false; }) ; } @@ -3024,8 +3209,8 @@ LM_FLATTEN static bool marshal_Tlopen(struct _marshal_ctx *ctx, struct lib9p_msg || marshal_tag(ctx, &val->tag) || marshal_fid(ctx, &val->fid) || marshal_4(ctx, &val->flags) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(12, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 12; false; }) ; } @@ -3037,8 +3222,8 @@ LM_FLATTEN static bool marshal_Treadlink(struct _marshal_ctx *ctx, struct lib9p_ || ({ _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(22, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 22; false; }) ; } @@ -3052,8 +3237,8 @@ LM_FLATTEN static bool marshal_Treaddir(struct _marshal_ctx *ctx, struct lib9p_m || 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(40, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 40; false; }) ; } @@ -3066,8 +3251,8 @@ LM_FLATTEN static bool marshal_Tfsync(struct _marshal_ctx *ctx, struct lib9p_msg || marshal_tag(ctx, &val->tag) || marshal_fid(ctx, &val->fid) || marshal_4(ctx, &val->datasync) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(50, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 50; false; }) ; } @@ -3081,8 +3266,8 @@ LM_FLATTEN static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_ || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 117; false; }) ; } @@ -3096,28 +3281,11 @@ LM_FLATTEN static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg || 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; }) - ; -} - -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_e -LM_FLATTEN static 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 118; false; }) ; } -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -3127,8 +3295,8 @@ LM_FLATTEN static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_m || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 100; false; }) ; } @@ -3141,8 +3309,8 @@ LM_FLATTEN static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_m || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 101; false; }) ; } @@ -3159,8 +3327,8 @@ LM_FLATTEN static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg #if CONFIG_9P_ENABLE_9P2000_u || ( is_ver(ctx, 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 107; false; }) ; } @@ -3180,8 +3348,8 @@ LM_FLATTEN static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_ 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 110; false; }) ; } @@ -3197,8 +3365,8 @@ LM_FLATTEN static bool marshal_Trename(struct _marshal_ctx *ctx, struct lib9p_ms || marshal_fid(ctx, &val->fid) || marshal_fid(ctx, &val->dfid) || marshal_s(ctx, &val->name) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(20, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 20; false; }) ; } @@ -3210,8 +3378,8 @@ LM_FLATTEN static bool marshal_Rreadlink(struct _marshal_ctx *ctx, struct lib9p_ || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) || marshal_tag(ctx, &val->tag) || marshal_s(ctx, &val->target) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(23, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 23; false; }) ; } @@ -3225,8 +3393,8 @@ LM_FLATTEN static bool marshal_Txattrwalk(struct _marshal_ctx *ctx, struct lib9p || marshal_fid(ctx, &val->fid) || marshal_fid(ctx, &val->newfid) || marshal_s(ctx, &val->name) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(30, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 30; false; }) ; } @@ -3241,8 +3409,8 @@ LM_FLATTEN static bool marshal_Txattrcreate(struct _marshal_ctx *ctx, struct lib || marshal_s(ctx, &val->name) || marshal_8(ctx, &val->attr_size) || marshal_4(ctx, &val->flags) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(32, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 32; false; }) ; } @@ -3259,8 +3427,8 @@ LM_FLATTEN static bool marshal_Tgetlock(struct _marshal_ctx *ctx, struct lib9p_m || marshal_8(ctx, &val->length) || marshal_4(ctx, &val->proc_id) || marshal_s(ctx, &val->client_id) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(54, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 54; false; }) ; } @@ -3276,8 +3444,8 @@ LM_FLATTEN static bool marshal_Rgetlock(struct _marshal_ctx *ctx, struct lib9p_m || marshal_8(ctx, &val->length) || marshal_4(ctx, &val->proc_id) || marshal_s(ctx, &val->client_id) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(55, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 55; false; }) ; } @@ -3291,8 +3459,8 @@ LM_FLATTEN static bool marshal_Tlink(struct _marshal_ctx *ctx, struct lib9p_msg_ || marshal_fid(ctx, &val->dfid) || marshal_fid(ctx, &val->fid) || marshal_s(ctx, &val->name) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(70, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 70; false; }) ; } @@ -3307,8 +3475,8 @@ LM_FLATTEN static bool marshal_Trenameat(struct _marshal_ctx *ctx, struct lib9p_ || marshal_s(ctx, &val->oldname) || marshal_fid(ctx, &val->newdirfid) || marshal_s(ctx, &val->newname) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(74, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 74; false; }) ; } @@ -3322,8 +3490,8 @@ LM_FLATTEN static bool marshal_Tunlinkat(struct _marshal_ctx *ctx, struct lib9p_ || marshal_fid(ctx, &val->dirfd) || marshal_s(ctx, &val->name) || marshal_4(ctx, &val->flags) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(76, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 76; false; }) ; } @@ -3342,27 +3510,8 @@ LM_FLATTEN static bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg 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; }) - ; -} - -LM_FLATTEN static 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 152; false; }) ; } @@ -3389,8 +3538,8 @@ LM_FLATTEN static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_ #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u || ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) && marshal_nuid(ctx, &val->n_uid) ) #endif /* CONFIG_9P_ENABLE_9P2000_L || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 102; false; }) ; } @@ -3408,8 +3557,8 @@ LM_FLATTEN static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_ms #if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u || ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) && marshal_nuid(ctx, &val->n_uid) ) #endif /* CONFIG_9P_ENABLE_9P2000_L || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 104; false; }) ; } @@ -3427,8 +3576,8 @@ LM_FLATTEN static bool marshal_Tlcreate(struct _marshal_ctx *ctx, struct lib9p_m || marshal_4(ctx, &val->flags) || marshal_4(ctx, &val->mode) || marshal_nuid(ctx, &val->gid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(14, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 14; false; }) ; } @@ -3443,8 +3592,8 @@ LM_FLATTEN static bool marshal_Tsymlink(struct _marshal_ctx *ctx, struct lib9p_m || marshal_s(ctx, &val->name) || marshal_s(ctx, &val->symtgt) || marshal_nuid(ctx, &val->gid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(16, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 16; false; }) ; } @@ -3461,8 +3610,8 @@ LM_FLATTEN static bool marshal_Tmknod(struct _marshal_ctx *ctx, struct lib9p_msg || marshal_4(ctx, &val->major) || marshal_4(ctx, &val->minor) || marshal_nuid(ctx, &val->gid) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(18, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 18; false; }) ; } @@ -3477,8 +3626,8 @@ LM_FLATTEN static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_ || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 112; false; }) ; } @@ -3493,8 +3642,8 @@ LM_FLATTEN static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_ms || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 114; false; }) ; } @@ -3509,8 +3658,8 @@ LM_FLATTEN static bool marshal_Tgetattr(struct _marshal_ctx *ctx, struct lib9p_m || marshal_tag(ctx, &val->tag) || marshal_fid(ctx, &val->fid) || marshal_getattr(ctx, &val->request_mask) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(24, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 24; false; }) ; } @@ -3531,8 +3680,8 @@ LM_FLATTEN static bool marshal_Tsetattr(struct _marshal_ctx *ctx, struct lib9p_m || marshal_8(ctx, &val->atime_nsec) || marshal_8(ctx, &val->mtime_sec) || marshal_8(ctx, &val->mtime_nsec) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(26, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 26; false; }) ; } @@ -3550,8 +3699,8 @@ LM_FLATTEN static bool marshal_Tlock(struct _marshal_ctx *ctx, struct lib9p_msg_ || marshal_8(ctx, &val->length) || marshal_4(ctx, &val->proc_id) || marshal_s(ctx, &val->client_id) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(52, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 52; false; }) ; } @@ -3563,12 +3712,46 @@ LM_FLATTEN static bool marshal_Rlock(struct _marshal_ctx *ctx, struct lib9p_msg_ || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) || marshal_tag(ctx, &val->tag) || marshal_lock_status(ctx, &val->status) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(53, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 53; false; }) ; } #endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000_e +LM_FLATTEN static 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_e(ctx, &val->data) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 153; false; }) + ; +} + +LM_FLATTEN static 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_e(ctx, &val->data) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 154; false; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) { uint32_t _stat_size_offset; @@ -3592,7 +3775,7 @@ LM_ALWAYS_INLINE static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p || ( is_ver(ctx, 9P2000_u) && marshal_nuid(ctx, &val->file_owner_n_gid) ) || ( is_ver(ctx, 9P2000_u) && marshal_nuid(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; }) + || ({ uint16le_encode(&ctx->net_bytes[_stat_size_offset], ctx->net_offset - _kern_type_offset); false; }) ; } @@ -3606,8 +3789,8 @@ LM_FLATTEN static bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_ || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 103; false; }) ; } @@ -3619,8 +3802,8 @@ LM_FLATTEN static bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_ms || ({ _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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 105; false; }) ; } @@ -3636,8 +3819,8 @@ LM_FLATTEN static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_ 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 111; false; }) ; } @@ -3652,8 +3835,8 @@ LM_FLATTEN static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_ || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 113; false; }) ; } @@ -3666,8 +3849,8 @@ LM_FLATTEN static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_ms || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 115; false; }) ; } @@ -3682,8 +3865,8 @@ LM_FLATTEN static bool marshal_Rlopen(struct _marshal_ctx *ctx, struct lib9p_msg || 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(13, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 13; false; }) ; } @@ -3696,8 +3879,8 @@ LM_FLATTEN static bool marshal_Rlcreate(struct _marshal_ctx *ctx, struct lib9p_m || 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(15, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 15; false; }) ; } @@ -3709,8 +3892,8 @@ LM_FLATTEN static bool marshal_Rsymlink(struct _marshal_ctx *ctx, struct lib9p_m || ({ _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(17, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 17; false; }) ; } @@ -3722,8 +3905,8 @@ LM_FLATTEN static bool marshal_Rmknod(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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(19, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 19; false; }) ; } @@ -3754,8 +3937,8 @@ LM_FLATTEN static bool marshal_Rgetattr(struct _marshal_ctx *ctx, struct lib9p_m || marshal_8(ctx, &val->btime_nsec) || marshal_8(ctx, &val->gen) || marshal_8(ctx, &val->data_version) - || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) - || ({ encode_u8le(25, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 25; false; }) ; } @@ -3767,8 +3950,8 @@ LM_FLATTEN static bool marshal_Tmkdir(struct _marshal_ctx *ctx, struct lib9p_msg || ({ _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(73, &ctx->net_bytes[_typ_offset]); false; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 73; false; }) ; } @@ -3785,9 +3968,9 @@ LM_FLATTEN static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_ || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 125; false; }) + || ({ uint16le_encode(&ctx->net_bytes[_nstat_offset], ctx->net_offset - _stat_offset); false; }) ; } @@ -3803,15 +3986,15 @@ LM_FLATTEN static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg || 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; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 126; false; }) + || ({ uint16le_encode(&ctx->net_bytes[_nstat_offset], ctx->net_offset - _stat_offset); false; }) ; } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -/* tables / exports ***********************************************************/ -#define _MSG_NAME(typ) [LIB9P_TYP_##typ] = #typ +/* function tables ************************************************************/ + #define _MSG_RECV(typ) [LIB9P_TYP_##typ/2] = { \ .basesize = sizeof(struct lib9p_msg_##typ), \ .validate = validate_##typ, \ @@ -3821,172 +4004,6 @@ LM_FLATTEN static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg .marshal = (_marshal_fn_t)marshal_##typ, \ } -const char * _lib9p_table_msg_name[LIB9P_VER_NUM][0x100] = { - [LIB9P_VER_unknown] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Rerror), - }, -#if CONFIG_9P_ENABLE_9P2000 - [LIB9P_VER_9P2000] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Topen), - _MSG_NAME(Ropen), - _MSG_NAME(Tcreate), - _MSG_NAME(Rcreate), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - _MSG_NAME(Tstat), - _MSG_NAME(Rstat), - _MSG_NAME(Twstat), - _MSG_NAME(Rwstat), - }, -#endif /* CONFIG_9P_ENABLE_9P2000 */ -#if CONFIG_9P_ENABLE_9P2000_L - [LIB9P_VER_9P2000_L] = { - _MSG_NAME(Rlerror), - _MSG_NAME(Tstatfs), - _MSG_NAME(Rstatfs), - _MSG_NAME(Tlopen), - _MSG_NAME(Rlopen), - _MSG_NAME(Tlcreate), - _MSG_NAME(Rlcreate), - _MSG_NAME(Tsymlink), - _MSG_NAME(Rsymlink), - _MSG_NAME(Tmknod), - _MSG_NAME(Rmknod), - _MSG_NAME(Trename), - _MSG_NAME(Rrename), - _MSG_NAME(Treadlink), - _MSG_NAME(Rreadlink), - _MSG_NAME(Tgetattr), - _MSG_NAME(Rgetattr), - _MSG_NAME(Tsetattr), - _MSG_NAME(Rsetattr), - _MSG_NAME(Txattrwalk), - _MSG_NAME(Rxattrwalk), - _MSG_NAME(Txattrcreate), - _MSG_NAME(Rxattrcreate), - _MSG_NAME(Treaddir), - _MSG_NAME(Rreaddir), - _MSG_NAME(Tfsync), - _MSG_NAME(Rfsync), - _MSG_NAME(Tlock), - _MSG_NAME(Rlock), - _MSG_NAME(Tgetlock), - _MSG_NAME(Rgetlock), - _MSG_NAME(Tlink), - _MSG_NAME(Rlink), - _MSG_NAME(Tmkdir), - _MSG_NAME(Trenameat), - _MSG_NAME(Rrenameat), - _MSG_NAME(Tunlinkat), - _MSG_NAME(Runlinkat), - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - }, -#endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e - [LIB9P_VER_9P2000_e] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Topen), - _MSG_NAME(Ropen), - _MSG_NAME(Tcreate), - _MSG_NAME(Rcreate), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - _MSG_NAME(Tstat), - _MSG_NAME(Rstat), - _MSG_NAME(Twstat), - _MSG_NAME(Rwstat), - _MSG_NAME(Tsession), - _MSG_NAME(Rsession), - _MSG_NAME(Tsread), - _MSG_NAME(Rsread), - _MSG_NAME(Tswrite), - _MSG_NAME(Rswrite), - }, -#endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000_u - [LIB9P_VER_9P2000_u] = { - _MSG_NAME(Tversion), - _MSG_NAME(Rversion), - _MSG_NAME(Tauth), - _MSG_NAME(Rauth), - _MSG_NAME(Tattach), - _MSG_NAME(Rattach), - _MSG_NAME(Rerror), - _MSG_NAME(Tflush), - _MSG_NAME(Rflush), - _MSG_NAME(Twalk), - _MSG_NAME(Rwalk), - _MSG_NAME(Topen), - _MSG_NAME(Ropen), - _MSG_NAME(Tcreate), - _MSG_NAME(Rcreate), - _MSG_NAME(Tread), - _MSG_NAME(Rread), - _MSG_NAME(Twrite), - _MSG_NAME(Rwrite), - _MSG_NAME(Tclunk), - _MSG_NAME(Rclunk), - _MSG_NAME(Tremove), - _MSG_NAME(Rremove), - _MSG_NAME(Tstat), - _MSG_NAME(Rstat), - _MSG_NAME(Twstat), - _MSG_NAME(Rwstat), - }, -#endif /* CONFIG_9P_ENABLE_9P2000_u */ -}; - const struct _lib9p_recv_tentry _lib9p_table_Tmsg_recv[LIB9P_VER_NUM][0x80] = { [LIB9P_VER_unknown] = { _MSG_RECV(Tversion), |