diff options
author | Toomas Soome <tsoome@me.com> | 2020-05-18 10:46:29 +0300 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2021-03-30 23:21:10 +0300 |
commit | c1ba859699f12f01e0a0ae33b874b48f666aac62 (patch) | |
tree | 869a7c06c984829727180761732785124864d83d | |
parent | 91b4b5393fe18d32505f967d482b81eef7f68d22 (diff) | |
download | illumos-joyent-c1ba859699f12f01e0a0ae33b874b48f666aac62.tar.gz |
13518 sun_sas: multiply-defined symbols
Reviewed by: Yuri Pankov <yuripv@yuripv.dev>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c | 1 | ||||
-rw-r--r-- | usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c | 44 | ||||
-rw-r--r-- | usr/src/lib/sun_sas/common/devtree_hba_disco.c | 2 | ||||
-rw-r--r-- | usr/src/lib/sun_sas/common/sun_sas.h | 12 |
4 files changed, 31 insertions, 28 deletions
diff --git a/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c b/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c index b30e975fe1..78b2100e89 100644 --- a/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c +++ b/usr/src/lib/sun_sas/common/Sun_sasFreeLibrary.c @@ -48,6 +48,7 @@ Sun_sasFreeLibrary(void) open_handle_index = 1; unlock(&all_hbas_lock); (void) mutex_destroy(&all_hbas_lock); + (void) mutex_destroy(&open_handles_lock); /* free sysevent handle. */ if (gSysEventHandle != NULL) diff --git a/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c b/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c index b5df2a4cc8..45164c5058 100644 --- a/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c +++ b/usr/src/lib/sun_sas/common/Sun_sasLoadLibrary.c @@ -27,6 +27,11 @@ #include <sun_sas.h> +mutex_t all_hbas_lock = DEFAULTMUTEX; +mutex_t open_handles_lock = DEFAULTMUTEX; +HBA_UINT16 open_handle_index; +HBA_UINT32 hba_count; + /* * Loads the HBA Library. Must be called before calling any HBA library * functions @@ -53,23 +58,17 @@ HBA_STATUS Sun_sasLoadLibrary() { } hba_count = 0; open_handle_index = 1; - /* Initialize the read-write lock */ - if (mutex_init(&all_hbas_lock, USYNC_THREAD, NULL)) { - log(LOG_DEBUG, ROUTINE, - "Unable to initialize lock in LoadLibrary for reason \"%s\"", - strerror(errno)); - return (HBA_STATUS_ERROR); - } + /* grab write lock */ lock(&all_hbas_lock); start = gethrtime(); if ((root = di_init("/", DINFOCACHE)) == DI_NODE_NIL) { - log(LOG_DEBUG, ROUTINE, - "Unable to load device tree for reason \"%s\"", - strerror(errno)); - unlock(&all_hbas_lock); - return (HBA_STATUS_ERROR); + log(LOG_DEBUG, ROUTINE, + "Unable to load device tree: \"%s\"", + strerror(errno)); + unlock(&all_hbas_lock); + return (HBA_STATUS_ERROR); } end = gethrtime(); duration = end - start; @@ -79,9 +78,9 @@ HBA_STATUS Sun_sasLoadLibrary() { /* At load time, we only gather libdevinfo information */ if (devtree_get_all_hbas(root) == HBA_STATUS_OK) { - atLeastOneHBA = B_TRUE; + atLeastOneHBA = B_TRUE; } else { - atLeastOneFailure = B_TRUE; + atLeastOneFailure = B_TRUE; } di_fini(root); @@ -90,13 +89,14 @@ HBA_STATUS Sun_sasLoadLibrary() { /* Now determine what status code to return */ if (atLeastOneHBA) { - /* We've got at least one HBA and possibly some failures */ - return (HBA_STATUS_OK); - } else if (atLeastOneFailure) { - /* We have no HBAs but have failures */ - return (HBA_STATUS_ERROR); - } else { - /* We have no HBAs and no failures */ - return (HBA_STATUS_OK); + /* We've got at least one HBA and possibly some failures */ + return (HBA_STATUS_OK); + } + if (atLeastOneFailure) { + /* We have no HBAs but have failures */ + return (HBA_STATUS_ERROR); } + + /* We have no HBAs and no failures */ + return (HBA_STATUS_OK); } diff --git a/usr/src/lib/sun_sas/common/devtree_hba_disco.c b/usr/src/lib/sun_sas/common/devtree_hba_disco.c index bfd584008b..2017f97e26 100644 --- a/usr/src/lib/sun_sas/common/devtree_hba_disco.c +++ b/usr/src/lib/sun_sas/common/devtree_hba_disco.c @@ -33,6 +33,8 @@ #include <inttypes.h> #include <ctype.h> +struct sun_sas_hba *global_hba_head; + /* free hba port info for the given hba */ static void free_hba_port(struct sun_sas_hba *hba_ptr) diff --git a/usr/src/lib/sun_sas/common/sun_sas.h b/usr/src/lib/sun_sas/common/sun_sas.h index d6872e5628..75344e6de3 100644 --- a/usr/src/lib/sun_sas/common/sun_sas.h +++ b/usr/src/lib/sun_sas/common/sun_sas.h @@ -107,11 +107,11 @@ extern "C" { /* misc */ #define SUN_MICROSYSTEMS "Sun Microsystems, Inc." -mutex_t all_hbas_lock; -mutex_t open_handles_lock; -mutex_t log_file_lock; -HBA_UINT32 hba_count; -HBA_UINT16 open_handle_index; +extern mutex_t all_hbas_lock; +extern mutex_t open_handles_lock; +extern mutex_t log_file_lock; +extern HBA_UINT32 hba_count; +extern HBA_UINT16 open_handle_index; /* Internal structures that aren't exposed to clients */ @@ -136,7 +136,7 @@ struct sun_sas_hba { struct sun_sas_port *first_port; }; -struct sun_sas_hba *global_hba_head; +extern struct sun_sas_hba *global_hba_head; struct ScsiEntryList { SMHBA_SCSIENTRY entry; |