Commit 641d5889 authored by Ritesh Sarraf's avatar Ritesh Sarraf

Imported Upstream version 2.2.9

parent 5ba9aaed
This document explains how to build the sourceforge
HBA API wraper library from source using the hbaapi_build
repository.
HBA API wraper library from source.
##
# HBA API Wrapper Library
......@@ -16,16 +15,7 @@ DEPENDENCIES
PROCESS
1) Obtain the source tarball from sourceforge
http://sourceforge.net/projects/hbaapi/
2) Untar the tarball and move its contents to hbaapi_build/
and change into its directory
# tar -xvzf hbaapi_src_2.2.tgz
# mv hbaapi_src_2.2/* hbaapi_build/
# rmdir hbaapi_src_2.2/
3) Bootstrap, configure, make and make install
1) Bootstrap, configure, make and make install
# ./bootstrap.sh
# rpm --eval "%configure" | sh
# make
......
......@@ -9,15 +9,9 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = HBAAPI.pc
dist_sysconf_DATA = hba.conf
dist_noinst_DATA = HBAAPILIB.c HBAAPI.pc.in libHBAAPI.spec hbaapi2.2.patch
hbaapilib.c: ${srcdir}/HBAAPILIB.c ${srcdir}/hbaapi2.2.patch
patch < hbaapi2.2.patch
cp ${srcdir}/HBAAPILIB.c $@
dist_noinst_DATA = HBAAPI.pc.in libHBAAPI.spec
clean-local:
-patch -R -N -r - < hbaapi2.2.patch
-rm -f hbaapilib.c
-if [ ${abs_srcdir} != ${abs_builddir} ]; then \
rm -f hba.conf; \
fi
......
AC_INIT([libHBAAPI], [2.2.5])
AC_INIT([libHBAAPI], [2.2.9], [fcoe-devel@open-fcoe.org])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
......
#
# This file contains names and references to HBA libraries
#
# Format:
#
# <library name> <library pathname>
#
# The library name should be prepended with the domain of
# the manufacturer or driver author.
#
# 32bit/64bit implementation note:
# If a 32bit implementation tries to load a 64 bit library,
# the load will fail with the result that the 64 bit vendor
# library is ignored.
# Likewise, if a 64bit implementation tries to load a 32 bit library,
# the load will fail with the result that the 32 bit vendor
# library is ignored.
org.snia.sample32 /usr/lib/libsample.so
com.qlogic.qla32 /usr/lib/libhbaapiqla.so
com.emulex.lightpulse32 /usr/lib/libhbaapiemu.so
com.emulex.lightpulse64 /usr/lib/sparcv9/libhbaapiemu.so
JniHbaLib /opt/JNIsnia/Solaris/Jni/32bit/JniHbaLib.so
JniHbaLib /opt/JNIsnia/Solaris/Jni/64bit/JniHbaLib.so
# Set a debug level (depends on compilation switches)
#
# Format:
#
# "debuglevel" <debug level>
#
# 0 is default, 1 show vendor library opens,
# 2 shows function calls, 3 shows callback events
#
# Uncomment the next line to specify a level
#debuglevel 3
This diff is collapsed.
--- HBAAPILIB.c 2011-11-22 10:56:03.767593438 -0800
+++ HBAAPILIB.c 2011-11-22 11:13:05.468590890 -0800
@@ -37,8 +37,12 @@
*/
#define HBAAPI_EXPORTS
#else
+#include <stddef.h>
#include <dlfcn.h>
+#include <stdlib.h>
#include <strings.h>
+#include <string.h>
+#define __USE_XOPEN
#endif
#include <stdio.h>
#include <time.h>
@@ -381,7 +385,7 @@
HBA_ALLADAPTERSCALLBACK_ELEM **lap;
HBA_ALLADAPTERSCALLBACK_ELEM *allcbp;
HBA_ADAPTERCALLBACK_ELEM *cbp;
- HBARemoveCallbackFunc registeredfunc;
+ HBARemoveCallbackFunc registeredfunc = NULL;
HBA_VENDORCALLBACK_ELEM *vhlp;
HBA_VENDORCALLBACK_ELEM *vnext;
int found;
@@ -395,7 +399,7 @@
GRAB_MUTEX(&_hbaapi_APSE_mutex);
GRAB_MUTEX(&_hbaapi_TE_mutex);
GRAB_MUTEX(&_hbaapi_LE_mutex);
- for(listp = cb_lists_array, found = 0; found == 0, *listp != NULL; listp++) {
+ for(listp = cb_lists_array, found = 0; *listp != NULL; listp++) {
lastp = *listp;
for(cbp=**listp; cbp != NULL; cbp = cbp->next) {
if(cbhandle != (HBA_CALLBACKHANDLE)cbp) {
@@ -455,6 +459,7 @@
return(status);
}
+#if defined(USESYSLOG) || defined(USELOGFILE)
static char wwn_str1[17];
static char wwn_str2[17];
static char wwn_str3[17];
@@ -471,8 +476,8 @@
}
return(buf);
}
+#endif
-
#ifdef WIN32
BOOL APIENTRY
DllMain( HANDLE hModule,
@@ -665,6 +670,7 @@
char hbaConfFilePath[256];
char *charPtr;
HBA_LIBRARY_INFO *lib_infop;
+ int duplicate = 0;
if(_hbaapi_librarylist != NULL) {
fprintf(stderr,
@@ -715,6 +721,30 @@
(strlen(librarypath) == 0)) {
continue;
}
+
+ /* Skip over duplicate library entries */
+ duplicate = 0;
+ for(lib_infop = _hbaapi_librarylist;
+ lib_infop != NULL;
+ lib_infop = lib_infop->next) {
+ if (strcmp(lib_infop->LibraryName, libraryname) == 0) {
+ fprintf(stderr, "Skipping duplicate entry for Library "
+ "name (%s) in %s\n",
+ libraryname, hbaConfFilePath);
+ duplicate = 1;
+ break;
+ } else if (strcmp(lib_infop->LibraryPath, librarypath) == 0) {
+ fprintf(stderr, "Skipping duplicate entry for Library "
+ "path (%s) in %s\n",
+ librarypath, hbaConfFilePath);
+ duplicate = 1;
+ break;
+ }
+ }
+ /* Duplicate found move to next */
+ if (duplicate)
+ continue;
+
/*
* Special case....
* Look for loglevel
@@ -820,6 +850,9 @@
/* successfully loaded library */
lib_infop->status = HBA_LIBRARY_LOADED;
}
+
+ fclose(hbaconf);
+
#endif /* WIN32 or UNIX */
#ifdef POSIX_THREADS
ret = pthread_mutex_init(&_hbaapi_LL_mutex, NULL);
@@ -859,8 +892,15 @@
InitializeCriticalSection(&_hbaapi_LE_mutex);
#endif
-
- return HBA_STATUS_OK;
+ /* At least one lib must be loaded */
+ status = HBA_STATUS_ERROR;
+ for(lib_infop = _hbaapi_librarylist; lib_infop != NULL; lib_infop = lib_infop->next) {
+ if (lib_infop->status == HBA_LIBRARY_LOADED) {
+ status = HBA_STATUS_OK;
+ break;
+ }
+ }
+ return status;
}
HBA_STATUS
@@ -1048,7 +1088,7 @@
if(adapt_infop == NULL) {
#ifndef WIN32
fprintf(stderr,
- "HBA_GetNumberOfAdapters: calloc failed on sizeof:%d\n",
+ "HBA_GetNumberOfAdapters: calloc failed on sizeof:%ld\n",
sizeof(HBA_ADAPTER_INFO));
#endif
RELEASE_MUTEX(&_hbaapi_AL_mutex);
@@ -1359,7 +1399,7 @@
if(cbp == NULL) {
#ifndef WIN32
fprintf(stderr,
- "HBA_RegisterForAdapterAddEvents: calloc failed for %d bytes\n",
+ "HBA_RegisterForAdapterAddEvents: calloc failed for %ld bytes\n",
sizeof(HBA_ALLADAPTERSCALLBACK_ELEM));
#endif
return HBA_STATUS_ERROR;
@@ -1399,7 +1439,7 @@
#ifndef WIN32
fprintf(stderr,
"HBA_RegisterForAdapterAddEvents: "
- "calloc failed for %d bytes\n",
+ "calloc failed for %ld bytes\n",
sizeof(HBA_VENDORCALLBACK_ELEM));
#endif
freevendorhandlelist(vendorhandlelist);
@@ -1535,7 +1575,7 @@
if(acbp == NULL) {
#ifndef WIN32
fprintf(stderr,
- "HBA_RegisterForAdapterEvents: calloc failed for %d bytes\n",
+ "HBA_RegisterForAdapterEvents: calloc failed for %ld bytes\n",
sizeof(HBA_ADAPTERCALLBACK_ELEM));
#endif
RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
@@ -1627,7 +1667,7 @@
#ifndef WIN32
fprintf(stderr,
"HBA_RegisterForAdapterPortEvents: "
- "calloc failed for %d bytes\n",
+ "calloc failed for %ld bytes\n",
sizeof(HBA_ADAPTERCALLBACK_ELEM));
#endif
RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
@@ -1720,7 +1760,7 @@
#ifndef WIN32
fprintf(stderr,
"HBA_RegisterForAdapterPortStatEvents: "
- "calloc failed for %d bytes\n",
+ "calloc failed for %ld bytes\n",
sizeof(HBA_ADAPTERCALLBACK_ELEM));
#endif
RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
@@ -1817,7 +1857,7 @@
if(acbp == NULL) {
#ifndef WIN32
fprintf(stderr,
- "HBA_RegisterForTargetEvents: calloc failed for %d bytes\n",
+ "HBA_RegisterForTargetEvents: calloc failed for %ld bytes\n",
sizeof(HBA_ADAPTERCALLBACK_ELEM));
#endif
RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
@@ -1912,7 +1952,7 @@
if(acbp == NULL) {
#ifndef WIN32
fprintf(stderr,
- "HBA_RegisterForLinkEvents: calloc failed for %d bytes\n",
+ "HBA_RegisterForLinkEvents: calloc failed for %ld bytes\n",
sizeof(HBA_ADAPTERCALLBACK_ELEM));
#endif
RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
--- ./hbaapi.h 2011-05-19 10:34:37.429915878 -0700
+++ ./hbaapi.h 2011-05-19 10:36:47.658915907 -0700
@@ -234,7 +234,7 @@
#define HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */
#define HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */
#define HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */
-#define HBA_PORTSPEED_NOT_NEGOTIATED 5 /* Speed not established */
+#define HBA_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Description
* hbasample.h - Header file for sample HBA API compliant vendor library
*
* License:
* The contents of this file are subject to the SNIA Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* /http://www.snia.org/English/Resources/Code/OpenSource.html
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Header file for
* SNIA HBA API Sample Vendor Specific Library
*
* The Initial Developer of the Original Code is:
* Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com)
*
* Contributor(s):
*
***************************************************************************
*/
#ifdef WIN32
#ifdef HBASAMPLE_EXPORTS
#define HBASAMPLE_API __declspec(dllexport)
#else
#define HBASAMPLE_API __declspec(dllimport)
#endif
#else
#define HBASAMPLE_API
#endif
HBASAMPLE_API HBA_STATUS HBA_RegisterLibrary( PHBA_ENTRYPOINTS entrypoints );
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment