diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-01-17 12:19:32 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-01-17 12:19:32 -0700 |
commit | a35db3be439c9a27f0763036cf3d4992ccf893eb (patch) | |
tree | 61025f79e52b31d636faa7b16fc2ee434b9c5a04 | |
parent | 287e11381634b879dc82b23eacb693a31c52f9ef (diff) | |
parent | a8b4ec816efc869d00023c7565f1fed5098eca9b (diff) |
Merge branch 'lukeshu/9p-idl-defs'
-rw-r--r-- | cmd/sbc_harness/config/config.h | 1 | ||||
-rw-r--r-- | lib9p/9p.generated.c | 2265 | ||||
-rwxr-xr-x | lib9p/idl.gen | 23 | ||||
-rw-r--r-- | lib9p/idl/2010-9P2000.L.9p (renamed from lib9p/idl/2010-9P2000.L.9p.wip) | 0 | ||||
-rw-r--r-- | lib9p/include/lib9p/9p.generated.h | 624 | ||||
-rw-r--r-- | lib9p/tests/test_server/config/config.h | 1 |
6 files changed, 2805 insertions, 109 deletions
diff --git a/cmd/sbc_harness/config/config.h b/cmd/sbc_harness/config/config.h index 2b6a6cf..56b39d6 100644 --- a/cmd/sbc_harness/config/config.h +++ b/cmd/sbc_harness/config/config.h @@ -62,6 +62,7 @@ #define CONFIG_9P_ENABLE_9P2000 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_e 0 /* bool */ +#define CONFIG_9P_ENABLE_9P2000_L 0 /* bool */ /* DHCP ***********************************************************************/ diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c index 67644e4..d809588 100644 --- a/lib9p/9p.generated.c +++ b/lib9p/9p.generated.c @@ -1,4 +1,4 @@ -/* Generated by `lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ +/* Generated by `lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ #include <stdbool.h> #include <stddef.h> /* for size_t */ @@ -11,6 +11,36 @@ #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 + #define _is_ver_9P2000(v) false +#endif +#if CONFIG_9P_ENABLE_9P2000_L + #define _is_ver_9P2000_L(v) (v == LIB9P_VER_9P2000_L) +#else + #define _is_ver_9P2000_L(v) false +#endif +#if CONFIG_9P_ENABLE_9P2000_e + #define _is_ver_9P2000_e(v) (v == LIB9P_VER_9P2000_e) +#else + #define _is_ver_9P2000_e(v) false +#endif +#if CONFIG_9P_ENABLE_9P2000_u + #define _is_ver_9P2000_u(v) (v == LIB9P_VER_9P2000_u) +#else + #define _is_ver_9P2000_u(v) false +#endif + /* strings ********************************************************************/ static const char *version_strs[LIB9P_VER_NUM] = { @@ -18,6 +48,9 @@ static const char *version_strs[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 [LIB9P_VER_9P2000] = "9P2000", #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = "9P2000.L", +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = "9P2000.e", #endif /* CONFIG_9P_ENABLE_9P2000_e */ @@ -41,6 +74,9 @@ static const lib9p_dm_t dm_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 [LIB9P_VER_9P2000] = 0b11101100000000000000000111111111, #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = 0b11101100000000000000000111111111, #endif /* CONFIG_9P_ENABLE_9P2000_e */ @@ -49,10 +85,15 @@ static const lib9p_dm_t dm_masks[LIB9P_VER_NUM] = { #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u static const lib9p_qt_t qt_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 [LIB9P_VER_9P2000] = 0b11101100, #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = 0b11101100, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = 0b11101100, #endif /* CONFIG_9P_ENABLE_9P2000_e */ @@ -61,10 +102,15 @@ static const lib9p_qt_t qt_masks[LIB9P_VER_NUM] = { #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u static const lib9p_o_t o_masks[LIB9P_VER_NUM] = { #if CONFIG_9P_ENABLE_9P2000 [LIB9P_VER_9P2000] = 0b01010011, #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = 0b00000000, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = 0b01010011, #endif /* CONFIG_9P_ENABLE_9P2000_e */ @@ -72,7 +118,48 @@ static const lib9p_o_t o_masks[LIB9P_VER_NUM] = { [LIB9P_VER_9P2000_u] = 0b01010011, #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; + #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +static const lib9p_getattr_t getattr_masks[LIB9P_VER_NUM] = { +#if CONFIG_9P_ENABLE_9P2000 + [LIB9P_VER_9P2000] = 0b0000000000000000000000000000000000000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000 */ + [LIB9P_VER_9P2000_L] = 0b0000000000000000000000000000000000000000000000000011111111111111, +#if CONFIG_9P_ENABLE_9P2000_e + [LIB9P_VER_9P2000_e] = 0b0000000000000000000000000000000000000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000_e */ +#if CONFIG_9P_ENABLE_9P2000_u + [LIB9P_VER_9P2000_u] = 0b0000000000000000000000000000000000000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000_u */ +}; + +static const lib9p_setattr_t setattr_masks[LIB9P_VER_NUM] = { +#if CONFIG_9P_ENABLE_9P2000 + [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000 */ + [LIB9P_VER_9P2000_L] = 0b00000000000000000000000111111111, +#if CONFIG_9P_ENABLE_9P2000_e + [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000_e */ +#if CONFIG_9P_ENABLE_9P2000_u + [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000_u */ +}; + +static const lib9p_lock_flags_t lock_flags_masks[LIB9P_VER_NUM] = { +#if CONFIG_9P_ENABLE_9P2000 + [LIB9P_VER_9P2000] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000 */ + [LIB9P_VER_9P2000_L] = 0b00000000000000000000000000000011, +#if CONFIG_9P_ENABLE_9P2000_e + [LIB9P_VER_9P2000_e] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000_e */ +#if CONFIG_9P_ENABLE_9P2000_u + [LIB9P_VER_9P2000_u] = 0b00000000000000000000000000000000, +#endif /* CONFIG_9P_ENABLE_9P2000_u */ +}; +#endif /* CONFIG_9P_ENABLE_9P2000_L */ /* validate_* *****************************************************************/ @@ -110,7 +197,7 @@ LM_ALWAYS_INLINE static bool _validate_list(struct _validate_ctx *ctx, #define validate_4(ctx) _validate_size_net(ctx, 4) #define validate_8(ctx) _validate_size_net(ctx, 8) -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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_tag(struct _validate_ctx *ctx) { return validate_2(ctx); } @@ -119,6 +206,8 @@ LM_ALWAYS_INLINE static bool validate_fid(struct _validate_ctx *ctx) { return validate_4(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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool validate_d(struct _validate_ctx *ctx) { uint32_t base_offset = ctx->net_offset; if (validate_4(ctx)) @@ -127,6 +216,8 @@ LM_ALWAYS_INLINE static bool validate_d(struct _validate_ctx *ctx) { return _validate_size_net(ctx, len) || _validate_size_host(ctx, len); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_s(struct _validate_ctx *ctx) { uint32_t base_offset = ctx->net_offset; if (validate_2(ctx)) @@ -139,6 +230,8 @@ LM_ALWAYS_INLINE static bool validate_s(struct _validate_ctx *ctx) { return 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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool validate_dm(struct _validate_ctx *ctx) { if (validate_4(ctx)) return true; @@ -149,6 +242,8 @@ LM_ALWAYS_INLINE static bool validate_dm(struct _validate_ctx *ctx) { return false; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_qt(struct _validate_ctx *ctx) { if (validate_1(ctx)) return true; @@ -159,13 +254,13 @@ LM_ALWAYS_INLINE static bool validate_qt(struct _validate_ctx *ctx) { return false; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_u +#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_L || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool validate_nuid(struct _validate_ctx *ctx) { return validate_4(ctx); } -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool validate_o(struct _validate_ctx *ctx) { if (validate_1(ctx)) @@ -177,6 +272,48 @@ LM_ALWAYS_INLINE static bool validate_o(struct _validate_ctx *ctx) { return false; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +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]); + if (val & ~mask) + return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in getattr bitfield: %#08"PRIx64, val & ~mask); + return false; +} + +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]); + if (val & ~mask) + return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in setattr bitfield: %#04"PRIx32, val & ~mask); + return false; +} + +LM_ALWAYS_INLINE static bool validate_lock_type(struct _validate_ctx *ctx) { + return validate_1(ctx); +} + +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]); + if (val & ~mask) + return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in lock_flags bitfield: %#04"PRIx32, val & ~mask); + return false; +} + +LM_ALWAYS_INLINE static bool validate_lock_status(struct _validate_ctx *ctx) { + return validate_1(ctx); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Tflush(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -224,6 +361,8 @@ LM_FLATTEN static bool validate_Rwrite(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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Rclunk(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -239,6 +378,8 @@ LM_FLATTEN static bool validate_Rclunk(struct _validate_ctx *ctx) { ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Rremove(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -254,6 +395,8 @@ LM_FLATTEN static bool validate_Rremove(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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Rwstat(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -270,6 +413,186 @@ LM_FLATTEN static bool validate_Rwstat(struct _validate_ctx *ctx) { } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool validate_Rlerror(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 7; (((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_Rstatfs(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_4(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 9; (((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_Rrename(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 21; (((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_Rsetattr(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 27; (((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_Rxattrwalk(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_8(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 31; (((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_Rxattrcreate(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 33; (((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_Rreaddir(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_list(ctx, decode_u32le(&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) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) + ; +} + +LM_FLATTEN static bool validate_Rfsync(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 51; (((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_Rlink(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 71; (((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_Rrenameat(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 75; (((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_Runlinkat(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 77; (((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_L */ #if CONFIG_9P_ENABLE_9P2000_e LM_FLATTEN static bool validate_Tsession(struct _validate_ctx *ctx) { uint32_t size; @@ -319,7 +642,7 @@ LM_FLATTEN static bool validate_Rswrite(struct _validate_ctx *ctx) { } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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_Tread(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -376,6 +699,8 @@ LM_FLATTEN static bool validate_Tremove(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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Tstat(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -392,6 +717,94 @@ LM_FLATTEN static bool validate_Tstat(struct _validate_ctx *ctx) { ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool validate_Tstatfs(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 8; (((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_Tlopen(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 12; (((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_Treadlink(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 22; (((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_Treaddir(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_8(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 40; (((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_Tfsync(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 50; (((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_L */ +#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_Rread(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -429,7 +842,7 @@ LM_FLATTEN static bool validate_Twrite(struct _validate_ctx *ctx) { ; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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; @@ -448,7 +861,7 @@ LM_FLATTEN static bool validate_Rsread(struct _validate_ctx *ctx) { } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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; @@ -483,6 +896,8 @@ LM_FLATTEN static bool validate_Rversion(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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -493,7 +908,7 @@ LM_FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) { || validate_tag(ctx) || validate_s(ctx) #if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) ) + || ( is_ver(ctx, 9P2000_u) && validate_4(ctx) ) #endif /* CONFIG_9P_ENABLE_9P2000_u */ || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) @@ -502,6 +917,8 @@ LM_FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) { ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Twalk(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -524,7 +941,176 @@ LM_FLATTEN static bool validate_Twalk(struct _validate_ctx *ctx) { ; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_L +LM_FLATTEN static bool validate_Trename(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || ({ 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 = 20; (((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_Rreadlink(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_s(ctx) + || ({ 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 = 23; (((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_Txattrwalk(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || ({ 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 = 30; (((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_Txattrcreate(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || validate_8(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 32; (((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_Tgetlock(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_1(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_4(ctx) + || validate_s(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 54; (((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_Rgetlock(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_1(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_4(ctx) + || validate_s(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 55; (((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_Tlink(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || ({ 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 = 70; (((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_Trenameat(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 74; (((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_Tunlinkat(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 76; (((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_L */ #if CONFIG_9P_ENABLE_9P2000_e LM_FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) { uint32_t size; @@ -564,7 +1150,7 @@ LM_FLATTEN static bool validate_Tswrite(struct _validate_ctx *ctx) { } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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) { return false || validate_qt(ctx) @@ -584,9 +1170,9 @@ LM_FLATTEN static bool validate_Tauth(struct _validate_ctx *ctx) { || validate_fid(ctx) || validate_s(ctx) || validate_s(ctx) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u + || ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) && validate_nuid(ctx) ) +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) || ({ uint8_t exp = 102; (((uint8_t)typ) != exp) && @@ -606,9 +1192,9 @@ LM_FLATTEN static bool validate_Tattach(struct _validate_ctx *ctx) { || validate_fid(ctx) || validate_s(ctx) || validate_s(ctx) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u + || ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) && validate_nuid(ctx) ) +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) || ({ uint8_t exp = 104; (((uint8_t)typ) != exp) && @@ -616,6 +1202,70 @@ LM_FLATTEN static bool validate_Tattach(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_L +LM_FLATTEN static bool validate_Tlcreate(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || validate_4(ctx) + || validate_4(ctx) + || validate_nuid(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 = 14; (((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_Tsymlink(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || validate_s(ctx) + || validate_nuid(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 = 16; (((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_Tmknod(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_s(ctx) + || validate_4(ctx) + || validate_4(ctx) + || validate_4(ctx) + || validate_nuid(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 = 18; (((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_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Topen(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -652,6 +1302,90 @@ LM_FLATTEN static bool validate_Tcreate(struct _validate_ctx *ctx) { ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool validate_Tgetattr(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_getattr(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 = 24; (((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_Tsetattr(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_setattr(ctx) + || validate_4(ctx) + || validate_nuid(ctx) + || validate_nuid(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 26; (((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_Tlock(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || validate_lock_type(ctx) + || validate_lock_flags(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_4(ctx) + || validate_s(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 52; (((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_Rlock(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_lock_status(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 = 53; (((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_L */ +#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; @@ -669,16 +1403,18 @@ LM_ALWAYS_INLINE static bool validate_stat(struct _validate_ctx *ctx) { || validate_s(ctx) || validate_s(ctx) #if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_s(ctx) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) ) + || ( is_ver(ctx, 9P2000_u) && validate_s(ctx) ) + || ( is_ver(ctx, 9P2000_u) && validate_nuid(ctx) ) + || ( is_ver(ctx, 9P2000_u) && validate_nuid(ctx) ) + || ( is_ver(ctx, 9P2000_u) && validate_nuid(ctx) ) #endif /* CONFIG_9P_ENABLE_9P2000_u */ || ({ uint16_t exp = ctx->net_offset - _kern_type_offset; (((uint16_t)stat_size) != exp) && lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "stat_size value is wrong (actual:%"PRIu16" != correct:%"PRIu16")", (uint16_t)stat_size, exp); }) ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Rauth(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -731,6 +1467,8 @@ LM_FLATTEN static bool validate_Rwalk(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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Ropen(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -765,6 +1503,127 @@ LM_FLATTEN static bool validate_Rcreate(struct _validate_ctx *ctx) { ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool validate_Rlopen(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_qid(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 13; (((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_Rlcreate(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_qid(ctx) + || validate_4(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 15; (((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_Rsymlink(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_qid(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 17; (((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_Rmknod(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_qid(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 19; (((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_Rgetattr(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_8(ctx) + || validate_qid(ctx) + || validate_4(ctx) + || validate_nuid(ctx) + || validate_nuid(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || validate_8(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 25; (((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_Tmkdir(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; })) + || validate_tag(ctx) + || validate_qid(ctx) + || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) + || ({ uint8_t exp = 73; (((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_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool validate_Rstat(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -831,7 +1690,7 @@ LM_ALWAYS_INLINE static void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *o ctx->net_offset += 8; } -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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_tag(struct _unmarshal_ctx *ctx, lib9p_tag_t *out) { unmarshal_2(ctx, (uint16_t *)out); } @@ -840,6 +1699,8 @@ LM_ALWAYS_INLINE static void unmarshal_fid(struct _unmarshal_ctx *ctx, lib9p_fid unmarshal_4(ctx, (uint32_t *)out); } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9p_d *out) { memset(out, 0, sizeof(*out)); unmarshal_4(ctx, &out->len); @@ -849,6 +1710,8 @@ LM_ALWAYS_INLINE static void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9 unmarshal_1(ctx, (uint8_t *)&out->dat[i]); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_s(struct _unmarshal_ctx *ctx, struct lib9p_s *out) { memset(out, 0, sizeof(*out)); unmarshal_2(ctx, &out->len); @@ -860,26 +1723,54 @@ LM_ALWAYS_INLINE static void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9 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 */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static void unmarshal_dm(struct _unmarshal_ctx *ctx, lib9p_dm_t *out) { unmarshal_4(ctx, (uint32_t *)out); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_qt(struct _unmarshal_ctx *ctx, lib9p_qt_t *out) { unmarshal_1(ctx, (uint8_t *)out); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_u +#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_L || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static void unmarshal_nuid(struct _unmarshal_ctx *ctx, lib9p_nuid_t *out) { unmarshal_4(ctx, (uint32_t *)out); } -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static void unmarshal_o(struct _unmarshal_ctx *ctx, lib9p_o_t *out) { unmarshal_1(ctx, (uint8_t *)out); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_ALWAYS_INLINE static void unmarshal_getattr(struct _unmarshal_ctx *ctx, lib9p_getattr_t *out) { + unmarshal_8(ctx, (uint64_t *)out); +} + +LM_ALWAYS_INLINE static void unmarshal_setattr(struct _unmarshal_ctx *ctx, lib9p_setattr_t *out) { + unmarshal_4(ctx, (uint32_t *)out); +} + +LM_ALWAYS_INLINE static void unmarshal_lock_type(struct _unmarshal_ctx *ctx, lib9p_lock_type_t *out) { + unmarshal_1(ctx, (uint8_t *)out); +} + +LM_ALWAYS_INLINE static void unmarshal_lock_flags(struct _unmarshal_ctx *ctx, lib9p_lock_flags_t *out) { + unmarshal_4(ctx, (uint32_t *)out); +} + +LM_ALWAYS_INLINE static void unmarshal_lock_status(struct _unmarshal_ctx *ctx, lib9p_lock_status_t *out) { + unmarshal_1(ctx, (uint8_t *)out); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -903,6 +1794,8 @@ LM_FLATTEN static void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p unmarshal_4(ctx, &out->count); } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Rclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rclunk *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -910,6 +1803,8 @@ LM_FLATTEN static void unmarshal_Rclunk(struct _unmarshal_ctx *ctx, struct lib9p unmarshal_tag(ctx, &out->tag); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Rremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rremove *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -917,6 +1812,8 @@ LM_FLATTEN static void unmarshal_Rremove(struct _unmarshal_ctx *ctx, struct lib9 unmarshal_tag(ctx, &out->tag); } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwstat *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -925,6 +1822,101 @@ LM_FLATTEN static void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static void unmarshal_Rlerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlerror *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_4(ctx, &out->ecode); +} + +LM_FLATTEN static void unmarshal_Rstatfs(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstatfs *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_4(ctx, &out->type); + unmarshal_4(ctx, &out->bsize); + unmarshal_8(ctx, &out->blocks); + unmarshal_8(ctx, &out->bfree); + unmarshal_8(ctx, &out->bavail); + unmarshal_8(ctx, &out->files); + unmarshal_8(ctx, &out->ffree); + unmarshal_8(ctx, &out->fsid); + unmarshal_4(ctx, &out->namelen); +} + +LM_FLATTEN static void unmarshal_Rrename(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rrename *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); +} + +LM_FLATTEN static void unmarshal_Rsetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsetattr *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); +} + +LM_FLATTEN static void unmarshal_Rxattrwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rxattrwalk *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_8(ctx, &out->attr_size); +} + +LM_FLATTEN static void unmarshal_Rxattrcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rxattrcreate *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); +} + +LM_FLATTEN static void unmarshal_Rreaddir(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rreaddir *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_4(ctx, &out->count); + out->data = ctx->extra; + ctx->extra += sizeof(out->data[0]) * out->count; + for (typeof(out->count) i = 0; i < out->count; i++) + unmarshal_1(ctx, &out->data[i]); +} + +LM_FLATTEN static void unmarshal_Rfsync(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rfsync *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); +} + +LM_FLATTEN static void unmarshal_Rlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlink *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); +} + +LM_FLATTEN static void unmarshal_Rrenameat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rrenameat *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); +} + +LM_FLATTEN static void unmarshal_Runlinkat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Runlinkat *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e LM_FLATTEN static void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsession *out) { memset(out, 0, sizeof(*out)); @@ -950,7 +1942,7 @@ LM_FLATTEN static void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9 } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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_Tread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tread *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -977,6 +1969,8 @@ LM_FLATTEN static void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9 unmarshal_fid(ctx, &out->fid); } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -985,6 +1979,54 @@ LM_FLATTEN static void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_ unmarshal_fid(ctx, &out->fid); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static void unmarshal_Tstatfs(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstatfs *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); +} + +LM_FLATTEN static void unmarshal_Tlopen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlopen *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_4(ctx, &out->flags); +} + +LM_FLATTEN static void unmarshal_Treadlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Treadlink *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); +} + +LM_FLATTEN static void unmarshal_Treaddir(struct _unmarshal_ctx *ctx, struct lib9p_msg_Treaddir *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_8(ctx, &out->offset); + unmarshal_4(ctx, &out->count); +} + +LM_FLATTEN static void unmarshal_Tfsync(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tfsync *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_4(ctx, &out->datasync); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -1003,7 +2045,7 @@ 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_e || CONFIG_9P_ENABLE_9P2000_u */ +#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)); @@ -1014,7 +2056,7 @@ LM_FLATTEN static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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; @@ -1033,6 +2075,8 @@ LM_FLATTEN static void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib unmarshal_s(ctx, &out->version); } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rerror *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -1040,10 +2084,12 @@ LM_FLATTEN static void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p unmarshal_tag(ctx, &out->tag); unmarshal_s(ctx, &out->ename); #if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->errno); + if ( is_ver(ctx, 9P2000_u) ) unmarshal_4(ctx, &out->errno); #endif /* CONFIG_9P_ENABLE_9P2000_u */ } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twalk *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -1058,7 +2104,104 @@ LM_FLATTEN static void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_ unmarshal_s(ctx, &out->wname[i]); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_L +LM_FLATTEN static void unmarshal_Trename(struct _unmarshal_ctx *ctx, struct lib9p_msg_Trename *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_fid(ctx, &out->dfid); + unmarshal_s(ctx, &out->name); +} + +LM_FLATTEN static void unmarshal_Rreadlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rreadlink *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_s(ctx, &out->target); +} + +LM_FLATTEN static void unmarshal_Txattrwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Txattrwalk *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_fid(ctx, &out->newfid); + unmarshal_s(ctx, &out->name); +} + +LM_FLATTEN static void unmarshal_Txattrcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Txattrcreate *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_s(ctx, &out->name); + unmarshal_8(ctx, &out->attr_size); + unmarshal_4(ctx, &out->flags); +} + +LM_FLATTEN static void unmarshal_Tgetlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tgetlock *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_1(ctx, &out->type); + unmarshal_8(ctx, &out->start); + unmarshal_8(ctx, &out->length); + unmarshal_4(ctx, &out->proc_id); + unmarshal_s(ctx, &out->client_id); +} + +LM_FLATTEN static void unmarshal_Rgetlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rgetlock *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_1(ctx, &out->type); + unmarshal_8(ctx, &out->start); + unmarshal_8(ctx, &out->length); + unmarshal_4(ctx, &out->proc_id); + unmarshal_s(ctx, &out->client_id); +} + +LM_FLATTEN static void unmarshal_Tlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlink *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->dfid); + unmarshal_fid(ctx, &out->fid); + unmarshal_s(ctx, &out->name); +} + +LM_FLATTEN static void unmarshal_Trenameat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Trenameat *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->olddirfid); + unmarshal_s(ctx, &out->oldname); + unmarshal_fid(ctx, &out->newdirfid); + unmarshal_s(ctx, &out->newname); +} + +LM_FLATTEN static void unmarshal_Tunlinkat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tunlinkat *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->dirfd); + unmarshal_s(ctx, &out->name); + unmarshal_4(ctx, &out->flags); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e LM_FLATTEN static void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsread *out) { memset(out, 0, sizeof(*out)); @@ -1088,7 +2231,7 @@ LM_FLATTEN static void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9 } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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) { memset(out, 0, sizeof(*out)); unmarshal_qt(ctx, &out->type); @@ -1104,9 +2247,9 @@ LM_FLATTEN static void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_ unmarshal_fid(ctx, &out->afid); unmarshal_s(ctx, &out->uname); unmarshal_s(ctx, &out->aname); -#if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_nuid(ctx, &out->n_uid); -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u + if ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) ) unmarshal_nuid(ctx, &out->n_uid); +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ } LM_FLATTEN static void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) { @@ -1118,11 +2261,51 @@ LM_FLATTEN static void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9 unmarshal_fid(ctx, &out->afid); unmarshal_s(ctx, &out->uname); unmarshal_s(ctx, &out->aname); -#if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_nuid(ctx, &out->n_uid); -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u + if ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) ) unmarshal_nuid(ctx, &out->n_uid); +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ +} + +#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_L +LM_FLATTEN static void unmarshal_Tlcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlcreate *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_s(ctx, &out->name); + unmarshal_4(ctx, &out->flags); + unmarshal_4(ctx, &out->mode); + unmarshal_nuid(ctx, &out->gid); +} + +LM_FLATTEN static void unmarshal_Tsymlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsymlink *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_s(ctx, &out->name); + unmarshal_s(ctx, &out->symtgt); + unmarshal_nuid(ctx, &out->gid); +} + +LM_FLATTEN static void unmarshal_Tmknod(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tmknod *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->dfid); + unmarshal_s(ctx, &out->name); + unmarshal_4(ctx, &out->mode); + unmarshal_4(ctx, &out->major); + unmarshal_4(ctx, &out->minor); + unmarshal_nuid(ctx, &out->gid); } +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -1143,6 +2326,58 @@ LM_FLATTEN static void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9 unmarshal_o(ctx, &out->mode); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static void unmarshal_Tgetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tgetattr *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_getattr(ctx, &out->request_mask); +} + +LM_FLATTEN static void unmarshal_Tsetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsetattr *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_setattr(ctx, &out->valid); + unmarshal_4(ctx, &out->mode); + unmarshal_nuid(ctx, &out->uid); + unmarshal_nuid(ctx, &out->gid); + unmarshal_8(ctx, &out->filesize); + unmarshal_8(ctx, &out->atime_sec); + unmarshal_8(ctx, &out->atime_nsec); + unmarshal_8(ctx, &out->mtime_sec); + unmarshal_8(ctx, &out->mtime_nsec); +} + +LM_FLATTEN static void unmarshal_Tlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlock *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_lock_type(ctx, &out->type); + unmarshal_lock_flags(ctx, &out->flags); + unmarshal_8(ctx, &out->start); + unmarshal_8(ctx, &out->length); + unmarshal_4(ctx, &out->proc_id); + unmarshal_s(ctx, &out->client_id); +} + +LM_FLATTEN static void unmarshal_Rlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlock *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_lock_status(ctx, &out->status); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#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)); ctx->net_offset += 2; @@ -1158,13 +2393,15 @@ LM_ALWAYS_INLINE static void unmarshal_stat(struct _unmarshal_ctx *ctx, struct l unmarshal_s(ctx, &out->file_owner_gid); unmarshal_s(ctx, &out->file_last_modified_uid); #if CONFIG_9P_ENABLE_9P2000_u - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_s(ctx, &out->file_extension); - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_nuid(ctx, &out->file_owner_n_uid); - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_nuid(ctx, &out->file_owner_n_gid); - if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_nuid(ctx, &out->file_last_modified_n_uid); + if ( is_ver(ctx, 9P2000_u) ) unmarshal_s(ctx, &out->file_extension); + if ( is_ver(ctx, 9P2000_u) ) unmarshal_nuid(ctx, &out->file_owner_n_uid); + if ( is_ver(ctx, 9P2000_u) ) unmarshal_nuid(ctx, &out->file_owner_n_gid); + if ( is_ver(ctx, 9P2000_u) ) unmarshal_nuid(ctx, &out->file_last_modified_n_uid); #endif /* CONFIG_9P_ENABLE_9P2000_u */ } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rauth *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -1193,6 +2430,8 @@ LM_FLATTEN static void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_ unmarshal_qid(ctx, &out->wqid[i]); } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -1211,6 +2450,79 @@ LM_FLATTEN static void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9 unmarshal_4(ctx, &out->iounit); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static void unmarshal_Rlopen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlopen *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_qid(ctx, &out->qid); + unmarshal_4(ctx, &out->iounit); +} + +LM_FLATTEN static void unmarshal_Rlcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlcreate *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_qid(ctx, &out->qid); + unmarshal_4(ctx, &out->iounit); +} + +LM_FLATTEN static void unmarshal_Rsymlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsymlink *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_qid(ctx, &out->qid); +} + +LM_FLATTEN static void unmarshal_Rmknod(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rmknod *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_qid(ctx, &out->qid); +} + +LM_FLATTEN static void unmarshal_Rgetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rgetattr *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_8(ctx, &out->valid); + unmarshal_qid(ctx, &out->qid); + unmarshal_4(ctx, &out->mode); + unmarshal_nuid(ctx, &out->uid); + unmarshal_nuid(ctx, &out->gid); + unmarshal_8(ctx, &out->nlink); + unmarshal_8(ctx, &out->rdev); + unmarshal_8(ctx, &out->filesize); + unmarshal_8(ctx, &out->blksize); + unmarshal_8(ctx, &out->blocks); + unmarshal_8(ctx, &out->atime_sec); + unmarshal_8(ctx, &out->atime_nsec); + unmarshal_8(ctx, &out->mtime_sec); + unmarshal_8(ctx, &out->mtime_nsec); + unmarshal_8(ctx, &out->ctime_sec); + unmarshal_8(ctx, &out->ctime_nsec); + unmarshal_8(ctx, &out->btime_sec); + unmarshal_8(ctx, &out->btime_nsec); + unmarshal_8(ctx, &out->gen); + unmarshal_8(ctx, &out->data_version); +} + +LM_FLATTEN static void unmarshal_Tmkdir(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tmkdir *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_qid(ctx, &out->qid); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -1273,7 +2585,7 @@ LM_ALWAYS_INLINE static bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) return false; } -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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 marshal_tag(struct _marshal_ctx *ctx, lib9p_tag_t *val) { return marshal_2(ctx, (uint16_t *)val); } @@ -1282,6 +2594,8 @@ LM_ALWAYS_INLINE static bool marshal_fid(struct _marshal_ctx *ctx, lib9p_fid_t * return marshal_4(ctx, (uint32_t *)val); } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *val) { return false || marshal_4(ctx, &val->len) @@ -1292,6 +2606,8 @@ LM_ALWAYS_INLINE static bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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 marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *val) { return false || marshal_2(ctx, &val->len) @@ -1302,29 +2618,60 @@ LM_ALWAYS_INLINE static bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s ; } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool marshal_dm(struct _marshal_ctx *ctx, lib9p_dm_t *val) { lib9p_dm_t masked_val = *val & dm_masks[ctx->ctx->version]; return marshal_4(ctx, (uint32_t *)&masked_val); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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 marshal_qt(struct _marshal_ctx *ctx, lib9p_qt_t *val) { lib9p_qt_t masked_val = *val & qt_masks[ctx->ctx->version]; return marshal_1(ctx, (uint8_t *)&masked_val); } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_u +#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_L || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool marshal_nuid(struct _marshal_ctx *ctx, lib9p_nuid_t *val) { return marshal_4(ctx, (uint32_t *)val); } -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_ALWAYS_INLINE static bool marshal_o(struct _marshal_ctx *ctx, lib9p_o_t *val) { lib9p_o_t masked_val = *val & o_masks[ctx->ctx->version]; return marshal_1(ctx, (uint8_t *)&masked_val); } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_ALWAYS_INLINE static bool marshal_getattr(struct _marshal_ctx *ctx, lib9p_getattr_t *val) { + lib9p_getattr_t masked_val = *val & getattr_masks[ctx->ctx->version]; + return marshal_8(ctx, (uint64_t *)&masked_val); +} + +LM_ALWAYS_INLINE static bool marshal_setattr(struct _marshal_ctx *ctx, lib9p_setattr_t *val) { + lib9p_setattr_t masked_val = *val & setattr_masks[ctx->ctx->version]; + return marshal_4(ctx, (uint32_t *)&masked_val); +} + +LM_ALWAYS_INLINE static bool marshal_lock_type(struct _marshal_ctx *ctx, lib9p_lock_type_t *val) { + return marshal_1(ctx, (uint8_t *)val); +} + +LM_ALWAYS_INLINE static bool marshal_lock_flags(struct _marshal_ctx *ctx, lib9p_lock_flags_t *val) { + lib9p_lock_flags_t masked_val = *val & lock_flags_masks[ctx->ctx->version]; + return marshal_4(ctx, (uint32_t *)&masked_val); +} + +LM_ALWAYS_INLINE static bool marshal_lock_status(struct _marshal_ctx *ctx, lib9p_lock_status_t *val) { + return marshal_1(ctx, (uint8_t *)val); +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1363,6 +2710,8 @@ LM_FLATTEN static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg ; } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1375,6 +2724,8 @@ LM_FLATTEN static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1387,6 +2738,8 @@ LM_FLATTEN static bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_ms ; } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1400,6 +2753,156 @@ LM_FLATTEN static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg } #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool marshal_Rlerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rlerror *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->ecode) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(7, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rstatfs(struct _marshal_ctx *ctx, struct lib9p_msg_Rstatfs *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->type) + || marshal_4(ctx, &val->bsize) + || marshal_8(ctx, &val->blocks) + || marshal_8(ctx, &val->bfree) + || marshal_8(ctx, &val->bavail) + || marshal_8(ctx, &val->files) + || 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; }) + ; +} + +LM_FLATTEN static bool marshal_Rrename(struct _marshal_ctx *ctx, struct lib9p_msg_Rrename *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(21, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rsetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Rsetattr *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(27, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rxattrwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rxattrwalk *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_8(ctx, &val->attr_size) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(31, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rxattrcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rxattrcreate *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(33, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rreaddir(struct _marshal_ctx *ctx, struct lib9p_msg_Rreaddir *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_4(ctx, &val->count) + || ({ bool err = false; + 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; }) + ; +} + +LM_FLATTEN static bool marshal_Rfsync(struct _marshal_ctx *ctx, struct lib9p_msg_Rfsync *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(51, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rlink *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(71, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rrenameat(struct _marshal_ctx *ctx, struct lib9p_msg_Rrenameat *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(75, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Runlinkat(struct _marshal_ctx *ctx, struct lib9p_msg_Runlinkat *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(77, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e LM_FLATTEN static bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession *val) { uint32_t _size_offset; @@ -1440,7 +2943,7 @@ LM_FLATTEN static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_ms } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1482,6 +2985,8 @@ LM_FLATTEN static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_ms ; } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1495,6 +3000,79 @@ LM_FLATTEN static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_ ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool marshal_Tstatfs(struct _marshal_ctx *ctx, struct lib9p_msg_Tstatfs *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(8, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Tlopen(struct _marshal_ctx *ctx, struct lib9p_msg_Tlopen *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_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; }) + ; +} + +LM_FLATTEN static bool marshal_Treadlink(struct _marshal_ctx *ctx, struct lib9p_msg_Treadlink *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(22, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Treaddir(struct _marshal_ctx *ctx, struct lib9p_msg_Treaddir *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_8(ctx, &val->offset) + || marshal_4(ctx, &val->count) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(40, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Tfsync(struct _marshal_ctx *ctx, struct lib9p_msg_Tfsync *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_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; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1523,7 +3101,7 @@ LM_FLATTEN static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg ; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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; @@ -1539,7 +3117,7 @@ LM_FLATTEN static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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; @@ -1568,6 +3146,8 @@ LM_FLATTEN static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_m ; } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1577,13 +3157,15 @@ LM_FLATTEN static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg || marshal_tag(ctx, &val->tag) || marshal_s(ctx, &val->ename) #if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->errno) ) + || ( 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; }) ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1603,7 +3185,149 @@ LM_FLATTEN static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_ ; } -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_L +LM_FLATTEN static bool marshal_Trename(struct _marshal_ctx *ctx, struct lib9p_msg_Trename *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_fid(ctx, &val->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; }) + ; +} + +LM_FLATTEN static bool marshal_Rreadlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rreadlink *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_s(ctx, &val->target) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(23, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Txattrwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Txattrwalk *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_fid(ctx, &val->newfid) + || marshal_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; }) + ; +} + +LM_FLATTEN static bool marshal_Txattrcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Txattrcreate *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_s(ctx, &val->name) + || marshal_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; }) + ; +} + +LM_FLATTEN static bool marshal_Tgetlock(struct _marshal_ctx *ctx, struct lib9p_msg_Tgetlock *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_1(ctx, &val->type) + || marshal_8(ctx, &val->start) + || 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; }) + ; +} + +LM_FLATTEN static bool marshal_Rgetlock(struct _marshal_ctx *ctx, struct lib9p_msg_Rgetlock *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_1(ctx, &val->type) + || marshal_8(ctx, &val->start) + || 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; }) + ; +} + +LM_FLATTEN static bool marshal_Tlink(struct _marshal_ctx *ctx, struct lib9p_msg_Tlink *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->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; }) + ; +} + +LM_FLATTEN static bool marshal_Trenameat(struct _marshal_ctx *ctx, struct lib9p_msg_Trenameat *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->olddirfid) + || 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; }) + ; +} + +LM_FLATTEN static bool marshal_Tunlinkat(struct _marshal_ctx *ctx, struct lib9p_msg_Tunlinkat *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->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; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e LM_FLATTEN static bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *val) { uint32_t _size_offset; @@ -1643,7 +3367,7 @@ LM_FLATTEN static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_ms } #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#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 marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) { return false || marshal_qt(ctx, &val->type) @@ -1662,9 +3386,9 @@ LM_FLATTEN static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_ || marshal_fid(ctx, &val->afid) || marshal_s(ctx, &val->uname) || marshal_s(ctx, &val->aname) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_nuid(ctx, &val->n_uid) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#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; }) ; @@ -1681,14 +3405,69 @@ LM_FLATTEN static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_ms || marshal_fid(ctx, &val->afid) || marshal_s(ctx, &val->uname) || marshal_s(ctx, &val->aname) -#if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_nuid(ctx, &val->n_uid) ) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#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; }) ; } +#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_L +LM_FLATTEN static bool marshal_Tlcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tlcreate *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_s(ctx, &val->name) + || marshal_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; }) + ; +} + +LM_FLATTEN static bool marshal_Tsymlink(struct _marshal_ctx *ctx, struct lib9p_msg_Tsymlink *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_s(ctx, &val->name) + || marshal_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; }) + ; +} + +LM_FLATTEN static bool marshal_Tmknod(struct _marshal_ctx *ctx, struct lib9p_msg_Tmknod *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->dfid) + || marshal_s(ctx, &val->name) + || marshal_4(ctx, &val->mode) + || 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; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1719,6 +3498,78 @@ LM_FLATTEN static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_ms ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool marshal_Tgetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Tgetattr *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_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; }) + ; +} + +LM_FLATTEN static bool marshal_Tsetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Tsetattr *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_setattr(ctx, &val->valid) + || marshal_4(ctx, &val->mode) + || marshal_nuid(ctx, &val->uid) + || marshal_nuid(ctx, &val->gid) + || marshal_8(ctx, &val->filesize) + || marshal_8(ctx, &val->atime_sec) + || 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; }) + ; +} + +LM_FLATTEN static bool marshal_Tlock(struct _marshal_ctx *ctx, struct lib9p_msg_Tlock *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_lock_type(ctx, &val->type) + || marshal_lock_flags(ctx, &val->flags) + || marshal_8(ctx, &val->start) + || 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; }) + ; +} + +LM_FLATTEN static bool marshal_Rlock(struct _marshal_ctx *ctx, struct lib9p_msg_Rlock *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_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; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#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; uint32_t _kern_type_offset; @@ -1736,15 +3587,17 @@ LM_ALWAYS_INLINE static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p || marshal_s(ctx, &val->file_owner_gid) || marshal_s(ctx, &val->file_last_modified_uid) #if CONFIG_9P_ENABLE_9P2000_u - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_s(ctx, &val->file_extension) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_nuid(ctx, &val->file_owner_n_uid) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_nuid(ctx, &val->file_owner_n_gid) ) - || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_nuid(ctx, &val->file_last_modified_n_uid) ) + || ( is_ver(ctx, 9P2000_u) && marshal_s(ctx, &val->file_extension) ) + || ( is_ver(ctx, 9P2000_u) && marshal_nuid(ctx, &val->file_owner_n_uid) ) + || ( 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; }) ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1788,6 +3641,8 @@ LM_FLATTEN static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_ ; } +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1816,6 +3671,109 @@ LM_FLATTEN static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_ms ; } +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +LM_FLATTEN static bool marshal_Rlopen(struct _marshal_ctx *ctx, struct lib9p_msg_Rlopen *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_qid(ctx, &val->qid) + || marshal_4(ctx, &val->iounit) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(13, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rlcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rlcreate *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_qid(ctx, &val->qid) + || marshal_4(ctx, &val->iounit) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(15, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rsymlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rsymlink *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_qid(ctx, &val->qid) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(17, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rmknod(struct _marshal_ctx *ctx, struct lib9p_msg_Rmknod *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_qid(ctx, &val->qid) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(19, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +LM_FLATTEN static bool marshal_Rgetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Rgetattr *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_8(ctx, &val->valid) + || marshal_qid(ctx, &val->qid) + || marshal_4(ctx, &val->mode) + || marshal_nuid(ctx, &val->uid) + || marshal_nuid(ctx, &val->gid) + || marshal_8(ctx, &val->nlink) + || marshal_8(ctx, &val->rdev) + || marshal_8(ctx, &val->filesize) + || marshal_8(ctx, &val->blksize) + || marshal_8(ctx, &val->blocks) + || marshal_8(ctx, &val->atime_sec) + || marshal_8(ctx, &val->atime_nsec) + || marshal_8(ctx, &val->mtime_sec) + || marshal_8(ctx, &val->mtime_nsec) + || marshal_8(ctx, &val->ctime_sec) + || marshal_8(ctx, &val->ctime_nsec) + || marshal_8(ctx, &val->btime_sec) + || 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; }) + ; +} + +LM_FLATTEN static bool marshal_Tmkdir(struct _marshal_ctx *ctx, struct lib9p_msg_Tmkdir *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_qid(ctx, &val->qid) + || ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; }) + || ({ encode_u8le(73, &ctx->net_bytes[_typ_offset]); false; }) + ; +} + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u LM_FLATTEN static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -1900,6 +3858,65 @@ const char * _lib9p_table_msg_name[LIB9P_VER_NUM][0x100] = { _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), @@ -1991,6 +4008,37 @@ const struct _lib9p_recv_tentry _lib9p_table_Tmsg_recv[LIB9P_VER_NUM][0x80] = { _MSG_RECV(Twstat), }, #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = { + _MSG_RECV(Tstatfs), + _MSG_RECV(Tlopen), + _MSG_RECV(Tlcreate), + _MSG_RECV(Tsymlink), + _MSG_RECV(Tmknod), + _MSG_RECV(Trename), + _MSG_RECV(Treadlink), + _MSG_RECV(Tgetattr), + _MSG_RECV(Tsetattr), + _MSG_RECV(Txattrwalk), + _MSG_RECV(Txattrcreate), + _MSG_RECV(Treaddir), + _MSG_RECV(Tfsync), + _MSG_RECV(Tlock), + _MSG_RECV(Tgetlock), + _MSG_RECV(Tlink), + _MSG_RECV(Trenameat), + _MSG_RECV(Tunlinkat), + _MSG_RECV(Tversion), + _MSG_RECV(Tauth), + _MSG_RECV(Tattach), + _MSG_RECV(Tflush), + _MSG_RECV(Twalk), + _MSG_RECV(Tread), + _MSG_RECV(Twrite), + _MSG_RECV(Tclunk), + _MSG_RECV(Tremove), + }, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = { _MSG_RECV(Tversion), @@ -2053,6 +4101,38 @@ const struct _lib9p_recv_tentry _lib9p_table_Rmsg_recv[LIB9P_VER_NUM][0x80] = { _MSG_RECV(Rwstat), }, #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = { + _MSG_RECV(Rlerror), + _MSG_RECV(Rstatfs), + _MSG_RECV(Rlopen), + _MSG_RECV(Rlcreate), + _MSG_RECV(Rsymlink), + _MSG_RECV(Rmknod), + _MSG_RECV(Rrename), + _MSG_RECV(Rreadlink), + _MSG_RECV(Rgetattr), + _MSG_RECV(Rsetattr), + _MSG_RECV(Rxattrwalk), + _MSG_RECV(Rxattrcreate), + _MSG_RECV(Rreaddir), + _MSG_RECV(Rfsync), + _MSG_RECV(Rlock), + _MSG_RECV(Rgetlock), + _MSG_RECV(Rlink), + _MSG_RECV(Tmkdir), + _MSG_RECV(Rrenameat), + _MSG_RECV(Runlinkat), + _MSG_RECV(Rversion), + _MSG_RECV(Rauth), + _MSG_RECV(Rattach), + _MSG_RECV(Rflush), + _MSG_RECV(Rwalk), + _MSG_RECV(Rread), + _MSG_RECV(Rwrite), + _MSG_RECV(Rremove), + }, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = { _MSG_RECV(Rversion), @@ -2115,6 +4195,37 @@ const struct _lib9p_send_tentry _lib9p_table_Tmsg_send[LIB9P_VER_NUM][0x80] = { _MSG_SEND(Twstat), }, #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = { + _MSG_SEND(Tstatfs), + _MSG_SEND(Tlopen), + _MSG_SEND(Tlcreate), + _MSG_SEND(Tsymlink), + _MSG_SEND(Tmknod), + _MSG_SEND(Trename), + _MSG_SEND(Treadlink), + _MSG_SEND(Tgetattr), + _MSG_SEND(Tsetattr), + _MSG_SEND(Txattrwalk), + _MSG_SEND(Txattrcreate), + _MSG_SEND(Treaddir), + _MSG_SEND(Tfsync), + _MSG_SEND(Tlock), + _MSG_SEND(Tgetlock), + _MSG_SEND(Tlink), + _MSG_SEND(Trenameat), + _MSG_SEND(Tunlinkat), + _MSG_SEND(Tversion), + _MSG_SEND(Tauth), + _MSG_SEND(Tattach), + _MSG_SEND(Tflush), + _MSG_SEND(Twalk), + _MSG_SEND(Tread), + _MSG_SEND(Twrite), + _MSG_SEND(Tclunk), + _MSG_SEND(Tremove), + }, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = { _MSG_SEND(Tversion), @@ -2177,6 +4288,38 @@ const struct _lib9p_send_tentry _lib9p_table_Rmsg_send[LIB9P_VER_NUM][0x80] = { _MSG_SEND(Rwstat), }, #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + [LIB9P_VER_9P2000_L] = { + _MSG_SEND(Rlerror), + _MSG_SEND(Rstatfs), + _MSG_SEND(Rlopen), + _MSG_SEND(Rlcreate), + _MSG_SEND(Rsymlink), + _MSG_SEND(Rmknod), + _MSG_SEND(Rrename), + _MSG_SEND(Rreadlink), + _MSG_SEND(Rgetattr), + _MSG_SEND(Rsetattr), + _MSG_SEND(Rxattrwalk), + _MSG_SEND(Rxattrcreate), + _MSG_SEND(Rreaddir), + _MSG_SEND(Rfsync), + _MSG_SEND(Rlock), + _MSG_SEND(Rgetlock), + _MSG_SEND(Rlink), + _MSG_SEND(Tmkdir), + _MSG_SEND(Rrenameat), + _MSG_SEND(Runlinkat), + _MSG_SEND(Rversion), + _MSG_SEND(Rauth), + _MSG_SEND(Rattach), + _MSG_SEND(Rflush), + _MSG_SEND(Rwalk), + _MSG_SEND(Rread), + _MSG_SEND(Rwrite), + _MSG_SEND(Rremove), + }, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e [LIB9P_VER_9P2000_e] = { _MSG_SEND(Rversion), diff --git a/lib9p/idl.gen b/lib9p/idl.gen index 31f6527..47ca49a 100755 --- a/lib9p/idl.gen +++ b/lib9p/idl.gen @@ -62,7 +62,8 @@ def c_ver_ifdef(versions: set[str]) -> str: def c_ver_cond(versions: set[str]) -> str: if len(versions) == 1: - return f"(ctx->ctx->version=={c_ver_enum(next(v for v in versions))})" + v = next(v for v in versions) + return f"is_ver(ctx, {v.replace('.', '_')})" return "( " + (" || ".join(c_ver_cond({v}) for v in sorted(versions))) + " )" @@ -318,12 +319,32 @@ def gen_c(versions: set[str], typs: list[idl.Type]) -> str: #include "internal.h" """ + # utilities ################################################################ + ret += f""" +/* utilities ******************************************************************/ +""" + def used(arg: str) -> str: return arg def unused(arg: str) -> str: return f"LM_UNUSED({arg})" + ret += "\n" + ret += "/**\n" + ret += f" * is_ver(ctx, ver) is essentially `(ctx->ctx->version == {idprefix.upper()}VER_##ver)`,\n" + ret += f" * but compiles correctly (to `false`) even if `{idprefix.upper()}VER_##ver` isn't defined\n" + ret += " * (because `!CONFIG_9P_ENABLE_##ver`). This is useful when `||`ing\n" + ret += " * several version checks together.\n" + ret += " */\n" + ret += "#define is_ver(ctx, ver) _is_ver_##ver(ctx->ctx->version)\n" + for v in sorted(versions): + ret += f"#if CONFIG_9P_ENABLE_{v.replace('.', '_')}\n" + ret += f"\t#define _is_ver_{v.replace('.', '_')}(v) (v == {c_ver_enum(v)})\n" + ret += "#else\n" + ret += f"\t#define _is_ver_{v.replace('.', '_')}(v) false\n" + ret += "#endif\n" + # strings ################################################################## ret += f""" /* strings ********************************************************************/ diff --git a/lib9p/idl/2010-9P2000.L.9p.wip b/lib9p/idl/2010-9P2000.L.9p index 972e7d0..972e7d0 100644 --- a/lib9p/idl/2010-9P2000.L.9p.wip +++ b/lib9p/idl/2010-9P2000.L.9p diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h index 3bc77c4..cf30e00 100644 --- a/lib9p/include/lib9p/9p.generated.h +++ b/lib9p/include/lib9p/9p.generated.h @@ -1,4 +1,4 @@ -/* Generated by `lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ +/* Generated by `lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ #ifndef _LIB9P_9P_H_ #error Do not include <lib9p/9p.generated.h> directly; include <lib9p/9p.h> instead @@ -14,6 +14,10 @@ #error config.h must define CONFIG_9P_ENABLE_9P2000 #endif +#ifndef CONFIG_9P_ENABLE_9P2000_L + #error config.h must define CONFIG_9P_ENABLE_9P2000_L +#endif + #ifndef CONFIG_9P_ENABLE_9P2000_e #error config.h must define CONFIG_9P_ENABLE_9P2000_e #endif @@ -29,6 +33,9 @@ enum lib9p_version { #if CONFIG_9P_ENABLE_9P2000 LIB9P_VER_9P2000, /* "9P2000" */ #endif /* CONFIG_9P_ENABLE_9P2000 */ +#if CONFIG_9P_ENABLE_9P2000_L + LIB9P_VER_9P2000_L, /* "9P2000.L" */ +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e LIB9P_VER_9P2000_e, /* "9P2000.e" */ #endif /* CONFIG_9P_ENABLE_9P2000_e */ @@ -43,64 +50,124 @@ const char *lib9p_version_str(enum lib9p_version); /* enum msg_type **************************************************************/ enum lib9p_msg_type { /* uint8_t */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u + LIB9P_TYP_Tversion = 100, + LIB9P_TYP_Rversion = 101, + LIB9P_TYP_Tauth = 102, + LIB9P_TYP_Rauth = 103, + LIB9P_TYP_Tattach = 104, + LIB9P_TYP_Rattach = 105, +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u + LIB9P_TYP_Rerror = 107, +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u + LIB9P_TYP_Tflush = 108, + LIB9P_TYP_Rflush = 109, + LIB9P_TYP_Twalk = 110, + LIB9P_TYP_Rwalk = 111, +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u + LIB9P_TYP_Topen = 112, + LIB9P_TYP_Ropen = 113, + LIB9P_TYP_Tcreate = 114, + LIB9P_TYP_Rcreate = 115, +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u + LIB9P_TYP_Tread = 116, + LIB9P_TYP_Rread = 117, + LIB9P_TYP_Twrite = 118, + LIB9P_TYP_Rwrite = 119, + LIB9P_TYP_Tclunk = 120, +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u - LIB9P_TYP_Tversion = 100, - LIB9P_TYP_Rversion = 101, - LIB9P_TYP_Tauth = 102, - LIB9P_TYP_Rauth = 103, - LIB9P_TYP_Tattach = 104, - LIB9P_TYP_Rattach = 105, - LIB9P_TYP_Rerror = 107, - LIB9P_TYP_Tflush = 108, - LIB9P_TYP_Rflush = 109, - LIB9P_TYP_Twalk = 110, - LIB9P_TYP_Rwalk = 111, - LIB9P_TYP_Topen = 112, - LIB9P_TYP_Ropen = 113, - LIB9P_TYP_Tcreate = 114, - LIB9P_TYP_Rcreate = 115, - LIB9P_TYP_Tread = 116, - LIB9P_TYP_Rread = 117, - LIB9P_TYP_Twrite = 118, - LIB9P_TYP_Rwrite = 119, - LIB9P_TYP_Tclunk = 120, - LIB9P_TYP_Rclunk = 121, - LIB9P_TYP_Tremove = 122, - LIB9P_TYP_Rremove = 123, - LIB9P_TYP_Tstat = 124, - LIB9P_TYP_Rstat = 125, - LIB9P_TYP_Twstat = 126, - LIB9P_TYP_Rwstat = 127, + LIB9P_TYP_Rclunk = 121, #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u + LIB9P_TYP_Tremove = 122, + LIB9P_TYP_Rremove = 123, +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u + LIB9P_TYP_Tstat = 124, + LIB9P_TYP_Rstat = 125, + LIB9P_TYP_Twstat = 126, + LIB9P_TYP_Rwstat = 127, +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L + LIB9P_TYP_Rlerror = 7, + LIB9P_TYP_Tstatfs = 8, + LIB9P_TYP_Rstatfs = 9, + LIB9P_TYP_Tlopen = 12, + LIB9P_TYP_Rlopen = 13, + LIB9P_TYP_Tlcreate = 14, + LIB9P_TYP_Rlcreate = 15, + LIB9P_TYP_Tsymlink = 16, + LIB9P_TYP_Rsymlink = 17, + LIB9P_TYP_Tmknod = 18, + LIB9P_TYP_Rmknod = 19, + LIB9P_TYP_Trename = 20, + LIB9P_TYP_Rrename = 21, + LIB9P_TYP_Treadlink = 22, + LIB9P_TYP_Rreadlink = 23, + LIB9P_TYP_Tgetattr = 24, + LIB9P_TYP_Rgetattr = 25, + LIB9P_TYP_Tsetattr = 26, + LIB9P_TYP_Rsetattr = 27, + LIB9P_TYP_Txattrwalk = 30, + LIB9P_TYP_Rxattrwalk = 31, + LIB9P_TYP_Txattrcreate = 32, + LIB9P_TYP_Rxattrcreate = 33, + LIB9P_TYP_Treaddir = 40, + LIB9P_TYP_Rreaddir = 41, + LIB9P_TYP_Tfsync = 50, + LIB9P_TYP_Rfsync = 51, + LIB9P_TYP_Tlock = 52, + LIB9P_TYP_Rlock = 53, + LIB9P_TYP_Tgetlock = 54, + LIB9P_TYP_Rgetlock = 55, + LIB9P_TYP_Tlink = 70, + LIB9P_TYP_Rlink = 71, + LIB9P_TYP_Tmkdir = 73, + LIB9P_TYP_Trenameat = 74, + LIB9P_TYP_Rrenameat = 75, + LIB9P_TYP_Tunlinkat = 76, + LIB9P_TYP_Runlinkat = 77, +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e - LIB9P_TYP_Tsession = 150, - LIB9P_TYP_Rsession = 151, - LIB9P_TYP_Tsread = 152, - LIB9P_TYP_Rsread = 153, - LIB9P_TYP_Tswrite = 154, - LIB9P_TYP_Rswrite = 155, + LIB9P_TYP_Tsession = 150, + LIB9P_TYP_Rsession = 151, + LIB9P_TYP_Tsread = 152, + LIB9P_TYP_Rsread = 153, + LIB9P_TYP_Tswrite = 154, + LIB9P_TYP_Rswrite = 155, #endif /* CONFIG_9P_ENABLE_9P2000_e */ }; /* payload types **************************************************************/ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u typedef uint16_t lib9p_tag_t; #define LIB9P_TAG_NOTAG ((lib9p_tag_t)UINT16_C(~0)) typedef uint32_t lib9p_fid_t; #define LIB9P_FID_NOFID ((lib9p_fid_t)UINT32_C(~0)) +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_d { uint32_t len; char *dat; }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_s { uint16_t len; char *utf8; }; +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u typedef uint32_t lib9p_dm_t; #define LIB9P_DM_DIR ((lib9p_dm_t)(1<<31)) @@ -142,6 +209,8 @@ typedef uint32_t lib9p_dm_t; #define LIB9P_DM_PERM_MASK ((lib9p_dm_t)(0777)) +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u typedef uint8_t lib9p_qt_t; #define LIB9P_QT_DIR ((lib9p_qt_t)(1<<7)) @@ -157,12 +226,12 @@ typedef uint8_t lib9p_qt_t; #define LIB9P_QT_FILE ((lib9p_qt_t)(0)) -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ -#if CONFIG_9P_ENABLE_9P2000_u +#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_L || CONFIG_9P_ENABLE_9P2000_u typedef uint32_t lib9p_nuid_t; #define LIB9P_NUID_NONUID ((lib9p_nuid_t)UINT32_C(~0)) -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u typedef uint8_t lib9p_o_t; @@ -182,6 +251,163 @@ typedef uint8_t lib9p_o_t; #define LIB9P_O_MODE_MASK ((lib9p_o_t)(0b00000011)) #define LIB9P_O_FLAG_MASK ((lib9p_o_t)(0b11111100)) +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +typedef uint64_t lib9p_getattr_t; + +/* unused ((lib9p_getattr_t)(1<<63)) */ +/* unused ((lib9p_getattr_t)(1<<62)) */ +/* unused ((lib9p_getattr_t)(1<<61)) */ +/* unused ((lib9p_getattr_t)(1<<60)) */ +/* unused ((lib9p_getattr_t)(1<<59)) */ +/* unused ((lib9p_getattr_t)(1<<58)) */ +/* unused ((lib9p_getattr_t)(1<<57)) */ +/* unused ((lib9p_getattr_t)(1<<56)) */ +/* unused ((lib9p_getattr_t)(1<<55)) */ +/* unused ((lib9p_getattr_t)(1<<54)) */ +/* unused ((lib9p_getattr_t)(1<<53)) */ +/* unused ((lib9p_getattr_t)(1<<52)) */ +/* unused ((lib9p_getattr_t)(1<<51)) */ +/* unused ((lib9p_getattr_t)(1<<50)) */ +/* unused ((lib9p_getattr_t)(1<<49)) */ +/* unused ((lib9p_getattr_t)(1<<48)) */ +/* unused ((lib9p_getattr_t)(1<<47)) */ +/* unused ((lib9p_getattr_t)(1<<46)) */ +/* unused ((lib9p_getattr_t)(1<<45)) */ +/* unused ((lib9p_getattr_t)(1<<44)) */ +/* unused ((lib9p_getattr_t)(1<<43)) */ +/* unused ((lib9p_getattr_t)(1<<42)) */ +/* unused ((lib9p_getattr_t)(1<<41)) */ +/* unused ((lib9p_getattr_t)(1<<40)) */ +/* unused ((lib9p_getattr_t)(1<<39)) */ +/* unused ((lib9p_getattr_t)(1<<38)) */ +/* unused ((lib9p_getattr_t)(1<<37)) */ +/* unused ((lib9p_getattr_t)(1<<36)) */ +/* unused ((lib9p_getattr_t)(1<<35)) */ +/* unused ((lib9p_getattr_t)(1<<34)) */ +/* unused ((lib9p_getattr_t)(1<<33)) */ +/* unused ((lib9p_getattr_t)(1<<32)) */ +/* unused ((lib9p_getattr_t)(1<<31)) */ +/* unused ((lib9p_getattr_t)(1<<30)) */ +/* unused ((lib9p_getattr_t)(1<<29)) */ +/* unused ((lib9p_getattr_t)(1<<28)) */ +/* unused ((lib9p_getattr_t)(1<<27)) */ +/* unused ((lib9p_getattr_t)(1<<26)) */ +/* unused ((lib9p_getattr_t)(1<<25)) */ +/* unused ((lib9p_getattr_t)(1<<24)) */ +/* unused ((lib9p_getattr_t)(1<<23)) */ +/* unused ((lib9p_getattr_t)(1<<22)) */ +/* unused ((lib9p_getattr_t)(1<<21)) */ +/* unused ((lib9p_getattr_t)(1<<20)) */ +/* unused ((lib9p_getattr_t)(1<<19)) */ +/* unused ((lib9p_getattr_t)(1<<18)) */ +/* unused ((lib9p_getattr_t)(1<<17)) */ +/* unused ((lib9p_getattr_t)(1<<16)) */ +/* unused ((lib9p_getattr_t)(1<<15)) */ +/* unused ((lib9p_getattr_t)(1<<14)) */ +#define LIB9P_GETATTR_DATA_VERSION ((lib9p_getattr_t)(1<<13)) +#define LIB9P_GETATTR_GEN ((lib9p_getattr_t)(1<<12)) +#define LIB9P_GETATTR_BTIME ((lib9p_getattr_t)(1<<11)) +#define LIB9P_GETATTR_BLOCKS ((lib9p_getattr_t)(1<<10)) +#define LIB9P_GETATTR_SIZE ((lib9p_getattr_t)(1<<9)) +#define LIB9P_GETATTR_INO ((lib9p_getattr_t)(1<<8)) +#define LIB9P_GETATTR_CTIME ((lib9p_getattr_t)(1<<7)) +#define LIB9P_GETATTR_MTIME ((lib9p_getattr_t)(1<<6)) +#define LIB9P_GETATTR_ATIME ((lib9p_getattr_t)(1<<5)) +#define LIB9P_GETATTR_RDEV ((lib9p_getattr_t)(1<<4)) +#define LIB9P_GETATTR_GID ((lib9p_getattr_t)(1<<3)) +#define LIB9P_GETATTR_UID ((lib9p_getattr_t)(1<<2)) +#define LIB9P_GETATTR_NLINK ((lib9p_getattr_t)(1<<1)) +#define LIB9P_GETATTR_MODE ((lib9p_getattr_t)(1<<0)) + +#define LIB9P_GETATTR_BASIC ((lib9p_getattr_t)(0x000007ff)) +#define LIB9P_GETATTR_ALL ((lib9p_getattr_t)(0x00003fff)) + +typedef uint32_t lib9p_setattr_t; + +/* unused ((lib9p_setattr_t)(1<<31)) */ +/* unused ((lib9p_setattr_t)(1<<30)) */ +/* unused ((lib9p_setattr_t)(1<<29)) */ +/* unused ((lib9p_setattr_t)(1<<28)) */ +/* unused ((lib9p_setattr_t)(1<<27)) */ +/* unused ((lib9p_setattr_t)(1<<26)) */ +/* unused ((lib9p_setattr_t)(1<<25)) */ +/* unused ((lib9p_setattr_t)(1<<24)) */ +/* unused ((lib9p_setattr_t)(1<<23)) */ +/* unused ((lib9p_setattr_t)(1<<22)) */ +/* unused ((lib9p_setattr_t)(1<<21)) */ +/* unused ((lib9p_setattr_t)(1<<20)) */ +/* unused ((lib9p_setattr_t)(1<<19)) */ +/* unused ((lib9p_setattr_t)(1<<18)) */ +/* unused ((lib9p_setattr_t)(1<<17)) */ +/* unused ((lib9p_setattr_t)(1<<16)) */ +/* unused ((lib9p_setattr_t)(1<<15)) */ +/* unused ((lib9p_setattr_t)(1<<14)) */ +/* unused ((lib9p_setattr_t)(1<<13)) */ +/* unused ((lib9p_setattr_t)(1<<12)) */ +/* unused ((lib9p_setattr_t)(1<<11)) */ +/* unused ((lib9p_setattr_t)(1<<10)) */ +/* unused ((lib9p_setattr_t)(1<<9)) */ +#define LIB9P_SETATTR_MTIME_SET ((lib9p_setattr_t)(1<<8)) +#define LIB9P_SETATTR_ATIME_SET ((lib9p_setattr_t)(1<<7)) +#define LIB9P_SETATTR_CTIME ((lib9p_setattr_t)(1<<6)) +#define LIB9P_SETATTR_MTIME ((lib9p_setattr_t)(1<<5)) +#define LIB9P_SETATTR_ATIME ((lib9p_setattr_t)(1<<4)) +#define LIB9P_SETATTR_SIZE ((lib9p_setattr_t)(1<<3)) +#define LIB9P_SETATTR_GID ((lib9p_setattr_t)(1<<2)) +#define LIB9P_SETATTR_UID ((lib9p_setattr_t)(1<<1)) +#define LIB9P_SETATTR_MODE ((lib9p_setattr_t)(1<<0)) + + +typedef uint8_t lib9p_lock_type_t; +#define LIB9P_LOCK_TYPE_RDLCK ((lib9p_lock_type_t)UINT8_C(0)) +#define LIB9P_LOCK_TYPE_WRLCK ((lib9p_lock_type_t)UINT8_C(1)) +#define LIB9P_LOCK_TYPE_UNLCK ((lib9p_lock_type_t)UINT8_C(2)) + +typedef uint32_t lib9p_lock_flags_t; + +/* unused ((lib9p_lock_flags_t)(1<<31)) */ +/* unused ((lib9p_lock_flags_t)(1<<30)) */ +/* unused ((lib9p_lock_flags_t)(1<<29)) */ +/* unused ((lib9p_lock_flags_t)(1<<28)) */ +/* unused ((lib9p_lock_flags_t)(1<<27)) */ +/* unused ((lib9p_lock_flags_t)(1<<26)) */ +/* unused ((lib9p_lock_flags_t)(1<<25)) */ +/* unused ((lib9p_lock_flags_t)(1<<24)) */ +/* unused ((lib9p_lock_flags_t)(1<<23)) */ +/* unused ((lib9p_lock_flags_t)(1<<22)) */ +/* unused ((lib9p_lock_flags_t)(1<<21)) */ +/* unused ((lib9p_lock_flags_t)(1<<20)) */ +/* unused ((lib9p_lock_flags_t)(1<<19)) */ +/* unused ((lib9p_lock_flags_t)(1<<18)) */ +/* unused ((lib9p_lock_flags_t)(1<<17)) */ +/* unused ((lib9p_lock_flags_t)(1<<16)) */ +/* unused ((lib9p_lock_flags_t)(1<<15)) */ +/* unused ((lib9p_lock_flags_t)(1<<14)) */ +/* unused ((lib9p_lock_flags_t)(1<<13)) */ +/* unused ((lib9p_lock_flags_t)(1<<12)) */ +/* unused ((lib9p_lock_flags_t)(1<<11)) */ +/* unused ((lib9p_lock_flags_t)(1<<10)) */ +/* unused ((lib9p_lock_flags_t)(1<<9)) */ +/* unused ((lib9p_lock_flags_t)(1<<8)) */ +/* unused ((lib9p_lock_flags_t)(1<<7)) */ +/* unused ((lib9p_lock_flags_t)(1<<6)) */ +/* unused ((lib9p_lock_flags_t)(1<<5)) */ +/* unused ((lib9p_lock_flags_t)(1<<4)) */ +/* unused ((lib9p_lock_flags_t)(1<<3)) */ +/* unused ((lib9p_lock_flags_t)(1<<2)) */ +#define LIB9P_LOCK_FLAGS_RECLAIM ((lib9p_lock_flags_t)(1<<1)) +#define LIB9P_LOCK_FLAGS_BLOCK ((lib9p_lock_flags_t)(1<<0)) + + +typedef uint8_t lib9p_lock_status_t; +#define LIB9P_LOCK_STATUS_SUCCESS ((lib9p_lock_status_t)UINT8_C(0)) +#define LIB9P_LOCK_STATUS_BLOCKED ((lib9p_lock_status_t)UINT8_C(1)) +#define LIB9P_LOCK_STATUS_ERROR ((lib9p_lock_status_t)UINT8_C(2)) +#define LIB9P_LOCK_STATUS_GRACE ((lib9p_lock_status_t)UINT8_C(3)) + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Tflush { lib9p_tag_t tag; uint16_t oldtag; @@ -196,19 +422,84 @@ struct lib9p_msg_Rwrite { uint32_t count; }; +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Rclunk { lib9p_tag_t tag; }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Rremove { lib9p_tag_t tag; }; +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Rwstat { lib9p_tag_t tag; }; #endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +struct lib9p_msg_Rlerror { + lib9p_tag_t tag; + uint32_t ecode; +}; + +struct lib9p_msg_Rstatfs { + lib9p_tag_t tag; + uint32_t type; + uint32_t bsize; + uint64_t blocks; + uint64_t bfree; + uint64_t bavail; + uint64_t files; + uint64_t ffree; + uint64_t fsid; + uint32_t namelen; +}; + +struct lib9p_msg_Rrename { + lib9p_tag_t tag; +}; + +struct lib9p_msg_Rsetattr { + lib9p_tag_t tag; +}; + +struct lib9p_msg_Rxattrwalk { + lib9p_tag_t tag; + uint64_t attr_size; +}; + +struct lib9p_msg_Rxattrcreate { + lib9p_tag_t tag; +}; + +struct lib9p_msg_Rreaddir { + lib9p_tag_t tag; + uint32_t count; + uint8_t *data; +}; + +struct lib9p_msg_Rfsync { + lib9p_tag_t tag; +}; + +struct lib9p_msg_Rlink { + lib9p_tag_t tag; +}; + +struct lib9p_msg_Rrenameat { + lib9p_tag_t tag; +}; + +struct lib9p_msg_Runlinkat { + lib9p_tag_t tag; +}; + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e struct lib9p_msg_Tsession { lib9p_tag_t tag; @@ -225,7 +516,7 @@ struct lib9p_msg_Rswrite { }; #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Tread { lib9p_tag_t tag; lib9p_fid_t fid; @@ -243,11 +534,46 @@ struct lib9p_msg_Tremove { lib9p_fid_t fid; }; +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Tstat { lib9p_tag_t tag; lib9p_fid_t fid; }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +struct lib9p_msg_Tstatfs { + lib9p_tag_t tag; + lib9p_fid_t fid; +}; + +struct lib9p_msg_Tlopen { + lib9p_tag_t tag; + lib9p_fid_t fid; + uint32_t flags; +}; + +struct lib9p_msg_Treadlink { + lib9p_tag_t tag; + lib9p_fid_t fid; +}; + +struct lib9p_msg_Treaddir { + lib9p_tag_t tag; + lib9p_fid_t fid; + uint64_t offset; + uint32_t count; +}; + +struct lib9p_msg_Tfsync { + lib9p_tag_t tag; + lib9p_fid_t fid; + uint32_t datasync; +}; + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Rread { lib9p_tag_t tag; struct lib9p_d data; @@ -260,7 +586,7 @@ struct lib9p_msg_Twrite { struct lib9p_d data; }; -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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 struct lib9p_msg_Rsread { lib9p_tag_t tag; @@ -268,7 +594,7 @@ struct lib9p_msg_Rsread { }; #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Tversion { lib9p_tag_t tag; uint32_t max_msg_size; @@ -281,6 +607,8 @@ struct lib9p_msg_Rversion { struct lib9p_s version; }; +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Rerror { lib9p_tag_t tag; struct lib9p_s ename; @@ -289,6 +617,8 @@ struct lib9p_msg_Rerror { #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Twalk { lib9p_tag_t tag; lib9p_fid_t fid; @@ -297,7 +627,77 @@ struct lib9p_msg_Twalk { struct lib9p_s *wname; }; -#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#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_L +struct lib9p_msg_Trename { + lib9p_tag_t tag; + lib9p_fid_t fid; + lib9p_fid_t dfid; + struct lib9p_s name; +}; + +struct lib9p_msg_Rreadlink { + lib9p_tag_t tag; + struct lib9p_s target; +}; + +struct lib9p_msg_Txattrwalk { + lib9p_tag_t tag; + lib9p_fid_t fid; + lib9p_fid_t newfid; + struct lib9p_s name; +}; + +struct lib9p_msg_Txattrcreate { + lib9p_tag_t tag; + lib9p_fid_t fid; + struct lib9p_s name; + uint64_t attr_size; + uint32_t flags; +}; + +struct lib9p_msg_Tgetlock { + lib9p_tag_t tag; + lib9p_fid_t fid; + uint8_t type; + uint64_t start; + uint64_t length; + uint32_t proc_id; + struct lib9p_s client_id; +}; + +struct lib9p_msg_Rgetlock { + lib9p_tag_t tag; + uint8_t type; + uint64_t start; + uint64_t length; + uint32_t proc_id; + struct lib9p_s client_id; +}; + +struct lib9p_msg_Tlink { + lib9p_tag_t tag; + lib9p_fid_t dfid; + lib9p_fid_t fid; + struct lib9p_s name; +}; + +struct lib9p_msg_Trenameat { + lib9p_tag_t tag; + lib9p_fid_t olddirfid; + struct lib9p_s oldname; + lib9p_fid_t newdirfid; + struct lib9p_s newname; +}; + +struct lib9p_msg_Tunlinkat { + lib9p_tag_t tag; + lib9p_fid_t dirfd; + struct lib9p_s name; + uint32_t flags; +}; + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ #if CONFIG_9P_ENABLE_9P2000_e struct lib9p_msg_Tsread { lib9p_tag_t tag; @@ -315,7 +715,7 @@ struct lib9p_msg_Tswrite { }; #endif /* CONFIG_9P_ENABLE_9P2000_e */ -#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_qid { lib9p_qt_t type; uint32_t vers; @@ -327,9 +727,9 @@ struct lib9p_msg_Tauth { lib9p_fid_t afid; struct lib9p_s uname; struct lib9p_s aname; -#if CONFIG_9P_ENABLE_9P2000_u +#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u lib9p_nuid_t n_uid; -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ }; struct lib9p_msg_Tattach { @@ -338,11 +738,42 @@ struct lib9p_msg_Tattach { lib9p_fid_t afid; struct lib9p_s uname; struct lib9p_s aname; -#if CONFIG_9P_ENABLE_9P2000_u +#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u lib9p_nuid_t n_uid; -#endif /* CONFIG_9P_ENABLE_9P2000_u */ +#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */ }; +#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_L +struct lib9p_msg_Tlcreate { + lib9p_tag_t tag; + lib9p_fid_t fid; + struct lib9p_s name; + uint32_t flags; + uint32_t mode; + lib9p_nuid_t gid; +}; + +struct lib9p_msg_Tsymlink { + lib9p_tag_t tag; + lib9p_fid_t fid; + struct lib9p_s name; + struct lib9p_s symtgt; + lib9p_nuid_t gid; +}; + +struct lib9p_msg_Tmknod { + lib9p_tag_t tag; + lib9p_fid_t dfid; + struct lib9p_s name; + uint32_t mode; + uint32_t major; + uint32_t minor; + lib9p_nuid_t gid; +}; + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Topen { lib9p_tag_t tag; lib9p_fid_t fid; @@ -357,6 +788,46 @@ struct lib9p_msg_Tcreate { lib9p_o_t mode; }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +struct lib9p_msg_Tgetattr { + lib9p_tag_t tag; + lib9p_fid_t fid; + lib9p_getattr_t request_mask; +}; + +struct lib9p_msg_Tsetattr { + lib9p_tag_t tag; + lib9p_fid_t fid; + lib9p_setattr_t valid; + uint32_t mode; + lib9p_nuid_t uid; + lib9p_nuid_t gid; + uint64_t filesize; + uint64_t atime_sec; + uint64_t atime_nsec; + uint64_t mtime_sec; + uint64_t mtime_nsec; +}; + +struct lib9p_msg_Tlock { + lib9p_tag_t tag; + lib9p_fid_t fid; + lib9p_lock_type_t type; + lib9p_lock_flags_t flags; + uint64_t start; + uint64_t length; + uint32_t proc_id; + struct lib9p_s client_id; +}; + +struct lib9p_msg_Rlock { + lib9p_tag_t tag; + lib9p_lock_status_t status; +}; + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_stat { uint16_t kern_type; uint32_t kern_dev; @@ -377,6 +848,8 @@ struct lib9p_stat { #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Rauth { lib9p_tag_t tag; struct lib9p_qid aqid; @@ -393,6 +866,8 @@ struct lib9p_msg_Rwalk { struct lib9p_qid *wqid; }; +#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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Ropen { lib9p_tag_t tag; struct lib9p_qid qid; @@ -405,6 +880,61 @@ struct lib9p_msg_Rcreate { uint32_t iounit; }; +#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */ +#if CONFIG_9P_ENABLE_9P2000_L +struct lib9p_msg_Rlopen { + lib9p_tag_t tag; + struct lib9p_qid qid; + uint32_t iounit; +}; + +struct lib9p_msg_Rlcreate { + lib9p_tag_t tag; + struct lib9p_qid qid; + uint32_t iounit; +}; + +struct lib9p_msg_Rsymlink { + lib9p_tag_t tag; + struct lib9p_qid qid; +}; + +struct lib9p_msg_Rmknod { + lib9p_tag_t tag; + struct lib9p_qid qid; +}; + +struct lib9p_msg_Rgetattr { + lib9p_tag_t tag; + uint64_t valid; + struct lib9p_qid qid; + uint32_t mode; + lib9p_nuid_t uid; + lib9p_nuid_t gid; + uint64_t nlink; + uint64_t rdev; + uint64_t filesize; + uint64_t blksize; + uint64_t blocks; + uint64_t atime_sec; + uint64_t atime_nsec; + uint64_t mtime_sec; + uint64_t mtime_nsec; + uint64_t ctime_sec; + uint64_t ctime_nsec; + uint64_t btime_sec; + uint64_t btime_nsec; + uint64_t gen; + uint64_t data_version; +}; + +struct lib9p_msg_Tmkdir { + lib9p_tag_t tag; + struct lib9p_qid qid; +}; + +#endif /* CONFIG_9P_ENABLE_9P2000_L */ +#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u struct lib9p_msg_Rstat { lib9p_tag_t tag; struct lib9p_stat stat; diff --git a/lib9p/tests/test_server/config/config.h b/lib9p/tests/test_server/config/config.h index 4f8384e..e207f7e 100644 --- a/lib9p/tests/test_server/config/config.h +++ b/lib9p/tests/test_server/config/config.h @@ -42,6 +42,7 @@ #define CONFIG_9P_ENABLE_9P2000 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_e 0 /* bool */ +#define CONFIG_9P_ENABLE_9P2000_L 0 /* bool */ /* COROUTINE ******************************************************************/ |