From nobody Mon Feb 9 21:22:17 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531747492249905.4194142964641; Mon, 16 Jul 2018 06:24:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9358B30820DC; Mon, 16 Jul 2018 13:24:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56E34600C9; Mon, 16 Jul 2018 13:24:50 +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 DBB101853DA2; Mon, 16 Jul 2018 13:24:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6GDOXt3028009 for ; Mon, 16 Jul 2018 09:24:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id CF9BF2026D76; Mon, 16 Jul 2018 13:24:33 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05CBB202704B; Mon, 16 Jul 2018 13:24:32 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Mon, 16 Jul 2018 14:23:53 +0100 Message-Id: <20180716132423.10354-8-berrange@redhat.com> In-Reply-To: <20180716132423.10354-1-berrange@redhat.com> References: <20180716132423.10354-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [go PATCH 07/37] network: move wrapper functions out of compat 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-Type: text/plain; charset="utf-8" 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 16 Jul 2018 13:24:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Daniel P. Berrang=C3=A9 --- network.go | 1 + network_compat.h | 10 ------- network_events_wrapper.go | 10 +++++++ network_events_wrapper.h | 8 ++++++ network_compat.go =3D> network_wrapper.go | 11 +------- network_wrapper.h | 37 +++++++++++++++++++++++++ 6 files changed, 57 insertions(+), 20 deletions(-) rename network_compat.go =3D> network_wrapper.go (86%) create mode 100644 network_wrapper.h diff --git a/network.go b/network.go index fe54bf1..26bf24e 100644 --- a/network.go +++ b/network.go @@ -32,6 +32,7 @@ package libvirt #include #include #include "network_compat.h" +#include "network_wrapper.h" */ import "C" =20 diff --git a/network_compat.h b/network_compat.h index 97c8ad5..08f0778 100644 --- a/network_compat.h +++ b/network_compat.h @@ -56,9 +56,6 @@ typedef void (*virConnectNetworkEventGenericCallback)(vir= ConnectPtr conn, void *opaque); #endif =20 -int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn, - int callbackID); - =20 /* 1.2.5 */ =20 @@ -86,11 +83,4 @@ struct _virNetworkDHCPLease { }; #endif =20 -void virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease); - -int virNetworkGetDHCPLeasesWrapper(virNetworkPtr network, - const char *mac, - virNetworkDHCPLeasePtr **leases, - unsigned int flags); - #endif /* LIBVIRT_GO_NETWORK_COMPAT_H__ */ diff --git a/network_events_wrapper.go b/network_events_wrapper.go index ea892cf..27bf555 100644 --- a/network_events_wrapper.go +++ b/network_events_wrapper.go @@ -54,5 +54,15 @@ int virConnectNetworkEventRegisterAnyWrapper(virConnectP= tr c, virNetworkPtr d, #endif } =20 +int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn, + int callbackID) +{ +#if LIBVIR_VERSION_NUMBER < 1002001 + assert(0); // Caller should have checked version +#else + return virConnectNetworkEventDeregisterAny(conn, callbackID); +#endif +} + */ import "C" diff --git a/network_events_wrapper.h b/network_events_wrapper.h index 1b73369..8388467 100644 --- a/network_events_wrapper.h +++ b/network_events_wrapper.h @@ -34,5 +34,13 @@ int virConnectNetworkEventRegisterAnyWrapper(virConnectP= tr c, virNetworkPtr d, int eventID, virConnectNetworkEve= ntGenericCallback cb, long goCallbackId); =20 +int virConnectNetworkEventRegisterAnyWrapper(virConnectPtr c, + virNetworkPtr d, + int eventID, + virConnectNetworkEventGeneric= Callback cb, + long goCallbackId); +int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn, + int callbackID); + =20 #endif /* LIBVIRT_GO_NETWORK_EVENTS_WRAPPER_H__ */ diff --git a/network_compat.go b/network_wrapper.go similarity index 86% rename from network_compat.go rename to network_wrapper.go index 56e9749..bd58754 100644 --- a/network_compat.go +++ b/network_wrapper.go @@ -31,16 +31,7 @@ package libvirt #include #include #include "network_compat.h" - -int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn, - int callbackID) -{ -#if LIBVIR_VERSION_NUMBER < 1002001 - assert(0); // Caller should have checked version -#else - return virConnectNetworkEventDeregisterAny(conn, callbackID); -#endif -} +#include "network_wrapper.h" =20 void virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease) { diff --git a/network_wrapper.h b/network_wrapper.h new file mode 100644 index 0000000..762fe3b --- /dev/null +++ b/network_wrapper.h @@ -0,0 +1,37 @@ +/* + * This file is part of the libvirt-go project + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL= THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + * + * Copyright (c) 2013 Alex Zorin + * Copyright (C) 2016 Red Hat, Inc. + * + */ + +#ifndef LIBVIRT_GO_NETWORK_WRAPPER_H__ +#define LIBVIRT_GO_NETWORK_WRAPPER_H__ + +void virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease); + +int virNetworkGetDHCPLeasesWrapper(virNetworkPtr network, + const char *mac, + virNetworkDHCPLeasePtr **leases, + unsigned int flags); + +#endif /* LIBVIRT_GO_NETWORK_WRAPPER_H__ */ --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list