]> xenbits.xensource.com Git - xen.git/commitdiff
tools/libs: ROUNDUP() related adjustments
authorJan Beulich <jbeulich@suse.com>
Fri, 3 Sep 2021 13:10:24 +0000 (15:10 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 3 Sep 2021 13:10:24 +0000 (15:10 +0200)
For one xc_private.h needlessly repeats xen-tools/libs.h's definition.

And then there are two suspicious uses (resulting from the inconsistency
with the respective 2nd parameter of DIV_ROUNDUP()): While the one in
tools/console/daemon/io.c - as per the code comment - intentionally uses
8 as the second argument (meaning to align to a multiple of 256), the
one in alloc_magic_pages_hvm() pretty certainly does not: There the goal
is to align to a uint64_t boundary, for the following module struct to
end up aligned.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Jackson <iwj@xenproject.org>
tools/libs/ctrl/xc_private.h
tools/libs/guest/xg_dom_x86.c

index 3e299b943f1c5481b0ba891df10511794b7f7731..2e483590e68e916773a9df6b2e481957247445ba 100644 (file)
@@ -63,8 +63,6 @@ struct iovec {
 #include <sys/uio.h>
 #endif
 
-#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-
 #define DECLARE_DOMCTL struct xen_domctl domctl
 #define DECLARE_SYSCTL struct xen_sysctl sysctl
 #define DECLARE_PHYSDEV_OP struct physdev_op physdev_op
index d2eb89ce01256716b3fc6a885f6ced7f9b6d4dd9..b6e75afba22de0fffc25c9338a55d604a22d09d0 100644 (file)
@@ -678,7 +678,7 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
     {
         if ( dom->cmdline )
         {
-            dom->cmdline_size = ROUNDUP(strlen(dom->cmdline) + 1, 8);
+            dom->cmdline_size = ROUNDUP(strlen(dom->cmdline) + 1, 3);
             start_info_size += dom->cmdline_size;
         }
     }