From nobody Sat Feb 7 08:02:49 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 1495199354984993.3076526498721; Fri, 19 May 2017 06:09:14 -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 7BC87624D9; Fri, 19 May 2017 13:09:12 +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 51D00189F6; Fri, 19 May 2017 13:09:12 +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 036B34A492; Fri, 19 May 2017 13:09:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4JD8wh4005287 for ; Fri, 19 May 2017 09:08:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id BE86B80E7E; Fri, 19 May 2017 13:08:58 +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 7BA3180E7D for ; Fri, 19 May 2017 13:08:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7BC87624D9 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 7BC87624D9 From: John Ferlan To: libvir-list@redhat.com Date: Fri, 19 May 2017 09:08:44 -0400 Message-Id: <20170519130853.13965-5-jferlan@redhat.com> In-Reply-To: <20170519130853.13965-1-jferlan@redhat.com> References: <20170519130853.13965-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/13] nodedev: Move node_device_linux_sysfs from node_driver to conf 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 19 May 2017 13:09:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the whole file from src/node_device into src/conf and rename the API's to have the "virNodeDevice" prefix. Signed-off-by: John Ferlan --- src/Makefile.am | 8 ++++---- .../node_device_linux_sysfs.c | 24 ++++++++++--------= ---- .../node_device_linux_sysfs.h | 9 +++++--- src/libvirt_private.syms | 5 +++++ src/node_device/node_device_driver.c | 8 ++++---- src/node_device/node_device_hal.c | 4 ++-- src/node_device/node_device_udev.c | 4 ++-- 7 files changed, 34 insertions(+), 28 deletions(-) rename src/{node_device =3D> conf}/node_device_linux_sysfs.c (89%) rename src/{node_device =3D> conf}/node_device_linux_sysfs.h (82%) diff --git a/src/Makefile.am b/src/Makefile.am index f95f30e..23c35eb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -462,7 +462,9 @@ SECRET_CONF_SOURCES =3D = \ # Network driver generic impl APIs NODE_DEVICE_CONF_SOURCES =3D \ conf/node_device_conf.c conf/node_device_conf.h \ - conf/virnodedeviceobj.c conf/virnodedeviceobj.h + conf/virnodedeviceobj.c conf/virnodedeviceobj.h \ + conf/node_device_linux_sysfs.c \ + conf/node_device_linux_sysfs.h =20 CPU_CONF_SOURCES =3D \ conf/cpu_conf.c conf/cpu_conf.h @@ -1162,9 +1164,7 @@ ACCESS_DRIVER_POLKIT_POLICY =3D \ =20 NODE_DEVICE_DRIVER_SOURCES =3D \ node_device/node_device_driver.c \ - node_device/node_device_driver.h \ - node_device/node_device_linux_sysfs.c \ - node_device/node_device_linux_sysfs.h + node_device/node_device_driver.h =20 NODE_DEVICE_DRIVER_HAL_SOURCES =3D \ node_device/node_device_hal.c \ diff --git a/src/node_device/node_device_linux_sysfs.c b/src/conf/node_devi= ce_linux_sysfs.c similarity index 89% rename from src/node_device/node_device_linux_sysfs.c rename to src/conf/node_device_linux_sysfs.c index 1b7aa94..a905cd9 100644 --- a/src/node_device/node_device_linux_sysfs.c +++ b/src/conf/node_device_linux_sysfs.c @@ -26,8 +26,6 @@ #include #include =20 -#include "node_device_driver.h" -#include "node_device_hal.h" #include "node_device_linux_sysfs.h" #include "virerror.h" #include "viralloc.h" @@ -44,7 +42,7 @@ VIR_LOG_INIT("node_device.node_device_linux_sysfs"); =20 int -nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host) +virNodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host) { char *tmp =3D NULL; int ret =3D -1; @@ -125,8 +123,8 @@ nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr= scsi_host) =20 =20 static int -nodeDeviceSysfsGetPCISRIOVCaps(const char *sysfsPath, - virNodeDevCapPCIDevPtr pci_dev) +virNodeDeviceSysfsGetPCISRIOVCaps(const char *sysfsPath, + virNodeDevCapPCIDevPtr pci_dev) { size_t i; int ret; @@ -164,7 +162,7 @@ nodeDeviceSysfsGetPCISRIOVCaps(const char *sysfsPath, =20 =20 static int -nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev) +virNodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev) { size_t i; int tmpGroup, ret =3D -1; @@ -204,19 +202,19 @@ nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCID= evPtr pci_dev) } =20 =20 -/* nodeDeviceSysfsGetPCIRelatedCaps() get info that is stored in sysfs +/* virNodeDeviceSysfsGetPCIRelatedCaps() get info that is stored in sysfs * about devices related to this device, i.e. things that can change * without this device itself changing. These must be refreshed * anytime full XML of the device is requested, because they can * change with no corresponding notification from the kernel/udev. */ int -nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath, - virNodeDevCapPCIDevPtr pci_dev) +virNodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath, + virNodeDevCapPCIDevPtr pci_dev) { - if (nodeDeviceSysfsGetPCISRIOVCaps(sysfsPath, pci_dev) < 0) + if (virNodeDeviceSysfsGetPCISRIOVCaps(sysfsPath, pci_dev) < 0) return -1; - if (nodeDeviceSysfsGetPCIIOMMUGroupCaps(pci_dev) < 0) + if (virNodeDeviceSysfsGetPCIIOMMUGroupCaps(pci_dev) < 0) return -1; return 0; } @@ -225,13 +223,13 @@ nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfs= Path, #else =20 int -nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host ATTRIBUT= E_UNUSED) +virNodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host ATTRI= BUTE_UNUSED) { return -1; } =20 int -nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath ATTRIBUTE_UNUSED, +virNodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath ATTRIBUTE_UNU= SED, virNodeDevCapPCIDevPtr pci_dev ATTRIBU= TE_UNUSED) { return -1; diff --git a/src/node_device/node_device_linux_sysfs.h b/src/conf/node_devi= ce_linux_sysfs.h similarity index 82% rename from src/node_device/node_device_linux_sysfs.h rename to src/conf/node_device_linux_sysfs.h index 8deea66..4e0bf65 100644 --- a/src/node_device/node_device_linux_sysfs.h +++ b/src/conf/node_device_linux_sysfs.h @@ -25,8 +25,11 @@ =20 # include "node_device_conf.h" =20 -int nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); -int nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath, - virNodeDevCapPCIDevPtr pci_dev); +int +virNodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); + +int +virNodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath, + virNodeDevCapPCIDevPtr pci_dev); =20 #endif /* __VIR_NODE_DEVICE_LINUX_SYSFS_H__ */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d361454..d8602e6 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -689,6 +689,11 @@ virNodeDeviceEventStateRegisterID; virNodeDeviceEventUpdateNew; =20 =20 +# conf/node_device_linux_sysfs.h +virNodeDeviceSysfsGetPCIRelatedDevCaps; +virNodeDeviceSysfsGetSCSIHostCaps; + + # conf/numa_conf.h virDomainNumaCheckABIStability; virDomainNumaEquals; diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index ba3da62..b4c0020 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -54,7 +54,7 @@ static int update_caps(virNodeDeviceObjPtr dev) while (cap) { switch (cap->data.type) { case VIR_NODE_DEV_CAP_SCSI_HOST: - nodeDeviceSysfsGetSCSIHostCaps(&dev->def->caps->data.scsi_host= ); + virNodeDeviceSysfsGetSCSIHostCaps(&dev->def->caps->data.scsi_h= ost); break; case VIR_NODE_DEV_CAP_NET: if (virNetDevGetLinkInfo(cap->data.net.ifname, &cap->data.net.= lnk) < 0) @@ -64,8 +64,8 @@ static int update_caps(virNodeDeviceObjPtr dev) return -1; break; case VIR_NODE_DEV_CAP_PCI_DEV: - if (nodeDeviceSysfsGetPCIRelatedDevCaps(dev->def->sysfs_path, - &dev->def->caps->data.p= ci_dev) < 0) + if (virNodeDeviceSysfsGetPCIRelatedDevCaps(dev->def->sysfs_path, + &dev->def->caps->dat= a.pci_dev) < 0) return -1; break; =20 @@ -275,7 +275,7 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn, =20 while (cap) { if (cap->data.type =3D=3D VIR_NODE_DEV_CAP_SCSI_HOST) { - nodeDeviceSysfsGetSCSIHostCaps(&cap->data.scsi_host); + virNodeDeviceSysfsGetSCSIHostCaps(&cap->data.scsi_host); if (cap->data.scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST) { if (STREQ(cap->data.scsi_host.wwnn, wwnn) && diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_devic= e_hal.c index 81e5ecc..e76201b 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -153,7 +153,7 @@ gather_pci_cap(LibHalContext *ctx, const char *udi, ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.function= )); } =20 - if (nodeDeviceSysfsGetPCIRelatedDevCaps(sysfs_path, &d->pci_dev) <= 0) { + if (virNodeDeviceSysfsGetPCIRelatedDevCaps(sysfs_path, &d->pci_dev= ) < 0) { VIR_FREE(sysfs_path); return -1; } @@ -239,7 +239,7 @@ gather_scsi_host_cap(LibHalContext *ctx, const char *ud= i, =20 (void)get_int_prop(ctx, udi, "scsi_host.host", (int *)&d->scsi_host.ho= st); =20 - retval =3D nodeDeviceSysfsGetSCSIHostCaps(&d->scsi_host); + retval =3D virNodeDeviceSysfsGetSCSIHostCaps(&d->scsi_host); =20 if (retval =3D=3D -1) goto out; diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 4ecb0b1..c88a234 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -474,7 +474,7 @@ static int udevProcessPCI(struct udev_device *device, &pci_dev->numa_node, 10) < 0) goto cleanup; =20 - if (nodeDeviceSysfsGetPCIRelatedDevCaps(def->sysfs_path, pci_dev) < 0) + if (virNodeDeviceSysfsGetPCIRelatedDevCaps(def->sysfs_path, pci_dev) <= 0) goto cleanup; =20 if (!(pciDev =3D virPCIDeviceNew(pci_dev->domain, @@ -688,7 +688,7 @@ static int udevProcessSCSIHost(struct udev_device *devi= ce ATTRIBUTE_UNUSED, return -1; } =20 - nodeDeviceSysfsGetSCSIHostCaps(&def->caps->data.scsi_host); + virNodeDeviceSysfsGetSCSIHostCaps(&def->caps->data.scsi_host); =20 if (udevGenerateDeviceName(device, def, NULL) !=3D 0) return -1; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list