xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>
Subject: [XEN PATCH 6/8] libxl: Export libxl__qmp_ev_qemu_compare_version
Date: Fri, 23 Apr 2021 17:15:56 +0100	[thread overview]
Message-ID: <20210423161558.224367-7-anthony.perard@citrix.com> (raw)
In-Reply-To: <20210423161558.224367-1-anthony.perard@citrix.com>

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 <anthony.perard@citrix.com>
---
 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 c6a4a187f5b0..c114f6d39960 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);
-- 
Anthony PERARD



  parent reply	other threads:[~2021-04-23 16:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 16:15 [XEN PATCH 0/8] Fix libxl with QEMU 6.0 + remove some more deprecated usages Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 1/8] libxl: Replace deprecated QMP command by "query-cpus-fast" Anthony PERARD
2021-04-28 16:53   ` Jason Andryuk
2021-05-10 14:11     ` Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 2/8] libxl: Replace QEMU's command line short-form boolean option Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 3/8] libxl: Replace deprecated "cpu-add" QMP command by "device_add" Anthony PERARD
2021-05-03 13:47   ` Jason Andryuk
2021-04-23 16:15 ` [XEN PATCH 4/8] libxl: Use -device for cd-rom drives Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 5/8] libxl: Assert qmp_ev's state in qmp_ev_qemu_compare_version Anthony PERARD
2021-04-23 16:15 ` Anthony PERARD [this message]
2021-04-23 16:15 ` [XEN PATCH 7/8] libxl: Use `id` with the "eject" QMP command Anthony PERARD
2021-04-23 16:15 ` [XEN PATCH 8/8] libxl: Replace QMP command "change" by "blockdev-change-media" Anthony PERARD
2021-05-03 14:13 ` [XEN PATCH 0/8] Fix libxl with QEMU 6.0 + remove some more deprecated usages Jason Andryuk
2021-05-10 14:17   ` Anthony PERARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210423161558.224367-7-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).