Re: [PATCH 10/11] util: Introduce virGetFCHostNameByFabricWWN

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

 



On Fri, Nov 18, 2016 at 09:26:36AM -0500, John Ferlan wrote:
Create a utility routine in order to read the scsi_host fabric_name files
looking for a match to a passed fabric_name

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
src/libvirt_private.syms |  1 +
src/util/virutil.c       | 86 ++++++++++++++++++++++++++++++++++++++++--------
src/util/virutil.h       |  4 +++
3 files changed, 78 insertions(+), 13 deletions(-)


diff --git a/src/util/virutil.c b/src/util/virutil.c
index a135819..fb72f2d 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -2166,6 +2166,18 @@ virManageVport(const int parent_host,
    return ret;
}

+# define READ_WWN(wwn_path, buf)                      \

This macro either jumps to a label or alters a third variable.
I don't think its scope should extend one function.

+    do {                                              \

+        if (virFileReadAll(wwn_path, 1024, &buf) < 0) \
+            goto cleanup;                             \

These two lines can be split out and with the STR{,N}EQ included,
this macro can be COMPARE_WWN, removing the need for changing
p. Or turned into a more complex function like virUSBSysReadFile.

+        if ((p = strchr(buf, '\n')))                  \
+            *p = '\0';                                \
+        if (STRPREFIX(buf, "0x"))                     \
+            p = buf + strlen("0x");                   \
+        else                                          \
+            p = buf;                                  \
+    } while (0)
+
/* virGetFCHostNameByWWN:
 *
 * Iterate over the sysfs tree to get FC host name (e.g. host5)

The rest looks good to me.

Jan

Attachment: signature.asc
Description: Digital signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux