From nobody Mon Feb 9 18:45:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1619782133; cv=none; d=zohomail.com; s=zohoarc; b=Aw3kY/JGblMSAWJvWhMSVCpRMt6EkhiL+lZP3ZtUYYmcg5LbK7jmKDnb4KX8iC8JWHIuxgJe8kSb6tCnDqVCb/ij/EEbYNnl9xBmkdq3wfpg022tZVCP/BMN+YtLse3tg9Rflm57bNbhnlJn0sY/V6HRcffguMNPP5JWjXdWrcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619782133; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lnp+WrQocOTIU8q2/M5aPO+s4BOrKUHmUgPO0Lzti4I=; b=TbSQpo8mkzJTav+fGLbK/eqpvwBGk/uXPfIQdqlLRs6O9y8E2RXPeUzVE0Z1+PlYnaQFmQanvPbsrC9omeWj8dehfe4iTAaQUkw+v6S3SVECKc31+ZclJk9iuZi2sccYrQKTbT9UvC4+RxcyTEdjR/uUsyIeNf2+eTj9N0EwKnM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1619782133300939.6186886110376; Fri, 30 Apr 2021 04:28:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.120476.227874 (Exim 4.92) (envelope-from ) id 1lcRK3-0001F4-Qo; Fri, 30 Apr 2021 11:28:39 +0000 Received: by outflank-mailman (output) from mailman id 120476.227874; Fri, 30 Apr 2021 11:28:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lcRK3-0001Eu-N1; Fri, 30 Apr 2021 11:28:39 +0000 Received: by outflank-mailman (input) for mailman id 120476; Fri, 30 Apr 2021 11:28:38 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lcRK2-00011a-FB for xen-devel@lists.xenproject.org; Fri, 30 Apr 2021 11:28:38 +0000 Received: from mx.upb.ro (unknown [141.85.13.230]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bb8a72c0-9212-4ddc-9666-b8cc43055019; Fri, 30 Apr 2021 11:28:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mx.upb.ro (Postfix) with ESMTP id 1E14DB56011F; Fri, 30 Apr 2021 14:28:23 +0300 (EEST) Received: from mx.upb.ro ([127.0.0.1]) by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id bSylNCdeoEZB; Fri, 30 Apr 2021 14:28:20 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mx.upb.ro (Postfix) with ESMTP id 8E727B560118; Fri, 30 Apr 2021 14:28:20 +0300 (EEST) Received: from mx.upb.ro ([127.0.0.1]) by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9hLohrSlnp5b; Fri, 30 Apr 2021 14:28:20 +0300 (EEST) Received: from localhost.localdomain (unknown [188.25.174.245]) by mx.upb.ro (Postfix) with ESMTPSA id 0F0BAB560113; Fri, 30 Apr 2021 14:28:19 +0300 (EEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bb8a72c0-9212-4ddc-9666-b8cc43055019 X-Virus-Scanned: amavisd-new at upb.ro From: Costin Lupu To: xen-devel@lists.xenproject.org Cc: Christian Lindig , David Scott , Ian Jackson , Wei Liu Subject: [PATCH v2 5/5] tools/ocaml: Fix redefinition errors Date: Fri, 30 Apr 2021 14:28:11 +0300 Message-Id: <1a8ff6dcdd70fef83828dce47e79eb846860cbe8.1619781564.git.costin.lupu@cs.pub.ro> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 avo= id confusion between control domain page granularity (PAGE_* definitions) and guest domain page granularity (which is what we are dealing with here). Same issue applies for redefinitions of Val_none and Some_val macros which can be already defined in the OCaml system headers (e.g. /usr/lib/ocaml/caml/mlvalues.h). Signed-off-by: Costin Lupu --- tools/ocaml/libs/xc/xenctrl_stubs.c | 10 ++++------ tools/ocaml/libs/xentoollog/xentoollog_stubs.c | 4 ++++ tools/ocaml/libs/xl/xenlight_stubs.c | 4 ++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index d05d7bb30e..f9e33e599a 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -36,14 +36,12 @@ =20 #include "mmap_stubs.h" =20 -#define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) - #define _H(__h) ((xc_interface *)(__h)) #define _D(__d) ((uint32_t)Int_val(__d)) =20 +#ifndef Val_none #define Val_none (Val_int(0)) +#endif =20 #define string_of_option_array(array, index) \ ((Field(array, index) =3D=3D Val_none) ? NULL : String_val(Field(Field(ar= ray, index), 0))) @@ -818,7 +816,7 @@ CAMLprim value stub_xc_domain_memory_increase_reservati= on(value xch, CAMLparam3(xch, domid, mem_kb); int retval; =20 - unsigned long nr_extents =3D ((unsigned long)(Int64_val(mem_kb))) >> (PAG= E_SHIFT - 10); + unsigned long nr_extents =3D ((unsigned long)(Int64_val(mem_kb))) >> (XC_= PAGE_SHIFT - 10); =20 uint32_t c_domid =3D _D(domid); caml_enter_blocking_section(); @@ -924,7 +922,7 @@ CAMLprim value stub_pages_to_kib(value pages) { CAMLparam1(pages); =20 - CAMLreturn(caml_copy_int64(Int64_val(pages) << (PAGE_SHIFT - 10))); + CAMLreturn(caml_copy_int64(Int64_val(pages) << (XC_PAGE_SHIFT - 10))); } =20 =20 diff --git a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c b/tools/ocaml/l= ibs/xentoollog/xentoollog_stubs.c index bf64b211c2..e4306a0c2f 100644 --- a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c +++ b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c @@ -53,8 +53,12 @@ static char * dup_String_val(value s) #include "_xtl_levels.inc" =20 /* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/= ocaml-wrapping-c.php */ +#ifndef Val_none #define Val_none Val_int(0) +#endif +#ifndef Some_val #define Some_val(v) Field(v,0) +#endif =20 static value Val_some(value v) { diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xen= light_stubs.c index 352a00134d..45b8af61c7 100644 --- a/tools/ocaml/libs/xl/xenlight_stubs.c +++ b/tools/ocaml/libs/xl/xenlight_stubs.c @@ -227,8 +227,12 @@ static value Val_string_list(libxl_string_list *c_val) } =20 /* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/= ocaml-wrapping-c.php */ +#ifndef Val_none #define Val_none Val_int(0) +#endif +#ifndef Some_val #define Some_val(v) Field(v,0) +#endif =20 static value Val_some(value v) { --=20 2.20.1