From: Denis Mukhin <dmukhin@ford.com>
Move xc_bitops.h to common tools location to be shared between
the toolstack and unit test code.
Adjust the guard in xen-tools/bitops.h
Correct the #include directives and comments referring to the old
xc_bitops.h in the toolstack code.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
Changes since v16:
- dropped unneeded includes
- added Anthony's A-b
---
.../ctrl/xc_bitops.h => include/xen-tools/bitops.h} | 6 +++---
tools/libs/ctrl/xc_misc.c | 13 +++++++------
tools/libs/guest/xg_dom_elfloader.c | 1 -
tools/libs/guest/xg_dom_hvmloader.c | 1 -
tools/libs/guest/xg_private.h | 2 +-
tools/libs/guest/xg_sr_common.h | 2 --
6 files changed, 11 insertions(+), 14 deletions(-)
rename tools/{libs/ctrl/xc_bitops.h => include/xen-tools/bitops.h} (95%)
diff --git a/tools/libs/ctrl/xc_bitops.h b/tools/include/xen-tools/bitops.h
similarity index 95%
rename from tools/libs/ctrl/xc_bitops.h
rename to tools/include/xen-tools/bitops.h
index 4a776dc3a57f..681482f6759f 100644
--- a/tools/libs/ctrl/xc_bitops.h
+++ b/tools/include/xen-tools/bitops.h
@@ -1,5 +1,5 @@
-#ifndef XC_BITOPS_H
-#define XC_BITOPS_H 1
+#ifndef __XEN_TOOLS_BITOPS_H__
+#define __XEN_TOOLS_BITOPS_H__
/* bitmap operations for single threaded access */
@@ -81,4 +81,4 @@ static inline void bitmap_or(void *_dst, const void *_other,
dst[i] |= other[i];
}
-#endif /* XC_BITOPS_H */
+#endif /* __XEN_TOOLS_BITOPS_H__ */
diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 33e87bac2868..10ddf85667a9 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -17,8 +17,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*/
-#include "xc_bitops.h"
#include "xc_private.h"
+#include <xen-tools/bitops.h>
#include <xen/hvm/hvm_op.h>
int xc_get_max_cpus(xc_interface *xch)
@@ -94,11 +94,12 @@ xc_cpumap_t xc_cpumap_alloc(xc_interface *xch)
}
/*
- * xc_bitops.h has macros that do this as well - however they assume that
- * the bitmask is word aligned but xc_cpumap_t is only guaranteed to be
- * byte aligned and so we need byte versions for architectures which do
- * not support misaligned accesses (which is basically everyone
- * but x86, although even on x86 it can be inefficient).
+ * <xen-tools/bitops.h> has macros that do this as well - however they
+ * assume that the bitmask is word aligned but xc_cpumap_t is only
+ * guaranteed to be byte aligned and so we need byte versions for
+ * architectures which do not support misaligned accesses (which is
+ * basically everyone but x86, although even on x86 it can be
+ * inefficient).
*
* NOTE: The xc_bitops macros now use byte alignment.
* TODO: Clean up the users of this interface.
diff --git a/tools/libs/guest/xg_dom_elfloader.c b/tools/libs/guest/xg_dom_elfloader.c
index f17930d98bf7..a55b5e8c3caf 100644
--- a/tools/libs/guest/xg_dom_elfloader.c
+++ b/tools/libs/guest/xg_dom_elfloader.c
@@ -26,7 +26,6 @@
#include <inttypes.h>
#include "xg_private.h"
-#include "xc_bitops.h"
#define XEN_VER "xen-3.0"
diff --git a/tools/libs/guest/xg_dom_hvmloader.c b/tools/libs/guest/xg_dom_hvmloader.c
index 39e1e5f579a7..a98c7fe5d877 100644
--- a/tools/libs/guest/xg_dom_hvmloader.c
+++ b/tools/libs/guest/xg_dom_hvmloader.c
@@ -25,7 +25,6 @@
#include <assert.h>
#include "xg_private.h"
-#include "xc_bitops.h"
/* ------------------------------------------------------------------------ */
/* parse elf binary */
diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h
index d73947094f2e..285229cf82a3 100644
--- a/tools/libs/guest/xg_private.h
+++ b/tools/libs/guest/xg_private.h
@@ -28,9 +28,9 @@
#include <sys/stat.h>
#include "xc_private.h"
-#include "xc_bitops.h"
#include "xenguest.h"
+#include <xen-tools/bitops.h>
#include <xen/memory.h>
#include <xen/elfnote.h>
#include <xen/libelf/libelf.h>
diff --git a/tools/libs/guest/xg_sr_common.h b/tools/libs/guest/xg_sr_common.h
index 2f058ee3a6ff..0e419c3a96a0 100644
--- a/tools/libs/guest/xg_sr_common.h
+++ b/tools/libs/guest/xg_sr_common.h
@@ -5,8 +5,6 @@
#include "xg_private.h"
#include "xg_save_restore.h"
-#include "xc_bitops.h"
-
#include "xg_sr_stream_format.h"
/* String representation of Domain Header types. */
--
2.51.0
© 2016 - 2025 Red Hat, Inc.