fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HBAAPILIB.c - Implements a sample common (wrapper) HBA API library
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the SNIA Public License
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Version 1.0 (the "License"); you may not use this file except in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compliance with the License. You may obtain a copy of the License at
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * /http://www.snia.org/English/Resources/Code/OpenSource.html
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Software distributed under the License is distributed on an "AS IS"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the License for the specific language governing rights and limitations
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The Original Code is SNIA HBA API Wrapper Library
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The Initial Developer of the Original Code is:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Contributor(s):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Tuan Lam, QLogic Corp. (t_lam@qlc.com)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dan Willie, Emulex Corp. (Dan.Willie@emulex.com)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dixon Hutchinson, Legato Systems, Inc. (dhutchin@legato.com)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * David Dillard, VERITAS Software Corp. (david.dillard@veritas.com)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Next define forces entry points in the dll to be exported
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See hbaapi.h to see what it does.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * LIBRARY_NUM is a shortcut to figure out which library we need to call.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The top 16 bits of handle are the library index
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * VENDOR_HANDLE turns a global library handle into a vendor specific handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with all upper 16 bits set to 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte openlog("HBAAPI", LOG_PID|LOG_ODELAY ,LOG_USER);\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(_hbaapi_debug_fd, (STR ## "\n"), (A1), (A2), (A3));\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* WIN32*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte openlog("HBAAPI", LOG_PID|LOG_ODELAY ,LOG_USER);\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _hbaapi_debug_fd = fopen("/tmp/HBAAPI.log", "a");\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(_hbaapi_debug_fd, (STR ## "\n"), (A1), (A2), (A3));\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* WIN32*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* Not both USESYSLOG and USELOGFILE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte openlog("HBAAPI", LOG_PID|LOG_ODELAY ,LOG_USER);\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* USESYSLOG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* WIN32 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _hbaapi_debug_fd = fopen("/tmp/HBAAPI.log", "a");\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(_hbaapi_debug_fd, (STR) ## "\n", (A1), (A2), (A3));\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* WIN32 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* USELOGFILE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* Not both USELOGFILE and USESYSLOG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When multiple mutex's are grabed, they must be always be grabbed in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the same order, or deadlock can result. There are three levels
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of mutex's involved in this API. If LL_mutex is grabbed, always grap
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * it first. If AL_mutex is grabbed, it may not be grabbed before
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * LL_mutex. If grabbed in a multi grab sequence, the mutex's protecting
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the callback lists must always be grabbed last and release before calling
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a vendor specific library function that might invoke a callback function
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * on the same thread.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RELEASE_MUTEX_RETURN(M,RET) release_mutex(M); return(RET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RELEASE_MUTEX_RETURN(m, RET) LeaveCriticalSection(m); return(RET)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Vendor library information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA_ENTRYPOINTSV2 functionTable; /* Function pointers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA_LIBRARY_STATUS status; /* info on this library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_LL_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Individual adapter (hba) information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA_STATUS GNstatus; /* status from GetAdapterNameFunc */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_AL_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Call back registration
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each instance of HBA_ADAPTERCALLBACK_ELEM represents a call to one of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * "register" functions that apply to a particular adapter.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HBA_ALLADAPTERSCALLBACK_ELEM is used just for HBA_RegisterForAdapterAddEvents
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ALLADAPTERSCALLBACK_ELEM *_hbaapi_adapteraddevents_callback_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ADAPTERCALLBACK_ELEM *_hbaapi_adapterevents_callback_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ADAPTERCALLBACK_ELEM *_hbaapi_adapterportevents_callback_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ADAPTERCALLBACK_ELEM *_hbaapi_adapterportstatevents_callback_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ADAPTERCALLBACK_ELEM *_hbaapi_targetevents_callback_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ADAPTERCALLBACK_ELEM *_hbaapi_linkevents_callback_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ADAPTERCALLBACK_ELEM *_hbaapi_adapterdeviceevents_callback_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* mutex's to protect each list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_AAE_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_AE_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_APE_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_APSE_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_TE_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepthread_mutex_t _hbaapi_LE_mutex = PTHREAD_MUTEX_INITIALIZER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common library internal. Mutex handling
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(0, "pthread_mutex_lock returned %d", ret, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(0, "pthread_mutex_unlock returned %d", ret, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common library internal. Check library and return vendorhandle
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* caller will release the mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR_INVALID_HANDLE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = HBA_CheckLibrary(handle, &lib_infop, &vendorHandle);\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *freevendorhandlelist is called with _hbaapi_LL_mutex already held
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefreevendorhandlelist(HBA_VENDORCALLBACK_ELEM *vhlist) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vhlp->lib_info->functionTable.RemoveCallbackHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortelocal_remove_callback(HBA_CALLBACKHANDLE cbhandle) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA_STATUS status = HBA_STATUS_ERROR_INVALID_HANDLE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* search through the simple lists first */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(listp = cb_lists_array, found = 0; found == 0, *listp != NULL; listp++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = cbp->lib_info->functionTable.RemoveCallbackHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if it wasnt in the simple lists, look in the list for adapteraddevents */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(allcbp = _hbaapi_adapteraddevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(vhlp = allcbp->vendorhandlelist; vhlp != NULL; vhlp = vnext) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vhlp->lib_info->functionTable.RemoveCallbackHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char *pc = (unsigned char *)&(wwn->wwn[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Read in the config file and load all the specified vendor specific
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * libraries and perform the function registration exercise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Open configuration file from known location */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* this is an app programming error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\SNIA\\HBA",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, configuration error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Enumerate all the subkeys. These have the form:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HKLM\Software\SNIA\HBA\<Vendor id> - note that we don't care
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * what the vendor id is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; ; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break; /* we're done */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (lStatus == ERROR_MORE_DATA) { /* buffer not big enough */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* do whatever */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now open the subkey that pertains to this vendor's library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lStatus = RegOpenKeyEx(hkSniaHba, cSubKeyName, 0, KEY_READ,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, installation error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return HBA_STATUS_ERROR; /* you may want to return something
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * else or keep trying */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* The name of the library is contained in a REG_SZ Value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * keyed to "LibraryFile" */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lStatus = RegQueryValueEx(hkVendorLib, "LibraryFile", NULL, &dwType,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, installation error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop = (HBA_LIBRARY_INFO *)calloc(1, sizeof(HBA_LIBRARY_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* what is the right thing to do in MS land??? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, installation error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now I can try to load the library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* printf("unable to load library %s\n", librarypath); */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, installation error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(1, "HBAAPI loading: %s\n", byFileName, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Call the registration function to get the list of pointers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(lib_infop->hLibrary, "HBA_RegisterLibraryV2");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load the function pointers directly into
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the table of functions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ((RegisterV2Func)(&lib_infop->functionTable));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* library not loaded */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, library error? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Maybe the vendor library is only Rev1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetProcAddress(lib_infop->hLibrary, "HBA_RegisterLibrary");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, library error? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load the function points directly into
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the Rev 2 table of functions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (HBA_ENTRYPOINTS *)(&lib_infop->functionTable)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* library not loaded */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, library error? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* successfully loaded library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetVersionFunc = lib_infop->functionTable.GetVersionHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, library error? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check the version of this library before loading */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Actually... This wrapper is compatible with version 1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef NOTDEF /* save for a later time... when it matters */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LoadLibraryFunc = lib_infop->functionTable.LoadLibraryHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Hmmm, dont we need to flag this in a realy big way??? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* How about messages to the system event logger ??? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, library error? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Initialize this library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ???Opportunity to send error msg, library error? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* successfully loaded library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dud_library: /* its also just the end of the loop */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* Unix as opposed to Win32 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fullline[512]; /* line read from HBA.conf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *libraryname; /* Read in from file HBA.conf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *librarypath; /* Read in from file HBA.conf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_LoadLibrary: previously unfreed "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "libraries exist, call HBA_FreeLibrary().\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((hbaconf = fopen(hbaConfFilePath, "r")) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Read in each line and load library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((hbaconf != NULL) && (fgets(fullline, sizeof(fullline), hbaconf))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Skip the comments... */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fullline[0] == '#') || (fullline[0] == '\n')) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* grab first 'thing' in line (if its there)*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((libraryname = strtok(fullline, " \t\n")) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "Library name(%s) in %s is > 64 characters\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* grab second 'thing' in line (if its there)*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((librarypath = strtok(NULL, " \t\n")) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "Library path(%s) in %s is > 256 characters\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* there should be no more 'things' in the line */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "Extraneous characters (\"%s\") in %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Continue to the next line if library name or path is invalid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Special case....
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Look for loglevel
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _hbaapi_debuglevel = strtol(librarypath, NULL, 10);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* error handling does the right thing automagically */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop = (HBA_LIBRARY_INFO *)calloc(1, sizeof(HBA_LIBRARY_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fprintf(stderr, "HBA_LoadLibrary: out of memeory\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load the DLL now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((lib_infop->hLibrary = dlopen(librarypath,RTLD_LAZY)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*printf("unable to load library %s\n", librarypath); */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Call the registration function to get the list of pointers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(lib_infop->hLibrary, "HBA_RegisterLibraryV2");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load the function points directly into
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the table of functions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ((RegisterV2Func)(&lib_infop->functionTable));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* library not loaded */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Maybe the vendor library is only Rev1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlsym(lib_infop->hLibrary, "HBA_RegisterLibrary");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This function is required */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_LoadLibrary: vendor specific RegisterLibrary "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(0, "HBA_LoadLibrary: vendor specific RegisterLibrary "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "function not found. lib: %s\n", librarypath, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load the function points directly into
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the table of functions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((HBA_ENTRYPOINTS *)(&lib_infop->functionTable)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* library not loaded */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_LoadLibrary: vendor specific RegisterLibrary "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "function encountered an error. lib: %s\n", librarypath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(0, "HBA_LoadLibrary: vendor specific RegisterLibrary "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "function encountered an error. lib: %s\n", librarypath, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* successfully loaded library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((GetVersionFunc = lib_infop->functionTable.GetVersionHandler)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check the version of this library before loading */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Actually... This wrapper is compatible with version 1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef NOTDEF /* save for a later time... when it matters */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf("Library version mismatch. Got %d expected %d.\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(1, "%s libversion = %d", librarypath, libversion, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LoadLibraryFunc = lib_infop->functionTable.LoadLibraryHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* this function is required */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_LoadLibrary: vendor specific LoadLibrary "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(0, "HBA_LoadLibrary: vendor specific LoadLibrary "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "function not found. lib: %s\n", librarypath, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Initialize this library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((status = ((LoadLibraryFunc)())) != HBA_STATUS_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* maybe this should be a printf so that we CANNOT miss it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_LoadLibrary: Encounterd and error loading: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(0, "Encounterd and error loading: %s", librarypath, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* successfully loaded library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* WIN32 or UNIX */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_LL_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_AL_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_AAE_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_AE_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_APE_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_APSE_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_TE_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = pthread_mutex_init(&_hbaapi_LE_mutex, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(lib_infop = _hbaapi_librarylist; lib_infop != NULL; lib_infop = lib_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeLibraryFunc = lib_infop->functionTable.FreeLibraryHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Free this library */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FreeLibrary(lib_infop->hLibrary); /* Unload DLL from memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dlclose(lib_infop->hLibrary); /* Unload DLL from memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* OK, now all functions are disabled except for LoadLibrary,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Hope no other thread calls it before we have returned */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Free up the callbacks, this is not the most efficient, but it works */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while((volatile HBA_ADAPTERCALLBACK_ELEM *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(listp = cb_lists_array; *listp != NULL; listp++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while((volatile HBA_ADAPTERCALLBACK_ELEM ***)**listp != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte local_remove_callback((HBA_CALLBACKHANDLE)**listp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* this will unlock them as well, but who cares */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The API used to use fixed size tables as its primary data structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Indexing from 1 to N identified each adapters. Now the adapters are
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * on a linked list. There is a unique "index" foreach each adapter.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Adapters always keep their index, even if they are removed from the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hardware. The only time the indexing is reset is on HBA_FreeLibrary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GRAB_MUTEX(&_hbaapi_LL_mutex); /* pay attention to order */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetNumberOfAdaptersHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Also get the names of all the adapters here and cache */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetAdapterNameFunc = lib_infop->functionTable.GetAdapterNameHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < num_adapters; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = (GetAdapterNameFunc)(j, (char *)&adaptername);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * check for duplicates, really, this may just be a second
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * call to this function
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ??? how do we know when a name becomes stale?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if(strcmp(adaptername, adapt_infop->name) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* already got this one */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_GetNumberOfAdapters: calloc failed on sizeof:%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((adapt_infop->GNstatus = status) == HBA_STATUS_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->LibraryPath, _hbaapi_total_adapter_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte adapt_infop->index = _hbaapi_total_adapter_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, _hbaapi_total_adapter_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The adapter index is from old code, but we have
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to support it. Go down the list looking for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the adapter
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "GetAdapterName for index:%d ->%s", adapterindex, adaptername, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(adaptername, adapt_infop->name) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* retrieve the vendor handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* or this with the library index to get the common handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte handle = HBA_HANDLE_FROM_LOCAL(lib_infop->index, handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This function ignores the list of known adapters and instead tries
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * each vendors open function to see if one of them
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * can open an adapter when referenced with a particular WWN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_OpenAdapterByWWN(HBA_HANDLE *phandle, HBA_WWN nodeWWN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "OpenAdapterByWWN: %s", WWN2STR1(&nodeWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetNumberOfAdaptersHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* look for new hardware */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OpenAdapterFunc = lib_infop->functionTable.OpenAdapterByWWNHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do not know if the WWN is known by this vendor,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * just try it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((status = (OpenAdapterFunc)(&handle, nodeWWN)) != HBA_STATUS_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* OK, make a vendor non-specific handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *phandle = HBA_HANDLE_FROM_LOCAL(lib_infop->index, handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RefreshAdapterConfiguration", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This function is VERY OS dependent. Wing it as best you can.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetWrapperLibraryAttributes", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(attributes, 0, sizeof(HBA_LIBRARYATTRIBUTES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if((handle = dlopen("libHBAAPI.so", RTLD_NOW)) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* No need to do anything with the module handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* It wasn't alloocated so it doesn't need to be freed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ( GetModuleFileName(module, attributes->LibPath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte matchCount = sscanf(BUILD_DATE, "%u/%u/%u %u:%u:%u",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&attributes->build_date, 0, sizeof(struct tm));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if(strptime(BUILD_DATE, "%Y/%m/%d %T %Z", &(attributes->build_date)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&attributes->build_date, 0, sizeof(struct tm));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&attributes->build_date, 0, sizeof(struct tm));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Callback registation and handling
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_RemoveCallback (HBA_CALLBACKHANDLE cbhandle) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Adapter Add Events *********************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteadapteraddevents_callback (void *data, HBA_WWN PortWWN, HBA_UINT32 eventType) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(3, "AddAdapterEvent, port:%s", WWN2STR1(&PortWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(cbp = _hbaapi_adapteraddevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*cbp->callback)(data, PortWWN, HBA_EVENT_ADAPTER_ADD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBARegisterForAdapterAddEventsFunc registeredfunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RegisterForAdapterAddEvents", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterAddEvents: calloc failed for %d bytes\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cbp->next = _hbaapi_adapteraddevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Need to release the mutex now incase the vendor function invokes the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback. We will grap the mutex later to attach the vendor handle list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the callback structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * now create a list of vendors (vendor libraryies, NOT ADAPTERS) that have
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * successfully registerred
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.RegisterForAdapterAddEventsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterAddEvents: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "calloc failed for %d bytes\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = (registeredfunc)(adapteraddevents_callback,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterAddEvents: Library->%s, Error->%d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterAddEvents: Library->%s, Error->%d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status_OK_cnt == 0 && not_supported_cnt != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (status_OK_cnt == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* At least one vendor library registered this function, but no
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * vendor call succeeded */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we have had atleast some success, now finish up */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* this seems silly, but what if another thread called
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the callback remove */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(cbp = _hbaapi_adapteraddevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* yup, its still there, hooray */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* bummer, somebody removed the callback before we finished
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * registration, probably will never happen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterAddEvents: HBA_RemoveCallback was "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "called for a handle before registration was finished.",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Adapter Events (other than add) ********************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(3, "AdapterEvent, port:%s, eventType:%d", WWN2STR1(&PortWWN),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*acbp->callback)(acbp->userdata, PortWWN, eventType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RegisterForAdapterEvents", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we now have the _hbaapi_LL_mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.RegisterForAdapterEventsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that allocated memory is used both as the handle for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller, and as userdata to the vendor call so that on
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback the specific registration may be recalled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterEvents: calloc failed for %d bytes\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = (registeredfunc)(adapterevents_callback,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte acbp->next = _hbaapi_adapterevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Adapter Port Events ********************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(3, "AdapterPortEvent, port:%s, eventType:%d fabricPortID:0X%06x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(acbp = _hbaapi_adapterportevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*acbp->callback)(acbp->userdata, PortWWN, eventType, fabricPortID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBARegisterForAdapterPortEventsFunc registeredfunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RegisterForAdapterPortEvents for port: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we now have the _hbaapi_LL_mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.RegisterForAdapterPortEventsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that allocated memory is used both as the handle for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller, and as userdata to the vendor call so that on
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback the specific registration may be recalled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterPortEvents: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "calloc failed for %d bytes\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = (registeredfunc)(adapterportevents_callback,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte acbp->next = _hbaapi_adapterportevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Adapter State Events *******************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(3, "AdapterPortStateEvent, port:%s, eventType:%d", WWN2STR1(&PortWWN),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for(acbp = _hbaapi_adapterportstatevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*acbp->callback)(acbp->userdata, PortWWN, eventType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RegisterForAdapterPortStatEvents for port: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we now have the _hbaapi_LL_mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.RegisterForAdapterPortStatEventsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that allocated memory is used both as the handle for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller, and as userdata to the vendor call so that on
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback the specific registration may be recalled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForAdapterPortStatEvents: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "calloc failed for %d bytes\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = (registeredfunc)(adapterportstatevents_callback,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte acbp->next = _hbaapi_adapterportstatevents_callback_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _hbaapi_adapterportstatevents_callback_list = acbp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Target Events **************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(3, "TargetEvent, hbaPort:%s, discoveredPort:%s eventType:%d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WWN2STR1(&hbaPortWWN), WWN2STR2(&discoveredPortWWN), eventType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RegisterForTargetEvents, hbaPort: %s, discoveredPort: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WWN2STR1(&hbaPortWWN), WWN2STR2(&discoveredPortWWN), 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we now have the _hbaapi_LL_mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.RegisterForTargetEventsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that allocated memory is used both as the handle for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller, and as userdata to the vendor call so that on
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback the specific registration may be recalled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForTargetEvents: calloc failed for %d bytes\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Link Events ****************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we now have the _hbaapi_LL_mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.RegisterForLinkEventsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that allocated memory is used both as the handle for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller, and as userdata to the vendor call so that on
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback the specific registration may be recalled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HBA_RegisterForLinkEvents: calloc failed for %d bytes\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_ERROR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RELEASE_MUTEX_RETURN(&_hbaapi_LL_mutex, HBA_STATUS_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * All of the functions below are almost passthru functions to the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * vendor specific function
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = HBA_CheckLibrary(handle, &lib_infop, &vendorHandle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CloseAdapterFunc = lib_infop->functionTable.CloseAdapterHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBAGetAdapterAttributesFunc GetAdapterAttributesFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetAdapterAttributesHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ((GetAdapterAttributesFunc)(vendorHandle, hbaattributes));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetAdapterPortAttributes", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetAdapterPortAttributesHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetPortStatisticsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetDiscoveredPortAttributes", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetDiscoveredPortAttributesHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetPortAttributesByWWN: %s", WWN2STR1(&PortWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetPortAttributesByWWNHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SendCTPassThruFunc = lib_infop->functionTable.SendCTPassThruHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendCTPassThruV2m hbaPortWWN: %s", WWN2STR1(&hbaPortWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SendCTPassThruV2Handler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetEventBufferFunc = lib_infop->functionTable.GetEventBufferHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_SetRNIDMgmtInfo (HBA_HANDLE handle, HBA_MGMTINFO Info) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SetRNIDMgmtInfoFunc = lib_infop->functionTable.SetRNIDMgmtInfoHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = (SetRNIDMgmtInfoFunc)(vendorHandle, Info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_GetRNIDMgmtInfo (HBA_HANDLE handle, HBA_MGMTINFO *pInfo) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GetRNIDMgmtInfoFunc = lib_infop->functionTable.GetRNIDMgmtInfoHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = (GetRNIDMgmtInfoFunc)(vendorHandle, pInfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendRNID for wwn: %s", WWN2STR1(&wwn), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SendRNIDFunc = lib_infop->functionTable.SendRNIDHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ((SendRNIDFunc)(vendorHandle, wwn, wwntype,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendRNIDV2, hbaPortWWN: %s", WWN2STR1(&hbaPortWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SendRNIDV2Handler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (vendorHandle, hbaPortWWN, destWWN, destFCID, NodeIdDataFormat,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = HBA_CheckLibrary(handle, &lib_infop, &vendorHandle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.RefreshInformationHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_ResetStatistics (HBA_HANDLE handle, HBA_UINT32 portindex) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = HBA_CheckLibrary(handle, &lib_infop, &vendorHandle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ResetStatisticsFunc = lib_infop->functionTable.ResetStatisticsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((ResetStatisticsFunc)(vendorHandle, portindex));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_GetFcpTargetMapping (HBA_HANDLE handle, PHBA_FCPTARGETMAPPING mapping) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBAGetFcpTargetMappingFunc GetFcpTargetMappingFunc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetFcpTargetMappingHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ((GetFcpTargetMappingFunc)(vendorHandle, mapping));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetFcpTargetMappingV2Handler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ((registeredfunc)(vendorHandle, hbaPortWWN, pmapping));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_GetFcpPersistentBinding (HBA_HANDLE handle, PHBA_FCPBINDING binding) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetFcpPersistentBinding", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetFcpPersistentBindingHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ((GetFcpPersistentBindingFunc)(vendorHandle, binding));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_ScsiInquiryV2 to discoveredPortWWN: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vendorHandle, hbaPortWWN, discoveredPortWWN, fcLUN, CDB_Byte1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CDB_Byte2, pRspBuffer, pRspBufferSize, pScsiStatus,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendScsiInquiry to PortWWN: %s", WWN2STR1(&PortWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SendScsiInquiryFunc = lib_infop->functionTable.ScsiInquiryHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vendorHandle, PortWWN, fcLUN, EVPD, PageCode, pRspBuffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_ScsiReportLUNsV2 to discoveredPortWWN: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ScsiReportLUNsV2Func = lib_infop->functionTable.ScsiReportLUNsV2Handler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendReportLUNs to PortWWN: %s", WWN2STR1(&portWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SendReportLUNsFunc = lib_infop->functionTable.ReportLUNsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBAScsiReadCapacityV2Func ScsiReadCapacityV2Func;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_ScsiReadCapacityV2 to discoveredPortWWN: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.ScsiReadCapacityV2Handler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vendorHandle, hbaPortWWN, discoveredPortWWN, fcLUN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendReadCapacity to portWWN: %s", WWN2STR1(&portWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SendReadCapacityFunc = lib_infop->functionTable.ReadCapacityHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SendRLSHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vendorHandle, hbaPortWWN, destWWN, pRspBuffer, pRspBufferSize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SendRPLHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vendorHandle, hbaPortWWN, agent_wwn, agent_domain, portindex,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SendRPSHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vendorHandle, hbaPortWWN, agent_wwn, agent_domain,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendSRL to wwn:%s domain:%d", WWN2STR1(&wwn), domain, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SendSRLHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SendLIRR destWWN:%s", WWN2STR1(&destWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SendLIRRHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vendorHandle, sourceWWN, destWWN, function, type,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.GetBindingCapabilityHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, hbaPortWWN, pcapability);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.GetBindingSupportHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, hbaPortWWN, pcapability);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SetBindingSupportHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, hbaPortWWN, capability);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_SetPersistentBindingV2 port: %s", WWN2STR1(&hbaPortWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.SetPersistentBindingV2Handler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, hbaPortWWN, pbinding);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetPersistentBindingV2 port: %s", WWN2STR1(&hbaPortWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte registeredfunc = lib_infop->functionTable.GetPersistentBindingV2Handler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, hbaPortWWN, pbinding);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RemovePersistentBinding", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.RemovePersistentBindingHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, hbaPortWWN, pbinding);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_RemoveAllPersistentBindings", 0, 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.RemoveAllPersistentBindingsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, hbaPortWWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetFC4Statistics port: %s", WWN2STR1(&portWWN), 0, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetFC4StatisticsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lib_infop->functionTable.GetFCPStatisticsHandler;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status =(registeredfunc)(vendorHandle, lunit, pstatistics);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEBUG(2, "HBA_GetVendorLibraryAttributes adapterindex:%d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(attributes, 0, sizeof(HBA_LIBRARYATTRIBUTES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Version 1 libary? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This should not happen, dont think its going to */