diff mbox series

[4/5] tools/libs/gnttab: Fix PAGE_SIZE redefinition error

Message ID bd1e79d7dade6dc6a8d89b1d0e96d47be6b2d315.1619524463.git.costin.lupu@cs.pub.ro (mailing list archive)
State Superseded
Headers show
Series Fix redefinition errors for toolstack libs | expand

Commit Message

Costin Lupu April 27, 2021, 12:05 p.m. UTC
If PAGE_SIZE is already defined in the system (e.g. in
/usr/include/limits.h header) then gcc will trigger a redefinition error
because of -Werror. This commit also protects PAGE_SHIFT and PAGE_MASK
definitions for keeping consistency.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
 tools/libs/gnttab/linux.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series


diff --git a/tools/libs/gnttab/linux.c b/tools/libs/gnttab/linux.c
index 74331a4c7b..e12f2697a5 100644
--- a/tools/libs/gnttab/linux.c
+++ b/tools/libs/gnttab/linux.c
@@ -36,9 +36,15 @@ 
 #include "private.h"
+#ifndef PAGE_SHIFT
 #define PAGE_SHIFT           12
+#ifndef PAGE_SIZE
 #define PAGE_SIZE            (1UL << PAGE_SHIFT)
+#ifndef PAGE_MASK
 #define PAGE_MASK            (~(PAGE_SIZE-1))
 #define DEVXEN "/dev/xen/"