Print this page
NEX-14979 HBA_LoadLibrary needs to close config file when done.
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>


1068                 (void) fprintf(stderr,
1069                     "HBA_LoadLibrary: vendor specific LoadLibrary "
1070                     "function not found.  lib: %s\n", librarypath);
1071                 DEBUG(1, "HBA_LoadLibrary: vendor specific LoadLibrary "
1072                     "function not found.  lib: %s\n", librarypath, 0, 0);
1073                 continue;
1074         }
1075         /* Initialize this library */
1076         if ((status = ((LoadLibraryFunc)())) != HBA_STATUS_OK) {
1077             /* maybe this should be a printf so that we CANNOT miss it */
1078                 (void) fprintf(stderr,
1079                     "HBA_LoadLibrary: Encounterd and error loading: %s",
1080                     librarypath);
1081                 DEBUG(1, "Encounterd and error loading: %s", librarypath, 0, 0);
1082                 DEBUG(1, "  HBA_STATUS: %d", status, 0, 0);
1083                 continue;
1084         }
1085         /* successfully loaded library */
1086         lib_infop->status = HBA_LIBRARY_LOADED;
1087         }

1088 #endif /* WIN32 or UNIX */
1089 #ifdef POSIX_THREADS
1090         /*
1091          * The _hbaapi_LL_mutex is already grabbed to proctect the caller of
1092          * HBA_FreeLibrary() during loading.
1093          * The mutexes are already initialized
1094          * with PTHREAD_MUTEX_INITIALIZER.  Do we need to init again?
1095          * Keeping the code from HBAAPI source...
1096          */
1097         ret = pthread_mutex_init(&_hbaapi_AL_mutex, NULL);
1098         if (ret == 0) {
1099                 ret = pthread_mutex_init(&_hbaapi_AAE_mutex, NULL);
1100         }
1101         if (ret == 0) {
1102                 ret = pthread_mutex_init(&_hbaapi_AE_mutex, NULL);
1103         }
1104         if (ret == 0) {
1105                 ret = pthread_mutex_init(&_hbaapi_APE_mutex, NULL);
1106         }
1107         if (ret == 0) {




1068                 (void) fprintf(stderr,
1069                     "HBA_LoadLibrary: vendor specific LoadLibrary "
1070                     "function not found.  lib: %s\n", librarypath);
1071                 DEBUG(1, "HBA_LoadLibrary: vendor specific LoadLibrary "
1072                     "function not found.  lib: %s\n", librarypath, 0, 0);
1073                 continue;
1074         }
1075         /* Initialize this library */
1076         if ((status = ((LoadLibraryFunc)())) != HBA_STATUS_OK) {
1077             /* maybe this should be a printf so that we CANNOT miss it */
1078                 (void) fprintf(stderr,
1079                     "HBA_LoadLibrary: Encounterd and error loading: %s",
1080                     librarypath);
1081                 DEBUG(1, "Encounterd and error loading: %s", librarypath, 0, 0);
1082                 DEBUG(1, "  HBA_STATUS: %d", status, 0, 0);
1083                 continue;
1084         }
1085         /* successfully loaded library */
1086         lib_infop->status = HBA_LIBRARY_LOADED;
1087         }
1088         fclose(hbaconf);
1089 #endif /* WIN32 or UNIX */
1090 #ifdef POSIX_THREADS
1091         /*
1092          * The _hbaapi_LL_mutex is already grabbed to proctect the caller of
1093          * HBA_FreeLibrary() during loading.
1094          * The mutexes are already initialized
1095          * with PTHREAD_MUTEX_INITIALIZER.  Do we need to init again?
1096          * Keeping the code from HBAAPI source...
1097          */
1098         ret = pthread_mutex_init(&_hbaapi_AL_mutex, NULL);
1099         if (ret == 0) {
1100                 ret = pthread_mutex_init(&_hbaapi_AAE_mutex, NULL);
1101         }
1102         if (ret == 0) {
1103                 ret = pthread_mutex_init(&_hbaapi_AE_mutex, NULL);
1104         }
1105         if (ret == 0) {
1106                 ret = pthread_mutex_init(&_hbaapi_APE_mutex, NULL);
1107         }
1108         if (ret == 0) {