Hello community,

here is the log from the commit of package libhbalinux2 for openSUSE:Factory 
checked in at 2013-09-13 14:45:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libhbalinux2 (Old)
 and      /work/SRC/openSUSE:Factory/.libhbalinux2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libhbalinux2"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libhbalinux2/libhbalinux2.changes        
2012-06-05 15:32:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libhbalinux2.new/libhbalinux2.changes   
2013-09-13 14:45:40.000000000 +0200
@@ -1,0 +2,16 @@
+Fri Sep 13 08:44:56 CEST 2013 - h...@suse.de
+
+- Updated to upstream version v1.0.15
+  * Build fixes
+  * Set SerialNumber to "Unknown" if not found
+  * Support for SCSI READ CAPACITY (16)
+  * PortSpeed and PortSupportedSpeed as bitmasks
+  * Use HBA_PORTTYPE values for PortType attribute
+  * Fix HBA_GetFcpTargetMappingV2 handler for small mapping buffer
+  * NumberOfPorts per Adapter count correction
+  * modify to match latest kernel /sys
+- Split off devel package
+- Remove 'libhbalinux-fix-issue-preventi'; merged with upstream
+- Update patches to apply
+
+-------------------------------------------------------------------

Old:
----
  libhbalinux-fix-issue-preventi
  libhbalinux-v1.0.8.tar.bz2

New:
----
  libhbalinux-v1.0.16.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libhbalinux2.spec ++++++
--- /var/tmp/diff_new_pack.TyfIcB/_old  2013-09-13 14:45:40.000000000 +0200
+++ /var/tmp/diff_new_pack.TyfIcB/_new  2013-09-13 14:45:40.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libhbalinux2
 #
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,15 +17,14 @@
 
 
 Name:           libhbalinux2
-Version:        1.0.8
+Version:        1.0.16
 Release:        0
 Summary:        FC-HBAAPI implementation using scsi_transport_fc interfaces
 License:        LGPL-2.0+
 Group:          System/Libraries
 Url:            http://www.open-fcoe.org
-Source0:        http://www.open-fcoe.org/openfc/libhbalinux-v%{version}.tar.bz2
+Source0:        libhbalinux-v%{version}.tar.bz2
 Patch0:         libhbalinux-remove-install-data-hook
-Patch1:         libhbalinux-fix-issue-preventi
 Patch2:         hbalinux-automake.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  autoconf
@@ -44,9 +43,19 @@
 --------
     Christoper Leech <christopher.le...@intel.com>
 
+%package        devel
+Summary:        FC-HBAAPI implementation using scsi_transport_fc interfaces
+Group:          System/Libraries
+Requires:       %{name} = %{version}-%{release}
+Requires:       pkgconfig
+
+%description    devel
+Development header files for FC-HBAAPI implementation
+
 %prep
 %setup -q -n libhbalinux-v%{version}
-%patch -P 0 -P 1 -P 2 -p1
+%patch0 -p1
+%patch2 -p1
 
 %build
 autoreconf --install
@@ -55,7 +64,7 @@
 
 %install
 make install DESTDIR="%buildroot"
-rm -f "%buildroot/%_libdir"/*.{la,so}
+rm -f "%buildroot/%_libdir"/*.la
 
 %post
 /sbin/ldconfig
@@ -84,4 +93,9 @@
 %doc COPYING
 %{_libdir}/*.so.*
 
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/*.pc
+
 %changelog

++++++ hbalinux-automake.diff ++++++
--- /var/tmp/diff_new_pack.TyfIcB/_old  2013-09-13 14:45:40.000000000 +0200
+++ /var/tmp/diff_new_pack.TyfIcB/_new  2013-09-13 14:45:40.000000000 +0200
@@ -1,18 +1,20 @@
-From: Jan Engelhardt <jeng...@inai.de>
-Date: 2012-05-29 12:26:09.399972892 +0200
+From ffa9f646bc594eb3eea997d90196fcb4ce90d6d1 Mon Sep 17 00:00:00 2001
+From: Hannes Reinecke <h...@suse.de>
+Date: Fri, 13 Sep 2013 08:30:28 +0200
+Subject: [PATCH] Fixup automake failure
 
-automake-1.12 wants AM_PROG_AR, and because this project uses
-"-Werror" that meant a failure for building with am 1.12.
----
- configure.ac |    3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
+automake >= 1.12 wants AM_PROG_AR, and because this project uses
+-Werror the build will fail.
 
-Index: libhbalinux-v1.0.8/configure.ac
-===================================================================
---- libhbalinux-v1.0.8.orig/configure.ac
-+++ libhbalinux-v1.0.8/configure.ac
-@@ -1,8 +1,9 @@
- AC_INIT([libhbalinux], [1.0.7], [de...@open-fcoe.org])
+Signed-off-by: Jan Engelhard <jeng...@inai.de>
+Signed-off-by: Hannes Reinecke <h...@suse.de>
+
+diff --git a/configure.ac b/configure.ac
+index 3a8ae4c..5a1b5e7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3,8 +3,9 @@ AC_INIT([libhbalinux], [1.0.16], [fcoe-de...@open-fcoe.org])
+ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  AM_INIT_AUTOMAKE([-Wall -Werror foreign])
  
 -AC_PROG_LIBTOOL

++++++ libhbalinux-remove-install-data-hook ++++++
--- /var/tmp/diff_new_pack.TyfIcB/_old  2013-09-13 14:45:40.000000000 +0200
+++ /var/tmp/diff_new_pack.TyfIcB/_new  2013-09-13 14:45:40.000000000 +0200
@@ -1,13 +1,24 @@
+From 56559ee5a001ee9f6a9a5fb8abbd7f80c4ced3bc Mon Sep 17 00:00:00 2001
+From: Hannes Reinecke <h...@suse.de>
+Date: Fri, 13 Sep 2013 08:37:05 +0200
+Subject: [PATCH] Remove install-data-hook from Makefile.am
+
+During build we should not install /etc/hba.conf; that will be
+done later during post-install.
+
+Signed-off-by: Hannes Reinecke <h...@suse.de>
+
 diff --git a/Makefile.am b/Makefile.am
-index b0ab765..47e8864 100644
+index 1349e7b..7c5ac14 100644
 --- a/Makefile.am
 +++ b/Makefile.am
-@@ -10,22 +10,3 @@ libhbalinux_la_LIBADD = $(PCIACCESS_LIBS)
- 
- dist_noinst_DATA = README COPYING INSTALL libhbalinux.spec
+@@ -12,23 +12,3 @@ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = libhbalinux.pc
  
+ dist_noinst_DATA = README COPYING INSTALL libhbalinux.pc.in libhbalinux.spec
+-
 -install-data-hook: libhbalinux.la
--      . $<; \
+-      . $${PWD}/$<; \
 -      ORG=org.open-fcoe.libhbalinux; \
 -      LIB=${libdir}/$${dlname}; \
 -      STR="$$ORG      $$LIB"; \

++++++ libhbalinux-v1.0.8.tar.bz2 -> libhbalinux-v1.0.16.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/Makefile.am 
new/libhbalinux-v1.0.16/Makefile.am
--- old/libhbalinux-v1.0.8/Makefile.am  2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/Makefile.am 2013-05-24 00:51:16.000000000 +0200
@@ -8,10 +8,13 @@
 libhbalinux_la_LDFLAGS = -version-info 2:2:0
 libhbalinux_la_LIBADD = $(PCIACCESS_LIBS)
 
-dist_noinst_DATA = README COPYING INSTALL libhbalinux.spec
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libhbalinux.pc
+
+dist_noinst_DATA = README COPYING INSTALL libhbalinux.pc.in libhbalinux.spec
 
 install-data-hook: libhbalinux.la
-       . $<; \
+       . $${PWD}/$<; \
        ORG=org.open-fcoe.libhbalinux; \
        LIB=${libdir}/$${dlname}; \
        STR="$$ORG      $$LIB"; \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/adapt_impl.h 
new/libhbalinux-v1.0.16/adapt_impl.h
--- old/libhbalinux-v1.0.8/adapt_impl.h 2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/adapt_impl.h        2013-05-24 00:51:16.000000000 
+0200
@@ -52,31 +52,6 @@
 #define MAX_DRIVER_NAME_LEN    20
 #define ARRAY_SIZE(a)          (sizeof(a)/sizeof((a)[0]))
 
-/* fc_port_type: copied from scsi_transport_fc.h */
-enum fc_port_type {
-       FC_PORTTYPE_UNKNOWN,
-       FC_PORTTYPE_OTHER,
-       FC_PORTTYPE_NOTPRESENT,
-       FC_PORTTYPE_NPORT,              /* Attached to FPort */
-       FC_PORTTYPE_NLPORT,             /* (Public) Loop w/ FLPort */
-       FC_PORTTYPE_LPORT,              /* (Private) Loop w/o FLPort */
-       FC_PORTTYPE_PTP,                /* Point to Point w/ another NPort */
-       FC_PORTTYPE_NPIV,               /* VPORT based on NPIV */
-};
-
-#define fc_enum_name_search(title, table_type, table) \
-static enum fc_port_type get_fc_##title##_value(const char *table_key) \
-{ \
-       int i; enum fc_port_type value = 0; \
-       for (i = 0; i < ARRAY_SIZE(table); i++) { \
-               if (!strcmp(table[i].name, table_key)) { \
-                       value = table[i].value; \
-                       break; \
-               } \
-       } \
-       return value; \
-}
-
 HBA_STATUS sysfs_get_port_stats(char *dir, HBA_PORTSTATISTICS *sp);
 HBA_STATUS sysfs_get_port_fc4stats(char *dir, HBA_FC4STATISTICS *fc4sp);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/bind.c 
new/libhbalinux-v1.0.16/bind.c
--- old/libhbalinux-v1.0.8/bind.c       2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/bind.c      2013-05-24 00:51:16.000000000 +0200
@@ -251,7 +251,7 @@
                        fcp->FcId = pp->ap_attr.PortFcId;
                        fcp->NodeWWN = pp->ap_attr.NodeWWN;
                        fcp->PortWWN = pp->ap_attr.PortWWN;
-                       fcp->FcpLun = (HBA_UINT64) lun << 48;
+                       fcp->FcpLun = (HBA_UINT64) lun;
                }
 
                /*
@@ -343,6 +343,8 @@
        memset(map->entry, 0, sizeof(map->entry[0]) * ctxt.oc_limit);
        sa_dir_read(SYSFS_LUN_DIR, get_binding_target_mapping, &ctxt);
        map->NumberOfEntries = ctxt.oc_count;
+       if (ctxt.oc_status == HBA_STATUS_OK && ctxt.oc_count > ctxt.oc_limit)
+               ctxt.oc_status = HBA_STATUS_ERROR_MORE_DATA;
        return ctxt.oc_status;
 }
 
@@ -364,11 +366,6 @@
        if (rp == NULL)
                return HBA_STATUS_ERROR_ILLEGAL_WWN;
 
-       /*
-        * Check for LUN more than 1023 or multi-level.
-        */
-       if (fc_lun & ((0xfc01ULL << 48) - 1))
-               return HBA_STATUS_ERROR;
        memset(&ctxt, 0, sizeof(ctxt));
        memset(&entry, 0, sizeof(entry));
        ctxt.oc_rport = rp;
@@ -377,7 +374,7 @@
        ctxt.oc_target = rp->ap_scsi_target;
        if (ctxt.oc_target == -1)
                return ENOENT;
-       ctxt.oc_lun = fc_lun >> 48;
+       ctxt.oc_lun = (int) fc_lun;
        ctxt.oc_limit = 1;
        ctxt.oc_ver = 1;
        ctxt.oc_entries = &entry;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/configure.ac 
new/libhbalinux-v1.0.16/configure.ac
--- old/libhbalinux-v1.0.8/configure.ac 2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/configure.ac        2013-05-24 00:51:16.000000000 
+0200
@@ -1,4 +1,6 @@
-AC_INIT([libhbalinux], [1.0.7], [de...@open-fcoe.org])
+AC_INIT([libhbalinux], [1.0.16], [fcoe-de...@open-fcoe.org])
+
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 
 AC_PROG_LIBTOOL
@@ -11,6 +13,6 @@
 PKG_CHECK_MODULES(HBAAPI, HBAAPI)
 AC_SUBST(HBAAPI_CFLAGS)
 
-AC_CONFIG_FILES([Makefile libhbalinux.spec])
+AC_CONFIG_FILES([Makefile libhbalinux.spec libhbalinux.pc])
 AC_OUTPUT
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/libhbalinux.pc.in 
new/libhbalinux-v1.0.16/libhbalinux.pc.in
--- old/libhbalinux-v1.0.8/libhbalinux.pc.in    1970-01-01 01:00:00.000000000 
+0100
+++ new/libhbalinux-v1.0.16/libhbalinux.pc.in   2013-05-24 00:51:16.000000000 
+0200
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libhbalinux
+Description: SNIA HBA API vendor library for Linux
+Version: @VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -ldl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/lport.c 
new/libhbalinux-v1.0.16/lport.c
--- old/libhbalinux-v1.0.8/lport.c      2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/lport.c     2013-05-24 00:51:16.000000000 +0200
@@ -34,24 +34,19 @@
 #define HBA_VENDOR_SPECIFIC_ID  0
 
 /*
- * Convert fc_port_type values to ascii string name.
- * (This table is copied from scsi_transport_fc.c).
+ * table of /sys port types strings to HBA-API values.
  */
-static struct {
-       enum fc_port_type       value;
-       char                    *name;
-} port_types_table[] = {
-    { FC_PORTTYPE_UNKNOWN,     "Unknown" },
-    { FC_PORTTYPE_OTHER,       "Other" },
-    { FC_PORTTYPE_NOTPRESENT,  "Not Present" },
-    { FC_PORTTYPE_NPORT,       "NPort (fabric via point-to-point)" },
-    { FC_PORTTYPE_NLPORT,      "NLPort (fabric via loop)" },
-    { FC_PORTTYPE_LPORT,       "LPort (private loop)" },
-    { FC_PORTTYPE_PTP,         "Point-To-Point (direct nport connection)" },
-    { FC_PORTTYPE_NPIV,        "NPIV VPORT" },
+struct sa_nameval port_types_table[] = {
+       { "Unknown",            HBA_PORTTYPE_UNKNOWN },
+       { "Other",              HBA_PORTTYPE_OTHER },
+       { "Not Present",        HBA_PORTTYPE_NOTPRESENT },
+       { "NPort (fabric via point-to-point)",  HBA_PORTTYPE_NPORT },
+       { "NLPort (fabric via loop)",   HBA_PORTTYPE_NLPORT },
+       { "LPort (private loop)",       HBA_PORTTYPE_LPORT },
+       { "Point-To-Point (direct nport connection)",   HBA_PORTTYPE_PTP },
+       {  "NPIV VPORT",        HBA_PORTTYPE_NPORT },
+       { NULL, 0 }
 };
-fc_enum_name_search(port_type, fc_port_type, port_types_table)
-#define FC_PORTTYPE_MAX_NAMELEN         50
 
 /*
  * table of /sys port state strings to HBA-API values.
@@ -74,15 +69,57 @@
  * table of /sys port speed strings to HBA-API values.
  */
 struct sa_nameval port_speeds_table[] = {
-       { "10 Gbit",        HBA_PORTSPEED_10GBIT },
-       { "2 Gbit",         HBA_PORTSPEED_2GBIT },
+       { "Unknown",        HBA_PORTSPEED_UNKNOWN },
        { "1 Gbit",         HBA_PORTSPEED_1GBIT },
+       { "2 Gbit",         HBA_PORTSPEED_2GBIT },
+       { "10 Gbit",        HBA_PORTSPEED_10GBIT },
        { "Not Negotiated", HBA_PORTSPEED_NOT_NEGOTIATED },
-       { "Unknown",        HBA_PORTSPEED_UNKNOWN },
        { NULL, 0 }
 };
 
 /*
+ * parse strings from /sys port speed/support_speeds files
+ * and convert them to bitmasks for the HBA_PORTSPEED supported
+ * Format expected: "1 Gbit[, 10 Gbit]", etc.
+ */
+static int sys_read_speed(const char *dir, const char *file, char *buf,
+                         size_t buflen, HBA_PORTSPEED *speeds)
+{
+       int rc = 0;
+       u_int32_t val = 0;
+       int len = 0;
+       char *cp;
+       struct sa_nameval *tp = port_speeds_table;
+
+       rc = sa_sys_read_line(dir, file, buf, buflen);
+       if (rc == 0 && strstr(buf, "Unknown") == NULL) {
+               for (cp = buf; *cp != '\0';) {
+                       for (; tp->nv_name != NULL; tp++) {
+                               len = strlen(tp->nv_name);
+                               if (strncasecmp(tp->nv_name, cp, len) == 0) {
+                                       val |= tp->nv_val;
+                                       cp += len;
+                                       break;
+                               }
+                       }
+                       if (*cp == '\0')
+                               break;
+                       if (*cp == ',') {
+                               cp++;
+                               if (*cp == ' ')
+                                       cp++;
+                       }
+                       else
+                               break; /* invalid string */
+               }
+       }
+
+       *speeds = val;
+
+       return rc;
+}
+
+/*
  * Code for OpenFC-supported adapters.
  */
 
@@ -98,31 +135,21 @@
 }
 
 static int
-check_ifmac(struct dirent *dp, void *arg)
+check_ifindex(struct dirent *dp, void *arg)
 {
-       char *address = (char *)arg;
+       char *ifindex = (char *)arg;
        char hba_dir[256];
        char buf[256];
-       int len, i, rc;
+       int rc;
 
        snprintf(hba_dir, sizeof(hba_dir),
                 SYSFS_HBA_DIR "/%s", dp->d_name);
-       i = readlink(hba_dir, buf, sizeof(buf) - 1);
-       if (i < 0) {
-               printf("readlink %s failed\n", hba_dir);
-               return 0;
-       }
-       buf[i] = '\0';
-       if (strstr(buf, "/virtual/net/"))
-               return 0;       /* skip virtual devices */
-
        memset(buf, 0, sizeof(buf));
-       rc = sa_sys_read_line(hba_dir, "address", buf, sizeof(buf));
+       rc = sa_sys_read_line(hba_dir, "ifindex", buf, sizeof(buf) - 1);
        if (rc)
                return 0;
-       len = strnlen(buf, sizeof(buf));
-       if (!strncmp(address, buf, len)) {
-               strncpy(address, dp->d_name, len);
+       if (!strncmp(ifindex, buf, sizeof(buf))) {
+               strcpy(arg, dp->d_name);
                return 1;
        }
        return 0;
@@ -130,7 +157,7 @@
 
 /*
  * find_phys_if - find the regular network interface name that
- *                has the same mac address as the VLAN interface.
+ *                has the ifindex that matches the specified iflink.
  *                This ifname will be used to find the PCI info
  *                of a VLAN interface.
  * hba_dir: hba_dir of VLAN interface.
@@ -141,15 +168,14 @@
 {
        int rc;
 
-       /* Get the mac address of VLAN interface */
-       rc = sa_sys_read_line(hba_dir, "address", buf, len);
+       rc = sa_sys_read_line(hba_dir, "iflink", buf, len);
        if (rc)
                return 1;
        /*
         * Search for the regular network interface and
         * return the interface name in the buf.
         */
-       sa_dir_read(SYSFS_HBA_DIR, check_ifmac, buf);
+       sa_dir_read(SYSFS_HBA_DIR, check_ifindex, buf);
        return 0;
 }
 
@@ -163,11 +189,14 @@
        struct adapter_info *ap;
        struct port_info *pp;
        char host_dir[80], hba_dir[80], drv_dir[80];
+       char dev_dir[128];
        char ifname[20], buf[256];
        char *driverName;
        int data[32], rc, i;
        char *cp;
        char *saveptr;  /* for strtok_r */
+       unsigned int ifindex;
+       unsigned int iflink;
 
        memset(&hba_info, 0, sizeof(hba_info));
 
@@ -225,12 +254,13 @@
                goto skip;
 
        /*
-        * See if host_dir is a PCI device directory
+        * See if <host_dir>/device is a PCI symlink.
         * If not, try it as a net device.
         */
-       i = readlink(host_dir, buf, sizeof(buf) - 1);
+       snprintf(dev_dir, sizeof(dev_dir), "%s/device", host_dir);
+       i = readlink(dev_dir, buf, sizeof(buf) - 1);
        if (i < 0)
-               goto skip;
+               i = 0;
        buf[i] = '\0';
 
        if (strstr(buf, "devices/pci") && !strstr(buf, "/net/")) {
@@ -241,35 +271,30 @@
                sa_strncpy_safe(ifname, sizeof(ifname), cp, strlen(cp));
                snprintf(hba_dir, sizeof(hba_dir),
                         SYSFS_HBA_DIR "/%s", ifname);
-               i = readlink(hba_dir, buf, sizeof(buf) - 1);
-               if (i < 0) {
-                       printf("readlink %s failed\n", hba_dir);
+               /*
+                * Try as VLAN device or other virtual net device.
+                * If this is the case, ifindex and iflink will be different.
+                * iflink is the ifindex of the physical device.
+                */
+               rc = sa_sys_read_u32(hba_dir, "ifindex", &ifindex);
+               if (rc < 0)
                        goto skip;
-               }
-               buf[i] = '\0';
-               if (strstr(buf, "/virtual/net/")) {
-                       memset(buf, 0, sizeof(buf));
+               rc = sa_sys_read_u32(hba_dir, "iflink", &iflink);
+               if (rc < 0)
+                       goto skip;
+               if (ifindex != iflink) {
                        rc = find_phys_if(hba_dir, buf, sizeof(buf));
                        if (rc)
                                goto skip;
-                       snprintf(hba_dir, sizeof(hba_dir),
-                                SYSFS_HBA_DIR "/%s", buf);
-                       i = readlink(hba_dir, buf, sizeof(buf) - 1);
-                       if (i < 0) {
-                               printf("readlink %s failed\n", hba_dir);
-                               goto skip;
-                       }
-                       buf[i] = '\0';
+                       strncpy(ifname, buf, sizeof(ifname));
                }
-               /*
-                * A sample link value here is like:
-                *      ../../devices/pci*.../0000:03:00.0/net/eth2
-                */
-               cp = strstr(buf, "/net/");
-               if (!cp)
+
+               snprintf(hba_dir, sizeof(hba_dir),
+                        SYSFS_HBA_DIR "/%s/device", ifname);
+               i = readlink(hba_dir, buf, sizeof(buf) - 1);
+               if (i < 0)
                        goto skip;
-               *cp = '\0';
-               strcat(hba_dir, "/device");
+               buf[i] = '\0';
        }
 
        /*
@@ -313,20 +338,21 @@
 
        /* Get PortType */
        rc = sa_sys_read_line(pp->host_dir, "port_type", buf, sizeof(buf));
-       pap->PortType = get_fc_port_type_value(buf);
+       rc = sa_enum_encode(port_types_table, buf, &pap->PortType);
 
        /* Get PortState */
        rc = sa_sys_read_line(pp->host_dir, "port_state", buf, sizeof(buf));
        rc = sa_enum_encode(port_states_table, buf, &pap->PortState);
 
        /* Get PortSpeed */
-       rc = sa_sys_read_line(pp->host_dir, "speed", buf, sizeof(buf));
-       rc = sa_enum_encode(port_speeds_table, buf, &pap->PortSpeed);
+       rc = sys_read_speed(pp->host_dir, "speed",
+                               buf, sizeof(buf),
+                               &pap->PortSpeed);
 
        /* Get PortSupportedSpeed */
-       rc = sa_sys_read_line(pp->host_dir, "supported_speed",
-                               buf, sizeof(buf));
-       rc = sa_enum_encode(port_speeds_table, buf, &pap->PortSupportedSpeed);
+       rc = sys_read_speed(pp->host_dir, "supported_speeds",
+                               buf, sizeof(buf),
+                               &pap->PortSupportedSpeed);
 
        /* Get PortMaxFrameSize */
        rc = sa_sys_read_line(pp->host_dir, "maxframe_size", buf, sizeof(buf));
@@ -368,7 +394,10 @@
        /* Get PortSupportedClassofService */
        rc = sa_sys_read_line(pp->host_dir, "supported_classes",
                                buf, sizeof(buf));
-       pap->PortSupportedClassofService = *(strstr(buf, "Class") + 6) - '0';
+
+       cp = strstr(buf, "Class");
+       if (cp)
+               pap->PortSupportedClassofService = *(cp + 6) - '0';
 
        /* Get OSDeviceName */
        sa_strncpy_safe(pap->OSDeviceName, sizeof(pap->OSDeviceName),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/pci.c 
new/libhbalinux-v1.0.16/pci.c
--- old/libhbalinux-v1.0.8/pci.c        2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/pci.c       2013-05-24 00:51:16.000000000 +0200
@@ -34,6 +34,10 @@
        u_int32_t dword_high = 0;
        int rc;
 
+       /* Default */
+       snprintf(hba_info->SerialNumber,
+                sizeof(hba_info->SerialNumber),
+                "Unknown");
        /*
         * Read the Status Register in the PCIe configuration
         * header space to see if the PCI Capability List is
@@ -153,7 +157,6 @@
 {
        const char *name;
        u_int8_t revision;
-       u_int8_t hdr_type;
        char *unknown = "Unknown";
 
        name = pci_device_get_vendor_name(dev);
@@ -179,15 +182,7 @@
                 sizeof(hba_info->HardwareVersion),
                 "%02x", revision);
 
-       /*
-        * Determine if the HBA is a single-function
-        * or multi-function adapter.
-        */
-       pci_device_cfg_read_u8(dev, &hdr_type, PCI_HEADER_TYPE);
-       if (hdr_type == 0x80)
-               hba_info->NumberOfPorts = 2;
-       else
-               hba_info->NumberOfPorts = 1;
+       hba_info->NumberOfPorts = 1;
 
        /*
         * Searching for serial number in PCIe extended
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/rport.c 
new/libhbalinux-v1.0.16/rport.c
--- old/libhbalinux-v1.0.8/rport.c      2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/rport.c     2013-05-24 00:51:16.000000000 +0200
@@ -80,7 +80,7 @@
        rc |= sys_read_wwn(rport_dir, "port_name", &rpa->PortWWN);
        rc |= sa_sys_read_u32(rport_dir, "port_id", &rpa->PortFcId);
        rc |= sa_sys_read_u32(rport_dir, "scsi_target_id", &rp->ap_scsi_target);
-       rc |= sa_sys_read_line(rport_dir, "maxframe_size", buf, sizeof(buf));
+       sa_sys_read_line(rport_dir, "maxframe_size", buf, sizeof(buf));
        sscanf(buf, "%d", &rpa->PortMaxFrameSize);
        rc |= sys_read_port_state(rport_dir, "port_state", &rpa->PortState);
        rc |= sys_read_classes(rport_dir, "supported_classes",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/sg.c new/libhbalinux-v1.0.16/sg.c
--- old/libhbalinux-v1.0.8/sg.c 2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/sg.c        2013-05-24 00:51:16.000000000 +0200
@@ -167,6 +167,7 @@
 {
        struct sg_io_hdr hdr;
        struct scsi_rcap10 cmd;
+       struct scsi_rcap16 cmd_16;
        size_t len;
        int fd;
        int rc;
@@ -180,17 +181,31 @@
                return errno;
        }
        memset(&hdr, 0, sizeof(hdr));
-       memset(&cmd, 0, sizeof(cmd));
 
-       cmd.rc_op = SCSI_OP_READ_CAP10;
+       /* If the response buffer size is enough to
+        * accomodate READ CAPACITY(16) response issue
+        * SCSI READ CAPACITY(16) else issue
+        * SCSI READ CAPACITY(10)
+        */
+       if (len >= sizeof(struct scsi_rcap16_resp)) {
+               memset(&cmd_16, 0, sizeof(cmd_16));
+               cmd_16.rc_op = SCSI_OP_SA_IN_16;
+               cmd_16.rc_sa = SCSI_SA_READ_CAP16;
+               ua_net32_put(&cmd_16.rc_alloc_len, len);
+               hdr.cmd_len = sizeof(cmd_16);
+               hdr.cmdp = (unsigned char *) &cmd_16;
+       } else {
+               memset(&cmd, 0, sizeof(cmd));
+               cmd.rc_op = SCSI_OP_READ_CAP10;
+               hdr.cmd_len = sizeof(cmd);
+               hdr.cmdp = (unsigned char *) &cmd;
+       }
 
        hdr.interface_id = 'S';
        hdr.dxfer_direction = SG_DXFER_FROM_DEV;
-       hdr.cmd_len = sizeof(cmd);
        hdr.mx_sb_len = *sense_lenp;
        hdr.dxfer_len = len;
        hdr.dxferp = (unsigned char *) resp;
-       hdr.cmdp = (unsigned char *) &cmd;
        hdr.sbp = (unsigned char *) sense;
        hdr.timeout = UINT_MAX;
        hdr.timeout = 3000;                     /* mS to wait for result */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libhbalinux-v1.0.8/utils.h 
new/libhbalinux-v1.0.16/utils.h
--- old/libhbalinux-v1.0.8/utils.h      2009-07-14 19:14:50.000000000 +0200
+++ new/libhbalinux-v1.0.16/utils.h     2013-05-24 00:51:16.000000000 +0200
@@ -23,7 +23,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
-#include <linux/types.h>
+#include <sys/types.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <stddef.h>

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to