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

[xen staging] tools/libs: ROUNDUP() related adjustments



commit 5325b3eaf6a9d8600bf9e9e7428b5c336fd43c84
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Sep 3 15:10:24 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Sep 3 15:10:24 2021 +0200

    tools/libs: ROUNDUP() related adjustments
    
    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@xxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 tools/libs/ctrl/xc_private.h  | 2 --
 tools/libs/guest/xg_dom_x86.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/libs/ctrl/xc_private.h b/tools/libs/ctrl/xc_private.h
index 3e299b943f..2e483590e6 100644
--- a/tools/libs/ctrl/xc_private.h
+++ b/tools/libs/ctrl/xc_private.h
@@ -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
diff --git a/tools/libs/guest/xg_dom_x86.c b/tools/libs/guest/xg_dom_x86.c
index d2eb89ce01..b6e75afba2 100644
--- a/tools/libs/guest/xg_dom_x86.c
+++ b/tools/libs/guest/xg_dom_x86.c
@@ -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;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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