[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/libxc: Fix domid parameter types



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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.