diff mbox series

[v3,15/38] tools/misc: don't include xg_save_restore.h from xen-mfndump.c

Message ID 20200823093519.18386-16-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series tools: move most libraries into tools/libs | expand

Commit Message

Jürgen Groß Aug. 23, 2020, 9:34 a.m. UTC
xen-mfndump.c is including the libxc private header xg_save_restore.h.
Avoid that by moving the definition of is_mapped() to xen-mfndump.c
(it is used there only) and by duplicating the definition of
M2P_SIZE() in xen-mfndump.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/libxc/xg_save_restore.h | 4 ----
 tools/misc/xen-mfndump.c      | 5 ++++-
 2 files changed, 4 insertions(+), 5 deletions(-)

Comments

Wei Liu Aug. 27, 2020, 10:37 a.m. UTC | #1
On Sun, Aug 23, 2020 at 11:34:56AM +0200, Juergen Gross wrote:
> xen-mfndump.c is including the libxc private header xg_save_restore.h.
> Avoid that by moving the definition of is_mapped() to xen-mfndump.c
> (it is used there only) and by duplicating the definition of
> M2P_SIZE() in xen-mfndump.c.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Wei Liu <wl@xen.org>
diff mbox series

Patch

diff --git a/tools/libxc/xg_save_restore.h b/tools/libxc/xg_save_restore.h
index 303081df0d..b904296997 100644
--- a/tools/libxc/xg_save_restore.h
+++ b/tools/libxc/xg_save_restore.h
@@ -109,10 +109,6 @@  static inline int get_platform_info(xc_interface *xch, uint32_t dom,
 #define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)
 #define M2P_CHUNKS(_m)  (M2P_SIZE((_m)) >> M2P_SHIFT)
 
-/* Returns TRUE if the PFN is currently mapped */
-#define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
-
-
 #define GET_FIELD(_p, _f, _w) (((_w) == 8) ? ((_p)->x64._f) : ((_p)->x32._f))
 
 #define SET_FIELD(_p, _f, _v, _w) do {          \
diff --git a/tools/misc/xen-mfndump.c b/tools/misc/xen-mfndump.c
index 858bd0e26b..cb15d08c7e 100644
--- a/tools/misc/xen-mfndump.c
+++ b/tools/misc/xen-mfndump.c
@@ -5,7 +5,10 @@ 
 #include <unistd.h>
 #include <inttypes.h>
 
-#include "xg_save_restore.h"
+#include <xen-tools/libs.h>
+
+#define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), 21)
+#define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
 
 static xc_interface *xch;