142 lines
4.1 KiB
Diff
142 lines
4.1 KiB
Diff
--- HBAAPILIB.c 2010-01-21 16:46:34.000000000 -0800
|
|
+++ HBAAPILIB.c 2010-01-21 17:20:26.000000000 -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,
|
|
@@ -859,8 +864,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 +1060,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 +1371,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 +1411,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 +1547,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 +1639,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 +1732,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 +1829,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 +1924,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);
|