xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: Julien Grall <julien@xen.org>, xen-devel@lists.xenproject.org
Cc: Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v3 4/5] tools/libs/gnttab: Fix PAGE_SIZE redefinition error
Date: Tue, 8 Jun 2021 15:37:51 +0300	[thread overview]
Message-ID: <61c4ad59-641a-f169-180b-7aeac1fc4a0b@cs.pub.ro> (raw)
In-Reply-To: <5603464e-2ef5-9358-d039-cfb1f93340d3@xen.org>

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@cs.pub.ro>
>> ---
>>   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


  reply	other threads:[~2021-06-08 12:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  8:35 [PATCH v3 0/5] Fix redefinition errors for toolstack libs Costin Lupu
2021-05-10  8:35 ` [PATCH v3 1/5] tools/debugger: Fix PAGE_SIZE redefinition error Costin Lupu
2021-05-11  6:35   ` Tim Deegan
2021-05-10  8:35 ` [PATCH v3 2/5] tools/libfsimage: Fix PATH_MAX " Costin Lupu
2021-05-10  8:35 ` [PATCH v3 3/5] tools/libs/foreignmemory: Fix PAGE_SIZE " Costin Lupu
2021-05-17 18:12   ` Julien Grall
2021-06-08 12:37     ` Costin Lupu
2021-05-10  8:35 ` [PATCH v3 4/5] tools/libs/gnttab: " Costin Lupu
2021-05-17 18:16   ` Julien Grall
2021-06-08 12:37     ` Costin Lupu [this message]
2021-05-10  8:35 ` [PATCH v3 5/5] tools/ocaml: Fix redefinition errors Costin Lupu
2021-05-17 18:16   ` Julien Grall
2021-05-19 14:03     ` Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61c4ad59-641a-f169-180b-7aeac1fc4a0b@cs.pub.ro \
    --to=costin.lupu@cs.pub.ro \
    --cc=iwj@xenproject.org \
    --cc=julien@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).