From e7f3db0679e5d37970a06f428208c3f5b51db5d2 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 18 Mar 2025 10:53:12 -0600 Subject: wip --- lib9p/protogen/c_marshal.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib9p/protogen/c_marshal.py') diff --git a/lib9p/protogen/c_marshal.py b/lib9p/protogen/c_marshal.py index 74b64f5..87ba50b 100644 --- a/lib9p/protogen/c_marshal.py +++ b/lib9p/protogen/c_marshal.py @@ -318,7 +318,14 @@ def gen_c_marshal(versions: set[str], typs: list[idl.UserType]) -> str: if path.root.typname == "stat": # SPECIAL (stat) ret += f"{'\t'*indent_lvl()}MARSHAL_BYTES(ctx, {path.c_str('val->')[:-3]}, {cnt_path.c_str('val->')});\n" else: - ret += f"{'\t'*indent_lvl()}MARSHAL_BYTES_ZEROCOPY(ctx, {path.c_str('val->')[:-3]}, {cnt_path.c_str('val->')});\n" + if ( + c9util.typename(child.typ, child) + == f"struct {c9util.ident("_iovec")}" + ): + ret += f"{'\t'*indent_lvl()}for (int iov_i = 0; iov_i < {path.c_str('val->')[:-3]}->iovcnt; iov_i++)\n" + ret += f"{'\t'*(indent_lvl()+1)}MARSHAL_BYTES_ZEROCOPY(ctx, {path.c_str('val->')[:-3]}->iov[iov_i].iov_base, {path.c_str('val->')[:-3]}->iov[iov_i].iov_len);\n" + else: + ret += f"{'\t'*indent_lvl()}MARSHAL_BYTES_ZEROCOPY(ctx, {path.c_str('val->')[:-3]}, {cnt_path.c_str('val->')});\n" return idlutil.WalkCmd.KEEP_GOING, pop loopvar = chr(ord("i") + loopdepth - 1) ret += f"{'\t'*indent_lvl()}for ({c9util.typename(child.cnt.typ)} {loopvar} = 0; {loopvar} < {cnt_path.c_str('val->')}; {loopvar}++) {{\n" -- cgit v1.2.3-2-g168b