diff options
-rw-r--r-- | lib9p/core_gen/c_format.py | 3 | ||||
-rw-r--r-- | lib9p/core_generated.c | 12 | ||||
-rw-r--r-- | lib9p/tests/testclient-p9p.explog | 24 | ||||
-rw-r--r-- | lib9p/tests/testclient-sess.explog | 20 |
4 files changed, 32 insertions, 27 deletions
diff --git a/lib9p/core_gen/c_format.py b/lib9p/core_gen/c_format.py index 8c0cded..f9eee90 100644 --- a/lib9p/core_gen/c_format.py +++ b/lib9p/core_gen/c_format.py @@ -140,7 +140,8 @@ def gen_c_format(versions: set[str], typs: list[idl.UserType]) -> str: ret += f'\tfmt_state_puts(state, " {member.membname}=[");\n' ret += f"\tfor ({cnt_typ} i = 0; i < {cnt_str}; i++) {{\n" ret += "\t\tif (i)\n" - ret += '\t\t\tfmt_state_puts(state, ", ");\n' + ret += "\t\t\tfmt_state_putchar(state, ',');\n" + ret += "\t\tfmt_state_putchar(state, ' ');\n" if isinstance(member.typ, idl.Primitive): ret += f'\t\tfmt_state_printf(state, "%"PRIu{member.typ.static_size*8}, self->{member.membname}[i]);\n' else: diff --git a/lib9p/core_generated.c b/lib9p/core_generated.c index ee78bff..544e9cd 100644 --- a/lib9p/core_generated.c +++ b/lib9p/core_generated.c @@ -5198,7 +5198,8 @@ static void lib9p_msg_Twalk_format(struct lib9p_msg_Twalk *self, struct fmt_stat fmt_state_puts(state, " wname=["); for (uint16_t i = 0; i < self->nwname; i++) { if (i) - fmt_state_puts(state, ", "); + fmt_state_putchar(state, ','); + fmt_state_putchar(state, ' '); lib9p_s_format(&self->wname[i], state); } fmt_state_puts(state, " ]"); @@ -5214,7 +5215,8 @@ static void lib9p_msg_Rwalk_format(struct lib9p_msg_Rwalk *self, struct fmt_stat fmt_state_puts(state, " wqid=["); for (uint16_t i = 0; i < self->nwqid; i++) { if (i) - fmt_state_puts(state, ", "); + fmt_state_putchar(state, ','); + fmt_state_putchar(state, ' '); lib9p_qid_format(&self->wqid[i], state); } fmt_state_puts(state, " ]"); @@ -7341,7 +7343,8 @@ static void lib9p_msg_Tsread_format(struct lib9p_msg_Tsread *self, struct fmt_st fmt_state_puts(state, " wname=["); for (uint16_t i = 0; i < self->nwname; i++) { if (i) - fmt_state_puts(state, ", "); + fmt_state_putchar(state, ','); + fmt_state_putchar(state, ' '); lib9p_s_format(&self->wname[i], state); } fmt_state_puts(state, " ]"); @@ -7380,7 +7383,8 @@ static void lib9p_msg_Tswrite_format(struct lib9p_msg_Tswrite *self, struct fmt_ fmt_state_puts(state, " wname=["); for (uint16_t i = 0; i < self->nwname; i++) { if (i) - fmt_state_puts(state, ", "); + fmt_state_putchar(state, ','); + fmt_state_putchar(state, ' '); lib9p_s_format(&self->wname[i], state); } fmt_state_puts(state, " ]"); diff --git a/lib9p/tests/testclient-p9p.explog b/lib9p/tests/testclient-p9p.explog index 45651a4..4ba19b3 100644 --- a/lib9p/tests/testclient-p9p.explog +++ b/lib9p/tests/testclient-p9p.explog @@ -30,14 +30,14 @@ < Rerror { tag=0 errstr="authentication not required" errnum=95 } > Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["Documentation" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(DIR) vers=1 path=2 } ] } +> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "Documentation" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(DIR) vers=1 path=2 } ] } > Tstat { tag=0 fid=1 } < Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(DIR) vers=1 path=2 } file_mode=(DIR|0555) file_atime=1728337905 file_mtime=1728337904 file_size=0 file_name="Documentation" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } } > Tclunk { tag=0 fid=1 } < Rclunk { tag=0 } -> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["Documentation" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(DIR) vers=1 path=2 } ] } +> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "Documentation" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(DIR) vers=1 path=2 } ] } > Topen { tag=0 fid=1 mode=(MODE_READ) } < Ropen { tag=0 qid={ type=(DIR) vers=1 path=2 } iounit=0 } > Tread { tag=0 fid=1 offset=0 count=4096 } @@ -52,8 +52,8 @@ < Rerror { tag=0 errstr="authentication not required" errnum=95 } > Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["README.md" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=4 } ] } +> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "README.md" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=4 } ] } > Topen { tag=0 fid=1 mode=(MODE_READ) } < Ropen { tag=0 qid={ type=(0) vers=1 path=4 } iounit=0 } > Tread { tag=0 fid=1 offset=0 count=4096 } @@ -68,8 +68,8 @@ < Rerror { tag=0 errstr="authentication not required" errnum=95 } > Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=["Documentation", "x" ] } -< Rwalk { tag=0 nwqid=2 wqid=[{ type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] } +> Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=[ "Documentation", "x" ] } +< Rwalk { tag=0 nwqid=2 wqid=[ { type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] } > Topen { tag=0 fid=1 mode=(MODE_READ) } < Ropen { tag=0 qid={ type=(0) vers=1 path=3 } iounit=0 } > Tread { tag=0 fid=1 offset=0 count=4096 } @@ -84,8 +84,8 @@ < Rerror { tag=0 errstr="authentication not required" errnum=95 } > Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=["Documentation", "x" ] } -< Rwalk { tag=0 nwqid=2 wqid=[{ type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] } +> Twalk { tag=0 fid=0 newfid=1 nwname=2 wname=[ "Documentation", "x" ] } +< Rwalk { tag=0 nwqid=2 wqid=[ { type=(DIR) vers=1 path=2 }, { type=(0) vers=1 path=3 } ] } > Tstat { tag=0 fid=1 } < Rstat { tag=0 stat={ kern_type=0 kern_dev=0 file_qid={ type=(0) vers=1 path=3 } file_mode=(0444) file_atime=1728337905 file_mtime=1728337904 file_size=166 file_name="x" file_owner_uid="root" file_owner_gid="root" file_last_modified_uid="root" file_extension="" file_owner_n_uid=0 file_owner_n_gid=0 file_last_modified_n_uid=0 } } > Tclunk { tag=0 fid=1 } @@ -96,8 +96,8 @@ < Rerror { tag=0 errstr="authentication not required" errnum=95 } > Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["shutdown" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=5 } ] } +> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "shutdown" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=5 } ] } > Topen { tag=0 fid=1 mode=(TRUNC|MODE_WRITE) } < Ropen { tag=0 qid={ type=(0) vers=1 path=5 } iounit=0 } > Twrite { tag=0 fid=1 offset=0 count=2 data="1\n" } diff --git a/lib9p/tests/testclient-sess.explog b/lib9p/tests/testclient-sess.explog index 6aab242..aa5ecb8 100644 --- a/lib9p/tests/testclient-sess.explog +++ b/lib9p/tests/testclient-sess.explog @@ -18,10 +18,10 @@ < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } > Tattach { tag=0 fid=1 afid=NOFID uname="bob" aname="" n_uid=1001 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Twalk { tag=0 fid=0 newfid=2 nwname=1 wname=["whoami" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=8 } ] } -> Twalk { tag=0 fid=1 newfid=3 nwname=1 wname=["whoami" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=8 } ] } +> Twalk { tag=0 fid=0 newfid=2 nwname=1 wname=[ "whoami" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=8 } ] } +> Twalk { tag=0 fid=1 newfid=3 nwname=1 wname=[ "whoami" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=8 } ] } > Topen { tag=0 fid=2 mode=(MODE_READ) } < Ropen { tag=0 qid={ type=(0) vers=1 path=8 } iounit=0 } > Topen { tag=0 fid=3 mode=(MODE_READ) } @@ -38,8 +38,8 @@ < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } # flush, but original response comes back first -> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=["slowread" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=6 } ] } +> Twalk { tag=0 fid=0 newfid=1 nwname=1 wname=[ "slowread" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=6 } ] } > Topen { tag=0 fid=1 mode=(MODE_READ) } < Ropen { tag=0 qid={ type=(0) vers=1 path=6 } iounit=0 } > Tread { tag=1 fid=1 offset=0 count=6 } @@ -48,8 +48,8 @@ < Rflush { tag=2 } # flush, succeeds -> Twalk { tag=1 fid=0 newfid=2 nwname=1 wname=["slowread-flushable" ] } -< Rwalk { tag=1 nwqid=1 wqid=[{ type=(0) vers=1 path=7 } ] } +> Twalk { tag=1 fid=0 newfid=2 nwname=1 wname=[ "slowread-flushable" ] } +< Rwalk { tag=1 nwqid=1 wqid=[ { type=(0) vers=1 path=7 } ] } > Topen { tag=0 fid=2 mode=(MODE_READ) } < Ropen { tag=0 qid={ type=(0) vers=1 path=7 } iounit=0 } > Tread { tag=1 fid=2 offset=0 count=6 } @@ -66,8 +66,8 @@ < Rversion { tag=0 max_msg_size=4120 version="9P2000" } > Tattach { tag=0 fid=0 afid=NOFID uname="nobody" aname="" n_uid=0 } < Rattach { tag=0 qid={ type=(DIR) vers=1 path=1 } } -> Twalk { tag=0 fid=0 newfid=0 nwname=1 wname=["shutdown" ] } -< Rwalk { tag=0 nwqid=1 wqid=[{ type=(0) vers=1 path=5 } ] } +> Twalk { tag=0 fid=0 newfid=0 nwname=1 wname=[ "shutdown" ] } +< Rwalk { tag=0 nwqid=1 wqid=[ { type=(0) vers=1 path=5 } ] } > Topen { tag=0 fid=0 mode=(MODE_WRITE) } < Ropen { tag=0 qid={ type=(0) vers=1 path=5 } iounit=0 } > Twrite { tag=0 fid=0 offset=0 count=2 data="1\n" } |