[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 04/13] nodedev: Move node_device_linux_sysfs from node_driver to conf



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 <jferlan redhat com>
---
 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 => conf}/node_device_linux_sysfs.c (89%)
 rename src/{node_device => 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 =                                          \
 # Network driver generic impl APIs
 NODE_DEVICE_CONF_SOURCES =                                     \
 		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
 
 CPU_CONF_SOURCES =						\
 		conf/cpu_conf.c conf/cpu_conf.h
@@ -1162,9 +1164,7 @@ ACCESS_DRIVER_POLKIT_POLICY = \
 
 NODE_DEVICE_DRIVER_SOURCES =					\
 		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
 
 NODE_DEVICE_DRIVER_HAL_SOURCES =				\
 		node_device/node_device_hal.c			\
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/conf/node_device_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 <sys/stat.h>
 #include <stdlib.h>
 
-#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");
 
 int
-nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
+virNodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
 {
     char *tmp = NULL;
     int ret = -1;
@@ -125,8 +123,8 @@ nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
 
 
 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,
 
 
 static int
-nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev)
+virNodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev)
 {
     size_t i;
     int tmpGroup, ret = -1;
@@ -204,19 +202,19 @@ nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev)
 }
 
 
-/* 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 *sysfsPath,
 #else
 
 int
-nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host ATTRIBUTE_UNUSED)
+virNodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host ATTRIBUTE_UNUSED)
 {
     return -1;
 }
 
 int
-nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath ATTRIBUTE_UNUSED,
+virNodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath ATTRIBUTE_UNUSED,
                                     virNodeDevCapPCIDevPtr pci_dev ATTRIBUTE_UNUSED)
 {
     return -1;
diff --git a/src/node_device/node_device_linux_sysfs.h b/src/conf/node_device_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 @@
 
 # include "node_device_conf.h"
 
-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);
 
 #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;
 
 
+# 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_device_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_host);
             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.pci_dev) < 0)
+           if (virNodeDeviceSysfsGetPCIRelatedDevCaps(dev->def->sysfs_path,
+                                                      &dev->def->caps->data.pci_dev) < 0)
               return -1;
            break;
 
@@ -275,7 +275,7 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
 
         while (cap) {
             if (cap->data.type == 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_device_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));
         }
 
-        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 *udi,
 
     (void)get_int_prop(ctx, udi, "scsi_host.host", (int *)&d->scsi_host.host);
 
-    retval = nodeDeviceSysfsGetSCSIHostCaps(&d->scsi_host);
+    retval = virNodeDeviceSysfsGetSCSIHostCaps(&d->scsi_host);
 
     if (retval == -1)
         goto out;
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_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;
 
-    if (nodeDeviceSysfsGetPCIRelatedDevCaps(def->sysfs_path, pci_dev) < 0)
+    if (virNodeDeviceSysfsGetPCIRelatedDevCaps(def->sysfs_path, pci_dev) < 0)
         goto cleanup;
 
     if (!(pciDev = virPCIDeviceNew(pci_dev->domain,
@@ -688,7 +688,7 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
         return -1;
     }
 
-    nodeDeviceSysfsGetSCSIHostCaps(&def->caps->data.scsi_host);
+    virNodeDeviceSysfsGetSCSIHostCaps(&def->caps->data.scsi_host);
 
     if (udevGenerateDeviceName(device, def, NULL) != 0)
         return -1;
-- 
2.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]