ckpt.c 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574
  1. /*
  2. * Copyright (c) 2002-2004 MontaVista Software, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Author: Steven Dake (sdake@mvista.com)
  7. *
  8. * This software licensed under BSD license, the text of which follows:
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions are met:
  12. *
  13. * - Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  26. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  27. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  28. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  30. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  32. * THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #include <stdio.h>
  35. #include <string.h>
  36. #include <stdlib.h>
  37. #include <assert.h>
  38. #include <unistd.h>
  39. #include <errno.h>
  40. #include <pthread.h>
  41. #include <sys/types.h>
  42. #include <sys/uio.h>
  43. #include <sys/socket.h>
  44. #include <sys/select.h>
  45. #include <sys/un.h>
  46. #include "util.h"
  47. #include "../include/list.h"
  48. #include "../include/saCkpt.h"
  49. #include "../include/ipc_gen.h"
  50. #include "../include/ipc_ckpt.h"
  51. struct message_overlay {
  52. struct res_header header;
  53. char data[4096];
  54. };
  55. /*
  56. * Data structure for instance data
  57. */
  58. struct ckptInstance {
  59. int response_fd;
  60. int dispatch_fd;
  61. SaCkptCallbacksT callbacks;
  62. int finalize;
  63. pthread_mutex_t response_mutex;
  64. pthread_mutex_t dispatch_mutex;
  65. struct list_head checkpoint_list;
  66. };
  67. struct ckptCheckpointInstance {
  68. int response_fd;
  69. SaCkptHandleT ckptHandle;
  70. SaCkptCheckpointHandleT checkpointHandle;
  71. SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
  72. SaNameT checkpointName;
  73. pthread_mutex_t response_mutex;
  74. struct list_head list;
  75. };
  76. struct ckptSectionIterationInstance {
  77. int response_fd;
  78. SaCkptCheckpointHandleT checkpointHandle;
  79. struct list_head sectionIdListHead;
  80. pthread_mutex_t response_mutex;
  81. };
  82. void ckptHandleInstanceDestructor (void *instance);
  83. void checkpointHandleInstanceDestructor (void *instance);
  84. void ckptSectionIterationHandleInstanceDestructor (void *instance);
  85. /*
  86. * All CKPT instances in this database
  87. */
  88. static struct saHandleDatabase ckptHandleDatabase = {
  89. .handleCount = 0,
  90. .handles = 0,
  91. .mutex = PTHREAD_MUTEX_INITIALIZER,
  92. .handleInstanceDestructor = ckptHandleInstanceDestructor
  93. };
  94. /*
  95. * All Checkpoint instances in this database
  96. */
  97. static struct saHandleDatabase checkpointHandleDatabase = {
  98. .handleCount = 0,
  99. .handles = 0,
  100. .mutex = PTHREAD_MUTEX_INITIALIZER,
  101. .handleInstanceDestructor = checkpointHandleInstanceDestructor
  102. };
  103. /*
  104. * All section iterators in this database
  105. */
  106. static struct saHandleDatabase ckptSectionIterationHandleDatabase = {
  107. .handleCount = 0,
  108. .handles = 0,
  109. .mutex = PTHREAD_MUTEX_INITIALIZER,
  110. .handleInstanceDestructor = ckptSectionIterationHandleInstanceDestructor
  111. };
  112. /*
  113. * Versions supported
  114. */
  115. static SaVersionT ckptVersionsSupported[] = {
  116. { 'B', 1, 1 }
  117. };
  118. static struct saVersionDatabase ckptVersionDatabase = {
  119. sizeof (ckptVersionsSupported) / sizeof (SaVersionT),
  120. ckptVersionsSupported
  121. };
  122. /*
  123. * Implementation
  124. */
  125. void ckptHandleInstanceDestructor (void *instance)
  126. {
  127. struct ckptInstance *ckptInstance = (struct ckptInstance *)instance;
  128. }
  129. void checkpointHandleInstanceDestructor (void *instance)
  130. {
  131. return;
  132. }
  133. void ckptSectionIterationHandleInstanceDestructor (void *instance)
  134. {
  135. struct ckptSectionIterationInstance *ckptSectionIterationInstance = (struct ckptSectionIterationInstance *)instance;
  136. if (ckptSectionIterationInstance->response_fd != -1) {
  137. shutdown (ckptSectionIterationInstance->response_fd, 0);
  138. close (ckptSectionIterationInstance->response_fd);
  139. }
  140. }
  141. SaAisErrorT
  142. saCkptInitialize (
  143. SaCkptHandleT *ckptHandle,
  144. const SaCkptCallbacksT *callbacks,
  145. SaVersionT *version)
  146. {
  147. struct ckptInstance *ckptInstance;
  148. SaAisErrorT error = SA_AIS_OK;
  149. error = saVersionVerify (&ckptVersionDatabase, version);
  150. if (error != SA_AIS_OK) {
  151. goto error_no_destroy;
  152. }
  153. error = saHandleCreate (&ckptHandleDatabase, sizeof (struct ckptInstance),
  154. ckptHandle);
  155. if (error != SA_AIS_OK) {
  156. goto error_no_destroy;
  157. }
  158. error = saHandleInstanceGet (&ckptHandleDatabase, *ckptHandle,
  159. (void *)&ckptInstance);
  160. if (error != SA_AIS_OK) {
  161. goto error_destroy;
  162. }
  163. ckptInstance->response_fd = -1;
  164. error = saServiceConnectTwo (&ckptInstance->response_fd,
  165. &ckptInstance->dispatch_fd, CKPT_SERVICE);
  166. if (error != SA_AIS_OK) {
  167. goto error_put_destroy;
  168. }
  169. memcpy (&ckptInstance->callbacks, callbacks, sizeof (SaCkptCallbacksT));
  170. list_init (&ckptInstance->checkpoint_list);
  171. pthread_mutex_init (&ckptInstance->response_mutex, NULL);
  172. saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
  173. return (SA_AIS_OK);
  174. error_put_destroy:
  175. saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
  176. error_destroy:
  177. saHandleDestroy (&ckptHandleDatabase, *ckptHandle);
  178. error_no_destroy:
  179. return (error);
  180. }
  181. SaAisErrorT
  182. saCkptSelectionObjectGet (
  183. const SaCkptHandleT ckptHandle,
  184. SaSelectionObjectT *selectionObject)
  185. {
  186. struct ckptInstance *ckptInstance;
  187. SaAisErrorT error;
  188. if (selectionObject == NULL) {
  189. return (SA_AIS_ERR_INVALID_PARAM);
  190. }
  191. error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle, (void *)&ckptInstance);
  192. if (error != SA_AIS_OK) {
  193. return (error);
  194. }
  195. *selectionObject = ckptInstance->dispatch_fd;
  196. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  197. return (SA_AIS_OK);
  198. }
  199. SaAisErrorT
  200. saCkptDispatch (
  201. const SaCkptHandleT ckptHandle,
  202. SaDispatchFlagsT dispatchFlags)
  203. {
  204. struct pollfd ufds;
  205. int poll_fd;
  206. int timeout = 1;
  207. SaCkptCallbacksT callbacks;
  208. SaAisErrorT error;
  209. int dispatch_avail;
  210. struct ckptInstance *ckptInstance;
  211. int cont = 1; /* always continue do loop except when set to 0 */
  212. struct message_overlay dispatch_data;
  213. struct res_lib_ckpt_checkpointopenasync *res_lib_ckpt_checkpointopenasync;
  214. struct ckptCheckpointInstance *ckptCheckpointInstance;
  215. error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle,
  216. (void *)&ckptInstance);
  217. if (error != SA_AIS_OK) {
  218. goto error_exit;
  219. }
  220. /*
  221. * Timeout instantly for SA_DISPATCH_ALL
  222. */
  223. if (dispatchFlags == SA_DISPATCH_ALL) {
  224. timeout = 0;
  225. }
  226. do {
  227. /*
  228. * Read data directly from socket
  229. */
  230. poll_fd = ckptInstance->dispatch_fd;
  231. ufds.fd = poll_fd;
  232. ufds.events = POLLIN;
  233. ufds.revents = 0;
  234. error = saPollRetry(&ufds, 1, timeout);
  235. if (error != SA_AIS_OK) {
  236. goto error_put;
  237. }
  238. pthread_mutex_lock(&ckptInstance->dispatch_mutex);
  239. if (ckptInstance->finalize == 1) {
  240. error = SA_AIS_OK;
  241. goto error_unlock;
  242. }
  243. if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) {
  244. error = SA_AIS_ERR_BAD_HANDLE;
  245. goto error_unlock;
  246. }
  247. dispatch_avail = (ufds.revents & POLLIN);
  248. if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
  249. pthread_mutex_unlock(&ckptInstance->dispatch_mutex);
  250. break; /* exit do while cont is 1 loop */
  251. } else
  252. if (dispatch_avail == 0) {
  253. pthread_mutex_unlock(&ckptInstance->dispatch_mutex);
  254. continue;
  255. }
  256. memset(&dispatch_data,0, sizeof(struct message_overlay));
  257. error = saRecvRetry (ckptInstance->dispatch_fd, &dispatch_data.header, sizeof (struct res_header), MSG_WAITALL | MSG_NOSIGNAL);
  258. if (error != SA_AIS_OK) {
  259. goto error_unlock;
  260. }
  261. if (dispatch_data.header.size > sizeof (struct res_header)) {
  262. error = saRecvRetry (ckptInstance->dispatch_fd, &dispatch_data.data,
  263. dispatch_data.header.size - sizeof (struct res_header),
  264. MSG_WAITALL | MSG_NOSIGNAL);
  265. if (error != SA_AIS_OK) {
  266. goto error_unlock;
  267. }
  268. }
  269. /*
  270. * Make copy of callbacks, message data, unlock instance,
  271. * and call callback. A risk of this dispatch method is that
  272. * the callback routines may operate at the same time that
  273. * CkptFinalize has been called in another thread.
  274. */
  275. memcpy(&callbacks,&ckptInstance->callbacks, sizeof(ckptInstance->callbacks));
  276. pthread_mutex_unlock(&ckptInstance->dispatch_mutex);
  277. /*
  278. * Dispatch incoming response
  279. */
  280. switch (dispatch_data.header.id) {
  281. case MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC:
  282. res_lib_ckpt_checkpointopenasync = (struct res_lib_ckpt_checkpointopenasync *) &dispatch_data;
  283. /*
  284. * This instance get/listadd/put required so that close
  285. * later has the proper list of checkpoints
  286. */
  287. error = saHandleInstanceGet (&checkpointHandleDatabase,
  288. res_lib_ckpt_checkpointopenasync->checkpointHandle,
  289. (void *)&ckptCheckpointInstance);
  290. assert (error == SA_AIS_OK); /* should only be valid handles here */
  291. if (res_lib_ckpt_checkpointopenasync->header.error == SA_AIS_OK) {
  292. /*
  293. * open succeeded without error
  294. */
  295. list_init (&ckptCheckpointInstance->list);
  296. list_add (&ckptCheckpointInstance->list,
  297. &ckptInstance->checkpoint_list);
  298. callbacks.saCkptCheckpointOpenCallback(
  299. res_lib_ckpt_checkpointopenasync->invocation,
  300. res_lib_ckpt_checkpointopenasync->checkpointHandle,
  301. res_lib_ckpt_checkpointopenasync->header.error);
  302. saHandleInstancePut (&checkpointHandleDatabase,
  303. res_lib_ckpt_checkpointopenasync->checkpointHandle);
  304. } else {
  305. /*
  306. * open failed with error
  307. */
  308. saHandleInstancePut (&checkpointHandleDatabase,
  309. res_lib_ckpt_checkpointopenasync->checkpointHandle);
  310. saHandleDestroy (&checkpointHandleDatabase,
  311. res_lib_ckpt_checkpointopenasync->checkpointHandle);
  312. callbacks.saCkptCheckpointOpenCallback(
  313. res_lib_ckpt_checkpointopenasync->invocation,
  314. -1,
  315. res_lib_ckpt_checkpointopenasync->header.error);
  316. }
  317. break;
  318. default:
  319. /* TODO */
  320. break;
  321. }
  322. /*
  323. * Determine if more messages should be processed
  324. */
  325. switch (dispatchFlags) {
  326. case SA_DISPATCH_ONE:
  327. cont = 0;
  328. break;
  329. case SA_DISPATCH_ALL:
  330. break;
  331. case SA_DISPATCH_BLOCKING:
  332. break;
  333. }
  334. } while (cont);
  335. error_unlock:
  336. pthread_mutex_unlock(&ckptInstance->dispatch_mutex);
  337. error_put:
  338. saHandleInstancePut(&ckptHandleDatabase, ckptHandle);
  339. error_exit:
  340. return (error);
  341. }
  342. SaAisErrorT
  343. saCkptFinalize (
  344. const SaCkptHandleT ckptHandle)
  345. {
  346. struct ckptInstance *ckptInstance;
  347. SaAisErrorT error;
  348. struct list_head *list;
  349. struct ckptCheckpointInstance *ckptCheckpointInstance;
  350. error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle,
  351. (void *)&ckptInstance);
  352. if (error != SA_AIS_OK) {
  353. return (error);
  354. }
  355. pthread_mutex_lock (&ckptInstance->response_mutex);
  356. /*
  357. * Another thread has already started finalizing
  358. */
  359. if (ckptInstance->finalize) {
  360. pthread_mutex_unlock (&ckptInstance->response_mutex);
  361. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  362. return (SA_AIS_ERR_BAD_HANDLE);
  363. }
  364. ckptInstance->finalize = 1;
  365. pthread_mutex_unlock (&ckptInstance->response_mutex);
  366. for (list = ckptInstance->checkpoint_list.next;
  367. list != &ckptInstance->checkpoint_list;
  368. list = list->next) {
  369. ckptCheckpointInstance = list_entry (list,
  370. struct ckptCheckpointInstance, list);
  371. saHandleInstancePut (&checkpointHandleDatabase,
  372. ckptCheckpointInstance->checkpointHandle);
  373. }
  374. saHandleDestroy (&ckptHandleDatabase, ckptHandle);
  375. if (ckptInstance->response_fd != -1) {
  376. shutdown (ckptInstance->response_fd, 0);
  377. close (ckptInstance->response_fd);
  378. }
  379. if (ckptInstance->dispatch_fd != -1) {
  380. shutdown (ckptInstance->dispatch_fd, 0);
  381. close (ckptInstance->dispatch_fd);
  382. }
  383. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  384. return (SA_AIS_OK);
  385. }
  386. SaAisErrorT
  387. saCkptCheckpointOpen (
  388. SaCkptHandleT ckptHandle,
  389. const SaNameT *checkpointName,
  390. const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
  391. SaCkptCheckpointOpenFlagsT checkpointOpenFlags,
  392. SaTimeT timeout,
  393. SaCkptCheckpointHandleT *checkpointHandle)
  394. {
  395. SaAisErrorT error;
  396. struct ckptCheckpointInstance *ckptCheckpointInstance;
  397. struct ckptInstance *ckptInstance;
  398. struct req_lib_ckpt_checkpointopen req_lib_ckpt_checkpointopen;
  399. struct res_lib_ckpt_checkpointopen res_lib_ckpt_checkpointopen;
  400. if ((checkpointOpenFlags & SA_CKPT_CHECKPOINT_CREATE) &&
  401. checkpointCreationAttributes == NULL) {
  402. return (SA_AIS_ERR_INVALID_PARAM);
  403. }
  404. if (((checkpointOpenFlags & SA_CKPT_CHECKPOINT_CREATE) == 0) &&
  405. checkpointCreationAttributes != NULL) {
  406. return (SA_AIS_ERR_INVALID_PARAM);
  407. }
  408. error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle,
  409. (void *)&ckptInstance);
  410. if (error != SA_AIS_OK) {
  411. goto error_exit;
  412. }
  413. error = saHandleCreate (&checkpointHandleDatabase,
  414. sizeof (struct ckptCheckpointInstance), checkpointHandle);
  415. if (error != SA_AIS_OK) {
  416. goto error_put_ckpt;
  417. }
  418. error = saHandleInstanceGet (&checkpointHandleDatabase,
  419. *checkpointHandle, (void *)&ckptCheckpointInstance);
  420. if (error != SA_AIS_OK) {
  421. goto error_destroy;
  422. }
  423. ckptCheckpointInstance->response_fd = ckptInstance->response_fd;
  424. ckptCheckpointInstance->ckptHandle = ckptHandle;
  425. ckptCheckpointInstance->checkpointHandle = *checkpointHandle;
  426. ckptCheckpointInstance->checkpointOpenFlags = checkpointOpenFlags;
  427. req_lib_ckpt_checkpointopen.header.size = sizeof (struct req_lib_ckpt_checkpointopen);
  428. req_lib_ckpt_checkpointopen.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPEN;
  429. memcpy (&req_lib_ckpt_checkpointopen.checkpointName, checkpointName, sizeof (SaNameT));
  430. memcpy (&ckptCheckpointInstance->checkpointName, checkpointName, sizeof (SaNameT));
  431. req_lib_ckpt_checkpointopen.checkpointCreationAttributesSet = 0;
  432. if (checkpointCreationAttributes) {
  433. memcpy (&req_lib_ckpt_checkpointopen.checkpointCreationAttributes,
  434. checkpointCreationAttributes,
  435. sizeof (SaCkptCheckpointCreationAttributesT));
  436. req_lib_ckpt_checkpointopen.checkpointCreationAttributesSet = 1;
  437. }
  438. req_lib_ckpt_checkpointopen.checkpointOpenFlags = checkpointOpenFlags;
  439. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointopen,
  440. sizeof (struct req_lib_ckpt_checkpointopen), MSG_NOSIGNAL);
  441. if (error != SA_AIS_OK) {
  442. goto error_put_destroy;
  443. }
  444. error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_checkpointopen,
  445. sizeof (struct res_lib_ckpt_checkpointopen), MSG_WAITALL | MSG_NOSIGNAL);
  446. if (error != SA_AIS_OK) {
  447. goto error_put_destroy;
  448. }
  449. if (res_lib_ckpt_checkpointopen.header.error != SA_AIS_OK) {
  450. error = res_lib_ckpt_checkpointopen.header.error;
  451. goto error_put_destroy;
  452. }
  453. pthread_mutex_init (&ckptCheckpointInstance->response_mutex, NULL);
  454. saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
  455. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  456. list_init (&ckptCheckpointInstance->list);
  457. list_add (&ckptCheckpointInstance->list, &ckptInstance->checkpoint_list);
  458. return (error);
  459. error_put_destroy:
  460. saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
  461. error_destroy:
  462. saHandleDestroy (&checkpointHandleDatabase, *checkpointHandle);
  463. error_put_ckpt:
  464. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  465. error_exit:
  466. return (error);
  467. }
  468. SaAisErrorT
  469. saCkptCheckpointOpenAsync (
  470. const SaCkptHandleT ckptHandle,
  471. SaInvocationT invocation,
  472. const SaNameT *checkpointName,
  473. const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
  474. SaCkptCheckpointOpenFlagsT checkpointOpenFlags)
  475. {
  476. struct ckptCheckpointInstance *ckptCheckpointInstance;
  477. struct ckptInstance *ckptInstance;
  478. SaCkptCheckpointHandleT checkpointHandle;
  479. SaAisErrorT error;
  480. struct req_lib_ckpt_checkpointopenasync req_lib_ckpt_checkpointopenasync;
  481. if ((checkpointOpenFlags & SA_CKPT_CHECKPOINT_CREATE) &&
  482. checkpointCreationAttributes == NULL) {
  483. return (SA_AIS_ERR_INVALID_PARAM);
  484. }
  485. if (((checkpointOpenFlags & SA_CKPT_CHECKPOINT_CREATE) == 0) &&
  486. checkpointCreationAttributes != NULL) {
  487. return (SA_AIS_ERR_INVALID_PARAM);
  488. }
  489. error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle,
  490. (void *)&ckptInstance);
  491. if (error != SA_AIS_OK) {
  492. goto error_exit;
  493. }
  494. error = saHandleCreate (&checkpointHandleDatabase,
  495. sizeof (struct ckptCheckpointInstance), &checkpointHandle);
  496. if (error != SA_AIS_OK) {
  497. goto error_put_ckpt;
  498. }
  499. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  500. (void *)&ckptCheckpointInstance);
  501. if (error != SA_AIS_OK) {
  502. goto error_destroy;
  503. }
  504. ckptCheckpointInstance->response_fd = ckptInstance->response_fd;
  505. ckptCheckpointInstance->ckptHandle = ckptHandle;
  506. ckptCheckpointInstance->checkpointHandle = checkpointHandle;
  507. ckptCheckpointInstance->checkpointOpenFlags = checkpointOpenFlags;
  508. memcpy (&ckptCheckpointInstance->checkpointName, checkpointName, sizeof (SaNameT));
  509. req_lib_ckpt_checkpointopenasync.header.size = sizeof (struct req_lib_ckpt_checkpointopenasync);
  510. req_lib_ckpt_checkpointopenasync.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC;
  511. req_lib_ckpt_checkpointopenasync.invocation = invocation;
  512. memcpy (&req_lib_ckpt_checkpointopenasync.checkpointName, checkpointName, sizeof (SaNameT));
  513. req_lib_ckpt_checkpointopenasync.checkpointCreationAttributesSet = 0;
  514. if (checkpointCreationAttributes) {
  515. memcpy (&req_lib_ckpt_checkpointopenasync.checkpointCreationAttributes,
  516. checkpointCreationAttributes,
  517. sizeof (SaCkptCheckpointCreationAttributesT));
  518. req_lib_ckpt_checkpointopenasync.checkpointCreationAttributesSet = 1;
  519. }
  520. req_lib_ckpt_checkpointopenasync.checkpointOpenFlags = checkpointOpenFlags;
  521. req_lib_ckpt_checkpointopenasync.checkpointHandle = checkpointHandle;
  522. error = saSendRetry (ckptInstance->response_fd, &req_lib_ckpt_checkpointopenasync,
  523. sizeof (struct req_lib_ckpt_checkpointopenasync), MSG_NOSIGNAL);
  524. if (error != SA_AIS_OK) {
  525. goto error_put_destroy;
  526. }
  527. pthread_mutex_init (&ckptCheckpointInstance->response_mutex, NULL);
  528. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  529. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  530. return (error);
  531. error_put_destroy:
  532. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  533. error_destroy:
  534. saHandleDestroy (&checkpointHandleDatabase, checkpointHandle);
  535. error_put_ckpt:
  536. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  537. error_exit:
  538. return (error);
  539. }
  540. SaAisErrorT
  541. saCkptCheckpointClose (
  542. SaCkptCheckpointHandleT checkpointHandle)
  543. {
  544. struct req_lib_ckpt_checkpointclose req_lib_ckpt_checkpointclose;
  545. struct res_lib_ckpt_checkpointclose res_lib_ckpt_checkpointclose;
  546. SaAisErrorT error;
  547. struct ckptCheckpointInstance *ckptCheckpointInstance;
  548. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  549. (void *)&ckptCheckpointInstance);
  550. if (error != SA_AIS_OK) {
  551. goto error_exit;
  552. }
  553. req_lib_ckpt_checkpointclose.header.size = sizeof (struct req_lib_ckpt_checkpointclose);
  554. req_lib_ckpt_checkpointclose.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTCLOSE;
  555. memcpy (&req_lib_ckpt_checkpointclose.checkpointName,
  556. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  557. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointclose,
  558. sizeof (struct req_lib_ckpt_checkpointclose), MSG_NOSIGNAL);
  559. if (error != SA_AIS_OK) {
  560. goto exit_put;
  561. }
  562. error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_checkpointclose,
  563. sizeof (struct res_lib_ckpt_checkpointclose), MSG_WAITALL | MSG_NOSIGNAL);
  564. list_del (&ckptCheckpointInstance->list);
  565. saHandleDestroy (&checkpointHandleDatabase, checkpointHandle);
  566. exit_put:
  567. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  568. error_exit:
  569. return (error);
  570. }
  571. SaAisErrorT
  572. saCkptCheckpointUnlink (
  573. SaCkptHandleT ckptHandle,
  574. const SaNameT *checkpointName)
  575. {
  576. SaAisErrorT error;
  577. struct ckptInstance *ckptInstance;
  578. struct req_lib_ckpt_checkpointunlink req_lib_ckpt_checkpointunlink;
  579. struct res_lib_ckpt_checkpointunlink res_lib_ckpt_checkpointunlink;
  580. error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle, (void *)&ckptInstance);
  581. if (error != SA_AIS_OK) {
  582. goto exit_noclose;
  583. }
  584. req_lib_ckpt_checkpointunlink.header.size = sizeof (struct req_lib_ckpt_checkpointunlink);
  585. req_lib_ckpt_checkpointunlink.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTUNLINK;
  586. memcpy (&req_lib_ckpt_checkpointunlink.checkpointName, checkpointName, sizeof (SaNameT));
  587. error = saSendRetry (ckptInstance->response_fd, &req_lib_ckpt_checkpointunlink,
  588. sizeof (struct req_lib_ckpt_checkpointunlink), MSG_NOSIGNAL);
  589. if (error != SA_AIS_OK) {
  590. goto exit_put;
  591. }
  592. error = saRecvRetry (ckptInstance->response_fd, &res_lib_ckpt_checkpointunlink,
  593. sizeof (struct res_lib_ckpt_checkpointunlink), MSG_WAITALL | MSG_NOSIGNAL);
  594. exit_put:
  595. saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
  596. return (error == SA_AIS_OK ? res_lib_ckpt_checkpointunlink.header.error : error);
  597. exit_noclose:
  598. return (error);
  599. }
  600. SaAisErrorT
  601. saCkptCheckpointRetentionDurationSet (
  602. SaCkptCheckpointHandleT checkpointHandle,
  603. SaTimeT retentionDuration)
  604. {
  605. SaAisErrorT error;
  606. struct ckptCheckpointInstance *ckptCheckpointInstance;
  607. struct req_lib_ckpt_checkpointretentiondurationset req_lib_ckpt_checkpointretentiondurationset;
  608. struct res_lib_ckpt_checkpointretentiondurationset res_lib_ckpt_checkpointretentiondurationset;
  609. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  610. (void *)&ckptCheckpointInstance);
  611. if (error != SA_AIS_OK) {
  612. goto error_exit_noput;
  613. }
  614. req_lib_ckpt_checkpointretentiondurationset.header.size = sizeof (struct req_lib_ckpt_checkpointretentiondurationset);
  615. req_lib_ckpt_checkpointretentiondurationset.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET;
  616. req_lib_ckpt_checkpointretentiondurationset.retentionDuration = retentionDuration;
  617. memcpy (&req_lib_ckpt_checkpointretentiondurationset.checkpointName,
  618. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  619. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  620. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointretentiondurationset, sizeof (struct req_lib_ckpt_checkpointretentiondurationset), MSG_NOSIGNAL);
  621. if (error != SA_AIS_OK) {
  622. goto error_exit;
  623. }
  624. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  625. &res_lib_ckpt_checkpointretentiondurationset,
  626. sizeof (struct res_lib_ckpt_checkpointretentiondurationset),
  627. MSG_WAITALL | MSG_NOSIGNAL);
  628. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  629. error_exit:
  630. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  631. error_exit_noput:
  632. return (error == SA_AIS_OK ? res_lib_ckpt_checkpointretentiondurationset.header.error : error);
  633. }
  634. SaAisErrorT
  635. saCkptActiveReplicaSet (
  636. SaCkptCheckpointHandleT checkpointHandle)
  637. {
  638. SaAisErrorT error;
  639. struct ckptCheckpointInstance *ckptCheckpointInstance;
  640. struct req_lib_ckpt_activereplicaset req_lib_ckpt_activereplicaset;
  641. struct res_lib_ckpt_activereplicaset res_lib_ckpt_activereplicaset;
  642. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  643. (void *)&ckptCheckpointInstance);
  644. if (error != SA_AIS_OK) {
  645. goto error_noput;
  646. }
  647. if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
  648. error = SA_AIS_ERR_ACCESS;
  649. goto error_put;
  650. }
  651. req_lib_ckpt_activereplicaset.header.size = sizeof (struct req_lib_ckpt_activereplicaset);
  652. req_lib_ckpt_activereplicaset.header.id = MESSAGE_REQ_CKPT_ACTIVEREPLICASET;
  653. memcpy (&req_lib_ckpt_activereplicaset.checkpointName,
  654. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  655. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  656. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_activereplicaset,
  657. sizeof (struct req_lib_ckpt_activereplicaset), MSG_NOSIGNAL);
  658. if (error != SA_AIS_OK) {
  659. goto error_put;
  660. }
  661. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  662. &res_lib_ckpt_activereplicaset,
  663. sizeof (struct res_lib_ckpt_activereplicaset),
  664. MSG_WAITALL | MSG_NOSIGNAL);
  665. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  666. error_put:
  667. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  668. error_noput:
  669. return (error == SA_AIS_OK ? res_lib_ckpt_activereplicaset.header.error : error);
  670. }
  671. SaAisErrorT
  672. saCkptCheckpointStatusGet (
  673. SaCkptCheckpointHandleT checkpointHandle,
  674. SaCkptCheckpointDescriptorT *checkpointStatus)
  675. {
  676. SaAisErrorT error;
  677. struct ckptCheckpointInstance *ckptCheckpointInstance;
  678. struct req_lib_ckpt_checkpointstatusget req_lib_ckpt_checkpointstatusget;
  679. struct res_lib_ckpt_checkpointstatusget res_lib_ckpt_checkpointstatusget;
  680. if (checkpointStatus == NULL) {
  681. return (SA_AIS_ERR_INVALID_PARAM);
  682. }
  683. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  684. (void *)&ckptCheckpointInstance);
  685. if (error != SA_AIS_OK) {
  686. return (error);
  687. }
  688. req_lib_ckpt_checkpointstatusget.header.size = sizeof (struct req_lib_ckpt_checkpointstatusget);
  689. req_lib_ckpt_checkpointstatusget.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET;
  690. memcpy (&req_lib_ckpt_checkpointstatusget.checkpointName,
  691. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  692. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  693. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointstatusget,
  694. sizeof (struct req_lib_ckpt_checkpointstatusget), MSG_NOSIGNAL);
  695. if (error != SA_AIS_OK) {
  696. goto error_exit;
  697. }
  698. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  699. &res_lib_ckpt_checkpointstatusget,
  700. sizeof (struct res_lib_ckpt_checkpointstatusget),
  701. MSG_WAITALL | MSG_NOSIGNAL);
  702. if (error != SA_AIS_OK) {
  703. goto error_exit;
  704. }
  705. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  706. memcpy (checkpointStatus,
  707. &res_lib_ckpt_checkpointstatusget.checkpointDescriptor,
  708. sizeof (SaCkptCheckpointDescriptorT));
  709. error_exit:
  710. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  711. return (error == SA_AIS_OK ? res_lib_ckpt_checkpointstatusget.header.error : error);
  712. }
  713. SaAisErrorT
  714. saCkptSectionCreate (
  715. SaCkptCheckpointHandleT checkpointHandle,
  716. SaCkptSectionCreationAttributesT *sectionCreationAttributes,
  717. const void *initialData,
  718. SaUint32T initialDataSize)
  719. {
  720. SaAisErrorT error;
  721. struct ckptCheckpointInstance *ckptCheckpointInstance;
  722. struct req_lib_ckpt_sectioncreate req_lib_ckpt_sectioncreate;
  723. struct res_lib_ckpt_sectioncreate res_lib_ckpt_sectioncreate;
  724. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  725. (void *)&ckptCheckpointInstance);
  726. if (error != SA_AIS_OK) {
  727. return (error);
  728. }
  729. if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
  730. error = SA_AIS_ERR_ACCESS;
  731. goto error_exit;
  732. }
  733. req_lib_ckpt_sectioncreate.header.size =
  734. sizeof (struct req_lib_ckpt_sectioncreate) +
  735. sectionCreationAttributes->sectionId->idLen +
  736. initialDataSize;
  737. req_lib_ckpt_sectioncreate.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONCREATE;
  738. req_lib_ckpt_sectioncreate.idLen = sectionCreationAttributes->sectionId->idLen;
  739. req_lib_ckpt_sectioncreate.expirationTime = sectionCreationAttributes->expirationTime;
  740. req_lib_ckpt_sectioncreate.initialDataSize = initialDataSize;
  741. memcpy (&req_lib_ckpt_sectioncreate.checkpointName,
  742. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  743. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  744. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectioncreate,
  745. sizeof (struct req_lib_ckpt_sectioncreate), MSG_NOSIGNAL);
  746. if (error != SA_AIS_OK) {
  747. goto error_exit;
  748. }
  749. /*
  750. * Write section identifier to server
  751. */
  752. error = saSendRetry (ckptCheckpointInstance->response_fd, sectionCreationAttributes->sectionId->id,
  753. sectionCreationAttributes->sectionId->idLen, MSG_NOSIGNAL);
  754. if (error != SA_AIS_OK) {
  755. goto error_exit;
  756. }
  757. error = saSendRetry (ckptCheckpointInstance->response_fd, initialData,
  758. initialDataSize, MSG_NOSIGNAL);
  759. if (error != SA_AIS_OK) {
  760. goto error_exit;
  761. }
  762. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  763. &res_lib_ckpt_sectioncreate,
  764. sizeof (struct res_lib_ckpt_sectioncreate),
  765. MSG_WAITALL | MSG_NOSIGNAL);
  766. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  767. error_exit:
  768. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  769. return (error == SA_AIS_OK ? res_lib_ckpt_sectioncreate.header.error : error);
  770. }
  771. SaAisErrorT
  772. saCkptSectionDelete (
  773. SaCkptCheckpointHandleT checkpointHandle,
  774. const SaCkptSectionIdT *sectionId)
  775. {
  776. SaAisErrorT error;
  777. struct ckptCheckpointInstance *ckptCheckpointInstance;
  778. struct req_lib_ckpt_sectiondelete req_lib_ckpt_sectiondelete;
  779. struct res_lib_ckpt_sectiondelete res_lib_ckpt_sectiondelete;
  780. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  781. (void *)&ckptCheckpointInstance);
  782. if (error != SA_AIS_OK) {
  783. return (error);
  784. }
  785. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  786. req_lib_ckpt_sectiondelete.header.size = sizeof (struct req_lib_ckpt_sectiondelete) + sectionId->idLen;
  787. req_lib_ckpt_sectiondelete.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONDELETE;
  788. req_lib_ckpt_sectiondelete.idLen = sectionId->idLen;
  789. memcpy (&req_lib_ckpt_sectiondelete.checkpointName,
  790. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  791. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectiondelete,
  792. sizeof (struct req_lib_ckpt_sectiondelete), MSG_NOSIGNAL);
  793. if (error != SA_AIS_OK) {
  794. goto error_exit;
  795. }
  796. /*
  797. * Write section identifier to server
  798. */
  799. error = saSendRetry (ckptCheckpointInstance->response_fd, sectionId->id,
  800. sectionId->idLen, MSG_NOSIGNAL);
  801. if (error != SA_AIS_OK) {
  802. goto error_exit;
  803. }
  804. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  805. &res_lib_ckpt_sectiondelete,
  806. sizeof (struct res_lib_ckpt_sectiondelete),
  807. MSG_WAITALL | MSG_NOSIGNAL);
  808. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  809. error_exit:
  810. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  811. return (error == SA_AIS_OK ? res_lib_ckpt_sectiondelete.header.error : error);
  812. }
  813. SaAisErrorT
  814. saCkptSectionExpirationTimeSet (
  815. SaCkptCheckpointHandleT checkpointHandle,
  816. const SaCkptSectionIdT *sectionId,
  817. SaTimeT expirationTime)
  818. {
  819. SaAisErrorT error;
  820. struct ckptCheckpointInstance *ckptCheckpointInstance;
  821. struct req_lib_ckpt_sectionexpirationtimeset req_lib_ckpt_sectionexpirationtimeset;
  822. struct res_lib_ckpt_sectionexpirationtimeset res_lib_ckpt_sectionexpirationtimeset;
  823. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  824. (void *)&ckptCheckpointInstance);
  825. if (error != SA_AIS_OK) {
  826. goto error_exit_noput;
  827. }
  828. req_lib_ckpt_sectionexpirationtimeset.header.size = sizeof (struct req_lib_ckpt_sectionexpirationtimeset) + sectionId->idLen;
  829. req_lib_ckpt_sectionexpirationtimeset.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET;
  830. req_lib_ckpt_sectionexpirationtimeset.idLen = sectionId->idLen;
  831. req_lib_ckpt_sectionexpirationtimeset.expirationTime = expirationTime;
  832. memcpy (&req_lib_ckpt_sectionexpirationtimeset.checkpointName,
  833. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  834. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  835. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectionexpirationtimeset,
  836. sizeof (struct req_lib_ckpt_sectionexpirationtimeset), MSG_NOSIGNAL);
  837. if (error != SA_AIS_OK) {
  838. goto error_exit;
  839. }
  840. /*
  841. * Write section identifier to server
  842. */
  843. if (sectionId->idLen) {
  844. error = saSendRetry (ckptCheckpointInstance->response_fd, sectionId->id,
  845. sectionId->idLen, MSG_NOSIGNAL);
  846. if (error != SA_AIS_OK) {
  847. goto error_exit;
  848. }
  849. }
  850. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  851. &res_lib_ckpt_sectionexpirationtimeset,
  852. sizeof (struct res_lib_ckpt_sectionexpirationtimeset),
  853. MSG_WAITALL | MSG_NOSIGNAL);
  854. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  855. error_exit:
  856. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  857. error_exit_noput:
  858. return (error == SA_AIS_OK ? res_lib_ckpt_sectionexpirationtimeset.header.error : error);
  859. }
  860. SaAisErrorT
  861. saCkptSectionIterationInitialize (
  862. SaCkptCheckpointHandleT checkpointHandle,
  863. SaCkptSectionsChosenT sectionsChosen,
  864. SaTimeT expirationTime,
  865. SaCkptSectionIterationHandleT *sectionIterationHandle)
  866. {
  867. SaAisErrorT error;
  868. struct ckptCheckpointInstance *ckptCheckpointInstance;
  869. struct ckptSectionIterationInstance *ckptSectionIterationInstance;
  870. struct req_lib_ckpt_sectioniteratorinitialize req_lib_ckpt_sectioniteratorinitialize;
  871. struct res_lib_ckpt_sectioniteratorinitialize res_lib_ckpt_sectioniteratorinitialize;
  872. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  873. (void *)&ckptCheckpointInstance);
  874. if (error != SA_AIS_OK) {
  875. goto error_no_destroy;
  876. }
  877. error = saHandleCreate (&ckptSectionIterationHandleDatabase,
  878. sizeof (struct ckptSectionIterationInstance), sectionIterationHandle);
  879. if (error != SA_AIS_OK) {
  880. goto error_put_checkpoint_db;
  881. }
  882. error = saHandleInstanceGet (&ckptSectionIterationHandleDatabase,
  883. *sectionIterationHandle, (void *)&ckptSectionIterationInstance);
  884. if (error != SA_AIS_OK) {
  885. goto error_destroy;
  886. }
  887. ckptSectionIterationInstance->response_fd = ckptCheckpointInstance->response_fd;
  888. ckptSectionIterationInstance->checkpointHandle = checkpointHandle;
  889. pthread_mutex_init (&ckptSectionIterationInstance->response_mutex, NULL);
  890. /*
  891. * Setup section id list for iterator next
  892. */
  893. list_init (&ckptSectionIterationInstance->sectionIdListHead);
  894. req_lib_ckpt_sectioniteratorinitialize.header.size = sizeof (struct req_lib_ckpt_sectioniteratorinitialize);
  895. req_lib_ckpt_sectioniteratorinitialize.header.id = MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE;
  896. req_lib_ckpt_sectioniteratorinitialize.sectionsChosen = sectionsChosen;
  897. req_lib_ckpt_sectioniteratorinitialize.expirationTime = expirationTime;
  898. memcpy (&req_lib_ckpt_sectioniteratorinitialize.checkpointName,
  899. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  900. pthread_mutex_lock (&ckptSectionIterationInstance->response_mutex);
  901. error = saSendRetry (ckptSectionIterationInstance->response_fd,
  902. &req_lib_ckpt_sectioniteratorinitialize,
  903. sizeof (struct req_lib_ckpt_sectioniteratorinitialize),
  904. MSG_NOSIGNAL);
  905. if (error != SA_AIS_OK) {
  906. goto error_put_destroy;
  907. }
  908. error = saRecvRetry (ckptSectionIterationInstance->response_fd,
  909. &res_lib_ckpt_sectioniteratorinitialize,
  910. sizeof (struct res_lib_ckpt_sectioniteratorinitialize),
  911. MSG_WAITALL | MSG_NOSIGNAL);
  912. pthread_mutex_unlock (&ckptSectionIterationInstance->response_mutex);
  913. saHandleInstancePut (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
  914. return (error == SA_AIS_OK ? res_lib_ckpt_sectioniteratorinitialize.header.error : error);
  915. error_put_destroy:
  916. saHandleInstancePut (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
  917. error_destroy:
  918. saHandleDestroy (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
  919. error_put_checkpoint_db:
  920. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  921. error_no_destroy:
  922. return (error);
  923. }
  924. struct iteratorSectionIdListEntry {
  925. struct list_head list;
  926. char data[0];
  927. };
  928. SaAisErrorT
  929. saCkptSectionIterationNext (
  930. SaCkptSectionIterationHandleT sectionIterationHandle,
  931. SaCkptSectionDescriptorT *sectionDescriptor)
  932. {
  933. SaAisErrorT error;
  934. struct ckptSectionIterationInstance *ckptSectionIterationInstance;
  935. struct req_lib_ckpt_sectioniteratornext req_lib_ckpt_sectioniteratornext;
  936. struct res_lib_ckpt_sectioniteratornext res_lib_ckpt_sectioniteratornext;
  937. struct iteratorSectionIdListEntry *iteratorSectionIdListEntry;
  938. error = saHandleInstanceGet (&ckptSectionIterationHandleDatabase,
  939. sectionIterationHandle, (void *)&ckptSectionIterationInstance);
  940. if (error != SA_AIS_OK) {
  941. goto error_exit;
  942. }
  943. /*
  944. * Allocate section id storage area
  945. */
  946. /*
  947. * TODO max section id size is 500
  948. */
  949. iteratorSectionIdListEntry = malloc (sizeof (struct list_head) + 500);
  950. if (iteratorSectionIdListEntry == 0) {
  951. error = SA_AIS_ERR_NO_MEMORY;
  952. goto error_put_nounlock;
  953. }
  954. req_lib_ckpt_sectioniteratornext.header.size = sizeof (struct req_lib_ckpt_sectioniteratornext);
  955. req_lib_ckpt_sectioniteratornext.header.id = MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT;
  956. pthread_mutex_lock (&ckptSectionIterationInstance->response_mutex);
  957. error = saSendRetry (ckptSectionIterationInstance->response_fd,
  958. &req_lib_ckpt_sectioniteratornext,
  959. sizeof (struct req_lib_ckpt_sectioniteratornext), MSG_NOSIGNAL);
  960. if (error != SA_AIS_OK) {
  961. goto error_put;
  962. }
  963. error = saRecvRetry (ckptSectionIterationInstance->response_fd, &res_lib_ckpt_sectioniteratornext,
  964. sizeof (struct res_lib_ckpt_sectioniteratornext), MSG_WAITALL | MSG_NOSIGNAL);
  965. if (error != SA_AIS_OK) {
  966. goto error_put;
  967. }
  968. memcpy (sectionDescriptor,
  969. &res_lib_ckpt_sectioniteratornext.sectionDescriptor,
  970. sizeof (SaCkptSectionDescriptorT));
  971. sectionDescriptor->sectionId.id = &iteratorSectionIdListEntry->data[0];
  972. if ((res_lib_ckpt_sectioniteratornext.header.size - sizeof (struct res_lib_ckpt_sectioniteratornext)) > 0) {
  973. error = saRecvRetry (ckptSectionIterationInstance->response_fd,
  974. sectionDescriptor->sectionId.id,
  975. res_lib_ckpt_sectioniteratornext.header.size -
  976. sizeof (struct res_lib_ckpt_sectioniteratornext),
  977. MSG_WAITALL | MSG_NOSIGNAL);
  978. }
  979. /*
  980. * Add to persistent memory list for this sectioniterator
  981. */
  982. if (error == SA_AIS_OK && res_lib_ckpt_sectioniteratornext.header.error == SA_AIS_OK) {
  983. list_init (&iteratorSectionIdListEntry->list);
  984. list_add (&iteratorSectionIdListEntry->list, &ckptSectionIterationInstance->sectionIdListHead);
  985. }
  986. error_put:
  987. pthread_mutex_unlock (&ckptSectionIterationInstance->response_mutex);
  988. error_put_nounlock:
  989. saHandleInstancePut (&ckptSectionIterationHandleDatabase, sectionIterationHandle);
  990. error_exit:
  991. return (error == SA_AIS_OK ? res_lib_ckpt_sectioniteratornext.header.error : error);
  992. }
  993. SaAisErrorT
  994. saCkptSectionIterationFinalize (
  995. SaCkptSectionIterationHandleT sectionIterationHandle)
  996. {
  997. SaAisErrorT error;
  998. struct ckptSectionIterationInstance *ckptSectionIterationInstance;
  999. struct iteratorSectionIdListEntry *iteratorSectionIdListEntry;
  1000. struct list_head *sectionIdIterationList;
  1001. struct list_head *sectionIdIterationListNext;
  1002. error = saHandleInstanceGet (&ckptSectionIterationHandleDatabase,
  1003. sectionIterationHandle, (void *)&ckptSectionIterationInstance);
  1004. if (error != SA_AIS_OK) {
  1005. goto error_noput;
  1006. }
  1007. /*
  1008. * iterate list of section ids for this iterator to free the allocated memory
  1009. * be careful to cache next pointer because free removes memory from use
  1010. */
  1011. for (sectionIdIterationList = ckptSectionIterationInstance->sectionIdListHead.next,
  1012. sectionIdIterationListNext = sectionIdIterationList->next;
  1013. sectionIdIterationList != &ckptSectionIterationInstance->sectionIdListHead;
  1014. sectionIdIterationList = sectionIdIterationListNext,
  1015. sectionIdIterationListNext = sectionIdIterationList->next) {
  1016. iteratorSectionIdListEntry = list_entry (sectionIdIterationList,
  1017. struct iteratorSectionIdListEntry, list);
  1018. free (iteratorSectionIdListEntry);
  1019. }
  1020. saHandleInstancePut (&checkpointHandleDatabase,
  1021. ckptSectionIterationInstance->checkpointHandle);
  1022. saHandleInstancePut (&ckptSectionIterationHandleDatabase, sectionIterationHandle);
  1023. saHandleDestroy (&ckptSectionIterationHandleDatabase, sectionIterationHandle);
  1024. error_noput:
  1025. return (error);
  1026. }
  1027. SaAisErrorT
  1028. saCkptCheckpointWrite (
  1029. SaCkptCheckpointHandleT checkpointHandle,
  1030. const SaCkptIOVectorElementT *ioVector,
  1031. SaUint32T numberOfElements,
  1032. SaUint32T *erroneousVectorIndex)
  1033. {
  1034. SaAisErrorT error = SA_AIS_OK;
  1035. struct ckptCheckpointInstance *ckptCheckpointInstance;
  1036. struct req_lib_ckpt_sectionwrite req_lib_ckpt_sectionwrite;
  1037. struct res_lib_ckpt_sectionwrite res_lib_ckpt_sectionwrite;
  1038. int i;
  1039. struct iovec iov[3];
  1040. int iov_len = 0;
  1041. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  1042. (void *)&ckptCheckpointInstance);
  1043. if (error != SA_AIS_OK) {
  1044. return (error);
  1045. }
  1046. if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
  1047. error = SA_AIS_ERR_ACCESS;
  1048. goto error_put;
  1049. }
  1050. req_lib_ckpt_sectionwrite.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONWRITE;
  1051. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  1052. for (i = 0; i < numberOfElements; i++) {
  1053. req_lib_ckpt_sectionwrite.header.size = sizeof (struct req_lib_ckpt_sectionwrite) + ioVector[i].sectionId.idLen + ioVector[i].dataSize;
  1054. req_lib_ckpt_sectionwrite.dataOffset = ioVector[i].dataOffset;
  1055. req_lib_ckpt_sectionwrite.dataSize = ioVector[i].dataSize;
  1056. req_lib_ckpt_sectionwrite.idLen = ioVector[i].sectionId.idLen;
  1057. memcpy (&req_lib_ckpt_sectionwrite.checkpointName,
  1058. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  1059. iov_len = 0;
  1060. /* TODO check for zero length stuff */
  1061. iov[0].iov_base = (char *)&req_lib_ckpt_sectionwrite;
  1062. iov[0].iov_len = sizeof (struct req_lib_ckpt_sectionwrite);
  1063. iov[1].iov_base = ioVector[i].sectionId.id;
  1064. iov[1].iov_len = ioVector[i].sectionId.idLen;
  1065. iov[2].iov_base = ioVector[i].dataBuffer;
  1066. iov[2].iov_len = ioVector[i].dataSize;
  1067. error = saSendMsgRetry (ckptCheckpointInstance->response_fd,
  1068. iov,
  1069. 3);
  1070. if (error != SA_AIS_OK) {
  1071. goto error_exit;
  1072. }
  1073. /*
  1074. * Receive response
  1075. */
  1076. error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_sectionwrite,
  1077. sizeof (struct res_lib_ckpt_sectionwrite), MSG_WAITALL | MSG_NOSIGNAL);
  1078. if (error != SA_AIS_OK) {
  1079. goto error_exit;
  1080. }
  1081. if (res_lib_ckpt_sectionwrite.header.error == SA_AIS_ERR_TRY_AGAIN) {
  1082. error = SA_AIS_ERR_TRY_AGAIN;
  1083. goto error_exit;
  1084. }
  1085. /*
  1086. * If error, report back erroneous index
  1087. */
  1088. if (res_lib_ckpt_sectionwrite.header.error != SA_AIS_OK) {
  1089. if (erroneousVectorIndex) {
  1090. *erroneousVectorIndex = i;
  1091. }
  1092. goto error_exit;
  1093. }
  1094. }
  1095. error_exit:
  1096. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  1097. error_put:
  1098. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  1099. return (error == SA_AIS_OK ? res_lib_ckpt_sectionwrite.header.error : error);
  1100. }
  1101. SaAisErrorT
  1102. saCkptSectionOverwrite (
  1103. SaCkptCheckpointHandleT checkpointHandle,
  1104. const SaCkptSectionIdT *sectionId,
  1105. const void *dataBuffer,
  1106. SaSizeT dataSize)
  1107. {
  1108. SaAisErrorT error;
  1109. struct ckptCheckpointInstance *ckptCheckpointInstance;
  1110. struct req_lib_ckpt_sectionoverwrite req_lib_ckpt_sectionoverwrite;
  1111. struct res_lib_ckpt_sectionoverwrite res_lib_ckpt_sectionoverwrite;
  1112. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  1113. (void *)&ckptCheckpointInstance);
  1114. if (error != SA_AIS_OK) {
  1115. return (error);
  1116. }
  1117. if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
  1118. return (SA_AIS_ERR_ACCESS);
  1119. }
  1120. req_lib_ckpt_sectionoverwrite.header.size = sizeof (struct req_lib_ckpt_sectionoverwrite) + sectionId->idLen + dataSize;
  1121. req_lib_ckpt_sectionoverwrite.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONOVERWRITE;
  1122. req_lib_ckpt_sectionoverwrite.idLen = sectionId->idLen;
  1123. req_lib_ckpt_sectionoverwrite.dataSize = dataSize;
  1124. memcpy (&req_lib_ckpt_sectionoverwrite.checkpointName,
  1125. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  1126. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  1127. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectionoverwrite,
  1128. sizeof (struct req_lib_ckpt_sectionoverwrite), MSG_NOSIGNAL);
  1129. if (error != SA_AIS_OK) {
  1130. goto error_exit;
  1131. }
  1132. if (sectionId->idLen) {
  1133. error = saSendRetry (ckptCheckpointInstance->response_fd, sectionId->id,
  1134. sectionId->idLen, MSG_NOSIGNAL);
  1135. if (error != SA_AIS_OK) {
  1136. goto error_exit;
  1137. }
  1138. }
  1139. error = saSendRetry (ckptCheckpointInstance->response_fd, dataBuffer, dataSize, MSG_NOSIGNAL);
  1140. if (error != SA_AIS_OK) {
  1141. goto error_exit;
  1142. }
  1143. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  1144. &res_lib_ckpt_sectionoverwrite,
  1145. sizeof (struct res_lib_ckpt_sectionoverwrite),
  1146. MSG_WAITALL | MSG_NOSIGNAL);
  1147. error_exit:
  1148. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  1149. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  1150. return (error == SA_AIS_OK ? res_lib_ckpt_sectionoverwrite.header.error : error);
  1151. }
  1152. SaAisErrorT
  1153. saCkptCheckpointRead (
  1154. SaCkptCheckpointHandleT checkpointHandle,
  1155. SaCkptIOVectorElementT *ioVector,
  1156. SaUint32T numberOfElements,
  1157. SaUint32T *erroneousVectorIndex)
  1158. {
  1159. SaAisErrorT error = SA_AIS_OK;
  1160. struct ckptCheckpointInstance *ckptCheckpointInstance;
  1161. struct req_lib_ckpt_sectionread req_lib_ckpt_sectionread;
  1162. struct res_lib_ckpt_sectionread res_lib_ckpt_sectionread;
  1163. int dataLength;
  1164. int i;
  1165. struct iovec iov[3];
  1166. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  1167. (void *)&ckptCheckpointInstance);
  1168. if (error != SA_AIS_OK) {
  1169. return (error);
  1170. }
  1171. if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_READ) == 0) {
  1172. return (SA_AIS_ERR_ACCESS);
  1173. }
  1174. req_lib_ckpt_sectionread.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONREAD;
  1175. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  1176. for (i = 0; i < numberOfElements; i++) {
  1177. req_lib_ckpt_sectionread.header.size = sizeof (struct req_lib_ckpt_sectionread) +
  1178. ioVector[i].sectionId.idLen;
  1179. req_lib_ckpt_sectionread.idLen = ioVector[i].sectionId.idLen;
  1180. req_lib_ckpt_sectionread.dataOffset = ioVector[i].dataOffset;
  1181. req_lib_ckpt_sectionread.dataSize = ioVector[i].dataSize;
  1182. memcpy (&req_lib_ckpt_sectionread.checkpointName,
  1183. &ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
  1184. iov[0].iov_base = (char *)&req_lib_ckpt_sectionread;
  1185. iov[0].iov_len = sizeof (struct req_lib_ckpt_sectionread);
  1186. iov[1].iov_base = ioVector[i].sectionId.id;
  1187. iov[1].iov_len = ioVector[i].sectionId.idLen;
  1188. error = saSendMsgRetry (ckptCheckpointInstance->response_fd,
  1189. iov,
  1190. 2);
  1191. /*
  1192. * Receive response header
  1193. */
  1194. error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_sectionread,
  1195. sizeof (struct res_lib_ckpt_sectionread), MSG_WAITALL | MSG_NOSIGNAL);
  1196. if (error != SA_AIS_OK) {
  1197. goto error_exit;
  1198. }
  1199. dataLength = res_lib_ckpt_sectionread.header.size - sizeof (struct res_lib_ckpt_sectionread);
  1200. /*
  1201. * Receive checkpoint section data
  1202. */
  1203. if (dataLength > 0) {
  1204. error = saRecvRetry (ckptCheckpointInstance->response_fd, ioVector[i].dataBuffer,
  1205. dataLength, MSG_WAITALL | MSG_NOSIGNAL);
  1206. if (error != SA_AIS_OK) {
  1207. goto error_exit;
  1208. }
  1209. }
  1210. if (res_lib_ckpt_sectionread.header.error != SA_AIS_OK) {
  1211. if (erroneousVectorIndex) {
  1212. *erroneousVectorIndex = i;
  1213. }
  1214. goto error_exit;
  1215. }
  1216. /*
  1217. * Report back bytes of data read
  1218. */
  1219. ioVector[i].readSize = res_lib_ckpt_sectionread.dataRead;
  1220. }
  1221. error_exit:
  1222. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  1223. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  1224. return (error == SA_AIS_OK ? res_lib_ckpt_sectionread.header.error : error);
  1225. }
  1226. SaAisErrorT
  1227. saCkptCheckpointSynchronize (
  1228. SaCkptCheckpointHandleT checkpointHandle,
  1229. SaTimeT timeout)
  1230. {
  1231. SaAisErrorT error;
  1232. struct ckptCheckpointInstance *ckptCheckpointInstance;
  1233. struct req_lib_ckpt_checkpointsynchronize req_lib_ckpt_checkpointsynchronize;
  1234. struct res_lib_ckpt_checkpointsynchronize res_lib_ckpt_checkpointsynchronize;
  1235. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  1236. (void *)&ckptCheckpointInstance);
  1237. if (error != SA_AIS_OK) {
  1238. return (error);
  1239. }
  1240. req_lib_ckpt_checkpointsynchronize.header.size = sizeof (struct req_lib_ckpt_checkpointsynchronize);
  1241. req_lib_ckpt_checkpointsynchronize.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE;
  1242. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  1243. error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointsynchronize,
  1244. sizeof (struct req_lib_ckpt_checkpointsynchronize), MSG_NOSIGNAL);
  1245. if (error != SA_AIS_OK) {
  1246. goto error_exit;
  1247. }
  1248. error = saRecvRetry (ckptCheckpointInstance->response_fd,
  1249. &res_lib_ckpt_checkpointsynchronize,
  1250. sizeof (struct res_lib_ckpt_checkpointsynchronize),
  1251. MSG_WAITALL | MSG_NOSIGNAL);
  1252. error_exit:
  1253. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  1254. saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
  1255. return (error == SA_AIS_OK ? res_lib_ckpt_checkpointsynchronize.header.error : error);
  1256. }
  1257. SaAisErrorT
  1258. saCkptCheckpointSynchronizeAsync (
  1259. SaCkptHandleT ckptHandle,
  1260. SaCkptCheckpointHandleT checkpointHandle,
  1261. SaInvocationT invocation)
  1262. {
  1263. return (SA_AIS_OK);
  1264. /* TODO not implemented in executive
  1265. struct ckptInstance *ckptInstance;
  1266. struct ckptCheckpointInstance *ckptCheckpointInstance;
  1267. SaAisErrorT error;
  1268. struct req_lib_ckpt_checkpointsynchronizeasync req_lib_ckpt_checkpointsynchronizeasync;
  1269. error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
  1270. (void *)&ckptCheckpointInstance);
  1271. if (error != SA_AIS_OK) {
  1272. return (error);
  1273. }
  1274. req_lib_ckpt_checkpointsynchronizeasync.header.size = sizeof (struct req_lib_ckpt_checkpointsynchronizeasync);
  1275. req_lib_ckpt_checkpointsynchronizeasync.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC;
  1276. req_lib_ckpt_checkpointsynchronizeasync.invocation = invocation;
  1277. pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
  1278. pthread_mutex_lock (&ckptInstance->response_mutex);
  1279. error = saSendRetry (ckptInstance->response_fd, &req_lib_ckpt_checkpointsynchronizeasync,
  1280. sizeof (struct req_lib_ckpt_checkpointsynchronizeasync), MSG_NOSIGNAL);
  1281. pthread_mutex_unlock (&ckptInstance->response_mutex);
  1282. pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
  1283. saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
  1284. return (error);
  1285. */
  1286. }