cpg.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. /*
  2. * vi: set autoindent tabstop=4 shiftwidth=4 :
  3. *
  4. * Copyright (c) 2006 Red Hat, Inc.
  5. *
  6. * All rights reserved.
  7. *
  8. * Author: Patrick Caulfield (pcaulfie@redhat.com)
  9. *
  10. * This software licensed under BSD license, the text of which follows:
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * - Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  21. * contributors may be used to endorse or promote products derived from this
  22. * software without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  28. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  31. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  32. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  33. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  34. * THE POSSIBILITY OF SUCH DAMAGE.
  35. */
  36. /*
  37. * Provides a closed process group API using the openais executive
  38. */
  39. #include <stdlib.h>
  40. #include <string.h>
  41. #include <unistd.h>
  42. #include <pthread.h>
  43. #include <sys/types.h>
  44. #include <sys/socket.h>
  45. #include <errno.h>
  46. #include "../include/saAis.h"
  47. #include "../include/cpg.h"
  48. #include "../include/ipc_cpg.h"
  49. #include "../include/mar_cpg.h"
  50. #include "util.h"
  51. struct cpg_inst {
  52. int response_fd;
  53. int dispatch_fd;
  54. int finalize;
  55. cpg_flow_control_state_t flow_control_state;
  56. cpg_callbacks_t callbacks;
  57. pthread_mutex_t response_mutex;
  58. pthread_mutex_t dispatch_mutex;
  59. };
  60. static void cpg_instance_destructor (void *instance);
  61. static struct saHandleDatabase cpg_handle_t_db = {
  62. .handleCount = 0,
  63. .handles = 0,
  64. .mutex = PTHREAD_MUTEX_INITIALIZER,
  65. .handleInstanceDestructor = cpg_instance_destructor
  66. };
  67. /*
  68. * Clean up function for a cpg instance (cpg_nitialize) handle
  69. */
  70. static void cpg_instance_destructor (void *instance)
  71. {
  72. }
  73. /**
  74. * @defgroup cpg_openais The closed process group API
  75. * @ingroup openais
  76. *
  77. * @{
  78. */
  79. cpg_error_t cpg_initialize (
  80. cpg_handle_t *handle,
  81. cpg_callbacks_t *callbacks)
  82. {
  83. SaAisErrorT error;
  84. struct cpg_inst *cpg_inst;
  85. error = saHandleCreate (&cpg_handle_t_db, sizeof (struct cpg_inst), handle);
  86. if (error != SA_AIS_OK) {
  87. goto error_no_destroy;
  88. }
  89. error = saHandleInstanceGet (&cpg_handle_t_db, *handle, (void *)&cpg_inst);
  90. if (error != SA_AIS_OK) {
  91. goto error_destroy;
  92. }
  93. error = saServiceConnect (&cpg_inst->dispatch_fd,
  94. &cpg_inst->response_fd,
  95. CPG_SERVICE);
  96. if (error != SA_AIS_OK) {
  97. goto error_put_destroy;
  98. }
  99. memcpy (&cpg_inst->callbacks, callbacks, sizeof (cpg_callbacks_t));
  100. pthread_mutex_init (&cpg_inst->response_mutex, NULL);
  101. pthread_mutex_init (&cpg_inst->dispatch_mutex, NULL);
  102. saHandleInstancePut (&cpg_handle_t_db, *handle);
  103. return (SA_AIS_OK);
  104. error_put_destroy:
  105. saHandleInstancePut (&cpg_handle_t_db, *handle);
  106. error_destroy:
  107. saHandleDestroy (&cpg_handle_t_db, *handle);
  108. error_no_destroy:
  109. return (error);
  110. }
  111. cpg_error_t cpg_finalize (
  112. cpg_handle_t handle)
  113. {
  114. struct cpg_inst *cpg_inst;
  115. SaAisErrorT error;
  116. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  117. if (error != SA_AIS_OK) {
  118. return (error);
  119. }
  120. pthread_mutex_lock (&cpg_inst->response_mutex);
  121. /*
  122. * Another thread has already started finalizing
  123. */
  124. if (cpg_inst->finalize) {
  125. pthread_mutex_unlock (&cpg_inst->response_mutex);
  126. saHandleInstancePut (&cpg_handle_t_db, handle);
  127. return (CPG_ERR_BAD_HANDLE);
  128. }
  129. cpg_inst->finalize = 1;
  130. pthread_mutex_unlock (&cpg_inst->response_mutex);
  131. saHandleDestroy (&cpg_handle_t_db, handle);
  132. /*
  133. * Disconnect from the server
  134. */
  135. if (cpg_inst->response_fd != -1) {
  136. shutdown(cpg_inst->response_fd, 0);
  137. close(cpg_inst->response_fd);
  138. }
  139. if (cpg_inst->dispatch_fd != -1) {
  140. shutdown(cpg_inst->dispatch_fd, 0);
  141. close(cpg_inst->dispatch_fd);
  142. }
  143. saHandleInstancePut (&cpg_handle_t_db, handle);
  144. return (CPG_OK);
  145. }
  146. cpg_error_t cpg_fd_get (
  147. cpg_handle_t handle,
  148. int *fd)
  149. {
  150. SaAisErrorT error;
  151. struct cpg_inst *cpg_inst;
  152. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  153. if (error != SA_AIS_OK) {
  154. return (error);
  155. }
  156. *fd = cpg_inst->dispatch_fd;
  157. saHandleInstancePut (&cpg_handle_t_db, handle);
  158. return (SA_AIS_OK);
  159. }
  160. struct res_overlay {
  161. mar_res_header_t header __attribute__((aligned(8)));
  162. char data[512000];
  163. };
  164. cpg_error_t cpg_dispatch (
  165. cpg_handle_t handle,
  166. cpg_dispatch_t dispatch_types)
  167. {
  168. struct pollfd ufds;
  169. int timeout = -1;
  170. SaAisErrorT error;
  171. int cont = 1; /* always continue do loop except when set to 0 */
  172. int dispatch_avail;
  173. struct cpg_inst *cpg_inst;
  174. struct res_lib_cpg_confchg_callback *res_cpg_confchg_callback;
  175. struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback;
  176. cpg_callbacks_t callbacks;
  177. struct res_overlay dispatch_data;
  178. int ignore_dispatch = 0;
  179. struct cpg_address member_list[CPG_MEMBERS_MAX];
  180. struct cpg_address left_list[CPG_MEMBERS_MAX];
  181. struct cpg_address joined_list[CPG_MEMBERS_MAX];
  182. struct cpg_name group_name;
  183. mar_cpg_address_t *left_list_start;
  184. mar_cpg_address_t *joined_list_start;
  185. unsigned int i;
  186. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  187. if (error != SA_AIS_OK) {
  188. return (error);
  189. }
  190. /*
  191. * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and
  192. * wait indefinately for SA_DISPATCH_BLOCKING
  193. */
  194. if (dispatch_types == CPG_DISPATCH_ALL) {
  195. timeout = 0;
  196. }
  197. do {
  198. ufds.fd = cpg_inst->dispatch_fd;
  199. ufds.events = POLLIN;
  200. ufds.revents = 0;
  201. error = saPollRetry (&ufds, 1, timeout);
  202. if (error != SA_AIS_OK) {
  203. goto error_nounlock;
  204. }
  205. pthread_mutex_lock (&cpg_inst->dispatch_mutex);
  206. /*
  207. * Regather poll data in case ufds has changed since taking lock
  208. */
  209. error = saPollRetry (&ufds, 1, timeout);
  210. if (error != SA_AIS_OK) {
  211. goto error_nounlock;
  212. }
  213. /*
  214. * Handle has been finalized in another thread
  215. */
  216. if (cpg_inst->finalize == 1) {
  217. error = CPG_OK;
  218. pthread_mutex_unlock (&cpg_inst->dispatch_mutex);
  219. goto error_unlock;
  220. }
  221. dispatch_avail = ufds.revents & POLLIN;
  222. if (dispatch_avail == 0 && dispatch_types == CPG_DISPATCH_ALL) {
  223. pthread_mutex_unlock (&cpg_inst->dispatch_mutex);
  224. break; /* exit do while cont is 1 loop */
  225. } else
  226. if (dispatch_avail == 0) {
  227. pthread_mutex_unlock (&cpg_inst->dispatch_mutex);
  228. continue; /* next poll */
  229. }
  230. if (ufds.revents & POLLIN) {
  231. /*
  232. * Queue empty, read response from socket
  233. */
  234. error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.header,
  235. sizeof (mar_res_header_t));
  236. if (error != SA_AIS_OK) {
  237. goto error_unlock;
  238. }
  239. if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
  240. error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.data,
  241. dispatch_data.header.size - sizeof (mar_res_header_t));
  242. if (error != SA_AIS_OK) {
  243. goto error_unlock;
  244. }
  245. }
  246. } else {
  247. pthread_mutex_unlock (&cpg_inst->dispatch_mutex);
  248. continue;
  249. }
  250. /*
  251. * Make copy of callbacks, message data, unlock instance, and call callback
  252. * A risk of this dispatch method is that the callback routines may
  253. * operate at the same time that cpgFinalize has been called.
  254. */
  255. memcpy (&callbacks, &cpg_inst->callbacks, sizeof (cpg_callbacks_t));
  256. pthread_mutex_unlock (&cpg_inst->dispatch_mutex);
  257. /*
  258. * Dispatch incoming message
  259. */
  260. switch (dispatch_data.header.id) {
  261. case MESSAGE_RES_CPG_DELIVER_CALLBACK:
  262. res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)&dispatch_data;
  263. cpg_inst->flow_control_state = res_cpg_deliver_callback->flow_control_state;
  264. marshall_from_mar_cpg_name_t (
  265. &group_name,
  266. &res_cpg_deliver_callback->group_name);
  267. callbacks.cpg_deliver_fn (handle,
  268. &group_name,
  269. res_cpg_deliver_callback->nodeid,
  270. res_cpg_deliver_callback->pid,
  271. &res_cpg_deliver_callback->message,
  272. res_cpg_deliver_callback->msglen);
  273. break;
  274. case MESSAGE_RES_CPG_CONFCHG_CALLBACK:
  275. res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)&dispatch_data;
  276. for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) {
  277. marshall_from_mar_cpg_address_t (&member_list[i],
  278. &res_cpg_confchg_callback->member_list[i]);
  279. }
  280. left_list_start = res_cpg_confchg_callback->member_list +
  281. res_cpg_confchg_callback->member_list_entries;
  282. for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) {
  283. marshall_from_mar_cpg_address_t (&left_list[i],
  284. &left_list_start[i]);
  285. }
  286. joined_list_start = res_cpg_confchg_callback->member_list +
  287. res_cpg_confchg_callback->member_list_entries +
  288. res_cpg_confchg_callback->left_list_entries;
  289. for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) {
  290. marshall_from_mar_cpg_address_t (&joined_list[i],
  291. &joined_list_start[i]);
  292. }
  293. marshall_from_mar_cpg_name_t (
  294. &group_name,
  295. &res_cpg_confchg_callback->group_name);
  296. callbacks.cpg_confchg_fn (handle,
  297. &group_name,
  298. member_list,
  299. res_cpg_confchg_callback->member_list_entries,
  300. left_list,
  301. res_cpg_confchg_callback->left_list_entries,
  302. joined_list,
  303. res_cpg_confchg_callback->joined_list_entries);
  304. break;
  305. default:
  306. error = SA_AIS_ERR_LIBRARY;
  307. goto error_nounlock;
  308. break;
  309. }
  310. /*
  311. * Determine if more messages should be processed
  312. * */
  313. switch (dispatch_types) {
  314. case CPG_DISPATCH_ONE:
  315. if (ignore_dispatch) {
  316. ignore_dispatch = 0;
  317. } else {
  318. cont = 0;
  319. }
  320. break;
  321. case CPG_DISPATCH_ALL:
  322. if (ignore_dispatch) {
  323. ignore_dispatch = 0;
  324. }
  325. break;
  326. case CPG_DISPATCH_BLOCKING:
  327. break;
  328. }
  329. } while (cont);
  330. error_unlock:
  331. saHandleInstancePut (&cpg_handle_t_db, handle);
  332. error_nounlock:
  333. return (error);
  334. }
  335. cpg_error_t cpg_join (
  336. cpg_handle_t handle,
  337. struct cpg_name *group)
  338. {
  339. cpg_error_t error;
  340. struct cpg_inst *cpg_inst;
  341. struct iovec iov[2];
  342. struct req_lib_cpg_join req_lib_cpg_join;
  343. struct res_lib_cpg_join res_lib_cpg_join;
  344. struct req_lib_cpg_trackstart req_lib_cpg_trackstart;
  345. struct res_lib_cpg_trackstart res_lib_cpg_trackstart;
  346. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  347. if (error != SA_AIS_OK) {
  348. return (error);
  349. }
  350. pthread_mutex_lock (&cpg_inst->response_mutex);
  351. /* Automatically add a tracker */
  352. req_lib_cpg_trackstart.header.size = sizeof (struct req_lib_cpg_trackstart);
  353. req_lib_cpg_trackstart.header.id = MESSAGE_REQ_CPG_TRACKSTART;
  354. marshall_to_mar_cpg_name_t (&req_lib_cpg_trackstart.group_name,
  355. group);
  356. iov[0].iov_base = &req_lib_cpg_trackstart;
  357. iov[0].iov_len = sizeof (struct req_lib_cpg_trackstart);
  358. error = saSendMsgReceiveReply (cpg_inst->dispatch_fd, iov, 1,
  359. &res_lib_cpg_trackstart, sizeof (struct res_lib_cpg_trackstart));
  360. if (error != SA_AIS_OK) {
  361. pthread_mutex_unlock (&cpg_inst->response_mutex);
  362. goto error_exit;
  363. }
  364. /* Now join */
  365. req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join);
  366. req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN;
  367. req_lib_cpg_join.pid = getpid();
  368. marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name,
  369. group);
  370. iov[0].iov_base = &req_lib_cpg_join;
  371. iov[0].iov_len = sizeof (struct req_lib_cpg_join);
  372. error = saSendMsgReceiveReply (cpg_inst->response_fd, iov, 1,
  373. &res_lib_cpg_join, sizeof (struct res_lib_cpg_join));
  374. pthread_mutex_unlock (&cpg_inst->response_mutex);
  375. if (error != SA_AIS_OK) {
  376. goto error_exit;
  377. }
  378. error = res_lib_cpg_join.header.error;
  379. error_exit:
  380. saHandleInstancePut (&cpg_handle_t_db, handle);
  381. return (error);
  382. }
  383. cpg_error_t cpg_leave (
  384. cpg_handle_t handle,
  385. struct cpg_name *group)
  386. {
  387. cpg_error_t error;
  388. struct cpg_inst *cpg_inst;
  389. struct iovec iov[2];
  390. struct req_lib_cpg_leave req_lib_cpg_leave;
  391. struct res_lib_cpg_leave res_lib_cpg_leave;
  392. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  393. if (error != SA_AIS_OK) {
  394. return (error);
  395. }
  396. req_lib_cpg_leave.header.size = sizeof (struct req_lib_cpg_leave);
  397. req_lib_cpg_leave.header.id = MESSAGE_REQ_CPG_LEAVE;
  398. req_lib_cpg_leave.pid = getpid();
  399. marshall_to_mar_cpg_name_t (&req_lib_cpg_leave.group_name,
  400. group);
  401. iov[0].iov_base = &req_lib_cpg_leave;
  402. iov[0].iov_len = sizeof (struct req_lib_cpg_leave);
  403. pthread_mutex_lock (&cpg_inst->response_mutex);
  404. error = saSendMsgReceiveReply (cpg_inst->response_fd, iov, 1,
  405. &res_lib_cpg_leave, sizeof (struct res_lib_cpg_leave));
  406. pthread_mutex_unlock (&cpg_inst->response_mutex);
  407. if (error != SA_AIS_OK) {
  408. goto error_exit;
  409. }
  410. error = res_lib_cpg_leave.header.error;
  411. error_exit:
  412. saHandleInstancePut (&cpg_handle_t_db, handle);
  413. return (error);
  414. }
  415. cpg_error_t cpg_mcast_joined (
  416. cpg_handle_t handle,
  417. cpg_guarantee_t guarantee,
  418. struct iovec *iovec,
  419. int iov_len)
  420. {
  421. int i;
  422. cpg_error_t error;
  423. struct cpg_inst *cpg_inst;
  424. struct iovec iov[64];
  425. struct req_lib_cpg_mcast req_lib_cpg_mcast;
  426. struct res_lib_cpg_mcast res_lib_cpg_mcast;
  427. int msg_len = 0;
  428. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  429. if (error != SA_AIS_OK) {
  430. return (error);
  431. }
  432. for (i = 0; i < iov_len; i++ ) {
  433. msg_len += iovec[i].iov_len;
  434. }
  435. req_lib_cpg_mcast.header.size = sizeof (struct req_lib_cpg_mcast) +
  436. msg_len;
  437. req_lib_cpg_mcast.header.id = MESSAGE_REQ_CPG_MCAST;
  438. req_lib_cpg_mcast.guarantee = guarantee;
  439. req_lib_cpg_mcast.msglen = msg_len;
  440. iov[0].iov_base = &req_lib_cpg_mcast;
  441. iov[0].iov_len = sizeof (struct req_lib_cpg_mcast);
  442. memcpy (&iov[1], iovec, iov_len * sizeof (struct iovec));
  443. pthread_mutex_lock (&cpg_inst->response_mutex);
  444. error = saSendMsgReceiveReply (cpg_inst->response_fd, iov, iov_len + 1,
  445. &res_lib_cpg_mcast, sizeof (res_lib_cpg_mcast));
  446. pthread_mutex_unlock (&cpg_inst->response_mutex);
  447. if (error != SA_AIS_OK) {
  448. goto error_exit;
  449. }
  450. cpg_inst->flow_control_state = res_lib_cpg_mcast.flow_control_state;
  451. if (res_lib_cpg_mcast.header.error == CPG_ERR_TRY_AGAIN) {
  452. cpg_inst->flow_control_state = CPG_FLOW_CONTROL_ENABLED;
  453. }
  454. error = res_lib_cpg_mcast.header.error;
  455. error_exit:
  456. saHandleInstancePut (&cpg_handle_t_db, handle);
  457. return (error);
  458. }
  459. cpg_error_t cpg_membership_get (
  460. cpg_handle_t handle,
  461. struct cpg_name *group_name,
  462. struct cpg_address *member_list,
  463. int *member_list_entries)
  464. {
  465. cpg_error_t error;
  466. struct cpg_inst *cpg_inst;
  467. struct iovec iov;
  468. struct req_lib_cpg_membership req_lib_cpg_membership_get;
  469. struct res_lib_cpg_confchg_callback res_lib_cpg_membership_get;
  470. unsigned int i;
  471. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  472. if (error != SA_AIS_OK) {
  473. return (error);
  474. }
  475. req_lib_cpg_membership_get.header.size = sizeof (mar_req_header_t);
  476. req_lib_cpg_membership_get.header.id = MESSAGE_REQ_CPG_MEMBERSHIP;
  477. marshall_to_mar_cpg_name_t (&req_lib_cpg_membership_get.group_name,
  478. group_name);
  479. iov.iov_base = &req_lib_cpg_membership_get;
  480. iov.iov_len = sizeof (mar_req_header_t);
  481. pthread_mutex_lock (&cpg_inst->response_mutex);
  482. error = saSendMsgReceiveReply (cpg_inst->response_fd, &iov, 1,
  483. &res_lib_cpg_membership_get, sizeof (mar_res_header_t));
  484. pthread_mutex_unlock (&cpg_inst->response_mutex);
  485. if (error != SA_AIS_OK) {
  486. goto error_exit;
  487. }
  488. error = res_lib_cpg_membership_get.header.error;
  489. /*
  490. * Copy results to caller
  491. */
  492. *member_list_entries = res_lib_cpg_membership_get.member_list_entries;
  493. if (member_list) {
  494. for (i = 0; i < res_lib_cpg_membership_get.member_list_entries; i++) {
  495. marshall_from_mar_cpg_address_t (&member_list[i],
  496. &res_lib_cpg_membership_get.member_list[i]);
  497. }
  498. }
  499. error_exit:
  500. saHandleInstancePut (&cpg_handle_t_db, handle);
  501. return (error);
  502. }
  503. cpg_error_t cpg_flow_control_state_get (
  504. cpg_handle_t handle,
  505. cpg_flow_control_state_t *flow_control_state)
  506. {
  507. cpg_error_t error;
  508. struct cpg_inst *cpg_inst;
  509. error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
  510. if (error != SA_AIS_OK) {
  511. return (error);
  512. }
  513. *flow_control_state = cpg_inst->flow_control_state;
  514. saHandleInstancePut (&cpg_handle_t_db, handle);
  515. return (error);
  516. }
  517. /** @} */