xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] tools/libxc: Fix domid parameter types
Date: Wed, 11 Oct 2017 12:01:22 +0100	[thread overview]
Message-ID: <20171011110122.h3aofwffvzmzo2ul@citrix.com> (raw)
In-Reply-To: <1507316400-5169-1-git-send-email-andrew.cooper3@citrix.com>

On Fri, Oct 06, 2017 at 08:00:00PM +0100, Andrew Cooper wrote:
> Mixed throughout libxc are uint32_t, int, and domid_t for domid parameters.
> With a signed type, and an explicitly 16-bit type, it is exceedingly difficult
> to construct an INVALID_DOMID constant which works with all of them.  (The
> main problem being that domid_t gets unconditionally zero extended when
> promoted to int for arithmatic.)
> 
> Libxl uses uint32_t consistently everywhere, so alter libxc to match.
> 

The following diff is required:


diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c
index 194bbdbc5d..6487672277 100644
--- a/tools/libxl/libxl_dom_save.c
+++ b/tools/libxl/libxl_dom_save.c
@@ -149,7 +149,7 @@ static void domain_suspend_switch_qemu_logdirty_done
 }
 
 void libxl__domain_suspend_common_switch_qemu_logdirty
-                               (int domid, unsigned enable, void *user)
+                               (uint32_t domid, unsigned enable, void *user)
 {
     libxl__save_helper_state *shs = user;
     libxl__egc *egc = shs->egc;
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index bcb6b0ae95..70a1e6e915 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3793,7 +3793,7 @@ void libxl__xc_domain_saverestore_async_callback_done(libxl__egc *egc,
 
 
 _hidden void libxl__domain_suspend_common_switch_qemu_logdirty
-                               (int domid, unsigned int enable, void *data);
+                               (uint32_t domid, unsigned int enable, void *data);
 _hidden void libxl__domain_common_switch_qemu_logdirty(libxl__egc *egc,
                                                int domid, unsigned enable,
                                                libxl__logdirty_switch *lds);
diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
index 3ae7373afc..cba7a30e4c 100755
--- a/tools/libxl/libxl_save_msgs_gen.pl
+++ b/tools/libxl/libxl_save_msgs_gen.pl
@@ -27,7 +27,7 @@ our @msgs = (
     [  4, 'srcxA',  "postcopy", [] ],
     [  5, 'srcxA',  "checkpoint", [] ],
     [  6, 'srcxA',  "wait_checkpoint", [] ],
-    [  7, 'scxA',   "switch_qemu_logdirty",  [qw(int domid
+    [  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'] ],

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

      parent reply	other threads:[~2017-10-11 11:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 19:00 [PATCH] tools/libxc: Fix domid parameter types Andrew Cooper
2017-10-09 14:47 ` Wei Liu
2017-10-09 14:51   ` Andrew Cooper
2017-10-09 15:19     ` Wei Liu
2017-10-09 15:38       ` Andrew Cooper
2017-10-11  9:51 ` Ian Jackson
2017-10-11  9:52   ` Andrew Cooper
2017-10-11 10:01     ` Wei Liu
2017-10-11 10:28       ` Ian Jackson
2017-10-11 10:32         ` Julien Grall
2017-10-11 11:01 ` Wei Liu [this message]

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=20171011110122.h3aofwffvzmzo2ul@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=xen-devel@lists.xen.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).