116 unlock(&open_handles_lock);
117 if (open_handle_ptr == NULL) {
118 return (-1);
119 }
120
121 return (open_handle_ptr->adapterIndex);
122 }
123 /*
124 * Given a handle, returns the open_handle structure
125 * The routine assumes that the open_handles_lock has already
126 * been taken.
127 */
128 struct open_handle *
129 RetrieveOpenHandle(HBA_HANDLE handle)
130 {
131
132 const char ROUTINE[] = "RetrieveOpenHandle";
133 struct open_handle *open_handle_ptr = NULL;
134
135 if (global_hba_head == NULL) {
136 log(LOG_DEBUG, ROUTINE, "No adpater is found.");
137 return (NULL);
138 }
139
140 for (open_handle_ptr = global_hba_head->open_handles;
141 open_handle_ptr != NULL;
142 open_handle_ptr = open_handle_ptr->next) {
143 if (open_handle_ptr->handle == handle) {
144 break;
145 }
146 }
147
148 return (open_handle_ptr);
149 }
150
151 /*
152 * Given an adapterIndex, this functions returns a pointer to the handle
153 * structure. This handle structure holds the hba's information
154 * Caller must take all_hbas_lock first.
155 */
156 struct sun_sas_hba *
|
116 unlock(&open_handles_lock);
117 if (open_handle_ptr == NULL) {
118 return (-1);
119 }
120
121 return (open_handle_ptr->adapterIndex);
122 }
123 /*
124 * Given a handle, returns the open_handle structure
125 * The routine assumes that the open_handles_lock has already
126 * been taken.
127 */
128 struct open_handle *
129 RetrieveOpenHandle(HBA_HANDLE handle)
130 {
131
132 const char ROUTINE[] = "RetrieveOpenHandle";
133 struct open_handle *open_handle_ptr = NULL;
134
135 if (global_hba_head == NULL) {
136 log(LOG_DEBUG, ROUTINE, "No adapter is found.");
137 return (NULL);
138 }
139
140 for (open_handle_ptr = global_hba_head->open_handles;
141 open_handle_ptr != NULL;
142 open_handle_ptr = open_handle_ptr->next) {
143 if (open_handle_ptr->handle == handle) {
144 break;
145 }
146 }
147
148 return (open_handle_ptr);
149 }
150
151 /*
152 * Given an adapterIndex, this functions returns a pointer to the handle
153 * structure. This handle structure holds the hba's information
154 * Caller must take all_hbas_lock first.
155 */
156 struct sun_sas_hba *
|