From nobody Sat Feb 7 08:58:41 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 149614103591091.90795644140769; Tue, 30 May 2017 03:43:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5AAA44E34C; Tue, 30 May 2017 10:43:53 +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 236CD5DC1F; Tue, 30 May 2017 10:43:52 +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 9CC894A48C; Tue, 30 May 2017 10:43:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UAhmQ2027487 for ; Tue, 30 May 2017 06:43:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id EEB92171BB; Tue, 30 May 2017 10:43:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-108.phx2.redhat.com [10.3.116.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9F8D5C542 for ; Tue, 30 May 2017 10:43:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5AAA44E34C Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.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 5AAA44E34C From: John Ferlan To: libvir-list@redhat.com Date: Tue, 30 May 2017 06:43:36 -0400 Message-Id: <20170530104344.25015-2-jferlan@redhat.com> In-Reply-To: <20170530104344.25015-1-jferlan@redhat.com> References: <20170530104344.25015-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 1/9] interface: Consistently use 'obj' for a virInterfaceObjPtr 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 30 May 2017 10:43:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Alter variable names to be obj rather than 'iface' and/or 'obj'. Signed-off-by: John Ferlan --- src/conf/virinterfaceobj.c | 48 ++++++++++++++-------------- src/conf/virinterfaceobj.h | 4 +-- src/test/test_driver.c | 78 +++++++++++++++++++++++-------------------= ---- 3 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index e80db23..62c3735 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -51,14 +51,14 @@ virInterfaceObjUnlock(virInterfaceObjPtr obj) =20 =20 void -virInterfaceObjFree(virInterfaceObjPtr iface) +virInterfaceObjFree(virInterfaceObjPtr obj) { - if (!iface) + if (!obj) return; =20 - virInterfaceDefFree(iface->def); - virMutexDestroy(&iface->lock); - VIR_FREE(iface); + virInterfaceDefFree(obj->def); + virMutexDestroy(&obj->lock); + VIR_FREE(obj); } =20 =20 @@ -136,7 +136,7 @@ virInterfaceObjListClone(virInterfaceObjListPtr src, for (i =3D 0; i < cnt; i++) { virInterfaceDefPtr def =3D src->objs[i]->def; virInterfaceDefPtr backup; - virInterfaceObjPtr iface; + virInterfaceObjPtr obj; char *xml =3D virInterfaceDefFormat(def); =20 if (!xml) @@ -148,9 +148,9 @@ virInterfaceObjListClone(virInterfaceObjListPtr src, } =20 VIR_FREE(xml); - if ((iface =3D virInterfaceObjAssignDef(dest, backup)) =3D=3D NULL) + if ((obj =3D virInterfaceObjAssignDef(dest, backup)) =3D=3D NULL) goto cleanup; - virInterfaceObjUnlock(iface); /* locked by virInterfaceObjAssignDe= f */ + virInterfaceObjUnlock(obj); /* locked by virInterfaceObjAssignDef = */ } =20 ret =3D cnt; @@ -165,47 +165,47 @@ virInterfaceObjPtr virInterfaceObjAssignDef(virInterfaceObjListPtr interfaces, virInterfaceDefPtr def) { - virInterfaceObjPtr iface; + virInterfaceObjPtr obj; =20 - if ((iface =3D virInterfaceObjFindByName(interfaces, def->name))) { - virInterfaceDefFree(iface->def); - iface->def =3D def; + if ((obj =3D virInterfaceObjFindByName(interfaces, def->name))) { + virInterfaceDefFree(obj->def); + obj->def =3D def; =20 - return iface; + return obj; } =20 - if (VIR_ALLOC(iface) < 0) + if (VIR_ALLOC(obj) < 0) return NULL; - if (virMutexInit(&iface->lock) < 0) { + if (virMutexInit(&obj->lock) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize mutex")); - VIR_FREE(iface); + VIR_FREE(obj); return NULL; } - virInterfaceObjLock(iface); + virInterfaceObjLock(obj); =20 if (VIR_APPEND_ELEMENT_COPY(interfaces->objs, - interfaces->count, iface) < 0) { - virInterfaceObjFree(iface); + interfaces->count, obj) < 0) { + virInterfaceObjFree(obj); return NULL; } =20 - iface->def =3D def; - return iface; + obj->def =3D def; + return obj; =20 } =20 =20 void virInterfaceObjRemove(virInterfaceObjListPtr interfaces, - virInterfaceObjPtr iface) + virInterfaceObjPtr obj) { size_t i; =20 - virInterfaceObjUnlock(iface); + virInterfaceObjUnlock(obj); for (i =3D 0; i < interfaces->count; i++) { virInterfaceObjLock(interfaces->objs[i]); - if (interfaces->objs[i] =3D=3D iface) { + if (interfaces->objs[i] =3D=3D obj) { virInterfaceObjUnlock(interfaces->objs[i]); virInterfaceObjFree(interfaces->objs[i]); =20 diff --git a/src/conf/virinterfaceobj.h b/src/conf/virinterfaceobj.h index 5b0527d..ee166c6 100644 --- a/src/conf/virinterfaceobj.h +++ b/src/conf/virinterfaceobj.h @@ -54,7 +54,7 @@ virInterfaceObjFindByName(virInterfaceObjListPtr interfac= es, const char *name); =20 void -virInterfaceObjFree(virInterfaceObjPtr iface); +virInterfaceObjFree(virInterfaceObjPtr obj); =20 void virInterfaceObjListFree(virInterfaceObjListPtr vms); @@ -69,7 +69,7 @@ virInterfaceObjAssignDef(virInterfaceObjListPtr interface= s, =20 void virInterfaceObjRemove(virInterfaceObjListPtr interfaces, - virInterfaceObjPtr iface); + virInterfaceObjPtr obj); =20 void virInterfaceObjLock(virInterfaceObjPtr obj); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 9330d9e..d9f9329 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3627,18 +3627,18 @@ static virInterfaceObjPtr testInterfaceObjFindByName(testDriverPtr privconn, const char *name) { - virInterfaceObjPtr iface; + virInterfaceObjPtr obj; =20 testDriverLock(privconn); - iface =3D virInterfaceObjFindByName(&privconn->ifaces, name); + obj =3D virInterfaceObjFindByName(&privconn->ifaces, name); testDriverUnlock(privconn); =20 - if (!iface) + if (!obj) virReportError(VIR_ERR_NO_INTERFACE, _("no interface with matching name '%s'"), name); =20 - return iface; + return obj; } =20 =20 @@ -3705,17 +3705,17 @@ testInterfaceLookupByName(virConnectPtr conn, const char *name) { testDriverPtr privconn =3D conn->privateData; - virInterfaceObjPtr iface; + virInterfaceObjPtr obj; virInterfacePtr ret =3D NULL; =20 - if (!(iface =3D testInterfaceObjFindByName(privconn, name))) + if (!(obj =3D testInterfaceObjFindByName(privconn, name))) goto cleanup; =20 - ret =3D virGetInterface(conn, iface->def->name, iface->def->mac); + ret =3D virGetInterface(conn, obj->def->name, obj->def->mac); =20 cleanup: - if (iface) - virInterfaceObjUnlock(iface); + if (obj) + virInterfaceObjUnlock(obj); return ret; } =20 @@ -3725,12 +3725,12 @@ testInterfaceLookupByMACString(virConnectPtr conn, const char *mac) { testDriverPtr privconn =3D conn->privateData; - virInterfaceObjPtr iface; + virInterfaceObjPtr obj; int ifacect; virInterfacePtr ret =3D NULL; =20 testDriverLock(privconn); - ifacect =3D virInterfaceObjFindByMACString(&privconn->ifaces, mac, &if= ace, 1); + ifacect =3D virInterfaceObjFindByMACString(&privconn->ifaces, mac, &ob= j, 1); testDriverUnlock(privconn); =20 if (ifacect =3D=3D 0) { @@ -3743,11 +3743,11 @@ testInterfaceLookupByMACString(virConnectPtr conn, goto cleanup; } =20 - ret =3D virGetInterface(conn, iface->def->name, iface->def->mac); + ret =3D virGetInterface(conn, obj->def->name, obj->def->mac); =20 cleanup: - if (iface) - virInterfaceObjUnlock(iface); + if (obj) + virInterfaceObjUnlock(obj); return ret; } =20 @@ -3869,19 +3869,19 @@ testInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags) { testDriverPtr privconn =3D iface->conn->privateData; - virInterfaceObjPtr privinterface; + virInterfaceObjPtr obj; char *ret =3D NULL; =20 virCheckFlags(0, NULL); =20 - if (!(privinterface =3D testInterfaceObjFindByName(privconn, iface->na= me))) + if (!(obj =3D testInterfaceObjFindByName(privconn, iface->name))) goto cleanup; =20 - ret =3D virInterfaceDefFormat(privinterface->def); + ret =3D virInterfaceDefFormat(obj->def); =20 cleanup: - if (privinterface) - virInterfaceObjUnlock(privinterface); + if (obj) + virInterfaceObjUnlock(obj); return ret; } =20 @@ -3893,7 +3893,7 @@ testInterfaceDefineXML(virConnectPtr conn, { testDriverPtr privconn =3D conn->privateData; virInterfaceDefPtr def; - virInterfaceObjPtr iface =3D NULL; + virInterfaceObjPtr obj =3D NULL; virInterfacePtr ret =3D NULL; =20 virCheckFlags(0, NULL); @@ -3902,16 +3902,16 @@ testInterfaceDefineXML(virConnectPtr conn, if ((def =3D virInterfaceDefParseString(xmlStr)) =3D=3D NULL) goto cleanup; =20 - if ((iface =3D virInterfaceObjAssignDef(&privconn->ifaces, def)) =3D= =3D NULL) + if ((obj =3D virInterfaceObjAssignDef(&privconn->ifaces, def)) =3D=3D = NULL) goto cleanup; def =3D NULL; =20 - ret =3D virGetInterface(conn, iface->def->name, iface->def->mac); + ret =3D virGetInterface(conn, obj->def->name, obj->def->mac); =20 cleanup: virInterfaceDefFree(def); - if (iface) - virInterfaceObjUnlock(iface); + if (obj) + virInterfaceObjUnlock(obj); testDriverUnlock(privconn); return ret; } @@ -3921,13 +3921,13 @@ static int testInterfaceUndefine(virInterfacePtr iface) { testDriverPtr privconn =3D iface->conn->privateData; - virInterfaceObjPtr privinterface; + virInterfaceObjPtr obj; int ret =3D -1; =20 - if (!(privinterface =3D testInterfaceObjFindByName(privconn, iface->na= me))) + if (!(obj =3D testInterfaceObjFindByName(privconn, iface->name))) goto cleanup; =20 - virInterfaceObjRemove(&privconn->ifaces, privinterface); + virInterfaceObjRemove(&privconn->ifaces, obj); ret =3D 0; =20 cleanup: @@ -3940,25 +3940,25 @@ testInterfaceCreate(virInterfacePtr iface, unsigned int flags) { testDriverPtr privconn =3D iface->conn->privateData; - virInterfaceObjPtr privinterface; + virInterfaceObjPtr obj; int ret =3D -1; =20 virCheckFlags(0, -1); =20 - if (!(privinterface =3D testInterfaceObjFindByName(privconn, iface->na= me))) + if (!(obj =3D testInterfaceObjFindByName(privconn, iface->name))) goto cleanup; =20 - if (privinterface->active !=3D 0) { + if (obj->active !=3D 0) { virReportError(VIR_ERR_OPERATION_INVALID, NULL); goto cleanup; } =20 - privinterface->active =3D 1; + obj->active =3D 1; ret =3D 0; =20 cleanup: - if (privinterface) - virInterfaceObjUnlock(privinterface); + if (obj) + virInterfaceObjUnlock(obj); return ret; } =20 @@ -3968,25 +3968,25 @@ testInterfaceDestroy(virInterfacePtr iface, unsigned int flags) { testDriverPtr privconn =3D iface->conn->privateData; - virInterfaceObjPtr privinterface; + virInterfaceObjPtr obj; int ret =3D -1; =20 virCheckFlags(0, -1); =20 - if (!(privinterface =3D testInterfaceObjFindByName(privconn, iface->na= me))) + if (!(obj =3D testInterfaceObjFindByName(privconn, iface->name))) goto cleanup; =20 - if (privinterface->active =3D=3D 0) { + if (obj->active =3D=3D 0) { virReportError(VIR_ERR_OPERATION_INVALID, NULL); goto cleanup; } =20 - privinterface->active =3D 0; + obj->active =3D 0; ret =3D 0; =20 cleanup: - if (privinterface) - virInterfaceObjUnlock(privinterface); + if (obj) + virInterfaceObjUnlock(obj); return ret; } =20 --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list