From nobody Fri Dec 19 08:04:03 2025 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580135727449718.7311223466967; Mon, 27 Jan 2020 06:35:27 -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 1iw5TZ-0001UD-HF; Mon, 27 Jan 2020 14:34:53 +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 1iw5TX-0001Th-Qg for xen-devel@lists.xenproject.org; Mon, 27 Jan 2020 14:34:51 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2cd87208-4112-11ea-855c-12813bfff9fa; Mon, 27 Jan 2020 14:34:51 +0000 (UTC) X-Inumbo-ID: 2cd87208-4112-11ea-855c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580135692; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=pvpzhNbntIVWvF1ywdzId5/B1YA3CMsL8tn8OeeGOE8=; b=MC8CEH4J/zlHLjdEp73KW1VNubFIYQtnt8UtmtHVS2bKThHEJ0TelU+9 Z2Q6m9OPVoWhXxL3TD/2FIa0J84w6cnl0CC6P0/IfpdVjVSPW1UhTqNaF 7HX20pr5XlLbWieJRWETveMLTpKxLfLjol/MquTQz2lXlRXnj0zvtmbI+ s=; 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: MuAm13dT2XQpxDVZ8uqhfigYFsa5zZU2Y7hU1Pxuv3ZtY6UBjaodLU2rRhBnO9JAkyy5iHFtoW k1fKu2zpupGFBFj1wVFYRbdIzEGFUPzzdXyO9bqOs/Xpx6Bji6Y8pIZxpXsLt2IGkHJMcxzUB/ IN8bQQ+F2x/VZDLDMlKysVLi6mEISw+XgEDFQ32ku58VM06MVmwP5P3dTx3DLztw8wrpobieqc iC1oszGtKirtOfc/8QiAlmQFMaA2Y6tJ4Gq8+A5iwMeUIm5IhCTPAgZuxKIzmWOA7KQd6NYjsS 4zQ= X-SBRS: 2.7 X-MesageID: 11664971 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.70,370,1574139600"; d="scan'208";a="11664971" From: Andrew Cooper To: Xen-devel Date: Mon, 27 Jan 2020 14:34:29 +0000 Message-ID: <20200127143444.25538-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200127143444.25538-1-andrew.cooper3@citrix.com> References: <20200127143444.25538-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 02/17] tools/libxl: Simplify callback handling in libxl-save-helper 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) The {save,restore}_callback helpers can have their scope reduced vastly, and helper_setcallbacks_{save,restore}() doesn't need to use a ternary operator= to write 0 (meaning NULL) into an already zeroed structure. No functional change. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libxl/libxl_save_helper.c | 16 ++++++---------- tools/libxl/libxl_save_msgs_gen.pl | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helpe= r.c index 017c7cd988..65dff389bf 100644 --- a/tools/libxl/libxl_save_helper.c +++ b/tools/libxl/libxl_save_helper.c @@ -217,8 +217,6 @@ int helper_getreply(void *user) =20 /*----- other callbacks -----*/ =20 -static struct save_callbacks helper_save_callbacks; - static void startup(const char *op) { xtl_log(&logger,XTL_DEBUG,0,program,"starting %s",op); =20 @@ -234,8 +232,6 @@ static void complete(int retval) { exit(0); } =20 -static struct restore_callbacks helper_restore_callbacks; - int main(int argc, char **argv) { int r; @@ -247,6 +243,7 @@ int main(int argc, char **argv) assert(mode); =20 if (!strcmp(mode,"--save-domain")) { + static struct save_callbacks cb; =20 io_fd =3D atoi(NEXTARG); recv_fd =3D atoi(NEXTARG); @@ -256,16 +253,16 @@ int main(int argc, char **argv) xc_stream_type_t stream_type =3D strtoul(NEXTARG,0,10); assert(!*++argv); =20 - helper_setcallbacks_save(&helper_save_callbacks, cbflags); + helper_setcallbacks_save(&cb, cbflags); =20 startup("save"); setup_signals(save_signal_handler); =20 - r =3D xc_domain_save(xch, io_fd, dom, flags, &helper_save_callback= s, - stream_type, recv_fd); + r =3D xc_domain_save(xch, io_fd, dom, flags, &cb, stream_type, rec= v_fd); complete(r); =20 } else if (!strcmp(mode,"--restore-domain")) { + static struct restore_callbacks cb; =20 io_fd =3D atoi(NEXTARG); send_back_fd =3D atoi(NEXTARG); @@ -278,7 +275,7 @@ int main(int argc, char **argv) xc_stream_type_t stream_type =3D strtoul(NEXTARG,0,10); assert(!*++argv); =20 - helper_setcallbacks_restore(&helper_restore_callbacks, cbflags); + helper_setcallbacks_restore(&cb, cbflags); =20 unsigned long store_mfn =3D 0; unsigned long console_mfn =3D 0; @@ -288,8 +285,7 @@ int main(int argc, char **argv) =20 r =3D xc_domain_restore(xch, io_fd, dom, store_evtchn, &store_mfn, store_domid, console_evtchn, &console_mfn, - console_domid, stream_type, - &helper_restore_callbacks, send_back_fd); + console_domid, stream_type, &cb, send_back_f= d); helper_stub_restore_results(store_mfn,console_mfn,0); complete(r); =20 diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_ms= gs_gen.pl index 6f1d79f821..831a15e0bb 100755 --- a/tools/libxl/libxl_save_msgs_gen.pl +++ b/tools/libxl/libxl_save_msgs_gen.pl @@ -333,7 +333,7 @@ END_ALWAYS my $c_v =3D "(1u<<$msgnum)"; my $c_cb =3D "cbs->$name"; $f_more_sr->(" if ($c_cb) cbflags |=3D $c_v;\n", $enumcallbacks= ); - $f_more_sr->(" $c_cb =3D (cbflags & $c_v) ? ${encode}_${name} := 0;\n", + $f_more_sr->(" if (cbflags & $c_v) $c_cb =3D ${encode}_${name};= \n", $setcallbacks); } $f_more_sr->(" return 1;\n }\n\n"); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel