From nobody Tue Apr 30 08:05:14 2024 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 1491478328460976.8147082318445; Thu, 6 Apr 2017 04:32:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C449361D1C; Thu, 6 Apr 2017 11:32:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97886A2E7E; Thu, 6 Apr 2017 11:32:06 +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 43CF8B3483; Thu, 6 Apr 2017 11:32:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v36BW4KW027990 for ; Thu, 6 Apr 2017 07:32:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id D96BB9EAC1; Thu, 6 Apr 2017 11:32:04 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-19.phx2.redhat.com [10.3.116.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 976D99EAC3 for ; Thu, 6 Apr 2017 11:32:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C449361D1C Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.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 C449361D1C From: John Ferlan To: libvir-list@redhat.com Date: Thu, 6 Apr 2017 07:31:58 -0400 Message-Id: <20170406113200.15595-2-jferlan@redhat.com> In-Reply-To: <20170406113200.15595-1-jferlan@redhat.com> References: <20170406113200.15595-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] nodedev: Introduce virNodeDeviceObjNumOfDevices 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 06 Apr 2017 11:32:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Unify the NumOfDevices API into virnodedeviceobj.c from node_device_driver and test_driver. The only real difference between the two is that the test driver doesn't call the aclfilter API. Signed-off-by: John Ferlan --- src/conf/virnodedeviceobj.c | 22 ++++++++++++++++++++++ src/conf/virnodedeviceobj.h | 6 ++++++ src/libvirt_private.syms | 1 + src/node_device/node_device_driver.c | 12 ++---------- src/test/test_driver.c | 6 +----- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 3fe3ae5..f0c20c2 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -474,6 +474,28 @@ virNodeDeviceCapMatch(virNodeDeviceObjPtr devobj, } =20 =20 +int +virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr devs, + virConnectPtr conn, + const char *cap, + virNodeDeviceObjListFilter aclfilter) +{ + size_t i; + int ndevs =3D 0; + + for (i =3D 0; i < devs->count; i++) { + virNodeDeviceObjPtr obj =3D devs->objs[i]; + virNodeDeviceObjLock(obj); + if (aclfilter && aclfilter(conn, obj->def) && + (!cap || virNodeDeviceObjHasCap(obj, cap))) + ++ndevs; + virNodeDeviceObjUnlock(obj); + } + + return ndevs; +} + + #define MATCH(FLAG) ((flags & (VIR_CONNECT_LIST_NODE_DEVICES_CAP_ ## FLAG)= ) && \ virNodeDeviceCapMatch(devobj, VIR_NODE_DEV_CAP_ ## FL= AG)) static bool diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h index e32bbf8..7d303a0 100644 --- a/src/conf/virnodedeviceobj.h +++ b/src/conf/virnodedeviceobj.h @@ -83,6 +83,12 @@ typedef bool virNodeDeviceDefPtr def); =20 int +virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr devs, + virConnectPtr conn, + const char *cap, + virNodeDeviceObjListFilter aclfilter); + +int virNodeDeviceObjListExport(virConnectPtr conn, virNodeDeviceObjList devobjs, virNodeDevicePtr **devices, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 92083e5..104ed88 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -951,6 +951,7 @@ virNodeDeviceObjHasCap; virNodeDeviceObjListExport; virNodeDeviceObjListFree; virNodeDeviceObjLock; +virNodeDeviceObjNumOfDevices; virNodeDeviceObjRemove; virNodeDeviceObjUnlock; =20 diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 99f7bc5..f90b168 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -160,7 +160,6 @@ nodeNumOfDevices(virConnectPtr conn, unsigned int flags) { int ndevs =3D 0; - size_t i; =20 if (virNodeNumOfDevicesEnsureACL(conn) < 0) return -1; @@ -168,15 +167,8 @@ nodeNumOfDevices(virConnectPtr conn, virCheckFlags(0, -1); =20 nodeDeviceLock(); - for (i =3D 0; i < driver->devs.count; i++) { - virNodeDeviceObjPtr obj =3D driver->devs.objs[i]; - virNodeDeviceObjLock(obj); - if (virNodeNumOfDevicesCheckACL(conn, obj->def) && - ((cap =3D=3D NULL) || - virNodeDeviceObjHasCap(obj, cap))) - ++ndevs; - virNodeDeviceObjUnlock(obj); - } + ndevs =3D virNodeDeviceObjNumOfDevices(&driver->devs, conn, cap, + virNodeNumOfDevicesCheckACL); nodeDeviceUnlock(); =20 return ndevs; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index cce4d2d..2f1f4fa 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5385,15 +5385,11 @@ testNodeNumOfDevices(virConnectPtr conn, { testDriverPtr driver =3D conn->privateData; int ndevs =3D 0; - size_t i; =20 virCheckFlags(0, -1); =20 testDriverLock(driver); - for (i =3D 0; i < driver->devs.count; i++) - if ((cap =3D=3D NULL) || - virNodeDeviceObjHasCap(driver->devs.objs[i], cap)) - ++ndevs; + ndevs =3D virNodeDeviceObjNumOfDevices(&driver->devs, conn, cap, NULL); testDriverUnlock(driver); =20 return ndevs; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 08:05:14 2024 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 1491478332088402.9937206815704; Thu, 6 Apr 2017 04:32:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 80D6CC065861; Thu, 6 Apr 2017 11:32:10 +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 50AE98932B; Thu, 6 Apr 2017 11:32:10 +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 F28E518523CE; Thu, 6 Apr 2017 11:32:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v36BW5tN027999 for ; Thu, 6 Apr 2017 07:32:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E1049EAC3; Thu, 6 Apr 2017 11:32:05 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-19.phx2.redhat.com [10.3.116.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D1139EAC1 for ; Thu, 6 Apr 2017 11:32:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 80D6CC065861 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.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 80D6CC065861 From: John Ferlan To: libvir-list@redhat.com Date: Thu, 6 Apr 2017 07:31:59 -0400 Message-Id: <20170406113200.15595-3-jferlan@redhat.com> In-Reply-To: <20170406113200.15595-1-jferlan@redhat.com> References: <20170406113200.15595-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] nodedev: Introduce virNodeDeviceObjGetNames 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 06 Apr 2017 11:32:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Unify the *ListDevice API into virnodedeviceobj.c from node_device_driver and test_driver. The only real difference between the two is that the test driver doesn't call the aclfilter API. The name of the new API follows that of other drivers to "GetNames". NB: Change some variable names to match what they really are - consistency with other drivers. Also added a clear of the input names. This also allows virNodeDeviceObjHasCap to be static to virnodedeviceobj Signed-off-by: John Ferlan --- src/conf/virnodedeviceobj.c | 36 ++++++++++++++++++++++++++++++++= +++- src/conf/virnodedeviceobj.h | 12 ++++++++---- src/libvirt_private.syms | 2 +- src/node_device/node_device_driver.c | 34 ++++++++++----------------------= -- src/test/test_driver.c | 27 ++++++--------------------- 5 files changed, 60 insertions(+), 51 deletions(-) diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index f0c20c2..5a8dfe7 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -33,7 +33,7 @@ VIR_LOG_INIT("conf.virnodedeviceobj"); =20 =20 -int +static int virNodeDeviceObjHasCap(const virNodeDeviceObj *dev, const char *cap) { @@ -496,6 +496,40 @@ virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr d= evs, } =20 =20 +int +virNodeDeviceObjGetNames(virNodeDeviceObjListPtr devs, + virConnectPtr conn, + virNodeDeviceObjListFilter aclfilter, + const char *cap, + char **const names, + int maxnames) +{ + int nnames =3D 0; + size_t i; + + for (i =3D 0; i < devs->count && nnames < maxnames; i++) { + virNodeDeviceObjPtr obj =3D devs->objs[i]; + virNodeDeviceObjLock(obj); + if (aclfilter && aclfilter(conn, obj->def) && + (!cap || virNodeDeviceObjHasCap(obj, cap))) { + if (VIR_STRDUP(names[nnames++], obj->def->name) < 0) { + virNodeDeviceObjUnlock(obj); + goto failure; + } + } + virNodeDeviceObjUnlock(obj); + } + + return nnames; + + failure: + while (--nnames >=3D 0) + VIR_FREE(names[nnames]); + memset(names, 0, maxnames * sizeof(*names)); + return -1; +} + + #define MATCH(FLAG) ((flags & (VIR_CONNECT_LIST_NODE_DEVICES_CAP_ ## FLAG)= ) && \ virNodeDeviceCapMatch(devobj, VIR_NODE_DEV_CAP_ ## FL= AG)) static bool diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h index 7d303a0..0acd8ce 100644 --- a/src/conf/virnodedeviceobj.h +++ b/src/conf/virnodedeviceobj.h @@ -40,10 +40,6 @@ struct _virNodeDeviceDriverState { }; =20 =20 -int -virNodeDeviceObjHasCap(const virNodeDeviceObj *dev, - const char *cap); - virNodeDeviceObjPtr virNodeDeviceObjFindByName(virNodeDeviceObjListPtr devs, const char *name); @@ -89,6 +85,14 @@ virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr dev= s, virNodeDeviceObjListFilter aclfilter); =20 int +virNodeDeviceObjGetNames(virNodeDeviceObjListPtr devs, + virConnectPtr conn, + virNodeDeviceObjListFilter aclfilter, + const char *cap, + char **const names, + int maxnames); + +int virNodeDeviceObjListExport(virConnectPtr conn, virNodeDeviceObjList devobjs, virNodeDevicePtr **devices, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 104ed88..5df6a5d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -946,8 +946,8 @@ virInterfaceObjUnlock; virNodeDeviceObjAssignDef; virNodeDeviceObjFindByName; virNodeDeviceObjFindBySysfsPath; +virNodeDeviceObjGetNames; virNodeDeviceObjGetParentHost; -virNodeDeviceObjHasCap; virNodeDeviceObjListExport; virNodeDeviceObjListFree; virNodeDeviceObjLock; diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index f90b168..e850a22 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -174,14 +174,17 @@ nodeNumOfDevices(virConnectPtr conn, return ndevs; } =20 + int nodeListDevices(virConnectPtr conn, const char *cap, - char **const names, int maxnames, + char **const names, + int maxnames, unsigned int flags) { - int ndevs =3D 0; - size_t i; + int nnames; + + memset(names, 0, maxnames * sizeof(*names)); =20 if (virNodeListDevicesEnsureACL(conn) < 0) return -1; @@ -189,29 +192,12 @@ nodeListDevices(virConnectPtr conn, virCheckFlags(0, -1); =20 nodeDeviceLock(); - for (i =3D 0; i < driver->devs.count && ndevs < maxnames; i++) { - virNodeDeviceObjPtr obj =3D driver->devs.objs[i]; - virNodeDeviceObjLock(obj); - if (virNodeListDevicesCheckACL(conn, obj->def) && - (cap =3D=3D NULL || - virNodeDeviceObjHasCap(obj, cap))) { - if (VIR_STRDUP(names[ndevs++], obj->def->name) < 0) { - virNodeDeviceObjUnlock(obj); - goto failure; - } - } - virNodeDeviceObjUnlock(obj); - } + nnames =3D virNodeDeviceObjGetNames(&driver->devs, conn, + virNodeListDevicesCheckACL, + cap, names, maxnames); nodeDeviceUnlock(); =20 - return ndevs; - - failure: - nodeDeviceUnlock(); - --ndevs; - while (--ndevs >=3D 0) - VIR_FREE(names[ndevs]); - return -1; + return nnames; } =20 int diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2f1f4fa..a9040e8 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5395,6 +5395,7 @@ testNodeNumOfDevices(virConnectPtr conn, return ndevs; } =20 + static int testNodeListDevices(virConnectPtr conn, const char *cap, @@ -5403,35 +5404,19 @@ testNodeListDevices(virConnectPtr conn, unsigned int flags) { testDriverPtr driver =3D conn->privateData; - int ndevs =3D 0; - size_t i; + int nnames =3D 0; =20 virCheckFlags(0, -1); =20 testDriverLock(driver); - for (i =3D 0; i < driver->devs.count && ndevs < maxnames; i++) { - virNodeDeviceObjLock(driver->devs.objs[i]); - if (cap =3D=3D NULL || - virNodeDeviceObjHasCap(driver->devs.objs[i], cap)) { - if (VIR_STRDUP(names[ndevs++], driver->devs.objs[i]->def->name= ) < 0) { - virNodeDeviceObjUnlock(driver->devs.objs[i]); - goto failure; - } - } - virNodeDeviceObjUnlock(driver->devs.objs[i]); - } + nnames =3D virNodeDeviceObjGetNames(&driver->devs, conn, NULL, + cap, names, maxnames); testDriverUnlock(driver); =20 - return ndevs; - - failure: - testDriverUnlock(driver); - --ndevs; - while (--ndevs >=3D 0) - VIR_FREE(names[ndevs]); - return -1; + return nnames; } =20 + static virNodeDevicePtr testNodeDeviceLookupByName(virConnectPtr conn, const char *name) { --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 08:05:14 2024 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 1491478330985755.4394898642006; Thu, 6 Apr 2017 04:32:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1E3D7F7B6; Thu, 6 Apr 2017 11:32:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF558A2E6B; Thu, 6 Apr 2017 11:32:08 +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 66D2AB3484; Thu, 6 Apr 2017 11:32:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v36BW5cc028006 for ; Thu, 6 Apr 2017 07:32:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id B693A9EAC3; Thu, 6 Apr 2017 11:32:05 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-19.phx2.redhat.com [10.3.116.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7689C9EAC1 for ; Thu, 6 Apr 2017 11:32:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E1E3D7F7B6 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.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 E1E3D7F7B6 From: John Ferlan To: libvir-list@redhat.com Date: Thu, 6 Apr 2017 07:32:00 -0400 Message-Id: <20170406113200.15595-4-jferlan@redhat.com> In-Reply-To: <20170406113200.15595-1-jferlan@redhat.com> References: <20170406113200.15595-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] nodedev: Pass driver arg by ref 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 06 Apr 2017 11:32:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Alter virNodeDeviceObjListExport in order to pass the drivers->devs by reference Signed-off-by: John Ferlan --- src/conf/virnodedeviceobj.c | 8 ++++---- src/conf/virnodedeviceobj.h | 2 +- src/node_device/node_device_driver.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 5a8dfe7..fc82799 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -561,7 +561,7 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj, =20 int virNodeDeviceObjListExport(virConnectPtr conn, - virNodeDeviceObjList devobjs, + virNodeDeviceObjListPtr devobjs, virNodeDevicePtr **devices, virNodeDeviceObjListFilter filter, unsigned int flags) @@ -572,11 +572,11 @@ virNodeDeviceObjListExport(virConnectPtr conn, int ret =3D -1; size_t i; =20 - if (devices && VIR_ALLOC_N(tmp_devices, devobjs.count + 1) < 0) + if (devices && VIR_ALLOC_N(tmp_devices, devobjs->count + 1) < 0) goto cleanup; =20 - for (i =3D 0; i < devobjs.count; i++) { - virNodeDeviceObjPtr devobj =3D devobjs.objs[i]; + for (i =3D 0; i < devobjs->count; i++) { + virNodeDeviceObjPtr devobj =3D devobjs->objs[i]; virNodeDeviceObjLock(devobj); if ((!filter || filter(conn, devobj->def)) && virNodeDeviceMatch(devobj, flags)) { diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h index 0acd8ce..b8b534b 100644 --- a/src/conf/virnodedeviceobj.h +++ b/src/conf/virnodedeviceobj.h @@ -94,7 +94,7 @@ virNodeDeviceObjGetNames(virNodeDeviceObjListPtr devs, =20 int virNodeDeviceObjListExport(virConnectPtr conn, - virNodeDeviceObjList devobjs, + virNodeDeviceObjListPtr devobjs, virNodeDevicePtr **devices, virNodeDeviceObjListFilter filter, unsigned int flags); diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index e850a22..269b086 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -213,7 +213,7 @@ nodeConnectListAllNodeDevices(virConnectPtr conn, return -1; =20 nodeDeviceLock(); - ret =3D virNodeDeviceObjListExport(conn, driver->devs, devices, + ret =3D virNodeDeviceObjListExport(conn, &driver->devs, devices, virConnectListAllNodeDevicesCheckACL, flags); nodeDeviceUnlock(); --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list