From nobody Mon Feb 9 03:46:54 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; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1667921710; cv=none; d=zohomail.com; s=zohoarc; b=ErYE1iEYXh6gGKz4gwTpyh84rzu0fLACBNSvBqClrU8wR85FqgHjafsj5DVaVK422gXsSx5jntKwqmjdV94QFuJxcoD2cPoynJ210nSqrZ5U/WbAnIjxEvsZ8o1itWo1uOsY7Ju8Af8andHUXylUURLJIILvvDCqMwKV9ESDBrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667921710; h=Content-Type: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=2DMiqVDsHGgZUVpzyzyTfVaUJmx9jSbt0uuNbvuFNzM=; b=lvVv32evO1NbZ0GNFfUnBXtoLLr3hxoKeGZekuYnOecbNsoF7vfTneEkHhhry+i7u6VBiXW0qYMsvOTRJb3f17nDkrJYml1+2DnuYpY2iyjEf6DN2WxBRWYBZ/ZMqHu7kiLZ5qcvVCuzBN7rcsmfOjsnfIpC/2dhdbYsqRUFDXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1667921710626965.822145405737; Tue, 8 Nov 2022 07:35:10 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.440124.694223 (Exim 4.92) (envelope-from ) id 1osQch-0002hS-EC; Tue, 08 Nov 2022 15:34:47 +0000 Received: by outflank-mailman (output) from mailman id 440124.694223; Tue, 08 Nov 2022 15:34:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1osQch-0002gc-8p; Tue, 08 Nov 2022 15:34:47 +0000 Received: by outflank-mailman (input) for mailman id 440124; Tue, 08 Nov 2022 15:34:45 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1osQcf-0001RY-UK for xen-devel@lists.xenproject.org; Tue, 08 Nov 2022 15:34:45 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id dea3d7d7-5f7a-11ed-91b5-6bf2151ebd3b; Tue, 08 Nov 2022 16:34:44 +0100 (CET) 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: dea3d7d7-5f7a-11ed-91b5-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1667921684; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=15Hgb+sdjhnccr4MqijiUOJ5Qs+Ch7oxO+EvADCJqio=; b=WRHD33tLaxdZpcMyw14p5Y07FIyljOBgqRa+zRGCsf5WGPeYiVR3OxiY J0LxnKadRNLGztmi9VCKkD3djdr2mTQLk1173EALzs2comeZh4y5Gx5wi fq+OhBRpZAvSDVx8fkzJsjvJsNodUG70b9c5qG+0RacwmPYgt9XwUANPZ M=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: None X-MesageID: 83996682 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:mkHlkaMkoFRuu6PvrR2pl8FynXyQoLVcMsEvi/4bfWQNrUoj0mBRz GsXCDuHM/6OYDejc493b4i09h4C7J+BzN5nSAto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQA+KmU4YoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvzrRC9H5qyo4mpB5gxmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0s9RAEVl+ eIjEi8qQTOd2+Tr2+uwUuY506zPLOGzVG8eknRpzDWfBvc6W5HTBa7N4Le03h9p2JoIR6yHI ZNEN3w/N3wsYDUWUrsTIJ8yguauwGX4aTpbgFmUubA28y7YywkZPL3FYIGEK4LUFZ89ckCwp HDeoG6oEw0mE92t5DuZ9Wy3h9HRtHauMG4VPOLhraM76LGJ/UQMDDUGWF39puO24mauVtQaJ 0EK9y4Gqakp6FftXtT7Rwe/onOPolgbQdU4O8037hucjJXd5QmxD3IBCDVGbbQOuMYoSBQw2 1SOntevAiZg2IB5UlrEqO3S92nrf3FIcylSPkfoUDfp/fHKhoAXpR7Rdex8N4GWkIHzRCqpy CiF+X1Wa6ooseYH0KCy/Fbiij2qp4TUQgNd2jg7Tl5J/SsiOtf7OtXABUzzqK8Zcd3HFgXpU G0swZD20QwYMX2aeMVhqs0pFarh2fuKOSa0bbVHT8h4rGTFF5JOkOltDNBCyKVBaJhsldzBO hW7VeZtCHh7bROXgVdfOd7ZNijT5fGI+BSMfqm8giBySpZwbhSb2ypleFSd2Wvg+GB1z/9ga cvFKJ70VyhKYUiC8NZRb75DuYLHOwhknT+DLXwF50jPPUWiiI69Fu5ebQrmghER56KYugTFm +uzxOPToyiykYTWPEHqzGLkBQlbcCdhXsuu+5U/myzqClMOJVzNwsT5mdsJE7GJVYwO/gsU1 hlRgnNl9Wc= IronPort-HdrOrdr: A9a23:4uIkDaiJIUIvYGmCAsI09W+H7XBQXuIji2hC6mlwRA09TySZ// rBoB19726MtN9xYgBHpTnuAsm9qB/nmaKdpLNhWItKPzOW31dATrsSjrcKqgeIc0aVm9K1l5 0QF5SWYOeAdWSS5vya3ODXKbkdKaG8gcKVuds= X-IronPort-AV: E=Sophos;i="5.96,148,1665460800"; d="scan'208";a="83996682" From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= To: CC: Henry Wang , =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , Christian Lindig , David Scott , Wei Liu , Anthony PERARD Subject: [PATCH for-4.17 v3 02/15] tools/ocaml/libs/xc: OCaml 5.0 compatibility Date: Tue, 8 Nov 2022 15:33:54 +0000 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1667921710882100007 Follow the manual to avoid naked pointers: https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head No functional change, except on OCaml 5.0 where it is a bugfix. Signed-off-by: Edwin T=C3=B6r=C3=B6k Acked-by: Christian Lindig --- Reason for inclusion in 4.17: - bugfix for upcoming OCaml 5.0 compiler (already in beta) Changes since v2: - add Acked-by line --- tools/ocaml/libs/mmap/mmap_stubs.h | 5 +++++ tools/ocaml/libs/xc/xenctrl_stubs.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/ocaml/libs/mmap/mmap_stubs.h b/tools/ocaml/libs/mmap/mma= p_stubs.h index 65e4239890..5c65cc86fb 100644 --- a/tools/ocaml/libs/mmap/mmap_stubs.h +++ b/tools/ocaml/libs/mmap/mmap_stubs.h @@ -30,4 +30,9 @@ struct mmap_interface int len; }; =20 +/* for compatibility with OCaml 4.02.3 */ +#ifndef Data_abstract_val +#define Data_abstract_val(v) ((void*) Op_val(v)) +#endif + #endif diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index a8789d19be..8cd11060ec 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -37,7 +37,7 @@ =20 #include "mmap_stubs.h" =20 -#define _H(__h) ((xc_interface *)(__h)) +#define _H(__h) *((xc_interface **) Data_abstract_val(__h)) #define _D(__d) ((uint32_t)Int_val(__d)) =20 #ifndef Val_none @@ -70,14 +70,15 @@ static void Noreturn failwith_xc(xc_interface *xch) CAMLprim value stub_xc_interface_open(void) { CAMLparam0(); - xc_interface *xch; + CAMLlocal1(result); =20 + result =3D caml_alloc(1, Abstract_tag); /* Don't assert XC_OPENFLAG_NON_REENTRANT because these bindings * do not prevent re-entrancy to libxc */ - xch =3D xc_interface_open(NULL, NULL, 0); - if (xch =3D=3D NULL) + _H(result) =3D xc_interface_open(NULL, NULL, 0); + if (_H(result) =3D=3D NULL) failwith_xc(NULL); - CAMLreturn((value)xch); + CAMLreturn(result); } =20 =20 --=20 2.34.1