summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib9p/9p.generated.c441
-rw-r--r--lib9p/idl/2002-9P2000.9p14
-rw-r--r--lib9p/idl/2010-9P2000.L.9p4
-rw-r--r--lib9p/idl/2012-9P2000.e.9p4
-rw-r--r--lib9p/include/lib9p/9p.generated.h81
-rw-r--r--lib9p/srv.c12
6 files changed, 268 insertions, 288 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; })
;
diff --git a/lib9p/idl/2002-9P2000.9p b/lib9p/idl/2002-9P2000.9p
index 14253f7..438e02f 100644
--- a/lib9p/idl/2002-9P2000.9p
+++ b/lib9p/idl/2002-9P2000.9p
@@ -28,12 +28,6 @@ num tag = 2
num fid = 4
"NOFID = ~0"
-# data - u32le `n`, then `n` bytes of data
-struct d = "len[4] len*(dat[1])"
-
-# data - s32le `n`, then `n` bytes of data
-struct d_signed = "len[4,max=s32_max] len*(dat[1])"
-
# string - u16le `n`, then `n` bytes of UTF-8, without any nul-bytes
struct s = "len[2] len*(utf8[1])"
@@ -153,10 +147,10 @@ msg Topen = "size[4,val=end-&size] typ[1,val=112] tag[tag] fid[fid] mode[o]"
msg Ropen = "size[4,val=end-&size] typ[1,val=113] tag[tag] qid[qid] iounit[4]"
msg Tcreate = "size[4,val=end-&size] typ[1,val=114] tag[tag] fid[fid] name[s] perm[dm] mode[o]"
msg Rcreate = "size[4,val=end-&size] typ[1,val=115] tag[tag] qid[qid] iounit[4]"
-msg Tread = "size[4,val=end-&size] typ[1,val=116] tag[tag] fid[fid] offset[8,max=s64_max] count[4,max=s32_max]"
-msg Rread = "size[4,val=end-&size] typ[1,val=117] tag[tag] data[d_signed]" # For directories `data` is the sequence "cnt*(entries[stat])".
-msg Twrite = "size[4,val=end-&size] typ[1,val=118] tag[tag] fid[fid] offset[8,max=s64_max] data[d_signed]"
-msg Rwrite = "size[4,val=end-&size] typ[1,val=119] tag[tag] count[4]"
+msg Tread = "size[4,val=end-&size] typ[1,val=116] tag[tag] fid[fid] offset[8,max=s64_max] count[4,max=s32_max]" # See 4e `sys/src/lib9p/srv.c:sread()` for `offset:max` and `count:max`.
+msg Rread = "size[4,val=end-&size] typ[1,val=117] tag[tag] count[4,max=s32_max] count*(data[1])" # `max` is inherited from Tread, for directories `data` is the sequence "cnt*(entries[stat])".
+msg Twrite = "size[4,val=end-&size] typ[1,val=118] tag[tag] fid[fid] offset[8,max=s64_max] count[4,max=s32_max] count*(data[1])" # See 4e `sys/src/lib9p/srv.c:swrite()` for `offset:max` and `count:max`.
+msg Rwrite = "size[4,val=end-&size] typ[1,val=119] tag[tag] count[4,max=s32_max]" # `max` is inherited from Twrite.
msg Tclunk = "size[4,val=end-&size] typ[1,val=120] tag[tag] fid[fid]"
msg Rclunk = "size[4,val=end-&size] typ[1,val=121] tag[tag]"
msg Tremove = "size[4,val=end-&size] typ[1,val=122] tag[tag] fid[fid]"
diff --git a/lib9p/idl/2010-9P2000.L.9p b/lib9p/idl/2010-9P2000.L.9p
index 5a7d09c..e21d411 100644
--- a/lib9p/idl/2010-9P2000.L.9p
+++ b/lib9p/idl/2010-9P2000.L.9p
@@ -7,7 +7,7 @@
# https://github.com/chaos/diod/blob/master/protocol.md
version "9P2000.L"
-from ./2002-9P2000.9p import tag, fid, s, d, d_signed, qt, qid
+from ./2002-9P2000.9p import tag, fid, s, qt, qid
from ./2002-9P2000.9p import Rerror
from ./2002-9P2000.9p import Tversion, Rversion, Tflush, Rflush, Twalk, Rwalk, Tread, Rread, Twrite, Rwrite, Tclunk, Rclunk, Tremove, Rremove
from ./2005-9P2000.u.9p import nuid, Tauth, Rauth, Tattach, Rattach
@@ -89,7 +89,7 @@ msg Txattrcreate = "size[4,val=end-&size] typ[1,val=32] tag[tag] fid[fid] name[s
msg Rxattrcreate = "size[4,val=end-&size] typ[1,val=33] tag[tag]"
#...
msg Treaddir = "size[4,val=end-&size] typ[1,val=40] tag[tag] fid[fid] offset[8] count[4]"
-msg Rreaddir = "size[4,val=end-&size] typ[1,val=41] tag[tag] data[d]" # data is "qid[qid] offset[8] type[1] name[s]"
+msg Rreaddir = "size[4,val=end-&size] typ[1,val=41] tag[tag] count[4] count*(data[1])" # data is "qid[qid] offset[8] type[1] name[s]"
#...
msg Tfsync = "size[4,val=end-&size] typ[1,val=50] tag[tag] fid[fid] datasync[4]"
msg Rfsync = "size[4,val=end-&size] typ[1,val=51] tag[tag]"
diff --git a/lib9p/idl/2012-9P2000.e.9p b/lib9p/idl/2012-9P2000.e.9p
index ef80796..dde9d96 100644
--- a/lib9p/idl/2012-9P2000.e.9p
+++ b/lib9p/idl/2012-9P2000.e.9p
@@ -13,6 +13,6 @@ from ./2002-9P2000.9p import *
msg Tsession = "size[4,val=end-&size] typ[1,val=150] tag[tag] key[8]"
msg Rsession = "size[4,val=end-&size] typ[1,val=151] tag[tag]"
msg Tsread = "size[4,val=end-&size] typ[1,val=152] tag[tag] fid[4] nwname[2] nwname*(wname[s])"
-msg Rsread = "size[4,val=end-&size] typ[1,val=153] tag[tag] data[d]"
-msg Tswrite = "size[4,val=end-&size] typ[1,val=154] tag[tag] fid[4] nwname[2] nwname*(wname[s]) data[d]"
+msg Rsread = "size[4,val=end-&size] typ[1,val=153] tag[tag] count[4] count*(data[1])"
+msg Tswrite = "size[4,val=end-&size] typ[1,val=154] tag[tag] fid[4] nwname[2] nwname*(wname[s]) count[4] count*(data[1])"
msg Rswrite = "size[4,val=end-&size] typ[1,val=155] tag[tag] count[4]"
diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h
index 4e155ad..a5b719e 100644
--- a/lib9p/include/lib9p/9p.generated.h
+++ b/lib9p/include/lib9p/9p.generated.h
@@ -156,18 +156,6 @@ typedef uint16_t lib9p_tag_t;
typedef uint32_t lib9p_fid_t;
#define LIB9P_FID_NOFID ((lib9p_fid_t)UINT32_C(~0))
-/* min_size = 4 ; max_size = 4,294,967,299 (warning: >UINT32_MAX) */
-struct lib9p_d {
- uint32_t len;
- [[gnu::nonstring]] char *dat;
-};
-
-/* min_size = 4 ; max_size = 2,147,483,651 */
-struct lib9p_d_signed {
- uint32_t len;
- [[gnu::nonstring]] char *dat;
-};
-
/* min_size = 2 ; max_size = 65,537 */
struct lib9p_s {
uint16_t len;
@@ -434,6 +422,13 @@ struct lib9p_msg_Rflush {
lib9p_tag_t tag;
};
+/* min_size = 11 ; max_size = 2,147,483,658 */
+struct lib9p_msg_Rread {
+ lib9p_tag_t tag;
+ uint32_t count;
+ [[gnu::nonstring]] char *data;
+};
+
/* size = 11 */
struct lib9p_msg_Rwrite {
lib9p_tag_t tag;
@@ -500,6 +495,13 @@ struct lib9p_msg_Rxattrcreate {
lib9p_tag_t tag;
};
+/* min_size = 11 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) */
+struct lib9p_msg_Rreaddir {
+ lib9p_tag_t tag;
+ uint32_t count;
+ [[gnu::nonstring]] char *data;
+};
+
/* size = 7 */
struct lib9p_msg_Rfsync {
lib9p_tag_t tag;
@@ -533,6 +535,13 @@ struct lib9p_msg_Rsession {
lib9p_tag_t tag;
};
+/* min_size = 11 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) */
+struct lib9p_msg_Rsread {
+ lib9p_tag_t tag;
+ uint32_t count;
+ [[gnu::nonstring]] char *data;
+};
+
/* size = 11 */
struct lib9p_msg_Rswrite {
lib9p_tag_t tag;
@@ -549,6 +558,15 @@ struct lib9p_msg_Tread {
uint32_t count;
};
+/* min_size = 23 ; max_size = 2,147,483,670 */
+struct lib9p_msg_Twrite {
+ lib9p_tag_t tag;
+ lib9p_fid_t fid;
+ uint64_t offset;
+ uint32_t count;
+ [[gnu::nonstring]] char *data;
+};
+
/* size = 11 */
struct lib9p_msg_Tclunk {
lib9p_tag_t tag;
@@ -605,36 +623,8 @@ struct lib9p_msg_Tfsync {
uint32_t datasync;
};
-/* min_size = 11 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) */
-struct lib9p_msg_Rreaddir {
- lib9p_tag_t tag;
- struct lib9p_d data;
-};
-
#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
-/* min_size = 11 ; max_size = 4,294,967,306 (warning: >UINT32_MAX) */
-struct lib9p_msg_Rsread {
- lib9p_tag_t tag;
- struct lib9p_d 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
-/* min_size = 11 ; max_size = 2,147,483,658 */
-struct lib9p_msg_Rread {
- lib9p_tag_t tag;
- struct lib9p_d_signed data;
-};
-
-/* min_size = 23 ; max_size = 2,147,483,670 */
-struct lib9p_msg_Twrite {
- lib9p_tag_t tag;
- lib9p_fid_t fid;
- uint64_t offset;
- struct lib9p_d_signed data;
-};
-
/* min_size = 13 ; max_size = 65,548 */
struct lib9p_msg_Tversion {
lib9p_tag_t tag;
@@ -762,11 +752,12 @@ struct lib9p_msg_Tsread {
/* min_size = 17 ; max_size = 8,589,934,607 (warning: >UINT32_MAX) */
struct lib9p_msg_Tswrite {
- lib9p_tag_t tag;
- uint32_t fid;
- uint16_t nwname;
- struct lib9p_s *wname;
- struct lib9p_d data;
+ lib9p_tag_t tag;
+ uint32_t fid;
+ uint16_t nwname;
+ struct lib9p_s *wname;
+ uint32_t count;
+ [[gnu::nonstring]] char *data;
};
#endif /* CONFIG_9P_ENABLE_9P2000_e */
diff --git a/lib9p/srv.c b/lib9p/srv.c
index 465e0bf..7e6402e 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -818,7 +818,7 @@ static void handle_Tread(struct _lib9p_srv_req *ctx,
/* Variables. */
implements_lib9p_srv_file *file = fidinfo->file;
- resp->data.dat = (char *)(&resp[1]);
+ resp->data = (char *)(&resp[1]);
/* Do it. */
if (fidinfo->flags & FIDFLAG_ISDIR) {
@@ -835,20 +835,20 @@ static void handle_Tread(struct _lib9p_srv_req *ctx,
return;
}
/* Do it. */
- size_t num = VCALL(file, dread, &ctx->ctx, (uint8_t *)resp->data.dat, req->count, idx);
+ size_t num = VCALL(file, dread, &ctx->ctx, (uint8_t *)resp->data, req->count, idx);
/* Translate object-count back to byte-count. */
uint32_t len = 0;
for (size_t i = 0; i < num; i++) {
uint32_t i_len;
- lib9p_stat_validate(&ctx->ctx.basectx, req->count, &((uint8_t *)resp->data.dat)[len], &i_len, NULL);
+ lib9p_stat_validate(&ctx->ctx.basectx, req->count, &((uint8_t *)resp->data)[len], &i_len, NULL);
len += i_len;
}
- resp->data.len = len;
+ resp->count = len;
/* Remember. */
fidinfo->dir_idx = idx+num;
fidinfo->dir_off = req->offset + len;
} else
- resp->data.len = VCALL(file, pread, &ctx->ctx, resp->data.dat, req->count, req->offset);
+ resp->count = VCALL(file, pread, &ctx->ctx, resp->data, req->count, req->offset);
}
static void handle_Twrite(struct _lib9p_srv_req *ctx,
@@ -873,7 +873,7 @@ static void handle_Twrite(struct _lib9p_srv_req *ctx,
implements_lib9p_srv_file *file = fidinfo->file;
/* Do it. */
- resp->count = VCALL(file, pwrite, &ctx->ctx, req->data.dat, req->data.len, req->offset);
+ resp->count = VCALL(file, pwrite, &ctx->ctx, req->data, req->count, req->offset);
}
static void handle_Tclunk(struct _lib9p_srv_req *ctx,