diff mbox

tools/libxc: Fix domid parameter types

Message ID 20171011110122.h3aofwffvzmzo2ul@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Oct. 11, 2017, 11:01 a.m. UTC
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 mbox

Patch

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'] ],