diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-02-03 15:05:43 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-02-03 21:05:29 -0700 |
commit | 19ca216509a67451f43301b313c76a2fdf11814b (patch) | |
tree | ca95cc64f7f60d9530c1871fa0c9d174d2267693 /lib9p/9p.generated.c | |
parent | c00502686d65001154728d338d41caba41bd1ff7 (diff) |
lib9p: idl: Inline the `d` and `d_signed` structs
Diffstat (limited to 'lib9p/9p.generated.c')
-rw-r--r-- | lib9p/9p.generated.c | 441 |
1 files changed, 218 insertions, 223 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c index d0f5d8b..1188c73 100644 --- a/lib9p/9p.generated.c +++ b/lib9p/9p.generated.c @@ -427,24 +427,6 @@ LM_ALWAYS_INLINE static bool validate_fid(struct _validate_ctx *ctx) { return validate_4(ctx); } -LM_ALWAYS_INLINE static bool validate_d(struct _validate_ctx *ctx) { - uint32_t len; - return false - || (validate_4(ctx) || ({ len = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || _validate_list(ctx, len, validate_1, sizeof(uint8_t)) - ; -} - -LM_ALWAYS_INLINE static bool validate_d_signed(struct _validate_ctx *ctx) { - uint32_t len; - return false - || (validate_4(ctx) || ({ len = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || _validate_list(ctx, len, validate_1, sizeof(uint8_t)) - || ({ uint32_t max = INT32_MAX; (((uint32_t)len) > max) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "len value is too large (%"PRIu32" > %"PRIu32")", len, max); }) - ; -} - LM_ALWAYS_INLINE static bool validate_s(struct _validate_ctx *ctx) { uint16_t len; return false @@ -569,19 +551,42 @@ LM_FLATTEN static bool validate_Rflush(struct _validate_ctx *ctx) { ; } +LM_FLATTEN static bool validate_Rread(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t count; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) + || validate_tag(ctx) + || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || _validate_list(ctx, count, 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 = 117; (((uint8_t)typ) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) + || ({ uint32_t max = INT32_MAX; (((uint32_t)count) > max) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "count value is too large (%"PRIu32" > %"PRIu32")", count, max); }) + ; +} + LM_FLATTEN static bool validate_Rwrite(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; + uint32_t count; uint32_t _size_offset; return false || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) || validate_tag(ctx) - || validate_4(ctx) + || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) || ({ uint8_t exp = 119; (((uint8_t)typ) != exp) && lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) + || ({ uint32_t max = INT32_MAX; (((uint32_t)count) > max) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "count value is too large (%"PRIu32" > %"PRIu32")", count, max); }) ; } @@ -735,6 +740,24 @@ LM_FLATTEN static bool validate_Rxattrcreate(struct _validate_ctx *ctx) { ; } +LM_FLATTEN static bool validate_Rreaddir(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t count; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) + || validate_tag(ctx) + || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || _validate_list(ctx, count, 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; @@ -828,6 +851,24 @@ LM_FLATTEN static bool validate_Rsession(struct _validate_ctx *ctx) { ; } +LM_FLATTEN static bool validate_Rsread(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint32_t count; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) + || validate_tag(ctx) + || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || _validate_list(ctx, count, 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 = 153; (((uint8_t)typ) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) + ; +} + LM_FLATTEN static bool validate_Rswrite(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -870,6 +911,31 @@ LM_FLATTEN static bool validate_Tread(struct _validate_ctx *ctx) { ; } +LM_FLATTEN static bool validate_Twrite(struct _validate_ctx *ctx) { + uint32_t size; + uint8_t typ; + uint64_t offset; + uint32_t count; + uint32_t _size_offset; + return false + || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) + || validate_tag(ctx) + || validate_fid(ctx) + || (validate_8(ctx) || ({ offset = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]); false; })) + || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || _validate_list(ctx, count, 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 = 118; (((uint8_t)typ) != exp) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) + || ({ uint64_t max = INT64_MAX; (((uint64_t)offset) > max) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "offset value is too large (%"PRIu64" > %"PRIu64")", offset, max); }) + || ({ uint32_t max = INT32_MAX; (((uint32_t)count) > max) && + lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "count value is too large (%"PRIu32" > %"PRIu32")", count, max); }) + ; +} + LM_FLATTEN static bool validate_Tclunk(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -1006,79 +1072,8 @@ LM_FLATTEN static bool validate_Tfsync(struct _validate_ctx *ctx) { ; } -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 = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) - || validate_tag(ctx) - || validate_d(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - 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); }) - ; -} - #endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e -LM_FLATTEN static bool validate_Rsread(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) - || validate_tag(ctx) - || validate_d(ctx) - || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); }) - || ({ uint8_t exp = 153; (((uint8_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) - ; -} - -#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u -LM_FLATTEN static bool validate_Rread(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) - || validate_tag(ctx) - || validate_d_signed(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 = 117; (((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_Twrite(struct _validate_ctx *ctx) { - uint32_t size; - uint8_t typ; - uint64_t offset; - uint32_t _size_offset; - return false - || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) - || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; })) - || validate_tag(ctx) - || validate_fid(ctx) - || (validate_8(ctx) || ({ offset = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]); false; })) - || validate_d_signed(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 = 118; (((uint8_t)typ) != exp) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); }) - || ({ uint64_t max = INT64_MAX; (((uint64_t)offset) > max) && - lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "offset value is too large (%"PRIu64" > %"PRIu64")", offset, max); }) - ; -} - LM_FLATTEN static bool validate_Tversion(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; @@ -1348,6 +1343,7 @@ LM_FLATTEN static bool validate_Tswrite(struct _validate_ctx *ctx) { uint32_t size; uint8_t typ; uint16_t nwname; + uint32_t count; uint32_t _size_offset; return false || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) @@ -1356,7 +1352,8 @@ LM_FLATTEN static bool validate_Tswrite(struct _validate_ctx *ctx) { || validate_4(ctx) || (validate_2(ctx) || ({ nwname = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; })) || _validate_list(ctx, nwname, validate_s, sizeof(struct lib9p_s)) - || validate_d(ctx) + || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; })) + || _validate_list(ctx, count, 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 = 154; (((uint8_t)typ) != exp) && @@ -1972,24 +1969,6 @@ LM_ALWAYS_INLINE static void unmarshal_fid(struct _unmarshal_ctx *ctx, lib9p_fid unmarshal_4(ctx, (uint32_t *)out); } -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); - out->dat = ctx->extra; - ctx->extra += sizeof(out->dat[0]) * out->len; - for (typeof(out->len) i = 0; i < out->len; i++) - unmarshal_1(ctx, (uint8_t *)&out->dat[i]); -} - -LM_ALWAYS_INLINE static void unmarshal_d_signed(struct _unmarshal_ctx *ctx, struct lib9p_d_signed *out) { - memset(out, 0, sizeof(*out)); - unmarshal_4(ctx, &out->len); - out->dat = ctx->extra; - ctx->extra += sizeof(out->dat[0]) * out->len; - for (typeof(out->len) i = 0; i < out->len; i++) - unmarshal_1(ctx, (uint8_t *)&out->dat[i]); -} - 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); @@ -2062,6 +2041,18 @@ LM_FLATTEN static void unmarshal_Rflush(struct _unmarshal_ctx *ctx, struct lib9p unmarshal_tag(ctx, &out->tag); } +LM_FLATTEN static void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_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, (uint8_t *)&out->data[i]); +} + LM_FLATTEN static void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwrite *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -2148,6 +2139,18 @@ LM_FLATTEN static void unmarshal_Rxattrcreate(struct _unmarshal_ctx *ctx, struct 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, (uint8_t *)&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; @@ -2193,6 +2196,18 @@ LM_FLATTEN static void unmarshal_Rsession(struct _unmarshal_ctx *ctx, struct lib unmarshal_tag(ctx, &out->tag); } +LM_FLATTEN static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_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, (uint8_t *)&out->data[i]); +} + LM_FLATTEN static void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rswrite *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -2213,6 +2228,20 @@ LM_FLATTEN static void unmarshal_Tread(struct _unmarshal_ctx *ctx, struct lib9p_ unmarshal_4(ctx, &out->count); } +LM_FLATTEN static void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) { + memset(out, 0, sizeof(*out)); + ctx->net_offset += 4; + ctx->net_offset += 1; + unmarshal_tag(ctx, &out->tag); + unmarshal_fid(ctx, &out->fid); + unmarshal_8(ctx, &out->offset); + unmarshal_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, (uint8_t *)&out->data[i]); +} + LM_FLATTEN static void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tclunk *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -2285,44 +2314,8 @@ LM_FLATTEN static void unmarshal_Tfsync(struct _unmarshal_ctx *ctx, struct lib9p unmarshal_4(ctx, &out->datasync); } -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_d(ctx, &out->data); -} - #endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e -LM_FLATTEN static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_d(ctx, &out->data); -} - -#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || 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; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_d_signed(ctx, &out->data); -} - -LM_FLATTEN static void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) { - memset(out, 0, sizeof(*out)); - ctx->net_offset += 4; - ctx->net_offset += 1; - unmarshal_tag(ctx, &out->tag); - unmarshal_fid(ctx, &out->fid); - unmarshal_8(ctx, &out->offset); - unmarshal_d_signed(ctx, &out->data); -} - LM_FLATTEN static void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tversion *out) { memset(out, 0, sizeof(*out)); ctx->net_offset += 4; @@ -2489,7 +2482,11 @@ LM_FLATTEN static void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9 ctx->extra += sizeof(out->wname[0]) * out->nwname; for (typeof(out->nwname) i = 0; i < out->nwname; i++) unmarshal_s(ctx, &out->wname[i]); - unmarshal_d(ctx, &out->data); + 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, (uint8_t *)&out->data[i]); } #endif /* CONFIG_9P_ENABLE_9P2000_e */ @@ -2890,26 +2887,6 @@ LM_ALWAYS_INLINE static bool marshal_fid(struct _marshal_ctx *ctx, lib9p_fid_t * return marshal_4(ctx, (uint32_t *)val); } -LM_ALWAYS_INLINE static bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *val) { - return false - || marshal_4(ctx, &val->len) - || ({ bool err = false; - for (typeof(val->len) i = 0; i < val->len && !err; i++) - err = marshal_1(ctx, (uint8_t *)&val->dat[i]); - err; }) - ; -} - -LM_ALWAYS_INLINE static bool marshal_d_signed(struct _marshal_ctx *ctx, struct lib9p_d_signed *val) { - return false - || marshal_4(ctx, &val->len) - || ({ bool err = false; - for (typeof(val->len) i = 0; i < val->len && !err; i++) - err = marshal_1(ctx, (uint8_t *)&val->dat[i]); - err; }) - ; -} - LM_ALWAYS_INLINE static bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *val) { return false || marshal_2(ctx, &val->len) @@ -2999,6 +2976,23 @@ LM_FLATTEN static bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg ; } +LM_FLATTEN static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_4(ctx, &val->count) + || ({ bool err = false; + for (typeof(val->count) i = 0; i < val->count && !err; i++) + err = marshal_1(ctx, (uint8_t *)&val->data[i]); + err; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 117; false; }) + ; +} + LM_FLATTEN static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -3135,6 +3129,23 @@ LM_FLATTEN static bool marshal_Rxattrcreate(struct _marshal_ctx *ctx, struct lib ; } +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, (uint8_t *)&val->data[i]); + err; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 41; false; }) + ; +} + LM_FLATTEN static bool marshal_Rfsync(struct _marshal_ctx *ctx, struct lib9p_msg_Rfsync *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -3210,6 +3221,23 @@ LM_FLATTEN static bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_m ; } +LM_FLATTEN static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_4(ctx, &val->count) + || ({ bool err = false; + for (typeof(val->count) i = 0; i < val->count && !err; i++) + err = marshal_1(ctx, (uint8_t *)&val->data[i]); + err; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 153; false; }) + ; +} + LM_FLATTEN static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -3240,6 +3268,25 @@ LM_FLATTEN static bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_ ; } +LM_FLATTEN static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) { + uint32_t _size_offset; + uint32_t _typ_offset; + return false + || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) + || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) + || marshal_tag(ctx, &val->tag) + || marshal_fid(ctx, &val->fid) + || marshal_8(ctx, &val->offset) + || marshal_4(ctx, &val->count) + || ({ bool err = false; + for (typeof(val->count) i = 0; i < val->count && !err; i++) + err = marshal_1(ctx, (uint8_t *)&val->data[i]); + err; }) + || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) + || ({ ctx->net_bytes[_typ_offset] = 118; false; }) + ; +} + LM_FLATTEN static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -3352,64 +3399,8 @@ LM_FLATTEN static bool marshal_Tfsync(struct _marshal_ctx *ctx, struct lib9p_msg ; } -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_d(ctx, &val->data) - || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) - || ({ ctx->net_bytes[_typ_offset] = 41; false; }) - ; -} - #endif /* CONFIG_9P_ENABLE_9P2000_L */ -#if CONFIG_9P_ENABLE_9P2000_e -LM_FLATTEN static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_d(ctx, &val->data) - || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) - || ({ ctx->net_bytes[_typ_offset] = 153; false; }) - ; -} - -#endif /* CONFIG_9P_ENABLE_9P2000_e */ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || 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; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_d_signed(ctx, &val->data) - || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) - || ({ ctx->net_bytes[_typ_offset] = 117; false; }) - ; -} - -LM_FLATTEN static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) { - uint32_t _size_offset; - uint32_t _typ_offset; - return false - || ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); }) - || ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); }) - || marshal_tag(ctx, &val->tag) - || marshal_fid(ctx, &val->fid) - || marshal_8(ctx, &val->offset) - || marshal_d_signed(ctx, &val->data) - || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) - || ({ ctx->net_bytes[_typ_offset] = 118; false; }) - ; -} - LM_FLATTEN static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) { uint32_t _size_offset; uint32_t _typ_offset; @@ -3648,7 +3639,11 @@ LM_FLATTEN static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_ms for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++) err = marshal_s(ctx, &val->wname[i]); err; }) - || marshal_d(ctx, &val->data) + || marshal_4(ctx, &val->count) + || ({ bool err = false; + for (typeof(val->count) i = 0; i < val->count && !err; i++) + err = marshal_1(ctx, (uint8_t *)&val->data[i]); + err; }) || ({ uint32le_encode(&ctx->net_bytes[_size_offset], ctx->net_offset - _size_offset); false; }) || ({ ctx->net_bytes[_typ_offset] = 154; false; }) ; |