From nobody Mon May 6 05:58:04 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1577454205; cv=none; d=zohomail.com; s=zohoarc; b=iMveCc0fsLMzgYs/l9MU8q/2Nz+ZN3O3wPe+m9WNur3YLa2KsPbSvGgvJ6zYu7m1WYqfUGLuxVKw8z7xJZexEY3s5EmBcPDwqB7DTbo4R8KEehGgVCAcEgpXC/iui7z2p3u9NvveOS1AncmdhJa9+A0dr3KAbYrJ1Hn5VKrk3p8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577454205; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=aT2s26coOQYm+49d5Bgg8/YseUiH8ZOjeveNKGEZRaE=; b=BmLB5NYa0gt5KDuJUaBvszERNS83xP0gENKBP7wwxS7PRS8dnbycENQYEIVK1yQF56wvqvsjS0DiWqjPU047AaeRitYqb/rGF2PzVq4b2TuOdpZzjifMVzSJIfHMkgkNr/qLb5HolJnTKy6p6EVxcQ1MXCHhgrlHRWo4Pf79q+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1577454205435143.61406210432642; Fri, 27 Dec 2019 05:43:25 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ikpt6-0003AL-2R; Fri, 27 Dec 2019 13:42:44 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ikpt4-0003AG-Mj for xen-devel@lists.xenproject.org; Fri, 27 Dec 2019 13:42:42 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c0b93876-28ae-11ea-9c08-12813bfff9fa; Fri, 27 Dec 2019 13:42:41 +0000 (UTC) X-Inumbo-ID: c0b93876-28ae-11ea-9c08-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1577454161; h=from:to:cc:subject:date:message-id:mime-version; bh=SrW7uG5mOIvJQxTTZgyE+7Erxi2kx5cJv8pzzuddk2s=; b=A2hWZmbxV1GjtxGJOgr9GnrfjSaLahU604daaS4dwmWJe3DM88bZIr5S bV3EELmYx3cLIRWnAjubrk9IvXpQZYZoOeNRAcX6K614EXZ1N0OLfo5I/ lqJwY9jv+VQgvJJ7qCUx27YmmKErvyrX6faTPoqTNtxrREGQZ6RdhvA6T 8=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: aNmjRBvUO3OkY1dqFm5xZb4z6uz3Xmy/kf51BsEHWGeYErKXqNXDAMK6aKcA5AK+gNDANRwRuY uJhdSPD8BmTgHUtfeOfvkIr0nB36maJnavBO/64iGX+fFWg56hJBhR7Svy0TV4owqeVudBwiI8 dY8uF57WkPxgy/iYsCQWKzl8P+zPfa3vRnbPDtqwMfVRSKuysgommHDxjqQKgUnOHuj5+soDGD 5opJuV+ouxDgiGCz7u9I2pc5VObC1mMOUqQ3onzhdHg0+C6QsjjuZhmHyTGqV+4yGerXwWGoLV K/I= X-SBRS: 2.7 X-MesageID: 10345413 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,363,1571716800"; d="scan'208";a="10345413" From: Andrew Cooper To: Xen-devel Date: Fri, 27 Dec 2019 13:42:37 +0000 Message-ID: <20191227134237.12530-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] tools/libxl: Code-gen improvements for libxl_save_msgs_gen.pl X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , Andrew Cooper , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) our @msgs() is an array of $msginfo's where the first element is a unique number. The $msgnum_used check ensures they are unique. Instead if specifying them explicitly, generate msgnum locally. This reduces the diff necessary to edit the middle of the @msgs() array. All other hunks are adjusting formatting in the generated C, to make it easier to follow. No change in behaviour of the generated C. Signed-off-by: Andrew Cooper Reviewed-by: Anthony PERARD --- CC: Ian Jackson CC: Wei Liu CC: Anthony Perard --- tools/libxl/libxl_save_msgs_gen.pl | 56 +++++++++++++++++++---------------= ---- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_ms= gs_gen.pl index cba7a30e4c..6f1d79f821 100755 --- a/tools/libxl/libxl_save_msgs_gen.pl +++ b/tools/libxl/libxl_save_msgs_gen.pl @@ -15,24 +15,24 @@ our @msgs =3D ( # and its null-ness needs to be passed through to the helper's= xc # W - needs a return value; callback is synchronous # A - needs a return value; callback is asynchronous - [ 1, 'sr', "log", [qw(uint32_t level - uint32_t errnoval - STRING context - STRING formatted)] ], - [ 2, 'sr', "progress", [qw(STRING context - STRING doing_what), - 'unsigned long', 'done', - 'unsigned long', 'total'] = ], - [ 3, 'srcxA', "suspend", [] ], - [ 4, 'srcxA', "postcopy", [] ], - [ 5, 'srcxA', "checkpoint", [] ], - [ 6, 'srcxA', "wait_checkpoint", [] ], - [ 7, 'scxA', "switch_qemu_logdirty", [qw(uint32_t domid - unsigned enable)] ], - [ 8, 'rcx', "restore_results", ['xen_pfn_t', 'store_gfn', - 'xen_pfn_t', 'console_gfn'] = ], - [ 9, 'srW', "complete", [qw(int retval - int errnoval)] ], + [ 'sr', "log", [qw(uint32_t level + uint32_t errnoval + STRING context + STRING formatted)] ], + [ 'sr', "progress", [qw(STRING context + STRING doing_what), + 'unsigned long', 'done', + 'unsigned long', 'total'] ], + [ 'srcxA', "suspend", [] ], + [ 'srcxA', "postcopy", [] ], + [ 'srcxA', "checkpoint", [] ], + [ 'srcxA', "wait_checkpoint", [] ], + [ 'scxA', "switch_qemu_logdirty", [qw(uint32_t domid + unsigned enable)] ], + [ 'rcx', "restore_results", ['xen_pfn_t', 'store_gfn', + 'xen_pfn_t', 'console_gfn'] ], + [ 'srW', "complete", [qw(int retval + int errnoval)] ], ); =20 #---------------------------------------- @@ -43,7 +43,7 @@ our %func_ah; our @outfuncs; our %out_decls; our %out_body; -our %msgnum_used; +our $msgnum =3D 0; =20 die unless @ARGV=3D=3D1; die if $ARGV[0] =3D~ m/^-/; @@ -123,7 +123,7 @@ static int bytes_get(const unsigned char **msg, void *result, int rlen) { if (endmsg - *msg < rlen) return 0; - memcpy(result,*msg,rlen); + memcpy(result, *msg, rlen); *msg +=3D rlen; return 1; } @@ -167,7 +167,7 @@ static int BLOCK_get(const unsigned char **msg, const unsigned char *const endmsg, const uint8_t **result, uint32_t *result_size) { - if (!uint32_t_get(msg,endmsg,result_size)) return 0; + if (!uint32_t_get(msg, endmsg, result_size)) return 0; if (endmsg - *msg < *result_size) return 0; *result =3D (const void*)*msg; *msg +=3D *result_size; @@ -180,7 +180,7 @@ static int STRING_get(const unsigned char **msg, { const uint8_t *data; uint32_t datalen; - if (!BLOCK_get(msg,endmsg,&data,&datalen)) return 0; + if (!BLOCK_get(msg, endmsg, &data, &datalen)) return 0; if (datalen =3D=3D 0) return 0; if (data[datalen-1] !=3D '\\0') return 0; *result =3D (const void*)data; @@ -228,7 +228,7 @@ foreach my $sr (qw(save restore)) { <(" const uint8_t *$arg;\n". " uint32_t ${arg}_size;\n"); } else { @@ -299,7 +299,7 @@ END_ALWAYS } $c_callback_args .=3D "$c_args, "; $c_recv.=3D - " if (!${typeid}_get(&msg,endmsg,$c_get_args)) return 0= ;\n"; + " if (!${typeid}_get(&msg, endmsg, $c_get_args)) return= 0;\n"; f_more("${encode}_$name", " ${typeid}_put(buf, &len, $c_args);\n"); } $f_more_sr->($c_recv); @@ -369,7 +369,7 @@ foreach my $sr (qw(save restore)) { f_more("${receiveds}_${sr}", " default:\n". " return 0;\n". - " }"); + " }\n"); $cbs{$sr} .=3D "} ".cbtype($sr).";\n\n"; if ($ch eq 'h') { print $cbs{$sr} or die $!; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel