tools/libs/foreignmemory: Fix PAGE_SIZE redefinition error
authorCostin Lupu <costin.lupu@cs.pub.ro>
Tue, 8 Jun 2021 12:35:27 +0000 (15:35 +0300)
committerJulien Grall <jgrall@amazon.com>
Fri, 9 Jul 2021 15:00:02 +0000 (16:00 +0100)
commit0dbb4be739c50b8018aeeb285ef290bf7962a28e
tree8d61acf6ff0ac1c96a88f03c3251cbb030115877
parentd276e0f3f14f2d46f27989008770eb2b9c678bc4
tools/libs/foreignmemory: Fix PAGE_SIZE redefinition error

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
patch replaces usage of PAGE_* macros with XC_PAGE_* macros in order to avoid
confusion between control domain page granularity (PAGE_* definitions) and
guest domain page granularity.

The exception is in osdep_xenforeignmemory_map() where we need the system page
size to check whether the PFN array should be allocated with mmap() or with
dynamic allocation.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Acked-by: Ian Jackson <iwj@xenproject.org>
tools/libs/foreignmemory/core.c
tools/libs/foreignmemory/freebsd.c
tools/libs/foreignmemory/linux.c
tools/libs/foreignmemory/minios.c
tools/libs/foreignmemory/netbsd.c
tools/libs/foreignmemory/private.h