summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-14 20:14:46 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-14 20:14:46 -0700
commit287e11381634b879dc82b23eacb693a31c52f9ef (patch)
tree236d11893dafb8f45141fdacc7d6f47cc0aa8529
parentf7c75fe0113cdbd3e13b4e22edf76d9456c4b064 (diff)
parent6e48efec92b3357b2b762d14994d2f812a3b6ef7 (diff)
Merge branch 'lukeshu/9p-idl-defs'
-rw-r--r--lib9p/9p.generated.c1105
-rwxr-xr-xlib9p/idl.gen48
-rw-r--r--lib9p/idl/0000-README.md23
-rw-r--r--lib9p/idl/1992-9P0.9p.wip71
-rw-r--r--lib9p/idl/1995-9P1.9p.wip71
-rw-r--r--lib9p/idl/2002-9P2000.9p17
-rw-r--r--lib9p/idl/2005-9P2000.u.9p16
-rw-r--r--lib9p/idl/2010-9P2000.L.9p.wip132
-rw-r--r--lib9p/idl/__init__.py31
-rw-r--r--lib9p/include/lib9p/9p.generated.h311
-rw-r--r--lib9p/include/lib9p/9p.h5
-rw-r--r--lib9p/srv.c6
12 files changed, 1023 insertions, 813 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c
index 984ba7f..67644e4 100644
--- a/lib9p/9p.generated.c
+++ b/lib9p/9p.generated.c
@@ -159,41 +159,14 @@ LM_ALWAYS_INLINE static bool validate_qt(struct _validate_ctx *ctx) {
return false;
}
-LM_ALWAYS_INLINE static bool validate_qid(struct _validate_ctx *ctx) {
- return false
- || validate_qt(ctx)
- || validate_4(ctx)
- || validate_8(ctx)
- ;
-}
-
-LM_ALWAYS_INLINE static bool validate_stat(struct _validate_ctx *ctx) {
- uint16_t stat_size;
- uint32_t _kern_type_offset;
- return false
- || (validate_2(ctx) || ({ stat_size = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || ({ _kern_type_offset = ctx->net_offset; validate_2(ctx); })
- || validate_4(ctx)
- || validate_qid(ctx)
- || validate_dm(ctx)
- || validate_4(ctx)
- || validate_4(ctx)
- || validate_8(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_s(ctx) )
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
- || ({ uint32_t exp = ctx->net_offset - _kern_type_offset; (((uint32_t)stat_size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "stat_size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)stat_size, exp); })
- ;
+LM_ALWAYS_INLINE static bool validate_nuid(struct _validate_ctx *ctx) {
+ return validate_4(ctx);
}
+#endif /* 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))
return true;
@@ -204,7 +177,7 @@ LM_ALWAYS_INLINE static bool validate_o(struct _validate_ctx *ctx) {
return false;
}
-LM_FLATTEN static bool validate_Tversion(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Tflush(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -212,16 +185,15 @@ LM_FLATTEN static bool validate_Tversion(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_4(ctx)
- || validate_s(ctx)
+ || validate_2(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 100; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 108; (((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_Rversion(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rflush(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -229,16 +201,14 @@ LM_FLATTEN static bool validate_Rversion(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_4(ctx)
- || validate_s(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 101; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 109; (((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_Tauth(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rwrite(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -246,20 +216,15 @@ LM_FLATTEN static bool validate_Tauth(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
-#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ || validate_4(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 102; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, 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); })
;
}
-LM_FLATTEN static bool validate_Rauth(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rclunk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -267,15 +232,14 @@ LM_FLATTEN static bool validate_Rauth(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_qid(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 103; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 121; (((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_Tattach(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rremove(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -283,21 +247,14 @@ LM_FLATTEN static bool validate_Tattach(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_fid(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
-#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 104; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 123; (((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_Rattach(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rwstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -305,15 +262,16 @@ LM_FLATTEN static bool validate_Rattach(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_qid(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 105; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 127; (((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_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_e
+LM_FLATTEN static bool validate_Tsession(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -321,18 +279,15 @@ LM_FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_s(ctx)
-#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ || validate_8(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 107; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 150; (((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_Tflush(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rsession(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -340,15 +295,14 @@ LM_FLATTEN static bool validate_Tflush(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_2(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 108; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 151; (((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_Rflush(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rswrite(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -356,56 +310,57 @@ LM_FLATTEN static bool validate_Rflush(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
+ || validate_4(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 109; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 155; (((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_Twalk(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
+LM_FLATTEN static bool validate_Tread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
- uint16_t nwname;
+ uint64_t offset;
+ uint32_t count;
uint32_t _size_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
|| validate_fid(ctx)
- || validate_fid(ctx)
- || (validate_2(ctx) || ({ nwname = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s))
+ || (validate_8(ctx) || ({ offset = decode_u64le(&ctx->net_bytes[ctx->net_offset-8]); false; }))
+ || (validate_4(ctx) || ({ count = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 110; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
- || ({ uint32_t max = 16; (((uint32_t)nwname) > max) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nwname value is too large (%"PRIu32" > %"PRIu32")", nwname, max); })
+ || ({ uint8_t exp = 116; (((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_Rwalk(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Tclunk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
- uint16_t nwqid;
uint32_t _size_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || (validate_2(ctx) || ({ nwqid = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_qid, sizeof(struct lib9p_qid))
+ || validate_fid(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 111; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
- || ({ uint32_t max = 16; (((uint32_t)nwqid) > max) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nwqid value is too large (%"PRIu32" > %"PRIu32")", nwqid, max); })
+ || ({ uint8_t exp = 120; (((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_Topen(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Tremove(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -414,15 +369,14 @@ LM_FLATTEN static bool validate_Topen(struct _validate_ctx *ctx) {
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
|| validate_fid(ctx)
- || validate_o(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 112; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 122; (((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_Ropen(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Tstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -430,16 +384,15 @@ LM_FLATTEN static bool validate_Ropen(struct _validate_ctx *ctx) {
|| (({ _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)
+ || validate_fid(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 113; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 124; (((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_Tcreate(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -447,35 +400,38 @@ LM_FLATTEN static bool validate_Tcreate(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_dm(ctx)
- || validate_o(ctx)
+ || validate_d(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 114; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, 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_Rcreate(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 _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)
+ || validate_fid(ctx)
+ || (validate_8(ctx) || ({ offset = decode_u64le(&ctx->net_bytes[ctx->net_offset-8]); false; }))
+ || validate_d(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 115; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ 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_Tread(struct _validate_ctx *ctx) {
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_e
+LM_FLATTEN static bool validate_Rsread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -483,17 +439,17 @@ LM_FLATTEN static bool validate_Tread(struct _validate_ctx *ctx) {
|| (({ _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)
+ || validate_d(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 116; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, 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_Rread(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
+LM_FLATTEN static bool validate_Tversion(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -501,15 +457,16 @@ LM_FLATTEN static bool validate_Rread(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_d(ctx)
+ || validate_4(ctx)
+ || validate_s(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 117; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 100; (((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) {
+LM_FLATTEN static bool validate_Rversion(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -517,17 +474,16 @@ LM_FLATTEN static bool validate_Twrite(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_fid(ctx)
- || validate_8(ctx)
- || validate_d(ctx)
+ || validate_4(ctx)
+ || validate_s(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 118; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 101; (((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_Rwrite(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -535,31 +491,42 @@ LM_FLATTEN static bool validate_Rwrite(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_4(ctx)
+ || validate_s(ctx)
+#if CONFIG_9P_ENABLE_9P2000_u
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) )
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 119; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 107; (((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_Tclunk(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Twalk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
+ uint16_t nwname;
uint32_t _size_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
|| validate_fid(ctx)
+ || validate_fid(ctx)
+ || (validate_2(ctx) || ({ nwname = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
+ || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s))
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 120; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 110; (((uint8_t)typ) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
+ || ({ uint16_t max = 16; (((uint16_t)nwname) > max) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nwname value is too large (%"PRIu16" > %"PRIu16")", nwname, max); })
;
}
-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_e
+LM_FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -567,14 +534,17 @@ LM_FLATTEN static bool validate_Rclunk(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
+ || validate_4(ctx)
+ || validate_2(ctx)
+ || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s))
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 121; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 152; (((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_Tremove(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Tswrite(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -582,15 +552,28 @@ LM_FLATTEN static bool validate_Tremove(struct _validate_ctx *ctx) {
|| (({ _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)
+ || validate_2(ctx)
+ || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s))
+ || validate_d(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 122; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 154; (((uint8_t)typ) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
;
}
-LM_FLATTEN static bool validate_Rremove(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
+LM_ALWAYS_INLINE static bool validate_qid(struct _validate_ctx *ctx) {
+ return false
+ || validate_qt(ctx)
+ || validate_4(ctx)
+ || validate_8(ctx)
+ ;
+}
+
+LM_FLATTEN static bool validate_Tauth(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -598,14 +581,20 @@ LM_FLATTEN static bool validate_Rremove(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
+ || validate_fid(ctx)
+ || validate_s(ctx)
+ || validate_s(ctx)
+#if CONFIG_9P_ENABLE_9P2000_u
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) )
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 123; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 102; (((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_Tstat(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Tattach(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -614,57 +603,83 @@ LM_FLATTEN static bool validate_Tstat(struct _validate_ctx *ctx) {
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
|| validate_fid(ctx)
+ || validate_fid(ctx)
+ || validate_s(ctx)
+ || validate_s(ctx)
+#if CONFIG_9P_ENABLE_9P2000_u
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) )
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 124; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 104; (((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_Rstat(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Topen(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
- uint16_t nstat;
uint32_t _size_offset;
- uint32_t _stat_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || (validate_2(ctx) || ({ nstat = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); })
+ || validate_fid(ctx)
+ || validate_o(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 125; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
- || ({ uint32_t exp = ctx->net_offset - _stat_offset; (((uint32_t)nstat) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nstat value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)nstat, exp); })
+ || ({ uint8_t exp = 112; (((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_Twstat(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Tcreate(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
- uint16_t nstat;
uint32_t _size_offset;
- uint32_t _stat_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
|| validate_fid(ctx)
- || (validate_2(ctx) || ({ nstat = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); })
+ || validate_s(ctx)
+ || validate_dm(ctx)
+ || validate_o(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 126; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
- || ({ uint32_t exp = ctx->net_offset - _stat_offset; (((uint32_t)nstat) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nstat value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)nstat, exp); })
+ || ({ uint8_t exp = 114; (((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_Rwstat(struct _validate_ctx *ctx) {
+LM_ALWAYS_INLINE static bool validate_stat(struct _validate_ctx *ctx) {
+ uint16_t stat_size;
+ uint32_t _kern_type_offset;
+ return false
+ || (validate_2(ctx) || ({ stat_size = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
+ || ({ _kern_type_offset = ctx->net_offset; validate_2(ctx); })
+ || validate_4(ctx)
+ || validate_qid(ctx)
+ || validate_dm(ctx)
+ || validate_4(ctx)
+ || validate_4(ctx)
+ || validate_8(ctx)
+ || validate_s(ctx)
+ || validate_s(ctx)
+ || validate_s(ctx)
+ || validate_s(ctx)
+#if CONFIG_9P_ENABLE_9P2000_u
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_s(ctx) )
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) )
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_nuid(ctx) )
+ || ( (ctx->ctx->version==LIB9P_VER_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); })
+ ;
+}
+
+LM_FLATTEN static bool validate_Rauth(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -672,16 +687,15 @@ LM_FLATTEN static bool validate_Rwstat(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
+ || validate_qid(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 127; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 103; (((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 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_e
-LM_FLATTEN static bool validate_Tsession(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rattach(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -689,30 +703,35 @@ LM_FLATTEN static bool validate_Tsession(struct _validate_ctx *ctx) {
|| (({ _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)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 150; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 105; (((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_Rsession(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rwalk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
+ uint16_t nwqid;
uint32_t _size_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
+ || (validate_2(ctx) || ({ nwqid = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
+ || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_qid, sizeof(struct lib9p_qid))
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 151; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 111; (((uint8_t)typ) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
+ || ({ uint16_t max = 16; (((uint16_t)nwqid) > max) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nwqid value is too large (%"PRIu16" > %"PRIu16")", nwqid, max); })
;
}
-LM_FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Ropen(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -720,17 +739,16 @@ LM_FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) {
|| (({ _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)
- || validate_2(ctx)
- || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s))
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 152; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 113; (((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_Rsread(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rcreate(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -738,49 +756,58 @@ LM_FLATTEN static bool validate_Rsread(struct _validate_ctx *ctx) {
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_d(ctx)
+ || validate_qid(ctx)
+ || validate_4(ctx)
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 153; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 115; (((uint8_t)typ) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
;
}
-LM_FLATTEN static bool validate_Tswrite(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Rstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
+ uint16_t nstat;
uint32_t _size_offset;
+ uint32_t _stat_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_4(ctx)
- || validate_2(ctx)
- || _validate_list(ctx, decode_u16le(&ctx->net_bytes[ctx->net_offset-2]), validate_s, sizeof(struct lib9p_s))
- || validate_d(ctx)
+ || (validate_2(ctx) || ({ nstat = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
+ || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); })
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 154; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 125; (((uint8_t)typ) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
+ || ({ uint16_t exp = ctx->net_offset - _stat_offset; (((uint16_t)nstat) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nstat value is wrong (actual:%"PRIu16" != correct:%"PRIu16")", (uint16_t)nstat, exp); })
;
}
-LM_FLATTEN static bool validate_Rswrite(struct _validate_ctx *ctx) {
+LM_FLATTEN static bool validate_Twstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
+ uint16_t nstat;
uint32_t _size_offset;
+ uint32_t _stat_offset;
return false
|| (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = decode_u32le(&ctx->net_bytes[ctx->net_offset-4]); false; }))
|| (validate_1(ctx) || ({ typ = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]); false; }))
|| validate_tag(ctx)
- || validate_4(ctx)
+ || validate_fid(ctx)
+ || (validate_2(ctx) || ({ nstat = decode_u16le(&ctx->net_bytes[ctx->net_offset-2]); false; }))
+ || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); })
|| ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint32_t exp = 155; (((uint32_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)typ, exp); })
+ || ({ uint8_t exp = 126; (((uint8_t)typ) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
+ || ({ uint16_t exp = ctx->net_offset - _stat_offset; (((uint16_t)nstat) != exp) &&
+ lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "nstat value is wrong (actual:%"PRIu16" != correct:%"PRIu16")", (uint16_t)nstat, exp); })
;
}
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
/* unmarshal_* ****************************************************************/
@@ -841,350 +868,368 @@ LM_ALWAYS_INLINE static void unmarshal_qt(struct _unmarshal_ctx *ctx, lib9p_qt_t
unmarshal_1(ctx, (uint8_t *)out);
}
-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);
- unmarshal_4(ctx, &out->vers);
- unmarshal_8(ctx, &out->path);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 2;
- unmarshal_2(ctx, &out->kern_type);
- unmarshal_4(ctx, &out->kern_dev);
- unmarshal_qid(ctx, &out->file_qid);
- unmarshal_dm(ctx, &out->file_mode);
- unmarshal_4(ctx, &out->file_atime);
- unmarshal_4(ctx, &out->file_mtime);
- unmarshal_8(ctx, &out->file_size);
- unmarshal_s(ctx, &out->file_name);
- unmarshal_s(ctx, &out->file_owner_uid);
- unmarshal_s(ctx, &out->file_owner_gid);
- unmarshal_s(ctx, &out->file_last_modified_uid);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_u
- if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_s(ctx, &out->file_extension);
- if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_owner_n_uid);
- if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_owner_n_gid);
- if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->file_last_modified_n_uid);
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+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 */
+#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);
}
-LM_FLATTEN static void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tversion *out) {
+LM_FLATTEN static void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->max_msg_size);
- unmarshal_s(ctx, &out->version);
+ unmarshal_2(ctx, &out->oldtag);
}
-LM_FLATTEN static void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rversion *out) {
+LM_FLATTEN static void unmarshal_Rflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rflush *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->max_msg_size);
- unmarshal_s(ctx, &out->version);
}
-LM_FLATTEN static void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tauth *out) {
+LM_FLATTEN static void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwrite *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->afid);
- unmarshal_s(ctx, &out->uname);
- unmarshal_s(ctx, &out->aname);
-#if CONFIG_9P_ENABLE_9P2000_u
- if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->n_uname);
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ unmarshal_4(ctx, &out->count);
}
-LM_FLATTEN static void unmarshal_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rauth *out) {
+LM_FLATTEN static void unmarshal_Rclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rclunk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->aqid);
}
-LM_FLATTEN static void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) {
+LM_FLATTEN static void unmarshal_Rremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rremove *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_fid(ctx, &out->afid);
- unmarshal_s(ctx, &out->uname);
- unmarshal_s(ctx, &out->aname);
-#if CONFIG_9P_ENABLE_9P2000_u
- if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->n_uname);
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-LM_FLATTEN static void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rattach *out) {
+LM_FLATTEN static void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
}
-LM_FLATTEN static void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rerror *out) {
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#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));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_s(ctx, &out->ename);
-#if CONFIG_9P_ENABLE_9P2000_u
- if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->errno);
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ unmarshal_8(ctx, &out->key);
}
-LM_FLATTEN static void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) {
+LM_FLATTEN static void unmarshal_Rsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsession *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_2(ctx, &out->oldtag);
}
-LM_FLATTEN static void unmarshal_Rflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rflush *out) {
+LM_FLATTEN static void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rswrite *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
+ unmarshal_4(ctx, &out->count);
}
-LM_FLATTEN static void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twalk *out) {
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || 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;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
unmarshal_fid(ctx, &out->fid);
- unmarshal_fid(ctx, &out->newfid);
- unmarshal_2(ctx, &out->nwname);
- out->wname = ctx->extra;
- ctx->extra += sizeof(out->wname[0]) * out->nwname;
- for (typeof(out->nwname) i = 0; i < out->nwname; i++)
- unmarshal_s(ctx, &out->wname[i]);
+ unmarshal_8(ctx, &out->offset);
+ unmarshal_4(ctx, &out->count);
}
-LM_FLATTEN static void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwalk *out) {
+LM_FLATTEN static void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tclunk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_2(ctx, &out->nwqid);
- out->wqid = ctx->extra;
- ctx->extra += sizeof(out->wqid[0]) * out->nwqid;
- for (typeof(out->nwqid) i = 0; i < out->nwqid; i++)
- unmarshal_qid(ctx, &out->wqid[i]);
+ unmarshal_fid(ctx, &out->fid);
}
-LM_FLATTEN static void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) {
+LM_FLATTEN static void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tremove *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
unmarshal_fid(ctx, &out->fid);
- unmarshal_o(ctx, &out->mode);
}
-LM_FLATTEN static void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) {
+LM_FLATTEN static void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
- unmarshal_4(ctx, &out->iounit);
+ unmarshal_fid(ctx, &out->fid);
}
-LM_FLATTEN static void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tcreate *out) {
+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_fid(ctx, &out->fid);
- unmarshal_s(ctx, &out->name);
- unmarshal_dm(ctx, &out->perm);
- unmarshal_o(ctx, &out->mode);
+ unmarshal_d(ctx, &out->data);
}
-LM_FLATTEN static void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rcreate *out) {
+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_qid(ctx, &out->qid);
- unmarshal_4(ctx, &out->iounit);
+ unmarshal_fid(ctx, &out->fid);
+ unmarshal_8(ctx, &out->offset);
+ unmarshal_d(ctx, &out->data);
}
-LM_FLATTEN static void unmarshal_Tread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tread *out) {
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_e
+LM_FLATTEN static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_8(ctx, &out->offset);
- unmarshal_4(ctx, &out->count);
+ unmarshal_d(ctx, &out->data);
}
-LM_FLATTEN static void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) {
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || 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;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_d(ctx, &out->data);
+ unmarshal_4(ctx, &out->max_msg_size);
+ unmarshal_s(ctx, &out->version);
}
-LM_FLATTEN static void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) {
+LM_FLATTEN static void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rversion *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_8(ctx, &out->offset);
- unmarshal_d(ctx, &out->data);
+ unmarshal_4(ctx, &out->max_msg_size);
+ unmarshal_s(ctx, &out->version);
}
-LM_FLATTEN static void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwrite *out) {
+LM_FLATTEN static void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rerror *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->count);
+ unmarshal_s(ctx, &out->ename);
+#if CONFIG_9P_ENABLE_9P2000_u
+ if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->errno);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-LM_FLATTEN static void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tclunk *out) {
+LM_FLATTEN static void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twalk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
unmarshal_fid(ctx, &out->fid);
+ unmarshal_fid(ctx, &out->newfid);
+ unmarshal_2(ctx, &out->nwname);
+ out->wname = ctx->extra;
+ ctx->extra += sizeof(out->wname[0]) * out->nwname;
+ for (typeof(out->nwname) i = 0; i < out->nwname; i++)
+ unmarshal_s(ctx, &out->wname[i]);
}
-LM_FLATTEN static void unmarshal_Rclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rclunk *out) {
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#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));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
+ unmarshal_4(ctx, &out->fid);
+ unmarshal_2(ctx, &out->nwname);
+ out->wname = ctx->extra;
+ ctx->extra += sizeof(out->wname[0]) * out->nwname;
+ for (typeof(out->nwname) i = 0; i < out->nwname; i++)
+ unmarshal_s(ctx, &out->wname[i]);
}
-LM_FLATTEN static void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tremove *out) {
+LM_FLATTEN static void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tswrite *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
+ unmarshal_4(ctx, &out->fid);
+ unmarshal_2(ctx, &out->nwname);
+ out->wname = ctx->extra;
+ ctx->extra += sizeof(out->wname[0]) * out->nwname;
+ for (typeof(out->nwname) i = 0; i < out->nwname; i++)
+ unmarshal_s(ctx, &out->wname[i]);
+ unmarshal_d(ctx, &out->data);
}
-LM_FLATTEN static void unmarshal_Rremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rremove *out) {
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
+LM_ALWAYS_INLINE static void unmarshal_qid(struct _unmarshal_ctx *ctx, struct lib9p_qid *out) {
+ memset(out, 0, sizeof(*out));
+ unmarshal_qt(ctx, &out->type);
+ unmarshal_4(ctx, &out->vers);
+ unmarshal_8(ctx, &out->path);
+}
+
+LM_FLATTEN static void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tauth *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
+ unmarshal_fid(ctx, &out->afid);
+ unmarshal_s(ctx, &out->uname);
+ unmarshal_s(ctx, &out->aname);
+#if CONFIG_9P_ENABLE_9P2000_u
+ if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_nuid(ctx, &out->n_uid);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-LM_FLATTEN static void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) {
+LM_FLATTEN static void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
unmarshal_fid(ctx, &out->fid);
+ unmarshal_fid(ctx, &out->afid);
+ unmarshal_s(ctx, &out->uname);
+ unmarshal_s(ctx, &out->aname);
+#if CONFIG_9P_ENABLE_9P2000_u
+ if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_nuid(ctx, &out->n_uid);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-LM_FLATTEN static void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) {
+LM_FLATTEN static void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- ctx->net_offset += 2;
- unmarshal_stat(ctx, &out->stat);
+ unmarshal_fid(ctx, &out->fid);
+ unmarshal_o(ctx, &out->mode);
}
-LM_FLATTEN static void unmarshal_Twstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twstat *out) {
+LM_FLATTEN static void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tcreate *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
unmarshal_fid(ctx, &out->fid);
+ unmarshal_s(ctx, &out->name);
+ unmarshal_dm(ctx, &out->perm);
+ unmarshal_o(ctx, &out->mode);
+}
+
+LM_ALWAYS_INLINE static void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) {
+ memset(out, 0, sizeof(*out));
ctx->net_offset += 2;
- unmarshal_stat(ctx, &out->stat);
+ unmarshal_2(ctx, &out->kern_type);
+ unmarshal_4(ctx, &out->kern_dev);
+ unmarshal_qid(ctx, &out->file_qid);
+ unmarshal_dm(ctx, &out->file_mode);
+ unmarshal_4(ctx, &out->file_atime);
+ unmarshal_4(ctx, &out->file_mtime);
+ unmarshal_8(ctx, &out->file_size);
+ unmarshal_s(ctx, &out->file_name);
+ unmarshal_s(ctx, &out->file_owner_uid);
+ unmarshal_s(ctx, &out->file_owner_gid);
+ unmarshal_s(ctx, &out->file_last_modified_uid);
+#if CONFIG_9P_ENABLE_9P2000_u
+ if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_s(ctx, &out->file_extension);
+ if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_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);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-LM_FLATTEN static void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwstat *out) {
+LM_FLATTEN static void unmarshal_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rauth *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
+ unmarshal_qid(ctx, &out->aqid);
}
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_e
-LM_FLATTEN static void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsession *out) {
+LM_FLATTEN static void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rattach *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_8(ctx, &out->key);
+ unmarshal_qid(ctx, &out->qid);
}
-LM_FLATTEN static void unmarshal_Rsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsession *out) {
+LM_FLATTEN static void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwalk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
+ unmarshal_2(ctx, &out->nwqid);
+ out->wqid = ctx->extra;
+ ctx->extra += sizeof(out->wqid[0]) * out->nwqid;
+ for (typeof(out->nwqid) i = 0; i < out->nwqid; i++)
+ unmarshal_qid(ctx, &out->wqid[i]);
}
-LM_FLATTEN static void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsread *out) {
+LM_FLATTEN static void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->fid);
- unmarshal_2(ctx, &out->nwname);
- out->wname = ctx->extra;
- ctx->extra += sizeof(out->wname[0]) * out->nwname;
- for (typeof(out->nwname) i = 0; i < out->nwname; i++)
- unmarshal_s(ctx, &out->wname[i]);
+ unmarshal_qid(ctx, &out->qid);
+ unmarshal_4(ctx, &out->iounit);
}
-LM_FLATTEN static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) {
+LM_FLATTEN static void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rcreate *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_d(ctx, &out->data);
+ unmarshal_qid(ctx, &out->qid);
+ unmarshal_4(ctx, &out->iounit);
}
-LM_FLATTEN static void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tswrite *out) {
+LM_FLATTEN static void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->fid);
- unmarshal_2(ctx, &out->nwname);
- out->wname = ctx->extra;
- ctx->extra += sizeof(out->wname[0]) * out->nwname;
- for (typeof(out->nwname) i = 0; i < out->nwname; i++)
- unmarshal_s(ctx, &out->wname[i]);
- unmarshal_d(ctx, &out->data);
+ ctx->net_offset += 2;
+ unmarshal_stat(ctx, &out->stat);
}
-LM_FLATTEN static void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rswrite *out) {
+LM_FLATTEN static void unmarshal_Twstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->count);
+ unmarshal_fid(ctx, &out->fid);
+ ctx->net_offset += 2;
+ unmarshal_stat(ctx, &out->stat);
}
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
/* marshal_* ******************************************************************/
@@ -1267,178 +1312,136 @@ LM_ALWAYS_INLINE static bool marshal_qt(struct _marshal_ctx *ctx, lib9p_qt_t *va
return marshal_1(ctx, (uint8_t *)&masked_val);
}
-LM_ALWAYS_INLINE static bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) {
- return false
- || marshal_qt(ctx, &val->type)
- || marshal_4(ctx, &val->vers)
- || marshal_8(ctx, &val->path)
- ;
-}
-
-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;
- return false
- || ({ _stat_size_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); })
- || ({ _kern_type_offset = ctx->net_offset; marshal_2(ctx, &val->kern_type); })
- || marshal_4(ctx, &val->kern_dev)
- || marshal_qid(ctx, &val->file_qid)
- || marshal_dm(ctx, &val->file_mode)
- || marshal_4(ctx, &val->file_atime)
- || marshal_4(ctx, &val->file_mtime)
- || marshal_8(ctx, &val->file_size)
- || marshal_s(ctx, &val->file_name)
- || marshal_s(ctx, &val->file_owner_uid)
- || marshal_s(ctx, &val->file_owner_gid)
- || marshal_s(ctx, &val->file_last_modified_uid)
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_s(ctx, &val->file_extension) )
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_owner_n_uid) )
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_owner_n_gid) )
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->file_last_modified_n_uid) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
- || ({ encode_u16le(ctx->net_offset - _kern_type_offset, &ctx->net_bytes[_stat_size_offset]); false; })
- ;
+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 */
+#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);
}
-LM_FLATTEN static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) {
+LM_FLATTEN static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_4(ctx, &val->max_msg_size)
- || marshal_s(ctx, &val->version)
+ || marshal_2(ctx, &val->oldtag)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(100, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(108, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion *val) {
+LM_FLATTEN static bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rflush *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_4(ctx, &val->max_msg_size)
- || marshal_s(ctx, &val->version)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(101, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(109, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val) {
+LM_FLATTEN static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_fid(ctx, &val->afid)
- || marshal_s(ctx, &val->uname)
- || marshal_s(ctx, &val->aname)
-#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->n_uname) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ || marshal_4(ctx, &val->count)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(102, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(119, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) {
+LM_FLATTEN static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_qid(ctx, &val->aqid)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(103, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(121, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *val) {
+LM_FLATTEN static bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_fid(ctx, &val->fid)
- || marshal_fid(ctx, &val->afid)
- || marshal_s(ctx, &val->uname)
- || marshal_s(ctx, &val->aname)
-#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->n_uname) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(104, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(123, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) {
+LM_FLATTEN static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_qid(ctx, &val->qid)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(105, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(127, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) {
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#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;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_s(ctx, &val->ename)
-#if CONFIG_9P_ENABLE_9P2000_u
- || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->errno) )
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ || marshal_8(ctx, &val->key)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(107, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(150, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) {
+LM_FLATTEN static bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_Rsession *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_2(ctx, &val->oldtag)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(108, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(151, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rflush *val) {
+LM_FLATTEN static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
+ || marshal_4(ctx, &val->count)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(109, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(155, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) {
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || 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;
return false
@@ -1446,35 +1449,27 @@ LM_FLATTEN static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
|| marshal_fid(ctx, &val->fid)
- || marshal_fid(ctx, &val->newfid)
- || marshal_2(ctx, &val->nwname)
- || ({ bool err = false;
- for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
- err = marshal_s(ctx, &val->wname[i]);
- err; })
+ || 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(110, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(116, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val) {
+LM_FLATTEN static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_2(ctx, &val->nwqid)
- || ({ bool err = false;
- for (typeof(val->nwqid) i = 0; i < val->nwqid && !err; i++)
- err = marshal_qid(ctx, &val->wqid[i]);
- err; })
+ || marshal_fid(ctx, &val->fid)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(111, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(120, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) {
+LM_FLATTEN static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1482,113 +1477,114 @@ LM_FLATTEN static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
|| marshal_fid(ctx, &val->fid)
- || marshal_o(ctx, &val->mode)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(112, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(122, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) {
+LM_FLATTEN static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_qid(ctx, &val->qid)
- || marshal_4(ctx, &val->iounit)
+ || marshal_fid(ctx, &val->fid)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(113, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(124, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *val) {
+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_fid(ctx, &val->fid)
- || marshal_s(ctx, &val->name)
- || marshal_dm(ctx, &val->perm)
- || marshal_o(ctx, &val->mode)
+ || marshal_d(ctx, &val->data)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(114, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(117, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *val) {
+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_qid(ctx, &val->qid)
- || marshal_4(ctx, &val->iounit)
+ || marshal_fid(ctx, &val->fid)
+ || marshal_8(ctx, &val->offset)
+ || marshal_d(ctx, &val->data)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(115, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(118, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val) {
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_e
+LM_FLATTEN static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_fid(ctx, &val->fid)
- || marshal_8(ctx, &val->offset)
- || marshal_4(ctx, &val->count)
+ || marshal_d(ctx, &val->data)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(116, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(153, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) {
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || 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;
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)
+ || marshal_4(ctx, &val->max_msg_size)
+ || marshal_s(ctx, &val->version)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(117, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(100, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) {
+LM_FLATTEN static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_fid(ctx, &val->fid)
- || marshal_8(ctx, &val->offset)
- || marshal_d(ctx, &val->data)
+ || marshal_4(ctx, &val->max_msg_size)
+ || marshal_s(ctx, &val->version)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(118, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(101, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) {
+LM_FLATTEN static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_4(ctx, &val->count)
+ || marshal_s(ctx, &val->ename)
+#if CONFIG_9P_ENABLE_9P2000_u
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->errno) )
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(119, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(107, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) {
+LM_FLATTEN static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1596,49 +1592,85 @@ LM_FLATTEN static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
|| marshal_fid(ctx, &val->fid)
+ || marshal_fid(ctx, &val->newfid)
+ || marshal_2(ctx, &val->nwname)
+ || ({ bool err = false;
+ for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
+ err = marshal_s(ctx, &val->wname[i]);
+ err; })
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(120, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(110, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *val) {
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#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;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
+ || marshal_4(ctx, &val->fid)
+ || marshal_2(ctx, &val->nwname)
+ || ({ bool err = false;
+ for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
+ err = marshal_s(ctx, &val->wname[i]);
+ err; })
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(121, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(152, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *val) {
+LM_FLATTEN static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_fid(ctx, &val->fid)
+ || marshal_4(ctx, &val->fid)
+ || marshal_2(ctx, &val->nwname)
+ || ({ bool err = false;
+ for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
+ err = marshal_s(ctx, &val->wname[i]);
+ err; })
+ || marshal_d(ctx, &val->data)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(122, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(154, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *val) {
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
+LM_ALWAYS_INLINE static bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) {
+ return false
+ || marshal_qt(ctx, &val->type)
+ || marshal_4(ctx, &val->vers)
+ || marshal_8(ctx, &val->path)
+ ;
+}
+
+LM_FLATTEN static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
+ || marshal_fid(ctx, &val->afid)
+ || marshal_s(ctx, &val->uname)
+ || marshal_s(ctx, &val->aname)
+#if CONFIG_9P_ENABLE_9P2000_u
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_nuid(ctx, &val->n_uid) )
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(123, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(102, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) {
+LM_FLATTEN static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1646,148 +1678,179 @@ LM_FLATTEN static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
|| marshal_fid(ctx, &val->fid)
+ || 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 */
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(124, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(104, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) {
+LM_FLATTEN static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
- uint32_t _nstat_offset;
- uint32_t _stat_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || ({ _nstat_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); })
- || ({ _stat_offset = ctx->net_offset; marshal_stat(ctx, &val->stat); })
+ || marshal_fid(ctx, &val->fid)
+ || marshal_o(ctx, &val->mode)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(125, &ctx->net_bytes[_typ_offset]); false; })
- || ({ encode_u16le(ctx->net_offset - _stat_offset, &ctx->net_bytes[_nstat_offset]); false; })
+ || ({ encode_u8le(112, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *val) {
+LM_FLATTEN static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
- uint32_t _nstat_offset;
- uint32_t _stat_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
|| marshal_fid(ctx, &val->fid)
- || ({ _nstat_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); })
- || ({ _stat_offset = ctx->net_offset; marshal_stat(ctx, &val->stat); })
+ || marshal_s(ctx, &val->name)
+ || marshal_dm(ctx, &val->perm)
+ || marshal_o(ctx, &val->mode)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(126, &ctx->net_bytes[_typ_offset]); false; })
- || ({ encode_u16le(ctx->net_offset - _stat_offset, &ctx->net_bytes[_nstat_offset]); false; })
+ || ({ encode_u8le(114, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *val) {
+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;
+ return false
+ || ({ _stat_size_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); })
+ || ({ _kern_type_offset = ctx->net_offset; marshal_2(ctx, &val->kern_type); })
+ || marshal_4(ctx, &val->kern_dev)
+ || marshal_qid(ctx, &val->file_qid)
+ || marshal_dm(ctx, &val->file_mode)
+ || marshal_4(ctx, &val->file_atime)
+ || marshal_4(ctx, &val->file_mtime)
+ || marshal_8(ctx, &val->file_size)
+ || marshal_s(ctx, &val->file_name)
+ || marshal_s(ctx, &val->file_owner_uid)
+ || marshal_s(ctx, &val->file_owner_gid)
+ || marshal_s(ctx, &val->file_last_modified_uid)
+#if CONFIG_9P_ENABLE_9P2000_u
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_s(ctx, &val->file_extension) )
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_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) )
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ || ({ encode_u16le(ctx->net_offset - _kern_type_offset, &ctx->net_bytes[_stat_size_offset]); false; })
+ ;
+}
+
+LM_FLATTEN static bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
+ || marshal_qid(ctx, &val->aqid)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(127, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(103, &ctx->net_bytes[_typ_offset]); false; })
;
}
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_e
-LM_FLATTEN static bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession *val) {
+LM_FLATTEN static bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_8(ctx, &val->key)
+ || marshal_qid(ctx, &val->qid)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(150, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(105, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_Rsession *val) {
+LM_FLATTEN static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
+ || marshal_2(ctx, &val->nwqid)
+ || ({ bool err = false;
+ for (typeof(val->nwqid) i = 0; i < val->nwqid && !err; i++)
+ err = marshal_qid(ctx, &val->wqid[i]);
+ err; })
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(151, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(111, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *val) {
+LM_FLATTEN static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_4(ctx, &val->fid)
- || marshal_2(ctx, &val->nwname)
- || ({ bool err = false;
- for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
- err = marshal_s(ctx, &val->wname[i]);
- err; })
+ || marshal_qid(ctx, &val->qid)
+ || marshal_4(ctx, &val->iounit)
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(152, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(113, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) {
+LM_FLATTEN static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_d(ctx, &val->data)
+ || 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(153, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(115, &ctx->net_bytes[_typ_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *val) {
+LM_FLATTEN static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
+ uint32_t _nstat_offset;
+ uint32_t _stat_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_4(ctx, &val->fid)
- || marshal_2(ctx, &val->nwname)
- || ({ bool err = false;
- for (typeof(val->nwname) i = 0; i < val->nwname && !err; i++)
- err = marshal_s(ctx, &val->wname[i]);
- err; })
- || marshal_d(ctx, &val->data)
+ || ({ _nstat_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); })
+ || ({ _stat_offset = ctx->net_offset; marshal_stat(ctx, &val->stat); })
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(154, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(125, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u16le(ctx->net_offset - _stat_offset, &ctx->net_bytes[_nstat_offset]); false; })
;
}
-LM_FLATTEN static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) {
+LM_FLATTEN static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
+ uint32_t _nstat_offset;
+ uint32_t _stat_offset;
return false
|| ({ _size_offset = ctx->net_offset; ({ ctx->net_offset += 4; false; }); })
|| ({ _typ_offset = ctx->net_offset; ({ ctx->net_offset += 1; false; }); })
|| marshal_tag(ctx, &val->tag)
- || marshal_4(ctx, &val->count)
+ || marshal_fid(ctx, &val->fid)
+ || ({ _nstat_offset = ctx->net_offset; ({ ctx->net_offset += 2; false; }); })
+ || ({ _stat_offset = ctx->net_offset; marshal_stat(ctx, &val->stat); })
|| ({ encode_u32le(ctx->net_offset - _size_offset, &ctx->net_bytes[_size_offset]); false; })
- || ({ encode_u8le(155, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u8le(126, &ctx->net_bytes[_typ_offset]); false; })
+ || ({ encode_u16le(ctx->net_offset - _stat_offset, &ctx->net_bytes[_nstat_offset]); false; })
;
}
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
/* tables / exports ***********************************************************/
#define _MSG_NAME(typ) [LIB9P_TYP_##typ] = #typ
diff --git a/lib9p/idl.gen b/lib9p/idl.gen
index e796855..31f6527 100755
--- a/lib9p/idl.gen
+++ b/lib9p/idl.gen
@@ -5,8 +5,10 @@
# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
+import graphlib
import os.path
import sys
+import typing
sys.path.insert(0, os.path.normpath(os.path.join(__file__, "..")))
@@ -90,6 +92,10 @@ def c_expr(expr: idl.Expr) -> str:
ret += [str(tok.val)]
case idl.ExprSym(name="end"):
ret += ["ctx->net_offset"]
+ case idl.ExprSym(name="s32_max"):
+ ret += ["INT32_MAX"]
+ case idl.ExprSym(name="s64_max"):
+ ret += ["INT64_MAX"]
case idl.ExprSym():
ret += [f"_{tok.name[1:]}_offset"]
return " ".join(ret)
@@ -137,6 +143,24 @@ def ifdef_pop(n: int) -> str:
return ret
+def topo_sorted(typs: list[idl.Type]) -> typing.Iterable[idl.Type]:
+ ts: graphlib.TopologicalSorter[idl.Type] = graphlib.TopologicalSorter()
+ for typ in typs:
+ match typ:
+ case idl.Number():
+ ts.add(typ)
+ case idl.Bitfield():
+ ts.add(typ)
+ case idl.Struct(): # and idl.Message():
+ deps = [
+ member.typ
+ for member in typ.members
+ if not isinstance(member.typ, idl.Primitive)
+ ]
+ ts.add(typ, *deps)
+ return ts.static_order()
+
+
# Generate .h ##################################################################
@@ -197,12 +221,16 @@ enum {idprefix}version {{
ret += """
/* payload types **************************************************************/
"""
- for typ in typs:
+ for typ in topo_sorted(typs):
ret += "\n"
ret += ifdef_push(1, c_ver_ifdef(typ.in_versions))
match typ:
case idl.Number():
ret += f"typedef {c_typename(typ.prim)} {c_typename(typ)};\n"
+ prefix = f"{idprefix.upper()}{typ.name.upper()}_"
+ namewidth = max(len(name) for name in typ.vals)
+ for name, val in typ.vals.items():
+ ret += f"#define {prefix}{name.ljust(namewidth)} (({c_typename(typ)})UINT{typ.static_size*8}_C({val}))\n"
case idl.Bitfield():
ret += f"typedef {c_typename(typ.prim)} {c_typename(typ)};\n"
names = [
@@ -381,7 +409,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)
"""
- for typ in typs:
+ for typ in topo_sorted(typs):
inline = "LM_FLATTEN" if isinstance(typ, idl.Message) else "LM_ALWAYS_INLINE"
argfn = unused if (isinstance(typ, idl.Struct) and not typ.members) else used
ret += "\n"
@@ -480,13 +508,17 @@ LM_ALWAYS_INLINE static bool _validate_list(struct _validate_ctx *ctx,
# Pass 4 - validate ,max= and ,val= constraints
for member in typ.members:
if member.max:
+ assert member.static_size
+ nbits = member.static_size * 8
ret += ifdef_push(2, c_ver_ifdef(member.in_versions))
- ret += f"\t || ({{ uint32_t max = {c_expr(member.max)}; (((uint32_t){member.name}) > max) &&\n"
- ret += f'\t lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "{member.name} value is too large (%"PRIu32" > %"PRIu32")", {member.name}, max); }})\n'
+ ret += f"\t || ({{ uint{nbits}_t max = {c_expr(member.max)}; (((uint{nbits}_t){member.name}) > max) &&\n"
+ ret += f'\t lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "{member.name} value is too large (%"PRIu{nbits}" > %"PRIu{nbits}")", {member.name}, max); }})\n'
if member.val:
+ assert member.static_size
+ nbits = member.static_size * 8
ret += ifdef_push(2, c_ver_ifdef(member.in_versions))
- ret += f"\t || ({{ uint32_t exp = {c_expr(member.val)}; (((uint32_t){member.name}) != exp) &&\n"
- ret += f'\t lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "{member.name} value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t){member.name}, exp); }})\n'
+ ret += f"\t || ({{ uint{nbits}_t exp = {c_expr(member.val)}; (((uint{nbits}_t){member.name}) != exp) &&\n"
+ ret += f'\t lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "{member.name} value is wrong (actual:%"PRIu{nbits}" != correct:%"PRIu{nbits}")", (uint{nbits}_t){member.name}, exp); }})\n'
ret += ifdef_pop(1)
ret += "\t ;\n"
@@ -517,7 +549,7 @@ LM_ALWAYS_INLINE static void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *o
\tctx->net_offset += 8;
}
"""
- for typ in typs:
+ for typ in topo_sorted(typs):
inline = "LM_FLATTEN" if isinstance(typ, idl.Message) else "LM_ALWAYS_INLINE"
argfn = unused if (isinstance(typ, idl.Struct) and not typ.members) else used
ret += "\n"
@@ -610,7 +642,7 @@ LM_ALWAYS_INLINE static bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val)
\treturn false;
}
"""
- for typ in typs:
+ for typ in topo_sorted(typs):
inline = "LM_FLATTEN" if isinstance(typ, idl.Message) else "LM_ALWAYS_INLINE"
argfn = unused if (isinstance(typ, idl.Struct) and not typ.members) else used
ret += "\n"
diff --git a/lib9p/idl/0000-README.md b/lib9p/idl/0000-README.md
index 86862b7..036de22 100644
--- a/lib9p/idl/0000-README.md
+++ b/lib9p/idl/0000-README.md
@@ -1,7 +1,7 @@
<!--
lib9p/idl/0000-README.md - Overview of 9P protocol definitions
- Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
@@ -35,7 +35,7 @@ bitfields,
structures,
- struct STRUCTNAME = "FILENAME[FIELDTYPE]..."
+ struct STRUCTNAME = "FIELDNAME[FIELDTYPE]..."
and messages (which are a special-case of structures).
@@ -44,8 +44,21 @@ and messages (which are a special-case of structures).
Struct fields that have numeric types (either primitives or `num`
types) can add to their type `,val=` and/or `,max=` to specify what
the exact value must be and/or what the maximum (inclusive) value is.
+A field that is repeated a variable number of times be wrapped in
+parenthesis and prefixed with the fieldname containing that count:
+`OTHERFIELDNAME*(FIELDNAME[FIELDTYPE])`.
`,val=` and `,max` take a string of `+`/`-` tokens and values; a value
-can either be a decimal numeric constant (eg: `107`), the `&fieldname`
-to refer to the offset of a field name in that struct, or the special
-value `end` to refer to the offset of the end of the struct.
+can be
+ - a decimal numeric constant (eg: `107`),
+ - `&fieldname` to refer to the offset of a field name in that struct,
+ - the special value `end` to refer to the offset of the end of the
+ struct,
+ - the special value `s32_max` to refer to the constant value
+ `(1<<31)-1`, or
+ - the special value `s64_max` to refer to the constant value
+ `(1<<63)-1`
+
+A parser for this syntax is given in `__init__.py`. However,
+`__init__.py` places the somewhat arbitrary undocumented restrictions
+on fields referenced as the count for a repeated field.
diff --git a/lib9p/idl/1992-9P0.9p.wip b/lib9p/idl/1992-9P0.9p.wip
index 27d6b33..15997d9 100644
--- a/lib9p/idl/1992-9P0.9p.wip
+++ b/lib9p/idl/1992-9P0.9p.wip
@@ -1,6 +1,6 @@
# lib9p/idl/1992-9P0.9p - Definitions of 9P0 (Plan 9 1st ed) messages
#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
# https://man.cat-v.org/plan_9_1st_ed/5/
@@ -18,36 +18,39 @@ struct qid = "path[4] version[4]"
# a nul-padded string
struct name = 28*(txt[1])
-msg Tnop = "typ[1,val=TODO] tag[tag,val=0xFFFF]"
-msg Rnop = "typ[1,val=TODO] tag[tag,val=0xFFFF]"
-msg Tsession = "typ[1,val=TODO] tag[tag,val=0xFFFF]"
-msg Rsession = "typ[1,val=TODO] tag[tag,val=0xFFFF]"
-msg Rerror = "typ[1,val=TODO] tag[tag] ename[64]"
-msg Tflush = "typ[1,val=TODO] tag[tag] oldtag[tag]"
-msg Rflush = "typ[1,val=TODO] tag[tag]"
-msg Tauth = "typ[1,val=TODO] tag[tag] fid[fid] uid[28] chal[36]"
-msg Rauth = "typ[1,val=TODO] tag[tag] fid[fid] chal[30]"
-msg Tattach = "typ[1,val=TODO] tag[tag] fid[fid] uid[28] aname[28] auth[28]"
-msg Rattach = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Tclone = "typ[1,val=TODO] tag[tag] fid[fid] newfid[fid]"
-msg Rclone = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Tclwalk = "typ[1,val=TODO] tag[tag] fid[fid] newfid[fid] name[28]"
-msg Rclwalk = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Twalk = "typ[1,val=TODO] tag[tag] fid[fid] name[28]"
-msg Rwalk = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Topen = "typ[1,val=TODO] tag[tag] fid[fid] mode[1]"
-msg Ropen = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Tcreate = "typ[1,val=TODO] tag[tag] fid[fid] name[28] perm[4] mode[1]"
-msg Rcreate = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Tread = "typ[1,val=TODO] tag[tag] fid[fid] offset[8] count[2,max=8192]"
-msg Rread = "typ[1,val=TODO] tag[tag] fid[fid] count[2,max=8192] pad[1] count*(data[1])"
-msg Twrite = "typ[1,val=TODO] tag[tag] fid[fid] offset[8] count[2,max=8192] pad[1] count*(data[1])"
-msg Rwrite = "typ[1,val=TODO] tag[tag] fid[fid] count[2,max=8192]"
-msg Tclunk = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Rclunk = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Tremove = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Rremove = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Tstat = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Rstat = "typ[1,val=TODO] tag[tag] fid[fid] stat[116]"
-msg Twstat = "typ[1,val=TODO] tag[tag] fid[fid] stat[116]"
-msg Rwstat = "typ[1,val=TODO] tag[tag] fid[fid]"
+msg Tmux = "typ[1,val=48] mux[2]" # Undocumented, but implemented by mux(3) / libmux.a
+#msg Rmux = "typ[1,val=49] illegal"
+msg Tnop = "typ[1,val=50] tag[tag,val=0xFFFF]"
+msg Rnop = "typ[1,val=51] tag[tag,val=0xFFFF]"
+msg Tsession = "typ[1,val=52] tag[tag,val=0xFFFF]"
+msg Rsession = "typ[1,val=53] tag[tag,val=0xFFFF]"
+#msg Terror = "typ[1,val=54] illegal"
+msg Rerror = "typ[1,val=55] tag[tag] ename[64]"
+msg Tflush = "typ[1,val=56] tag[tag] oldtag[tag]"
+msg Rflush = "typ[1,val=57] tag[tag]"
+msg Tattach = "typ[1,val=58] tag[tag] fid[fid] uid[28] aname[28] auth[28]"
+msg Rattach = "typ[1,val=59] tag[tag] fid[fid] qid[8]"
+msg Tclone = "typ[1,val=60] tag[tag] fid[fid] newfid[fid]"
+msg Rclone = "typ[1,val=61] tag[tag] fid[fid]"
+msg Twalk = "typ[1,val=62] tag[tag] fid[fid] name[28]"
+msg Rwalk = "typ[1,val=63] tag[tag] fid[fid] qid[8]"
+msg Topen = "typ[1,val=64] tag[tag] fid[fid] mode[1]"
+msg Ropen = "typ[1,val=65] tag[tag] fid[fid] qid[8]"
+msg Tcreate = "typ[1,val=66] tag[tag] fid[fid] name[28] perm[4] mode[1]"
+msg Rcreate = "typ[1,val=67] tag[tag] fid[fid] qid[8]"
+msg Tread = "typ[1,val=68] tag[tag] fid[fid] offset[8] count[2,max=8192]"
+msg Rread = "typ[1,val=69] tag[tag] fid[fid] count[2,max=8192] pad[1] count*(data[1])"
+msg Twrite = "typ[1,val=70] tag[tag] fid[fid] offset[8] count[2,max=8192] pad[1] count*(data[1])"
+msg Rwrite = "typ[1,val=71] tag[tag] fid[fid] count[2,max=8192]"
+msg Tclunk = "typ[1,val=72] tag[tag] fid[fid]"
+msg Rclunk = "typ[1,val=73] tag[tag] fid[fid]"
+msg Tremove = "typ[1,val=74] tag[tag] fid[fid]"
+msg Rremove = "typ[1,val=75] tag[tag] fid[fid]"
+msg Tstat = "typ[1,val=76] tag[tag] fid[fid]"
+msg Rstat = "typ[1,val=77] tag[tag] fid[fid] stat[116]"
+msg Twstat = "typ[1,val=78] tag[tag] fid[fid] stat[116]"
+msg Rwstat = "typ[1,val=79] tag[tag] fid[fid]"
+msg Tclwalk = "typ[1,val=80] tag[tag] fid[fid] newfid[fid] name[28]"
+msg Rclwalk = "typ[1,val=81] tag[tag] fid[fid] qid[8]"
+msg Tauth = "typ[1,val=82] tag[tag] fid[fid] uid[28] chal[36]"
+msg Rauth = "typ[1,val=83] tag[tag] fid[fid] chal[30]"
diff --git a/lib9p/idl/1995-9P1.9p.wip b/lib9p/idl/1995-9P1.9p.wip
index 30b9112..2812cda 100644
--- a/lib9p/idl/1995-9P1.9p.wip
+++ b/lib9p/idl/1995-9P1.9p.wip
@@ -1,6 +1,6 @@
# lib9p/idl/1995-9P1.9p - Definitions of 9P1 (Plan 9 2nd ed and 3rd ed) messages
#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
# https://man.cat-v.org/plan_9_2nd_ed/5/
@@ -19,34 +19,41 @@ struct qid = "path[4] version[4]"
# a nul-padded string
struct name = 28*(txt[1])
-msg Tnop = "typ[1,val=TODO] tag[tag,val=0xFFFF]"
-msg Rnop = "typ[1,val=TODO] tag[tag,val=0xFFFF]"
-msg Tsession = "typ[1,val=TODO] tag[tag,val=0xFFFF] chal[8]"
-msg Rsession = "typ[1,val=TODO] tag[tag,val=0xFFFF] chal[8] authid[28] authdom[48]"
-msg Rerror = "typ[1,val=TODO] tag[tag] ename[64]"
-msg Tflush = "typ[1,val=TODO] tag[tag] oldtag[tag]"
-msg Rflush = "typ[1,val=TODO] tag[tag]"
-msg Tattach = "typ[1,val=TODO] tag[tag] fid[fid] uid[28] aname[28] ticket[72] auth[13]"
-msg Rattach = "typ[1,val=TODO] tag[tag] fid[fid] qid[8] rauth[13]"
-msg Tclone = "typ[1,val=TODO] tag[tag] fid[fid] newfid[fid]"
-msg Rclone = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Tclwalk = "typ[1,val=TODO] tag[tag] fid[fid] newfid[fid] name[28]"
-msg Rclwalk = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Twalk = "typ[1,val=TODO] tag[tag] fid[fid] name[28]"
-msg Rwalk = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Topen = "typ[1,val=TODO] tag[tag] fid[fid] mode[1]"
-msg Ropen = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Tcreate = "typ[1,val=TODO] tag[tag] fid[fid] name[28] perm[4] mode[1]"
-msg Rcreate = "typ[1,val=TODO] tag[tag] fid[fid] qid[8]"
-msg Tread = "typ[1,val=TODO] tag[tag] fid[fid] offset[8] count[2,max=8192]"
-msg Rread = "typ[1,val=TODO] tag[tag] fid[fid] count[2,max=8192] pad[1] count*(data[1])"
-msg Twrite = "typ[1,val=TODO] tag[tag] fid[fid] offset[8] count[2,max=8192] pad[1] count*(data[1])"
-msg Rwrite = "typ[1,val=TODO] tag[tag] fid[fid] count[2,max=8192]"
-msg Tclunk = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Rclunk = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Tremove = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Rremove = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Tstat = "typ[1,val=TODO] tag[tag] fid[fid]"
-msg Rstat = "typ[1,val=TODO] tag[tag] fid[fid] stat[116]"
-msg Twstat = "typ[1,val=TODO] tag[tag] fid[fid] stat[116]"
-msg Rwstat = "typ[1,val=TODO] tag[tag] fid[fid]"
+msg Tnop = "typ[1,val=50] tag[tag,val=0xFFFF]"
+msg Rnop = "typ[1,val=51] tag[tag,val=0xFFFF]"
+#msg Tosession = "typ[1,val=52] illegal"
+#msg Rosession = "typ[1,val=53] illegal"
+#msg Terror = "typ[1,val=54] illegal"
+msg Rerror = "typ[1,val=55] tag[tag] ename[64]"
+msg Tflush = "typ[1,val=56] tag[tag] oldtag[tag]"
+msg Rflush = "typ[1,val=57] tag[tag]"
+#msg Toattach = "typ[1,val=58] illegal"
+#msg Roattach = "typ[1,val=59] illegal"
+msg Tclone = "typ[1,val=60] tag[tag] fid[fid] newfid[fid]"
+msg Rclone = "typ[1,val=61] tag[tag] fid[fid]"
+msg Twalk = "typ[1,val=62] tag[tag] fid[fid] name[28]"
+msg Rwalk = "typ[1,val=63] tag[tag] fid[fid] qid[8]"
+msg Topen = "typ[1,val=64] tag[tag] fid[fid] mode[1]"
+msg Ropen = "typ[1,val=65] tag[tag] fid[fid] qid[8]"
+msg Tcreate = "typ[1,val=66] tag[tag] fid[fid] name[28] perm[4] mode[1]"
+msg Rcreate = "typ[1,val=67] tag[tag] fid[fid] qid[8]"
+msg Tread = "typ[1,val=68] tag[tag] fid[fid] offset[8,max=s64_max] count[2,max=8192]"
+msg Rread = "typ[1,val=69] tag[tag] fid[fid] count[2,max=8192] pad[1] count*(data[1])"
+msg Twrite = "typ[1,val=70] tag[tag] fid[fid] offset[8] count[2,max=8192] pad[1] count*(data[1])"
+msg Rwrite = "typ[1,val=71] tag[tag] fid[fid] count[2,max=8192]"
+msg Tclunk = "typ[1,val=72] tag[tag] fid[fid]"
+msg Rclunk = "typ[1,val=73] tag[tag] fid[fid]"
+msg Tremove = "typ[1,val=74] tag[tag] fid[fid]"
+msg Rremove = "typ[1,val=75] tag[tag] fid[fid]"
+msg Tstat = "typ[1,val=76] tag[tag] fid[fid]"
+msg Rstat = "typ[1,val=77] tag[tag] fid[fid] stat[116]"
+msg Twstat = "typ[1,val=78] tag[tag] fid[fid] stat[116]"
+msg Rwstat = "typ[1,val=79] tag[tag] fid[fid]"
+msg Tclwalk = "typ[1,val=80] tag[tag] fid[fid] newfid[fid] name[28]"
+msg Rclwalk = "typ[1,val=81] tag[tag] fid[fid] qid[8]"
+#msg Toauth = typ[1,val=82] illegal"
+#msg Roauth = typ[1,val=83] illegal"
+msg Tsession = "typ[1,val=84] tag[tag,val=0xFFFF] chal[8]"
+msg Rsession = "typ[1,val=85] tag[tag,val=0xFFFF] chal[8] authid[28] authdom[48]"
+msg Tattach = "typ[1,val=86] tag[tag] fid[fid] uid[28] aname[28] ticket[72] auth[13]"
+msg Rattach = "typ[1,val=87] tag[tag] fid[fid] qid[8] rauth[13]"
diff --git a/lib9p/idl/2002-9P2000.9p b/lib9p/idl/2002-9P2000.9p
index c83f439..c1cd74b 100644
--- a/lib9p/idl/2002-9P2000.9p
+++ b/lib9p/idl/2002-9P2000.9p
@@ -1,6 +1,6 @@
# lib9p/idl/2002-9P2000.9p - Definitions of 9P2000 messages
#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
# "9P2000" base protocol
@@ -9,21 +9,26 @@
#
# But due to incompleteness of the draft RFC, the Plan 9 manual
# section-5 and the Plan 9 headers (particularly fcall.h) are often
-# better references.
+# better references. The s{32,64}_max limitations are not documented
+# in the draft RFC or the manual pages, but have been enforced by
+# lib9p/srv.c in every release of Plan 9 4e.
#
# https://github.com/plan9foundation/plan9/tree/main/sys/man/5
# https://man.cat-v.org/plan_9/5/
# https://github.com/plan9foundation/plan9/blob/main/sys/include/fcall.h
+# https://github.com/plan9foundation/plan9/blob/main/sys/src/lib9p/srv.c
version "9P2000"
# tag - identify a request/response pair
num tag = 2
+ "NOTAG = ~0"
# file identifier - like a UNIX file-descriptor
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 = "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])"
@@ -136,9 +141,9 @@ 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] 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]"
msg Rread = "size[4,val=end-&size] typ[1,val=117] tag[tag] data[d]" # 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] data[d]"
+msg Twrite = "size[4,val=end-&size] typ[1,val=118] tag[tag] fid[fid] offset[8,max=s64_max] data[d]"
msg Rwrite = "size[4,val=end-&size] typ[1,val=119] tag[tag] count[4]"
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]"
diff --git a/lib9p/idl/2005-9P2000.u.9p b/lib9p/idl/2005-9P2000.u.9p
index 3eab4ad..d96bbce 100644
--- a/lib9p/idl/2005-9P2000.u.9p
+++ b/lib9p/idl/2005-9P2000.u.9p
@@ -1,6 +1,6 @@
# lib9p/idl/2005-9P2000.u.9p - Definitions of 9P2000.u messages
#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
# "9P2000.u" Unix extension
@@ -10,13 +10,17 @@ version "9P2000.u"
from ./2002-9P2000.9p import *
+# numeric user ID
+num nuid = 4
+ "NONUID = ~0"
+
struct stat += "file_extension[s]"
- "file_owner_n_uid[4]"
- "file_owner_n_gid[4]"
- "file_last_modified_n_uid[4]"
+ "file_owner_n_uid[nuid]"
+ "file_owner_n_gid[nuid]"
+ "file_last_modified_n_uid[nuid]"
-msg Tauth += "n_uname[4]"
-msg Tattach += "n_uname[4]"
+msg Tauth += "n_uid[nuid]"
+msg Tattach += "n_uid[nuid]"
msg Rerror += "errno[4]"
diff --git a/lib9p/idl/2010-9P2000.L.9p.wip b/lib9p/idl/2010-9P2000.L.9p.wip
index f5e79c5..972e7d0 100644
--- a/lib9p/idl/2010-9P2000.L.9p.wip
+++ b/lib9p/idl/2010-9P2000.L.9p.wip
@@ -1,56 +1,106 @@
# lib9p/idl/2010-9P2000.L.9p - Definitions of 9P2000.L messages
#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
# "9P2000.L" Linux extension
# https://github.com/chaos/diod/blob/master/protocol.md
version "9P2000.L"
-from ./2002-9P2000.9p import *
-from ./2005-9P2000.u.9p import Tauth, Tattach
+from ./2002-9P2000.9p import tag, fid, s, qt, qid, 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
+
+bitfield getattr = 8
+ "0=MODE"
+ "1=NLINK"
+ "2=UID"
+ "3=GID"
+ "4=RDEV"
+ "5=ATIME"
+ "6=MTIME"
+ "7=CTIME"
+ "8=INO"
+ "9=SIZE"
+ "10=BLOCKS"
+
+ "11=BTIME"
+ "12=GEN"
+ "13=DATA_VERSION"
+
+ "BASIC=0x000007ff" # Mask for fields up to BLOCKS
+ "ALL =0x00003fff" # Mask for All fields above
+
+bitfield setattr = 4
+ "0=MODE"
+ "1=UID"
+ "2=GID"
+ "3=SIZE"
+ "4=ATIME"
+ "5=MTIME"
+ "6=CTIME"
+ "7=ATIME_SET"
+ "8=MTIME_SET"
+
+num lock_type = 1
+ "RDLCK=0"
+ "WRLCK=1"
+ "UNLCK=2"
+
+bitfield lock_flags = 4
+ "0=BLOCK"
+ "1=RECLAIM"
+
+num lock_status = 1
+ "SUCCESS=0"
+ "BLOCKED=1"
+ "ERROR=2"
+ "GRACE=3"
#msg Tlerror = "size[4,val=end-&size] typ[1,val=6] tag[tag] illegal" # analogous to 106/Terror
msg Rlerror = "size[4,val=end-&size] typ[1,val=7] tag[tag] ecode[4]" # analogous to 107/Rerror
-msg Tstatfs = "size[4,val=end-&size] typ[1,val=8] tag[tag] TODO"
-msg Rstatfs = "size[4,val=end-&size] typ[1,val=9] tag[tag] TODO"
-msg Tlopen = "size[4,val=end-&size] typ[1,val=12] tag[tag] TODO" # analogous to 112/Topen
-msg Rlopen = "size[4,val=end-&size] typ[1,val=13] tag[tag] TODO" # analogous to 113/Ropen
-msg Tlcreate = "size[4,val=end-&size] typ[1,val=14] tag[tag] TODO" # analogous to 114/Tcreate
-msg Rlcreate = "size[4,val=end-&size] typ[1,val=15] tag[tag] TODO" # analogous to 115/Rcreate
-msg Tsymlink = "size[4,val=end-&size] typ[1,val=16] tag[tag] TODO"
-msg Rsymlink = "size[4,val=end-&size] typ[1,val=17] tag[tag] TODO"
-msg Tmknod = "size[4,val=end-&size] typ[1,val=18] tag[tag] TODO"
-msg Rmknod = "size[4,val=end-&size] typ[1,val=19] tag[tag] TODO"
-msg Trename = "size[4,val=end-&size] typ[1,val=20] tag[tag] TODO"
-msg Rrename = "size[4,val=end-&size] typ[1,val=21] tag[tag] TODO"
-msg Treadlink = "size[4,val=end-&size] typ[1,val=22] tag[tag] TODO"
-msg Rreadlink = "size[4,val=end-&size] typ[1,val=23] tag[tag] TODO"
-msg Tgetattr = "size[4,val=end-&size] typ[1,val=24] tag[tag] TODO"
-msg Rgetattr = "size[4,val=end-&size] typ[1,val=25] tag[tag] TODO"
-msg Tsetattr = "size[4,val=end-&size] typ[1,val=26] tag[tag] TODO"
-msg Rsetattr = "size[4,val=end-&size] typ[1,val=27] tag[tag] TODO"
+msg Tstatfs = "size[4,val=end-&size] typ[1,val=8] tag[tag] fid[fid]"
+msg Rstatfs = "size[4,val=end-&size] typ[1,val=9] tag[tag] type[4] bsize[4] blocks[8] bfree[8] bavail[8] files[8] ffree[8] fsid[8] namelen[4]"
+msg Tlopen = "size[4,val=end-&size] typ[1,val=12] tag[tag] fid[fid] flags[4]" # analogous to 112/Topen
+msg Rlopen = "size[4,val=end-&size] typ[1,val=13] tag[tag] qid[qid] iounit[4]" # analogous to 113/Ropen
+msg Tlcreate = "size[4,val=end-&size] typ[1,val=14] tag[tag] fid[fid] name[s] flags[4] mode[4] gid[nuid]" # analogous to 114/Tcreate
+msg Rlcreate = "size[4,val=end-&size] typ[1,val=15] tag[tag] qid[qid] iounit[4]" # analogous to 115/Rcreate
+msg Tsymlink = "size[4,val=end-&size] typ[1,val=16] tag[tag] fid[fid] name[s] symtgt[s] gid[nuid]"
+msg Rsymlink = "size[4,val=end-&size] typ[1,val=17] tag[tag] qid[qid]"
+msg Tmknod = "size[4,val=end-&size] typ[1,val=18] tag[tag] dfid[fid] name[s] mode[4] major[4] minor[4] gid[nuid]"
+msg Rmknod = "size[4,val=end-&size] typ[1,val=19] tag[tag] qid[qid]"
+msg Trename = "size[4,val=end-&size] typ[1,val=20] tag[tag] fid[fid] dfid[fid] name[s]"
+msg Rrename = "size[4,val=end-&size] typ[1,val=21] tag[tag]"
+msg Treadlink = "size[4,val=end-&size] typ[1,val=22] tag[tag] fid[fid]"
+msg Rreadlink = "size[4,val=end-&size] typ[1,val=23] tag[tag] target[s]"
+msg Tgetattr = "size[4,val=end-&size] typ[1,val=24] tag[tag] fid[fid] request_mask[getattr]"
+msg Rgetattr = "size[4,val=end-&size] typ[1,val=25] tag[tag] valid[8] qid[qid] mode[4] uid[nuid] gid[nuid] nlink[8]"
+ "rdev[8] filesize[8] blksize[8] blocks[8]"
+ "atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8]"
+ "ctime_sec[8] ctime_nsec[8] btime_sec[8] btime_nsec[8]"
+ "gen[8] data_version[8]"
+msg Tsetattr = "size[4,val=end-&size] typ[1,val=26] tag[tag] fid[fid] valid[setattr] mode[4] uid[nuid] gid[nuid] filesize[8] atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8]"
+msg Rsetattr = "size[4,val=end-&size] typ[1,val=27] tag[tag]"
#...
-msg Txattrwalk = "size[4,val=end-&size] typ[1,val=30] tag[tag] TODO"
-msg Rxattrwalk = "size[4,val=end-&size] typ[1,val=31] tag[tag] TODO"
-msg Txattrcreate = "size[4,val=end-&size] typ[1,val=32] tag[tag] TODO"
-msg Rxattrcreate = "size[4,val=end-&size] typ[1,val=33] tag[tag] TODO"
+msg Txattrwalk = "size[4,val=end-&size] typ[1,val=30] tag[tag] fid[fid] newfid[fid] name[s]"
+msg Rxattrwalk = "size[4,val=end-&size] typ[1,val=31] tag[tag] attr_size[8]"
+msg Txattrcreate = "size[4,val=end-&size] typ[1,val=32] tag[tag] fid[fid] name[s] attr_size[8] flags[4]"
+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] TODO"
-msg Rreaddir = "size[4,val=end-&size] typ[1,val=41] tag[tag] TODO"
+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] 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] TODO"
-msg Rfsync = "size[4,val=end-&size] typ[1,val=51] tag[tag] TODO"
-msg Tlock = "size[4,val=end-&size] typ[1,val=52] tag[tag] TODO"
-msg Rlock = "size[4,val=end-&size] typ[1,val=53] tag[tag] TODO"
-msg Tgetlock = "size[4,val=end-&size] typ[1,val=54] tag[tag] TODO"
-msg Rgetlock = "size[4,val=end-&size] typ[1,val=55] tag[tag] TODO"
+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]"
+msg Tlock = "size[4,val=end-&size] typ[1,val=52] tag[tag] fid[fid] type[lock_type] flags[lock_flags] start[8] length[8] proc_id[4] client_id[s]"
+msg Rlock = "size[4,val=end-&size] typ[1,val=53] tag[tag] status[lock_status]"
+msg Tgetlock = "size[4,val=end-&size] typ[1,val=54] tag[tag] fid[fid] type[1] start[8] length[8] proc_id[4] client_id[s]"
+msg Rgetlock = "size[4,val=end-&size] typ[1,val=55] tag[tag] type[1] start[8] length[8] proc_id[4] client_id[s]"
# ...
-msg Tlink = "size[4,val=end-&size] typ[1,val=70] tag[tag] TODO"
-msg Rlink = "size[4,val=end-&size] typ[1,val=71] tag[tag] TODO"
-msg Tmkdir = "size[4,val=end-&size] typ[1,val=72] tag[tag] TODO"
-msg Tmkdir = "size[4,val=end-&size] typ[1,val=73] tag[tag] TODO"
-msg Trenameat = "size[4,val=end-&size] typ[1,val=74] tag[tag] TODO"
-msg Rrenameat = "size[4,val=end-&size] typ[1,val=75] tag[tag] TODO"
-msg Tunlinkat = "size[4,val=end-&size] typ[1,val=76] tag[tag] TODO"
-msg Runlinkat = "size[4,val=end-&size] typ[1,val=77] tag[tag] TODO"
+msg Tlink = "size[4,val=end-&size] typ[1,val=70] tag[tag] dfid[fid] fid[fid] name[s]"
+msg Rlink = "size[4,val=end-&size] typ[1,val=71] tag[tag]"
+msg Tmkdir = "size[4,val=end-&size] typ[1,val=72] tag[tag] dfid[fid] name[s] mode[4] gid[nuid]"
+msg Tmkdir = "size[4,val=end-&size] typ[1,val=73] tag[tag] qid[qid]"
+msg Trenameat = "size[4,val=end-&size] typ[1,val=74] tag[tag] olddirfid[fid] oldname[s] newdirfid[fid] newname[s]"
+msg Rrenameat = "size[4,val=end-&size] typ[1,val=75] tag[tag]"
+msg Tunlinkat = "size[4,val=end-&size] typ[1,val=76] tag[tag] dirfd[fid] name[s] flags[4]"
+msg Runlinkat = "size[4,val=end-&size] typ[1,val=77] tag[tag]"
diff --git a/lib9p/idl/__init__.py b/lib9p/idl/__init__.py
index 920d02d..ab45ed0 100644
--- a/lib9p/idl/__init__.py
+++ b/lib9p/idl/__init__.py
@@ -1,12 +1,12 @@
# lib9p/idl/__init__.py - A parser for .9p specification files.
#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
import enum
import os.path
import re
-from typing import Callable, Literal, TypeAlias, TypeVar, cast
+from typing import Callable, Literal, TypeVar, cast
__all__ = [
# entrypoint
@@ -50,8 +50,11 @@ class Number:
prim: Primitive
+ vals: dict[str, str]
+
def __init__(self) -> None:
self.in_versions = set()
+ self.vals = {}
@property
def static_size(self) -> int:
@@ -181,8 +184,7 @@ class Message(Struct):
return self.members[1].val.tokens[0].val
-Type: TypeAlias = Primitive | Number | Bitfield | Struct | Message
-# type Type = Primitive | Number | Bitfield | Struct | Message # Change to this once we have Python 3.13
+type Type = Primitive | Number | Bitfield | Struct | Message
T = TypeVar("T", Number, Bitfield, Struct, Message)
# Parse ########################################################################
@@ -196,12 +198,27 @@ re_memtype = f"(?:{re_symname}|{re_priname})" # typenames that a struct member
re_expr = f"(?:(?:-|\\+|[0-9]+|&?{re_symname})+)"
+re_numspec = f"(?P<name>{re_symname})\\s*=\\s*(?P<val>\\S+)"
+
re_bitspec_bit = f"(?P<bit>[0-9]+)\\s*=\\s*(?P<name>{re_symname})"
re_bitspec_alias = f"(?P<name>{re_symname})\\s*=\\s*(?P<val>\\S+)"
re_memberspec = f"(?:(?P<cnt>{re_symname})\\*\\()?(?P<name>{re_symname})\\[(?P<typ>{re_memtype})(?:,max=(?P<max>{re_expr})|,val=(?P<val>{re_expr}))*\\]\\)?"
+def parse_numspec(ver: str, n: Number, spec: str) -> None:
+ spec = spec.strip()
+
+ if m := re.fullmatch(re_numspec, spec):
+ name = m.group("name")
+ val = m.group("val")
+ if name in n.vals:
+ raise ValueError(f"{n.name}: name {repr(name)} already assigned")
+ n.vals[name] = val
+ else:
+ raise SyntaxError(f"invalid num spec {repr(spec)}")
+
+
def parse_bitspec(ver: str, bf: Bitfield, spec: str) -> None:
spec = spec.strip()
@@ -266,7 +283,7 @@ def parse_members(ver: str, env: dict[str, Type], struct: Struct, specs: str) ->
raise ValueError(f"duplicate member name {repr(member.name)}")
if m.group("typ") not in env:
- raise NameError(f"Unknown type {repr(m.group(2))}")
+ raise NameError(f"Unknown type {repr(m.group('typ'))}")
member.typ = env[m.group("typ")]
if cnt := m.group("cnt"):
@@ -434,6 +451,8 @@ def parse_file(
match prev:
case Bitfield():
parse_bitspec(version, prev, m.group("specs"))
+ case Number():
+ parse_numspec(version, prev, m.group("specs"))
case Struct(): # and Message()
parse_members(version, env, prev, m.group("specs"))
case _:
@@ -448,7 +467,7 @@ def parse_file(
typs: list[Type] = [x for x in env.values() if not isinstance(x, Primitive)]
for typ in [typ for typ in typs if isinstance(typ, Struct)]:
- valid_syms = ["end", *["&" + m.name for m in typ.members]]
+ valid_syms = ["end", "s32_max", "s64_max", *["&" + m.name for m in typ.members]]
for member in typ.members:
for tok in [*member.max.tokens, *member.val.tokens]:
if isinstance(tok, ExprSym) and tok.name not in valid_syms:
diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h
index a6dc13c..3bc77c4 100644
--- a/lib9p/include/lib9p/9p.generated.h
+++ b/lib9p/include/lib9p/9p.generated.h
@@ -86,8 +86,10 @@ enum lib9p_msg_type { /* uint8_t */
#if CONFIG_9P_ENABLE_9P2000 || 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))
struct lib9p_d {
uint32_t len;
@@ -155,32 +157,13 @@ typedef uint8_t lib9p_qt_t;
#define LIB9P_QT_FILE ((lib9p_qt_t)(0))
-struct lib9p_qid {
- lib9p_qt_t type;
- uint32_t vers;
- uint64_t path;
-};
-
-struct lib9p_stat {
- uint16_t kern_type;
- uint32_t kern_dev;
- struct lib9p_qid file_qid;
- lib9p_dm_t file_mode;
- uint32_t file_atime;
- uint32_t file_mtime;
- uint64_t file_size;
- struct lib9p_s file_name;
- struct lib9p_s file_owner_uid;
- struct lib9p_s file_owner_gid;
- struct lib9p_s file_last_modified_uid;
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_u
- struct lib9p_s file_extension;
- uint32_t file_owner_n_uid;
- uint32_t file_owner_n_gid;
- uint32_t file_last_modified_n_uid;
-#endif /* 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 */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
typedef uint8_t lib9p_o_t;
/* unused ((lib9p_o_t)(1<<7)) */
@@ -199,201 +182,237 @@ typedef uint8_t lib9p_o_t;
#define LIB9P_O_MODE_MASK ((lib9p_o_t)(0b00000011))
#define LIB9P_O_FLAG_MASK ((lib9p_o_t)(0b11111100))
-struct lib9p_msg_Tversion {
- lib9p_tag_t tag;
- uint32_t max_msg_size;
- struct lib9p_s version;
+struct lib9p_msg_Tflush {
+ lib9p_tag_t tag;
+ uint16_t oldtag;
};
-struct lib9p_msg_Rversion {
- lib9p_tag_t tag;
- uint32_t max_msg_size;
- struct lib9p_s version;
+struct lib9p_msg_Rflush {
+ lib9p_tag_t tag;
};
-struct lib9p_msg_Tauth {
- lib9p_tag_t tag;
- lib9p_fid_t afid;
- struct lib9p_s uname;
- struct lib9p_s aname;
-#if CONFIG_9P_ENABLE_9P2000_u
- uint32_t n_uname;
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+struct lib9p_msg_Rwrite {
+ lib9p_tag_t tag;
+ uint32_t count;
};
-struct lib9p_msg_Rauth {
- lib9p_tag_t tag;
- struct lib9p_qid aqid;
+struct lib9p_msg_Rclunk {
+ lib9p_tag_t tag;
};
-struct lib9p_msg_Tattach {
- lib9p_tag_t tag;
- lib9p_fid_t fid;
- lib9p_fid_t afid;
- struct lib9p_s uname;
- struct lib9p_s aname;
-#if CONFIG_9P_ENABLE_9P2000_u
- uint32_t n_uname;
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
+struct lib9p_msg_Rremove {
+ lib9p_tag_t tag;
};
-struct lib9p_msg_Rattach {
- lib9p_tag_t tag;
- struct lib9p_qid qid;
+struct lib9p_msg_Rwstat {
+ lib9p_tag_t tag;
};
-struct lib9p_msg_Rerror {
- lib9p_tag_t tag;
- struct lib9p_s ename;
-#if CONFIG_9P_ENABLE_9P2000_u
- uint32_t 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_e
+struct lib9p_msg_Tsession {
+ lib9p_tag_t tag;
+ uint64_t key;
};
-struct lib9p_msg_Tflush {
+struct lib9p_msg_Rsession {
lib9p_tag_t tag;
- uint16_t oldtag;
};
-struct lib9p_msg_Rflush {
+struct lib9p_msg_Rswrite {
lib9p_tag_t tag;
+ uint32_t count;
};
-struct lib9p_msg_Twalk {
- lib9p_tag_t tag;
- lib9p_fid_t fid;
- lib9p_fid_t newfid;
- uint16_t nwname;
- struct lib9p_s *wname;
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
+struct lib9p_msg_Tread {
+ lib9p_tag_t tag;
+ lib9p_fid_t fid;
+ uint64_t offset;
+ uint32_t count;
};
-struct lib9p_msg_Rwalk {
- lib9p_tag_t tag;
- uint16_t nwqid;
- struct lib9p_qid *wqid;
+struct lib9p_msg_Tclunk {
+ lib9p_tag_t tag;
+ lib9p_fid_t fid;
};
-struct lib9p_msg_Topen {
+struct lib9p_msg_Tremove {
lib9p_tag_t tag;
lib9p_fid_t fid;
- lib9p_o_t mode;
};
-struct lib9p_msg_Ropen {
- lib9p_tag_t tag;
- struct lib9p_qid qid;
- uint32_t iounit;
+struct lib9p_msg_Tstat {
+ lib9p_tag_t tag;
+ lib9p_fid_t fid;
};
-struct lib9p_msg_Tcreate {
+struct lib9p_msg_Rread {
+ lib9p_tag_t tag;
+ struct lib9p_d data;
+};
+
+struct lib9p_msg_Twrite {
lib9p_tag_t tag;
lib9p_fid_t fid;
- struct lib9p_s name;
- lib9p_dm_t perm;
- lib9p_o_t mode;
+ uint64_t offset;
+ struct lib9p_d data;
};
-struct lib9p_msg_Rcreate {
- lib9p_tag_t tag;
- struct lib9p_qid qid;
- uint32_t iounit;
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_e
+struct lib9p_msg_Rsread {
+ lib9p_tag_t tag;
+ struct lib9p_d data;
};
-struct lib9p_msg_Tread {
- lib9p_tag_t tag;
- lib9p_fid_t fid;
- uint64_t offset;
- uint32_t count;
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
+struct lib9p_msg_Tversion {
+ lib9p_tag_t tag;
+ uint32_t max_msg_size;
+ struct lib9p_s version;
};
-struct lib9p_msg_Rread {
+struct lib9p_msg_Rversion {
lib9p_tag_t tag;
- struct lib9p_d data;
+ uint32_t max_msg_size;
+ struct lib9p_s version;
};
-struct lib9p_msg_Twrite {
+struct lib9p_msg_Rerror {
+ lib9p_tag_t tag;
+ struct lib9p_s ename;
+#if CONFIG_9P_ENABLE_9P2000_u
+ uint32_t errno;
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+};
+
+struct lib9p_msg_Twalk {
lib9p_tag_t tag;
lib9p_fid_t fid;
- uint64_t offset;
- struct lib9p_d data;
+ lib9p_fid_t newfid;
+ uint16_t nwname;
+ struct lib9p_s *wname;
};
-struct lib9p_msg_Rwrite {
- lib9p_tag_t tag;
- uint32_t count;
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_e
+struct lib9p_msg_Tsread {
+ lib9p_tag_t tag;
+ uint32_t fid;
+ uint16_t nwname;
+ struct lib9p_s *wname;
};
-struct lib9p_msg_Tclunk {
- lib9p_tag_t tag;
- lib9p_fid_t fid;
+struct lib9p_msg_Tswrite {
+ lib9p_tag_t tag;
+ uint32_t fid;
+ uint16_t nwname;
+ struct lib9p_s *wname;
+ struct lib9p_d data;
};
-struct lib9p_msg_Rclunk {
- lib9p_tag_t tag;
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
+struct lib9p_qid {
+ lib9p_qt_t type;
+ uint32_t vers;
+ uint64_t path;
};
-struct lib9p_msg_Tremove {
- lib9p_tag_t tag;
- lib9p_fid_t fid;
+struct lib9p_msg_Tauth {
+ lib9p_tag_t tag;
+ lib9p_fid_t afid;
+ struct lib9p_s uname;
+ struct lib9p_s aname;
+#if CONFIG_9P_ENABLE_9P2000_u
+ lib9p_nuid_t n_uid;
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-struct lib9p_msg_Rremove {
- lib9p_tag_t tag;
+struct lib9p_msg_Tattach {
+ lib9p_tag_t tag;
+ lib9p_fid_t fid;
+ lib9p_fid_t afid;
+ struct lib9p_s uname;
+ struct lib9p_s aname;
+#if CONFIG_9P_ENABLE_9P2000_u
+ lib9p_nuid_t n_uid;
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-struct lib9p_msg_Tstat {
+struct lib9p_msg_Topen {
lib9p_tag_t tag;
lib9p_fid_t fid;
+ lib9p_o_t mode;
};
-struct lib9p_msg_Rstat {
- lib9p_tag_t tag;
- struct lib9p_stat stat;
+struct lib9p_msg_Tcreate {
+ lib9p_tag_t tag;
+ lib9p_fid_t fid;
+ struct lib9p_s name;
+ lib9p_dm_t perm;
+ lib9p_o_t mode;
};
-struct lib9p_msg_Twstat {
- lib9p_tag_t tag;
- lib9p_fid_t fid;
- struct lib9p_stat stat;
+struct lib9p_stat {
+ uint16_t kern_type;
+ uint32_t kern_dev;
+ struct lib9p_qid file_qid;
+ lib9p_dm_t file_mode;
+ uint32_t file_atime;
+ uint32_t file_mtime;
+ uint64_t file_size;
+ struct lib9p_s file_name;
+ struct lib9p_s file_owner_uid;
+ struct lib9p_s file_owner_gid;
+ struct lib9p_s file_last_modified_uid;
+#if CONFIG_9P_ENABLE_9P2000_u
+ struct lib9p_s file_extension;
+ lib9p_nuid_t file_owner_n_uid;
+ lib9p_nuid_t file_owner_n_gid;
+ lib9p_nuid_t file_last_modified_n_uid;
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-struct lib9p_msg_Rwstat {
- lib9p_tag_t tag;
+struct lib9p_msg_Rauth {
+ lib9p_tag_t tag;
+ struct lib9p_qid aqid;
};
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_e
-struct lib9p_msg_Tsession {
- lib9p_tag_t tag;
- uint64_t key;
+struct lib9p_msg_Rattach {
+ lib9p_tag_t tag;
+ struct lib9p_qid qid;
};
-struct lib9p_msg_Rsession {
- lib9p_tag_t tag;
+struct lib9p_msg_Rwalk {
+ lib9p_tag_t tag;
+ uint16_t nwqid;
+ struct lib9p_qid *wqid;
};
-struct lib9p_msg_Tsread {
- lib9p_tag_t tag;
- uint32_t fid;
- uint16_t nwname;
- struct lib9p_s *wname;
+struct lib9p_msg_Ropen {
+ lib9p_tag_t tag;
+ struct lib9p_qid qid;
+ uint32_t iounit;
};
-struct lib9p_msg_Rsread {
- lib9p_tag_t tag;
- struct lib9p_d data;
+struct lib9p_msg_Rcreate {
+ lib9p_tag_t tag;
+ struct lib9p_qid qid;
+ uint32_t iounit;
};
-struct lib9p_msg_Tswrite {
- lib9p_tag_t tag;
- uint32_t fid;
- uint16_t nwname;
- struct lib9p_s *wname;
- struct lib9p_d data;
+struct lib9p_msg_Rstat {
+ lib9p_tag_t tag;
+ struct lib9p_stat stat;
};
-struct lib9p_msg_Rswrite {
- lib9p_tag_t tag;
- uint32_t count;
+struct lib9p_msg_Twstat {
+ lib9p_tag_t tag;
+ lib9p_fid_t fid;
+ struct lib9p_stat stat;
};
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h
index 72a8292..21c10e0 100644
--- a/lib9p/include/lib9p/9p.h
+++ b/lib9p/include/lib9p/9p.h
@@ -19,11 +19,6 @@
#error config.h must define CONFIG_9P_MAX_ERR_SIZE
#endif
-/******************************************************************************/
-
-#define LIB9P_NOTAG ((uint16_t)~0U)
-#define LIB9P_NOFID ((uint32_t)~0U)
-
/* ctx ************************************************************************/
struct lib9p_ctx {
diff --git a/lib9p/srv.c b/lib9p/srv.c
index e7fdb03..d5b643d 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -510,7 +510,7 @@ static void handle_Tauth(struct _lib9p_srv_req *ctx,
struct lib9p_msg_Rauth *resp) {
util_handler_common(ctx, req, resp);
- ctx->ctx.uid = req->n_uname;
+ ctx->ctx.uid = req->n_uid;
ctx->ctx.uname = req->uname.utf8;
struct lib9p_srv *srv = ctx->parent_sess->parent_conn->parent_srv;
@@ -530,7 +530,7 @@ static void handle_Tattach(struct _lib9p_srv_req *ctx,
struct lib9p_msg_Rattach *resp) {
util_handler_common(ctx, req, resp);
- ctx->ctx.uid = req->n_uname;
+ ctx->ctx.uid = req->n_uid;
ctx->ctx.uname = req->uname.utf8;
struct lib9p_srv *srv = ctx->parent_sess->parent_conn->parent_srv;
@@ -562,7 +562,7 @@ static void handle_Tattach(struct _lib9p_srv_req *ctx,
LINUX_EOPNOTSUPP, "TODO: auth not implemented");
return;
} else {
- if (req->afid != LIB9P_NOFID) {
+ if (req->afid != LIB9P_FID_NOFID) {
lib9p_error(&ctx->ctx.basectx,
LINUX_EACCES, "FID provided as auth-file, but no auth-file is required");
return;