summaryrefslogtreecommitdiff
path: root/lib9p/9p.generated.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/9p.generated.c')
-rw-r--r--lib9p/9p.generated.c9167
1 files changed, 6016 insertions, 3151 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c
index 8d6c82f..b58a485 100644
--- a/lib9p/9p.generated.c
+++ b/lib9p/9p.generated.c
@@ -1,4 +1,4 @@
-/* Generated by `lib9p/idl.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2003-9P2000.p9p.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */
+/* Generated by `lib9p/proto.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2003-9P2000.p9p.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */
#include <stdbool.h>
#include <stddef.h> /* for size_t */
@@ -6,10 +6,132 @@
#include <string.h> /* for memset() */
#include <libmisc/assert.h>
+#include <libmisc/endian.h>
#include <lib9p/9p.h>
-#include "internal.h"
+#include "tables.h"
+#include "utf8.h"
+
+/* libobj vtables *************************************************************/
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_tag_t, lib9p_tag, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_fid_t, lib9p_fid, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_s, lib9p_s, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_dm_t, lib9p_dm, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_qt_t, lib9p_qt, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_qid, lib9p_qid, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_stat, lib9p_stat, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_o_t, lib9p_o, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tversion, lib9p_msg_Tversion, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rversion, lib9p_msg_Rversion, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tauth, lib9p_msg_Tauth, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rauth, lib9p_msg_Rauth, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tattach, lib9p_msg_Tattach, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rattach, lib9p_msg_Rattach, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rerror, lib9p_msg_Rerror, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tflush, lib9p_msg_Tflush, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rflush, lib9p_msg_Rflush, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Twalk, lib9p_msg_Twalk, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rwalk, lib9p_msg_Rwalk, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Topen, lib9p_msg_Topen, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Ropen, lib9p_msg_Ropen, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tcreate, lib9p_msg_Tcreate, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rcreate, lib9p_msg_Rcreate, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tread, lib9p_msg_Tread, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rread, lib9p_msg_Rread, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Twrite, lib9p_msg_Twrite, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rwrite, lib9p_msg_Rwrite, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tclunk, lib9p_msg_Tclunk, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rclunk, lib9p_msg_Rclunk, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tremove, lib9p_msg_Tremove, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rremove, lib9p_msg_Rremove, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tstat, lib9p_msg_Tstat, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rstat, lib9p_msg_Rstat, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rwstat, lib9p_msg_Rwstat, static);
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_p9p
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Topenfd, lib9p_msg_Topenfd, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Ropenfd, lib9p_msg_Ropenfd, static);
+#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
+#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_nuid_t, lib9p_nuid, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_errno_t, lib9p_errno, static);
+#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_L
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_super_magic_t, lib9p_super_magic, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lo_t, lib9p_lo, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_dt_t, lib9p_dt, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_mode_t, lib9p_mode, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_b4_t, lib9p_b4, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_getattr_t, lib9p_getattr, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_setattr_t, lib9p_setattr, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lock_type_t, lib9p_lock_type, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lock_flags_t, lib9p_lock_flags, static);
+LO_IMPLEMENTATION_C(fmt_formatter, lib9p_lock_status_t, lib9p_lock_status, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlerror, lib9p_msg_Rlerror, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tstatfs, lib9p_msg_Tstatfs, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rstatfs, lib9p_msg_Rstatfs, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlopen, lib9p_msg_Tlopen, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlopen, lib9p_msg_Rlopen, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlcreate, lib9p_msg_Tlcreate, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlcreate, lib9p_msg_Rlcreate, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsymlink, lib9p_msg_Tsymlink, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsymlink, lib9p_msg_Rsymlink, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tmknod, lib9p_msg_Tmknod, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rmknod, lib9p_msg_Rmknod, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Trename, lib9p_msg_Trename, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rrename, lib9p_msg_Rrename, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Treadlink, lib9p_msg_Treadlink, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rreadlink, lib9p_msg_Rreadlink, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tgetattr, lib9p_msg_Tgetattr, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rgetattr, lib9p_msg_Rgetattr, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsetattr, lib9p_msg_Tsetattr, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsetattr, lib9p_msg_Rsetattr, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Txattrwalk, lib9p_msg_Txattrwalk, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rxattrwalk, lib9p_msg_Rxattrwalk, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Txattrcreate, lib9p_msg_Txattrcreate, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rxattrcreate, lib9p_msg_Rxattrcreate, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Treaddir, lib9p_msg_Treaddir, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rreaddir, lib9p_msg_Rreaddir, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tfsync, lib9p_msg_Tfsync, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rfsync, lib9p_msg_Rfsync, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlock, lib9p_msg_Tlock, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlock, lib9p_msg_Rlock, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tgetlock, lib9p_msg_Tgetlock, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rgetlock, lib9p_msg_Rgetlock, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tlink, lib9p_msg_Tlink, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rlink, lib9p_msg_Rlink, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tmkdir, lib9p_msg_Tmkdir, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rmkdir, lib9p_msg_Rmkdir, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Trenameat, lib9p_msg_Trenameat, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rrenameat, lib9p_msg_Rrenameat, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tunlinkat, lib9p_msg_Tunlinkat, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Runlinkat, lib9p_msg_Runlinkat, static);
+#endif /* CONFIG_9P_ENABLE_9P2000_L */
+#if CONFIG_9P_ENABLE_9P2000_e
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsession, lib9p_msg_Tsession, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsession, lib9p_msg_Rsession, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tsread, lib9p_msg_Tsread, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rsread, lib9p_msg_Rsread, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Tswrite, lib9p_msg_Tswrite, static);
+LO_IMPLEMENTATION_C(fmt_formatter, struct lib9p_msg_Rswrite, lib9p_msg_Rswrite, static);
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
/* utilities ******************************************************************/
#if CONFIG_9P_ENABLE_9P2000
@@ -39,255 +161,31 @@
#endif
/**
- * is_ver(ctx, ver) is essentially `(ctx->ctx->version == LIB9P_VER_##ver)`,
- * but compiles correctly (to `false`) even if `LIB9P_VER_##ver` isn't defined
+ * is_ver(ctx, ver) is essentially `(ctx->version == LIB9P_VER_##ver)`, but
+ * compiles correctly (to `false`) even if `LIB9P_VER_##ver` isn't defined
* (because `!CONFIG_9P_ENABLE_##ver`). This is useful when `||`ing
* several version checks together.
*/
-#define is_ver(CTX, ver) _is_ver_##ver(CTX->ctx->version)
-
-/* strings ********************************************************************/
-
-const char *const _lib9p_table_ver_name[LIB9P_VER_NUM] = {
- [LIB9P_VER_unknown] = "unknown",
-#if CONFIG_9P_ENABLE_9P2000
- [LIB9P_VER_9P2000] = "9P2000",
-#endif /* CONFIG_9P_ENABLE_9P2000 */
-#if CONFIG_9P_ENABLE_9P2000_L
- [LIB9P_VER_9P2000_L] = "9P2000.L",
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
- [LIB9P_VER_9P2000_e] = "9P2000.e",
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
-#if CONFIG_9P_ENABLE_9P2000_p9p
- [LIB9P_VER_9P2000_p9p] = "9P2000.p9p",
-#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
-#if CONFIG_9P_ENABLE_9P2000_u
- [LIB9P_VER_9P2000_u] = "9P2000.u",
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-};
-
-#define _MSG_NAME(typ) [LIB9P_TYP_##typ] = #typ
-const char *const _lib9p_table_msg_name[LIB9P_VER_NUM][0x100] = {
- [LIB9P_VER_unknown] = {
- _MSG_NAME(Tversion),
- _MSG_NAME(Rversion),
- _MSG_NAME(Rerror),
- },
-#if CONFIG_9P_ENABLE_9P2000
- [LIB9P_VER_9P2000] = {
- _MSG_NAME(Tversion),
- _MSG_NAME(Rversion),
- _MSG_NAME(Tauth),
- _MSG_NAME(Rauth),
- _MSG_NAME(Tattach),
- _MSG_NAME(Rattach),
- _MSG_NAME(Rerror),
- _MSG_NAME(Tflush),
- _MSG_NAME(Rflush),
- _MSG_NAME(Twalk),
- _MSG_NAME(Rwalk),
- _MSG_NAME(Topen),
- _MSG_NAME(Ropen),
- _MSG_NAME(Tcreate),
- _MSG_NAME(Rcreate),
- _MSG_NAME(Tread),
- _MSG_NAME(Rread),
- _MSG_NAME(Twrite),
- _MSG_NAME(Rwrite),
- _MSG_NAME(Tclunk),
- _MSG_NAME(Rclunk),
- _MSG_NAME(Tremove),
- _MSG_NAME(Rremove),
- _MSG_NAME(Tstat),
- _MSG_NAME(Rstat),
- _MSG_NAME(Twstat),
- _MSG_NAME(Rwstat),
- },
-#endif /* CONFIG_9P_ENABLE_9P2000 */
-#if CONFIG_9P_ENABLE_9P2000_L
- [LIB9P_VER_9P2000_L] = {
- _MSG_NAME(Rlerror),
- _MSG_NAME(Tstatfs),
- _MSG_NAME(Rstatfs),
- _MSG_NAME(Tlopen),
- _MSG_NAME(Rlopen),
- _MSG_NAME(Tlcreate),
- _MSG_NAME(Rlcreate),
- _MSG_NAME(Tsymlink),
- _MSG_NAME(Rsymlink),
- _MSG_NAME(Tmknod),
- _MSG_NAME(Rmknod),
- _MSG_NAME(Trename),
- _MSG_NAME(Rrename),
- _MSG_NAME(Treadlink),
- _MSG_NAME(Rreadlink),
- _MSG_NAME(Tgetattr),
- _MSG_NAME(Rgetattr),
- _MSG_NAME(Tsetattr),
- _MSG_NAME(Rsetattr),
- _MSG_NAME(Txattrwalk),
- _MSG_NAME(Rxattrwalk),
- _MSG_NAME(Txattrcreate),
- _MSG_NAME(Rxattrcreate),
- _MSG_NAME(Treaddir),
- _MSG_NAME(Rreaddir),
- _MSG_NAME(Tfsync),
- _MSG_NAME(Rfsync),
- _MSG_NAME(Tlock),
- _MSG_NAME(Rlock),
- _MSG_NAME(Tgetlock),
- _MSG_NAME(Rgetlock),
- _MSG_NAME(Tlink),
- _MSG_NAME(Rlink),
- _MSG_NAME(Tmkdir),
- _MSG_NAME(Rmkdir),
- _MSG_NAME(Trenameat),
- _MSG_NAME(Rrenameat),
- _MSG_NAME(Tunlinkat),
- _MSG_NAME(Runlinkat),
- _MSG_NAME(Tversion),
- _MSG_NAME(Rversion),
- _MSG_NAME(Tauth),
- _MSG_NAME(Rauth),
- _MSG_NAME(Tattach),
- _MSG_NAME(Rattach),
- _MSG_NAME(Rerror),
- _MSG_NAME(Tflush),
- _MSG_NAME(Rflush),
- _MSG_NAME(Twalk),
- _MSG_NAME(Rwalk),
- _MSG_NAME(Tread),
- _MSG_NAME(Rread),
- _MSG_NAME(Twrite),
- _MSG_NAME(Rwrite),
- _MSG_NAME(Tclunk),
- _MSG_NAME(Rclunk),
- _MSG_NAME(Tremove),
- _MSG_NAME(Rremove),
- },
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
- [LIB9P_VER_9P2000_e] = {
- _MSG_NAME(Tversion),
- _MSG_NAME(Rversion),
- _MSG_NAME(Tauth),
- _MSG_NAME(Rauth),
- _MSG_NAME(Tattach),
- _MSG_NAME(Rattach),
- _MSG_NAME(Rerror),
- _MSG_NAME(Tflush),
- _MSG_NAME(Rflush),
- _MSG_NAME(Twalk),
- _MSG_NAME(Rwalk),
- _MSG_NAME(Topen),
- _MSG_NAME(Ropen),
- _MSG_NAME(Tcreate),
- _MSG_NAME(Rcreate),
- _MSG_NAME(Tread),
- _MSG_NAME(Rread),
- _MSG_NAME(Twrite),
- _MSG_NAME(Rwrite),
- _MSG_NAME(Tclunk),
- _MSG_NAME(Rclunk),
- _MSG_NAME(Tremove),
- _MSG_NAME(Rremove),
- _MSG_NAME(Tstat),
- _MSG_NAME(Rstat),
- _MSG_NAME(Twstat),
- _MSG_NAME(Rwstat),
- _MSG_NAME(Tsession),
- _MSG_NAME(Rsession),
- _MSG_NAME(Tsread),
- _MSG_NAME(Rsread),
- _MSG_NAME(Tswrite),
- _MSG_NAME(Rswrite),
- },
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
-#if CONFIG_9P_ENABLE_9P2000_p9p
- [LIB9P_VER_9P2000_p9p] = {
- _MSG_NAME(Topenfd),
- _MSG_NAME(Ropenfd),
- _MSG_NAME(Tversion),
- _MSG_NAME(Rversion),
- _MSG_NAME(Tauth),
- _MSG_NAME(Rauth),
- _MSG_NAME(Tattach),
- _MSG_NAME(Rattach),
- _MSG_NAME(Rerror),
- _MSG_NAME(Tflush),
- _MSG_NAME(Rflush),
- _MSG_NAME(Twalk),
- _MSG_NAME(Rwalk),
- _MSG_NAME(Topen),
- _MSG_NAME(Ropen),
- _MSG_NAME(Tcreate),
- _MSG_NAME(Rcreate),
- _MSG_NAME(Tread),
- _MSG_NAME(Rread),
- _MSG_NAME(Twrite),
- _MSG_NAME(Rwrite),
- _MSG_NAME(Tclunk),
- _MSG_NAME(Rclunk),
- _MSG_NAME(Tremove),
- _MSG_NAME(Rremove),
- _MSG_NAME(Tstat),
- _MSG_NAME(Rstat),
- _MSG_NAME(Twstat),
- _MSG_NAME(Rwstat),
- },
-#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
-#if CONFIG_9P_ENABLE_9P2000_u
- [LIB9P_VER_9P2000_u] = {
- _MSG_NAME(Tversion),
- _MSG_NAME(Rversion),
- _MSG_NAME(Tauth),
- _MSG_NAME(Rauth),
- _MSG_NAME(Tattach),
- _MSG_NAME(Rattach),
- _MSG_NAME(Rerror),
- _MSG_NAME(Tflush),
- _MSG_NAME(Rflush),
- _MSG_NAME(Twalk),
- _MSG_NAME(Rwalk),
- _MSG_NAME(Topen),
- _MSG_NAME(Ropen),
- _MSG_NAME(Tcreate),
- _MSG_NAME(Rcreate),
- _MSG_NAME(Tread),
- _MSG_NAME(Rread),
- _MSG_NAME(Twrite),
- _MSG_NAME(Rwrite),
- _MSG_NAME(Tclunk),
- _MSG_NAME(Rclunk),
- _MSG_NAME(Tremove),
- _MSG_NAME(Rremove),
- _MSG_NAME(Tstat),
- _MSG_NAME(Rstat),
- _MSG_NAME(Twstat),
- _MSG_NAME(Rwstat),
- },
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-};
+#define is_ver(ctx, ver) _is_ver_##ver((ctx)->version)
/* bitmasks *******************************************************************/
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static const lib9p_dm_t dm_masks[LIB9P_VER_NUM] = {
#if CONFIG_9P_ENABLE_9P2000
- [LIB9P_VER_9P2000] = 0b11101100000000000000000111111111,
+ [LIB9P_VER_9P2000] = 0b11111100000000000000000111111111,
#endif /* CONFIG_9P_ENABLE_9P2000 */
#if CONFIG_9P_ENABLE_9P2000_L
[LIB9P_VER_9P2000_L] = 0b00000000000000000000000000000000,
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
- [LIB9P_VER_9P2000_e] = 0b11101100000000000000000111111111,
+ [LIB9P_VER_9P2000_e] = 0b11111100000000000000000111111111,
#endif /* CONFIG_9P_ENABLE_9P2000_e */
#if CONFIG_9P_ENABLE_9P2000_p9p
- [LIB9P_VER_9P2000_p9p] = 0b11101100000000000000000111111111,
+ [LIB9P_VER_9P2000_p9p] = 0b11111100000000000000000111111111,
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_u
- [LIB9P_VER_9P2000_u] = 0b11101100101111000000000111111111,
+ [LIB9P_VER_9P2000_u] = 0b11111100101111000000000111111111,
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
@@ -295,19 +193,19 @@ static const lib9p_dm_t dm_masks[LIB9P_VER_NUM] = {
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static const lib9p_qt_t qt_masks[LIB9P_VER_NUM] = {
#if CONFIG_9P_ENABLE_9P2000
- [LIB9P_VER_9P2000] = 0b11101100,
+ [LIB9P_VER_9P2000] = 0b11111100,
#endif /* CONFIG_9P_ENABLE_9P2000 */
#if CONFIG_9P_ENABLE_9P2000_L
- [LIB9P_VER_9P2000_L] = 0b11101100,
+ [LIB9P_VER_9P2000_L] = 0b11111100,
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
- [LIB9P_VER_9P2000_e] = 0b11101100,
+ [LIB9P_VER_9P2000_e] = 0b11111100,
#endif /* CONFIG_9P_ENABLE_9P2000_e */
#if CONFIG_9P_ENABLE_9P2000_p9p
- [LIB9P_VER_9P2000_p9p] = 0b11101100,
+ [LIB9P_VER_9P2000_p9p] = 0b11111100,
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_u
- [LIB9P_VER_9P2000_u] = 0b11101110,
+ [LIB9P_VER_9P2000_u] = 0b11111110,
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
@@ -416,2562 +314,2664 @@ static const lib9p_lock_flags_t lock_flags_masks[LIB9P_VER_NUM] = {
/* validate_* *****************************************************************/
-LM_ALWAYS_INLINE static bool _validate_size_net(struct _validate_ctx *ctx, uint32_t n) {
- if (__builtin_add_overflow(ctx->net_offset, n, &ctx->net_offset))
- /* If needed-net-size overflowed uint32_t, then
- * there's no way that actual-net-size will live up to
- * that. */
- return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content");
- if (ctx->net_offset > ctx->net_size)
- return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content");
- return false;
-}
-
-LM_ALWAYS_INLINE static bool _validate_size_host(struct _validate_ctx *ctx, size_t n) {
- if (__builtin_add_overflow(ctx->host_extra, n, &ctx->host_extra))
- /* If needed-host-size overflowed size_t, then there's
- * no way that actual-net-size will live up to
- * that. */
- return lib9p_error(ctx->ctx, LINUX_EBADMSG, "message is too short for content");
- return false;
-}
-
-LM_ALWAYS_INLINE static bool _validate_list(struct _validate_ctx *ctx,
- size_t cnt,
- _validate_fn_t item_fn, size_t item_host_size) {
- for (size_t i = 0; i < cnt; i++)
- if (_validate_size_host(ctx, item_host_size) || item_fn(ctx))
- return true;
- return false;
-}
-
-LM_ALWAYS_INLINE static bool validate_1(struct _validate_ctx *ctx) { return _validate_size_net(ctx, 1); }
-LM_ALWAYS_INLINE static bool validate_2(struct _validate_ctx *ctx) { return _validate_size_net(ctx, 2); }
-LM_ALWAYS_INLINE static bool validate_4(struct _validate_ctx *ctx) { return _validate_size_net(ctx, 4); }
-LM_ALWAYS_INLINE static bool validate_8(struct _validate_ctx *ctx) { return _validate_size_net(ctx, 8); }
-
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static bool validate_tag(struct _validate_ctx *ctx) {
- return validate_2(ctx);
-}
-
-LM_ALWAYS_INLINE static bool validate_fid(struct _validate_ctx *ctx) {
- return validate_4(ctx);
-}
-
-LM_ALWAYS_INLINE static bool validate_s(struct _validate_ctx *ctx) {
- uint16_t len;
- return false
- || (validate_2(ctx) || ({ len = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || _validate_size_net(ctx, len)
- || ({ (!is_valid_utf8_without_nul(&ctx->net_bytes[ctx->net_offset-len], len)) && lib9p_error(ctx->ctx, LINUX_EBADMSG, "message contains invalid UTF-8"); })
- ;
-}
+#define VALIDATE_NET_BYTES(n) \
+ if (__builtin_add_overflow(net_offset, n, &net_offset)) \
+ /* If needed-net-size overflowed uint32_t, then \
+ * there's no way that actual-net-size will live up to \
+ * that. */ \
+ return lib9p_error(ctx, LINUX_EBADMSG, "message is too short for content"); \
+ if (net_offset > net_size) \
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "message is too short for content (%"PRIu32" > %"PRIu32") @ %d", net_offset, net_size, __LINE__);
+#define VALIDATE_NET_UTF8(n) \
+ { \
+ size_t len = n; \
+ VALIDATE_NET_BYTES(len); \
+ if (!is_valid_utf8_without_nul(&net_bytes[net_offset-len], len)) \
+ return lib9p_error(ctx, LINUX_EBADMSG, "message contains invalid UTF-8"); \
+ }
+#define RESERVE_HOST_BYTES(n) \
+ if (__builtin_add_overflow(host_size, n, &host_size)) \
+ /* If needed-host-size overflowed ssize_t, then there's \
+ * no way that actual-net-size will live up to \
+ * that. */ \
+ return lib9p_error(ctx, LINUX_EBADMSG, "message is too short for content");
+#define GET_U8LE(off) (net_bytes[off])
+#define GET_U16LE(off) uint16le_decode(&net_bytes[off])
+#define GET_U32LE(off) uint32le_decode(&net_bytes[off])
+#define GET_U64LE(off) uint64le_decode(&net_bytes[off])
+#define LAST_U8LE() GET_U8LE(net_offset-1)
+#define LAST_U16LE() GET_U16LE(net_offset-2)
+#define LAST_U32LE() GET_U32LE(net_offset-4)
+#define LAST_U64LE() GET_U64LE(net_offset-8)
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static bool validate_dm(struct _validate_ctx *ctx) {
- if (validate_4(ctx))
- return true;
- lib9p_dm_t mask = dm_masks[ctx->ctx->version];
- lib9p_dm_t val = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]);
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in dm bitfield: %#04"PRIx32, val & ~mask);
- return false;
+static ssize_t validate_stat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, uint32_t *ret_net_size) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_stat);
+ uint32_t offsetof_stat_size = net_offset + 0;
+ uint32_t offsetof_kern_type = net_offset + 2;
+ uint32_t offsetof_file_qid_type = net_offset + 8;
+ VALIDATE_NET_BYTES(21);
+ if (GET_U8LE(offsetof_file_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_file_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_file_mode = net_offset + 0;
+ VALIDATE_NET_BYTES(22);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+#if CONFIG_9P_ENABLE_9P2000_u
+ if (is_ver(ctx, 9P2000_u)) {
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(12);
+ }
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_stat_size) != (uint32_t)(offsetof_end - offsetof_kern_type))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "stat->stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_stat_size), (uint32_t)(offsetof_end - offsetof_kern_type));
+ if (GET_U32LE(offsetof_file_mode) & ~dm_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_file_mode) & ~dm_masks[ctx->version]);
+ if (ret_net_size)
+ *ret_net_size = net_offset;
+ return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static bool validate_qt(struct _validate_ctx *ctx) {
- if (validate_1(ctx))
- return true;
- lib9p_qt_t mask = qt_masks[ctx->ctx->version];
- lib9p_qt_t val = ctx->net_bytes[ctx->net_offset-1];
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#01"PRIx8, val & ~mask);
- return false;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+static ssize_t validate_Tversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tversion);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tversion->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(100))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tversion->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(100));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rversion(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rversion);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rversion->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(101))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rversion->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(101));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tauth(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tauth);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static bool validate_nuid(struct _validate_ctx *ctx) {
- return validate_4(ctx);
-}
-
+ if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) {
+ VALIDATE_NET_BYTES(4);
+ }
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static bool validate_o(struct _validate_ctx *ctx) {
- if (validate_1(ctx))
- return true;
- lib9p_o_t mask = o_masks[ctx->ctx->version];
- lib9p_o_t val = ctx->net_bytes[ctx->net_offset-1];
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in o bitfield: %#01"PRIx8, val & ~mask);
- return false;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tauth->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(102))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tauth->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(102));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rauth(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rauth);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_aqid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_aqid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_aqid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rauth->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(103))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rauth->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(103));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tattach(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tattach);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(17);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static bool validate_errno(struct _validate_ctx *ctx) {
- return validate_4(ctx);
-}
-
+ if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) {
+ VALIDATE_NET_BYTES(4);
+ }
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_ALWAYS_INLINE static bool validate_super_magic(struct _validate_ctx *ctx) {
- return validate_4(ctx);
-}
-
-LM_ALWAYS_INLINE static bool validate_lo(struct _validate_ctx *ctx) {
- if (validate_4(ctx))
- return true;
- lib9p_lo_t mask = lo_masks[ctx->ctx->version];
- lib9p_lo_t val = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]);
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in lo bitfield: %#04"PRIx32, val & ~mask);
- return false;
-}
-
-LM_ALWAYS_INLINE static bool validate_dt(struct _validate_ctx *ctx) {
- return validate_1(ctx);
-}
-
-LM_ALWAYS_INLINE static bool validate_mode(struct _validate_ctx *ctx) {
- if (validate_4(ctx))
- return true;
- lib9p_mode_t mask = mode_masks[ctx->ctx->version];
- lib9p_mode_t val = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]);
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in mode bitfield: %#04"PRIx32, val & ~mask);
- return false;
-}
-
-LM_ALWAYS_INLINE static bool validate_b4(struct _validate_ctx *ctx) {
- return validate_4(ctx);
-}
-
-LM_ALWAYS_INLINE static bool validate_getattr(struct _validate_ctx *ctx) {
- if (validate_8(ctx))
- return true;
- lib9p_getattr_t mask = getattr_masks[ctx->ctx->version];
- lib9p_getattr_t val = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]);
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in getattr bitfield: %#08"PRIx64, val & ~mask);
- return false;
-}
-
-LM_ALWAYS_INLINE static bool validate_setattr(struct _validate_ctx *ctx) {
- if (validate_4(ctx))
- return true;
- lib9p_setattr_t mask = setattr_masks[ctx->ctx->version];
- lib9p_setattr_t val = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]);
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in setattr bitfield: %#04"PRIx32, val & ~mask);
- return false;
-}
-
-LM_ALWAYS_INLINE static bool validate_lock_type(struct _validate_ctx *ctx) {
- return validate_1(ctx);
-}
-
-LM_ALWAYS_INLINE static bool validate_lock_flags(struct _validate_ctx *ctx) {
- if (validate_4(ctx))
- return true;
- lib9p_lock_flags_t mask = lock_flags_masks[ctx->ctx->version];
- lib9p_lock_flags_t val = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]);
- if (val & ~mask)
- return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in lock_flags bitfield: %#04"PRIx32, val & ~mask);
- return false;
-}
-
-LM_ALWAYS_INLINE static bool validate_lock_status(struct _validate_ctx *ctx) {
- return validate_1(ctx);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Tflush(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_2(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, 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_Rflush(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_Rread(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t count;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || _validate_size_net(ctx, count)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 117; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- || ({ uint32_t max = INT32_MAX; (((uint32_t)count) > max) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "count value is too large (%"PRIu32" > %"PRIu32")", count, max); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rwrite(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t count;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 119; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- || ({ uint32_t max = INT32_MAX; (((uint32_t)count) > max) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "count value is too large (%"PRIu32" > %"PRIu32")", count, max); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rclunk(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_Rremove(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 123; (((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_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Rwstat(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 127; (((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_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static bool validate_Rrename(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 21; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rsetattr(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 27; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rxattrwalk(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_8(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 31; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rxattrcreate(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 33; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rreaddir(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t count;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || _validate_size_net(ctx, count)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 41; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rfsync(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 51; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rlink(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 71; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rrenameat(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 75; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Runlinkat(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 77; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
-LM_FLATTEN static bool validate_Tsession(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_8(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_Rsession(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_Rsread(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t count;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || _validate_size_net(ctx, count)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 153; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rswrite(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 155; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Tread(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint64_t offset;
- uint32_t count;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || (validate_8(ctx) || ({ offset = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]); false; }))
- || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 116; (((uint8_t)typ) != exp) &&
- 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_Twrite(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint64_t offset;
- uint32_t count;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || (validate_8(ctx) || ({ offset = uint64le_decode(&ctx->net_bytes[ctx->net_offset-8]); false; }))
- || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || _validate_size_net(ctx, count)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 118; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- || ({ uint64_t max = INT64_MAX; (((uint64_t)offset) > max) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "offset value is too large (%"PRIu64" > %"PRIu64")", offset, max); })
- || ({ uint32_t max = INT32_MAX; (((uint32_t)count) > max) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "count value is too large (%"PRIu32" > %"PRIu32")", count, max); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tclunk(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_Tremove(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 122; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tattach->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(104))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tattach->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(104));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rattach(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rattach);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rattach->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(105))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rattach->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(105));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rerror(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rerror);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(9);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+#if CONFIG_9P_ENABLE_9P2000_u
+ if (is_ver(ctx, 9P2000_u)) {
+ VALIDATE_NET_BYTES(4);
+ }
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rerror->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(107))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rerror->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(107));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tflush(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tflush);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 9;
+ VALIDATE_NET_BYTES(9);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tflush->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(108))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tflush->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(108));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rflush(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rflush);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rflush->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(109))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rflush->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(109));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Twalk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Twalk);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_nwname = net_offset + 15;
+ VALIDATE_NET_BYTES(17);
+ for (uint16_t i = 0, cnt = LAST_U16LE(); i < cnt; i++) {
+ RESERVE_HOST_BYTES(sizeof(struct lib9p_s));
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ }
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(110))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(110));
+ if ((uint16_t)GET_U16LE(offsetof_nwname) > (uint16_t)(16))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twalk->nwname value is too large: %"PRIu16" > %"PRIu16,
+ (uint16_t)GET_U16LE(offsetof_nwname), (uint16_t)(16));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rwalk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rwalk);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_nwqid = net_offset + 7;
+ VALIDATE_NET_BYTES(9);
+ for (uint16_t i = 0, cnt = LAST_U16LE(); i < cnt; i++) {
+ RESERVE_HOST_BYTES(sizeof(struct lib9p_qid));
+ uint32_t offsetof_wqid_type = net_offset + 0;
+ VALIDATE_NET_BYTES(13);
+ if (GET_U8LE(offsetof_wqid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_wqid_type) & ~qt_masks[ctx->version]);
+ }
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(111))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(111));
+ if ((uint16_t)GET_U16LE(offsetof_nwqid) > (uint16_t)(16))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwalk->nwqid value is too large: %"PRIu16" > %"PRIu16,
+ (uint16_t)GET_U16LE(offsetof_nwqid), (uint16_t)(16));
+ return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Tstat(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 124; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
+static ssize_t validate_Topen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Topen);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_mode = net_offset + 11;
+ uint32_t offsetof_end = net_offset + 12;
+ VALIDATE_NET_BYTES(12);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Topen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(112))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Topen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(112));
+ if (GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in o bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Ropen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Ropen);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 4;
+ VALIDATE_NET_BYTES(4);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Ropen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(113))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Ropen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(113));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tcreate);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_perm = net_offset + 0;
+ uint32_t offsetof_mode = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 5;
+ VALIDATE_NET_BYTES(5);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(114))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(114));
+ if (GET_U32LE(offsetof_perm) & ~dm_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_perm) & ~dm_masks[ctx->version]);
+ if (GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in o bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rcreate);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 4;
+ VALIDATE_NET_BYTES(4);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(115))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(115));
+ return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static bool validate_Tstatfs(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 8; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Treadlink(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 22; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Treaddir(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_8(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 40; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Tversion(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_4(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_Rversion(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_4(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_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 = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_fid(ctx)
- || (validate_2(ctx) || ({ nwname = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || _validate_list(ctx, nwname, validate_s, sizeof(struct lib9p_s))
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 110; (((uint8_t)typ) != exp) &&
- 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); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static bool validate_Trename(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 20; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rreadlink(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 23; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Txattrwalk(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 30; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Txattrcreate(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_8(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 32; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tlink(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 70; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Trenameat(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 74; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tunlinkat(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 76; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
-LM_FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint16_t nwname;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_4(ctx)
- || (validate_2(ctx) || ({ nwname = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || _validate_list(ctx, nwname, validate_s, sizeof(struct lib9p_s))
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 152; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tswrite(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint16_t nwname;
- uint32_t count;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_4(ctx)
- || (validate_2(ctx) || ({ nwname = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || _validate_list(ctx, nwname, validate_s, sizeof(struct lib9p_s))
- || (validate_4(ctx) || ({ count = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || _validate_size_net(ctx, count)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 154; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || 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;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
-#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
- || ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) && validate_nuid(ctx) )
-#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 102; (((uint8_t)typ) != exp) &&
- 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) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
-#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
- || ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) && validate_nuid(ctx) )
-#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 104; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
+static ssize_t validate_Tread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tread);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_offset = net_offset + 11;
+ uint32_t offsetof_count = net_offset + 19;
+ uint32_t offsetof_end = net_offset + 23;
+ VALIDATE_NET_BYTES(23);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(116))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(116));
+ if ((uint64_t)GET_U64LE(offsetof_offset) > (uint64_t)(INT64_MAX))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tread->offset value is too large: %"PRIu64" > %"PRIu64,
+ (uint64_t)GET_U64LE(offsetof_offset), (uint64_t)(INT64_MAX));
+ if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tread->count value is too large: %"PRIu32" > %"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rread);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_count = net_offset + 7;
+ VALIDATE_NET_BYTES(11);
+ VALIDATE_NET_BYTES(LAST_U32LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(117))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(117));
+ if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rread->count value is too large: %"PRIu32" > %"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Twrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Twrite);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_offset = net_offset + 11;
+ uint32_t offsetof_count = net_offset + 19;
+ VALIDATE_NET_BYTES(23);
+ VALIDATE_NET_BYTES(LAST_U32LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(118))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(118));
+ if ((uint64_t)GET_U64LE(offsetof_offset) > (uint64_t)(INT64_MAX))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twrite->offset value is too large: %"PRIu64" > %"PRIu64,
+ (uint64_t)GET_U64LE(offsetof_offset), (uint64_t)(INT64_MAX));
+ if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twrite->count value is too large: %"PRIu32" > %"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rwrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rwrite);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_count = net_offset + 7;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(119))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(119));
+ if ((uint32_t)GET_U32LE(offsetof_count) > (uint32_t)(INT32_MAX))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwrite->count value is too large: %"PRIu32" > %"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_count), (uint32_t)(INT32_MAX));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tclunk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tclunk);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tclunk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(120))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tclunk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(120));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rclunk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rclunk);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rclunk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(121))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rclunk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(121));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tremove(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tremove);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tremove->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(122))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tremove->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(122));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rremove(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rremove);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rremove->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(123))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rremove->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(123));
+ return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static bool validate_Tsymlink(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
- || validate_nuid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 16; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Topen(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_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); })
- || ({ 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_Tcreate(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(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); })
- || ({ 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); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_p9p
-LM_FLATTEN static bool validate_Topenfd(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_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); })
- || ({ uint8_t exp = 98; (((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_p9p */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_s(ctx)
+static ssize_t validate_Tstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tstat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(124))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(124));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rstat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_nstat = net_offset + 7;
+ uint32_t offsetof_stat = net_offset + 9;
+ uint32_t offsetof_stat_stat_size = net_offset + 9;
+ uint32_t offsetof_stat_kern_type = net_offset + 11;
+ uint32_t offsetof_stat_file_qid_type = net_offset + 17;
+ VALIDATE_NET_BYTES(30);
+ if (GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_stat_file_mode = net_offset + 0;
+ VALIDATE_NET_BYTES(22);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
#if CONFIG_9P_ENABLE_9P2000_u
- || ( is_ver(ctx, 9P2000_u) && validate_errno(ctx) )
+ if (is_ver(ctx, 9P2000_u)) {
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(12);
+ }
#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); })
- || ({ 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); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static bool validate_Rlerror(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_errno(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 7; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rstatfs(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_super_magic(ctx)
- || validate_4(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 9; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tlopen(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_lo(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 12; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tlcreate(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_lo(ctx)
- || validate_mode(ctx)
- || validate_nuid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 14; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tmknod(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_mode(ctx)
- || validate_4(ctx)
- || validate_4(ctx)
- || validate_nuid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 18; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tmkdir(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_s(ctx)
- || validate_mode(ctx)
- || validate_nuid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 72; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tfsync(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_b4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 50; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tgetattr(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_getattr(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 24; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tsetattr(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_setattr(ctx)
- || validate_mode(ctx)
- || validate_nuid(ctx)
- || validate_nuid(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 26; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tgetlock(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_lock_type(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_4(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 54; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rgetlock(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_lock_type(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_4(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 55; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Tlock(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || validate_lock_type(ctx)
- || validate_lock_flags(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_4(ctx)
- || validate_s(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 52; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rlock(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_lock_status(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 53; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static bool validate_stat(struct _validate_ctx *ctx) {
- uint16_t stat_size;
- uint32_t _kern_type_offset;
- return false
- || (validate_2(ctx) || ({ stat_size = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || ({ _kern_type_offset = ctx->net_offset; validate_2(ctx); })
- || validate_4(ctx)
- || validate_qid(ctx)
- || validate_dm(ctx)
- || validate_4(ctx)
- || validate_4(ctx)
- || validate_8(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
- || validate_s(ctx)
+ uint32_t offsetof_stat_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_stat_stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rstat->stat.stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_stat_stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type));
+ if (GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(125))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(125));
+ if ((uint32_t)GET_U32LE(offsetof_nstat) != (uint32_t)(offsetof_end - offsetof_stat))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rstat->nstat value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_nstat), (uint32_t)(offsetof_end - offsetof_stat));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Twstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Twstat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_nstat = net_offset + 11;
+ uint32_t offsetof_stat = net_offset + 13;
+ uint32_t offsetof_stat_stat_size = net_offset + 13;
+ uint32_t offsetof_stat_kern_type = net_offset + 15;
+ uint32_t offsetof_stat_file_qid_type = net_offset + 21;
+ VALIDATE_NET_BYTES(34);
+ if (GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_stat_file_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_stat_file_mode = net_offset + 0;
+ VALIDATE_NET_BYTES(22);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
#if CONFIG_9P_ENABLE_9P2000_u
- || ( is_ver(ctx, 9P2000_u) && validate_s(ctx) )
- || ( is_ver(ctx, 9P2000_u) && validate_nuid(ctx) )
- || ( is_ver(ctx, 9P2000_u) && validate_nuid(ctx) )
- || ( is_ver(ctx, 9P2000_u) && validate_nuid(ctx) )
+ if (is_ver(ctx, 9P2000_u)) {
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(12);
+ }
#endif /* CONFIG_9P_ENABLE_9P2000_u */
- || ({ uint16_t exp = ctx->net_offset - _kern_type_offset; (((uint16_t)stat_size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "stat_size value is wrong (actual:%"PRIu16" != correct:%"PRIu16")", (uint16_t)stat_size, exp); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Rauth(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 103; (((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) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_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 = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || (validate_2(ctx) || ({ nwqid = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || _validate_list(ctx, nwqid, validate_qid, sizeof(struct lib9p_qid))
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 111; (((uint8_t)typ) != exp) &&
- 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); })
- ;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static bool validate_Ropen(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 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_Rcreate(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 115; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
+ uint32_t offsetof_stat_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_stat_stat_size) != (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twstat->stat.stat_size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_stat_stat_size), (uint32_t)(offsetof_stat_end - offsetof_stat_kern_type));
+ if (GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in dm bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_stat_file_mode) & ~dm_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(126))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(126));
+ if ((uint32_t)GET_U32LE(offsetof_nstat) != (uint32_t)(offsetof_end - offsetof_stat))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Twstat->nstat value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_nstat), (uint32_t)(offsetof_end - offsetof_stat));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rwstat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rwstat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwstat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(127))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rwstat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(127));
+ return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_p9p
-LM_FLATTEN static bool validate_Ropenfd(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || validate_4(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 99; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
+static ssize_t validate_Topenfd(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Topenfd);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_mode = net_offset + 11;
+ uint32_t offsetof_end = net_offset + 12;
+ VALIDATE_NET_BYTES(12);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Topenfd->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(98))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Topenfd->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(98));
+ if (GET_U8LE(offsetof_mode) & ~o_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in o bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_mode) & ~o_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Ropenfd(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Ropenfd);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 8;
+ VALIDATE_NET_BYTES(8);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Ropenfd->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(99))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Ropenfd->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(99));
+ return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static bool validate_Rlopen(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 13; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rlcreate(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || validate_4(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 15; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rsymlink(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 17; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rmknod(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 19; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rgetattr(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_getattr(ctx)
- || validate_qid(ctx)
- || validate_mode(ctx)
- || validate_nuid(ctx)
- || validate_nuid(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || validate_8(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 25; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
-}
-
-LM_FLATTEN static bool validate_Rmkdir(struct _validate_ctx *ctx) {
- uint32_t size;
- uint8_t typ;
- uint32_t _size_offset;
- return false
- || (({ _size_offset = ctx->net_offset; validate_4(ctx); }) || ({ size = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_qid(ctx)
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ uint8_t exp = 73; (((uint8_t)typ) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "typ value is wrong (actual:%"PRIu8" != correct:%"PRIu8")", (uint8_t)typ, exp); })
- ;
+static ssize_t validate_Rlerror(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rlerror);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlerror->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(7))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlerror->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(7));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tstatfs(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tstatfs);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tstatfs->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(8))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tstatfs->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(8));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rstatfs(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rstatfs);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 67;
+ VALIDATE_NET_BYTES(67);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rstatfs->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(9))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rstatfs->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(9));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tlopen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tlopen);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_flags = net_offset + 11;
+ uint32_t offsetof_end = net_offset + 15;
+ VALIDATE_NET_BYTES(15);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlopen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(12))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlopen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(12));
+ if (GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in lo bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rlopen(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rlopen);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 4;
+ VALIDATE_NET_BYTES(4);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlopen->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(13))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlopen->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(13));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tlcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tlcreate);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_flags = net_offset + 0;
+ uint32_t offsetof_mode = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 12;
+ VALIDATE_NET_BYTES(12);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(14))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(14));
+ if (GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in lo bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_flags) & ~lo_masks[ctx->version]);
+ if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rlcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rlcreate);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 4;
+ VALIDATE_NET_BYTES(4);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(15))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(15));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tsymlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tsymlink);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 4;
+ VALIDATE_NET_BYTES(4);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsymlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(16))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsymlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(16));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rsymlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rsymlink);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsymlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(17))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsymlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(17));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tmknod(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tmknod);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_mode = net_offset + 0;
+ uint32_t offsetof_end = net_offset + 16;
+ VALIDATE_NET_BYTES(16);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tmknod->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(18))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tmknod->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(18));
+ if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rmknod(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rmknod);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rmknod->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(19))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rmknod->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(19));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Trename(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Trename);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(17);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Trename->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(20))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Trename->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(20));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rrename(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rrename);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rrename->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(21))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rrename->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(21));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Treadlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Treadlink);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Treadlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(22))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Treadlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(22));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rreadlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rreadlink);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(9);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rreadlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(23))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rreadlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(23));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tgetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tgetattr);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_request_mask = net_offset + 11;
+ uint32_t offsetof_end = net_offset + 19;
+ VALIDATE_NET_BYTES(19);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tgetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(24))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tgetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(24));
+ if (GET_U64LE(offsetof_request_mask) & ~getattr_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in getattr bitfield: %#016"PRIx64,
+ GET_U64LE(offsetof_request_mask) & ~getattr_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rgetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rgetattr);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_valid = net_offset + 7;
+ uint32_t offsetof_qid_type = net_offset + 15;
+ VALIDATE_NET_BYTES(28);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_mode = net_offset + 0;
+ uint32_t offsetof_end = net_offset + 132;
+ VALIDATE_NET_BYTES(132);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rgetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(25))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rgetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(25));
+ if (GET_U64LE(offsetof_valid) & ~getattr_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in getattr bitfield: %#016"PRIx64,
+ GET_U64LE(offsetof_valid) & ~getattr_masks[ctx->version]);
+ if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tsetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tsetattr);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_valid = net_offset + 11;
+ uint32_t offsetof_mode = net_offset + 15;
+ uint32_t offsetof_end = net_offset + 67;
+ VALIDATE_NET_BYTES(67);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(26))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(26));
+ if (GET_U32LE(offsetof_valid) & ~setattr_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in setattr bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_valid) & ~setattr_masks[ctx->version]);
+ if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rsetattr(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rsetattr);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsetattr->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(27))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsetattr->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(27));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Txattrwalk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Txattrwalk);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(17);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Txattrwalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(30))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Txattrwalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(30));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rxattrwalk(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rxattrwalk);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 15;
+ VALIDATE_NET_BYTES(15);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rxattrwalk->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(31))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rxattrwalk->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(31));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Txattrcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Txattrcreate);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 12;
+ VALIDATE_NET_BYTES(12);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Txattrcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(32))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Txattrcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(32));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rxattrcreate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rxattrcreate);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rxattrcreate->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(33))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rxattrcreate->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(33));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Treaddir(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Treaddir);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 23;
+ VALIDATE_NET_BYTES(23);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Treaddir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(40))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Treaddir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(40));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rreaddir(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rreaddir);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(11);
+ VALIDATE_NET_BYTES(LAST_U32LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rreaddir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(41))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rreaddir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(41));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tfsync(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tfsync);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 15;
+ VALIDATE_NET_BYTES(15);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tfsync->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(50))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tfsync->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(50));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rfsync(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rfsync);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rfsync->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(51))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rfsync->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(51));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tlock);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_flags = net_offset + 12;
+ VALIDATE_NET_BYTES(38);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(52))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(52));
+ if (GET_U32LE(offsetof_flags) & ~lock_flags_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in lock_flags bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_flags) & ~lock_flags_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rlock);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 8;
+ VALIDATE_NET_BYTES(8);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(53))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(53));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tgetlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tgetlock);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(34);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tgetlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(54))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tgetlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(54));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rgetlock(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rgetlock);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(30);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rgetlock->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(55))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rgetlock->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(55));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tlink);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(17);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(70))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(70));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rlink(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rlink);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlink->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(71))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rlink->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(71));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tmkdir(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tmkdir);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_mode = net_offset + 0;
+ uint32_t offsetof_end = net_offset + 8;
+ VALIDATE_NET_BYTES(8);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tmkdir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(72))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tmkdir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(72));
+ if (GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in mode bitfield: %#08"PRIx32,
+ GET_U32LE(offsetof_mode) & ~mode_masks[ctx->version]);
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rmkdir(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rmkdir);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_qid_type = net_offset + 7;
+ VALIDATE_NET_BYTES(20);
+ if (GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version])
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#02"PRIx8,
+ GET_U8LE(offsetof_qid_type) & ~qt_masks[ctx->version]);
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rmkdir->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(73))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rmkdir->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(73));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Trenameat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Trenameat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ VALIDATE_NET_BYTES(6);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Trenameat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(74))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Trenameat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(74));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rrenameat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rrenameat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rrenameat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(75))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rrenameat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(75));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tunlinkat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tunlinkat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ uint32_t offsetof_end = net_offset + 4;
+ VALIDATE_NET_BYTES(4);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tunlinkat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(76))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tunlinkat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(76));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Runlinkat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Runlinkat);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Runlinkat->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(77))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Runlinkat->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(77));
+ return (ssize_t)host_size;
}
#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-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 = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || (validate_2(ctx) || ({ nstat = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); })
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ 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_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 = uint32le_decode(&ctx->net_bytes[ctx->net_offset-4]); false; }))
- || (validate_1(ctx) || ({ typ = ctx->net_bytes[ctx->net_offset-1]; false; }))
- || validate_tag(ctx)
- || validate_fid(ctx)
- || (validate_2(ctx) || ({ nstat = uint16le_decode(&ctx->net_bytes[ctx->net_offset-2]); false; }))
- || ({ _stat_offset = ctx->net_offset; validate_stat(ctx); })
- || ({ uint32_t exp = ctx->net_offset - _size_offset; (((uint32_t)size) != exp) &&
- lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "size value is wrong (actual:%"PRIu32" != correct:%"PRIu32")", (uint32_t)size, exp); })
- || ({ 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); })
- ;
+#if CONFIG_9P_ENABLE_9P2000_e
+static ssize_t validate_Tsession(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tsession);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 15;
+ VALIDATE_NET_BYTES(15);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsession->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(150))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsession->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(150));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rsession(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rsession);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 7;
+ VALIDATE_NET_BYTES(7);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsession->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(151))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsession->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(151));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tsread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tsread);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ for (uint16_t i = 0, cnt = LAST_U16LE(); i < cnt; i++) {
+ RESERVE_HOST_BYTES(sizeof(struct lib9p_s));
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ }
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(152))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tsread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(152));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rsread(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rsread);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(11);
+ VALIDATE_NET_BYTES(LAST_U32LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsread->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(153))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rsread->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(153));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Tswrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Tswrite);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ VALIDATE_NET_BYTES(13);
+ for (uint16_t i = 0, cnt = LAST_U16LE(); i < cnt; i++) {
+ RESERVE_HOST_BYTES(sizeof(struct lib9p_s));
+ VALIDATE_NET_BYTES(2);
+ VALIDATE_NET_UTF8(LAST_U16LE());
+ }
+ VALIDATE_NET_BYTES(4);
+ VALIDATE_NET_BYTES(LAST_U32LE());
+ uint32_t offsetof_end = net_offset + 0;
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tswrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(154))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Tswrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(154));
+ return (ssize_t)host_size;
+}
+
+static ssize_t validate_Rswrite(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes) {
+ uint32_t net_offset = 0;
+ ssize_t host_size = sizeof(struct lib9p_msg_Rswrite);
+ uint32_t offsetof_size = net_offset + 0;
+ uint32_t offsetof_typ = net_offset + 4;
+ uint32_t offsetof_end = net_offset + 11;
+ VALIDATE_NET_BYTES(11);
+ if ((uint32_t)GET_U32LE(offsetof_size) != (uint32_t)(offsetof_end - offsetof_size))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rswrite->size value is wrong: actual: %"PRIu32" != correct:%"PRIu32,
+ (uint32_t)GET_U32LE(offsetof_size), (uint32_t)(offsetof_end - offsetof_size));
+ if ((uint8_t)GET_U8LE(offsetof_typ) != (uint8_t)(155))
+ return lib9p_errorf(ctx, LINUX_EBADMSG, "Rswrite->typ value is wrong: actual: %"PRIu8" != correct:%"PRIu8,
+ (uint8_t)GET_U8LE(offsetof_typ), (uint8_t)(155));
+ return (ssize_t)host_size;
}
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
/* unmarshal_* ****************************************************************/
-LM_ALWAYS_INLINE static void unmarshal_1(struct _unmarshal_ctx *ctx, uint8_t *out) {
- *out = ctx->net_bytes[ctx->net_offset];
- ctx->net_offset += 1;
-}
+#define UNMARSHAL_BYTES(ctx, data_lvalue, len) \
+ data_lvalue = (char *)&net_bytes[net_offset]; \
+ net_offset += len;
+#define UNMARSHAL_U8LE(ctx, val_lvalue) \
+ val_lvalue = net_bytes[net_offset]; \
+ net_offset += 1;
+#define UNMARSHAL_U16LE(ctx, val_lvalue) \
+ val_lvalue = uint16le_decode(&net_bytes[net_offset]); \
+ net_offset += 2;
+#define UNMARSHAL_U32LE(ctx, val_lvalue) \
+ val_lvalue = uint32le_decode(&net_bytes[net_offset]); \
+ net_offset += 4;
+#define UNMARSHAL_U64LE(ctx, val_lvalue) \
+ val_lvalue = uint64le_decode(&net_bytes[net_offset]); \
+ net_offset += 8;
-LM_ALWAYS_INLINE static void unmarshal_2(struct _unmarshal_ctx *ctx, uint16_t *out) {
- *out = uint16le_decode(&ctx->net_bytes[ctx->net_offset]);
- ctx->net_offset += 2;
-}
-
-LM_ALWAYS_INLINE static void unmarshal_4(struct _unmarshal_ctx *ctx, uint32_t *out) {
- *out = uint32le_decode(&ctx->net_bytes[ctx->net_offset]);
- ctx->net_offset += 4;
-}
-
-LM_ALWAYS_INLINE static void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out) {
- *out = uint64le_decode(&ctx->net_bytes[ctx->net_offset]);
- ctx->net_offset += 8;
-}
-
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static void unmarshal_tag(struct _unmarshal_ctx *ctx, lib9p_tag_t *out) {
- unmarshal_2(ctx, (uint16_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_fid(struct _unmarshal_ctx *ctx, lib9p_fid_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s *out) {
- memset(out, 0, sizeof(*out));
- unmarshal_2(ctx, &out->len);
- out->utf8 = (char *)&ctx->net_bytes[ctx->net_offset];
- ctx->net_offset += out->len;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static void unmarshal_dm(struct _unmarshal_ctx *ctx, lib9p_dm_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
+static void unmarshal_stat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_stat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 2;
+ UNMARSHAL_U16LE(ctx, out->kern_type);
+ UNMARSHAL_U32LE(ctx, out->kern_dev);
+ UNMARSHAL_U8LE(ctx, out->file_qid.type);
+ UNMARSHAL_U32LE(ctx, out->file_qid.vers);
+ UNMARSHAL_U64LE(ctx, out->file_qid.path);
+ UNMARSHAL_U32LE(ctx, out->file_mode);
+ UNMARSHAL_U32LE(ctx, out->file_atime);
+ UNMARSHAL_U32LE(ctx, out->file_mtime);
+ UNMARSHAL_U64LE(ctx, out->file_size);
+ UNMARSHAL_U16LE(ctx, out->file_name.len);
+ UNMARSHAL_BYTES(ctx, out->file_name.utf8, out->file_name.len);
+ UNMARSHAL_U16LE(ctx, out->file_owner_uid.len);
+ UNMARSHAL_BYTES(ctx, out->file_owner_uid.utf8, out->file_owner_uid.len);
+ UNMARSHAL_U16LE(ctx, out->file_owner_gid.len);
+ UNMARSHAL_BYTES(ctx, out->file_owner_gid.utf8, out->file_owner_gid.len);
+ UNMARSHAL_U16LE(ctx, out->file_last_modified_uid.len);
+ UNMARSHAL_BYTES(ctx, out->file_last_modified_uid.utf8, out->file_last_modified_uid.len);
+#if CONFIG_9P_ENABLE_9P2000_u
+ if (is_ver(ctx, 9P2000_u)) {
+ UNMARSHAL_U16LE(ctx, out->file_extension.len);
+ UNMARSHAL_BYTES(ctx, out->file_extension.utf8, out->file_extension.len);
+ UNMARSHAL_U32LE(ctx, out->file_owner_n_uid);
+ UNMARSHAL_U32LE(ctx, out->file_owner_n_gid);
+ UNMARSHAL_U32LE(ctx, out->file_last_modified_n_uid);
+ }
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static void unmarshal_qt(struct _unmarshal_ctx *ctx, lib9p_qt_t *out) {
- unmarshal_1(ctx, (uint8_t *)out);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+static void unmarshal_Tversion([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tversion *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->max_msg_size);
+ UNMARSHAL_U16LE(ctx, out->version.len);
+ UNMARSHAL_BYTES(ctx, out->version.utf8, out->version.len);
+}
+
+static void unmarshal_Rversion([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rversion *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->max_msg_size);
+ UNMARSHAL_U16LE(ctx, out->version.len);
+ UNMARSHAL_BYTES(ctx, out->version.utf8, out->version.len);
+}
+
+static void unmarshal_Tauth([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tauth *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->afid);
+ UNMARSHAL_U16LE(ctx, out->uname.len);
+ UNMARSHAL_BYTES(ctx, out->uname.utf8, out->uname.len);
+ UNMARSHAL_U16LE(ctx, out->aname.len);
+ UNMARSHAL_BYTES(ctx, out->aname.utf8, out->aname.len);
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static void unmarshal_nuid(struct _unmarshal_ctx *ctx, lib9p_nuid_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
+ if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) {
+ UNMARSHAL_U32LE(ctx, out->n_uid);
+ }
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static void unmarshal_o(struct _unmarshal_ctx *ctx, lib9p_o_t *out) {
- unmarshal_1(ctx, (uint8_t *)out);
}
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+static void unmarshal_Rauth([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rauth *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->aqid.type);
+ UNMARSHAL_U32LE(ctx, out->aqid.vers);
+ UNMARSHAL_U64LE(ctx, out->aqid.path);
+}
+
+static void unmarshal_Tattach([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tattach *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U32LE(ctx, out->afid);
+ UNMARSHAL_U16LE(ctx, out->uname.len);
+ UNMARSHAL_BYTES(ctx, out->uname.utf8, out->uname.len);
+ UNMARSHAL_U16LE(ctx, out->aname.len);
+ UNMARSHAL_BYTES(ctx, out->aname.utf8, out->aname.len);
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static void unmarshal_errno(struct _unmarshal_ctx *ctx, lib9p_errno_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
+ if (( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) )) {
+ UNMARSHAL_U32LE(ctx, out->n_uid);
+ }
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_ALWAYS_INLINE static void unmarshal_super_magic(struct _unmarshal_ctx *ctx, lib9p_super_magic_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_lo(struct _unmarshal_ctx *ctx, lib9p_lo_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_dt(struct _unmarshal_ctx *ctx, lib9p_dt_t *out) {
- unmarshal_1(ctx, (uint8_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_mode(struct _unmarshal_ctx *ctx, lib9p_mode_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_b4(struct _unmarshal_ctx *ctx, lib9p_b4_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_getattr(struct _unmarshal_ctx *ctx, lib9p_getattr_t *out) {
- unmarshal_8(ctx, (uint64_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_setattr(struct _unmarshal_ctx *ctx, lib9p_setattr_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_lock_type(struct _unmarshal_ctx *ctx, lib9p_lock_type_t *out) {
- unmarshal_1(ctx, (uint8_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_lock_flags(struct _unmarshal_ctx *ctx, lib9p_lock_flags_t *out) {
- unmarshal_4(ctx, (uint32_t *)out);
-}
-
-LM_ALWAYS_INLINE static void unmarshal_lock_status(struct _unmarshal_ctx *ctx, lib9p_lock_status_t *out) {
- unmarshal_1(ctx, (uint8_t *)out);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- 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) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-LM_FLATTEN static void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->count);
- out->data = (char *)&ctx->net_bytes[ctx->net_offset];
- ctx->net_offset += out->count;
-}
-
-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_4(ctx, &out->count);
-}
-
-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);
-}
-
-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);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwstat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static void unmarshal_Rrename(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rrename *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-LM_FLATTEN static void unmarshal_Rsetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsetattr *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
}
-LM_FLATTEN static void unmarshal_Rxattrwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rxattrwalk *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_8(ctx, &out->attr_size);
-}
-
-LM_FLATTEN static void unmarshal_Rxattrcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rxattrcreate *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-LM_FLATTEN static void unmarshal_Rreaddir(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rreaddir *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->count);
- out->data = (char *)&ctx->net_bytes[ctx->net_offset];
- ctx->net_offset += out->count;
-}
-
-LM_FLATTEN static void unmarshal_Rfsync(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rfsync *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-LM_FLATTEN static void unmarshal_Rlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlink *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-LM_FLATTEN static void unmarshal_Rrenameat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rrenameat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-LM_FLATTEN static void unmarshal_Runlinkat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Runlinkat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
-LM_FLATTEN static void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsession *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_8(ctx, &out->key);
-}
-
-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);
-}
-
-LM_FLATTEN static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->count);
- out->data = (char *)&ctx->net_bytes[ctx->net_offset];
- ctx->net_offset += out->count;
+static void unmarshal_Rattach([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rattach *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+}
+
+static void unmarshal_Rerror([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rerror *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U16LE(ctx, out->ename.len);
+ UNMARSHAL_BYTES(ctx, out->ename.utf8, out->ename.len);
+#if CONFIG_9P_ENABLE_9P2000_u
+ if (is_ver(ctx, 9P2000_u)) {
+ UNMARSHAL_U32LE(ctx, out->errno);
+ }
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-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);
+static void unmarshal_Tflush([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tflush *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U16LE(ctx, out->oldtag);
+}
+
+static void unmarshal_Rflush([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rflush *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Twalk([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Twalk *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U32LE(ctx, out->newfid);
+ UNMARSHAL_U16LE(ctx, out->nwname);
+ out->wname = extra;
+ extra += sizeof(out->wname[0]) * out->nwname;
+ for (uint16_t i = 0; i < out->nwname; i++) {
+ UNMARSHAL_U16LE(ctx, out->wname[i].len);
+ UNMARSHAL_BYTES(ctx, out->wname[i].utf8, out->wname[i].len);
+ }
}
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_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_8(ctx, &out->offset);
- unmarshal_4(ctx, &out->count);
-}
-
-LM_FLATTEN static void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_8(ctx, &out->offset);
- unmarshal_4(ctx, &out->count);
- out->data = (char *)&ctx->net_bytes[ctx->net_offset];
- ctx->net_offset += out->count;
-}
-
-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_fid(ctx, &out->fid);
-}
-
-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);
+static void unmarshal_Rwalk([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rwalk *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U16LE(ctx, out->nwqid);
+ out->wqid = extra;
+ extra += sizeof(out->wqid[0]) * out->nwqid;
+ for (uint16_t i = 0; i < out->nwqid; i++) {
+ UNMARSHAL_U8LE(ctx, out->wqid[i].type);
+ UNMARSHAL_U32LE(ctx, out->wqid[i].vers);
+ UNMARSHAL_U64LE(ctx, out->wqid[i].path);
+ }
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
+static void unmarshal_Topen([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Topen *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U8LE(ctx, out->mode);
+}
+
+static void unmarshal_Ropen([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Ropen *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+ UNMARSHAL_U32LE(ctx, out->iounit);
+}
+
+static void unmarshal_Tcreate([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tcreate *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+ UNMARSHAL_U32LE(ctx, out->perm);
+ UNMARSHAL_U8LE(ctx, out->mode);
+}
+
+static void unmarshal_Rcreate([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rcreate *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+ UNMARSHAL_U32LE(ctx, out->iounit);
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static void unmarshal_Tstatfs(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstatfs *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
-}
-
-LM_FLATTEN static void unmarshal_Treadlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Treadlink *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
-}
-
-LM_FLATTEN static void unmarshal_Treaddir(struct _unmarshal_ctx *ctx, struct lib9p_msg_Treaddir *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_8(ctx, &out->offset);
- unmarshal_4(ctx, &out->count);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || 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_4(ctx, &out->max_msg_size);
- unmarshal_s(ctx, &out->version);
-}
-
-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_4(ctx, &out->max_msg_size);
- unmarshal_s(ctx, &out->version);
-}
-
-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]);
+static void unmarshal_Tread([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tread *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U64LE(ctx, out->offset);
+ UNMARSHAL_U32LE(ctx, out->count);
+}
+
+static void unmarshal_Rread([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rread *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->count);
+ UNMARSHAL_BYTES(ctx, out->data, out->count);
+}
+
+static void unmarshal_Twrite([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Twrite *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U64LE(ctx, out->offset);
+ UNMARSHAL_U32LE(ctx, out->count);
+ UNMARSHAL_BYTES(ctx, out->data, out->count);
+}
+
+static void unmarshal_Rwrite([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rwrite *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->count);
+}
+
+static void unmarshal_Tclunk([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tclunk *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+}
+
+static void unmarshal_Rclunk([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rclunk *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Tremove([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tremove *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+}
+
+static void unmarshal_Rremove([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rremove *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static void unmarshal_Trename(struct _unmarshal_ctx *ctx, struct lib9p_msg_Trename *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_fid(ctx, &out->dfid);
- unmarshal_s(ctx, &out->name);
-}
-
-LM_FLATTEN static void unmarshal_Rreadlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rreadlink *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_s(ctx, &out->target);
-}
-
-LM_FLATTEN static void unmarshal_Txattrwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Txattrwalk *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_fid(ctx, &out->newfid);
- unmarshal_s(ctx, &out->name);
-}
-
-LM_FLATTEN static void unmarshal_Txattrcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Txattrcreate *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_s(ctx, &out->name);
- unmarshal_8(ctx, &out->attr_size);
- unmarshal_4(ctx, &out->flags);
-}
-
-LM_FLATTEN static void unmarshal_Tlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlink *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->dfid);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_s(ctx, &out->name);
-}
-
-LM_FLATTEN static void unmarshal_Trenameat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Trenameat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->olddirfid);
- unmarshal_s(ctx, &out->oldname);
- unmarshal_fid(ctx, &out->newdirfid);
- unmarshal_s(ctx, &out->newname);
-}
-
-LM_FLATTEN static void unmarshal_Tunlinkat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tunlinkat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->dirfd);
- unmarshal_s(ctx, &out->name);
- unmarshal_4(ctx, &out->flags);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000_e
-LM_FLATTEN static void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsread *out) {
- memset(out, 0, sizeof(*out));
- 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_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tswrite *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_4(ctx, &out->fid);
- unmarshal_2(ctx, &out->nwname);
- out->wname = ctx->extra;
- ctx->extra += sizeof(out->wname[0]) * out->nwname;
- for (typeof(out->nwname) i = 0; i < out->nwname; i++)
- unmarshal_s(ctx, &out->wname[i]);
- unmarshal_4(ctx, &out->count);
- out->data = (char *)&ctx->net_bytes[ctx->net_offset];
- ctx->net_offset += out->count;
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_e */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_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_L || CONFIG_9P_ENABLE_9P2000_u
- if ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) ) unmarshal_nuid(ctx, &out->n_uid);
-#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
-}
-
-LM_FLATTEN static void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) {
- 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_L || CONFIG_9P_ENABLE_9P2000_u
- if ( ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) ) unmarshal_nuid(ctx, &out->n_uid);
-#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static void unmarshal_Tsymlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsymlink *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_s(ctx, &out->name);
- unmarshal_s(ctx, &out->symtgt);
- unmarshal_nuid(ctx, &out->gid);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_o(ctx, &out->mode);
-}
-
-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);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_p9p
-LM_FLATTEN static void unmarshal_Topenfd(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topenfd *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);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_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_s(ctx, &out->ename);
+static void unmarshal_Tstat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tstat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+}
+
+static void unmarshal_Rstat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rstat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ net_offset += 2;
+ net_offset += 2;
+ UNMARSHAL_U16LE(ctx, out->stat.kern_type);
+ UNMARSHAL_U32LE(ctx, out->stat.kern_dev);
+ UNMARSHAL_U8LE(ctx, out->stat.file_qid.type);
+ UNMARSHAL_U32LE(ctx, out->stat.file_qid.vers);
+ UNMARSHAL_U64LE(ctx, out->stat.file_qid.path);
+ UNMARSHAL_U32LE(ctx, out->stat.file_mode);
+ UNMARSHAL_U32LE(ctx, out->stat.file_atime);
+ UNMARSHAL_U32LE(ctx, out->stat.file_mtime);
+ UNMARSHAL_U64LE(ctx, out->stat.file_size);
+ UNMARSHAL_U16LE(ctx, out->stat.file_name.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_name.utf8, out->stat.file_name.len);
+ UNMARSHAL_U16LE(ctx, out->stat.file_owner_uid.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_owner_uid.utf8, out->stat.file_owner_uid.len);
+ UNMARSHAL_U16LE(ctx, out->stat.file_owner_gid.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_owner_gid.utf8, out->stat.file_owner_gid.len);
+ UNMARSHAL_U16LE(ctx, out->stat.file_last_modified_uid.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_last_modified_uid.utf8, out->stat.file_last_modified_uid.len);
#if CONFIG_9P_ENABLE_9P2000_u
- if ( is_ver(ctx, 9P2000_u) ) unmarshal_errno(ctx, &out->errno);
+ if (is_ver(ctx, 9P2000_u)) {
+ UNMARSHAL_U16LE(ctx, out->stat.file_extension.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_extension.utf8, out->stat.file_extension.len);
+ UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_uid);
+ UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_gid);
+ UNMARSHAL_U32LE(ctx, out->stat.file_last_modified_n_uid);
+ }
#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static void unmarshal_Rlerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlerror *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_errno(ctx, &out->ecode);
-}
-
-LM_FLATTEN static void unmarshal_Rstatfs(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstatfs *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_super_magic(ctx, &out->type);
- unmarshal_4(ctx, &out->bsize);
- unmarshal_8(ctx, &out->blocks);
- unmarshal_8(ctx, &out->bfree);
- unmarshal_8(ctx, &out->bavail);
- unmarshal_8(ctx, &out->files);
- unmarshal_8(ctx, &out->ffree);
- unmarshal_8(ctx, &out->fsid);
- unmarshal_4(ctx, &out->namelen);
-}
-
-LM_FLATTEN static void unmarshal_Tlopen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlopen *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_lo(ctx, &out->flags);
-}
-
-LM_FLATTEN static void unmarshal_Tlcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlcreate *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_s(ctx, &out->name);
- unmarshal_lo(ctx, &out->flags);
- unmarshal_mode(ctx, &out->mode);
- unmarshal_nuid(ctx, &out->gid);
-}
-
-LM_FLATTEN static void unmarshal_Tmknod(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tmknod *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->dfid);
- unmarshal_s(ctx, &out->name);
- unmarshal_mode(ctx, &out->mode);
- unmarshal_4(ctx, &out->major);
- unmarshal_4(ctx, &out->minor);
- unmarshal_nuid(ctx, &out->gid);
-}
-
-LM_FLATTEN static void unmarshal_Tmkdir(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tmkdir *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->dfid);
- unmarshal_s(ctx, &out->name);
- unmarshal_mode(ctx, &out->mode);
- unmarshal_nuid(ctx, &out->gid);
-}
-
-LM_FLATTEN static void unmarshal_Tfsync(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tfsync *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_b4(ctx, &out->datasync);
-}
-
-LM_FLATTEN static void unmarshal_Tgetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tgetattr *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_getattr(ctx, &out->request_mask);
-}
-
-LM_FLATTEN static void unmarshal_Tsetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsetattr *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_setattr(ctx, &out->valid);
- unmarshal_mode(ctx, &out->mode);
- unmarshal_nuid(ctx, &out->uid);
- unmarshal_nuid(ctx, &out->gid);
- unmarshal_8(ctx, &out->filesize);
- unmarshal_8(ctx, &out->atime_sec);
- unmarshal_8(ctx, &out->atime_nsec);
- unmarshal_8(ctx, &out->mtime_sec);
- unmarshal_8(ctx, &out->mtime_nsec);
-}
-
-LM_FLATTEN static void unmarshal_Tgetlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tgetlock *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_lock_type(ctx, &out->type);
- unmarshal_8(ctx, &out->start);
- unmarshal_8(ctx, &out->length);
- unmarshal_4(ctx, &out->proc_id);
- unmarshal_s(ctx, &out->client_id);
-}
-
-LM_FLATTEN static void unmarshal_Rgetlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rgetlock *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_lock_type(ctx, &out->type);
- unmarshal_8(ctx, &out->start);
- unmarshal_8(ctx, &out->length);
- unmarshal_4(ctx, &out->proc_id);
- unmarshal_s(ctx, &out->client_id);
-}
-
-LM_FLATTEN static void unmarshal_Tlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tlock *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_fid(ctx, &out->fid);
- unmarshal_lock_type(ctx, &out->type);
- unmarshal_lock_flags(ctx, &out->flags);
- unmarshal_8(ctx, &out->start);
- unmarshal_8(ctx, &out->length);
- unmarshal_4(ctx, &out->proc_id);
- unmarshal_s(ctx, &out->client_id);
-}
-
-LM_FLATTEN static void unmarshal_Rlock(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlock *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_lock_status(ctx, &out->status);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_ALWAYS_INLINE static void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 2;
- 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);
+static void unmarshal_Twstat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Twstat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ net_offset += 2;
+ net_offset += 2;
+ UNMARSHAL_U16LE(ctx, out->stat.kern_type);
+ UNMARSHAL_U32LE(ctx, out->stat.kern_dev);
+ UNMARSHAL_U8LE(ctx, out->stat.file_qid.type);
+ UNMARSHAL_U32LE(ctx, out->stat.file_qid.vers);
+ UNMARSHAL_U64LE(ctx, out->stat.file_qid.path);
+ UNMARSHAL_U32LE(ctx, out->stat.file_mode);
+ UNMARSHAL_U32LE(ctx, out->stat.file_atime);
+ UNMARSHAL_U32LE(ctx, out->stat.file_mtime);
+ UNMARSHAL_U64LE(ctx, out->stat.file_size);
+ UNMARSHAL_U16LE(ctx, out->stat.file_name.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_name.utf8, out->stat.file_name.len);
+ UNMARSHAL_U16LE(ctx, out->stat.file_owner_uid.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_owner_uid.utf8, out->stat.file_owner_uid.len);
+ UNMARSHAL_U16LE(ctx, out->stat.file_owner_gid.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_owner_gid.utf8, out->stat.file_owner_gid.len);
+ UNMARSHAL_U16LE(ctx, out->stat.file_last_modified_uid.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_last_modified_uid.utf8, out->stat.file_last_modified_uid.len);
#if CONFIG_9P_ENABLE_9P2000_u
- if ( is_ver(ctx, 9P2000_u) ) unmarshal_s(ctx, &out->file_extension);
- if ( is_ver(ctx, 9P2000_u) ) unmarshal_nuid(ctx, &out->file_owner_n_uid);
- if ( is_ver(ctx, 9P2000_u) ) unmarshal_nuid(ctx, &out->file_owner_n_gid);
- if ( is_ver(ctx, 9P2000_u) ) unmarshal_nuid(ctx, &out->file_last_modified_n_uid);
+ if (is_ver(ctx, 9P2000_u)) {
+ UNMARSHAL_U16LE(ctx, out->stat.file_extension.len);
+ UNMARSHAL_BYTES(ctx, out->stat.file_extension.utf8, out->stat.file_extension.len);
+ UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_uid);
+ UNMARSHAL_U32LE(ctx, out->stat.file_owner_n_gid);
+ UNMARSHAL_U32LE(ctx, out->stat.file_last_modified_n_uid);
+ }
#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_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);
-}
-
-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_qid(ctx, &out->qid);
-}
-
-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]);
-}
-
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
- unmarshal_4(ctx, &out->iounit);
-}
-
-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_qid(ctx, &out->qid);
- unmarshal_4(ctx, &out->iounit);
+static void unmarshal_Rwstat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rwstat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
}
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_p9p
-LM_FLATTEN static void unmarshal_Ropenfd(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropenfd *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_4(ctx, &out->unixfd);
+static void unmarshal_Topenfd([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Topenfd *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U8LE(ctx, out->mode);
+}
+
+static void unmarshal_Ropenfd([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Ropenfd *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+ UNMARSHAL_U32LE(ctx, out->iounit);
+ UNMARSHAL_U32LE(ctx, out->unixfd);
}
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_L
-LM_FLATTEN static void unmarshal_Rlopen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlopen *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
- unmarshal_4(ctx, &out->iounit);
-}
-
-LM_FLATTEN static void unmarshal_Rlcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rlcreate *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
- unmarshal_4(ctx, &out->iounit);
-}
-
-LM_FLATTEN static void unmarshal_Rsymlink(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsymlink *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
-}
-
-LM_FLATTEN static void unmarshal_Rmknod(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rmknod *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
-}
-
-LM_FLATTEN static void unmarshal_Rgetattr(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rgetattr *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_getattr(ctx, &out->valid);
- unmarshal_qid(ctx, &out->qid);
- unmarshal_mode(ctx, &out->mode);
- unmarshal_nuid(ctx, &out->uid);
- unmarshal_nuid(ctx, &out->gid);
- unmarshal_8(ctx, &out->nlink);
- unmarshal_8(ctx, &out->rdev);
- unmarshal_8(ctx, &out->filesize);
- unmarshal_8(ctx, &out->blksize);
- unmarshal_8(ctx, &out->blocks);
- unmarshal_8(ctx, &out->atime_sec);
- unmarshal_8(ctx, &out->atime_nsec);
- unmarshal_8(ctx, &out->mtime_sec);
- unmarshal_8(ctx, &out->mtime_nsec);
- unmarshal_8(ctx, &out->ctime_sec);
- unmarshal_8(ctx, &out->ctime_nsec);
- unmarshal_8(ctx, &out->btime_sec);
- unmarshal_8(ctx, &out->btime_nsec);
- unmarshal_8(ctx, &out->gen);
- unmarshal_8(ctx, &out->data_version);
-}
-
-LM_FLATTEN static void unmarshal_Rmkdir(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rmkdir *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- unmarshal_qid(ctx, &out->qid);
+static void unmarshal_Rlerror([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rlerror *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->ecode);
+}
+
+static void unmarshal_Tstatfs([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tstatfs *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+}
+
+static void unmarshal_Rstatfs([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rstatfs *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->type);
+ UNMARSHAL_U32LE(ctx, out->bsize);
+ UNMARSHAL_U64LE(ctx, out->blocks);
+ UNMARSHAL_U64LE(ctx, out->bfree);
+ UNMARSHAL_U64LE(ctx, out->bavail);
+ UNMARSHAL_U64LE(ctx, out->files);
+ UNMARSHAL_U64LE(ctx, out->ffree);
+ UNMARSHAL_U64LE(ctx, out->fsid);
+ UNMARSHAL_U32LE(ctx, out->namelen);
+}
+
+static void unmarshal_Tlopen([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tlopen *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U32LE(ctx, out->flags);
+}
+
+static void unmarshal_Rlopen([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rlopen *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+ UNMARSHAL_U32LE(ctx, out->iounit);
+}
+
+static void unmarshal_Tlcreate([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tlcreate *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+ UNMARSHAL_U32LE(ctx, out->flags);
+ UNMARSHAL_U32LE(ctx, out->mode);
+ UNMARSHAL_U32LE(ctx, out->gid);
+}
+
+static void unmarshal_Rlcreate([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rlcreate *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+ UNMARSHAL_U32LE(ctx, out->iounit);
+}
+
+static void unmarshal_Tsymlink([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tsymlink *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+ UNMARSHAL_U16LE(ctx, out->symtgt.len);
+ UNMARSHAL_BYTES(ctx, out->symtgt.utf8, out->symtgt.len);
+ UNMARSHAL_U32LE(ctx, out->gid);
+}
+
+static void unmarshal_Rsymlink([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rsymlink *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+}
+
+static void unmarshal_Tmknod([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tmknod *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->dfid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+ UNMARSHAL_U32LE(ctx, out->mode);
+ UNMARSHAL_U32LE(ctx, out->major);
+ UNMARSHAL_U32LE(ctx, out->minor);
+ UNMARSHAL_U32LE(ctx, out->gid);
+}
+
+static void unmarshal_Rmknod([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rmknod *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+}
+
+static void unmarshal_Trename([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Trename *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U32LE(ctx, out->dfid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+}
+
+static void unmarshal_Rrename([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rrename *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Treadlink([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Treadlink *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+}
+
+static void unmarshal_Rreadlink([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rreadlink *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U16LE(ctx, out->target.len);
+ UNMARSHAL_BYTES(ctx, out->target.utf8, out->target.len);
+}
+
+static void unmarshal_Tgetattr([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tgetattr *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U64LE(ctx, out->request_mask);
+}
+
+static void unmarshal_Rgetattr([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rgetattr *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U64LE(ctx, out->valid);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+ UNMARSHAL_U32LE(ctx, out->mode);
+ UNMARSHAL_U32LE(ctx, out->uid);
+ UNMARSHAL_U32LE(ctx, out->gid);
+ UNMARSHAL_U64LE(ctx, out->nlink);
+ UNMARSHAL_U64LE(ctx, out->rdev);
+ UNMARSHAL_U64LE(ctx, out->filesize);
+ UNMARSHAL_U64LE(ctx, out->blksize);
+ UNMARSHAL_U64LE(ctx, out->blocks);
+ UNMARSHAL_U64LE(ctx, out->atime_sec);
+ UNMARSHAL_U64LE(ctx, out->atime_nsec);
+ UNMARSHAL_U64LE(ctx, out->mtime_sec);
+ UNMARSHAL_U64LE(ctx, out->mtime_nsec);
+ UNMARSHAL_U64LE(ctx, out->ctime_sec);
+ UNMARSHAL_U64LE(ctx, out->ctime_nsec);
+ UNMARSHAL_U64LE(ctx, out->btime_sec);
+ UNMARSHAL_U64LE(ctx, out->btime_nsec);
+ UNMARSHAL_U64LE(ctx, out->gen);
+ UNMARSHAL_U64LE(ctx, out->data_version);
+}
+
+static void unmarshal_Tsetattr([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tsetattr *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U32LE(ctx, out->valid);
+ UNMARSHAL_U32LE(ctx, out->mode);
+ UNMARSHAL_U32LE(ctx, out->uid);
+ UNMARSHAL_U32LE(ctx, out->gid);
+ UNMARSHAL_U64LE(ctx, out->filesize);
+ UNMARSHAL_U64LE(ctx, out->atime_sec);
+ UNMARSHAL_U64LE(ctx, out->atime_nsec);
+ UNMARSHAL_U64LE(ctx, out->mtime_sec);
+ UNMARSHAL_U64LE(ctx, out->mtime_nsec);
+}
+
+static void unmarshal_Rsetattr([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rsetattr *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Txattrwalk([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Txattrwalk *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U32LE(ctx, out->newfid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+}
+
+static void unmarshal_Rxattrwalk([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rxattrwalk *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U64LE(ctx, out->attr_size);
+}
+
+static void unmarshal_Txattrcreate([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Txattrcreate *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+ UNMARSHAL_U64LE(ctx, out->attr_size);
+ UNMARSHAL_U32LE(ctx, out->flags);
+}
+
+static void unmarshal_Rxattrcreate([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rxattrcreate *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Treaddir([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Treaddir *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U64LE(ctx, out->offset);
+ UNMARSHAL_U32LE(ctx, out->count);
+}
+
+static void unmarshal_Rreaddir([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rreaddir *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->count);
+ UNMARSHAL_BYTES(ctx, out->data, out->count);
+}
+
+static void unmarshal_Tfsync([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tfsync *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U32LE(ctx, out->datasync);
+}
+
+static void unmarshal_Rfsync([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rfsync *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Tlock([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tlock *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U8LE(ctx, out->type);
+ UNMARSHAL_U32LE(ctx, out->flags);
+ UNMARSHAL_U64LE(ctx, out->start);
+ UNMARSHAL_U64LE(ctx, out->length);
+ UNMARSHAL_U32LE(ctx, out->proc_id);
+ UNMARSHAL_U16LE(ctx, out->client_id.len);
+ UNMARSHAL_BYTES(ctx, out->client_id.utf8, out->client_id.len);
+}
+
+static void unmarshal_Rlock([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rlock *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->status);
+}
+
+static void unmarshal_Tgetlock([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tgetlock *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U8LE(ctx, out->type);
+ UNMARSHAL_U64LE(ctx, out->start);
+ UNMARSHAL_U64LE(ctx, out->length);
+ UNMARSHAL_U32LE(ctx, out->proc_id);
+ UNMARSHAL_U16LE(ctx, out->client_id.len);
+ UNMARSHAL_BYTES(ctx, out->client_id.utf8, out->client_id.len);
+}
+
+static void unmarshal_Rgetlock([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rgetlock *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->type);
+ UNMARSHAL_U64LE(ctx, out->start);
+ UNMARSHAL_U64LE(ctx, out->length);
+ UNMARSHAL_U32LE(ctx, out->proc_id);
+ UNMARSHAL_U16LE(ctx, out->client_id.len);
+ UNMARSHAL_BYTES(ctx, out->client_id.utf8, out->client_id.len);
+}
+
+static void unmarshal_Tlink([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tlink *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->dfid);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+}
+
+static void unmarshal_Rlink([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rlink *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Tmkdir([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tmkdir *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->dfid);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+ UNMARSHAL_U32LE(ctx, out->mode);
+ UNMARSHAL_U32LE(ctx, out->gid);
+}
+
+static void unmarshal_Rmkdir([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rmkdir *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U8LE(ctx, out->qid.type);
+ UNMARSHAL_U32LE(ctx, out->qid.vers);
+ UNMARSHAL_U64LE(ctx, out->qid.path);
+}
+
+static void unmarshal_Trenameat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Trenameat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->olddirfid);
+ UNMARSHAL_U16LE(ctx, out->oldname.len);
+ UNMARSHAL_BYTES(ctx, out->oldname.utf8, out->oldname.len);
+ UNMARSHAL_U32LE(ctx, out->newdirfid);
+ UNMARSHAL_U16LE(ctx, out->newname.len);
+ UNMARSHAL_BYTES(ctx, out->newname.utf8, out->newname.len);
+}
+
+static void unmarshal_Rrenameat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rrenameat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Tunlinkat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tunlinkat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->dirfd);
+ UNMARSHAL_U16LE(ctx, out->name.len);
+ UNMARSHAL_BYTES(ctx, out->name.utf8, out->name.len);
+ UNMARSHAL_U32LE(ctx, out->flags);
+}
+
+static void unmarshal_Runlinkat([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Runlinkat *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
}
#endif /* CONFIG_9P_ENABLE_9P2000_L */
-#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-LM_FLATTEN static void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) {
- memset(out, 0, sizeof(*out));
- ctx->net_offset += 4;
- ctx->net_offset += 1;
- unmarshal_tag(ctx, &out->tag);
- ctx->net_offset += 2;
- unmarshal_stat(ctx, &out->stat);
-}
-
-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_fid(ctx, &out->fid);
- ctx->net_offset += 2;
- unmarshal_stat(ctx, &out->stat);
+#if CONFIG_9P_ENABLE_9P2000_e
+static void unmarshal_Tsession([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tsession *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U64LE(ctx, out->key);
+}
+
+static void unmarshal_Rsession([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rsession *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+}
+
+static void unmarshal_Tsread([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tsread *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U16LE(ctx, out->nwname);
+ out->wname = extra;
+ extra += sizeof(out->wname[0]) * out->nwname;
+ for (uint16_t i = 0; i < out->nwname; i++) {
+ UNMARSHAL_U16LE(ctx, out->wname[i].len);
+ UNMARSHAL_BYTES(ctx, out->wname[i].utf8, out->wname[i].len);
+ }
+}
+
+static void unmarshal_Rsread([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rsread *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->count);
+ UNMARSHAL_BYTES(ctx, out->data, out->count);
+}
+
+static void unmarshal_Tswrite([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Tswrite *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->fid);
+ UNMARSHAL_U16LE(ctx, out->nwname);
+ out->wname = extra;
+ extra += sizeof(out->wname[0]) * out->nwname;
+ for (uint16_t i = 0; i < out->nwname; i++) {
+ UNMARSHAL_U16LE(ctx, out->wname[i].len);
+ UNMARSHAL_BYTES(ctx, out->wname[i].utf8, out->wname[i].len);
+ }
+ UNMARSHAL_U32LE(ctx, out->count);
+ UNMARSHAL_BYTES(ctx, out->data, out->count);
}
-#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+
+static void unmarshal_Rswrite([[gnu::unused]] struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out_buf) {
+ struct lib9p_msg_Rswrite *out = out_buf;
+ [[gnu::unused]] void *extra = &out[1];
+ uint32_t net_offset = 0;
+ net_offset += 4;
+ net_offset += 1;
+ UNMARSHAL_U16LE(ctx, out->tag);
+ UNMARSHAL_U32LE(ctx, out->count);
+}
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
/* marshal_* ******************************************************************/
-#define MARSHAL_BYTES_ZEROCOPY(ctx, data, len) \
- if (ctx->net_iov[ctx->net_iov_cnt-1].iov_len) \
- ctx->net_iov_cnt++; \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_base = data; \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_len = len; \
- ctx->net_iov_cnt++;
-#define MARSHAL_BYTES(ctx, data, len) \
- if (!ctx->net_iov[ctx->net_iov_cnt-1].iov_base) \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_base = &ctx->net_copied[ctx->net_copied_size]; \
- memcpy(&ctx->net_copied[ctx->net_copied_size], data, len); \
- ctx->net_copied_size += len; \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_len += len;
-#define MARSHAL_U8LE(ctx, val) \
- if (!ctx->net_iov[ctx->net_iov_cnt-1].iov_base) \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_base = &ctx->net_copied[ctx->net_copied_size]; \
- ctx->net_copied[ctx->net_copied_size] = val; \
- ctx->net_copied_size += 1; \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_len += 1;
-#define MARSHAL_U16LE(ctx, val) \
- if (!ctx->net_iov[ctx->net_iov_cnt-1].iov_base) \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_base = &ctx->net_copied[ctx->net_copied_size]; \
- uint16le_encode(&ctx->net_copied[ctx->net_copied_size], val); \
- ctx->net_copied_size += 2; \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_len += 2;
-#define MARSHAL_U32LE(ctx, val) \
- if (!ctx->net_iov[ctx->net_iov_cnt-1].iov_base) \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_base = &ctx->net_copied[ctx->net_copied_size]; \
- uint32le_encode(&ctx->net_copied[ctx->net_copied_size], val); \
- ctx->net_copied_size += 4; \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_len += 4;
-#define MARSHAL_U64LE(ctx, val) \
- if (!ctx->net_iov[ctx->net_iov_cnt-1].iov_base) \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_base = &ctx->net_copied[ctx->net_copied_size]; \
- uint64le_encode(&ctx->net_copied[ctx->net_copied_size], val); \
- ctx->net_copied_size += 8; \
- ctx->net_iov[ctx->net_iov_cnt-1].iov_len += 8;
+#define MARSHAL_BYTES_ZEROCOPY(ctx, data, len) \
+ if (ret->net_iov[ret->net_iov_cnt-1].iov_len) \
+ ret->net_iov_cnt++; \
+ ret->net_iov[ret->net_iov_cnt-1].iov_base = data; \
+ ret->net_iov[ret->net_iov_cnt-1].iov_len = len; \
+ ret->net_iov_cnt++;
+#define MARSHAL_BYTES(ctx, data, len) \
+ if (!ret->net_iov[ret->net_iov_cnt-1].iov_base) \
+ ret->net_iov[ret->net_iov_cnt-1].iov_base = &ret->net_copied[ret->net_copied_size]; \
+ memcpy(&ret->net_copied[ret->net_copied_size], data, len); \
+ ret->net_copied_size += len; \
+ ret->net_iov[ret->net_iov_cnt-1].iov_len += len;
+#define MARSHAL_U8LE(ctx, val) \
+ if (!ret->net_iov[ret->net_iov_cnt-1].iov_base) \
+ ret->net_iov[ret->net_iov_cnt-1].iov_base = &ret->net_copied[ret->net_copied_size]; \
+ ret->net_copied[ret->net_copied_size] = val; \
+ ret->net_copied_size += 1; \
+ ret->net_iov[ret->net_iov_cnt-1].iov_len += 1;
+#define MARSHAL_U16LE(ctx, val) \
+ if (!ret->net_iov[ret->net_iov_cnt-1].iov_base) \
+ ret->net_iov[ret->net_iov_cnt-1].iov_base = &ret->net_copied[ret->net_copied_size]; \
+ uint16le_encode(&ret->net_copied[ret->net_copied_size], val); \
+ ret->net_copied_size += 2; \
+ ret->net_iov[ret->net_iov_cnt-1].iov_len += 2;
+#define MARSHAL_U32LE(ctx, val) \
+ if (!ret->net_iov[ret->net_iov_cnt-1].iov_base) \
+ ret->net_iov[ret->net_iov_cnt-1].iov_base = &ret->net_copied[ret->net_copied_size]; \
+ uint32le_encode(&ret->net_copied[ret->net_copied_size], val); \
+ ret->net_copied_size += 4; \
+ ret->net_iov[ret->net_iov_cnt-1].iov_len += 4;
+#define MARSHAL_U64LE(ctx, val) \
+ if (!ret->net_iov[ret->net_iov_cnt-1].iov_base) \
+ ret->net_iov[ret->net_iov_cnt-1].iov_base = &ret->net_copied[ret->net_copied_size]; \
+ uint64le_encode(&ret->net_copied[ret->net_copied_size], val); \
+ ret->net_copied_size += 8; \
+ ret->net_iov[ret->net_iov_cnt-1].iov_len += 8;
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
+static bool marshal_stat(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 49 + val->file_name.len + val->file_owner_uid.len + val->file_owner_gid.len + val->file_last_modified_uid.len;
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 14 + val->file_extension.len;
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
- if (needed_size > ctx->ctx->max_msg_size) {
+ if (needed_size > ctx->max_msg_size) {
return true;
}
uint32_t offsetof_end = needed_size;
@@ -2979,10 +2979,10 @@ static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
MARSHAL_U16LE(ctx, offsetof_end - offsetof_kern_type);
MARSHAL_U16LE(ctx, val->kern_type);
MARSHAL_U32LE(ctx, val->kern_dev);
- MARSHAL_U8LE(ctx, val->file_qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->file_qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->file_qid.vers);
MARSHAL_U64LE(ctx, val->file_qid.path);
- MARSHAL_U32LE(ctx, val->file_mode & dm_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->file_mode & dm_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->file_atime);
MARSHAL_U32LE(ctx, val->file_mtime);
MARSHAL_U64LE(ctx, val->file_size);
@@ -2998,20 +2998,8 @@ static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U16LE(ctx, val->file_extension.len);
MARSHAL_BYTES(ctx, val->file_extension.utf8, val->file_extension.len);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->file_owner_n_uid);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->file_owner_n_gid);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->file_last_modified_n_uid);
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
@@ -3020,13 +3008,13 @@ static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) {
+static bool marshal_Tversion(struct lib9p_ctx *ctx, struct lib9p_msg_Tversion *val, struct _marshal_ret *ret) {
uint32_t needed_size = 13 + val->version.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tversion",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3040,13 +3028,13 @@ static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion
return false;
}
-static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion *val) {
+static bool marshal_Rversion(struct lib9p_ctx *ctx, struct lib9p_msg_Rversion *val, struct _marshal_ret *ret) {
uint32_t needed_size = 13 + val->version.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rversion",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3060,18 +3048,18 @@ static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion
return false;
}
-static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val) {
+static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, struct _marshal_ret *ret) {
uint32_t needed_size = 15 + val->uname.len + val->aname.len;
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
if ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) {
needed_size += 4;
}
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tauth",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3092,13 +3080,13 @@ static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val)
return false;
}
-static bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) {
+static bool marshal_Rauth(struct lib9p_ctx *ctx, struct lib9p_msg_Rauth *val, struct _marshal_ret *ret) {
uint32_t needed_size = 20;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rauth",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3106,24 +3094,24 @@ static bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val)
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 103);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->aqid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->aqid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->aqid.vers);
MARSHAL_U64LE(ctx, val->aqid.path);
return false;
}
-static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *val) {
+static bool marshal_Tattach(struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *val, struct _marshal_ret *ret) {
uint32_t needed_size = 19 + val->uname.len + val->aname.len;
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
if ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) {
needed_size += 4;
}
#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tattach",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3145,13 +3133,13 @@ static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *
return false;
}
-static bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) {
+static bool marshal_Rattach(struct lib9p_ctx *ctx, struct lib9p_msg_Rattach *val, struct _marshal_ret *ret) {
uint32_t needed_size = 20;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rattach",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3159,24 +3147,24 @@ static bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 105);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
return false;
}
-static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) {
+static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val, struct _marshal_ret *ret) {
uint32_t needed_size = 9 + val->ename.len;
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 4;
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rerror",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3194,13 +3182,13 @@ static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *va
return false;
}
-static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) {
+static bool marshal_Tflush(struct lib9p_ctx *ctx, struct lib9p_msg_Tflush *val, struct _marshal_ret *ret) {
uint32_t needed_size = 9;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tflush",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3212,13 +3200,13 @@ static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *va
return false;
}
-static bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rflush *val) {
+static bool marshal_Rflush(struct lib9p_ctx *ctx, struct lib9p_msg_Rflush *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rflush",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3229,16 +3217,16 @@ static bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rflush *va
return false;
}
-static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) {
+static bool marshal_Twalk(struct lib9p_ctx *ctx, struct lib9p_msg_Twalk *val, struct _marshal_ret *ret) {
uint32_t needed_size = 17;
for (uint16_t i = 0; i < val->nwname; i++) {
needed_size += 2 + val->wname[i].len;
}
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Twalk",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3256,13 +3244,13 @@ static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val)
return false;
}
-static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val) {
+static bool marshal_Rwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rwalk *val, struct _marshal_ret *ret) {
uint32_t needed_size = 9 + (val->nwqid)*13;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rwalk",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3272,7 +3260,7 @@ static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val)
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U16LE(ctx, val->nwqid);
for (uint16_t i = 0; i < val->nwqid; i++) {
- MARSHAL_U8LE(ctx, val->wqid[i].type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->wqid[i].type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->wqid[i].vers);
MARSHAL_U64LE(ctx, val->wqid[i].path);
}
@@ -3281,13 +3269,13 @@ static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val)
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) {
+static bool marshal_Topen(struct lib9p_ctx *ctx, struct lib9p_msg_Topen *val, struct _marshal_ret *ret) {
uint32_t needed_size = 12;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Topen",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3296,17 +3284,17 @@ static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val)
MARSHAL_U8LE(ctx, 112);
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
- MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->version]);
return false;
}
-static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) {
+static bool marshal_Ropen(struct lib9p_ctx *ctx, struct lib9p_msg_Ropen *val, struct _marshal_ret *ret) {
uint32_t needed_size = 24;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Ropen",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3314,20 +3302,20 @@ static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val)
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 113);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
MARSHAL_U32LE(ctx, val->iounit);
return false;
}
-static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *val) {
+static bool marshal_Tcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tcreate *val, struct _marshal_ret *ret) {
uint32_t needed_size = 18 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tcreate",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3338,18 +3326,18 @@ static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->name.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->name.utf8, val->name.len);
- MARSHAL_U32LE(ctx, val->perm & dm_masks[ctx->ctx->version]);
- MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->perm & dm_masks[ctx->version]);
+ MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->version]);
return false;
}
-static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *val) {
+static bool marshal_Rcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rcreate *val, struct _marshal_ret *ret) {
uint32_t needed_size = 24;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rcreate",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3357,7 +3345,7 @@ static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 115);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
MARSHAL_U32LE(ctx, val->iounit);
@@ -3366,13 +3354,13 @@ static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-static bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val) {
+static bool marshal_Tread(struct lib9p_ctx *ctx, struct lib9p_msg_Tread *val, struct _marshal_ret *ret) {
uint32_t needed_size = 23;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tread",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3386,13 +3374,13 @@ static bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val)
return false;
}
-static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) {
+static bool marshal_Rread(struct lib9p_ctx *ctx, struct lib9p_msg_Rread *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11 + val->count;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rread",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3405,13 +3393,13 @@ static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val)
return false;
}
-static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) {
+static bool marshal_Twrite(struct lib9p_ctx *ctx, struct lib9p_msg_Twrite *val, struct _marshal_ret *ret) {
uint32_t needed_size = 23 + val->count;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Twrite",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3426,13 +3414,13 @@ static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *va
return false;
}
-static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) {
+static bool marshal_Rwrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rwrite *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rwrite",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3444,13 +3432,13 @@ static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *va
return false;
}
-static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) {
+static bool marshal_Tclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Tclunk *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tclunk",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3462,13 +3450,13 @@ static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *va
return false;
}
-static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *val) {
+static bool marshal_Rclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Rclunk *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rclunk",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3479,13 +3467,13 @@ static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *va
return false;
}
-static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *val) {
+static bool marshal_Tremove(struct lib9p_ctx *ctx, struct lib9p_msg_Tremove *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tremove",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3497,13 +3485,13 @@ static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *
return false;
}
-static bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *val) {
+static bool marshal_Rremove(struct lib9p_ctx *ctx, struct lib9p_msg_Rremove *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rremove",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3516,13 +3504,13 @@ static bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
-static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) {
+static bool marshal_Tstat(struct lib9p_ctx *ctx, struct lib9p_msg_Tstat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tstat",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3534,18 +3522,18 @@ static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val)
return false;
}
-static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) {
+static bool marshal_Rstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 58 + val->stat.file_name.len + val->stat.file_owner_uid.len + val->stat.file_owner_gid.len + val->stat.file_last_modified_uid.len;
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 14 + val->stat.file_extension.len;
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rstat",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3565,10 +3553,10 @@ static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val)
MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_kern_type);
MARSHAL_U16LE(ctx, val->stat.kern_type);
MARSHAL_U32LE(ctx, val->stat.kern_dev);
- MARSHAL_U8LE(ctx, val->stat.file_qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->stat.file_qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->stat.file_qid.vers);
MARSHAL_U64LE(ctx, val->stat.file_qid.path);
- MARSHAL_U32LE(ctx, val->stat.file_mode & dm_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->stat.file_mode & dm_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->stat.file_atime);
MARSHAL_U32LE(ctx, val->stat.file_mtime);
MARSHAL_U64LE(ctx, val->stat.file_size);
@@ -3584,38 +3572,26 @@ static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val)
if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U16LE(ctx, val->stat.file_extension.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_extension.utf8, val->stat.file_extension.len);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->stat.file_owner_n_uid);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->stat.file_owner_n_gid);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->stat.file_last_modified_n_uid);
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
return false;
}
-static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *val) {
+static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 62 + val->stat.file_name.len + val->stat.file_owner_uid.len + val->stat.file_owner_gid.len + val->stat.file_last_modified_uid.len;
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 14 + val->stat.file_extension.len;
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Twstat",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3636,10 +3612,10 @@ static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *va
MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_kern_type);
MARSHAL_U16LE(ctx, val->stat.kern_type);
MARSHAL_U32LE(ctx, val->stat.kern_dev);
- MARSHAL_U8LE(ctx, val->stat.file_qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->stat.file_qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->stat.file_qid.vers);
MARSHAL_U64LE(ctx, val->stat.file_qid.path);
- MARSHAL_U32LE(ctx, val->stat.file_mode & dm_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->stat.file_mode & dm_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->stat.file_atime);
MARSHAL_U32LE(ctx, val->stat.file_mtime);
MARSHAL_U64LE(ctx, val->stat.file_size);
@@ -3655,33 +3631,21 @@ static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *va
if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U16LE(ctx, val->stat.file_extension.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->stat.file_extension.utf8, val->stat.file_extension.len);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->stat.file_owner_n_uid);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->stat.file_owner_n_gid);
- }
-#endif /* CONFIG_9P_ENABLE_9P2000_u */
-#if CONFIG_9P_ENABLE_9P2000_u
- if (is_ver(ctx, 9P2000_u)) {
MARSHAL_U32LE(ctx, val->stat.file_last_modified_n_uid);
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
return false;
}
-static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *val) {
+static bool marshal_Rwstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rwstat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rwstat",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3694,13 +3658,13 @@ static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *va
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_p9p
-static bool marshal_Topenfd(struct _marshal_ctx *ctx, struct lib9p_msg_Topenfd *val) {
+static bool marshal_Topenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Topenfd *val, struct _marshal_ret *ret) {
uint32_t needed_size = 12;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Topenfd",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3709,17 +3673,17 @@ static bool marshal_Topenfd(struct _marshal_ctx *ctx, struct lib9p_msg_Topenfd *
MARSHAL_U8LE(ctx, 98);
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
- MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->version]);
return false;
}
-static bool marshal_Ropenfd(struct _marshal_ctx *ctx, struct lib9p_msg_Ropenfd *val) {
+static bool marshal_Ropenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Ropenfd *val, struct _marshal_ret *ret) {
uint32_t needed_size = 28;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Ropenfd",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3727,7 +3691,7 @@ static bool marshal_Ropenfd(struct _marshal_ctx *ctx, struct lib9p_msg_Ropenfd *
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 99);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
MARSHAL_U32LE(ctx, val->iounit);
@@ -3737,13 +3701,13 @@ static bool marshal_Ropenfd(struct _marshal_ctx *ctx, struct lib9p_msg_Ropenfd *
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_L
-static bool marshal_Rlerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rlerror *val) {
+static bool marshal_Rlerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rlerror *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rlerror",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3755,13 +3719,13 @@ static bool marshal_Rlerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rlerror *
return false;
}
-static bool marshal_Tstatfs(struct _marshal_ctx *ctx, struct lib9p_msg_Tstatfs *val) {
+static bool marshal_Tstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Tstatfs *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tstatfs",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3773,13 +3737,13 @@ static bool marshal_Tstatfs(struct _marshal_ctx *ctx, struct lib9p_msg_Tstatfs *
return false;
}
-static bool marshal_Rstatfs(struct _marshal_ctx *ctx, struct lib9p_msg_Rstatfs *val) {
+static bool marshal_Rstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Rstatfs *val, struct _marshal_ret *ret) {
uint32_t needed_size = 67;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rstatfs",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3799,13 +3763,13 @@ static bool marshal_Rstatfs(struct _marshal_ctx *ctx, struct lib9p_msg_Rstatfs *
return false;
}
-static bool marshal_Tlopen(struct _marshal_ctx *ctx, struct lib9p_msg_Tlopen *val) {
+static bool marshal_Tlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Tlopen *val, struct _marshal_ret *ret) {
uint32_t needed_size = 15;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tlopen",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3814,17 +3778,17 @@ static bool marshal_Tlopen(struct _marshal_ctx *ctx, struct lib9p_msg_Tlopen *va
MARSHAL_U8LE(ctx, 12);
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
- MARSHAL_U32LE(ctx, val->flags & lo_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->flags & lo_masks[ctx->version]);
return false;
}
-static bool marshal_Rlopen(struct _marshal_ctx *ctx, struct lib9p_msg_Rlopen *val) {
+static bool marshal_Rlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Rlopen *val, struct _marshal_ret *ret) {
uint32_t needed_size = 24;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rlopen",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3832,20 +3796,20 @@ static bool marshal_Rlopen(struct _marshal_ctx *ctx, struct lib9p_msg_Rlopen *va
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 13);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
MARSHAL_U32LE(ctx, val->iounit);
return false;
}
-static bool marshal_Tlcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tlcreate *val) {
+static bool marshal_Tlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tlcreate *val, struct _marshal_ret *ret) {
uint32_t needed_size = 25 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tlcreate",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3856,19 +3820,19 @@ static bool marshal_Tlcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tlcreate
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->name.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->name.utf8, val->name.len);
- MARSHAL_U32LE(ctx, val->flags & lo_masks[ctx->ctx->version]);
- MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->flags & lo_masks[ctx->version]);
+ MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->gid);
return false;
}
-static bool marshal_Rlcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rlcreate *val) {
+static bool marshal_Rlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rlcreate *val, struct _marshal_ret *ret) {
uint32_t needed_size = 24;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rlcreate",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3876,20 +3840,20 @@ static bool marshal_Rlcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rlcreate
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 15);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
MARSHAL_U32LE(ctx, val->iounit);
return false;
}
-static bool marshal_Tsymlink(struct _marshal_ctx *ctx, struct lib9p_msg_Tsymlink *val) {
+static bool marshal_Tsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tsymlink *val, struct _marshal_ret *ret) {
uint32_t needed_size = 19 + val->name.len + val->symtgt.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tsymlink",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3906,13 +3870,13 @@ static bool marshal_Tsymlink(struct _marshal_ctx *ctx, struct lib9p_msg_Tsymlink
return false;
}
-static bool marshal_Rsymlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rsymlink *val) {
+static bool marshal_Rsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rsymlink *val, struct _marshal_ret *ret) {
uint32_t needed_size = 20;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rsymlink",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3920,19 +3884,19 @@ static bool marshal_Rsymlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rsymlink
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 17);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
return false;
}
-static bool marshal_Tmknod(struct _marshal_ctx *ctx, struct lib9p_msg_Tmknod *val) {
+static bool marshal_Tmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Tmknod *val, struct _marshal_ret *ret) {
uint32_t needed_size = 29 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tmknod",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3943,20 +3907,20 @@ static bool marshal_Tmknod(struct _marshal_ctx *ctx, struct lib9p_msg_Tmknod *va
MARSHAL_U32LE(ctx, val->dfid);
MARSHAL_U16LE(ctx, val->name.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->name.utf8, val->name.len);
- MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->major);
MARSHAL_U32LE(ctx, val->minor);
MARSHAL_U32LE(ctx, val->gid);
return false;
}
-static bool marshal_Rmknod(struct _marshal_ctx *ctx, struct lib9p_msg_Rmknod *val) {
+static bool marshal_Rmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Rmknod *val, struct _marshal_ret *ret) {
uint32_t needed_size = 20;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rmknod",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3964,19 +3928,19 @@ static bool marshal_Rmknod(struct _marshal_ctx *ctx, struct lib9p_msg_Rmknod *va
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 19);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
return false;
}
-static bool marshal_Trename(struct _marshal_ctx *ctx, struct lib9p_msg_Trename *val) {
+static bool marshal_Trename(struct lib9p_ctx *ctx, struct lib9p_msg_Trename *val, struct _marshal_ret *ret) {
uint32_t needed_size = 17 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Trename",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -3991,13 +3955,13 @@ static bool marshal_Trename(struct _marshal_ctx *ctx, struct lib9p_msg_Trename *
return false;
}
-static bool marshal_Rrename(struct _marshal_ctx *ctx, struct lib9p_msg_Rrename *val) {
+static bool marshal_Rrename(struct lib9p_ctx *ctx, struct lib9p_msg_Rrename *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rrename",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4008,13 +3972,13 @@ static bool marshal_Rrename(struct _marshal_ctx *ctx, struct lib9p_msg_Rrename *
return false;
}
-static bool marshal_Treadlink(struct _marshal_ctx *ctx, struct lib9p_msg_Treadlink *val) {
+static bool marshal_Treadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Treadlink *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Treadlink",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4026,13 +3990,13 @@ static bool marshal_Treadlink(struct _marshal_ctx *ctx, struct lib9p_msg_Treadli
return false;
}
-static bool marshal_Rreadlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rreadlink *val) {
+static bool marshal_Rreadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rreadlink *val, struct _marshal_ret *ret) {
uint32_t needed_size = 9 + val->target.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rreadlink",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4045,13 +4009,13 @@ static bool marshal_Rreadlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rreadli
return false;
}
-static bool marshal_Tgetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Tgetattr *val) {
+static bool marshal_Tgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetattr *val, struct _marshal_ret *ret) {
uint32_t needed_size = 19;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tgetattr",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4060,17 +4024,17 @@ static bool marshal_Tgetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Tgetattr
MARSHAL_U8LE(ctx, 24);
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
- MARSHAL_U64LE(ctx, val->request_mask & getattr_masks[ctx->ctx->version]);
+ MARSHAL_U64LE(ctx, val->request_mask & getattr_masks[ctx->version]);
return false;
}
-static bool marshal_Rgetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Rgetattr *val) {
+static bool marshal_Rgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetattr *val, struct _marshal_ret *ret) {
uint32_t needed_size = 160;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rgetattr",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4078,11 +4042,11 @@ static bool marshal_Rgetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Rgetattr
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 25);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U64LE(ctx, val->valid & getattr_masks[ctx->ctx->version]);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U64LE(ctx, val->valid & getattr_masks[ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
- MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->uid);
MARSHAL_U32LE(ctx, val->gid);
MARSHAL_U64LE(ctx, val->nlink);
@@ -4103,13 +4067,13 @@ static bool marshal_Rgetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Rgetattr
return false;
}
-static bool marshal_Tsetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Tsetattr *val) {
+static bool marshal_Tsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tsetattr *val, struct _marshal_ret *ret) {
uint32_t needed_size = 67;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tsetattr",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4118,8 +4082,8 @@ static bool marshal_Tsetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Tsetattr
MARSHAL_U8LE(ctx, 26);
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
- MARSHAL_U32LE(ctx, val->valid & setattr_masks[ctx->ctx->version]);
- MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->valid & setattr_masks[ctx->version]);
+ MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->uid);
MARSHAL_U32LE(ctx, val->gid);
MARSHAL_U64LE(ctx, val->filesize);
@@ -4130,13 +4094,13 @@ static bool marshal_Tsetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Tsetattr
return false;
}
-static bool marshal_Rsetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Rsetattr *val) {
+static bool marshal_Rsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rsetattr *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rsetattr",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4147,13 +4111,13 @@ static bool marshal_Rsetattr(struct _marshal_ctx *ctx, struct lib9p_msg_Rsetattr
return false;
}
-static bool marshal_Txattrwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Txattrwalk *val) {
+static bool marshal_Txattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrwalk *val, struct _marshal_ret *ret) {
uint32_t needed_size = 17 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Txattrwalk",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4168,13 +4132,13 @@ static bool marshal_Txattrwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Txattr
return false;
}
-static bool marshal_Rxattrwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rxattrwalk *val) {
+static bool marshal_Rxattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrwalk *val, struct _marshal_ret *ret) {
uint32_t needed_size = 15;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rxattrwalk",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4186,13 +4150,13 @@ static bool marshal_Rxattrwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rxattr
return false;
}
-static bool marshal_Txattrcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Txattrcreate *val) {
+static bool marshal_Txattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrcreate *val, struct _marshal_ret *ret) {
uint32_t needed_size = 25 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Txattrcreate",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4208,13 +4172,13 @@ static bool marshal_Txattrcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Txat
return false;
}
-static bool marshal_Rxattrcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rxattrcreate *val) {
+static bool marshal_Rxattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrcreate *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rxattrcreate",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4225,13 +4189,13 @@ static bool marshal_Rxattrcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rxat
return false;
}
-static bool marshal_Treaddir(struct _marshal_ctx *ctx, struct lib9p_msg_Treaddir *val) {
+static bool marshal_Treaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Treaddir *val, struct _marshal_ret *ret) {
uint32_t needed_size = 23;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Treaddir",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4245,13 +4209,13 @@ static bool marshal_Treaddir(struct _marshal_ctx *ctx, struct lib9p_msg_Treaddir
return false;
}
-static bool marshal_Rreaddir(struct _marshal_ctx *ctx, struct lib9p_msg_Rreaddir *val) {
+static bool marshal_Rreaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Rreaddir *val, struct _marshal_ret *ret) {
uint64_t needed_size = 11 + val->count;
- if (needed_size > (uint64_t)(ctx->ctx->max_msg_size)) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > (uint64_t)(ctx->max_msg_size)) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rreaddir",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4264,13 +4228,13 @@ static bool marshal_Rreaddir(struct _marshal_ctx *ctx, struct lib9p_msg_Rreaddir
return false;
}
-static bool marshal_Tfsync(struct _marshal_ctx *ctx, struct lib9p_msg_Tfsync *val) {
+static bool marshal_Tfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Tfsync *val, struct _marshal_ret *ret) {
uint32_t needed_size = 15;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tfsync",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4283,13 +4247,13 @@ static bool marshal_Tfsync(struct _marshal_ctx *ctx, struct lib9p_msg_Tfsync *va
return false;
}
-static bool marshal_Rfsync(struct _marshal_ctx *ctx, struct lib9p_msg_Rfsync *val) {
+static bool marshal_Rfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Rfsync *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rfsync",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4300,13 +4264,13 @@ static bool marshal_Rfsync(struct _marshal_ctx *ctx, struct lib9p_msg_Rfsync *va
return false;
}
-static bool marshal_Tlock(struct _marshal_ctx *ctx, struct lib9p_msg_Tlock *val) {
+static bool marshal_Tlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tlock *val, struct _marshal_ret *ret) {
uint32_t needed_size = 38 + val->client_id.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tlock",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4316,7 +4280,7 @@ static bool marshal_Tlock(struct _marshal_ctx *ctx, struct lib9p_msg_Tlock *val)
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U8LE(ctx, val->type);
- MARSHAL_U32LE(ctx, val->flags & lock_flags_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->flags & lock_flags_masks[ctx->version]);
MARSHAL_U64LE(ctx, val->start);
MARSHAL_U64LE(ctx, val->length);
MARSHAL_U32LE(ctx, val->proc_id);
@@ -4325,13 +4289,13 @@ static bool marshal_Tlock(struct _marshal_ctx *ctx, struct lib9p_msg_Tlock *val)
return false;
}
-static bool marshal_Rlock(struct _marshal_ctx *ctx, struct lib9p_msg_Rlock *val) {
+static bool marshal_Rlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rlock *val, struct _marshal_ret *ret) {
uint32_t needed_size = 8;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rlock",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4343,13 +4307,13 @@ static bool marshal_Rlock(struct _marshal_ctx *ctx, struct lib9p_msg_Rlock *val)
return false;
}
-static bool marshal_Tgetlock(struct _marshal_ctx *ctx, struct lib9p_msg_Tgetlock *val) {
+static bool marshal_Tgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetlock *val, struct _marshal_ret *ret) {
uint32_t needed_size = 34 + val->client_id.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tgetlock",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4367,13 +4331,13 @@ static bool marshal_Tgetlock(struct _marshal_ctx *ctx, struct lib9p_msg_Tgetlock
return false;
}
-static bool marshal_Rgetlock(struct _marshal_ctx *ctx, struct lib9p_msg_Rgetlock *val) {
+static bool marshal_Rgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetlock *val, struct _marshal_ret *ret) {
uint32_t needed_size = 30 + val->client_id.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rgetlock",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4390,13 +4354,13 @@ static bool marshal_Rgetlock(struct _marshal_ctx *ctx, struct lib9p_msg_Rgetlock
return false;
}
-static bool marshal_Tlink(struct _marshal_ctx *ctx, struct lib9p_msg_Tlink *val) {
+static bool marshal_Tlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tlink *val, struct _marshal_ret *ret) {
uint32_t needed_size = 17 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tlink",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4411,13 +4375,13 @@ static bool marshal_Tlink(struct _marshal_ctx *ctx, struct lib9p_msg_Tlink *val)
return false;
}
-static bool marshal_Rlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rlink *val) {
+static bool marshal_Rlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rlink *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rlink",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4428,13 +4392,13 @@ static bool marshal_Rlink(struct _marshal_ctx *ctx, struct lib9p_msg_Rlink *val)
return false;
}
-static bool marshal_Tmkdir(struct _marshal_ctx *ctx, struct lib9p_msg_Tmkdir *val) {
+static bool marshal_Tmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Tmkdir *val, struct _marshal_ret *ret) {
uint32_t needed_size = 21 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tmkdir",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4445,18 +4409,18 @@ static bool marshal_Tmkdir(struct _marshal_ctx *ctx, struct lib9p_msg_Tmkdir *va
MARSHAL_U32LE(ctx, val->dfid);
MARSHAL_U16LE(ctx, val->name.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->name.utf8, val->name.len);
- MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->ctx->version]);
+ MARSHAL_U32LE(ctx, val->mode & mode_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->gid);
return false;
}
-static bool marshal_Rmkdir(struct _marshal_ctx *ctx, struct lib9p_msg_Rmkdir *val) {
+static bool marshal_Rmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Rmkdir *val, struct _marshal_ret *ret) {
uint32_t needed_size = 20;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rmkdir",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4464,19 +4428,19 @@ static bool marshal_Rmkdir(struct _marshal_ctx *ctx, struct lib9p_msg_Rmkdir *va
MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
MARSHAL_U8LE(ctx, 73);
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->ctx->version]);
+ MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
MARSHAL_U64LE(ctx, val->qid.path);
return false;
}
-static bool marshal_Trenameat(struct _marshal_ctx *ctx, struct lib9p_msg_Trenameat *val) {
+static bool marshal_Trenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Trenameat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 19 + val->oldname.len + val->newname.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Trenameat",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4493,13 +4457,13 @@ static bool marshal_Trenameat(struct _marshal_ctx *ctx, struct lib9p_msg_Trename
return false;
}
-static bool marshal_Rrenameat(struct _marshal_ctx *ctx, struct lib9p_msg_Rrenameat *val) {
+static bool marshal_Rrenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Rrenameat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rrenameat",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4510,13 +4474,13 @@ static bool marshal_Rrenameat(struct _marshal_ctx *ctx, struct lib9p_msg_Rrename
return false;
}
-static bool marshal_Tunlinkat(struct _marshal_ctx *ctx, struct lib9p_msg_Tunlinkat *val) {
+static bool marshal_Tunlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Tunlinkat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 17 + val->name.len;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tunlinkat",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4531,13 +4495,13 @@ static bool marshal_Tunlinkat(struct _marshal_ctx *ctx, struct lib9p_msg_Tunlink
return false;
}
-static bool marshal_Runlinkat(struct _marshal_ctx *ctx, struct lib9p_msg_Runlinkat *val) {
+static bool marshal_Runlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Runlinkat *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Runlinkat",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4550,13 +4514,13 @@ static bool marshal_Runlinkat(struct _marshal_ctx *ctx, struct lib9p_msg_Runlink
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
-static bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession *val) {
+static bool marshal_Tsession(struct lib9p_ctx *ctx, struct lib9p_msg_Tsession *val, struct _marshal_ret *ret) {
uint32_t needed_size = 15;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tsession",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4568,13 +4532,13 @@ static bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession
return false;
}
-static bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_Rsession *val) {
+static bool marshal_Rsession(struct lib9p_ctx *ctx, struct lib9p_msg_Rsession *val, struct _marshal_ret *ret) {
uint32_t needed_size = 7;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rsession",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4585,16 +4549,16 @@ static bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_Rsession
return false;
}
-static bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *val) {
+static bool marshal_Tsread(struct lib9p_ctx *ctx, struct lib9p_msg_Tsread *val, struct _marshal_ret *ret) {
uint64_t needed_size = 13;
for (uint16_t i = 0; i < val->nwname; i++) {
needed_size += 2 + val->wname[i].len;
}
- if (needed_size > (uint64_t)(ctx->ctx->max_msg_size)) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > (uint64_t)(ctx->max_msg_size)) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tsread",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4611,13 +4575,13 @@ static bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *va
return false;
}
-static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) {
+static bool marshal_Rsread(struct lib9p_ctx *ctx, struct lib9p_msg_Rsread *val, struct _marshal_ret *ret) {
uint64_t needed_size = 11 + val->count;
- if (needed_size > (uint64_t)(ctx->ctx->max_msg_size)) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > (uint64_t)(ctx->max_msg_size)) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rsread",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4630,16 +4594,16 @@ static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *va
return false;
}
-static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *val) {
+static bool marshal_Tswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Tswrite *val, struct _marshal_ret *ret) {
uint64_t needed_size = 17 + val->count;
for (uint16_t i = 0; i < val->nwname; i++) {
needed_size += 2 + val->wname[i].len;
}
- if (needed_size > (uint64_t)(ctx->ctx->max_msg_size)) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > (uint64_t)(ctx->max_msg_size)) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Tswrite",
- ctx->ctx->version ? "negotiated" : "client",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "client",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
@@ -4658,13 +4622,13 @@ static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *
return false;
}
-static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) {
+static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val, struct _marshal_ret *ret) {
uint32_t needed_size = 11;
- if (needed_size > ctx->ctx->max_msg_size) {
- lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
+ if (needed_size > ctx->max_msg_size) {
+ lib9p_errorf(ctx, LINUX_ERANGE, "%s message too large to marshal into %s limit (limit=%"PRIu32")",
"Rswrite",
- ctx->ctx->version ? "negotiated" : "server",
- ctx->ctx->max_msg_size);
+ ctx->version ? "negotiated" : "server",
+ ctx->max_msg_size);
return true;
}
uint32_t offsetof_end = needed_size;
@@ -4677,34 +4641,2935 @@ static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *
}
#endif /* CONFIG_9P_ENABLE_9P2000_e */
-/* function tables ************************************************************/
+/* *_format *******************************************************************/
+
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_tag_format(lib9p_tag_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_TAG_NOTAG:
+ fmt_state_puts(state, "NOTAG");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu16, *self);
+ }
+}
+
+static void lib9p_fid_format(lib9p_fid_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_FID_NOFID:
+ fmt_state_puts(state, "NOFID");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu32, *self);
+ }
+}
+
+static void lib9p_s_format(struct lib9p_s *self, struct fmt_state *state) {
+ /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47781 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat"
+#pragma GCC diagnostic ignored "-Wformat-extra-args"
+ fmt_state_printf(state, "%.*q", self->len, self->utf8);
+#pragma GCC diagnostic pop
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_dm_format(lib9p_dm_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<31)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "DIR");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<30)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "APPEND");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<29)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "EXCL");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<28)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "_PLAN9_MOUNT");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<27)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "AUTH");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<26)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "TMP");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<25)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<25");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<24)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<24");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<23)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "DEVICE");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<22)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<22");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<21)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PIPE");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<20)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "SOCKET");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<19)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "SETUID");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<18)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "SETGID");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<17)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<17");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<16)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<16");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<15)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<15");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<14)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<14");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<13)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<13");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<12)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<12");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<11)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<11");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<10)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<10");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<9)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<9");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<8)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "OWNER_R");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "OWNER_W");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "OWNER_X");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "GROUP_R");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "GROUP_W");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "GROUP_X");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "OTHER_R");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<1)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "OTHER_W");
+ empty = false;
+ }
+ if ((*self & ~((lib9p_dm_t)0777)) & (UINT32_C(1)<<0)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "OTHER_X");
+ empty = false;
+ }
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_printf(state, "%#04"PRIo32, *self & 0777);
+ fmt_state_putchar(state, ')');
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_qt_format(lib9p_qt_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if (*self & (UINT8_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "DIR");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "APPEND");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "EXCL");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "_PLAN9_MOUNT");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "AUTH");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "TMP");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<1)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "SYMLINK");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<0)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<0");
+ empty = false;
+ }
+ if (empty)
+ fmt_state_putchar(state, '0');
+ fmt_state_putchar(state, ')');
+}
+
+static void lib9p_qid_format(struct lib9p_qid *self, struct fmt_state *state) {
+ fmt_state_putchar(state, '{');
+ fmt_state_puts(state, " type=");
+ lib9p_qt_format(&self->type, state);
+ fmt_state_puts(state, " vers=");
+ fmt_state_printf(state, "%"PRIu32, self->vers);
+ fmt_state_puts(state, " path=");
+ fmt_state_printf(state, "%"PRIu64, self->path);
+ fmt_state_puts(state, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_stat_format(struct lib9p_stat *self, struct fmt_state *state) {
+ fmt_state_putchar(state, '{');
+ fmt_state_puts(state, " kern_type=");
+ fmt_state_printf(state, "%"PRIu16, self->kern_type);
+ fmt_state_puts(state, " kern_dev=");
+ fmt_state_printf(state, "%"PRIu32, self->kern_dev);
+ fmt_state_puts(state, " file_qid=");
+ lib9p_qid_format(&self->file_qid, state);
+ fmt_state_puts(state, " file_mode=");
+ lib9p_dm_format(&self->file_mode, state);
+ fmt_state_puts(state, " file_atime=");
+ fmt_state_printf(state, "%"PRIu32, self->file_atime);
+ fmt_state_puts(state, " file_mtime=");
+ fmt_state_printf(state, "%"PRIu32, self->file_mtime);
+ fmt_state_puts(state, " file_size=");
+ fmt_state_printf(state, "%"PRIu64, self->file_size);
+ fmt_state_puts(state, " file_name=");
+ lib9p_s_format(&self->file_name, state);
+ fmt_state_puts(state, " file_owner_uid=");
+ lib9p_s_format(&self->file_owner_uid, state);
+ fmt_state_puts(state, " file_owner_gid=");
+ lib9p_s_format(&self->file_owner_gid, state);
+ fmt_state_puts(state, " file_last_modified_uid=");
+ lib9p_s_format(&self->file_last_modified_uid, state);
+#if CONFIG_9P_ENABLE_9P2000_u
+ fmt_state_puts(state, " file_extension=");
+ lib9p_s_format(&self->file_extension, state);
+ fmt_state_puts(state, " file_owner_n_uid=");
+ lib9p_nuid_format(&self->file_owner_n_uid, state);
+ fmt_state_puts(state, " file_owner_n_gid=");
+ lib9p_nuid_format(&self->file_owner_n_gid, state);
+ fmt_state_puts(state, " file_last_modified_n_uid=");
+ lib9p_nuid_format(&self->file_last_modified_n_uid, state);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ fmt_state_puts(state, " }");
+}
-const uint32_t _lib9p_table_msg_min_size[LIB9P_VER_NUM] = {
- [LIB9P_VER_unknown] = 9,
+static void lib9p_o_format(lib9p_o_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if (*self & (UINT8_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<7");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "RCLOSE");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "CEXEC");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "TRUNC");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<3");
+ empty = false;
+ }
+ if (*self & (UINT8_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<2");
+ empty = false;
+ }
+ switch (*self & LIB9P_O_MODE_MASK) {
+ case LIB9P_O_MODE_READ:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_READ");
+ empty = false;
+ break;
+ case LIB9P_O_MODE_WRITE:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_WRITE");
+ empty = false;
+ break;
+ case LIB9P_O_MODE_RDWR:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_RDWR");
+ empty = false;
+ break;
+ case LIB9P_O_MODE_EXEC:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_EXEC");
+ empty = false;
+ break;
+ default:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_printf(state, "%"PRIu8, *self & LIB9P_O_MODE_MASK);
+ empty = false;
+ }
+ if (empty)
+ fmt_state_putchar(state, '0');
+ fmt_state_putchar(state, ')');
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_msg_Tversion_format(struct lib9p_msg_Tversion *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tversion {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " max_msg_size=");
+ fmt_state_printf(state, "%"PRIu32, self->max_msg_size);
+ fmt_state_puts(state, " version=");
+ lib9p_s_format(&self->version, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rversion_format(struct lib9p_msg_Rversion *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rversion {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " max_msg_size=");
+ fmt_state_printf(state, "%"PRIu32, self->max_msg_size);
+ fmt_state_puts(state, " version=");
+ lib9p_s_format(&self->version, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tauth_format(struct lib9p_msg_Tauth *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tauth {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " afid=");
+ lib9p_fid_format(&self->afid, state);
+ fmt_state_puts(state, " uname=");
+ lib9p_s_format(&self->uname, state);
+ fmt_state_puts(state, " aname=");
+ lib9p_s_format(&self->aname, state);
+#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
+ fmt_state_puts(state, " n_uid=");
+ lib9p_nuid_format(&self->n_uid, state);
+#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rauth_format(struct lib9p_msg_Rauth *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rauth {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " aqid=");
+ lib9p_qid_format(&self->aqid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tattach_format(struct lib9p_msg_Tattach *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tattach {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " afid=");
+ lib9p_fid_format(&self->afid, state);
+ fmt_state_puts(state, " uname=");
+ lib9p_s_format(&self->uname, state);
+ fmt_state_puts(state, " aname=");
+ lib9p_s_format(&self->aname, state);
+#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
+ fmt_state_puts(state, " n_uid=");
+ lib9p_nuid_format(&self->n_uid, state);
+#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rattach_format(struct lib9p_msg_Rattach *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rattach {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rerror_format(struct lib9p_msg_Rerror *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rerror {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " ename=");
+ lib9p_s_format(&self->ename, state);
+#if CONFIG_9P_ENABLE_9P2000_u
+ fmt_state_puts(state, " errno=");
+ lib9p_errno_format(&self->errno, state);
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tflush_format(struct lib9p_msg_Tflush *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tflush {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " oldtag=");
+ fmt_state_printf(state, "%"PRIu16, self->oldtag);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rflush_format(struct lib9p_msg_Rflush *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rflush {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Twalk_format(struct lib9p_msg_Twalk *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Twalk {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " newfid=");
+ lib9p_fid_format(&self->newfid, state);
+ fmt_state_puts(state, " nwname=");
+ fmt_state_printf(state, "%"PRIu16, self->nwname);
+ fmt_state_puts(state, " wname=[");
+ for (uint16_t i = 0; i < self->nwname; i++) {
+ if (i)
+ fmt_state_puts(state, ", ");
+ lib9p_s_format(&self->wname[i], state);
+ }
+ fmt_state_puts(state, " ]");
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rwalk_format(struct lib9p_msg_Rwalk *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rwalk {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " nwqid=");
+ fmt_state_printf(state, "%"PRIu16, self->nwqid);
+ fmt_state_puts(state, " wqid=[");
+ for (uint16_t i = 0; i < self->nwqid; i++) {
+ if (i)
+ fmt_state_puts(state, ", ");
+ lib9p_qid_format(&self->wqid[i], state);
+ }
+ fmt_state_puts(state, " ]");
+ fmt_state_puts(state, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_msg_Topen_format(struct lib9p_msg_Topen *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Topen {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_o_format(&self->mode, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Ropen_format(struct lib9p_msg_Ropen *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Ropen {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " iounit=");
+ fmt_state_printf(state, "%"PRIu32, self->iounit);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tcreate_format(struct lib9p_msg_Tcreate *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tcreate {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " perm=");
+ lib9p_dm_format(&self->perm, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_o_format(&self->mode, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rcreate_format(struct lib9p_msg_Rcreate *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rcreate {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " iounit=");
+ fmt_state_printf(state, "%"PRIu32, self->iounit);
+ fmt_state_puts(state, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_msg_Tread_format(struct lib9p_msg_Tread *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tread {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " offset=");
+ fmt_state_printf(state, "%"PRIu64, self->offset);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rread_format(struct lib9p_msg_Rread *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rread {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " data=<bytedata>");
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Twrite_format(struct lib9p_msg_Twrite *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Twrite {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " offset=");
+ fmt_state_printf(state, "%"PRIu64, self->offset);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " data=<bytedata>");
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rwrite_format(struct lib9p_msg_Rwrite *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rwrite {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tclunk_format(struct lib9p_msg_Tclunk *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tclunk {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rclunk_format(struct lib9p_msg_Rclunk *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rclunk {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tremove_format(struct lib9p_msg_Tremove *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tremove {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rremove_format(struct lib9p_msg_Rremove *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rremove {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_msg_Tstat_format(struct lib9p_msg_Tstat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tstat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rstat_format(struct lib9p_msg_Rstat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rstat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " stat=");
+ lib9p_stat_format(&self->stat, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Twstat_format(struct lib9p_msg_Twstat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Twstat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " stat=");
+ lib9p_stat_format(&self->stat, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rwstat_format(struct lib9p_msg_Rwstat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rwstat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_p9p
+static void lib9p_msg_Topenfd_format(struct lib9p_msg_Topenfd *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Topenfd {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_o_format(&self->mode, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Ropenfd_format(struct lib9p_msg_Ropenfd *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Ropenfd {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " iounit=");
+ fmt_state_printf(state, "%"PRIu32, self->iounit);
+ fmt_state_puts(state, " unixfd=");
+ fmt_state_printf(state, "%"PRIu32, self->unixfd);
+ fmt_state_puts(state, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
+#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
+static void lib9p_nuid_format(lib9p_nuid_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_NUID_NONUID:
+ fmt_state_puts(state, "NONUID");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu32, *self);
+ }
+}
+
+static void lib9p_errno_format(lib9p_errno_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_ERRNO_NOERROR:
+ fmt_state_puts(state, "NOERROR");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu32, *self);
+ }
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u */
+#if CONFIG_9P_ENABLE_9P2000_L
+static void lib9p_super_magic_format(lib9p_super_magic_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_SUPER_MAGIC_V9FS_MAGIC:
+ fmt_state_puts(state, "V9FS_MAGIC");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu32, *self);
+ }
+}
+
+static void lib9p_lo_format(lib9p_lo_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if (*self & (UINT32_C(1)<<31)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<31");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<30)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<30");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<29)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<29");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<28)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<28");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<27)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<27");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<26)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<26");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<25)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<25");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<24)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<24");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<23)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<23");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<22)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<22");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<21)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<21");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<20)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "SYNC");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<19)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "CLOEXEC");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<18)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "NOATIME");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<17)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "NOFOLLOW");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<16)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "DIRECTORY");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<15)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "LARGEFILE");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<14)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "DIRECT");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<13)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "BSD_FASYNC");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<12)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "DSYNC");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<11)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "NONBLOCK");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<10)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "APPEND");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<9)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "TRUNC");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<8)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "NOCTTY");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "EXCL");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "CREATE");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<5");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<4");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<3");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<2");
+ empty = false;
+ }
+ switch (*self & LIB9P_LO_MODE_MASK) {
+ case LIB9P_LO_MODE_RDONLY:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_RDONLY");
+ empty = false;
+ break;
+ case LIB9P_LO_MODE_WRONLY:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_WRONLY");
+ empty = false;
+ break;
+ case LIB9P_LO_MODE_RDWR:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_RDWR");
+ empty = false;
+ break;
+ case LIB9P_LO_MODE_NOACCESS:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE_NOACCESS");
+ empty = false;
+ break;
+ default:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_printf(state, "%"PRIu32, *self & LIB9P_LO_MODE_MASK);
+ empty = false;
+ }
+ if (empty)
+ fmt_state_putchar(state, '0');
+ fmt_state_putchar(state, ')');
+}
+
+static void lib9p_dt_format(lib9p_dt_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_DT_UNKNOWN:
+ fmt_state_puts(state, "UNKNOWN");
+ break;
+ case LIB9P_DT_PIPE:
+ fmt_state_puts(state, "PIPE");
+ break;
+ case LIB9P_DT_CHAR_DEV:
+ fmt_state_puts(state, "CHAR_DEV");
+ break;
+ case LIB9P_DT_DIRECTORY:
+ fmt_state_puts(state, "DIRECTORY");
+ break;
+ case LIB9P_DT_BLOCK_DEV:
+ fmt_state_puts(state, "BLOCK_DEV");
+ break;
+ case LIB9P_DT_REGULAR:
+ fmt_state_puts(state, "REGULAR");
+ break;
+ case LIB9P_DT_SYMLINK:
+ fmt_state_puts(state, "SYMLINK");
+ break;
+ case LIB9P_DT_SOCKET:
+ fmt_state_puts(state, "SOCKET");
+ break;
+ case _LIB9P_DT_WHITEOUT:
+ fmt_state_puts(state, "_WHITEOUT");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu8, *self);
+ }
+}
+
+static void lib9p_mode_format(lib9p_mode_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if (*self & (UINT32_C(1)<<31)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<31");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<30)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<30");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<29)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<29");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<28)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<28");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<27)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<27");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<26)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<26");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<25)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<25");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<24)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<24");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<23)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<23");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<22)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<22");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<21)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<21");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<20)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<20");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<19)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<19");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<18)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<18");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<17)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<17");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<16)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<16");
+ empty = false;
+ }
+ switch (*self & LIB9P_MODE_FMT_MASK) {
+ case LIB9P_MODE_FMT_PIPE:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "FMT_PIPE");
+ empty = false;
+ break;
+ case LIB9P_MODE_FMT_CHAR_DEV:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "FMT_CHAR_DEV");
+ empty = false;
+ break;
+ case LIB9P_MODE_FMT_DIRECTORY:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "FMT_DIRECTORY");
+ empty = false;
+ break;
+ case LIB9P_MODE_FMT_BLOCK_DEV:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "FMT_BLOCK_DEV");
+ empty = false;
+ break;
+ case LIB9P_MODE_FMT_REGULAR:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "FMT_REGULAR");
+ empty = false;
+ break;
+ case LIB9P_MODE_FMT_SYMLINK:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "FMT_SYMLINK");
+ empty = false;
+ break;
+ case LIB9P_MODE_FMT_SOCKET:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "FMT_SOCKET");
+ empty = false;
+ break;
+ default:
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_printf(state, "%"PRIu32, *self & LIB9P_MODE_FMT_MASK);
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<11)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_SETGROUP");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<10)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_SETUSER");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<9)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_STICKY");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<8)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_OWNER_R");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_OWNER_W");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_OWNER_X");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_GROUP_R");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_GROUP_W");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_GROUP_X");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_OTHER_R");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<1)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_OTHER_W");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<0)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "PERM_OTHER_X");
+ empty = false;
+ }
+ if (empty)
+ fmt_state_putchar(state, '0');
+ fmt_state_putchar(state, ')');
+}
+
+static void lib9p_b4_format(lib9p_b4_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_B4_FALSE:
+ fmt_state_puts(state, "FALSE");
+ break;
+ case LIB9P_B4_TRUE:
+ fmt_state_puts(state, "TRUE");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu32, *self);
+ }
+}
+
+static void lib9p_getattr_format(lib9p_getattr_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if (*self & (UINT64_C(1)<<63)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<63");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<62)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<62");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<61)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<61");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<60)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<60");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<59)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<59");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<58)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<58");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<57)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<57");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<56)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<56");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<55)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<55");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<54)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<54");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<53)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<53");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<52)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<52");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<51)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<51");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<50)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<50");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<49)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<49");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<48)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<48");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<47)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<47");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<46)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<46");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<45)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<45");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<44)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<44");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<43)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<43");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<42)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<42");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<41)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<41");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<40)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<40");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<39)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<39");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<38)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<38");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<37)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<37");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<36)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<36");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<35)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<35");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<34)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<34");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<33)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<33");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<32)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<32");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<31)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<31");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<30)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<30");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<29)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<29");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<28)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<28");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<27)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<27");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<26)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<26");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<25)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<25");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<24)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<24");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<23)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<23");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<22)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<22");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<21)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<21");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<20)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<20");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<19)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<19");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<18)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<18");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<17)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<17");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<16)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<16");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<15)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<15");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<14)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<14");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<13)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "DATA_VERSION");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<12)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "GEN");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<11)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "BTIME");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<10)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "BLOCKS");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<9)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "SIZE");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<8)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "INO");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "CTIME");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MTIME");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "ATIME");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "RDEV");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "GID");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "UID");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<1)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "NLINK");
+ empty = false;
+ }
+ if (*self & (UINT64_C(1)<<0)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE");
+ empty = false;
+ }
+ if (empty)
+ fmt_state_putchar(state, '0');
+ fmt_state_putchar(state, ')');
+}
+
+static void lib9p_setattr_format(lib9p_setattr_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if (*self & (UINT32_C(1)<<31)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<31");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<30)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<30");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<29)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<29");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<28)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<28");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<27)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<27");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<26)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<26");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<25)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<25");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<24)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<24");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<23)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<23");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<22)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<22");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<21)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<21");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<20)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<20");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<19)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<19");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<18)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<18");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<17)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<17");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<16)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<16");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<15)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<15");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<14)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<14");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<13)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<13");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<12)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<12");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<11)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<11");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<10)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<10");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<9)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<9");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<8)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MTIME_SET");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "ATIME_SET");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "CTIME");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MTIME");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "ATIME");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "SIZE");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "GID");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<1)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "UID");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<0)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "MODE");
+ empty = false;
+ }
+ if (empty)
+ fmt_state_putchar(state, '0');
+ fmt_state_putchar(state, ')');
+}
+
+static void lib9p_lock_type_format(lib9p_lock_type_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_LOCK_TYPE_RDLCK:
+ fmt_state_puts(state, "RDLCK");
+ break;
+ case LIB9P_LOCK_TYPE_WRLCK:
+ fmt_state_puts(state, "WRLCK");
+ break;
+ case LIB9P_LOCK_TYPE_UNLCK:
+ fmt_state_puts(state, "UNLCK");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu8, *self);
+ }
+}
+
+static void lib9p_lock_flags_format(lib9p_lock_flags_t *self, struct fmt_state *state) {
+ bool empty = true;
+ fmt_state_putchar(state, '(');
+ if (*self & (UINT32_C(1)<<31)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<31");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<30)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<30");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<29)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<29");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<28)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<28");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<27)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<27");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<26)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<26");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<25)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<25");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<24)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<24");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<23)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<23");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<22)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<22");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<21)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<21");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<20)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<20");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<19)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<19");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<18)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<18");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<17)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<17");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<16)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<16");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<15)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<15");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<14)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<14");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<13)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<13");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<12)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<12");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<11)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<11");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<10)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<10");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<9)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<9");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<8)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<8");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<7)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<7");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<6)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<6");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<5)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<5");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<4)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<4");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<3)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<3");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<2)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "1<<2");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<1)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "RECLAIM");
+ empty = false;
+ }
+ if (*self & (UINT32_C(1)<<0)) {
+ if (!empty)
+ fmt_state_putchar(state, '|');
+ fmt_state_puts(state, "BLOCK");
+ empty = false;
+ }
+ if (empty)
+ fmt_state_putchar(state, '0');
+ fmt_state_putchar(state, ')');
+}
+
+static void lib9p_lock_status_format(lib9p_lock_status_t *self, struct fmt_state *state) {
+ switch (*self) {
+ case LIB9P_LOCK_STATUS_SUCCESS:
+ fmt_state_puts(state, "SUCCESS");
+ break;
+ case LIB9P_LOCK_STATUS_BLOCKED:
+ fmt_state_puts(state, "BLOCKED");
+ break;
+ case LIB9P_LOCK_STATUS_ERROR:
+ fmt_state_puts(state, "ERROR");
+ break;
+ case LIB9P_LOCK_STATUS_GRACE:
+ fmt_state_puts(state, "GRACE");
+ break;
+ default:
+ fmt_state_printf(state, "%"PRIu8, *self);
+ }
+}
+
+static void lib9p_msg_Rlerror_format(struct lib9p_msg_Rlerror *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rlerror {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " ecode=");
+ lib9p_errno_format(&self->ecode, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tstatfs_format(struct lib9p_msg_Tstatfs *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tstatfs {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rstatfs_format(struct lib9p_msg_Rstatfs *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rstatfs {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " type=");
+ lib9p_super_magic_format(&self->type, state);
+ fmt_state_puts(state, " bsize=");
+ fmt_state_printf(state, "%"PRIu32, self->bsize);
+ fmt_state_puts(state, " blocks=");
+ fmt_state_printf(state, "%"PRIu64, self->blocks);
+ fmt_state_puts(state, " bfree=");
+ fmt_state_printf(state, "%"PRIu64, self->bfree);
+ fmt_state_puts(state, " bavail=");
+ fmt_state_printf(state, "%"PRIu64, self->bavail);
+ fmt_state_puts(state, " files=");
+ fmt_state_printf(state, "%"PRIu64, self->files);
+ fmt_state_puts(state, " ffree=");
+ fmt_state_printf(state, "%"PRIu64, self->ffree);
+ fmt_state_puts(state, " fsid=");
+ fmt_state_printf(state, "%"PRIu64, self->fsid);
+ fmt_state_puts(state, " namelen=");
+ fmt_state_printf(state, "%"PRIu32, self->namelen);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tlopen_format(struct lib9p_msg_Tlopen *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tlopen {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " flags=");
+ lib9p_lo_format(&self->flags, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rlopen_format(struct lib9p_msg_Rlopen *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rlopen {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " iounit=");
+ fmt_state_printf(state, "%"PRIu32, self->iounit);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tlcreate_format(struct lib9p_msg_Tlcreate *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tlcreate {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " flags=");
+ lib9p_lo_format(&self->flags, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_mode_format(&self->mode, state);
+ fmt_state_puts(state, " gid=");
+ lib9p_nuid_format(&self->gid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rlcreate_format(struct lib9p_msg_Rlcreate *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rlcreate {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " iounit=");
+ fmt_state_printf(state, "%"PRIu32, self->iounit);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tsymlink_format(struct lib9p_msg_Tsymlink *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tsymlink {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " symtgt=");
+ lib9p_s_format(&self->symtgt, state);
+ fmt_state_puts(state, " gid=");
+ lib9p_nuid_format(&self->gid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rsymlink_format(struct lib9p_msg_Rsymlink *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rsymlink {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tmknod_format(struct lib9p_msg_Tmknod *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tmknod {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " dfid=");
+ lib9p_fid_format(&self->dfid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_mode_format(&self->mode, state);
+ fmt_state_puts(state, " major=");
+ fmt_state_printf(state, "%"PRIu32, self->major);
+ fmt_state_puts(state, " minor=");
+ fmt_state_printf(state, "%"PRIu32, self->minor);
+ fmt_state_puts(state, " gid=");
+ lib9p_nuid_format(&self->gid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rmknod_format(struct lib9p_msg_Rmknod *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rmknod {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Trename_format(struct lib9p_msg_Trename *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Trename {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " dfid=");
+ lib9p_fid_format(&self->dfid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rrename_format(struct lib9p_msg_Rrename *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rrename {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Treadlink_format(struct lib9p_msg_Treadlink *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Treadlink {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rreadlink_format(struct lib9p_msg_Rreadlink *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rreadlink {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " target=");
+ lib9p_s_format(&self->target, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tgetattr_format(struct lib9p_msg_Tgetattr *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tgetattr {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " request_mask=");
+ lib9p_getattr_format(&self->request_mask, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rgetattr_format(struct lib9p_msg_Rgetattr *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rgetattr {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " valid=");
+ lib9p_getattr_format(&self->valid, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_mode_format(&self->mode, state);
+ fmt_state_puts(state, " uid=");
+ lib9p_nuid_format(&self->uid, state);
+ fmt_state_puts(state, " gid=");
+ lib9p_nuid_format(&self->gid, state);
+ fmt_state_puts(state, " nlink=");
+ fmt_state_printf(state, "%"PRIu64, self->nlink);
+ fmt_state_puts(state, " rdev=");
+ fmt_state_printf(state, "%"PRIu64, self->rdev);
+ fmt_state_puts(state, " filesize=");
+ fmt_state_printf(state, "%"PRIu64, self->filesize);
+ fmt_state_puts(state, " blksize=");
+ fmt_state_printf(state, "%"PRIu64, self->blksize);
+ fmt_state_puts(state, " blocks=");
+ fmt_state_printf(state, "%"PRIu64, self->blocks);
+ fmt_state_puts(state, " atime_sec=");
+ fmt_state_printf(state, "%"PRIu64, self->atime_sec);
+ fmt_state_puts(state, " atime_nsec=");
+ fmt_state_printf(state, "%"PRIu64, self->atime_nsec);
+ fmt_state_puts(state, " mtime_sec=");
+ fmt_state_printf(state, "%"PRIu64, self->mtime_sec);
+ fmt_state_puts(state, " mtime_nsec=");
+ fmt_state_printf(state, "%"PRIu64, self->mtime_nsec);
+ fmt_state_puts(state, " ctime_sec=");
+ fmt_state_printf(state, "%"PRIu64, self->ctime_sec);
+ fmt_state_puts(state, " ctime_nsec=");
+ fmt_state_printf(state, "%"PRIu64, self->ctime_nsec);
+ fmt_state_puts(state, " btime_sec=");
+ fmt_state_printf(state, "%"PRIu64, self->btime_sec);
+ fmt_state_puts(state, " btime_nsec=");
+ fmt_state_printf(state, "%"PRIu64, self->btime_nsec);
+ fmt_state_puts(state, " gen=");
+ fmt_state_printf(state, "%"PRIu64, self->gen);
+ fmt_state_puts(state, " data_version=");
+ fmt_state_printf(state, "%"PRIu64, self->data_version);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tsetattr_format(struct lib9p_msg_Tsetattr *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tsetattr {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " valid=");
+ lib9p_setattr_format(&self->valid, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_mode_format(&self->mode, state);
+ fmt_state_puts(state, " uid=");
+ lib9p_nuid_format(&self->uid, state);
+ fmt_state_puts(state, " gid=");
+ lib9p_nuid_format(&self->gid, state);
+ fmt_state_puts(state, " filesize=");
+ fmt_state_printf(state, "%"PRIu64, self->filesize);
+ fmt_state_puts(state, " atime_sec=");
+ fmt_state_printf(state, "%"PRIu64, self->atime_sec);
+ fmt_state_puts(state, " atime_nsec=");
+ fmt_state_printf(state, "%"PRIu64, self->atime_nsec);
+ fmt_state_puts(state, " mtime_sec=");
+ fmt_state_printf(state, "%"PRIu64, self->mtime_sec);
+ fmt_state_puts(state, " mtime_nsec=");
+ fmt_state_printf(state, "%"PRIu64, self->mtime_nsec);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rsetattr_format(struct lib9p_msg_Rsetattr *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rsetattr {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Txattrwalk_format(struct lib9p_msg_Txattrwalk *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Txattrwalk {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " newfid=");
+ lib9p_fid_format(&self->newfid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rxattrwalk_format(struct lib9p_msg_Rxattrwalk *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rxattrwalk {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " attr_size=");
+ fmt_state_printf(state, "%"PRIu64, self->attr_size);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Txattrcreate_format(struct lib9p_msg_Txattrcreate *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Txattrcreate {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " attr_size=");
+ fmt_state_printf(state, "%"PRIu64, self->attr_size);
+ fmt_state_puts(state, " flags=");
+ fmt_state_printf(state, "%"PRIu32, self->flags);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rxattrcreate_format(struct lib9p_msg_Rxattrcreate *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rxattrcreate {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Treaddir_format(struct lib9p_msg_Treaddir *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Treaddir {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " offset=");
+ fmt_state_printf(state, "%"PRIu64, self->offset);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rreaddir_format(struct lib9p_msg_Rreaddir *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rreaddir {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " data=<bytedata>");
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tfsync_format(struct lib9p_msg_Tfsync *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tfsync {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " datasync=");
+ lib9p_b4_format(&self->datasync, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rfsync_format(struct lib9p_msg_Rfsync *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rfsync {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tlock_format(struct lib9p_msg_Tlock *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tlock {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " type=");
+ lib9p_lock_type_format(&self->type, state);
+ fmt_state_puts(state, " flags=");
+ lib9p_lock_flags_format(&self->flags, state);
+ fmt_state_puts(state, " start=");
+ fmt_state_printf(state, "%"PRIu64, self->start);
+ fmt_state_puts(state, " length=");
+ fmt_state_printf(state, "%"PRIu64, self->length);
+ fmt_state_puts(state, " proc_id=");
+ fmt_state_printf(state, "%"PRIu32, self->proc_id);
+ fmt_state_puts(state, " client_id=");
+ lib9p_s_format(&self->client_id, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rlock_format(struct lib9p_msg_Rlock *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rlock {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " status=");
+ lib9p_lock_status_format(&self->status, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tgetlock_format(struct lib9p_msg_Tgetlock *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tgetlock {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " type=");
+ lib9p_lock_type_format(&self->type, state);
+ fmt_state_puts(state, " start=");
+ fmt_state_printf(state, "%"PRIu64, self->start);
+ fmt_state_puts(state, " length=");
+ fmt_state_printf(state, "%"PRIu64, self->length);
+ fmt_state_puts(state, " proc_id=");
+ fmt_state_printf(state, "%"PRIu32, self->proc_id);
+ fmt_state_puts(state, " client_id=");
+ lib9p_s_format(&self->client_id, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rgetlock_format(struct lib9p_msg_Rgetlock *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rgetlock {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " type=");
+ lib9p_lock_type_format(&self->type, state);
+ fmt_state_puts(state, " start=");
+ fmt_state_printf(state, "%"PRIu64, self->start);
+ fmt_state_puts(state, " length=");
+ fmt_state_printf(state, "%"PRIu64, self->length);
+ fmt_state_puts(state, " proc_id=");
+ fmt_state_printf(state, "%"PRIu32, self->proc_id);
+ fmt_state_puts(state, " client_id=");
+ lib9p_s_format(&self->client_id, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tlink_format(struct lib9p_msg_Tlink *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tlink {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " dfid=");
+ lib9p_fid_format(&self->dfid, state);
+ fmt_state_puts(state, " fid=");
+ lib9p_fid_format(&self->fid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rlink_format(struct lib9p_msg_Rlink *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rlink {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tmkdir_format(struct lib9p_msg_Tmkdir *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tmkdir {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " dfid=");
+ lib9p_fid_format(&self->dfid, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " mode=");
+ lib9p_mode_format(&self->mode, state);
+ fmt_state_puts(state, " gid=");
+ lib9p_nuid_format(&self->gid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rmkdir_format(struct lib9p_msg_Rmkdir *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rmkdir {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " qid=");
+ lib9p_qid_format(&self->qid, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Trenameat_format(struct lib9p_msg_Trenameat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Trenameat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " olddirfid=");
+ lib9p_fid_format(&self->olddirfid, state);
+ fmt_state_puts(state, " oldname=");
+ lib9p_s_format(&self->oldname, state);
+ fmt_state_puts(state, " newdirfid=");
+ lib9p_fid_format(&self->newdirfid, state);
+ fmt_state_puts(state, " newname=");
+ lib9p_s_format(&self->newname, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rrenameat_format(struct lib9p_msg_Rrenameat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rrenameat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tunlinkat_format(struct lib9p_msg_Tunlinkat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tunlinkat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " dirfd=");
+ lib9p_fid_format(&self->dirfd, state);
+ fmt_state_puts(state, " name=");
+ lib9p_s_format(&self->name, state);
+ fmt_state_puts(state, " flags=");
+ fmt_state_printf(state, "%"PRIu32, self->flags);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Runlinkat_format(struct lib9p_msg_Runlinkat *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Runlinkat {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+#endif /* CONFIG_9P_ENABLE_9P2000_L */
+#if CONFIG_9P_ENABLE_9P2000_e
+static void lib9p_msg_Tsession_format(struct lib9p_msg_Tsession *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tsession {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " key=");
+ fmt_state_printf(state, "%"PRIu64, self->key);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rsession_format(struct lib9p_msg_Rsession *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rsession {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tsread_format(struct lib9p_msg_Tsread *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tsread {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ fmt_state_printf(state, "%"PRIu32, self->fid);
+ fmt_state_puts(state, " nwname=");
+ fmt_state_printf(state, "%"PRIu16, self->nwname);
+ fmt_state_puts(state, " wname=[");
+ for (uint16_t i = 0; i < self->nwname; i++) {
+ if (i)
+ fmt_state_puts(state, ", ");
+ lib9p_s_format(&self->wname[i], state);
+ }
+ fmt_state_puts(state, " ]");
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rsread_format(struct lib9p_msg_Rsread *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rsread {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " data=<bytedata>");
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Tswrite_format(struct lib9p_msg_Tswrite *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Tswrite {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " fid=");
+ fmt_state_printf(state, "%"PRIu32, self->fid);
+ fmt_state_puts(state, " nwname=");
+ fmt_state_printf(state, "%"PRIu16, self->nwname);
+ fmt_state_puts(state, " wname=[");
+ for (uint16_t i = 0; i < self->nwname; i++) {
+ if (i)
+ fmt_state_puts(state, ", ");
+ lib9p_s_format(&self->wname[i], state);
+ }
+ fmt_state_puts(state, " ]");
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " data=<bytedata>");
+ fmt_state_puts(state, " }");
+}
+
+static void lib9p_msg_Rswrite_format(struct lib9p_msg_Rswrite *self, struct fmt_state *state) {
+ fmt_state_puts(state, "Rswrite {");
+ fmt_state_puts(state, " tag=");
+ lib9p_tag_format(&self->tag, state);
+ fmt_state_puts(state, " count=");
+ fmt_state_printf(state, "%"PRIu32, self->count);
+ fmt_state_puts(state, " }");
+}
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+
+/* tables.h *******************************************************************/
+
+const struct _lib9p_ver_tentry _lib9p_table_ver[LIB9P_VER_NUM] = {
+ [LIB9P_VER_unknown] = {.name="unknown", .min_msg_size=9},
+#if CONFIG_9P_ENABLE_9P2000
+ [LIB9P_VER_9P2000] = {.name="9P2000", .min_msg_size=9},
+#endif /* CONFIG_9P_ENABLE_9P2000 */
+#if CONFIG_9P_ENABLE_9P2000_L
+ [LIB9P_VER_9P2000_L] = {.name="9P2000.L", .min_msg_size=9},
+#endif /* CONFIG_9P_ENABLE_9P2000_L */
+#if CONFIG_9P_ENABLE_9P2000_e
+ [LIB9P_VER_9P2000_e] = {.name="9P2000.e", .min_msg_size=9},
+#endif /* CONFIG_9P_ENABLE_9P2000_e */
+#if CONFIG_9P_ENABLE_9P2000_p9p
+ [LIB9P_VER_9P2000_p9p] = {.name="9P2000.p9p", .min_msg_size=9},
+#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
+#if CONFIG_9P_ENABLE_9P2000_u
+ [LIB9P_VER_9P2000_u] = {.name="9P2000.u", .min_msg_size=13},
+#endif /* CONFIG_9P_ENABLE_9P2000_u */
+};
+
+#define _MSG(typ) [LIB9P_TYP_##typ] = { \
+ .name = #typ, \
+ .box_as_fmt_formatter = (_box_as_fmt_formatter_fn_t)lo_box_lib9p_msg_##typ##_as_fmt_formatter, \
+ }
+const struct _lib9p_msg_tentry _lib9p_table_msg[LIB9P_VER_NUM][0x100] = {
+ [LIB9P_VER_unknown] = {
+ _MSG(Tversion),
+ _MSG(Rversion),
+ _MSG(Rerror),
+ },
#if CONFIG_9P_ENABLE_9P2000
- [LIB9P_VER_9P2000] = 9,
+ [LIB9P_VER_9P2000] = {
+ _MSG(Tversion),
+ _MSG(Rversion),
+ _MSG(Tauth),
+ _MSG(Rauth),
+ _MSG(Tattach),
+ _MSG(Rattach),
+ _MSG(Rerror),
+ _MSG(Tflush),
+ _MSG(Rflush),
+ _MSG(Twalk),
+ _MSG(Rwalk),
+ _MSG(Topen),
+ _MSG(Ropen),
+ _MSG(Tcreate),
+ _MSG(Rcreate),
+ _MSG(Tread),
+ _MSG(Rread),
+ _MSG(Twrite),
+ _MSG(Rwrite),
+ _MSG(Tclunk),
+ _MSG(Rclunk),
+ _MSG(Tremove),
+ _MSG(Rremove),
+ _MSG(Tstat),
+ _MSG(Rstat),
+ _MSG(Twstat),
+ _MSG(Rwstat),
+ },
#endif /* CONFIG_9P_ENABLE_9P2000 */
#if CONFIG_9P_ENABLE_9P2000_L
- [LIB9P_VER_9P2000_L] = 9,
+ [LIB9P_VER_9P2000_L] = {
+ _MSG(Rlerror),
+ _MSG(Tstatfs),
+ _MSG(Rstatfs),
+ _MSG(Tlopen),
+ _MSG(Rlopen),
+ _MSG(Tlcreate),
+ _MSG(Rlcreate),
+ _MSG(Tsymlink),
+ _MSG(Rsymlink),
+ _MSG(Tmknod),
+ _MSG(Rmknod),
+ _MSG(Trename),
+ _MSG(Rrename),
+ _MSG(Treadlink),
+ _MSG(Rreadlink),
+ _MSG(Tgetattr),
+ _MSG(Rgetattr),
+ _MSG(Tsetattr),
+ _MSG(Rsetattr),
+ _MSG(Txattrwalk),
+ _MSG(Rxattrwalk),
+ _MSG(Txattrcreate),
+ _MSG(Rxattrcreate),
+ _MSG(Treaddir),
+ _MSG(Rreaddir),
+ _MSG(Tfsync),
+ _MSG(Rfsync),
+ _MSG(Tlock),
+ _MSG(Rlock),
+ _MSG(Tgetlock),
+ _MSG(Rgetlock),
+ _MSG(Tlink),
+ _MSG(Rlink),
+ _MSG(Tmkdir),
+ _MSG(Rmkdir),
+ _MSG(Trenameat),
+ _MSG(Rrenameat),
+ _MSG(Tunlinkat),
+ _MSG(Runlinkat),
+ _MSG(Tversion),
+ _MSG(Rversion),
+ _MSG(Tauth),
+ _MSG(Rauth),
+ _MSG(Tattach),
+ _MSG(Rattach),
+ _MSG(Rerror),
+ _MSG(Tflush),
+ _MSG(Rflush),
+ _MSG(Twalk),
+ _MSG(Rwalk),
+ _MSG(Tread),
+ _MSG(Rread),
+ _MSG(Twrite),
+ _MSG(Rwrite),
+ _MSG(Tclunk),
+ _MSG(Rclunk),
+ _MSG(Tremove),
+ _MSG(Rremove),
+ },
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
- [LIB9P_VER_9P2000_e] = 9,
+ [LIB9P_VER_9P2000_e] = {
+ _MSG(Tversion),
+ _MSG(Rversion),
+ _MSG(Tauth),
+ _MSG(Rauth),
+ _MSG(Tattach),
+ _MSG(Rattach),
+ _MSG(Rerror),
+ _MSG(Tflush),
+ _MSG(Rflush),
+ _MSG(Twalk),
+ _MSG(Rwalk),
+ _MSG(Topen),
+ _MSG(Ropen),
+ _MSG(Tcreate),
+ _MSG(Rcreate),
+ _MSG(Tread),
+ _MSG(Rread),
+ _MSG(Twrite),
+ _MSG(Rwrite),
+ _MSG(Tclunk),
+ _MSG(Rclunk),
+ _MSG(Tremove),
+ _MSG(Rremove),
+ _MSG(Tstat),
+ _MSG(Rstat),
+ _MSG(Twstat),
+ _MSG(Rwstat),
+ _MSG(Tsession),
+ _MSG(Rsession),
+ _MSG(Tsread),
+ _MSG(Rsread),
+ _MSG(Tswrite),
+ _MSG(Rswrite),
+ },
#endif /* CONFIG_9P_ENABLE_9P2000_e */
#if CONFIG_9P_ENABLE_9P2000_p9p
- [LIB9P_VER_9P2000_p9p] = 9,
+ [LIB9P_VER_9P2000_p9p] = {
+ _MSG(Topenfd),
+ _MSG(Ropenfd),
+ _MSG(Tversion),
+ _MSG(Rversion),
+ _MSG(Tauth),
+ _MSG(Rauth),
+ _MSG(Tattach),
+ _MSG(Rattach),
+ _MSG(Rerror),
+ _MSG(Tflush),
+ _MSG(Rflush),
+ _MSG(Twalk),
+ _MSG(Rwalk),
+ _MSG(Topen),
+ _MSG(Ropen),
+ _MSG(Tcreate),
+ _MSG(Rcreate),
+ _MSG(Tread),
+ _MSG(Rread),
+ _MSG(Twrite),
+ _MSG(Rwrite),
+ _MSG(Tclunk),
+ _MSG(Rclunk),
+ _MSG(Tremove),
+ _MSG(Rremove),
+ _MSG(Tstat),
+ _MSG(Rstat),
+ _MSG(Twstat),
+ _MSG(Rwstat),
+ },
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_u
- [LIB9P_VER_9P2000_u] = 13,
+ [LIB9P_VER_9P2000_u] = {
+ _MSG(Tversion),
+ _MSG(Rversion),
+ _MSG(Tauth),
+ _MSG(Rauth),
+ _MSG(Tattach),
+ _MSG(Rattach),
+ _MSG(Rerror),
+ _MSG(Tflush),
+ _MSG(Rflush),
+ _MSG(Twalk),
+ _MSG(Rwalk),
+ _MSG(Topen),
+ _MSG(Ropen),
+ _MSG(Tcreate),
+ _MSG(Rcreate),
+ _MSG(Tread),
+ _MSG(Rread),
+ _MSG(Twrite),
+ _MSG(Rwrite),
+ _MSG(Tclunk),
+ _MSG(Rclunk),
+ _MSG(Tremove),
+ _MSG(Rremove),
+ _MSG(Tstat),
+ _MSG(Rstat),
+ _MSG(Twstat),
+ _MSG(Rwstat),
+ },
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-#define _MSG_RECV(typ) [LIB9P_TYP_##typ/2] = { \
- .basesize = sizeof(struct lib9p_msg_##typ), \
- .validate = validate_##typ, \
- .unmarshal = (_unmarshal_fn_t)unmarshal_##typ, \
+#define _MSG_RECV(typ) [LIB9P_TYP_##typ/2] = { \
+ .validate = validate_##typ, \
+ .unmarshal = (_unmarshal_fn_t)unmarshal_##typ, \
}
-#define _MSG_SEND(typ) [LIB9P_TYP_##typ/2] = { \
- .marshal = (_marshal_fn_t)marshal_##typ, \
+#define _MSG_SEND(typ) [LIB9P_TYP_##typ/2] = { \
+ .marshal = (_marshal_fn_t)marshal_##typ, \
}
const struct _lib9p_recv_tentry _lib9p_table_Tmsg_recv[LIB9P_VER_NUM][0x80] = {
@@ -5161,12 +8026,12 @@ const struct _lib9p_send_tentry _lib9p_table_Rmsg_send[LIB9P_VER_NUM][0x80] = {
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-LM_FLATTEN bool _lib9p_stat_validate(struct _validate_ctx *ctx) {
- return validate_stat(ctx);
+LM_FLATTEN ssize_t _lib9p_stat_validate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, uint32_t *ret_net_size) {
+ return validate_stat(ctx, net_size, net_bytes, ret_net_size);
}
-LM_FLATTEN void _lib9p_stat_unmarshal(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) {
- unmarshal_stat(ctx, out);
+LM_FLATTEN void _lib9p_stat_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out) {
+ unmarshal_stat(ctx, net_bytes, out);
}
-LM_FLATTEN bool _lib9p_stat_marshal(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
- return marshal_stat(ctx, val);
+LM_FLATTEN bool _lib9p_stat_marshal(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _marshal_ret *ret) {
+ return marshal_stat(ctx, val, ret);
}