diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-02 20:44:59 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-02 20:44:59 -0600 |
commit | ff88c4cc9bfdc91c3af390ab6a7588f5a8ade40a (patch) | |
tree | ae18e6d4576fa594be94e8278877fbdedfa1d4ba /lib9p/9p.generated.c | |
parent | 13b8cafb7e28784f037ecd24876c225ddcf48d76 (diff) | |
parent | 8cc87f8c1f25c9d3fec00561237891650a91b47a (diff) |
Diffstat (limited to 'lib9p/9p.generated.c')
-rw-r--r-- | lib9p/9p.generated.c | 2821 |
1 files changed, 2820 insertions, 1 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c index 49bab14..b58a485 100644 --- a/lib9p/9p.generated.c +++ b/lib9p/9p.generated.c @@ -13,6 +13,126 @@ #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 #define _is_ver_9P2000(v) (v == LIB9P_VER_9P2000) @@ -4521,6 +4641,2702 @@ static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val } #endif /* CONFIG_9P_ENABLE_9P2000_e */ +/* *_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, " }"); +} + +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] = { @@ -4542,7 +7358,10 @@ const struct _lib9p_ver_tentry _lib9p_table_ver[LIB9P_VER_NUM] = { #endif /* CONFIG_9P_ENABLE_9P2000_u */ }; -#define _MSG(typ) [LIB9P_TYP_##typ] = {.name=#typ} +#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), |