From nobody Sun Feb 8 14:52:04 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.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; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495381048278586.2204551106299; Sun, 21 May 2017 08:37:28 -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 6170780C1D; Sun, 21 May 2017 15:37:26 +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 2BE4818967; Sun, 21 May 2017 15:37:26 +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 9A6281800C8D; Sun, 21 May 2017 15:37:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4LFamF8031322 for ; Sun, 21 May 2017 11:36:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C024179DA; Sun, 21 May 2017 15:36:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-18.phx2.redhat.com [10.3.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C05FF5DC1D for ; Sun, 21 May 2017 15:36:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6170780C1D Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6170780C1D From: John Ferlan To: libvir-list@redhat.com Date: Sun, 21 May 2017 11:36:45 -0400 Message-Id: <20170521153645.32172-1-jferlan@redhat.com> In-Reply-To: <20170425223656.20740-1-jferlan@redhat.com> References: <20170425223656.20740-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/08] interface: Introduce virInterfaceObjEndAPI 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: , MIME-Version: 1.0 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.26]); Sun, 21 May 2017 15:37:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For now it'll just call the virInterfaceObjUnlock, but a future adjustment will do something different. The virInterfaceObjUnlock is now private to virinterfaceobj.c with a short term forward reference. Additionally, make virInterfaceObjLock private since it's only used in virinterfaceobj anyway. For now this will involved creating a forward reference, but this will go away soon too. Signed-off-by: John Ferlan --- src/conf/virinterfaceobj.c | 17 +++++++++++++++-- src/conf/virinterfaceobj.h | 9 +++------ src/libvirt_private.syms | 3 +-- src/test/test_driver.c | 15 +++++++-------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index 1e3f25c..8f839b3 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -44,6 +44,9 @@ struct _virInterfaceObjList { virInterfaceObjPtr *objs; }; =20 +static void +virInterfaceObjLock(virInterfaceObjPtr obj); + /* virInterfaceObj manipulation */ =20 static virInterfaceObjPtr @@ -67,14 +70,14 @@ virInterfaceObjNew(void) } =20 =20 -void +static void virInterfaceObjLock(virInterfaceObjPtr obj) { virMutexLock(&obj->lock); } =20 =20 -void +static void virInterfaceObjUnlock(virInterfaceObjPtr obj) { virMutexUnlock(&obj->lock); @@ -82,6 +85,16 @@ virInterfaceObjUnlock(virInterfaceObjPtr obj) =20 =20 void +virInterfaceObjEndAPI(virInterfaceObjPtr *obj) +{ + if (!*obj) + return; + + virInterfaceObjUnlock(*obj); +} + + +void virInterfaceObjFree(virInterfaceObjPtr obj) { if (!obj) diff --git a/src/conf/virinterfaceobj.h b/src/conf/virinterfaceobj.h index 3934e63..2b9e1b2 100644 --- a/src/conf/virinterfaceobj.h +++ b/src/conf/virinterfaceobj.h @@ -28,6 +28,9 @@ typedef virInterfaceObj *virInterfaceObjPtr; typedef struct _virInterfaceObjList virInterfaceObjList; typedef virInterfaceObjList *virInterfaceObjListPtr; =20 +void +virInterfaceObjEndAPI(virInterfaceObjPtr *obj); + virInterfaceDefPtr virInterfaceObjGetDef(virInterfaceObjPtr obj); =20 @@ -68,12 +71,6 @@ void virInterfaceObjListRemove(virInterfaceObjListPtr interfaces, virInterfaceObjPtr obj); =20 -void -virInterfaceObjLock(virInterfaceObjPtr obj); - -void -virInterfaceObjUnlock(virInterfaceObjPtr obj); - typedef bool (*virInterfaceObjListFilter)(virConnectPtr conn, virInterfaceDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index aa6f351..364b32e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -910,6 +910,7 @@ virDomainObjListRename; =20 =20 # conf/virinterfaceobj.h +virInterfaceObjEndAPI; virInterfaceObjGetDef; virInterfaceObjIsActive; virInterfaceObjListAssignDef; @@ -921,9 +922,7 @@ virInterfaceObjListGetNames; virInterfaceObjListNew; virInterfaceObjListNumOfInterfaces; virInterfaceObjListRemove; -virInterfaceObjLock; virInterfaceObjSetActive; -virInterfaceObjUnlock; =20 =20 # conf/virnetworkobj.h diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ac16f4f..fb95319 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1027,7 +1027,7 @@ testParseInterfaces(testDriverPtr privconn, } =20 virInterfaceObjSetActive(obj, true); - virInterfaceObjUnlock(obj); + virInterfaceObjEndAPI(&obj); } =20 ret =3D 0; @@ -3718,7 +3718,7 @@ testInterfaceLookupByName(virConnectPtr conn, =20 ret =3D virGetInterface(conn, def->name, def->mac); =20 - virInterfaceObjUnlock(obj); + virInterfaceObjEndAPI(&obj); return ret; } =20 @@ -3769,7 +3769,7 @@ testInterfaceIsActive(virInterfacePtr iface) =20 ret =3D virInterfaceObjIsActive(obj); =20 - virInterfaceObjUnlock(obj); + virInterfaceObjEndAPI(&obj); return ret; } =20 @@ -3881,7 +3881,7 @@ testInterfaceGetXMLDesc(virInterfacePtr iface, =20 ret =3D virInterfaceDefFormat(def); =20 - virInterfaceObjUnlock(obj); + virInterfaceObjEndAPI(&obj); return ret; } =20 @@ -3912,8 +3912,7 @@ testInterfaceDefineXML(virConnectPtr conn, =20 cleanup: virInterfaceDefFree(def); - if (obj) - virInterfaceObjUnlock(obj); + virInterfaceObjEndAPI(&obj); testDriverUnlock(privconn); return ret; } @@ -3956,7 +3955,7 @@ testInterfaceCreate(virInterfacePtr iface, ret =3D 0; =20 cleanup: - virInterfaceObjUnlock(obj); + virInterfaceObjEndAPI(&obj); return ret; } =20 @@ -3983,7 +3982,7 @@ testInterfaceDestroy(virInterfacePtr iface, ret =3D 0; =20 cleanup: - virInterfaceObjUnlock(obj); + virInterfaceObjEndAPI(&obj); return ret; } =20 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list