| 1 |
/* |
| 2 |
* Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. |
| 3 |
* |
| 4 |
* This Software is licensed under one of the following licenses: |
| 5 |
* |
| 6 |
* 1) under the terms of the "Common Public License 1.0" a copy of which is |
| 7 |
* in the file LICENSE.txt in the root directory. The license is also |
| 8 |
* available from the Open Source Initiative, see |
| 9 |
* http://www.opensource.org/licenses/cpl.php. |
| 10 |
* |
| 11 |
* 2) under the terms of the "The BSD License" a copy of which is in the file |
| 12 |
* LICENSE2.txt in the root directory. The license is also available from |
| 13 |
* the Open Source Initiative, see |
| 14 |
* http://www.opensource.org/licenses/bsd-license.php. |
| 15 |
* |
| 16 |
* 3) under the terms of the "GNU General Public License (GPL) Version 2" a |
| 17 |
* copy of which is in the file LICENSE3.txt in the root directory. The |
| 18 |
* license is also available from the Open Source Initiative, see |
| 19 |
* http://www.opensource.org/licenses/gpl-license.php. |
| 20 |
* |
| 21 |
* Licensee has the right to choose one of the above licenses. |
| 22 |
* |
| 23 |
* Redistributions of source code must retain the above copyright |
| 24 |
* notice and one of the license notices. |
| 25 |
* |
| 26 |
* Redistributions in binary form must reproduce both the above copyright |
| 27 |
* notice, one of the license notices in the documentation |
| 28 |
* and/or other materials provided with the distribution. |
| 29 |
*/ |
| 30 |
|
| 31 |
/********************************************************************** |
| 32 |
* |
| 33 |
* MODULE: udat.c |
| 34 |
* |
| 35 |
* PURPOSE: DAT Provider and Consumer registry functions. |
| 36 |
* |
| 37 |
* $Id: udat.c,v 1.22 2005/03/24 05:58:35 jlentini Exp $ |
| 38 |
**********************************************************************/ |
| 39 |
|
| 40 |
#include <dat2/udat.h> |
| 41 |
#include <dat2/dat_registry.h> /* Provider API function prototypes */ |
| 42 |
|
| 43 |
#include "dat_dr.h" |
| 44 |
#include "dat_init.h" |
| 45 |
#include "dat_osd.h" |
| 46 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 47 |
#include "dat_sr.h" |
| 48 |
#endif |
| 49 |
|
| 50 |
#define UDAT_IS_BAD_POINTER(p) ( NULL == (p) ) |
| 51 |
|
| 52 |
/********************************************************************* |
| 53 |
* * |
| 54 |
* Internal Function Declarations * |
| 55 |
* * |
| 56 |
*********************************************************************/ |
| 57 |
|
| 58 |
DAT_BOOLEAN udat_check_state(void); |
| 59 |
|
| 60 |
/********************************************************************* |
| 61 |
* * |
| 62 |
* External Function Definitions * |
| 63 |
* * |
| 64 |
*********************************************************************/ |
| 65 |
|
| 66 |
/* |
| 67 |
* Use a global to get an unresolved when run with pre-extension library |
| 68 |
*/ |
| 69 |
int g_dat_extensions = 0; |
| 70 |
|
| 71 |
/* |
| 72 |
* |
| 73 |
* Provider API |
| 74 |
* |
| 75 |
*/ |
| 76 |
|
| 77 |
/*********************************************************************** |
| 78 |
* Function: dat_registry_add_provider |
| 79 |
***********************************************************************/ |
| 80 |
|
| 81 |
DAT_RETURN DAT_API |
| 82 |
dat_registry_add_provider(IN const DAT_PROVIDER * provider, |
| 83 |
IN const DAT_PROVIDER_INFO * provider_info) |
| 84 |
{ |
| 85 |
DAT_DR_ENTRY entry; |
| 86 |
|
| 87 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_PROVIDER_API, |
| 88 |
"DAT Registry: %s (%s,%x:%x,%x)\n", __FUNCTION__, |
| 89 |
provider_info->ia_name, |
| 90 |
provider_info->dapl_version_major, |
| 91 |
provider_info->dapl_version_minor, |
| 92 |
provider_info->is_thread_safe); |
| 93 |
|
| 94 |
if (UDAT_IS_BAD_POINTER(provider)) { |
| 95 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); |
| 96 |
} |
| 97 |
|
| 98 |
if (UDAT_IS_BAD_POINTER(provider_info)) { |
| 99 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); |
| 100 |
} |
| 101 |
|
| 102 |
if (DAT_FALSE == udat_check_state()) { |
| 103 |
return DAT_ERROR(DAT_INVALID_STATE, 0); |
| 104 |
} |
| 105 |
|
| 106 |
entry.ref_count = 0; |
| 107 |
entry.ia_open_func = provider->ia_open_func; |
| 108 |
entry.info = *provider_info; |
| 109 |
#ifdef DAT_EXTENSIONS |
| 110 |
entry.ia_ext_func = provider->handle_extendedop_func; |
| 111 |
#endif |
| 112 |
return dat_dr_insert(provider_info, &entry); |
| 113 |
} |
| 114 |
|
| 115 |
//*********************************************************************** |
| 116 |
// Function: dat_registry_remove_provider |
| 117 |
//*********************************************************************** |
| 118 |
|
| 119 |
DAT_RETURN DAT_API |
| 120 |
dat_registry_remove_provider(IN const DAT_PROVIDER * provider, |
| 121 |
IN const DAT_PROVIDER_INFO * provider_info) |
| 122 |
{ |
| 123 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_PROVIDER_API, |
| 124 |
"DAT Registry: dat_registry_remove_provider () called\n"); |
| 125 |
|
| 126 |
if (UDAT_IS_BAD_POINTER(provider)) { |
| 127 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); |
| 128 |
} |
| 129 |
|
| 130 |
if (DAT_FALSE == udat_check_state()) { |
| 131 |
return DAT_ERROR(DAT_INVALID_STATE, 0); |
| 132 |
} |
| 133 |
|
| 134 |
return dat_dr_remove(provider_info); |
| 135 |
} |
| 136 |
|
| 137 |
/* |
| 138 |
* |
| 139 |
* Consumer API |
| 140 |
* |
| 141 |
*/ |
| 142 |
|
| 143 |
/*********************************************************************** |
| 144 |
* Function: dat_ia_open |
| 145 |
***********************************************************************/ |
| 146 |
|
| 147 |
DAT_RETURN DAT_API |
| 148 |
dat_ia_openv(IN const DAT_NAME_PTR name, |
| 149 |
IN DAT_COUNT async_event_qlen, |
| 150 |
INOUT DAT_EVD_HANDLE * async_event_handle, |
| 151 |
OUT DAT_IA_HANDLE * ia_handle, |
| 152 |
IN DAT_UINT32 dapl_major, |
| 153 |
IN DAT_UINT32 dapl_minor, IN DAT_BOOLEAN thread_safety) |
| 154 |
{ |
| 155 |
DAT_IA_OPEN_FUNC ia_open_func; |
| 156 |
DAT_PROVIDER_INFO info; |
| 157 |
DAT_OS_SIZE len; |
| 158 |
DAT_RETURN dat_status; |
| 159 |
|
| 160 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 161 |
"DAT Registry: dat_ia_openv (%s,%x:%x,%x) called\n", |
| 162 |
name, dapl_major, dapl_minor, thread_safety); |
| 163 |
|
| 164 |
if (UDAT_IS_BAD_POINTER(name)) { |
| 165 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); |
| 166 |
} |
| 167 |
|
| 168 |
len = dat_os_strlen(name); |
| 169 |
|
| 170 |
if (DAT_NAME_MAX_LENGTH <= len) { |
| 171 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); |
| 172 |
} |
| 173 |
|
| 174 |
if (UDAT_IS_BAD_POINTER(ia_handle)) { |
| 175 |
return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); |
| 176 |
} |
| 177 |
|
| 178 |
if (DAT_FALSE == udat_check_state()) { |
| 179 |
return DAT_ERROR(DAT_INVALID_STATE, 0); |
| 180 |
} |
| 181 |
|
| 182 |
dat_os_strncpy(info.ia_name, name, len + 1); |
| 183 |
|
| 184 |
info.dapl_version_major = dapl_major; |
| 185 |
info.dapl_version_minor = dapl_minor; |
| 186 |
info.is_thread_safe = thread_safety; |
| 187 |
|
| 188 |
/* |
| 189 |
* Since DAT allows providers to be loaded by either the static |
| 190 |
* registry or explicitly through OS dependent methods, do not |
| 191 |
* return an error if no providers are loaded via the static registry. |
| 192 |
* Don't even bother calling the static registry if DAT is compiled |
| 193 |
* with no static registry support. |
| 194 |
*/ |
| 195 |
|
| 196 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 197 |
(void)dat_sr_provider_open(&info); |
| 198 |
#endif |
| 199 |
|
| 200 |
dat_status = dat_dr_provider_open(&info, &ia_open_func); |
| 201 |
if (dat_status != DAT_SUCCESS) { |
| 202 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 203 |
"DAT Registry: dat_ia_open () provider information " |
| 204 |
"for IA name %s not found in dynamic registry\n", |
| 205 |
name); |
| 206 |
|
| 207 |
return dat_status; |
| 208 |
} |
| 209 |
|
| 210 |
dat_status = (*ia_open_func) (name, |
| 211 |
async_event_qlen, |
| 212 |
async_event_handle, ia_handle); |
| 213 |
if (dat_status == DAT_SUCCESS) { |
| 214 |
*ia_handle = (DAT_IA_HANDLE) dats_set_ia_handle(*ia_handle); |
| 215 |
} else { |
| 216 |
(void)dat_dr_provider_close(&info); |
| 217 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 218 |
(void)dat_sr_provider_close(&info); |
| 219 |
#endif |
| 220 |
return dat_status; |
| 221 |
} |
| 222 |
|
| 223 |
/* |
| 224 |
* See if provider supports extensions |
| 225 |
*/ |
| 226 |
if (dat_status == DAT_SUCCESS) { |
| 227 |
DAT_IA_ATTR ia_attr; |
| 228 |
|
| 229 |
if (dat_ia_query(*ia_handle, |
| 230 |
NULL, |
| 231 |
DAT_IA_ALL, |
| 232 |
&ia_attr, 0, NULL) == DAT_SUCCESS) { |
| 233 |
if (ia_attr.extension_supported) { |
| 234 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 235 |
"DAT Registry: dat_ia_open () " |
| 236 |
"Extensions (Type=%d, ver=%d) supported!\n", |
| 237 |
ia_attr.extension_supported, |
| 238 |
ia_attr.extension_version); |
| 239 |
g_dat_extensions = 1; |
| 240 |
} |
| 241 |
} |
| 242 |
} |
| 243 |
return dat_status; |
| 244 |
} |
| 245 |
|
| 246 |
/************************************************************************ |
| 247 |
* Function: dat_ia_close |
| 248 |
***********************************************************************/ |
| 249 |
|
| 250 |
DAT_RETURN DAT_API |
| 251 |
dat_ia_close(IN DAT_IA_HANDLE ia_handle, IN DAT_CLOSE_FLAGS ia_flags) |
| 252 |
{ |
| 253 |
DAT_PROVIDER *provider; |
| 254 |
DAT_PROVIDER_ATTR provider_attr; |
| 255 |
DAT_IA_HANDLE dapl_ia_handle; |
| 256 |
DAT_RETURN dat_status; |
| 257 |
const char *ia_name; |
| 258 |
|
| 259 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 260 |
"DAT Registry: dat_ia_close () called\n"); |
| 261 |
|
| 262 |
dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle); |
| 263 |
if (dat_status != DAT_SUCCESS) { |
| 264 |
return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); |
| 265 |
} |
| 266 |
|
| 267 |
if (DAT_FALSE == udat_check_state()) { |
| 268 |
return DAT_ERROR(DAT_INVALID_STATE, 0); |
| 269 |
} |
| 270 |
|
| 271 |
provider = DAT_HANDLE_TO_PROVIDER(dapl_ia_handle); |
| 272 |
ia_name = provider->device_name; |
| 273 |
|
| 274 |
if (DAT_SUCCESS != (dat_status = dat_ia_query(ia_handle, |
| 275 |
NULL, |
| 276 |
0, |
| 277 |
NULL, |
| 278 |
DAT_PROVIDER_FIELD_ALL, |
| 279 |
&provider_attr))) { |
| 280 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 281 |
"DAT Registry: query function for %s provider failed\n", |
| 282 |
ia_name); |
| 283 |
} else if (DAT_SUCCESS != (dat_status = |
| 284 |
(*provider->ia_close_func) (dapl_ia_handle, |
| 285 |
ia_flags))) { |
| 286 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 287 |
"DAT Registry: close function for %s provider failed\n", |
| 288 |
ia_name); |
| 289 |
} else { |
| 290 |
DAT_PROVIDER_INFO info; |
| 291 |
DAT_OS_SIZE len; |
| 292 |
|
| 293 |
len = dat_os_strlen(ia_name); |
| 294 |
|
| 295 |
dat_os_assert(len < DAT_NAME_MAX_LENGTH); |
| 296 |
|
| 297 |
dat_os_strncpy(info.ia_name, ia_name, len + 1); |
| 298 |
|
| 299 |
info.dapl_version_major = provider_attr.dapl_version_major; |
| 300 |
info.dapl_version_minor = provider_attr.dapl_version_minor; |
| 301 |
info.is_thread_safe = provider_attr.is_thread_safe; |
| 302 |
|
| 303 |
dat_status = dat_dr_provider_close(&info); |
| 304 |
if (DAT_SUCCESS != dat_status) { |
| 305 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 306 |
"DAT Registry: dynamic registry unable to close " |
| 307 |
"provider for IA name %s\n", ia_name); |
| 308 |
} |
| 309 |
|
| 310 |
/* Remove the handle from the handle table */ |
| 311 |
(void)dats_free_ia_handle(ia_handle); |
| 312 |
|
| 313 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 314 |
dat_status = dat_sr_provider_close(&info); |
| 315 |
if (DAT_SUCCESS != dat_status) { |
| 316 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 317 |
"DAT Registry: static registry unable to close " |
| 318 |
"provider for IA name %s\n", ia_name); |
| 319 |
} |
| 320 |
#endif |
| 321 |
} |
| 322 |
|
| 323 |
return dat_status; |
| 324 |
} |
| 325 |
|
| 326 |
//*********************************************************************** |
| 327 |
// Function: dat_registry_list_providers |
| 328 |
//*********************************************************************** |
| 329 |
|
| 330 |
DAT_RETURN DAT_API |
| 331 |
dat_registry_list_providers(IN DAT_COUNT max_to_return, |
| 332 |
OUT DAT_COUNT * entries_returned, |
| 333 |
OUT DAT_PROVIDER_INFO * (dat_provider_list[])) |
| 334 |
{ |
| 335 |
DAT_RETURN dat_status; |
| 336 |
|
| 337 |
dat_status = DAT_SUCCESS; |
| 338 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 339 |
"DAT Registry: dat_registry_list_providers () called\n"); |
| 340 |
|
| 341 |
if (DAT_FALSE == udat_check_state()) { |
| 342 |
return DAT_ERROR(DAT_INVALID_STATE, 0); |
| 343 |
} |
| 344 |
|
| 345 |
if ((UDAT_IS_BAD_POINTER(entries_returned))) { |
| 346 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); |
| 347 |
} |
| 348 |
|
| 349 |
if (0 != max_to_return && (UDAT_IS_BAD_POINTER(dat_provider_list))) { |
| 350 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3); |
| 351 |
} |
| 352 |
|
| 353 |
if (0 == max_to_return) { |
| 354 |
/* the user is allowed to call with max_to_return set to zero. |
| 355 |
* in which case we simply return (in *entries_returned) the |
| 356 |
* number of providers currently installed. We must also |
| 357 |
* (per spec) return an error |
| 358 |
*/ |
| 359 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 360 |
(void)dat_sr_size(entries_returned); |
| 361 |
#else |
| 362 |
(void)dat_dr_size(entries_returned); |
| 363 |
#endif |
| 364 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); |
| 365 |
} else { |
| 366 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 367 |
dat_status = dat_sr_list(max_to_return, |
| 368 |
entries_returned, dat_provider_list); |
| 369 |
#else |
| 370 |
dat_status = dat_dr_list(max_to_return, |
| 371 |
entries_returned, dat_provider_list); |
| 372 |
#endif |
| 373 |
} |
| 374 |
return dat_status; |
| 375 |
} |
| 376 |
|
| 377 |
/********************************************************************* |
| 378 |
* * |
| 379 |
* Internal Function Definitions * |
| 380 |
* * |
| 381 |
*********************************************************************/ |
| 382 |
|
| 383 |
//*********************************************************************** |
| 384 |
// Function: udat_check_state |
| 385 |
//*********************************************************************** |
| 386 |
|
| 387 |
/* |
| 388 |
* This function returns TRUE if the DAT registry is in a state capable |
| 389 |
* of handling DAT API calls and false otherwise. |
| 390 |
*/ |
| 391 |
|
| 392 |
DAT_BOOLEAN udat_check_state(void) |
| 393 |
{ |
| 394 |
DAT_MODULE_STATE state; |
| 395 |
DAT_BOOLEAN status; |
| 396 |
|
| 397 |
state = dat_module_get_state(); |
| 398 |
|
| 399 |
if (DAT_MODULE_STATE_UNINITIALIZED == state) { |
| 400 |
dat_init(); |
| 401 |
status = DAT_TRUE; |
| 402 |
} else if (DAT_MODULE_STATE_DEINITIALIZED == state) { |
| 403 |
status = DAT_FALSE; |
| 404 |
} else { |
| 405 |
status = DAT_TRUE; |
| 406 |
} |
| 407 |
|
| 408 |
return status; |
| 409 |
} |
| 410 |
|
| 411 |
#ifdef DAT_EXTENSIONS |
| 412 |
|
| 413 |
/*********************************************************************** |
| 414 |
* Function: udat_extension_open - provider name supplied |
| 415 |
***********************************************************************/ |
| 416 |
DAT_RETURN DAT_API |
| 417 |
udat_extension_open(IN const DAT_NAME_PTR name, |
| 418 |
IN DAT_EXTENDED_OP ext_op, |
| 419 |
IN va_list args) |
| 420 |
{ |
| 421 |
DAT_HANDLE_EXTENDEDOP_FUNC prov_ext_func; |
| 422 |
DAT_PROVIDER_INFO info; |
| 423 |
DAT_OS_SIZE len; |
| 424 |
DAT_RETURN dat_status; |
| 425 |
|
| 426 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 427 |
" udat_extenstion_op(%s,%x:%x,%x,%d) called\n", |
| 428 |
name, ext_op, DAT_VERSION_MAJOR, DAT_VERSION_MINOR, DAT_THREADSAFE); |
| 429 |
|
| 430 |
if (UDAT_IS_BAD_POINTER(name)) { |
| 431 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); |
| 432 |
} |
| 433 |
|
| 434 |
len = dat_os_strlen(name); |
| 435 |
|
| 436 |
if (DAT_NAME_MAX_LENGTH <= len) { |
| 437 |
return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); |
| 438 |
} |
| 439 |
|
| 440 |
if (DAT_FALSE == udat_check_state()) { |
| 441 |
return DAT_ERROR(DAT_INVALID_STATE, 0); |
| 442 |
} |
| 443 |
|
| 444 |
dat_os_strncpy(info.ia_name, name, len + 1); |
| 445 |
|
| 446 |
info.dapl_version_major = DAT_VERSION_MAJOR; |
| 447 |
info.dapl_version_minor = DAT_VERSION_MINOR; |
| 448 |
info.is_thread_safe = DAT_THREADSAFE; |
| 449 |
|
| 450 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 451 |
(void)dat_sr_provider_open(&info); |
| 452 |
#endif |
| 453 |
dat_status = dat_dr_provider_open_ext(&info, &prov_ext_func); |
| 454 |
if (dat_status != DAT_SUCCESS) { |
| 455 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 456 |
" DAT Registry: udat_ext_op () provider information " |
| 457 |
"for IA name %s not found in dynamic registry\n", |
| 458 |
name); |
| 459 |
return dat_status; |
| 460 |
} |
| 461 |
g_dat_extensions = 1; |
| 462 |
dat_status = (*prov_ext_func) (name, ext_op, args); |
| 463 |
|
| 464 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 465 |
" udat_extension_op () return = 0x%x for IA name %s\n", |
| 466 |
dat_status, name); |
| 467 |
|
| 468 |
if (dat_status != DAT_SUCCESS) { |
| 469 |
(void)dat_dr_provider_close(&info); |
| 470 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 471 |
(void)dat_sr_provider_close(&info); |
| 472 |
#endif |
| 473 |
} |
| 474 |
|
| 475 |
return dat_status; |
| 476 |
} |
| 477 |
/*********************************************************************** |
| 478 |
* Function: udat_extension_close - provider handle supplied |
| 479 |
***********************************************************************/ |
| 480 |
DAT_RETURN DAT_API |
| 481 |
udat_extension_close(IN DAT_IA_HANDLE ia_handle, |
| 482 |
IN DAT_EXTENDED_OP ext_op, |
| 483 |
IN va_list args) |
| 484 |
{ |
| 485 |
DAT_PROVIDER *provider; |
| 486 |
DAT_PROVIDER_INFO info; |
| 487 |
DAT_OS_SIZE len; |
| 488 |
DAT_RETURN dat_status; |
| 489 |
const char* ia_name; |
| 490 |
|
| 491 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 492 |
" udat_ext_close_op(ia=%p,op=%x) called\n", |
| 493 |
ia_handle, ext_op); |
| 494 |
|
| 495 |
if (ia_handle == NULL) |
| 496 |
return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); |
| 497 |
|
| 498 |
if (DAT_FALSE == udat_check_state()) |
| 499 |
return DAT_ERROR(DAT_INVALID_STATE, 0); |
| 500 |
|
| 501 |
provider = DAT_HANDLE_TO_PROVIDER(ia_handle); |
| 502 |
ia_name = provider->device_name; |
| 503 |
|
| 504 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 505 |
" udat_ext_close_op(ia=%p,op=%x,name=%s) called\n", |
| 506 |
ia_handle, ext_op, ia_name); |
| 507 |
|
| 508 |
dat_status = (*provider->handle_extendedop_func) (ia_handle, ext_op, args); |
| 509 |
|
| 510 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 511 |
" udat_extension_op () return = 0x%x for IA name %s\n", |
| 512 |
dat_status, ia_name); |
| 513 |
|
| 514 |
if (dat_status != DAT_SUCCESS) |
| 515 |
return dat_status; |
| 516 |
|
| 517 |
len = dat_os_strlen(ia_name); |
| 518 |
dat_os_assert(len < DAT_NAME_MAX_LENGTH); |
| 519 |
dat_os_strncpy(info.ia_name, ia_name, len + 1); |
| 520 |
info.dapl_version_major = DAT_VERSION_MAJOR; |
| 521 |
info.dapl_version_minor = DAT_VERSION_MINOR; |
| 522 |
info.is_thread_safe = DAT_THREADSAFE; |
| 523 |
|
| 524 |
dat_status = dat_dr_provider_close(&info); |
| 525 |
if (DAT_SUCCESS != dat_status) { |
| 526 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 527 |
"udat_ext_close_op: dynamic registry unable to close " |
| 528 |
"provider for IA name %s\n", ia_name); |
| 529 |
} |
| 530 |
|
| 531 |
#ifndef DAT_NO_STATIC_REGISTRY |
| 532 |
dat_status = dat_sr_provider_close(&info); |
| 533 |
if (DAT_SUCCESS != dat_status) { |
| 534 |
dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API, |
| 535 |
"udat_ext_close_op: static registry unable to close " |
| 536 |
"provider for IA name %s\n", ia_name); |
| 537 |
} |
| 538 |
#endif |
| 539 |
return dat_status; |
| 540 |
} |
| 541 |
#endif |
| 542 |
|
| 543 |
/* |
| 544 |
* Local variables: |
| 545 |
* c-indent-level: 4 |
| 546 |
* c-basic-offset: 4 |
| 547 |
* tab-width: 8 |
| 548 |
* End: |
| 549 |
*/ |