From nobody Sun Feb 8 07:08:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1567500200; cv=none; d=zoho.com; s=zohoarc; b=XA4JwUejecSOh/jRzHBRnfSJUmw3tc+P1uIzKvTg2FUUrbU+ZVTVFDqHg5AWNAqT1w1/akLdW3Atu/Eyzx72ZpzJkuEIPhvPKCMVylEXHT197AblSLnCHaacpaehLGD6lGDGRKvpI5v2EpuGe5KOEai7sAfc4+zL17wVkqvE+K4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567500200; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7GmiQVmG0dYyCFasOrCmWliPuIYCu0Zg+kmUNHf7bMI=; b=np73JZoFDkl60fi9ae4H4T/2HSTI5vWDx+XQS0Tr4cV24B1lamPkcZHwy7HVnw/WZ8jNkQ7RD5jxfdU2EW/UkqenGsNbriX4cn4ww3eShklz+5AQ6eprTYSIUc26Eao4gIbBgpcpNPYEmxdDOYSUsnmSwUqpPoj5OOJRG7M5AE4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1567500200966242.4211057697354; Tue, 3 Sep 2019 01:43:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C902D3082126; Tue, 3 Sep 2019 08:43:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A195960C63; Tue, 3 Sep 2019 08:43:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5A73E2551E; Tue, 3 Sep 2019 08:43:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x838hEBO030024 for ; Tue, 3 Sep 2019 04:43:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id A6ACA5D704; Tue, 3 Sep 2019 08:43:14 +0000 (UTC) Received: from lindworm.usersys.redhat.com (unknown [10.43.2.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4BFE5D6B7; Tue, 3 Sep 2019 08:43:13 +0000 (UTC) From: Pino Toscano To: libvir-list@redhat.com Date: Tue, 3 Sep 2019 10:43:02 +0200 Message-Id: <20190903084306.32520-3-ptoscano@redhat.com> In-Reply-To: <20190903084306.32520-1-ptoscano@redhat.com> References: <20190903084306.32520-1-ptoscano@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [ocaml PATCH 2/6] Turn libvirt_c.h as proper header X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 03 Sep 2019 08:43:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" - make sure that all the function declarations are non-static, so the header can be included by more than one C source - move all the common includes there from the generated file from generator.pl - add include guard for it, even if it will not be used in practice Signed-off-by: Pino Toscano --- libvirt/generator.pl | 17 ---------- libvirt/libvirt_c.h | 60 ++++++++++++++++++++++++------------ libvirt/libvirt_c_epilogue.c | 38 +++++++++++------------ 3 files changed, 60 insertions(+), 55 deletions(-) diff --git a/libvirt/generator.pl b/libvirt/generator.pl index 92d5a64..61526c0 100755 --- a/libvirt/generator.pl +++ b/libvirt/generator.pl @@ -232,23 +232,6 @@ print F <<'END'; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130= 1 USA */ =20 -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "libvirt_c.h" =20 #include "libvirt_c_oneoffs.c" diff --git a/libvirt/libvirt_c.h b/libvirt/libvirt_c.h index 8533618..541d8e3 100644 --- a/libvirt/libvirt_c.h +++ b/libvirt/libvirt_c.h @@ -18,18 +18,38 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130= 1 USA */ =20 +#ifndef LIBVIRT_C_H +#define LIBVIRT_C_H + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + /* Please read libvirt/README file. */ =20 -static const char *Optstring_val (value strv); +const char *Optstring_val (value strv); typedef value (*Val_ptr_t) (void *); -static value Val_opt (void *ptr, Val_ptr_t Val_ptr); +value Val_opt (void *ptr, Val_ptr_t Val_ptr); typedef value (*Val_const_ptr_t) (const void *); -static value Val_opt_const (const void *ptr, Val_const_ptr_t Val_ptr); -/*static value option_default (value option, value deflt);*/ -static void _raise_virterror (const char *fn) Noreturn; -static value Val_virterror (virErrorPtr err); -static int _list_length (value listv); -static value Val_virconnectcredential (const virConnectCredentialPtr cred); +value Val_opt_const (const void *ptr, Val_const_ptr_t Val_ptr); +/*value option_default (value option, value deflt);*/ +void _raise_virterror (const char *fn) Noreturn; +value Val_virterror (virErrorPtr err); +int _list_length (value listv); +value Val_virconnectcredential (const virConnectCredentialPtr cred); =20 /* Use this around synchronous libvirt API calls to release the OCaml * lock, allowing other threads to run simultaneously. 'code' must not @@ -106,12 +126,12 @@ static value Val_virconnectcredential (const virConne= ctCredentialPtr cred); #define Sec_val(rv) (*((virSecretPtr *)Data_custom_val(rv))) =20 /* Wrap up a pointer to something in a custom block. */ -static value Val_connect (virConnectPtr conn); -static value Val_dom (virDomainPtr dom); -static value Val_net (virNetworkPtr net); -static value Val_pol (virStoragePoolPtr pool); -static value Val_vol (virStorageVolPtr vol); -static value Val_sec (virSecretPtr sec); +value Val_connect (virConnectPtr conn); +value Val_dom (virDomainPtr dom); +value Val_net (virNetworkPtr net); +value Val_pol (virStoragePoolPtr pool); +value Val_vol (virStorageVolPtr vol); +value Val_sec (virSecretPtr sec); =20 /* Domains and networks are stored as pairs (dom/net, conn), so have * some convenience functions for unwrapping and wrapping them. @@ -127,8 +147,10 @@ static value Val_sec (virSecretPtr sec); #define Connect_volv(rv) (Connect_val(Field((rv),1))) #define Connect_secv(rv) (Connect_val(Field((rv),1))) =20 -static value Val_domain (virDomainPtr dom, value connv); -static value Val_network (virNetworkPtr net, value connv); -static value Val_pool (virStoragePoolPtr pol, value connv); -static value Val_volume (virStorageVolPtr vol, value connv); -static value Val_secret (virSecretPtr sec, value connv); +value Val_domain (virDomainPtr dom, value connv); +value Val_network (virNetworkPtr net, value connv); +value Val_pool (virStoragePoolPtr pol, value connv); +value Val_volume (virStorageVolPtr vol, value connv); +value Val_secret (virSecretPtr sec, value connv); + +#endif diff --git a/libvirt/libvirt_c_epilogue.c b/libvirt/libvirt_c_epilogue.c index 37efc43..e58f7bb 100644 --- a/libvirt/libvirt_c_epilogue.c +++ b/libvirt/libvirt_c_epilogue.c @@ -20,7 +20,7 @@ =20 /* Please read libvirt/README file. */ =20 -static const char * +const char * Optstring_val (value strv) { if (strv =3D=3D Val_int (0)) /* None */ @@ -29,7 +29,7 @@ Optstring_val (value strv) return String_val (Field (strv, 0)); } =20 -static value +value Val_opt (void *ptr, Val_ptr_t Val_ptr) { CAMLparam0 (); @@ -45,7 +45,7 @@ Val_opt (void *ptr, Val_ptr_t Val_ptr) CAMLreturn (optv); } =20 -static value +value Val_opt_const (const void *ptr, Val_const_ptr_t Val_ptr) { CAMLparam0 (); @@ -62,7 +62,7 @@ Val_opt_const (const void *ptr, Val_const_ptr_t Val_ptr) } =20 #if 0 -static value +value option_default (value option, value deflt) { if (option =3D=3D Val_int (0)) /* "None" */ @@ -72,7 +72,7 @@ option_default (value option, value deflt) } #endif =20 -static void +void _raise_virterror (const char *fn) { CAMLparam0 (); @@ -100,7 +100,7 @@ _raise_virterror (const char *fn) (void) caml__frame; } =20 -static int +int _list_length (value listv) { CAMLparam1 (listv); @@ -111,7 +111,7 @@ _list_length (value listv) CAMLreturnT (int, len); } =20 -static value +value Val_virconnectcredential (const virConnectCredentialPtr cred) { CAMLparam0 (); @@ -196,7 +196,7 @@ Val_err_level (virErrorLevel code) } =20 /* Convert a virterror to a value. */ -static value +value Val_virterror (virErrorPtr err) { CAMLparam0 (); @@ -283,7 +283,7 @@ static struct custom_operations sec_custom_operations = =3D { custom_deserialize_default }; =20 -static value +value Val_connect (virConnectPtr conn) { CAMLparam0 (); @@ -294,7 +294,7 @@ Val_connect (virConnectPtr conn) CAMLreturn (rv); } =20 -static value +value Val_dom (virDomainPtr dom) { CAMLparam0 (); @@ -305,7 +305,7 @@ Val_dom (virDomainPtr dom) CAMLreturn (rv); } =20 -static value +value Val_net (virNetworkPtr net) { CAMLparam0 (); @@ -316,7 +316,7 @@ Val_net (virNetworkPtr net) CAMLreturn (rv); } =20 -static value +value Val_pol (virStoragePoolPtr pol) { CAMLparam0 (); @@ -327,7 +327,7 @@ Val_pol (virStoragePoolPtr pol) CAMLreturn (rv); } =20 -static value +value Val_vol (virStorageVolPtr vol) { CAMLparam0 (); @@ -338,7 +338,7 @@ Val_vol (virStorageVolPtr vol) CAMLreturn (rv); } =20 -static value +value Val_sec (virSecretPtr sec) { CAMLparam0 (); @@ -350,7 +350,7 @@ Val_sec (virSecretPtr sec) } =20 /* This wraps up the (dom, conn) pair (Domain.t). */ -static value +value Val_domain (virDomainPtr dom, value connv) { CAMLparam1 (connv); @@ -364,7 +364,7 @@ Val_domain (virDomainPtr dom, value connv) } =20 /* This wraps up the (net, conn) pair (Network.t). */ -static value +value Val_network (virNetworkPtr net, value connv) { CAMLparam1 (connv); @@ -378,7 +378,7 @@ Val_network (virNetworkPtr net, value connv) } =20 /* This wraps up the (pol, conn) pair (Pool.t). */ -static value +value Val_pool (virStoragePoolPtr pol, value connv) { CAMLparam1 (connv); @@ -392,7 +392,7 @@ Val_pool (virStoragePoolPtr pol, value connv) } =20 /* This wraps up the (vol, conn) pair (Volume.t). */ -static value +value Val_volume (virStorageVolPtr vol, value connv) { CAMLparam1 (connv); @@ -406,7 +406,7 @@ Val_volume (virStorageVolPtr vol, value connv) } =20 /* This wraps up the (sec, conn) pair (Secret.t). */ -static value +value Val_secret (virSecretPtr sec, value connv) { CAMLparam1 (connv); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list