Re: [libvirt] [PATCH 04/15] nodedev: Drop the nodeDeviceSysfsGetSCSIHostCaps wrapper

2018-01-26 Thread Michal Privoznik
On 01/25/2018 10:23 AM, Erik Skultety wrote:
> We can call directly the virNodeDeviceGetSCSIHostCaps helper instead.
> 
> Signed-off-by: Erik Skultety 
> ---
>  src/conf/node_device_conf.c   | 12 
>  src/node_device/node_device_driver.c  |  2 +-
>  src/node_device/node_device_hal.c |  4 ++--
>  src/node_device/node_device_linux_sysfs.c | 12 
>  src/node_device/node_device_linux_sysfs.h |  1 -
>  src/node_device/node_device_udev.c|  2 +-
>  6 files changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index bf84fd2b3..70a753ebf 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -2431,6 +2431,8 @@ virNodeDeviceDeleteVport(virConnectPtr conn,
>  }
>  
>  
> +#ifdef __linux__
> +
>  int
>  virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
>  {
> @@ -2511,3 +2513,13 @@ virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr 
> scsi_host)
>  VIR_FREE(tmp);
>  return ret;
>  }
> +
> +#else
> +
> +int
> +virNodeDeviceGetSCSIHostCaps(virNodeDevCap)

The linux version of this function takes virNodeDevCapSCSIHostPtr. This
non-linux should do so too. Also, you should give the argument a name
and mark it as ATTRIBUTE_UNUSED.

> +{
> +return -1;
> +}
> +
> +#endif /* __linux__ */
> diff --git a/src/node_device/node_device_driver.c 
> b/src/node_device/node_device_driver.c
> index 6216a6977..a2f687942 100644
> --- a/src/node_device/node_device_driver.c
> +++ b/src/node_device/node_device_driver.c
> @@ -56,7 +56,7 @@ nodeDeviceUpdateCaps(virNodeDeviceDefPtr def)
>  while (cap) {
>  switch (cap->data.type) {
>  case VIR_NODE_DEV_CAP_SCSI_HOST:
> -nodeDeviceSysfsGetSCSIHostCaps(>data.scsi_host);
> +virNodeDeviceGetSCSIHostCaps(>data.scsi_host);
>  break;
>  case VIR_NODE_DEV_CAP_SCSI_TARGET:
>  nodeDeviceSysfsGetSCSITargetCaps(def->sysfs_path,
> diff --git a/src/node_device/node_device_hal.c 
> b/src/node_device/node_device_hal.c
> index c19e327c9..4c50f4613 100644
> --- a/src/node_device/node_device_hal.c
> +++ b/src/node_device/node_device_hal.c
> @@ -151,7 +151,7 @@ gather_pci_cap(LibHalContext *ctx, const char *udi,
>  ignore_value(virStrToLong_ui(p+1, , 16, >pci_dev.function));
>  }
>  
> -if (nodeDeviceSysfsGetPCIRelatedDevCaps(sysfs_path, >pci_dev) < 
> 0) {
> +if (virNodeDeviceGetPCIDynamicCaps(sysfs_path, >pci_dev) < 0) {
>  VIR_FREE(sysfs_path);
>  return -1;

This doesn't look right. You're not changing PCI function in this patch.
ACK to the rest.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 04/15] nodedev: Drop the nodeDeviceSysfsGetSCSIHostCaps wrapper

2018-01-25 Thread Erik Skultety
We can call directly the virNodeDeviceGetSCSIHostCaps helper instead.

Signed-off-by: Erik Skultety 
---
 src/conf/node_device_conf.c   | 12 
 src/node_device/node_device_driver.c  |  2 +-
 src/node_device/node_device_hal.c |  4 ++--
 src/node_device/node_device_linux_sysfs.c | 12 
 src/node_device/node_device_linux_sysfs.h |  1 -
 src/node_device/node_device_udev.c|  2 +-
 6 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index bf84fd2b3..70a753ebf 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -2431,6 +2431,8 @@ virNodeDeviceDeleteVport(virConnectPtr conn,
 }
 
 
+#ifdef __linux__
+
 int
 virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
 {
@@ -2511,3 +2513,13 @@ virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr 
scsi_host)
 VIR_FREE(tmp);
 return ret;
 }
+
+#else
+
+int
+virNodeDeviceGetSCSIHostCaps(virNodeDevCap)
+{
+return -1;
+}
+
+#endif /* __linux__ */
diff --git a/src/node_device/node_device_driver.c 
b/src/node_device/node_device_driver.c
index 6216a6977..a2f687942 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -56,7 +56,7 @@ nodeDeviceUpdateCaps(virNodeDeviceDefPtr def)
 while (cap) {
 switch (cap->data.type) {
 case VIR_NODE_DEV_CAP_SCSI_HOST:
-nodeDeviceSysfsGetSCSIHostCaps(>data.scsi_host);
+virNodeDeviceGetSCSIHostCaps(>data.scsi_host);
 break;
 case VIR_NODE_DEV_CAP_SCSI_TARGET:
 nodeDeviceSysfsGetSCSITargetCaps(def->sysfs_path,
diff --git a/src/node_device/node_device_hal.c 
b/src/node_device/node_device_hal.c
index c19e327c9..4c50f4613 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -151,7 +151,7 @@ gather_pci_cap(LibHalContext *ctx, const char *udi,
 ignore_value(virStrToLong_ui(p+1, , 16, >pci_dev.function));
 }
 
-if (nodeDeviceSysfsGetPCIRelatedDevCaps(sysfs_path, >pci_dev) < 0) {
+if (virNodeDeviceGetPCIDynamicCaps(sysfs_path, >pci_dev) < 0) {
 VIR_FREE(sysfs_path);
 return -1;
 }
@@ -237,7 +237,7 @@ gather_scsi_host_cap(LibHalContext *ctx, const char *udi,
 
 (void)get_int_prop(ctx, udi, "scsi_host.host", (int *)>scsi_host.host);
 
-retval = nodeDeviceSysfsGetSCSIHostCaps(>scsi_host);
+retval = virNodeDeviceGetSCSIHostCaps(>scsi_host);
 
 if (retval == -1)
 goto out;
diff --git a/src/node_device/node_device_linux_sysfs.c 
b/src/node_device/node_device_linux_sysfs.c
index 6f438e5f3..b3f80a555 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -45,12 +45,6 @@
 
 VIR_LOG_INIT("node_device.node_device_linux_sysfs");
 
-int
-nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
-{
-return virNodeDeviceGetSCSIHostCaps(scsi_host);
-}
-
 
 int
 nodeDeviceSysfsGetSCSITargetCaps(const char *sysfsPath,
@@ -196,12 +190,6 @@ nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath,
 
 #else
 
-int
-nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host 
ATTRIBUTE_UNUSED)
-{
-return -1;
-}
-
 int nodeDeviceSysfsGetSCSITargetCaps(const char *sysfsPath ATTRIBUTE_UNUSED,
  virNodeDevCapSCSITargetPtr scsi_target 
ATTRIBUTE_UNUSED)
 {
diff --git a/src/node_device/node_device_linux_sysfs.h 
b/src/node_device/node_device_linux_sysfs.h
index 12cfe6341..9392d6934 100644
--- a/src/node_device/node_device_linux_sysfs.h
+++ b/src/node_device/node_device_linux_sysfs.h
@@ -25,7 +25,6 @@
 
 # include "node_device_conf.h"
 
-int nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host);
 int nodeDeviceSysfsGetSCSITargetCaps(const char *sysfsPath,
  virNodeDevCapSCSITargetPtr scsi_target);
 int nodeDeviceSysfsGetPCIRelatedDevCaps(const char *sysfsPath,
diff --git a/src/node_device/node_device_udev.c 
b/src/node_device/node_device_udev.c
index e0fca6159..4cc531d2c 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -781,7 +781,7 @@ udevProcessSCSIHost(struct udev_device *device 
ATTRIBUTE_UNUSED,
 return -1;
 }
 
-nodeDeviceSysfsGetSCSIHostCaps(>caps->data.scsi_host);
+virNodeDeviceGetSCSIHostCaps(>caps->data.scsi_host);
 
 if (udevGenerateDeviceName(device, def, NULL) != 0)
 return -1;
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list