cfg.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. /*
  2. * Copyright (c) 2002-2005 MontaVista Software, Inc.
  3. * Copyright (c) 2006 Red Hat, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Author: Steven Dake (sdake@mvista.com)
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. #include <stdio.h>
  36. #include <string.h>
  37. #include <stdlib.h>
  38. #include <unistd.h>
  39. #include <errno.h>
  40. #include <signal.h>
  41. #include <pthread.h>
  42. #include <sys/types.h>
  43. #include <sys/socket.h>
  44. #include <sys/select.h>
  45. #include <sys/un.h>
  46. #include "../include/saAis.h"
  47. #include "../include/cfg.h"
  48. #include "../include/mar_gen.h"
  49. #include "../include/ipc_gen.h"
  50. #include "../include/ipc_cfg.h"
  51. #include "util.h"
  52. struct res_overlay {
  53. mar_res_header_t header;
  54. char data[4096];
  55. };
  56. /*
  57. * Data structure for instance data
  58. */
  59. struct cfg_instance {
  60. int response_fd;
  61. int dispatch_fd;
  62. OpenaisCfgCallbacksT callbacks;
  63. SaNameT compName;
  64. int compRegistered;
  65. int finalize;
  66. pthread_mutex_t response_mutex;
  67. pthread_mutex_t dispatch_mutex;
  68. };
  69. static void cfg_handleInstanceDestructor (void *);
  70. /*
  71. * All instances in one database
  72. */
  73. static struct saHandleDatabase cfg_hdb = {
  74. .handleCount = 0,
  75. .handles = 0,
  76. .mutex = PTHREAD_MUTEX_INITIALIZER,
  77. .handleInstanceDestructor = cfg_handleInstanceDestructor
  78. };
  79. /*
  80. * Implementation
  81. */
  82. void cfg_handleInstanceDestructor (void *instance)
  83. {
  84. }
  85. SaAisErrorT
  86. openais_cfg_initialize (
  87. openais_cfg_handle_t *cfg_handle,
  88. const OpenaisCfgCallbacksT *cfgCallbacks)
  89. {
  90. struct cfg_instance *cfg_instance;
  91. SaAisErrorT error = SA_AIS_OK;
  92. error = saHandleCreate (&cfg_hdb, sizeof (struct cfg_instance), cfg_handle);
  93. if (error != SA_AIS_OK) {
  94. goto error_no_destroy;
  95. }
  96. error = saHandleInstanceGet (&cfg_hdb, *cfg_handle, (void *)&cfg_instance);
  97. if (error != SA_AIS_OK) {
  98. goto error_destroy;
  99. }
  100. cfg_instance->response_fd = -1;
  101. cfg_instance->dispatch_fd = -1;
  102. error = saServiceConnect (&cfg_instance->response_fd,
  103. &cfg_instance->dispatch_fd, CFG_SERVICE);
  104. if (error != SA_AIS_OK) {
  105. goto error_put_destroy;
  106. }
  107. if (cfgCallbacks) {
  108. memcpy (&cfg_instance->callbacks, cfgCallbacks, sizeof (OpenaisCfgCallbacksT));
  109. }
  110. pthread_mutex_init (&cfg_instance->response_mutex, NULL);
  111. pthread_mutex_init (&cfg_instance->dispatch_mutex, NULL);
  112. saHandleInstancePut (&cfg_hdb, *cfg_handle);
  113. return (SA_AIS_OK);
  114. error_put_destroy:
  115. saHandleInstancePut (&cfg_hdb, *cfg_handle);
  116. error_destroy:
  117. saHandleDestroy (&cfg_hdb, *cfg_handle);
  118. error_no_destroy:
  119. return (error);
  120. }
  121. SaAisErrorT
  122. openais_cfg_fd_get (
  123. openais_cfg_handle_t cfg_handle,
  124. SaSelectionObjectT *selectionObject)
  125. {
  126. struct cfg_instance *cfg_instance;
  127. SaAisErrorT error;
  128. error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
  129. if (error != SA_AIS_OK) {
  130. return (error);
  131. }
  132. *selectionObject = cfg_instance->dispatch_fd;
  133. saHandleInstancePut (&cfg_hdb, cfg_handle);
  134. return (SA_AIS_OK);
  135. }
  136. SaAisErrorT
  137. openais_cfg_dispatch (
  138. openais_cfg_handle_t cfg_handle,
  139. SaDispatchFlagsT dispatchFlags)
  140. {
  141. struct pollfd ufds;
  142. int timeout = -1;
  143. SaAisErrorT error;
  144. int cont = 1; /* always continue do loop except when set to 0 */
  145. int dispatch_avail;
  146. struct cfg_instance *cfg_instance;
  147. #ifdef COMPILE_OUT
  148. struct res_lib_openais_healthcheckcallback *res_lib_openais_healthcheckcallback;
  149. struct res_lib_openais_readinessstatesetcallback *res_lib_openais_readinessstatesetcallback;
  150. struct res_lib_openais_csisetcallback *res_lib_openais_csisetcallback;
  151. struct res_lib_openais_csiremovecallback *res_lib_openais_csiremovecallback;
  152. struct res_lib_cfg_statetrackcallback *res_lib_cfg_statetrackcallback;
  153. #endif
  154. OpenaisCfgCallbacksT callbacks;
  155. struct res_overlay dispatch_data;
  156. error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
  157. (void *)&cfg_instance);
  158. if (error != SA_AIS_OK) {
  159. return (error);
  160. }
  161. /*
  162. * Timeout instantly for SA_DISPATCH_ALL
  163. */
  164. if (dispatchFlags == SA_DISPATCH_ALL) {
  165. timeout = 0;
  166. }
  167. do {
  168. /*
  169. * Read data directly from socket
  170. */
  171. ufds.fd = cfg_instance->dispatch_fd;
  172. ufds.events = POLLIN;
  173. ufds.revents = 0;
  174. error = saPollRetry (&ufds, 1, timeout);
  175. if (error != SA_AIS_OK) {
  176. goto error_nounlock;
  177. }
  178. pthread_mutex_lock (&cfg_instance->dispatch_mutex);
  179. error = saPollRetry (&ufds, 1, 0);
  180. if (error != SA_AIS_OK) {
  181. goto error_nounlock;
  182. }
  183. /*
  184. * Handle has been finalized in another thread
  185. */
  186. if (cfg_instance->finalize == 1) {
  187. error = SA_AIS_OK;
  188. pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
  189. goto error_unlock;
  190. }
  191. dispatch_avail = ufds.revents & POLLIN;
  192. if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
  193. pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
  194. break; /* exit do while cont is 1 loop */
  195. } else
  196. if (dispatch_avail == 0) {
  197. pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
  198. continue; /* next poll */
  199. }
  200. if (ufds.revents & POLLIN) {
  201. /*
  202. * Queue empty, read response from socket
  203. */
  204. error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.header,
  205. sizeof (mar_res_header_t));
  206. if (error != SA_AIS_OK) {
  207. goto error_unlock;
  208. }
  209. if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
  210. error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.data,
  211. dispatch_data.header.size - sizeof (mar_res_header_t));
  212. if (error != SA_AIS_OK) {
  213. goto error_unlock;
  214. }
  215. }
  216. } else {
  217. pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
  218. continue;
  219. }
  220. /*
  221. * Make copy of callbacks, message data, unlock instance, and call callback
  222. * A risk of this dispatch method is that the callback routines may
  223. * operate at the same time that cfgFinalize has been called in another thread.
  224. */
  225. memcpy (&callbacks, &cfg_instance->callbacks, sizeof (OpenaisCfgCallbacksT));
  226. pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
  227. /*
  228. * Dispatch incoming response
  229. */
  230. switch (dispatch_data.header.id) {
  231. default:
  232. error = SA_AIS_ERR_LIBRARY;
  233. goto error_nounlock;
  234. break;
  235. }
  236. /*
  237. * Determine if more messages should be processed
  238. */
  239. switch (dispatchFlags) {
  240. case SA_DISPATCH_ONE:
  241. cont = 0;
  242. break;
  243. case SA_DISPATCH_ALL:
  244. break;
  245. case SA_DISPATCH_BLOCKING:
  246. break;
  247. }
  248. } while (cont);
  249. error_unlock:
  250. saHandleInstancePut (&cfg_hdb, cfg_handle);
  251. error_nounlock:
  252. return (error);
  253. }
  254. SaAisErrorT
  255. openais_cfg_finalize (
  256. openais_cfg_handle_t cfg_handle)
  257. {
  258. struct cfg_instance *cfg_instance;
  259. SaAisErrorT error;
  260. error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
  261. if (error != SA_AIS_OK) {
  262. return (error);
  263. }
  264. pthread_mutex_lock (&cfg_instance->dispatch_mutex);
  265. pthread_mutex_lock (&cfg_instance->response_mutex);
  266. /*
  267. * Another thread has already started finalizing
  268. */
  269. if (cfg_instance->finalize) {
  270. pthread_mutex_unlock (&cfg_instance->response_mutex);
  271. pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
  272. saHandleInstancePut (&cfg_hdb, cfg_handle);
  273. return (SA_AIS_ERR_BAD_HANDLE);
  274. }
  275. cfg_instance->finalize = 1;
  276. pthread_mutex_unlock (&cfg_instance->response_mutex);
  277. pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
  278. saHandleDestroy (&cfg_hdb, cfg_handle);
  279. if (cfg_instance->response_fd != -1) {
  280. shutdown (cfg_instance->response_fd, 0);
  281. close (cfg_instance->response_fd);
  282. }
  283. if (cfg_instance->dispatch_fd != -1) {
  284. shutdown (cfg_instance->dispatch_fd, 0);
  285. close (cfg_instance->dispatch_fd);
  286. }
  287. saHandleInstancePut (&cfg_hdb, cfg_handle);
  288. return (error);
  289. }
  290. SaAisErrorT
  291. openais_cfg_ring_status_get (
  292. openais_cfg_handle_t cfg_handle,
  293. char ***interface_names,
  294. char ***status,
  295. unsigned int *interface_count)
  296. {
  297. struct cfg_instance *cfg_instance;
  298. struct req_lib_cfg_ringstatusget req_lib_cfg_ringstatusget;
  299. struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
  300. unsigned int i;
  301. SaAisErrorT error;
  302. error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
  303. if (error != SA_AIS_OK) {
  304. return (error);
  305. }
  306. req_lib_cfg_ringstatusget.header.size = sizeof (struct req_lib_cfg_ringstatusget);
  307. req_lib_cfg_ringstatusget.header.id = MESSAGE_REQ_CFG_RINGSTATUSGET;
  308. pthread_mutex_lock (&cfg_instance->response_mutex);
  309. error = saSendReceiveReply (cfg_instance->response_fd,
  310. &req_lib_cfg_ringstatusget,
  311. sizeof (struct req_lib_cfg_ringstatusget),
  312. &res_lib_cfg_ringstatusget,
  313. sizeof (struct res_lib_cfg_ringstatusget));
  314. pthread_mutex_unlock (&cfg_instance->response_mutex);
  315. *interface_count = res_lib_cfg_ringstatusget.interface_count;
  316. *interface_names = malloc (sizeof (char *) * *interface_count);
  317. if (*interface_names == NULL) {
  318. return (SA_AIS_ERR_NO_MEMORY);
  319. }
  320. memset (*interface_names, 0, sizeof (char *) * *interface_count);
  321. *status = malloc (sizeof (char *) * *interface_count);
  322. if (*status == NULL) {
  323. error = SA_AIS_ERR_NO_MEMORY;
  324. goto error_free_interface_names;
  325. }
  326. memset (*status, 0, sizeof (char *) * *interface_count);
  327. for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
  328. (*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]);
  329. if ((*(interface_names))[i] == NULL) {
  330. error = SA_AIS_ERR_NO_MEMORY;
  331. goto error_free_contents;
  332. }
  333. (*(status))[i] = strdup (res_lib_cfg_ringstatusget.interface_status[i]);
  334. if ((*(status))[i] == NULL) {
  335. error = SA_AIS_ERR_NO_MEMORY;
  336. goto error_free_contents;
  337. }
  338. }
  339. goto no_error;
  340. error_free_contents:
  341. for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
  342. if ((*(interface_names))[i]) {
  343. free ((*(interface_names))[i]);
  344. }
  345. if ((*(status))[i]) {
  346. free ((*(status))[i]);
  347. }
  348. }
  349. free (*status);
  350. error_free_interface_names:
  351. free (*interface_names);
  352. no_error:
  353. saHandleInstancePut (&cfg_hdb, cfg_handle);
  354. return (error);
  355. }
  356. SaAisErrorT
  357. openais_cfg_ring_reenable (
  358. openais_cfg_handle_t cfg_handle)
  359. {
  360. struct cfg_instance *cfg_instance;
  361. struct req_lib_cfg_ringreenable req_lib_cfg_ringreenable;
  362. struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
  363. SaAisErrorT error;
  364. error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
  365. if (error != SA_AIS_OK) {
  366. return (error);
  367. }
  368. req_lib_cfg_ringreenable.header.size = sizeof (struct req_lib_cfg_ringreenable);
  369. req_lib_cfg_ringreenable.header.id = MESSAGE_REQ_CFG_RINGREENABLE;
  370. pthread_mutex_lock (&cfg_instance->response_mutex);
  371. error = saSendReceiveReply (cfg_instance->response_fd,
  372. &req_lib_cfg_ringreenable,
  373. sizeof (struct req_lib_cfg_ringreenable),
  374. &res_lib_cfg_ringreenable,
  375. sizeof (struct res_lib_cfg_ringreenable));
  376. pthread_mutex_unlock (&cfg_instance->response_mutex);
  377. saHandleInstancePut (&cfg_hdb, cfg_handle);
  378. return (error);
  379. }
  380. SaAisErrorT
  381. openais_cfg_state_track (
  382. openais_cfg_handle_t cfg_handle,
  383. SaUint8T trackFlags,
  384. const OpenaisCfgStateNotificationT *notificationBuffer)
  385. {
  386. struct cfg_instance *cfg_instance;
  387. struct req_lib_cfg_statetrack req_lib_cfg_statetrack;
  388. struct res_lib_cfg_statetrack res_lib_cfg_statetrack;
  389. SaAisErrorT error;
  390. req_lib_cfg_statetrack.header.size = sizeof (struct req_lib_cfg_statetrack);
  391. req_lib_cfg_statetrack.header.id = MESSAGE_REQ_CFG_STATETRACKSTART;
  392. req_lib_cfg_statetrack.trackFlags = trackFlags;
  393. req_lib_cfg_statetrack.notificationBufferAddress = (OpenaisCfgStateNotificationT *)notificationBuffer;
  394. error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
  395. (void *)&cfg_instance);
  396. if (error != SA_AIS_OK) {
  397. return (error);
  398. }
  399. pthread_mutex_lock (&cfg_instance->response_mutex);
  400. error = saSendReceiveReply (cfg_instance->response_fd,
  401. &req_lib_cfg_statetrack,
  402. sizeof (struct req_lib_cfg_statetrack),
  403. &res_lib_cfg_statetrack,
  404. sizeof (struct res_lib_cfg_statetrack));
  405. pthread_mutex_unlock (&cfg_instance->response_mutex);
  406. saHandleInstancePut (&cfg_hdb, cfg_handle);
  407. return (error == SA_AIS_OK ? res_lib_cfg_statetrack.header.error : error);
  408. }
  409. SaAisErrorT
  410. openais_cfg_state_track_stop (
  411. openais_cfg_handle_t cfg_handle)
  412. {
  413. struct cfg_instance *cfg_instance;
  414. struct req_lib_cfg_statetrackstop req_lib_cfg_statetrackstop;
  415. struct res_lib_cfg_statetrackstop res_lib_cfg_statetrackstop;
  416. SaAisErrorT error;
  417. error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
  418. (void *)&cfg_instance);
  419. if (error != SA_AIS_OK) {
  420. return (error);
  421. }
  422. req_lib_cfg_statetrackstop.header.size = sizeof (struct req_lib_cfg_statetrackstop);
  423. req_lib_cfg_statetrackstop.header.id = MESSAGE_REQ_CFG_STATETRACKSTOP;
  424. pthread_mutex_lock (&cfg_instance->response_mutex);
  425. error = saSendReceiveReply (cfg_instance->response_fd,
  426. &req_lib_cfg_statetrackstop,
  427. sizeof (struct req_lib_cfg_statetrackstop),
  428. &res_lib_cfg_statetrackstop,
  429. sizeof (struct res_lib_cfg_statetrackstop));
  430. pthread_mutex_unlock (&cfg_instance->response_mutex);
  431. saHandleInstancePut (&cfg_hdb, cfg_handle);
  432. return (error == SA_AIS_OK ? res_lib_cfg_statetrackstop.header.error : error);
  433. }
  434. SaAisErrorT
  435. openais_cfg_admin_state_get (
  436. openais_cfg_handle_t cfg_handle,
  437. OpenaisCfgAdministrativeTargetT administrativeTarget,
  438. OpenaisCfgAdministrativeStateT *administrativeState)
  439. {
  440. struct cfg_instance *cfg_instance;
  441. struct req_lib_cfg_administrativestateget req_lib_cfg_administrativestateget;
  442. struct res_lib_cfg_administrativestateget res_lib_cfg_administrativestateget;
  443. SaAisErrorT error;
  444. error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
  445. (void *)&cfg_instance);
  446. if (error != SA_AIS_OK) {
  447. return (error);
  448. }
  449. req_lib_cfg_administrativestateget.header.id = MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET;
  450. req_lib_cfg_administrativestateget.header.size = sizeof (struct req_lib_cfg_administrativestateget);
  451. req_lib_cfg_administrativestateget.administrativeTarget = administrativeTarget;
  452. error = saSendReceiveReply (cfg_instance->response_fd,
  453. &req_lib_cfg_administrativestateget,
  454. sizeof (struct req_lib_cfg_administrativestateget),
  455. &res_lib_cfg_administrativestateget,
  456. sizeof (struct res_lib_cfg_administrativestateget));
  457. error = res_lib_cfg_administrativestateget.header.error;
  458. pthread_mutex_unlock (&cfg_instance->response_mutex);
  459. saHandleInstancePut (&cfg_hdb, cfg_handle);
  460. return (error == SA_AIS_OK ? res_lib_cfg_administrativestateget.header.error : error);
  461. }
  462. SaAisErrorT
  463. openais_cfg_admin_state_set (
  464. openais_cfg_handle_t cfg_handle,
  465. OpenaisCfgAdministrativeTargetT administrativeTarget,
  466. OpenaisCfgAdministrativeStateT administrativeState)
  467. {
  468. struct cfg_instance *cfg_instance;
  469. struct req_lib_cfg_administrativestateset req_lib_cfg_administrativestateset;
  470. struct res_lib_cfg_administrativestateset res_lib_cfg_administrativestateset;
  471. SaAisErrorT error;
  472. error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
  473. (void *)&cfg_instance);
  474. if (error != SA_AIS_OK) {
  475. return (error);
  476. }
  477. req_lib_cfg_administrativestateset.header.id = MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET;
  478. req_lib_cfg_administrativestateset.header.size = sizeof (struct req_lib_cfg_administrativestateset);
  479. req_lib_cfg_administrativestateset.administrativeTarget = administrativeTarget;
  480. req_lib_cfg_administrativestateset.administrativeState = administrativeState;
  481. error = saSendReceiveReply (cfg_instance->response_fd,
  482. &req_lib_cfg_administrativestateset,
  483. sizeof (struct req_lib_cfg_administrativestateset),
  484. &res_lib_cfg_administrativestateset,
  485. sizeof (struct res_lib_cfg_administrativestateset));
  486. error = res_lib_cfg_administrativestateset.header.error;
  487. pthread_mutex_unlock (&cfg_instance->response_mutex);
  488. saHandleInstancePut (&cfg_hdb, cfg_handle);
  489. return (error == SA_AIS_OK ? res_lib_cfg_administrativestateset.header.error : error);
  490. }