From patchwork Tue May 11 09:28:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 12250311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 547C1C433B4 for ; Tue, 11 May 2021 09:28:45 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 093DA613C0 for ; Tue, 11 May 2021 09:28:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 093DA613C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.125666.236570 (Exim 4.92) (envelope-from ) id 1lgOgw-0005cZ-CW; Tue, 11 May 2021 09:28:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 125666.236570; Tue, 11 May 2021 09:28:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgOgw-0005cJ-8c; Tue, 11 May 2021 09:28:38 +0000 Received: by outflank-mailman (input) for mailman id 125666; Tue, 11 May 2021 09:28:36 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lgOgu-0003CS-QI for xen-devel@lists.xenproject.org; Tue, 11 May 2021 09:28:36 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4fd96fab-119e-4fd6-83c6-13902c1a4a75; Tue, 11 May 2021 09:28:21 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4fd96fab-119e-4fd6-83c6-13902c1a4a75 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1620725301; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5TXGPQaxHF3c+AxwdM2mzDWq6ZbvGPMF7pL7COPhMao=; b=F32S+JuxxduiyLWGxIjSgs3qZSInsnhqdubCEFjQMSLvzqzxQTtE/VsN +Qr7ZiK6h0g4PcPhudIBPtLBSm8WFiLo4RLn0pNp6LZ24e1EN5x0nvxlM yYhFFPqfcZLTCb42Vf4oiS+KGBgBFEfbTPnQzJiOhRbqnyRVfxxCFphnu g=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: HBhO1fWqAGziFPHWeyyUFF6jO7hf3HQe7A7T3q1IOe5SWxgUYYsyfYQx8zTSe7sywaO2gPQLDe YbU1yPtxsAaSA6T1D8AQKQE0jors2PYumZf4MrgWGppL+DKe6h1TdEquiqKuuKAwqwqMyHCjcn 8ng/0YIQsU7gXOkY6y+YmfTFKkj3TYbZmyPubVGEQUQxWKZPvyJLKp9WDIWAWri09uxlswYpIp UiNneZeJ/9tFCLeFiL0AKR6FGEaaNW137sR7GnnX3ZR+wNVnUAnhjTMBEv5kwL/u3wR41KuMf7 tfI= X-SBRS: 5.1 X-MesageID: 43313593 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:Jknn4q8tSUR0/Rfqx8duk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re+sjztCWE8Ar5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtFD4bbLbGSS4/yU3ODBKadD/OW6 X-IronPort-AV: E=Sophos;i="5.82,290,1613451600"; d="scan'208";a="43313593" From: Anthony PERARD To: CC: Anthony PERARD , Jason Andryuk , Ian Jackson , Wei Liu Subject: [XEN PATCH v2 6/8] libxl: Export libxl__qmp_ev_qemu_compare_version Date: Tue, 11 May 2021 10:28:08 +0100 Message-ID: <20210511092810.13759-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511092810.13759-1-anthony.perard@citrix.com> References: <20210511092810.13759-1-anthony.perard@citrix.com> MIME-Version: 1.0 We are going to want to check QEMU's version in other places where we can use libxl__ev_qmp_send. Signed-off-by: Anthony PERARD Reviewed-by: Jason Andryuk --- tools/libs/light/libxl_internal.h | 8 ++++++++ tools/libs/light/libxl_qmp.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h index 44a2f3c8fe3b..0b4671318c82 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h @@ -492,6 +492,14 @@ _hidden int libxl__ev_qmp_send(libxl__egc *egc, libxl__ev_qmp *ev, const char *cmd, libxl__json_object *args); _hidden void libxl__ev_qmp_dispose(libxl__gc *gc, libxl__ev_qmp *ev); +/* return values: + * < 0 if qemu's version < asked version + * = 0 if qemu's version == asked version + * > 0 if qemu's version > asked version + */ +_hidden int libxl__qmp_ev_qemu_compare_version(libxl__ev_qmp *ev, int major, + int minor, int micro); + typedef enum { /* initial state */ qmp_state_disconnected = 1, diff --git a/tools/libs/light/libxl_qmp.c b/tools/libs/light/libxl_qmp.c index d0967c9f029f..fb146a54cb9c 100644 --- a/tools/libs/light/libxl_qmp.c +++ b/tools/libs/light/libxl_qmp.c @@ -289,7 +289,7 @@ static int qmp_handle_response(libxl__gc *gc, libxl__qmp_handler *qmp, * = 0 if qemu's version == asked version * > 0 if qemu's version > asked version */ -static int qmp_ev_qemu_compare_version(libxl__ev_qmp *ev, int major, +int libxl__qmp_ev_qemu_compare_version(libxl__ev_qmp *ev, int major, int minor, int micro) { assert(ev->state == qmp_state_connected); @@ -1073,7 +1073,7 @@ static void dm_state_save_to_fdset(libxl__egc *egc, libxl__ev_qmp *ev, int fdset /* The `live` parameter was added to QEMU 2.11. It signals QEMU that * the save operation is for a live migration rather than for taking a * snapshot. */ - if (qmp_ev_qemu_compare_version(ev, 2, 11, 0) >= 0) + if (libxl__qmp_ev_qemu_compare_version(ev, 2, 11, 0) >= 0) libxl__qmp_param_add_bool(gc, &args, "live", dsps->live); QMP_PARAMETERS_SPRINTF(&args, "filename", "/dev/fdset/%d", fdset); rc = libxl__ev_qmp_send(egc, ev, "xen-save-devices-state", args);