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

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



Hi Julien,

On 5/17/21 9:16 PM, Julien Grall wrote:
> Hi Costin,
> 
> On 10/05/2021 09:35, Costin Lupu wrote:
>> 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 (which is what we are dealing with here).
>>
>> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
>> ---
>>   tools/libs/gnttab/freebsd.c | 28 +++++++++++++---------------
>>   tools/libs/gnttab/linux.c   | 28 +++++++++++++---------------
>>   tools/libs/gnttab/netbsd.c  | 23 ++++++++++-------------
>>   3 files changed, 36 insertions(+), 43 deletions(-)
>>
>> diff --git a/tools/libs/gnttab/freebsd.c b/tools/libs/gnttab/freebsd.c
>> index 768af701c6..e42ac3fbf3 100644
>> --- a/tools/libs/gnttab/freebsd.c
>> +++ b/tools/libs/gnttab/freebsd.c
>> @@ -30,14 +30,11 @@
>>     #include <xen/sys/gntdev.h>
>>   +#include <xenctrl.h>
>>   #include <xen-tools/libs.h>
>>     #include "private.h"
>>   -#define PAGE_SHIFT           12
>> -#define PAGE_SIZE            (1UL << PAGE_SHIFT)
>> -#define PAGE_MASK            (~(PAGE_SIZE-1))
>> -
>>   #define DEVXEN "/dev/xen/gntdev"
>>     int osdep_gnttab_open(xengnttab_handle *xgt)
>> @@ -77,10 +74,11 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
>>       int domids_stride;
>>       unsigned int refs_size = ROUNDUP(count *
>>                                        sizeof(struct
>> ioctl_gntdev_grant_ref),
>> -                                     PAGE_SHIFT);
>> +                                     XC_PAGE_SHIFT);
>> +    int os_page_size = getpagesize();
> 
> Same remark as for patch #4. This at least want to be explained in the
> commit message.

Done.


Thanks,
Costin



 


Rackspace

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