[Openais] checkpoint service B.01.01 - defect 245

Steven Dake sdake at mvista.com
Mon Feb 7 17:37:55 PST 2005


Attached is a patch to revise the checkpoint service to B.01.01 of the
specification from what is currently in bitkeepr.

I suspect we may have some various bugs with compliance (as we did with
cluster membership) but the code appears to operate properly and exports
the specified APIs and functionality.

Note to developers using checkpoint service:

1. The type for handles of checkpoints, ckpts, and iterators has changed
to 64 bits.

2. Previously saCkptInitialize didn't have to be called in an
application making its need pointless.  The saCkptCheckpointOpen call
has added a parameter which is a valid handle returned from
saCkptInitialize.

3. The section id field has changed the order of the definitions.  The
length field is now first, followed by the string.  This makes some
(broken) static declarations of structures give compile errors.  If you
based your applications from testckpt.c your likely to run into these
sorts of problems.

4. the async calls and dispatch calls are unimplemented or probably
don't work.  The async calls would work the same way as an sync call, so
from a developement standpoint your safe with the sync calls for now.

Note to code reviewers:
the previous checkpoint service used 3 seperate fds/service handlers for
holding information relating to the various checkpoint apis.  These have
been rolled into one service handler.

Thanks
-steve
-------------- next part --------------
Files defect-245.orig/exec/.ckpt.c.swp and defect-245/exec/.ckpt.c.swp differ
Files defect-245.orig/exec/.ckpt.h.swp and defect-245/exec/.ckpt.h.swp differ
diff -uNr defect-245.orig/exec/Makefile defect-245/exec/Makefile
--- defect-245.orig/exec/Makefile	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/exec/Makefile	2005-02-06 15:07:17.000000000 -0700
@@ -29,13 +29,13 @@
 # THE POSSIBILITY OF SUCH DAMAGE.
 
 # Production mode flags
-CFLAGS = -O3 -Wall -fomit-frame-pointer -fPIC
-LDFLAGS = 
+#CFLAGS = -O3 -Wall -fomit-frame-pointer -fPIC
+#LDFLAGS = 
 
 # Debug mode flags
-#CFLAGS = -g -Wall -fPIC
+CFLAGS = -g -Wall -fPIC
 ##-DDEBUG
-#LDFLAGS = -g -fPIC
+LDFLAGS = -g -fPIC
 
 # Profile mode flags
 #CFLAGS = -O2 -pg -fPIC
diff -uNr defect-245.orig/exec/ckpt.c defect-245/exec/ckpt.c
--- defect-245.orig/exec/ckpt.c	2005-02-06 12:51:56.000000000 -0700
+++ defect-245/exec/ckpt.c	2005-02-07 17:53:35.000000000 -0700
@@ -45,7 +45,8 @@
 #include <signal.h>
 
 #include "../include/ais_types.h"
-#include "../include/ais_msg.h"
+#include "../include/saCkpt.h"
+#include "../include/ipc_ckpt.h"
 #include "../include/list.h"
 #include "../include/queue.h"
 #include "aispoll.h"
@@ -62,13 +63,16 @@
 
 DECLARE_LIST_INIT(checkpointIteratorListHead);
 
-//TODO static totempg_recovery_plug_handle ckpt_checkpoint_recovery_plug_handle;
+struct checkpoint_cleanup {
+    struct list_head list;
+    struct saCkptCheckpoint *checkpoint;
+};
 
-static int ckpt_checkpoint_exec_init_fn (void);
+//TODO static totempg_recovery_plug_handle ckpt_checkpoint_recovery_plug_handle;
 
-static int ckpt_checkpoint_exit_fn (struct conn_info *conn_info);
+static int ckpt_exec_init_fn (void);
 
-static int ckptSectionIteratorApiFinalize (struct conn_info *conn_info);
+static int ckpt_exit_fn (struct conn_info *conn_info);
 
 static int message_handler_req_lib_activatepoll (struct conn_info *, void *message);
 
@@ -96,19 +100,17 @@
 
 static int message_handler_req_lib_ckpt_init (struct conn_info *conn_info, void *message);
 
-static int message_handler_req_lib_ckpt_checkpoint_init (struct conn_info *conn_info, void *message);
-
-static int message_handler_req_lib_ckpt_sectioniterator_init (struct conn_info *conn_info, void *message);
-
 static int message_handler_req_lib_ckpt_checkpointopen (struct conn_info *conn_info, void *message);
 
 static int message_handler_req_lib_ckpt_checkpointopenasync (struct conn_info *conn_info, void *message);
 
+static int message_handler_req_lib_ckpt_checkpointclose (struct conn_info *conn_info, void *message);
+
 static int message_handler_req_lib_ckpt_checkpointunlink (struct conn_info *conn_info, void *message);
 
 static int message_handler_req_lib_ckpt_checkpointretentiondurationset (struct conn_info *conn_info, void *message);
 
-static int message_handler_req_lib_ckpt_activecheckpointset (struct conn_info *conn_info, void *message);
+static int message_handler_req_lib_ckpt_activereplicaset (struct conn_info *conn_info, void *message);
 
 static int message_handler_req_lib_ckpt_checkpointstatusget (struct conn_info *conn_info, void *message);
 
@@ -131,7 +133,7 @@
 static int message_handler_req_lib_ckpt_sectioniteratorinitialize (struct conn_info *conn_info, void *message);
 static int message_handler_req_lib_ckpt_sectioniteratornext (struct conn_info *conn_info, void *message);
 
-static int ckpt_checkpoint_confchg_fn (
+static int ckpt_confchg_fn (
 	enum totempg_configuration_type configuration_type,
 	struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
@@ -152,36 +154,6 @@
 struct libais_handler ckpt_libais_handlers[] =
 {
 	{ /* 0 */
-		.libais_handler_fn			= message_handler_req_lib_activatepoll,
-		.response_size				= sizeof (struct res_lib_activatepoll),
-		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL,
-	}
-};
-
-/*
- * TODO
- */
-int (*ckpt_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian_conversion_required) = {
-};
-
-/*
- * exported service
- */
-struct service_handler ckpt_service_handler = {
-	.libais_handlers			= ckpt_libais_handlers,
-	.libais_handlers_count		= sizeof (ckpt_libais_handlers) / sizeof (struct libais_handler),
-	.aisexec_handler_fns		= ckpt_aisexec_handler_fns,
-	.aisexec_handler_fns_count	= sizeof (ckpt_aisexec_handler_fns) / sizeof (int (*)),
-	.confchg_fn					= 0, /* ckpt service handler is not distributed */
-	.libais_init_fn				= message_handler_req_lib_ckpt_init,
-	.libais_exit_fn				= 0,
-	.exec_init_fn				= 0,
-	.exec_dump_fn				= 0
-};
-
-struct libais_handler ckpt_checkpoint_libais_handlers[] =
-{
-	{ /* 0 */
 		.libais_handler_fn	= message_handler_req_lib_activatepoll,
 		.response_size		= sizeof (struct res_lib_activatepoll),
 		.response_id		= MESSAGE_RES_LIB_ACTIVATEPOLL,
@@ -197,69 +169,84 @@
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
 	},
 	{ /* 3 */
+		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointclose,
+		.response_size		= sizeof (struct res_lib_ckpt_checkpointclose),
+		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTCLOSE,
+	},
+	{ /* 4 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointunlink,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointunlink),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
 	},
-	{ /* 4 */
+	{ /* 5 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointretentiondurationset,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointretentiondurationset),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
 	},
-	{ /* 5 */
-		.libais_handler_fn	= message_handler_req_lib_ckpt_activecheckpointset,
-		.response_size		= sizeof (struct res_lib_ckpt_activecheckpointset),
-		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_ACTIVECHECKPOINTSET,
-	},
 	{ /* 6 */
+		.libais_handler_fn	= message_handler_req_lib_ckpt_activereplicaset,
+		.response_size		= sizeof (struct res_lib_ckpt_activereplicaset),
+		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_ACTIVEREPLICASET,
+	},
+	{ /* 7 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointstatusget,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointstatusget),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
 	},
-	{ /* 7 */
+	{ /* 8 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectioncreate,
 		.response_size		= sizeof (struct res_lib_ckpt_sectioncreate),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE,
 	},
-	{ /* 8 */
+	{ /* 9 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectiondelete,
 		.response_size		= sizeof (struct res_lib_ckpt_sectiondelete),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE,
 	},
-	{ /* 9 */
+	{ /* 10 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionexpirationtimeset,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionexpirationtimeset),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
 	},
-	{ /* 10 */
+	{ /* 11 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionwrite,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionwrite),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE,
 	},
-	{ /* 11 */
+	{ /* 12 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionoverwrite,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionoverwrite),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE,
 	},
-	{ /* 12 */
+	{ /* 13 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionread,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionread),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD,
 	},
-	{ /* 13 */
+	{ /* 14 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointsynchronize,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointsynchronize),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
 	},
-	{ /* 14 */
+	{ /* 15 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointsynchronizeasync,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointsynchronizeasync), // TODO RESPONSE
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC,
 	},
+	{ /* 16 */
+		.libais_handler_fn	= message_handler_req_lib_ckpt_sectioniteratorinitialize,
+		.response_size		= sizeof (struct res_lib_ckpt_sectioniteratorinitialize),
+		.response_id		= MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE,
+	},
+	{ /* 17 */
+		.libais_handler_fn	= message_handler_req_lib_ckpt_sectioniteratornext,
+		.response_size		= sizeof (struct res_lib_ckpt_sectioniteratornext),
+		.response_id		= MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT,
+	}
 };
 
 
-static int (*ckpt_checkpoint_aisexec_handler_fns[]) (void *msg, struct in_addr source_addr, int endian_conversion_required) = {
+static int (*ckpt_aisexec_handler_fns[]) (void *msg, struct in_addr source_addr, int endian_conversion_required) = {
 	message_handler_req_exec_ckpt_checkpointopen,
 	message_handler_req_exec_ckpt_checkpointclose,
 	message_handler_req_exec_ckpt_checkpointunlink,
@@ -273,53 +260,19 @@
 	message_handler_req_exec_ckpt_sectionread
 };
 
-struct service_handler ckpt_checkpoint_service_handler = {
-	.libais_handlers			= ckpt_checkpoint_libais_handlers,
-	.libais_handlers_count		= sizeof (ckpt_checkpoint_libais_handlers) / sizeof (struct libais_handler),
-	.aisexec_handler_fns		= ckpt_checkpoint_aisexec_handler_fns,
-	.aisexec_handler_fns_count	= sizeof (ckpt_checkpoint_aisexec_handler_fns) / sizeof (int (*)),
-	.confchg_fn					= ckpt_checkpoint_confchg_fn,
-	.libais_init_fn				= message_handler_req_lib_ckpt_checkpoint_init,
-	.libais_exit_fn				= ckpt_checkpoint_exit_fn,
-	.exec_init_fn				= ckpt_checkpoint_exec_init_fn,
-	.exec_dump_fn				= 0
-};
-
-struct libais_handler ckpt_sectioniterator_libais_handlers[] =
-{
-	{ /* 0 */
-		.libais_handler_fn			= message_handler_req_lib_activatepoll,
-		.response_size				= sizeof (struct res_lib_activatepoll),
-		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL,
-	},
-	{ /* 1 */
-		.libais_handler_fn			= message_handler_req_lib_ckpt_sectioniteratorinitialize,
-		.response_size				= sizeof (struct res_lib_ckpt_sectioniteratorinitialize),
-		.response_id				= MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE,
-	},
-	{ /* 2 */
-		.libais_handler_fn			= message_handler_req_lib_ckpt_sectioniteratornext,
-		.response_size				= sizeof (struct res_lib_ckpt_sectioniteratornext),
-		.response_id				= MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT,
-	}
-};
-
-static int (*ckpt_sectioniterator_aisexec_handler_fns[]) (void *msg, struct in_addr source_addr, int endian_conversion_required) = {
-};
-
-struct service_handler ckpt_sectioniterator_service_handler = {
-	.libais_handlers			= ckpt_sectioniterator_libais_handlers,
-	.libais_handlers_count		= sizeof (ckpt_sectioniterator_libais_handlers) / sizeof (struct libais_handler),
-	.aisexec_handler_fns		= ckpt_sectioniterator_aisexec_handler_fns ,
-	.aisexec_handler_fns_count	= sizeof (ckpt_sectioniterator_aisexec_handler_fns) / sizeof (int (*)),
-	.confchg_fn					= 0, /* Section Iterators are not distributed */
-	.libais_init_fn				= message_handler_req_lib_ckpt_sectioniterator_init,
-	.libais_exit_fn				= ckptSectionIteratorApiFinalize,
-	.exec_init_fn				= 0,
+struct service_handler ckpt_service_handler = {
+	.libais_handlers			= ckpt_libais_handlers,
+	.libais_handlers_count		= sizeof (ckpt_libais_handlers) / sizeof (struct libais_handler),
+	.aisexec_handler_fns		= ckpt_aisexec_handler_fns,
+	.aisexec_handler_fns_count	= sizeof (ckpt_aisexec_handler_fns) / sizeof (int (*)),
+	.confchg_fn					= ckpt_confchg_fn,
+	.libais_init_fn				= message_handler_req_lib_ckpt_init,
+	.libais_exit_fn				= ckpt_exit_fn,
+	.exec_init_fn				= ckpt_exec_init_fn,
 	.exec_dump_fn				= 0
 };
 
-static struct saCkptCheckpoint *findCheckpoint (SaNameT *name)
+static struct saCkptCheckpoint *ckpt_checkpoint_find_global (SaNameT *name)
 {
 	struct list_head *checkpointList;
 	struct saCkptCheckpoint *checkpoint;
@@ -338,7 +291,28 @@
 	return (0);
 }
 
-static struct saCkptCheckpointSection *findCheckpointSection (
+static void ckpt_checkpoint_remove_cleanup (
+	struct conn_info *conn_info,
+	struct saCkptCheckpoint *checkpoint)
+{
+	struct list_head *list;
+	struct checkpoint_cleanup *checkpoint_cleanup;
+
+   for (list = conn_info->ais_ci.u.libckpt_ci.checkpoint_list.next;
+		list != &conn_info->ais_ci.u.libckpt_ci.checkpoint_list;
+        list = list->next) {
+
+        checkpoint_cleanup = list_entry (list,
+            struct checkpoint_cleanup, list);
+
+		if (checkpoint_cleanup->checkpoint == checkpoint) {
+			list_del (&checkpoint_cleanup->list);
+			free (checkpoint_cleanup);
+			return;
+		}
+	}
+}
+static struct saCkptCheckpointSection *ckpt_checkpoint_find_globalSection (
 	struct saCkptCheckpoint *ckptCheckpoint,
 	char *id,
 	int idLen)
@@ -400,7 +374,7 @@
 	free (checkpoint);
 }
 
-int sendCkptCheckpointClose (struct saCkptCheckpoint *checkpoint) {
+int ckpt_checkpoint_close (struct saCkptCheckpoint *checkpoint) {
 	struct req_exec_ckpt_checkpointclose req_exec_ckpt_checkpointclose;
 	struct iovec iovecs[2];
 
@@ -412,8 +386,7 @@
 	req_exec_ckpt_checkpointclose.header.id = MESSAGE_REQ_EXEC_CKPT_CHECKPOINTCLOSE;
 
 	memcpy (&req_exec_ckpt_checkpointclose.checkpointName,
-		&checkpoint->name,
-		sizeof (SaNameT));
+		&checkpoint->name, sizeof (SaNameT));
 
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointclose;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointclose);
@@ -426,7 +399,7 @@
 	return (-1);
 }
 
-static int ckpt_checkpoint_exec_init_fn (void)
+static int ckpt_exec_init_fn (void)
 {
 #ifdef TODO
 	int res;
@@ -441,34 +414,41 @@
 	return (0);
 }
 
-static int ckpt_checkpoint_exit_fn (struct conn_info *conn_info)
+static int ckpt_exit_fn (struct conn_info *conn_info)
 {
-
+	struct checkpoint_cleanup *checkpoint_cleanup;
+	struct list_head *list;
+	
+	if (conn_info->service != SOCKET_SERVICE_CKPT) {
+		return 0;
+	}
+	
 	/*
-	 * close checkpoint opened from this fd
+	 * close all checkpoints opened on this fd
 	 */
-	if (conn_info->service == SOCKET_SERVICE_CKPT_CHECKPOINT &&
-		conn_info->ais_ci.u.libckpt_ci.checkpoint) {
-		log_printf (LOG_LEVEL_DEBUG, "Trying to finalize %p %s\n", conn_info,
-			getSaNameT (&conn_info->ais_ci.u.libckpt_ci.checkpoint->name));
+	for (list = conn_info->ais_ci.u.libckpt_ci.checkpoint_list.next;
+		list != &conn_info->ais_ci.u.libckpt_ci.checkpoint_list;) {
 
-		sendCkptCheckpointClose (conn_info->ais_ci.u.libckpt_ci.checkpoint);
-	}
-	return (0);
-}
+		checkpoint_cleanup = list_entry (list,
+			struct checkpoint_cleanup, list);
 
-static int ckptSectionIteratorApiFinalize (struct conn_info *conn_info) {
-	/*
-	 * If section iterator connection, unlink from list and free section iterator data
-	 */
-	if (conn_info->service == SOCKET_SERVICE_CKPT_SECTIONITERATOR) {
-		log_printf (LOG_LEVEL_DEBUG, "freeing section iterator\n");
-		if (conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries) {
-			free (conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries);
-		}
-		list_del (&conn_info->ais_ci.u.libckpt_ci.sectionIterator.list);
+		ckpt_checkpoint_close (checkpoint_cleanup->checkpoint);
+
+		list = list->next;
+
+		free (checkpoint_cleanup);
 	}
 
+#ifdef TODO
+/* todo close section iterators
+ */
+// TODO what about exit of open checkpoints
+
+	if (conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries) {
+		free (conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries);
+	}
+	list_del (&conn_info->ais_ci.u.libckpt_ci.sectionIterator.list);
+#endif
 	return (0);
 }
 
@@ -478,7 +458,7 @@
 
 	res_lib_activatepoll.header.size = sizeof (struct res_lib_activatepoll);
 	res_lib_activatepoll.header.id = MESSAGE_RES_LIB_ACTIVATEPOLL;
-	res_lib_activatepoll.header.error = SA_OK;
+	res_lib_activatepoll.header.error = SA_AIS_OK;
 	libais_send_response (conn_info, &res_lib_activatepoll,
 		sizeof (struct res_lib_activatepoll));
 
@@ -493,11 +473,12 @@
 
 	struct saCkptCheckpoint *ckptCheckpoint = 0;
 	struct saCkptCheckpointSection *ckptCheckpointSection = 0;
-	SaErrorT error = SA_OK;
+	struct checkpoint_cleanup *checkpoint_cleanup;
+	SaErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "Executive request to open checkpoint %p\n", req_exec_ckpt_checkpointopen);
 	
-	ckptCheckpoint = findCheckpoint (&req_lib_ckpt_checkpointopen->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_checkpointopen->checkpointName);
 
 	/*
 	 * If checkpoint doesn't exist, create one
@@ -505,14 +486,14 @@
 	if (ckptCheckpoint == 0) {
 		ckptCheckpoint = malloc (sizeof (struct saCkptCheckpoint));
 		if (ckptCheckpoint == 0) {
-			error = SA_ERR_NO_MEMORY;
+			error = SA_AIS_ERR_NO_MEMORY;
 			goto error_exit;
 		}
 
 		ckptCheckpointSection = malloc (sizeof (struct saCkptCheckpointSection));
 		if (ckptCheckpointSection == 0) {
 			free (ckptCheckpoint);
-			error = SA_ERR_NO_MEMORY;
+			error = SA_AIS_ERR_NO_MEMORY;
 			goto error_exit;
 		}
 
@@ -553,10 +534,10 @@
 	 * If the checkpoint has been unlinked, it is an invalid name
 	 */
 	if (ckptCheckpoint->unlinked) {
-		error = SA_ERR_INVALID_PARAM; /* Is this the correct return ? */
+		error = SA_AIS_ERR_INVALID_PARAM; /* Is this the correct return ? */
 		goto error_exit;
 	}
-
+	
 	/*
 	 * Setup connection information and mark checkpoint as referenced
 	 */
@@ -577,17 +558,25 @@
 	 * If this node was the source of the message, respond to this node
 	 */
 	if (req_exec_ckpt_checkpointopen->source.in_addr.s_addr == this_ip.sin_addr.s_addr) {
-		req_exec_ckpt_checkpointopen->source.conn_info->ais_ci.u.libckpt_ci.checkpoint = ckptCheckpoint;
-		req_exec_ckpt_checkpointopen->source.conn_info->ais_ci.u.libckpt_ci.checkpointOpenFlags = req_lib_ckpt_checkpointopen->checkpointOpenFlags;
 		res_lib_ckpt_checkpointopen.header.size = sizeof (struct res_lib_ckpt_checkpointopen);
 		res_lib_ckpt_checkpointopen.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN;
 		res_lib_ckpt_checkpointopen.header.error = error;
 
+		checkpoint_cleanup = malloc (sizeof (struct checkpoint_cleanup));
+		if (checkpoint_cleanup == 0) {
+			free (ckptCheckpoint);
+			error = SA_AIS_ERR_NO_MEMORY;
+		} else {
+			checkpoint_cleanup->checkpoint = ckptCheckpoint;
+			list_add (&checkpoint_cleanup->list,
+				&req_exec_ckpt_checkpointopen->source.conn_info->ais_ci.u.libckpt_ci.checkpoint_list);
+		}
+
 		libais_send_response (req_exec_ckpt_checkpointopen->source.conn_info, &res_lib_ckpt_checkpointopen,
 			sizeof (struct res_lib_ckpt_checkpointopen));
 	}
 
-//	return (error == SA_OK ? 0 : -1);
+//	return (error == SA_AIS_OK ? 0 : -1);
 	return (0);
 }
 
@@ -638,16 +627,19 @@
 extern int message_handler_req_exec_ckpt_checkpointclose (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_ckpt_checkpointclose *req_exec_ckpt_checkpointclose = (struct req_exec_ckpt_checkpointclose *)message;
+	struct res_lib_ckpt_checkpointclose res_lib_ckpt_checkpointclose;
 	struct saCkptCheckpoint *checkpoint = 0;
+	SaAisErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "Got EXEC request to close checkpoint %s\n", getSaNameT (&req_exec_ckpt_checkpointclose->checkpointName));
 
-	checkpoint = findCheckpoint (&req_exec_ckpt_checkpointclose->checkpointName);
+	checkpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_checkpointclose->checkpointName);
 	if (checkpoint == 0) {
-		return (0);
+		goto error_exit;
 	}
 
 	checkpoint->referenceCount--;
+	assert (checkpoint->referenceCount >= 0);
 	log_printf (LOG_LEVEL_DEBUG, "disconnect called, new CKPT ref count is %d\n", 
 		checkpoint->referenceCount);
 
@@ -666,6 +658,17 @@
 			&checkpoint->retention_timer);
 	}
 	
+error_exit:
+	if (req_exec_ckpt_checkpointclose->source.in_addr.s_addr == this_ip.sin_addr.s_addr) {
+		ckpt_checkpoint_remove_cleanup (req_exec_ckpt_checkpointclose->source.conn_info,
+			checkpoint);
+
+		res_lib_ckpt_checkpointclose.header.size = sizeof (struct res_lib_ckpt_checkpointclose);
+		res_lib_ckpt_checkpointclose.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTCLOSE;
+		res_lib_ckpt_checkpointclose.header.error = error;
+		libais_send_response (req_exec_ckpt_checkpointclose->source.conn_info,
+			&res_lib_ckpt_checkpointclose, sizeof (struct res_lib_ckpt_checkpointclose));
+	}
 	return (0);
 }
 
@@ -676,16 +679,16 @@
 	struct req_lib_ckpt_checkpointunlink *req_lib_ckpt_checkpointunlink = (struct req_lib_ckpt_checkpointunlink *)&req_exec_ckpt_checkpointunlink->req_lib_ckpt_checkpointunlink;
 	struct res_lib_ckpt_checkpointunlink res_lib_ckpt_checkpointunlink;
 	struct saCkptCheckpoint *ckptCheckpoint = 0;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 	
 	log_printf (LOG_LEVEL_DEBUG, "Got EXEC request to unlink checkpoint %p\n", req_exec_ckpt_checkpointunlink);
-	ckptCheckpoint = findCheckpoint (&req_lib_ckpt_checkpointunlink->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_checkpointunlink->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 	if (ckptCheckpoint->unlinked) {
-		error = SA_ERR_INVALID_PARAM;
+		error = SA_AIS_ERR_INVALID_PARAM;
 		goto error_exit;
 	}
 	ckptCheckpoint->unlinked = 1;
@@ -720,7 +723,7 @@
 	struct res_lib_ckpt_checkpointretentiondurationset res_lib_ckpt_checkpointretentiondurationset;
 	struct saCkptCheckpoint *checkpoint;
 
-	checkpoint = findCheckpoint (&req_exec_ckpt_checkpointretentiondurationset->checkpointName);
+	checkpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_checkpointretentiondurationset->checkpointName);
 	if (checkpoint) {
 		log_printf (LOG_LEVEL_NOTICE, "CKPT: Setting retention duration for checkpoint %s\n",
 			getSaNameT (&req_exec_ckpt_checkpointretentiondurationset->checkpointName));
@@ -743,7 +746,7 @@
 	if (req_exec_ckpt_checkpointretentiondurationset->source.in_addr.s_addr == this_ip.sin_addr.s_addr) {
 		res_lib_ckpt_checkpointretentiondurationset.header.size = sizeof (struct res_lib_ckpt_checkpointretentiondurationset);
 		res_lib_ckpt_checkpointretentiondurationset.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET;
-		res_lib_ckpt_checkpointretentiondurationset.header.error = SA_OK;
+		res_lib_ckpt_checkpointretentiondurationset.header.error = SA_AIS_OK;
 
 		libais_send_response (req_exec_ckpt_checkpointretentiondurationset->source.conn_info,
 			&res_lib_ckpt_checkpointretentiondurationset,
@@ -759,7 +762,7 @@
 	struct saCkptCheckpoint *checkpoint;
 	struct iovec iovecs[2];
 
-	checkpoint = findCheckpoint (&req_exec_ckpt_checkpointretentiondurationexpire->checkpointName);
+	checkpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_checkpointretentiondurationexpire->checkpointName);
 	if (checkpoint && checkpoint->expired == 0) {
 		log_printf (LOG_LEVEL_NOTICE, "CKPT: Expiring checkpoint %s\n", getSaNameT (&req_exec_ckpt_checkpointretentiondurationexpire->checkpointName));
 		checkpoint->expired = 1;
@@ -791,23 +794,23 @@
 	struct saCkptCheckpointSection *ckptCheckpointSection;
 	void *initialData;
 	void *sectionId;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "Executive request to create a checkpoint section.\n");
-	ckptCheckpoint = findCheckpoint (&req_exec_ckpt_sectioncreate->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_sectioncreate->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_SYSTEM; // TODO find the right error for this
+		error = SA_AIS_ERR_LIBRARY; // TODO find the right error for this
 		goto error_exit;
 	}
 
 	/*
 	 * Determine if user-specified checkpoint ID already exists
 	 */
-	ckptCheckpointSection = findCheckpointSection (ckptCheckpoint,
+	ckptCheckpointSection = ckpt_checkpoint_find_globalSection (ckptCheckpoint,
 		((char *)req_lib_ckpt_sectioncreate) + sizeof (struct req_lib_ckpt_sectioncreate),
 		req_lib_ckpt_sectioncreate->idLen);
 	if (ckptCheckpointSection) {
-		error = SA_ERR_EXIST;
+		error = SA_AIS_ERR_EXIST;
 		goto error_exit;
 	}
 
@@ -816,7 +819,7 @@
 	 */
 	ckptCheckpointSection = malloc (sizeof (struct saCkptCheckpointSection));
 	if (ckptCheckpointSection == 0) {
-		error = SA_ERR_NO_MEMORY;
+		error = SA_AIS_ERR_NO_MEMORY;
 		goto error_exit;
 	}
 	/*
@@ -825,7 +828,7 @@
 	initialData = malloc (req_lib_ckpt_sectioncreate->initialDataSize);
 	if (initialData == 0) {
 		free (ckptCheckpointSection);
-		error = SA_ERR_NO_MEMORY;
+		error = SA_AIS_ERR_NO_MEMORY;
 		goto error_exit;
 	}
 	/*
@@ -835,7 +838,7 @@
 	if (sectionId == 0) {
 		free (ckptCheckpointSection);
 		free (initialData);
-		error = SA_ERR_NO_MEMORY;
+		error = SA_AIS_ERR_NO_MEMORY;
 		goto error_exit;
 	}
 		
@@ -875,7 +878,8 @@
 	 * Add checkpoint section to checkpoint
 	 */
 	list_init (&ckptCheckpointSection->list);
-	list_add (&ckptCheckpointSection->list, &ckptCheckpoint->checkpointSectionsListHead);
+	list_add (&ckptCheckpointSection->list,
+		&ckptCheckpoint->checkpointSectionsListHead);
 
 error_exit:
 	if (req_exec_ckpt_sectioncreate->source.in_addr.s_addr == this_ip.sin_addr.s_addr) {
@@ -896,11 +900,11 @@
 	struct res_lib_ckpt_sectiondelete res_lib_ckpt_sectiondelete;
 	struct saCkptCheckpoint *ckptCheckpoint;
 	struct saCkptCheckpointSection *ckptCheckpointSection;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 
-	ckptCheckpoint = findCheckpoint (&req_exec_ckpt_sectiondelete->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_sectiondelete->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -908,19 +912,18 @@
 	 * Determine if the user is trying to delete the default section
 	 */
 	if (req_lib_ckpt_sectiondelete->idLen == 0) {
-		error = SA_ERR_INVALID_PARAM;
+		error = SA_AIS_ERR_INVALID_PARAM;
 		goto error_exit;
 	}
 
 	/*
 	 * Find checkpoint section to be deleted
 	 */
-	ckptCheckpointSection = findCheckpointSection (ckptCheckpoint,
+	ckptCheckpointSection = ckpt_checkpoint_find_globalSection (ckptCheckpoint,
 		((char *)(req_lib_ckpt_sectiondelete) + sizeof (struct req_lib_ckpt_sectiondelete)),
 		req_lib_ckpt_sectiondelete->idLen);
 	if (ckptCheckpointSection == 0) {
-printf ("section not found\n");
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -951,12 +954,12 @@
 	struct res_lib_ckpt_sectionexpirationtimeset res_lib_ckpt_sectionexpirationtimeset;
 	struct saCkptCheckpoint *ckptCheckpoint;
 	struct saCkptCheckpointSection *ckptCheckpointSection;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "Executive request to set section expiratoin time\n");
-	ckptCheckpoint = findCheckpoint (&req_exec_ckpt_sectionexpirationtimeset->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_sectionexpirationtimeset->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -964,20 +967,20 @@
 	 * Determine if the user is trying to set expiration time for the default section
 	 */
 	if (req_lib_ckpt_sectionexpirationtimeset->idLen == 0) {
-		error = SA_ERR_INVALID_PARAM;
+		error = SA_AIS_ERR_INVALID_PARAM;
 		goto error_exit;
 	}
 
 	/*
 	 * Find checkpoint section that expiration time should be set for
 	 */
-	ckptCheckpointSection = findCheckpointSection (ckptCheckpoint,
+	ckptCheckpointSection = ckpt_checkpoint_find_globalSection (ckptCheckpoint,
 		((char *)req_lib_ckpt_sectionexpirationtimeset) +
 			sizeof (struct req_lib_ckpt_sectionexpirationtimeset),
 		req_lib_ckpt_sectionexpirationtimeset->idLen);
 
 	if (ckptCheckpointSection == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -1015,12 +1018,12 @@
 	struct saCkptCheckpointSection *ckptCheckpointSection;
 	int sizeRequired;
 	void *sectionData;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "Executive request to section write.\n");
-	ckptCheckpoint = findCheckpoint (&req_exec_ckpt_sectionwrite->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_sectionwrite->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -1028,13 +1031,13 @@
 	/*
 	 * Find checkpoint section to be written
 	 */
-	ckptCheckpointSection = findCheckpointSection (ckptCheckpoint,
+	ckptCheckpointSection = ckpt_checkpoint_find_globalSection (ckptCheckpoint,
 		((char *)req_lib_ckpt_sectionwrite) + sizeof (struct req_lib_ckpt_sectionwrite),
 		req_lib_ckpt_sectionwrite->idLen);
 	if (ckptCheckpointSection == 0) {
 printf ("CANT FIND SECTION '%s'\n",
 		((char *)req_lib_ckpt_sectionwrite) + sizeof (struct req_lib_ckpt_sectionwrite));
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -1045,7 +1048,7 @@
 	if (sizeRequired > ckptCheckpointSection->sectionDescriptor.sectionSize) {
 		sectionData = realloc (ckptCheckpointSection->sectionData, sizeRequired);
 		if (sectionData == 0) {
-			error = SA_ERR_NO_MEMORY;
+			error = SA_AIS_ERR_NO_MEMORY;
 			goto error_exit;
 		}
 
@@ -1093,24 +1096,24 @@
 	struct saCkptCheckpoint *ckptCheckpoint;
 	struct saCkptCheckpointSection *ckptCheckpointSection;
 	void *sectionData;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "Executive request to section overwrite.\n");
-	ckptCheckpoint = findCheckpoint (&req_exec_ckpt_sectionoverwrite->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_sectionoverwrite->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
 	/*
 	 * Find checkpoint section to be overwritten
 	 */
-	ckptCheckpointSection = findCheckpointSection (ckptCheckpoint,
+	ckptCheckpointSection = ckpt_checkpoint_find_globalSection (ckptCheckpoint,
 		((char *)req_lib_ckpt_sectionoverwrite) +
 			sizeof (struct req_lib_ckpt_sectionoverwrite),
 		req_lib_ckpt_sectionoverwrite->idLen);
 	if (ckptCheckpointSection == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -1119,7 +1122,7 @@
 	 */
 	sectionData = malloc (req_lib_ckpt_sectionoverwrite->dataSize);
 	if (sectionData == 0) {
-		error = SA_ERR_NO_MEMORY;
+		error = SA_AIS_ERR_NO_MEMORY;
 		goto error_exit;
 	}
 
@@ -1164,25 +1167,25 @@
 	struct saCkptCheckpoint *ckptCheckpoint;
 	struct saCkptCheckpointSection *ckptCheckpointSection = 0;
 	int sectionSize = 0;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "Executive request for section read.\n");
 
-	ckptCheckpoint = findCheckpoint (&req_exec_ckpt_sectionread->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_exec_ckpt_sectionread->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_SYSTEM; // TODO find the right error for this
+		error = SA_AIS_ERR_LIBRARY; // TODO find the right error for this
 		goto error_exit;
 	}
 
 	/*
 	 * Find checkpoint section to be read
 	 */
-	ckptCheckpointSection = findCheckpointSection (ckptCheckpoint,
+	ckptCheckpointSection = ckpt_checkpoint_find_globalSection (ckptCheckpoint,
 		((char *)req_lib_ckpt_sectionread) +
 			sizeof (struct req_lib_ckpt_sectionread),
 		req_lib_ckpt_sectionread->idLen);
 	if (ckptCheckpointSection == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -1205,7 +1208,7 @@
 	 */
 	if (req_lib_ckpt_sectionread->dataOffset > sectionSize) {
 		sectionSize = 0;
-		error = SA_ERR_INVALID_PARAM;
+		error = SA_AIS_ERR_INVALID_PARAM;
 		goto error_exit;
 	}
 
@@ -1239,69 +1242,20 @@
 static int message_handler_req_lib_ckpt_init (struct conn_info *conn_info, void *message)
 {
 	struct res_lib_init res_lib_init;
-	SaErrorT error = SA_ERR_SECURITY;
-
-	log_printf (LOG_LEVEL_DEBUG, "Got request to initialize CKPT.\n");
-
-	if (conn_info->authenticated) {
-		conn_info->service = SOCKET_SERVICE_CKPT;
-		error = SA_OK;
-	}
-
-	res_lib_init.header.size = sizeof (struct res_lib_init);
-	res_lib_init.header.id = MESSAGE_RES_INIT;
-	res_lib_init.header.error = error;
-
-	libais_send_response (conn_info, &res_lib_init, sizeof (res_lib_init));
-
-	if (conn_info->authenticated) {
-		return (0);
-	}
-	return (-1);
-}
-
-static int message_handler_req_lib_ckpt_checkpoint_init (struct conn_info *conn_info, void *message)
-{
-	struct res_lib_init res_lib_init;
-	SaErrorT error = SA_ERR_SECURITY;
+	SaErrorT error = SA_AIS_ERR_ACCESS;
 
 	log_printf (LOG_LEVEL_DEBUG, "Got request to initialize CKPT checkpoint.\n");
 
 	if (conn_info->authenticated) {
-    	conn_info->service = SOCKET_SERVICE_CKPT_CHECKPOINT;
-		conn_info->ais_ci.u.libckpt_ci.checkpoint = 0;
-		conn_info->ais_ci.u.libckpt_ci.checkpointOpenFlags = 0;
-		error = SA_OK;
-	}
-
-	res_lib_init.header.size = sizeof (struct res_lib_init);
-	res_lib_init.header.id = MESSAGE_RES_INIT;
-	res_lib_init.header.error = error;
-
-	libais_send_response (conn_info, &res_lib_init, sizeof (res_lib_init));
-
-	if (conn_info->authenticated) {
-		return (0);
-	}
-	return (-1);
-}
-
-static int message_handler_req_lib_ckpt_sectioniterator_init (struct conn_info *conn_info, void *message)
-{
-	struct res_lib_init res_lib_init;
-	SaErrorT error = SA_ERR_SECURITY;
-
-	log_printf (LOG_LEVEL_DEBUG, "Got request to initialize CKPT section iterator.\n");
-
-	if (conn_info->authenticated) {
-		conn_info->service = SOCKET_SERVICE_CKPT_SECTIONITERATOR;
+    	conn_info->service = SOCKET_SERVICE_CKPT;
 		list_init (&conn_info->ais_ci.u.libckpt_ci.sectionIterator.list);
 		conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries = 0;
 		conn_info->ais_ci.u.libckpt_ci.sectionIterator.iteratorCount = 0;
 		conn_info->ais_ci.u.libckpt_ci.sectionIterator.iteratorPos = 0;
 		list_add (&conn_info->ais_ci.u.libckpt_ci.sectionIterator.list,
 			&checkpointIteratorListHead);
-		error = SA_OK;
+		list_init (&conn_info->ais_ci.u.libckpt_ci.checkpoint_list);
+		error = SA_AIS_OK;
 	}
 
 	res_lib_init.header.size = sizeof (struct res_lib_init);
@@ -1348,6 +1302,36 @@
 }
 
 
+static int message_handler_req_lib_ckpt_checkpointclose (struct conn_info *conn_info, void *message) {
+	struct req_lib_ckpt_checkpointclose *req_lib_ckpt_checkpointclose = (struct req_lib_ckpt_checkpointclose *)message;
+	struct req_exec_ckpt_checkpointclose req_exec_ckpt_checkpointclose;
+	struct saCkptCheckpoint *checkpoint;
+	struct iovec iovecs[2];
+
+	checkpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_checkpointclose->checkpointName);
+	if (checkpoint->expired == 1) {
+		return (0);
+	}
+	req_exec_ckpt_checkpointclose.header.size =
+		sizeof (struct req_exec_ckpt_checkpointclose);
+	req_exec_ckpt_checkpointclose.header.id = MESSAGE_REQ_EXEC_CKPT_CHECKPOINTCLOSE;
+
+	req_exec_ckpt_checkpointclose.source.conn_info = conn_info;
+	req_exec_ckpt_checkpointclose.source.in_addr.s_addr = this_ip.sin_addr.s_addr;
+
+	memcpy (&req_exec_ckpt_checkpointclose.checkpointName,
+		&checkpoint->name, sizeof (SaNameT));
+
+	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointclose;
+	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointclose);
+
+	if (totempg_send_ok (sizeof (struct req_exec_ckpt_checkpointclose))) {
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED) == 0);
+	}
+
+	return (0);
+}
+
 static int message_handler_req_lib_ckpt_checkpointunlink (struct conn_info *conn_info, void *message)
 {
 	struct req_lib_ckpt_checkpointunlink *req_lib_ckpt_checkpointunlink = (struct req_lib_ckpt_checkpointunlink *)message;
@@ -1387,7 +1371,7 @@
 	req_exec_ckpt_checkpointretentiondurationset.source.in_addr.s_addr = this_ip.sin_addr.s_addr;
 
 	memcpy (&req_exec_ckpt_checkpointretentiondurationset.checkpointName,
-		&conn_info->ais_ci.u.libckpt_ci.checkpoint->name,
+		&req_lib_ckpt_checkpointretentiondurationset->checkpointName,
 		sizeof (SaNameT));
 	req_exec_ckpt_checkpointretentiondurationset.retentionDuration = req_lib_ckpt_checkpointretentiondurationset->retentionDuration;
 
@@ -1399,7 +1383,7 @@
 	return (0);
 }
 
-static int message_handler_req_lib_ckpt_activecheckpointset (struct conn_info *conn_info, void *message)
+static int message_handler_req_lib_ckpt_activereplicaset (struct conn_info *conn_info, void *message)
 {
 	return (0);
 }
@@ -1414,13 +1398,13 @@
 	struct list_head *checkpointSectionList;
 	struct saCkptCheckpointSection *checkpointSection;
 
-	req_lib_ckpt_checkpointstatusget = 0; /* The request info isn't used */
 	log_printf (LOG_LEVEL_DEBUG, "in status get\n");
 
 	/*
 	 * Count memory used by checkpoint sections
 	 */
-	checkpoint = conn_info->ais_ci.u.libckpt_ci.checkpoint;
+	checkpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_checkpointstatusget->checkpointName);
+
 	for (checkpointSectionList = checkpoint->checkpointSectionsListHead.next;
 		checkpointSectionList != &checkpoint->checkpointSectionsListHead;
 		checkpointSectionList = checkpointSectionList->next) {
@@ -1437,13 +1421,13 @@
 	 */
 	res_lib_ckpt_checkpointstatusget.header.size = sizeof (struct res_lib_ckpt_checkpointstatusget);
 	res_lib_ckpt_checkpointstatusget.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET;
-	res_lib_ckpt_checkpointstatusget.header.error = SA_OK;
+	res_lib_ckpt_checkpointstatusget.header.error = SA_AIS_OK;
 
-	memcpy (&res_lib_ckpt_checkpointstatusget.checkpointStatus.checkpointCreationAttributes,
+	memcpy (&res_lib_ckpt_checkpointstatusget.checkpointDescriptor.checkpointCreationAttributes,
 		&checkpoint->checkpointCreationAttributes,
 		sizeof (SaCkptCheckpointCreationAttributesT));
-	res_lib_ckpt_checkpointstatusget.checkpointStatus.numberOfSections = numberOfSections;
-	res_lib_ckpt_checkpointstatusget.checkpointStatus.memoryUsed = memoryUsed;
+	res_lib_ckpt_checkpointstatusget.checkpointDescriptor.numberOfSections = numberOfSections;
+	res_lib_ckpt_checkpointstatusget.checkpointDescriptor.memoryUsed = memoryUsed;
 
 	log_printf (LOG_LEVEL_DEBUG, "before sending message\n");
 	libais_send_response (conn_info, &res_lib_ckpt_checkpointstatusget,
@@ -1455,22 +1439,11 @@
 {
 	struct req_lib_ckpt_sectioncreate *req_lib_ckpt_sectioncreate = (struct req_lib_ckpt_sectioncreate *)message;
 	struct req_exec_ckpt_sectioncreate req_exec_ckpt_sectioncreate;
-	struct res_lib_ckpt_sectioncreate res_lib_ckpt_sectioncreate;
 	struct iovec iovecs[2];
+	struct saCkptCheckpoint *checkpoint;
 
 	log_printf (LOG_LEVEL_DEBUG, "Section create from API fd %d\n", conn_info->fd);
-	/*
-	 * Determine if checkpoint is opened in write mode If not, send error to api
-	 */
-	if ((conn_info->ais_ci.u.libckpt_ci.checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
-		res_lib_ckpt_sectioncreate.header.size = sizeof (struct res_lib_ckpt_sectioncreate);
-		res_lib_ckpt_sectioncreate.header.id = MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE;
-		res_lib_ckpt_sectioncreate.header.error = SA_ERR_ACCESS;
-
-		libais_send_response (conn_info, &res_lib_ckpt_sectioncreate,
-			sizeof (struct res_lib_ckpt_sectioncreate));
-		return (0);
-	}
+	checkpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_sectioncreate->checkpointName);
 
 	/*
 	 * checkpoint opened is writeable mode so send message to cluster
@@ -1483,7 +1456,7 @@
 		sizeof (struct req_lib_ckpt_sectioncreate));
 
 	memcpy (&req_exec_ckpt_sectioncreate.checkpointName,
-		&conn_info->ais_ci.u.libckpt_ci.checkpoint->name,
+		&req_lib_ckpt_sectioncreate->checkpointName,
 		sizeof (SaNameT));
 
 	req_exec_ckpt_sectioncreate.source.conn_info = conn_info;
@@ -1532,7 +1505,7 @@
 	req_exec_ckpt_sectiondelete.header.size = sizeof (struct req_exec_ckpt_sectiondelete);
 
 	memcpy (&req_exec_ckpt_sectiondelete.checkpointName,
-		&conn_info->ais_ci.u.libckpt_ci.checkpoint->name,
+		&req_lib_ckpt_sectiondelete->checkpointName,
 		sizeof (SaNameT));
 
 	memcpy (&req_exec_ckpt_sectiondelete.req_lib_ckpt_sectiondelete,
@@ -1571,7 +1544,7 @@
 	req_exec_ckpt_sectionexpirationtimeset.header.size = sizeof (struct req_exec_ckpt_sectionexpirationtimeset);
 
 	memcpy (&req_exec_ckpt_sectionexpirationtimeset.checkpointName,
-		&conn_info->ais_ci.u.libckpt_ci.checkpoint->name,
+		&req_lib_ckpt_sectionexpirationtimeset->checkpointName,
 		sizeof (SaNameT));
 
 	memcpy (&req_exec_ckpt_sectionexpirationtimeset.req_lib_ckpt_sectionexpirationtimeset,
@@ -1605,23 +1578,11 @@
 {
 	struct req_lib_ckpt_sectionwrite *req_lib_ckpt_sectionwrite = (struct req_lib_ckpt_sectionwrite *)message;
 	struct req_exec_ckpt_sectionwrite req_exec_ckpt_sectionwrite;
-	struct res_lib_ckpt_sectionwrite res_lib_ckpt_sectionwrite;
 	struct iovec iovecs[2];
+	struct saCkptCheckpoint *checkpoint;
 
 	log_printf (LOG_LEVEL_DEBUG, "Section write from API fd %d\n", conn_info->fd);
-// UNDO printf ("section write %d\n", write_inv++);
-	/*
-	 * Determine if checkpoint is opened in write mode If not, send error to api
-	 */
-	if ((conn_info->ais_ci.u.libckpt_ci.checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
-		res_lib_ckpt_sectionwrite.header.size = sizeof (struct res_lib_ckpt_sectionwrite);
-		res_lib_ckpt_sectionwrite.header.id = MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE;
-		res_lib_ckpt_sectionwrite.header.error = SA_ERR_ACCESS;
-
-		libais_send_response (conn_info, &res_lib_ckpt_sectionwrite,
-			sizeof (struct res_lib_ckpt_sectionwrite));
-		return (0);
-	}
+	checkpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_sectionwrite->checkpointName);
 
 	/*
 	 * checkpoint opened is writeable mode so send message to cluster
@@ -1634,7 +1595,7 @@
 		sizeof (struct req_lib_ckpt_sectionwrite));
 
 	memcpy (&req_exec_ckpt_sectionwrite.checkpointName,
-		&conn_info->ais_ci.u.libckpt_ci.checkpoint->name,
+		&req_lib_ckpt_sectionwrite->checkpointName,
 		sizeof (SaNameT));
 
 	req_exec_ckpt_sectionwrite.source.conn_info = conn_info;
@@ -1662,22 +1623,11 @@
 {
 	struct req_lib_ckpt_sectionoverwrite *req_lib_ckpt_sectionoverwrite = (struct req_lib_ckpt_sectionoverwrite *)message;
 	struct req_exec_ckpt_sectionoverwrite req_exec_ckpt_sectionoverwrite;
-	struct res_lib_ckpt_sectionoverwrite res_lib_ckpt_sectionoverwrite;
 	struct iovec iovecs[2];
+	struct saCkptCheckpoint *checkpoint;
 
 	log_printf (LOG_LEVEL_DEBUG, "Section overwrite from API fd %d\n", conn_info->fd);
-	/*
-	 * Determine if checkpoint is opened in write mode If not, send error to api
-	 */
-	if ((conn_info->ais_ci.u.libckpt_ci.checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
-		res_lib_ckpt_sectionoverwrite.header.size = sizeof (struct res_lib_ckpt_sectionoverwrite);
-		res_lib_ckpt_sectionoverwrite.header.id = MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE;
-		res_lib_ckpt_sectionoverwrite.header.error = SA_ERR_ACCESS;
-
-		libais_send_response (conn_info, &res_lib_ckpt_sectionoverwrite,
-			sizeof (struct res_lib_ckpt_sectionoverwrite));
-		return (0);
-	}
+	checkpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_sectionoverwrite->checkpointName);
 
 	/*
 	 * checkpoint opened is writeable mode so send message to cluster
@@ -1690,7 +1640,7 @@
 		sizeof (struct req_lib_ckpt_sectionoverwrite));
 
 	memcpy (&req_exec_ckpt_sectionoverwrite.checkpointName,
-		&conn_info->ais_ci.u.libckpt_ci.checkpoint->name,
+		&req_lib_ckpt_sectionoverwrite->checkpointName,
 		sizeof (SaNameT));
 
 	req_exec_ckpt_sectionoverwrite.source.conn_info = conn_info;
@@ -1717,22 +1667,11 @@
 {
 	struct req_lib_ckpt_sectionread *req_lib_ckpt_sectionread = (struct req_lib_ckpt_sectionread *)message;
 	struct req_exec_ckpt_sectionread req_exec_ckpt_sectionread;
-	struct res_lib_ckpt_sectionread res_lib_ckpt_sectionread;
 	struct iovec iovecs[2];
+	struct saCkptCheckpoint *checkpoint;
 
 	log_printf (LOG_LEVEL_DEBUG, "Section overwrite from API fd %d\n", conn_info->fd);
-	/*
-	 * Determine if checkpoint is opened in write mode If not, send error to api
-	 */
-	if ((conn_info->ais_ci.u.libckpt_ci.checkpointOpenFlags & SA_CKPT_CHECKPOINT_READ) == 0) {
-		res_lib_ckpt_sectionread.header.size = sizeof (struct res_lib_ckpt_sectionread);
-		res_lib_ckpt_sectionread.header.id = MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD;
-		res_lib_ckpt_sectionread.header.error = SA_ERR_ACCESS;
-
-		libais_send_response (conn_info, &res_lib_ckpt_sectionread,
-			sizeof (struct res_lib_ckpt_sectionread));
-		return (0);
-	}
+	checkpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_sectionread->checkpointName);
 
 	/*
 	 * checkpoint opened is writeable mode so send message to cluster
@@ -1745,7 +1684,7 @@
 		sizeof (struct req_lib_ckpt_sectionread));
 
 	memcpy (&req_exec_ckpt_sectionread.checkpointName,
-		&conn_info->ais_ci.u.libckpt_ci.checkpoint->name,
+		&req_lib_ckpt_sectionread->checkpointName,
 		sizeof (SaNameT));
 
 	req_exec_ckpt_sectionread.source.conn_info = conn_info;
@@ -1789,14 +1728,14 @@
 	struct list_head *checkpointSectionList;
 	int addEntry = 0;
 	int iteratorEntries = 0;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 
 	log_printf (LOG_LEVEL_DEBUG, "section iterator initialize\n");
 	ckptSectionIterator = &conn_info->ais_ci.u.libckpt_ci.sectionIterator;
 
-	ckptCheckpoint = findCheckpoint (&req_lib_ckpt_sectioniteratorinitialize->checkpointName);
+	ckptCheckpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_sectioniteratorinitialize->checkpointName);
 	if (ckptCheckpoint == 0) {
-		error = SA_ERR_NOT_EXIST;
+		error = SA_AIS_ERR_NOT_EXIST;
 		goto error_exit;
 	}
 
@@ -1824,7 +1763,7 @@
 				if (ckptSectionIterator->sectionIteratorEntries) {
 					free (ckptSectionIterator->sectionIteratorEntries);
 				}
-				error = SA_ERR_NO_MEMORY;
+				error = SA_AIS_ERR_NO_MEMORY;
 				goto error_exit;
 			}
 			ckptSectionIteratorEntries[iteratorEntries - 1].active = 1;
@@ -1850,7 +1789,7 @@
 	struct req_lib_ckpt_sectioniteratornext *req_lib_ckpt_sectioniteratornext = (struct req_lib_ckpt_sectioniteratornext *)message;
 	struct res_lib_ckpt_sectioniteratornext res_lib_ckpt_sectioniteratornext;
 	struct saCkptSectionIterator *ckptSectionIterator;
-	SaErrorT error = SA_OK;
+	SaErrorT error = SA_AIS_OK;
 	int sectionIdSize = 0;
 	int iteratorPos = 0;
 
@@ -1867,7 +1806,7 @@
 		 * No more sections in iterator
 		 */
 		if (ckptSectionIterator->iteratorPos + 1 >= ckptSectionIterator->iteratorCount) {
-			error = SA_ERR_NOT_EXIST;
+			error = SA_AIS_ERR_NOT_EXIST;
 			goto error_exit;
 		}
 
diff -uNr defect-245.orig/exec/ckpt.h defect-245/exec/ckpt.h
--- defect-245.orig/exec/ckpt.h	2005-02-06 12:51:56.000000000 -0700
+++ defect-245/exec/ckpt.h	2005-02-07 15:46:12.000000000 -0700
@@ -32,7 +32,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "../include/ais_types.h"
-#include "../include/ais_msg.h"
+#include "../include/saCkpt.h"
 #include "aispoll.h"
 #include "parse.h"
 
@@ -70,15 +70,10 @@
 };
 
 struct libckpt_ci {
-	struct saCkptCheckpoint *checkpoint;
-	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
+	struct list_head checkpoint_list;
 	struct saCkptSectionIterator sectionIterator;
 };
 
 extern struct service_handler ckpt_service_handler;
 
-extern struct service_handler ckpt_checkpoint_service_handler;
-
-extern struct service_handler ckpt_sectioniterator_service_handler;
-
 #endif /* CKPT_H_DEFINED */
diff -uNr defect-245.orig/exec/main.c defect-245/exec/main.c
--- defect-245.orig/exec/main.c	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/exec/main.c	2005-02-06 15:09:09.000000000 -0700
@@ -87,12 +87,10 @@
     &clm_service_handler,
     &amf_service_handler,
     &ckpt_service_handler,
-    &ckpt_checkpoint_service_handler,
-    &ckpt_sectioniterator_service_handler,
     &evt_service_handler
 };
 
-#define AIS_SERVICE_HANDLERS_COUNT 7
+#define AIS_SERVICE_HANDLERS_COUNT 5
 #define AIS_SERVICE_HANDLER_AISEXEC_FUNCTIONS_MAX 40
 
 static int poll_handler_libais_deliver (poll_handle handle, int fd, int revent, void *data, unsigned int *prio);
diff -uNr defect-245.orig/exec/main.h defect-245/exec/main.h
--- defect-245.orig/exec/main.h	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/exec/main.h	2005-02-06 14:46:47.000000000 -0700
@@ -58,8 +58,6 @@
 	SOCKET_SERVICE_CLM,
 	SOCKET_SERVICE_AMF,
 	SOCKET_SERVICE_CKPT,
-	SOCKET_SERVICE_CKPT_CHECKPOINT,
-	SOCKET_SERVICE_CKPT_SECTIONITERATOR,
 	SOCKET_SERVICE_EVT
 };
 
Files defect-245.orig/include/.saCkpt.h.swp and defect-245/include/.saCkpt.h.swp differ
diff -uNr defect-245.orig/include/ais_ckpt.h defect-245/include/ais_ckpt.h
--- defect-245.orig/include/ais_ckpt.h	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/include/ais_ckpt.h	1969-12-31 17:00:00.000000000 -0700
@@ -1,174 +0,0 @@
-
-/*
- * Copyright (c) 2002-2003 MontaVista Software, Inc.
- *
- * All rights reserved.
- *
- * Author: Steven Dake (sdake at mvista.com)
- *
- * This software licensed under BSD license, the text of which follows:
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * - Neither the name of the MontaVista Software, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived from this
- *   software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "ais_types.h"
-
-#ifndef AIS_CKPT_H_DEFINED
-#define AIS_CKPT_H_DEFINED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-SaErrorT
-saCkptInitialize (
-	SaCkptHandleT *ckptHandle,
-	const SaCkptCallbacksT *callbacks,
-	const SaVersionT *version);
-
-SaErrorT
-saCkptSelectionObjectGet (
-	const SaCkptHandleT *ckptHandle,
-	SaSelectionObjectT *selectionObject);
-
-SaErrorT
-saCkptDispatch (
-	const SaCkptHandleT *ckptHandle,
-	SaDispatchFlagsT dispatchFlags);
-
-SaErrorT
-saCkptFinalize (
-	const SaCkptHandleT *ckptHandle);
-
-SaErrorT
-saCkptCheckpointOpen (
-	const SaNameT *checkpointName,
-	const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
-	SaCkptCheckpointOpenFlagsT checkpointOpenFlags,
-	SaTimeT timeout,
-	SaCkptCheckpointHandleT *checkpointHandle);
-
-SaErrorT
-saCkptCheckpointOpenAsync (
-	const SaCkptHandleT *ckptHandle,
-	SaInvocationT invocation,	
-	const SaNameT *checkpointName,
-	const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
-	SaCkptCheckpointOpenFlagsT checkpointOpenFlags);
-
-SaErrorT
-saCkptCheckpointClose (
-	const SaCkptCheckpointHandleT *checkpointHandle);
-
-SaErrorT
-saCkptCheckpointUnlink (
-	const SaNameT *checkpointName);
-
-SaErrorT
-saCkptCheckpointRetentionDurationSet (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaTimeT retentionDuration);
-
-SaErrorT
-saCkptActiveCheckpointSet (
-	const SaCkptCheckpointHandleT *checkpointHandle);
-
-SaErrorT
-saCkptCheckpointStatusGet (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaCkptCheckpointStatusT *checkpointStatus);
-
-SaErrorT
-saCkptSectionCreate (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaCkptSectionCreationAttributesT *sectionCreationAttributes,
-	const void *initialData,
-	SaUint32T initialDataSize);
-
-
-SaErrorT
-saCkptSectionDelete (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	const SaCkptSectionIdT *sectionId);
-
-SaErrorT
-saCkptSectionExpirationTimeSet (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	const SaCkptSectionIdT *sectionId,
-	SaTimeT expirationTime);
-
-SaErrorT
-saCkptSectionIteratorInitialize (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaCkptSectionsChosenT sectionsChosen,
-	SaTimeT expirationTime,
-	SaCkptSectionIteratorT *sectionIterator);
-
-SaErrorT
-saCkptSectionIteratorNext (
-	SaCkptSectionIteratorT *sectionIterator,
-	SaCkptSectionDescriptorT *sectionDescriptor);
-
-SaErrorT
-saCkptSectionIteratorFinalize (
-	SaCkptSectionIteratorT *sectionIterator);
-
-SaErrorT
-saCkptCheckpointWrite (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	const SaCkptIOVectorElementT *ioVector,
-	SaUint32T numberOfElements,
-	SaUint32T *erroneousVectorIndex);
-
-SaErrorT
-saCkptSectionOverwrite (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	const SaCkptSectionIdT *secitonId,
-	SaUint8T *dataBuffer,
-	SaSizeT dataSize);
-
-SaErrorT
-saCkptCheckpointRead (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaCkptIOVectorElementT *ioVector,
-	SaUint32T numberOfElements,
-	SaUint32T *erroneousVectorIndex);
-
-SaErrorT
-saCkptCheckpointSynchronize (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaTimeT timeout);
-
-SaErrorT
-saCkptCheckpointSynchronizeAsync (
-	const SaCkptHandleT *ckptHandle,
-	SaInvocationT invocation,
-	const SaCkptCheckpointHandleT *checkpointHandle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* AIS_CKPT_H_DEFINED */
diff -uNr defect-245.orig/include/ais_msg.h defect-245/include/ais_msg.h
--- defect-245.orig/include/ais_msg.h	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/include/ais_msg.h	2005-02-06 14:38:55.000000000 -0700
@@ -101,60 +101,6 @@
 	MESSAGE_RES_AMF_RESPONSE
 };
 
-enum req_lib_ckpt_checkpoint_types {
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPEN = 1,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_ACTIVECHECKPOINTSET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONCREATE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONDELETE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONWRITE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONOVERWRITE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONREAD,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC
-};
-
-enum req_lib_ckpt_sectioniterator_types {
-	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE = 1,
-	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT
-};
-
-enum res_lib_ckpt_types {
-	MESSAGE_RES_CKPT_CHECKPOINTOPENASYNC = 1,
-	MESSAGE_RES_CKPT_CHECKPOINTSYNCHRONIZEASYNC
-};
-
-enum res_lib_ckpt_checkpoint_types {
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN = 1,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
-	MESSAGE_RES_CKPT_CHECKPOINT_ACTIVECHECKPOINTSET,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC
-};
-
-enum res_lib_ckpt_sectioniterator_types {
-	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE = 1,
-	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT
-};
-
-struct message_source {
-	struct conn_info *conn_info;
-	struct in_addr in_addr;
-} __attribute__((packed));
-
 struct res_evs_deliver_callback {
 	struct res_header header;
 	struct in_addr source_addr;
@@ -305,23 +251,6 @@
 	SaAmfHAStateT haState;
 };
 
-struct req_exec_ckpt_checkpointclose {
-	struct req_header header;
-	SaNameT checkpointName;
-};
-
-struct req_exec_ckpt_checkpointretentiondurationset {
-	struct req_header header;
-	struct message_source source;
-	SaNameT checkpointName;
-	SaTimeT retentionDuration;
-};
-
-struct req_exec_ckpt_checkpointretentiondurationexpire {
-	struct req_header header;
-	SaNameT checkpointName;
-};
-
 struct res_lib_amf_componentterminatecallback {
 	struct res_header header;
 	SaInvocationT invocation;
@@ -462,226 +391,4 @@
 	struct res_header header;
 };
 
-struct req_lib_ckpt_checkpointopen {
-	struct req_header header;
-	SaNameT checkpointName;
-	SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
-	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
-};
-
-struct res_lib_ckpt_checkpointopen {
-	struct res_header header;
-};
-
-struct req_exec_ckpt_checkpointopen {
-	struct req_header header;
-	struct message_source source;
-	struct req_lib_ckpt_checkpointopen req_lib_ckpt_checkpointopen;
-};
-
-
-struct req_lib_ckpt_checkpointopenasync {
-	struct req_header header;
-	SaNameT checkpointName;
-	SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
-	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
-	SaInvocationT invocation;
-};
-
-struct res_lib_ckpt_checkpointopenasync {
-	struct res_header header;
-	SaCkptCheckpointHandleT checkpointHandle;
-	SaInvocationT invocation;
-};
-
-struct req_lib_ckpt_checkpointclose {
-	struct req_header header;
-};
-
-struct res_lib_ckpt_checkpointclose {
-	struct res_header header;
-	SaNameT checkpointName;
-};
-
-struct req_lib_ckpt_checkpointunlink {
-	struct req_header header;
-	SaNameT checkpointName;
-};
-
-struct res_lib_ckpt_checkpointunlink {
-	struct res_header header;
-};
-
-struct req_exec_ckpt_checkpointunlink {
-	struct req_header header;
-	struct message_source source;
-	struct req_lib_ckpt_checkpointunlink req_lib_ckpt_checkpointunlink;
-};
-
-struct req_lib_ckpt_checkpointretentiondurationset {
-	struct req_header header;
-	SaTimeT retentionDuration;
-};
-struct res_lib_ckpt_checkpointretentiondurationset {
-	struct res_header header;
-};
-
-struct req_lib_ckpt_activecheckpointset {
-	struct req_header header;
-};
-
-struct res_lib_ckpt_activecheckpointset {
-	struct res_header header;
-};
-
-struct req_lib_ckpt_checkpointstatusget {
-	struct req_header header;
-};
-
-struct res_lib_ckpt_checkpointstatusget {
-	struct res_header header;
-	SaCkptCheckpointStatusT checkpointStatus;
-};
-
-struct req_lib_ckpt_sectioncreate {
-	struct req_header header;
-	SaUint32T idLen;
-	SaTimeT expirationTime;
-	SaUint32T initialDataSize;
-};
-
-struct res_lib_ckpt_sectioncreate {
-	struct res_header header;
-};
-
-struct req_exec_ckpt_sectioncreate {
-	struct req_header header;
-	struct message_source source;
-	SaNameT checkpointName;
-	struct req_lib_ckpt_sectioncreate req_lib_ckpt_sectioncreate; /* this must be last */
-};
-
-struct req_lib_ckpt_sectiondelete {
-	struct req_header header;
-	SaUint32T idLen;
-};
-
-struct res_lib_ckpt_sectiondelete {
-	struct res_header header;
-};
-struct req_exec_ckpt_sectiondelete {
-	struct req_header header;
-	struct message_source source;
-	SaNameT checkpointName;
-	struct req_lib_ckpt_sectiondelete req_lib_ckpt_sectiondelete; /* this must be last */
-};
-
-struct req_lib_ckpt_sectionexpirationtimeset {
-	struct req_header header;
-	SaUint32T idLen;
-	SaTimeT expirationTime;
-};
-
-struct res_lib_ckpt_sectionexpirationtimeset {
-	struct res_header header;
-};
-
-struct req_exec_ckpt_sectionexpirationtimeset {
-	struct req_header header;
-	struct message_source source;
-	SaNameT checkpointName;
-	struct req_lib_ckpt_sectionexpirationtimeset req_lib_ckpt_sectionexpirationtimeset;
-};
-
-struct req_lib_ckpt_sectioniteratorinitialize {
-	struct req_header header;
-	SaNameT checkpointName;
-	SaCkptSectionsChosenT sectionsChosen;
-	SaTimeT expirationTime;
-};
-
-struct res_lib_ckpt_sectioniteratorinitialize {
-	struct res_header header;
-};
-
-struct req_lib_ckpt_sectioniteratornext {
-	struct req_header header;
-};
-
-struct res_lib_ckpt_sectioniteratornext {
-	struct res_header header;
-	SaCkptSectionDescriptorT sectionDescriptor;
-};
-
-struct req_lib_ckpt_sectionwrite {
-	struct req_header header;
-	SaUint32T idLen;
-	SaOffsetT dataOffset;
-	SaOffsetT dataSize;
-};
-
-struct res_lib_ckpt_sectionwrite {
-	struct res_header header;
-};
-
-struct req_exec_ckpt_sectionwrite {
-	struct req_header header;
-	struct message_source source;
-	SaNameT checkpointName;
-	struct req_lib_ckpt_sectionwrite req_lib_ckpt_sectionwrite;
-};
-
-struct req_lib_ckpt_sectionoverwrite {
-	struct req_header header;
-	SaUint32T idLen;
-	SaUint32T dataSize;
-};
-
-struct res_lib_ckpt_sectionoverwrite {
-	struct res_header header;
-};
-	
-struct req_exec_ckpt_sectionoverwrite {
-	struct req_header header;
-	struct message_source source;
-	SaNameT checkpointName;
-	struct req_lib_ckpt_sectionoverwrite req_lib_ckpt_sectionoverwrite;
-};
-
-struct req_lib_ckpt_sectionread {
-	struct req_header header;
-	SaUint32T idLen;
-	SaOffsetT dataOffset;
-	SaOffsetT dataSize;
-};
-
-struct res_lib_ckpt_sectionread {
-	struct res_header header;
-	SaSizeT dataRead;
-};
-
-struct req_exec_ckpt_sectionread {
-	struct req_header header;
-	struct message_source source;
-	SaNameT checkpointName;
-	struct req_lib_ckpt_sectionread req_lib_ckpt_sectionread;
-};
-
-struct req_lib_ckpt_checkpointsynchronize {
-	struct req_header header;
-};
-
-struct res_lib_ckpt_checkpointsynchronize {
-	struct res_header header;
-};
-
-struct req_lib_ckpt_checkpointsynchronizeasync {
-	struct req_header header;
-	SaInvocationT invocation;
-};
-
-struct res_lib_ckpt_checkpointsynchronizeasync {
-	struct res_header header;
-};
-
 #endif /* AIS_MSG_H_DEFINED */
diff -uNr defect-245.orig/include/ais_types.h defect-245/include/ais_types.h
--- defect-245.orig/include/ais_types.h	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/include/ais_types.h	2005-02-06 13:13:54.000000000 -0700
@@ -304,95 +304,4 @@
 	SaAmfErrorBufferT *additionalInformation;
 } SaAmfAdditionalDataT;
 
-typedef SaUint64T SaCkptHandleT;
-
-typedef SaUint64T SaCkptCheckpointHandleT;
-
-typedef SaUint64T SaCkptSectionIteratorT;
-
-#define SA_CKPT_WR_ALL_REPLICAS 0x1
-#define SA_CKPT_WR_ACTIVE_REPLICA 0x2
-#define SA_CKPT_WR_ACTIVE_REPLICA_WEAK 0x4
-
-typedef SaUint32T SaCkptCheckpointCreationFlagsT;
-
-typedef struct {
-	SaCkptCheckpointCreationFlagsT creationFlags;
-	SaSizeT checkpointSize;
-	SaTimeT retentionDuration;
-	SaUint32T maxSections;
-	SaSizeT maxSectionSize;
-	SaUint32T maxSectionIdSize;
-} SaCkptCheckpointCreationAttributesT;
-
-#define SA_CKPT_CHECKPOINT_READ 0x1
-#define SA_CKPT_CHECKPOINT_WRITE 0x2
-#define SA_CKPT_CHECKPOINT_COLOCATED 0x4
-typedef SaUint32T SaCkptCheckpointOpenFlagsT;
-
-#define SA_CKPT_DEFAULT_SECTION_ID { 0, 0 }
-#define SA_CKPT_GENERATED_SECTION_ID { 0, 0 }
-
-typedef struct {
-	SaUint8T *id;
-	SaUint32T idLen;
-} SaCkptSectionIdT;
-
-typedef struct {
-	SaCkptSectionIdT *sectionId;
-	SaTimeT expirationTime;
-} SaCkptSectionCreationAttributesT;
-
-typedef enum {
-	SA_CKPT_SECTION_VALID = 1,
-	SA_CKPT_SECTION_CORRUPTED = 2
-} SaCkptSectionStateT;
-
-typedef struct {
-	SaCkptSectionIdT sectionId;
-	SaTimeT expirationTime;
-	SaSizeT sectionSize;
-	SaCkptSectionStateT sectionState;
-	SaTimeT lastUpdate;
-} SaCkptSectionDescriptorT;
-
-typedef enum {
-	SA_CKPT_SECTIONS_FOREVER = 1,
-	SA_CKPT_SECTIONS_LEQ_EXPIRATION_TIME = 2,
-	SA_CKPT_SECTIONS_GEQ_EXPIRATION_TIME = 3,
-	SA_CKPT_SECTIONS_CORRUPTED = 4,
-	SA_CKPT_SECTIONS_ANY = 5
-} SaCkptSectionsChosenT;
-
-typedef SaUint32T SaOffsetT;
-
-typedef struct {
-	SaCkptSectionIdT sectionId;
-	void *dataBuffer;
-	SaSizeT dataSize;
-	SaOffsetT dataOffset;
-	SaSizeT readSize;
-} SaCkptIOVectorElementT;
-
-typedef struct {
-	SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
-	SaUint32T numberOfSections;
-	SaUint32T memoryUsed;
-} SaCkptCheckpointStatusT;
-
-typedef void (*SaCkptCheckpointOpenCallbackT) (
-	SaInvocationT invocation,	
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaErrorT error);
-
-typedef void (*SaCkptCheckpointSynchronizeCallbackT) (
-	SaInvocationT invocation,	
-	SaErrorT error);
-
-typedef struct {
-	SaCkptCheckpointOpenCallbackT saCkptCheckpointOpenCallback;
-	SaCkptCheckpointSynchronizeCallbackT saCkptCheckpointSynchronizeCallback;
-} SaCkptCallbacksT;
-
-
 #endif /* AIS_TYPES_H_DEFINED */
diff -uNr defect-245.orig/include/ipc_ckpt.h defect-245/include/ipc_ckpt.h
--- defect-245.orig/include/ipc_ckpt.h	1969-12-31 17:00:00.000000000 -0700
+++ defect-245/include/ipc_ckpt.h	2005-02-06 16:56:07.000000000 -0700
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake at mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef IPC_CKPT_H_DEFINED
+#define IPC_CKPT_H_DEFINED
+
+#include "../include/ipc_gen.h"
+#include "../include/ais_types.h"
+#include "../include/saCkpt.h"
+
+enum req_lib_ckpt_checkpoint_types {
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPEN = 1,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTCLOSE,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
+	MESSAGE_REQ_CKPT_CHECKPOINT_ACTIVEREPLICASET,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONCREATE,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONDELETE,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONWRITE,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONOVERWRITE,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONREAD,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC,
+	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE,
+	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT
+};
+
+enum res_lib_ckpt_checkpoint_types {
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTCLOSE,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
+	MESSAGE_RES_CKPT_CHECKPOINT_ACTIVEREPLICASET,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC,
+	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE,
+	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT
+};
+
+struct req_exec_ckpt_checkpointclose {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+};
+
+struct req_exec_ckpt_checkpointretentiondurationset {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+	SaTimeT retentionDuration;
+};
+
+struct req_exec_ckpt_checkpointretentiondurationexpire {
+	struct req_header header;
+	SaNameT checkpointName;
+};
+
+struct req_lib_ckpt_checkpointopen {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
+	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
+};
+
+struct res_lib_ckpt_checkpointopen {
+	struct res_header header;
+};
+
+struct req_exec_ckpt_checkpointopen {
+	struct req_header header;
+	struct message_source source;
+	struct req_lib_ckpt_checkpointopen req_lib_ckpt_checkpointopen;
+};
+
+
+struct req_lib_ckpt_checkpointopenasync {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
+	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
+	SaInvocationT invocation;
+};
+
+struct res_lib_ckpt_checkpointopenasync {
+	struct res_header header;
+	SaCkptCheckpointHandleT checkpointHandle;
+	SaInvocationT invocation;
+};
+
+struct req_lib_ckpt_checkpointclose {
+	struct req_header header;
+	SaNameT checkpointName;
+};
+
+struct res_lib_ckpt_checkpointclose {
+	struct res_header header;
+};
+
+struct req_lib_ckpt_checkpointunlink {
+	struct req_header header;
+	SaNameT checkpointName;
+};
+
+struct res_lib_ckpt_checkpointunlink {
+	struct res_header header;
+};
+
+struct req_exec_ckpt_checkpointunlink {
+	struct req_header header;
+	struct message_source source;
+	struct req_lib_ckpt_checkpointunlink req_lib_ckpt_checkpointunlink;
+};
+
+struct req_lib_ckpt_checkpointretentiondurationset {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaTimeT retentionDuration;
+};
+struct res_lib_ckpt_checkpointretentiondurationset {
+	struct res_header header;
+};
+
+struct req_lib_ckpt_activereplicaset {
+	struct req_header header;
+};
+
+struct res_lib_ckpt_activereplicaset {
+	struct res_header header;
+};
+
+struct req_lib_ckpt_checkpointstatusget {
+	struct req_header header;
+	SaNameT checkpointName;
+};
+
+struct res_lib_ckpt_checkpointstatusget {
+	struct res_header header;
+	SaCkptCheckpointDescriptorT checkpointDescriptor;
+};
+
+struct req_lib_ckpt_sectioncreate {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaUint32T idLen;
+	SaTimeT expirationTime;
+	SaUint32T initialDataSize;
+};
+
+struct res_lib_ckpt_sectioncreate {
+	struct res_header header;
+};
+
+struct req_exec_ckpt_sectioncreate {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+	struct req_lib_ckpt_sectioncreate req_lib_ckpt_sectioncreate; /* this must be last */
+};
+
+struct req_lib_ckpt_sectiondelete {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaUint32T idLen;
+};
+
+struct res_lib_ckpt_sectiondelete {
+	struct res_header header;
+};
+struct req_exec_ckpt_sectiondelete {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+	struct req_lib_ckpt_sectiondelete req_lib_ckpt_sectiondelete; /* this must be last */
+};
+
+struct req_lib_ckpt_sectionexpirationtimeset {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaUint32T idLen;
+	SaTimeT expirationTime;
+};
+
+struct res_lib_ckpt_sectionexpirationtimeset {
+	struct res_header header;
+};
+
+struct req_exec_ckpt_sectionexpirationtimeset {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+	struct req_lib_ckpt_sectionexpirationtimeset req_lib_ckpt_sectionexpirationtimeset;
+};
+
+struct req_lib_ckpt_sectioniteratorinitialize {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaCkptSectionsChosenT sectionsChosen;
+	SaTimeT expirationTime;
+};
+
+struct res_lib_ckpt_sectioniteratorinitialize {
+	struct res_header header;
+};
+
+struct req_lib_ckpt_sectioniteratornext {
+	struct req_header header;
+};
+
+struct res_lib_ckpt_sectioniteratornext {
+	struct res_header header;
+	SaCkptSectionDescriptorT sectionDescriptor;
+};
+
+struct req_lib_ckpt_sectionwrite {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaUint32T idLen;
+	SaOffsetT dataOffset;
+	SaOffsetT dataSize;
+};
+
+struct res_lib_ckpt_sectionwrite {
+	struct res_header header;
+};
+
+struct req_exec_ckpt_sectionwrite {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+	struct req_lib_ckpt_sectionwrite req_lib_ckpt_sectionwrite;
+};
+
+struct req_lib_ckpt_sectionoverwrite {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaUint32T idLen;
+	SaUint32T dataSize;
+};
+
+struct res_lib_ckpt_sectionoverwrite {
+	struct res_header header;
+};
+	
+struct req_exec_ckpt_sectionoverwrite {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+	struct req_lib_ckpt_sectionoverwrite req_lib_ckpt_sectionoverwrite;
+};
+
+struct req_lib_ckpt_sectionread {
+	struct req_header header;
+	SaNameT checkpointName;
+	SaUint32T idLen;
+	SaOffsetT dataOffset;
+	SaOffsetT dataSize;
+};
+
+struct res_lib_ckpt_sectionread {
+	struct res_header header;
+	SaSizeT dataRead;
+};
+
+struct req_exec_ckpt_sectionread {
+	struct req_header header;
+	struct message_source source;
+	SaNameT checkpointName;
+	struct req_lib_ckpt_sectionread req_lib_ckpt_sectionread;
+};
+
+struct req_lib_ckpt_checkpointsynchronize {
+	struct req_header header;
+};
+
+struct res_lib_ckpt_checkpointsynchronize {
+	struct res_header header;
+};
+
+struct req_lib_ckpt_checkpointsynchronizeasync {
+	struct req_header header;
+	SaInvocationT invocation;
+};
+
+struct res_lib_ckpt_checkpointsynchronizeasync {
+	struct res_header header;
+};
+
+#endif /* IPC_CKPT_H_DEFINED */
diff -uNr defect-245.orig/include/ipc_gen.h defect-245/include/ipc_gen.h
--- defect-245.orig/include/ipc_gen.h	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/include/ipc_gen.h	2005-02-06 14:49:32.000000000 -0700
@@ -39,8 +39,6 @@
 	MESSAGE_REQ_CLM_INIT,
 	MESSAGE_REQ_AMF_INIT,
 	MESSAGE_REQ_CKPT_INIT,
-	MESSAGE_REQ_CKPT_CHECKPOINT_INIT,
-	MESSAGE_REQ_CKPT_SECTIONITERATOR_INIT,
 	MESSAGE_REQ_EVT_INIT
 };
 
@@ -87,5 +85,9 @@
 	SaErrorT error;
 };
 
+struct message_source {
+    struct conn_info *conn_info;
+    struct in_addr in_addr;
+} __attribute__((packed));
 
 #endif /* IPC_GEN_H_DEFINED */
diff -uNr defect-245.orig/include/saCkpt.h defect-245/include/saCkpt.h
--- defect-245.orig/include/saCkpt.h	1969-12-31 17:00:00.000000000 -0700
+++ defect-245/include/saCkpt.h	2005-02-06 14:28:37.000000000 -0700
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake at mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SACKPT_H_DEFINED
+#define SACKPT_H_DEFINED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef SaUint64T SaCkptHandleT;
+
+typedef SaUint64T SaCkptCheckpointHandleT;
+
+typedef SaUint64T SaCkptSectionIterationHandleT;
+
+#define SA_CKPT_WR_ALL_REPLICAS	0x01
+#define SA_CKPT_WR_ACTIVE_REPLICA	0x2
+#define SA_CKPT_WR_ACTIVE_REPLICA_WEAK	0x4
+#define SA_CKPT_CHECKPOINT_COLLOCATED	0x8
+
+typedef SaUint32T SaCkptCheckpointCreationFlagsT;
+
+typedef struct {
+	SaCkptCheckpointCreationFlagsT creationFlags;
+	SaSizeT checkpointSize;
+	SaTimeT retentionDuration;
+	SaUint32T maxSections;
+	SaSizeT maxSectionSize;
+	SaSizeT maxSectionIdSize;
+} SaCkptCheckpointCreationAttributesT;
+
+#define SA_CKPT_CHECKPOINT_READ		0x1
+#define SA_CKPT_CHECKPOINT_WRITE	0x2
+#define SA_CKPT_CHECKPOINT_CREATE	0x4
+
+typedef SaUint32T SaCkptCheckpointOpenFlagsT;
+
+#define SA_CKPT_DEFAULT_SECTION_ID { 0, 0 }
+#define SA_CKPT_GENERATED_SECTION_ID { 0, 0 }
+
+typedef struct {
+	SaUint16T idLen;
+	SaUint8T *id;
+} SaCkptSectionIdT;
+
+typedef struct {
+	SaCkptSectionIdT *sectionId;
+	SaTimeT expirationTime;
+} SaCkptSectionCreationAttributesT;
+
+typedef enum {
+	SA_CKPT_SECTION_VALID = 1,
+	SA_CKPT_SECTION_CORRUPTED = 2
+} SaCkptSectionStateT;
+
+typedef struct {
+	SaCkptSectionIdT sectionId;
+	SaTimeT expirationTime;
+	SaSizeT sectionSize;
+	SaCkptSectionStateT sectionState;
+	SaTimeT lastUpdate;
+} SaCkptSectionDescriptorT;
+
+typedef enum {
+	SA_CKPT_SECTIONS_FOREVER = 1,
+	SA_CKPT_SECTIONS_LEQ_EXPIRATION_TIME = 2,
+	SA_CKPT_SECTIONS_GEQ_EXPIRATION_TIME = 3,
+	SA_CKPT_SECTIONS_CORRUPTED = 4,
+	SA_CKPT_SECTIONS_ANY = 5
+} SaCkptSectionsChosenT;
+
+typedef SaUint32T SaOffsetT;
+
+typedef struct {
+	SaCkptSectionIdT sectionId;
+	void *dataBuffer;
+	SaSizeT dataSize;
+	SaOffsetT dataOffset;
+	SaSizeT readSize;
+} SaCkptIOVectorElementT;
+
+typedef struct {
+	SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
+	SaUint32T numberOfSections;
+	SaUint32T memoryUsed;
+} SaCkptCheckpointDescriptorT;
+
+typedef void (*SaCkptCheckpointOpenCallbackT) (
+	SaInvocationT invocation,	
+	const SaCkptCheckpointHandleT checkpointHandle,
+	SaAisErrorT error);
+
+typedef void (*SaCkptCheckpointSynchronizeCallbackT) (
+	SaInvocationT invocation,	
+	SaAisErrorT error);
+
+typedef struct {
+	SaCkptCheckpointOpenCallbackT saCkptCheckpointOpenCallback;
+	SaCkptCheckpointSynchronizeCallbackT saCkptCheckpointSynchronizeCallback;
+} SaCkptCallbacksT;
+
+
+SaAisErrorT
+saCkptInitialize (
+	SaCkptHandleT *ckptHandle,
+	const SaCkptCallbacksT *callbacks,
+	SaVersionT *version);
+
+SaAisErrorT
+saCkptSelectionObjectGet (
+	SaCkptHandleT ckptHandle,
+	SaSelectionObjectT *selectionObject);
+
+SaAisErrorT
+saCkptDispatch (
+	SaCkptHandleT ckptHandle,
+	SaDispatchFlagsT dispatchFlags);
+
+SaAisErrorT
+saCkptFinalize (
+	SaCkptHandleT ckptHandle);
+
+SaAisErrorT
+saCkptCheckpointOpen (
+	SaCkptHandleT ckptHandle,
+	const SaNameT *checkpointName,
+	const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
+	SaCkptCheckpointOpenFlagsT checkpointOpenFlags,
+	SaTimeT timeout,
+	SaCkptCheckpointHandleT *checkpointHandle);
+
+SaAisErrorT
+saCkptCheckpointOpenAsync (
+	SaCkptHandleT ckptHandle,
+	SaInvocationT invocation,	
+	const SaNameT *checkpointName,
+	const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
+	SaCkptCheckpointOpenFlagsT checkpointOpenFlags);
+
+SaAisErrorT
+saCkptCheckpointClose (
+	SaCkptCheckpointHandleT checkpointHandle);
+
+SaAisErrorT
+saCkptCheckpointUnlink (
+	SaCkptCheckpointHandleT checkpointHandle,
+	const SaNameT *checkpointName);
+
+SaAisErrorT
+saCkptCheckpointRetentionDurationSet (
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaTimeT retentionDuration);
+
+SaAisErrorT
+saCkptActiveReplicaSet (
+	const SaCkptCheckpointHandleT checkpointHandle);
+
+SaAisErrorT
+saCkptCheckpointStatusGet (
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaCkptCheckpointDescriptorT *checkpointStatus);
+
+SaAisErrorT
+saCkptSectionCreate (
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaCkptSectionCreationAttributesT *sectionCreationAttributes,
+	const void *initialData,
+	SaUint32T initialDataSize);
+
+
+SaAisErrorT
+saCkptSectionDelete (
+	SaCkptCheckpointHandleT checkpointHandle,
+	const SaCkptSectionIdT *sectionId);
+
+SaAisErrorT
+saCkptSectionExpirationTimeSet (
+	SaCkptCheckpointHandleT checkpointHandle,
+	const SaCkptSectionIdT *sectionId,
+	SaTimeT expirationTime);
+
+SaAisErrorT
+saCkptSectionIterationInitialize (
+	const SaCkptCheckpointHandleT checkpointHandle,
+	SaCkptSectionsChosenT sectionsChosen,
+	SaTimeT expirationTime,
+	SaCkptSectionIterationHandleT *sectionIterationHandle);
+
+SaAisErrorT
+saCkptSectionIterationNext (
+	SaCkptSectionIterationHandleT sectionIterationHandle,
+	SaCkptSectionDescriptorT *sectionDescriptor);
+
+SaAisErrorT
+saCkptSectionIterationFinalize (
+	SaCkptSectionIterationHandleT sectionIterationHandle);
+
+SaAisErrorT
+saCkptCheckpointWrite (
+	SaCkptCheckpointHandleT checkpointHandle,
+	const SaCkptIOVectorElementT *ioVector,
+	SaUint32T numberOfElements,
+	SaUint32T *erroneousVectorIndex);
+
+SaAisErrorT
+saCkptSectionOverwrite (
+	SaCkptCheckpointHandleT checkpointHandle,
+	const SaCkptSectionIdT *secitonId,
+	const void *dataBuffer,
+	SaSizeT dataSize);
+
+SaAisErrorT
+saCkptCheckpointRead (
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaCkptIOVectorElementT *ioVector,
+	SaUint32T numberOfElements,
+	SaUint32T *erroneousVectorIndex);
+
+SaAisErrorT
+saCkptCheckpointSynchronize (
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaTimeT timeout);
+
+SaAisErrorT
+saCkptCheckpointSynchronizeAsync (
+	SaCkptHandleT ckptHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaInvocationT invocation);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SACKPT_H_DEFINED */
Files defect-245.orig/lib/.ckpt.c.swp and defect-245/lib/.ckpt.c.swp differ
diff -uNr defect-245.orig/lib/Makefile defect-245/lib/Makefile
--- defect-245.orig/lib/Makefile	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/lib/Makefile	2005-02-06 13:13:23.000000000 -0700
@@ -86,7 +86,7 @@
 clm.o: ../include/ais_types.h ../include/saClm.h ../include/ais_types.h
 clm.o: ../include/ais_msg.h ../include/evs.h ../include/saClm.h
 clm.o: ../include/ipc_gen.h ../include/ipc_clm.h util.h
-ckpt.o: ../include/list.h ../include/ais_types.h ../include/ais_ckpt.h
+ckpt.o: ../include/list.h ../include/ais_types.h ../include/saCkpt.h
 ckpt.o: ../include/ais_types.h ../include/ais_msg.h ../include/evs.h
 ckpt.o: ../include/saClm.h ../include/ipc_gen.h util.h
 evt.o: ../include/ipc_evt.h ../include/ais_types.h ../include/saEvt.h
diff -uNr defect-245.orig/lib/ckpt.c defect-245/lib/ckpt.c
--- defect-245.orig/lib/ckpt.c	2005-02-06 12:51:56.000000000 -0700
+++ defect-245/lib/ckpt.c	2005-02-07 14:16:04.000000000 -0700
@@ -44,12 +44,13 @@
 #include <sys/select.h>
 #include <sys/un.h>
 
-#include "../include/list.h"
-#include "../include/ais_types.h"
-#include "../include/ais_ckpt.h"
-#include "../include/ais_msg.h"
 #include "util.h"
 
+#include "../include/list.h"
+#include "../include/saCkpt.h"
+#include "../include/ipc_gen.h"
+#include "../include/ipc_ckpt.h"
+
 struct message_overlay {
 	struct req_header header;
 	char data[4096];
@@ -68,13 +69,16 @@
 
 struct ckptCheckpointInstance {
 	int fd;
+	SaCkptHandleT ckptHandle;
+	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
 	SaNameT checkpointName;
 	SaUint32T maxSectionIdSize;
 	pthread_mutex_t mutex;
 };
 
-struct ckptSectionIteratorInstance {
+struct ckptSectionIterationInstance {
 	int fd;
+	SaCkptCheckpointHandleT checkpointHandle;
 	struct list_head sectionIdListHead;
 	SaUint32T maxSectionIdSize;
 	pthread_mutex_t mutex;
@@ -82,7 +86,7 @@
 
 void ckptHandleInstanceDestructor (void *instance);
 void checkpointHandleInstanceDestructor (void *instance);
-void ckptSectionIteratorHandleInstanceDestructor (void *instance);
+void ckptSectionIterationHandleInstanceDestructor (void *instance);
 
 /*
  * All CKPT instances in this database
@@ -107,19 +111,19 @@
 /*
  * All section iterators in this database
  */
-static struct saHandleDatabase ckptSectionIteratorHandleDatabase = {
+static struct saHandleDatabase ckptSectionIterationHandleDatabase = {
 	.handleCount				= 0,
 	.handles					= 0,
 	.mutex						= PTHREAD_MUTEX_INITIALIZER,
-	.handleInstanceDestructor	= ckptSectionIteratorHandleInstanceDestructor
+	.handleInstanceDestructor	= ckptSectionIterationHandleInstanceDestructor
 };
 
 /*
  * Versions supported
  */
 static SaVersionT ckptVersionsSupported[] = {
-	{ 'A', 1, 1 },
-	{ 'a', 1, 1 }
+	{ 'B', 1, 1 },
+	{ 'b', 1, 1 }
 };
 
 static struct saVersionDatabase ckptVersionDatabase = {
@@ -146,49 +150,43 @@
 
 void checkpointHandleInstanceDestructor (void *instance)
 {
-	struct ckptCheckpointInstance *ckptCheckpointInstance = (struct ckptCheckpointInstance *)instance;
-
-	if (ckptCheckpointInstance->fd != -1) {
-		shutdown (ckptCheckpointInstance->fd, 0);
-
-		close (ckptCheckpointInstance->fd);
-	}
+	return;
 }
 
-void ckptSectionIteratorHandleInstanceDestructor (void *instance)
+void ckptSectionIterationHandleInstanceDestructor (void *instance)
 {
-	struct ckptSectionIteratorInstance *ckptSectionIteratorInstance = (struct ckptSectionIteratorInstance *)instance;
+	struct ckptSectionIterationInstance *ckptSectionIterationInstance = (struct ckptSectionIterationInstance *)instance;
 
-	if (ckptSectionIteratorInstance->fd != -1) {
-		shutdown (ckptSectionIteratorInstance->fd, 0);
+	if (ckptSectionIterationInstance->fd != -1) {
+		shutdown (ckptSectionIterationInstance->fd, 0);
 
-		close (ckptSectionIteratorInstance->fd);
+		close (ckptSectionIterationInstance->fd);
 	}
 }
 
-SaErrorT
+SaAisErrorT
 saCkptInitialize (
 	SaCkptHandleT *ckptHandle,
 	const SaCkptCallbacksT *callbacks,
-	const SaVersionT *version)
+	SaVersionT *version)
 {
 	struct ckptInstance *ckptInstance;
-	SaErrorT error = SA_OK;
+	SaAisErrorT error = SA_AIS_OK;
 
 	error = saVersionVerify (&ckptVersionDatabase, version);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleCreate (&ckptHandleDatabase, sizeof (struct ckptInstance),
 		ckptHandle);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&ckptHandleDatabase, *ckptHandle,
 		(void *)&ckptInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_destroy;
 	}
 
@@ -199,12 +197,12 @@
 	 * sync response
 	 */
 	error = saQueueInit (&ckptInstance->inq, 512, sizeof (void *));
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_put_destroy;
 	}
 
-	error = saServiceConnect (&ckptInstance->fd, MESSAGE_REQ_CKPT_CHECKPOINT_INIT);
-	if (error != SA_OK) {
+	error = saServiceConnect (&ckptInstance->fd, MESSAGE_REQ_CKPT_INIT);
+	if (error != SA_AIS_OK) {
 		goto error_put_destroy;
 	}
 
@@ -214,7 +212,7 @@
 
 	saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
 
-	return (SA_OK);
+	return (SA_AIS_OK);
 
 error_put_destroy:
 	saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
@@ -224,34 +222,34 @@
 	return (error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptSelectionObjectGet (
-	const SaCkptHandleT *ckptHandle,
+	const SaCkptHandleT ckptHandle,
 	SaSelectionObjectT *selectionObject)
 {
 	struct ckptInstance *ckptInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 
-	error = saHandleInstanceGet (&ckptHandleDatabase, *ckptHandle, (void *)&ckptInstance);
-	if (error != SA_OK) {
+	error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle, (void *)&ckptInstance);
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
 	*selectionObject = ckptInstance->fd;
 
-	saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
+	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
 
-	return (SA_OK);
+	return (SA_AIS_OK);
 }
 
 #ifdef COMPILE_OUT
-SaErrorT
+SaAisErrorT
 saCkptDispatch (
-	const SaCkptHandleT *ckptHandle,
+	const SaCkptHandleT ckptHandle,
 	SaDispatchFlagsT dispatchFlags)
 {
 	fd_set read_fds;
-	SaErrorT error;
+	SaAisErrorT error;
 	int dispatch_avail;
 	struct timeval *timeout = 0;
 	struct ckptInstance *ckptInstance;
@@ -261,8 +259,8 @@
 	int ignore_dispatch = 0;
 	int cont = 1; /* always continue do loop except when set to 0 */
 
-	error = saHandleInstanceGet (&ckptHandleDatabase, *ckptHandle, (void *)&ckptInstance);
-	if (error != SA_OK) {
+	error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle, (void *)&ckptInstance);
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
@@ -281,7 +279,7 @@
 		FD_SET (ckptInstance->fd, &read_fds);
 
 		error = saSelectRetry (ckptInstance->fd + 1, &read_fds, 0, 0, timeout);
-		if (error != SA_OK) {
+		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 
@@ -308,14 +306,14 @@
 			 * Queue empty, read response from socket
 			 */
 			error = saRecvRetry (ckptInstance->fd, &ckptInstance->message.header, sizeof (struct req_header), MSG_WAITALL | MSG_NOSIGNAL);
-			if (error != SA_OK) {
+			if (error != SA_AIS_OK) {
 				goto error_exit;
 			}
 			if (ckptInstance->message.header.size > sizeof (struct req_header)) {
 				error = saRecvRetry (ckptInstance->fd, &ckptInstance->message.data,
 					ckptInstance->message.header.size - sizeof (struct req_header),
 					MSG_WAITALL | MSG_NOSIGNAL);
-				if (error != SA_OK) {
+				if (error != SA_AIS_OK) {
 					goto error_exit;
 				}
 			}
@@ -419,16 +417,16 @@
 }
 #endif
 
-SaErrorT
+SaAisErrorT
 saCkptFinalize (
-	const SaCkptHandleT *ckptHandle)
+	const SaCkptHandleT ckptHandle)
 {
 	struct ckptInstance *ckptInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 
-	error = saHandleInstanceGet (&ckptHandleDatabase, *ckptHandle,
+	error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle,
 		(void *)&ckptInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
@@ -439,8 +437,8 @@
 	 */
 	if (ckptInstance->finalize) {
 		pthread_mutex_unlock (&ckptInstance->mutex);
-		saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
-		return (SA_ERR_BAD_HANDLE);
+		saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
+		return (SA_AIS_ERR_BAD_HANDLE);
 	}
 
 	ckptInstance->finalize = 1;
@@ -449,47 +447,53 @@
 
 	pthread_mutex_unlock (&ckptInstance->mutex);
 
-	saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
+	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
 
-    saHandleDestroy (&ckptHandleDatabase, *ckptHandle);
+    saHandleDestroy (&ckptHandleDatabase, ckptHandle);
 
-	return (SA_OK);
+	return (SA_AIS_OK);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointOpen (
+	SaCkptHandleT ckptHandle,
 	const SaNameT *checkpointName,
 	const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
 	SaCkptCheckpointOpenFlagsT checkpointOpenFlags,
 	SaTimeT timeout,
 	SaCkptCheckpointHandleT *checkpointHandle)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
+	struct ckptInstance *ckptInstance;
 	struct req_lib_ckpt_checkpointopen req_lib_ckpt_checkpointopen;
 	struct res_lib_ckpt_checkpointopen res_lib_ckpt_checkpointopen;
 
 	error = saHandleCreate (&checkpointHandleDatabase,
 		sizeof (struct ckptCheckpointInstance), checkpointHandle);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_destroy;
 	}
 
-	ckptCheckpointInstance->fd = -1;
+	error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle,
+		(void *)&ckptInstance);
+	if (error != SA_AIS_OK) {
+		goto error_put_destroy;
+	}
+
+	ckptCheckpointInstance->fd = ckptInstance->fd;
 
 	ckptCheckpointInstance->maxSectionIdSize =
 		checkpointCreationAttributes->maxSectionIdSize;
 
-	error = saServiceConnect (&ckptCheckpointInstance->fd, MESSAGE_REQ_CKPT_CHECKPOINT_INIT);
-	if (error != SA_OK) {
-		goto error_put_destroy;
-	}
+	ckptCheckpointInstance->ckptHandle = ckptHandle;
+	ckptCheckpointInstance->checkpointOpenFlags = checkpointOpenFlags;
 
 	req_lib_ckpt_checkpointopen.header.size = sizeof (struct req_lib_ckpt_checkpointopen);
 	req_lib_ckpt_checkpointopen.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPEN;
@@ -502,19 +506,19 @@
 
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointopen,
 		sizeof (struct req_lib_ckpt_checkpointopen), MSG_NOSIGNAL);
-	if (error != SA_OK) {
-		goto error_put_destroy;
+	if (error != SA_AIS_OK) {
+		goto error_put_ckpt_destroy;
 	}
 
 	error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_checkpointopen,
 		sizeof (struct res_lib_ckpt_checkpointopen), MSG_WAITALL | MSG_NOSIGNAL);
-	if (error != SA_OK) {
-		goto error_put_destroy;
+	if (error != SA_AIS_OK) {
+		goto error_put_ckpt_destroy;
 	}
 	
-	if (res_lib_ckpt_checkpointopen.header.error != SA_OK) {
+	if (res_lib_ckpt_checkpointopen.header.error != SA_AIS_OK) {
 		error = res_lib_ckpt_checkpointopen.header.error;
-		goto error_put_destroy;
+		goto error_put_ckpt_destroy;
 	}
 
 	pthread_mutex_init (&ckptCheckpointInstance->mutex, NULL);
@@ -523,28 +527,32 @@
 
 	return (error);
 
+error_put_ckpt_destroy:
+	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
+
 error_put_destroy:
 	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+
 error_destroy:
 	saHandleDestroy (&checkpointHandleDatabase, *checkpointHandle);
 error_no_destroy:
 	return (error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointOpenAsync (
-	const SaCkptHandleT *ckptHandle,
+	const SaCkptHandleT ckptHandle,
 	SaInvocationT invocation,	
 	const SaNameT *checkpointName,
 	const SaCkptCheckpointCreationAttributesT *checkpointCreationAttributes,
 	SaCkptCheckpointOpenFlagsT checkpointOpenFlags)
 {
 	struct ckptInstance *ckptInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 	struct req_lib_ckpt_checkpointopenasync req_lib_ckpt_checkpointopenasync;
 
-	error = saHandleInstanceGet (&ckptHandleDatabase, *ckptHandle, (void *)&ckptInstance);
-	if (error != SA_OK) {
+	error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle, (void *)&ckptInstance);
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
@@ -565,43 +573,64 @@
 
 	pthread_mutex_unlock (&ckptInstance->mutex);
 
-	saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
+	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
 
 	return (error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointClose (
-	const SaCkptCheckpointHandleT *checkpointHandle)
+	SaCkptCheckpointHandleT checkpointHandle)
 {
-	SaErrorT error;
+	struct req_lib_ckpt_checkpointclose req_lib_ckpt_checkpointclose;
+	struct res_lib_ckpt_checkpointclose res_lib_ckpt_checkpointclose;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-    saHandleDestroy (&checkpointHandleDatabase, *checkpointHandle);
+	req_lib_ckpt_checkpointclose.header.size = sizeof (struct req_lib_ckpt_checkpointclose);
+	req_lib_ckpt_checkpointclose.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTCLOSE;
+	memcpy (&req_lib_ckpt_checkpointclose.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
+
+	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointclose,
+		sizeof (struct req_lib_ckpt_checkpointclose), MSG_NOSIGNAL);
+	if (error != SA_AIS_OK) {
+		goto exit_put;
+	}
 
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_checkpointclose,
+		sizeof (struct res_lib_ckpt_checkpointclose), MSG_WAITALL | MSG_NOSIGNAL);
+
+
+	saHandleInstancePut (&ckptHandleDatabase, ckptCheckpointInstance->ckptHandle);
+
+    saHandleDestroy (&checkpointHandleDatabase, checkpointHandle);
+
+exit_put:
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
 error_exit:
 	return (error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointUnlink (
+	SaCkptHandleT ckptHandle,
 	const SaNameT *checkpointName)
 {
-	SaErrorT error;
+	SaAisErrorT error;
+	struct ckptInstance *ckptInstance;
 	struct req_lib_ckpt_checkpointunlink req_lib_ckpt_checkpointunlink;
 	struct res_lib_ckpt_checkpointunlink res_lib_ckpt_checkpointunlink;
-	int fd;
 
-	error = saServiceConnect (&fd, MESSAGE_REQ_CKPT_CHECKPOINT_INIT);
-	if (error != SA_OK) {
+	error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle, (void *)&ckptInstance);
+	if (error != SA_AIS_OK) {
 		goto exit_noclose;
 	}
 
@@ -610,34 +639,37 @@
 	memcpy (&req_lib_ckpt_checkpointunlink.checkpointName, checkpointName, sizeof (SaNameT));
 
 
-	error = saSendRetry (fd, &req_lib_ckpt_checkpointunlink, sizeof (struct req_lib_ckpt_checkpointunlink), MSG_NOSIGNAL);
-	if (error != SA_OK) {
-		goto exit_close;
+	error = saSendRetry (ckptInstance->fd, &req_lib_ckpt_checkpointunlink,
+		sizeof (struct req_lib_ckpt_checkpointunlink), MSG_NOSIGNAL);
+	if (error != SA_AIS_OK) {
+		goto exit_put;
 	}
 
-	error = saRecvRetry (fd, &res_lib_ckpt_checkpointunlink,
+	error = saRecvRetry (ckptInstance->fd, &res_lib_ckpt_checkpointunlink,
 		sizeof (struct res_lib_ckpt_checkpointunlink), MSG_WAITALL | MSG_NOSIGNAL);
 
-exit_close:
-	close (fd);
-	return (error == SA_OK ? res_lib_ckpt_checkpointunlink.header.error : error);
+exit_put:
+	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
+	
+	return (error == SA_AIS_OK ? res_lib_ckpt_checkpointunlink.header.error : error);
+
 exit_noclose:
 	return (error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointRetentionDurationSet (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	SaTimeT retentionDuration)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_checkpointretentiondurationset req_lib_ckpt_checkpointretentiondurationset;
 	struct res_lib_ckpt_checkpointretentiondurationset res_lib_ckpt_checkpointretentiondurationset;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit_noput;
 	}
 
@@ -645,11 +677,13 @@
 	req_lib_ckpt_checkpointretentiondurationset.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET;
 
 	req_lib_ckpt_checkpointretentiondurationset.retentionDuration = retentionDuration;
+	memcpy (&req_lib_ckpt_checkpointretentiondurationset.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
 
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointretentiondurationset, sizeof (struct req_lib_ckpt_checkpointretentiondurationset), MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -661,74 +695,77 @@
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
 error_exit:
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 error_exit_noput:
-	return (error == SA_OK ? res_lib_ckpt_checkpointretentiondurationset.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_checkpointretentiondurationset.header.error : error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptActiveCheckpointSet (
-	const SaCkptCheckpointHandleT *checkpointHandle)
+	SaCkptCheckpointHandleT checkpointHandle)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
-	struct req_lib_ckpt_activecheckpointset req_lib_ckpt_activecheckpointset;
-	struct res_lib_ckpt_activecheckpointset res_lib_ckpt_activecheckpointset;
+	struct req_lib_ckpt_activereplicaset req_lib_ckpt_activereplicaset;
+	struct res_lib_ckpt_activereplicaset res_lib_ckpt_activereplicaset;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		 (void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	req_lib_ckpt_activecheckpointset.header.size = sizeof (struct req_lib_ckpt_activecheckpointset);
-	req_lib_ckpt_activecheckpointset.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_ACTIVECHECKPOINTSET;
+	req_lib_ckpt_activereplicaset.header.size = sizeof (struct req_lib_ckpt_activereplicaset);
+	req_lib_ckpt_activereplicaset.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_ACTIVEREPLICASET;
 
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_activecheckpointset,
-		sizeof (struct req_lib_ckpt_activecheckpointset), MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_activereplicaset,
+		sizeof (struct req_lib_ckpt_activereplicaset), MSG_NOSIGNAL);
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
 	error = saRecvRetry (ckptCheckpointInstance->fd,
-		&res_lib_ckpt_activecheckpointset,
-		sizeof (struct res_lib_ckpt_activecheckpointset),
+		&res_lib_ckpt_activereplicaset,
+		sizeof (struct res_lib_ckpt_activereplicaset),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
 error_exit:
-	return (error == SA_OK ? res_lib_ckpt_activecheckpointset.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_activereplicaset.header.error : error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointStatusGet (
-	const SaCkptCheckpointHandleT *checkpointHandle,
-	SaCkptCheckpointStatusT *checkpointStatus)
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaCkptCheckpointDescriptorT *checkpointStatus)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_checkpointstatusget req_lib_ckpt_checkpointstatusget;
 	struct res_lib_ckpt_checkpointstatusget res_lib_ckpt_checkpointstatusget;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
 	req_lib_ckpt_checkpointstatusget.header.size = sizeof (struct req_lib_ckpt_checkpointstatusget);
 	req_lib_ckpt_checkpointstatusget.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET;
 
+	memcpy (&req_lib_ckpt_checkpointstatusget.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
+
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
 
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointstatusget,
 		sizeof (struct req_lib_ckpt_checkpointstatusget), MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -736,39 +773,43 @@
 		&res_lib_ckpt_checkpointstatusget,
 		sizeof (struct res_lib_ckpt_checkpointstatusget),
 		MSG_WAITALL | MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
 	memcpy (checkpointStatus,
-		&res_lib_ckpt_checkpointstatusget.checkpointStatus,
-		sizeof (SaCkptCheckpointStatusT));
+		&res_lib_ckpt_checkpointstatusget.checkpointDescriptor,
+		sizeof (SaCkptCheckpointDescriptorT));
 
 error_exit:
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 	return (error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptSectionCreate (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	SaCkptSectionCreationAttributesT *sectionCreationAttributes,
 	const void *initialData,
 	SaUint32T initialDataSize)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_sectioncreate req_lib_ckpt_sectioncreate;
 	struct res_lib_ckpt_sectioncreate res_lib_ckpt_sectioncreate;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
+	if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
+		error = SA_AIS_ERR_ACCESS;
+		goto error_exit;
+	}
 
 	req_lib_ckpt_sectioncreate.header.size =
 		sizeof (struct req_lib_ckpt_sectioncreate) +
@@ -780,12 +821,14 @@
 	req_lib_ckpt_sectioncreate.expirationTime = sectionCreationAttributes->expirationTime;
 	req_lib_ckpt_sectioncreate.initialDataSize = initialDataSize;
 
+	memcpy (&req_lib_ckpt_sectioncreate.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
 
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectioncreate,
 		sizeof (struct req_lib_ckpt_sectioncreate), MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -794,13 +837,13 @@
 	 */
 	error = saSendRetry (ckptCheckpointInstance->fd, sectionCreationAttributes->sectionId->id,
 		sectionCreationAttributes->sectionId->idLen, MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
 	error = saSendRetry (ckptCheckpointInstance->fd, initialData,
 		initialDataSize, MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -812,25 +855,25 @@
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
 error_exit:
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
-	return (error == SA_OK ? res_lib_ckpt_sectioncreate.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectioncreate.header.error : error);
 }
 
 
-SaErrorT
+SaAisErrorT
 saCkptSectionDelete (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	const SaCkptSectionIdT *sectionId)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_sectiondelete req_lib_ckpt_sectiondelete;
 	struct res_lib_ckpt_sectiondelete res_lib_ckpt_sectiondelete;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
@@ -840,9 +883,12 @@
 	req_lib_ckpt_sectiondelete.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONDELETE;
 	req_lib_ckpt_sectiondelete.idLen = sectionId->idLen;
 
+	memcpy (&req_lib_ckpt_sectiondelete.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
+
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectiondelete,
 		sizeof (struct req_lib_ckpt_sectiondelete), MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -851,7 +897,7 @@
 	 */
 	error = saSendRetry (ckptCheckpointInstance->fd, sectionId->id,
 		sectionId->idLen, MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 	error = saRecvRetry (ckptCheckpointInstance->fd,
@@ -862,24 +908,24 @@
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
 error_exit:
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
-	return (error == SA_OK ? res_lib_ckpt_sectiondelete.header.error : error);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectiondelete.header.error : error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptSectionExpirationTimeSet (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	const SaCkptSectionIdT *sectionId,
 	SaTimeT expirationTime)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_sectionexpirationtimeset req_lib_ckpt_sectionexpirationtimeset;
 	struct res_lib_ckpt_sectionexpirationtimeset res_lib_ckpt_sectionexpirationtimeset;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit_noput;
 	}
 
@@ -888,11 +934,14 @@
 	req_lib_ckpt_sectionexpirationtimeset.idLen = sectionId->idLen;
 	req_lib_ckpt_sectionexpirationtimeset.expirationTime = expirationTime;
 
+	memcpy (&req_lib_ckpt_sectionexpirationtimeset.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
+
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
 
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectionexpirationtimeset,
 		sizeof (struct req_lib_ckpt_sectionexpirationtimeset), MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -902,7 +951,7 @@
 	if (sectionId->idLen) {
 		error = saSendRetry (ckptCheckpointInstance->fd, sectionId->id,
 			sectionId->idLen, MSG_NOSIGNAL);
-		if (error != SA_OK) {
+		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 	}
@@ -915,58 +964,59 @@
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
 error_exit:
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 error_exit_noput:
-	return (error == SA_OK ? res_lib_ckpt_sectionexpirationtimeset.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectionexpirationtimeset.header.error : error);
 }
 
-SaErrorT
-saCkptSectionIteratorInitialize (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+SaAisErrorT
+saCkptSectionIterationInitialize (
+	SaCkptCheckpointHandleT checkpointHandle,
 	SaCkptSectionsChosenT sectionsChosen,
 	SaTimeT expirationTime,
-	SaCkptSectionIteratorT *sectionIterator)
+	SaCkptSectionIterationHandleT *sectionIterationHandle)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
-	struct ckptSectionIteratorInstance *ckptSectionIteratorInstance;
+	struct ckptSectionIterationInstance *ckptSectionIterationInstance;
 	struct req_lib_ckpt_sectioniteratorinitialize req_lib_ckpt_sectioniteratorinitialize;
 	struct res_lib_ckpt_sectioniteratorinitialize res_lib_ckpt_sectioniteratorinitialize;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_no_destroy;
 	}
 
-	error = saHandleCreate (&ckptSectionIteratorHandleDatabase,
-		sizeof (struct ckptSectionIteratorInstance), sectionIterator);
-	if (error != SA_OK) {
+	error = saHandleCreate (&ckptSectionIterationHandleDatabase,
+		sizeof (struct ckptSectionIterationInstance), sectionIterationHandle);
+	if (error != SA_AIS_OK) {
 		goto error_put_checkpoint_db;
 	}
 
-	error = saHandleInstanceGet (&ckptSectionIteratorHandleDatabase,
-		*sectionIterator,
-		(void *)&ckptSectionIteratorInstance);
-	if (error != SA_OK) {
+	error = saHandleInstanceGet (&ckptSectionIterationHandleDatabase,
+		*sectionIterationHandle, (void *)&ckptSectionIterationInstance);
+	if (error != SA_AIS_OK) {
 		goto error_destroy;
 	}
 
-	ckptSectionIteratorInstance->fd = -1;
+	ckptSectionIterationInstance->fd = ckptCheckpointInstance->fd;
 
-	pthread_mutex_init (&ckptSectionIteratorInstance->mutex, NULL);
+	ckptSectionIterationInstance->checkpointHandle = checkpointHandle;
+
+	pthread_mutex_init (&ckptSectionIterationInstance->mutex, NULL);
 
 	/*
 	 * Setup section id list for iterator next
 	 */
-	list_init (&ckptSectionIteratorInstance->sectionIdListHead);
+	list_init (&ckptSectionIterationInstance->sectionIdListHead);
 
-	ckptSectionIteratorInstance->maxSectionIdSize =
+	ckptSectionIterationInstance->maxSectionIdSize =
 		ckptCheckpointInstance->maxSectionIdSize;
 
-	error = saServiceConnect (&ckptSectionIteratorInstance->fd,	
-		MESSAGE_REQ_CKPT_SECTIONITERATOR_INIT);
-	if (error != SA_OK) {
+	error = saServiceConnect (&ckptSectionIterationInstance->fd,	
+		MESSAGE_REQ_CKPT_INIT);
+	if (error != SA_AIS_OK) {
 		goto error_put_destroy;
 	}
 
@@ -977,36 +1027,34 @@
 	memcpy (&req_lib_ckpt_sectioniteratorinitialize.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	pthread_mutex_lock (&ckptSectionIteratorInstance->mutex);
+	pthread_mutex_lock (&ckptSectionIterationInstance->mutex);
 
-	error = saSendRetry (ckptSectionIteratorInstance->fd,
+	error = saSendRetry (ckptSectionIterationInstance->fd,
 		&req_lib_ckpt_sectioniteratorinitialize,
 		sizeof (struct req_lib_ckpt_sectioniteratorinitialize),
 		MSG_NOSIGNAL);
 
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_put_destroy;
 	}
 
-	error = saRecvRetry (ckptSectionIteratorInstance->fd,
+	error = saRecvRetry (ckptSectionIterationInstance->fd,
 		&res_lib_ckpt_sectioniteratorinitialize,
 		sizeof (struct res_lib_ckpt_sectioniteratorinitialize),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptSectionIteratorInstance->mutex);
-
-	saHandleInstancePut (&ckptSectionIteratorHandleDatabase, *sectionIterator);
+	pthread_mutex_unlock (&ckptSectionIterationInstance->mutex);
 
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
 
-	return (error == SA_OK ? res_lib_ckpt_sectioniteratorinitialize.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectioniteratorinitialize.header.error : error);
 
 error_put_destroy:
-	saHandleInstancePut (&ckptSectionIteratorHandleDatabase, *sectionIterator);
+	saHandleInstancePut (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
 error_destroy:
-	saHandleDestroy (&ckptSectionIteratorHandleDatabase, *sectionIterator);
+	saHandleDestroy (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
 error_put_checkpoint_db:
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 error_no_destroy:
 	return (error);
 }
@@ -1016,48 +1064,48 @@
 	char data[0];
 };
 
-SaErrorT
-saCkptSectionIteratorNext (
-	SaCkptSectionIteratorT *sectionIterator,
+SaAisErrorT
+saCkptSectionIterationNext (
+	SaCkptSectionIterationHandleT sectionIterationHandle,
 	SaCkptSectionDescriptorT *sectionDescriptor)
 {
-	SaErrorT error;
-	struct ckptSectionIteratorInstance *ckptSectionIteratorInstance;
+	SaAisErrorT error;
+	struct ckptSectionIterationInstance *ckptSectionIterationInstance;
 	struct req_lib_ckpt_sectioniteratornext req_lib_ckpt_sectioniteratornext;
 	struct res_lib_ckpt_sectioniteratornext res_lib_ckpt_sectioniteratornext;
 	struct iteratorSectionIdListEntry *iteratorSectionIdListEntry;
 
-	error = saHandleInstanceGet (&ckptSectionIteratorHandleDatabase,
-		*sectionIterator, (void *)&ckptSectionIteratorInstance);
-	if (error != SA_OK) {
+	error = saHandleInstanceGet (&ckptSectionIterationHandleDatabase,
+		sectionIterationHandle, (void *)&ckptSectionIterationInstance);
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 	/*
 	 * Allocate section id storage area
 	 */
 	iteratorSectionIdListEntry = malloc (sizeof (struct list_head) +
-		ckptSectionIteratorInstance->maxSectionIdSize);
+		ckptSectionIterationInstance->maxSectionIdSize);
 	if (iteratorSectionIdListEntry == 0) {
-		error = SA_ERR_NO_MEMORY;
+		error = SA_AIS_ERR_NO_MEMORY;
 		goto error_put_nounlock;
 	}
 
 	req_lib_ckpt_sectioniteratornext.header.size = sizeof (struct req_lib_ckpt_sectioniteratornext); 
 	req_lib_ckpt_sectioniteratornext.header.id = MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT;
 
-	pthread_mutex_lock (&ckptSectionIteratorInstance->mutex);
+	pthread_mutex_lock (&ckptSectionIterationInstance->mutex);
 
-	error = saSendRetry (ckptSectionIteratorInstance->fd,
+	error = saSendRetry (ckptSectionIterationInstance->fd,
 		&req_lib_ckpt_sectioniteratornext,
 		sizeof (struct req_lib_ckpt_sectioniteratornext), MSG_NOSIGNAL);
 
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_put;
 	}
 
-	error = saRecvRetry (ckptSectionIteratorInstance->fd, &res_lib_ckpt_sectioniteratornext,
+	error = saRecvRetry (ckptSectionIterationInstance->fd, &res_lib_ckpt_sectioniteratornext,
 		sizeof (struct res_lib_ckpt_sectioniteratornext), MSG_WAITALL | MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_put;
 	}
 
@@ -1068,7 +1116,7 @@
 	sectionDescriptor->sectionId.id = &iteratorSectionIdListEntry->data[0];
 	
 	if ((res_lib_ckpt_sectioniteratornext.header.size - sizeof (struct res_lib_ckpt_sectioniteratornext)) > 0) {
-		error = saRecvRetry (ckptSectionIteratorInstance->fd,
+		error = saRecvRetry (ckptSectionIterationInstance->fd,
 			sectionDescriptor->sectionId.id,
 			res_lib_ckpt_sectioniteratornext.header.size -
 				sizeof (struct res_lib_ckpt_sectioniteratornext),
@@ -1078,32 +1126,32 @@
 	/*
 	 * Add to persistent memory list for this sectioniterator
 	 */
-	if (error == SA_OK && res_lib_ckpt_sectioniteratornext.header.error == SA_OK) {
+	if (error == SA_AIS_OK && res_lib_ckpt_sectioniteratornext.header.error == SA_AIS_OK) {
 		list_init (&iteratorSectionIdListEntry->list);
-		list_add (&iteratorSectionIdListEntry->list, &ckptSectionIteratorInstance->sectionIdListHead);
+		list_add (&iteratorSectionIdListEntry->list, &ckptSectionIterationInstance->sectionIdListHead);
 	}
 
 error_put:
-	pthread_mutex_unlock (&ckptSectionIteratorInstance->mutex);
+	pthread_mutex_unlock (&ckptSectionIterationInstance->mutex);
 error_put_nounlock:
-	saHandleInstancePut (&ckptSectionIteratorHandleDatabase, *sectionIterator);
+	saHandleInstancePut (&ckptSectionIterationHandleDatabase, sectionIterationHandle);
 error_exit:
-	return (error == SA_OK ? res_lib_ckpt_sectioniteratornext.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectioniteratornext.header.error : error);
 }
 	
-SaErrorT
-saCkptSectionIteratorFinalize (
-	SaCkptSectionIteratorT *sectionIterator)
+SaAisErrorT
+saCkptSectionIterationFinalize (
+	SaCkptSectionIterationHandleT sectionIterationHandle)
 {
-	SaErrorT error;
-	struct ckptSectionIteratorInstance *ckptSectionIteratorInstance;
+	SaAisErrorT error;
+	struct ckptSectionIterationInstance *ckptSectionIterationInstance;
 	struct iteratorSectionIdListEntry *iteratorSectionIdListEntry;
-	struct list_head *sectionIdIteratorList;
-	struct list_head *sectionIdIteratorListNext;
+	struct list_head *sectionIdIterationList;
+	struct list_head *sectionIdIterationListNext;
 
-	error = saHandleInstanceGet (&ckptSectionIteratorHandleDatabase,
-		*sectionIterator, (void *)&ckptSectionIteratorInstance);
-	if (error != SA_OK) {
+	error = saHandleInstanceGet (&ckptSectionIterationHandleDatabase,
+		sectionIterationHandle, (void *)&ckptSectionIterationInstance);
+	if (error != SA_AIS_OK) {
 		goto error_noput;
 	}
 
@@ -1111,34 +1159,37 @@
 	 * iterate list of section ids for this iterator to free the allocated memory
 	 * be careful to cache next pointer because free removes memory from use
 	 */
-	for (sectionIdIteratorList = ckptSectionIteratorInstance->sectionIdListHead.next,
-		sectionIdIteratorListNext = sectionIdIteratorList->next;
-		sectionIdIteratorList != &ckptSectionIteratorInstance->sectionIdListHead;
-		sectionIdIteratorList = sectionIdIteratorListNext,
-		sectionIdIteratorListNext = sectionIdIteratorList->next) {
+	for (sectionIdIterationList = ckptSectionIterationInstance->sectionIdListHead.next,
+		sectionIdIterationListNext = sectionIdIterationList->next;
+		sectionIdIterationList != &ckptSectionIterationInstance->sectionIdListHead;
+		sectionIdIterationList = sectionIdIterationListNext,
+		sectionIdIterationListNext = sectionIdIterationList->next) {
 
-		iteratorSectionIdListEntry = list_entry (sectionIdIteratorList,
+		iteratorSectionIdListEntry = list_entry (sectionIdIterationList,
 			struct iteratorSectionIdListEntry, list);
 
 		free (iteratorSectionIdListEntry);
 	}
 
-	saHandleInstancePut (&ckptSectionIteratorHandleDatabase, *sectionIterator);
+	saHandleInstancePut (&checkpointHandleDatabase,
+		ckptSectionIterationInstance->checkpointHandle);
+
+	saHandleInstancePut (&ckptSectionIterationHandleDatabase, sectionIterationHandle);
 
-    saHandleDestroy (&ckptSectionIteratorHandleDatabase, *sectionIterator);
+    saHandleDestroy (&ckptSectionIterationHandleDatabase, sectionIterationHandle);
 
 error_noput:
 	return (error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointWrite (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	const SaCkptIOVectorElementT *ioVector,
 	SaUint32T numberOfElements,
 	SaUint32T *erroneousVectorIndex)
 {
-	SaErrorT error = SA_OK;
+	SaAisErrorT error = SA_AIS_OK;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_sectionwrite req_lib_ckpt_sectionwrite;
 	struct res_lib_ckpt_sectionwrite res_lib_ckpt_sectionwrite;
@@ -1146,12 +1197,16 @@
 	struct iovec iov[3];
 	int iov_len = 0;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
+	if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
+		error = SA_AIS_ERR_ACCESS;
+		goto error_put;
+	}
 	req_lib_ckpt_sectionwrite.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONWRITE;
 
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
@@ -1164,6 +1219,9 @@
 		req_lib_ckpt_sectionwrite.dataSize = ioVector[i].dataSize;
 		req_lib_ckpt_sectionwrite.idLen = ioVector[i].sectionId.idLen;
 
+		memcpy (&req_lib_ckpt_sectionwrite.checkpointName,
+			&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
+
 		iov_len = 0;
 /* TODO check for zero length stuff */
 		iov[0].iov_base = (char *)&req_lib_ckpt_sectionwrite;
@@ -1176,7 +1234,7 @@
 		error = saSendMsgRetry (ckptCheckpointInstance->fd,
 			iov,
 			3);
-		if (error != SA_OK) {
+		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 
@@ -1185,18 +1243,18 @@
 		 */
 		error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_sectionwrite,
 			sizeof (struct res_lib_ckpt_sectionwrite), MSG_WAITALL | MSG_NOSIGNAL);
-		if (error != SA_OK) {
+		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 
-		if (res_lib_ckpt_sectionwrite.header.error == SA_ERR_TRY_AGAIN) {
-			error = SA_ERR_TRY_AGAIN;
+		if (res_lib_ckpt_sectionwrite.header.error == SA_AIS_ERR_TRY_AGAIN) {
+			error = SA_AIS_ERR_TRY_AGAIN;
 			goto error_exit;
 		}
 		/*
 		 * If error, report back erroneous index
 		 */
-		if (res_lib_ckpt_sectionwrite.header.error != SA_OK) {
+		if (res_lib_ckpt_sectionwrite.header.error != SA_AIS_OK) {
 			if (erroneousVectorIndex) {
 				*erroneousVectorIndex = i;
 			}
@@ -1205,54 +1263,60 @@
 	}
 
 error_exit:
-
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+error_put:
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
-	return (error == SA_OK ? res_lib_ckpt_sectionwrite.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectionwrite.header.error : error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptSectionOverwrite (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	const SaCkptSectionIdT *sectionId,
-	SaUint8T *dataBuffer,
+	const void *dataBuffer,
 	SaSizeT dataSize)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_sectionoverwrite req_lib_ckpt_sectionoverwrite;
 	struct res_lib_ckpt_sectionoverwrite res_lib_ckpt_sectionoverwrite;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
+	if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_WRITE) == 0) {
+		return (SA_AIS_ERR_ACCESS);
+	}
+
 	req_lib_ckpt_sectionoverwrite.header.size = sizeof (struct req_lib_ckpt_sectionoverwrite) + sectionId->idLen + dataSize; 
 	req_lib_ckpt_sectionoverwrite.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONOVERWRITE;
 	req_lib_ckpt_sectionoverwrite.idLen = sectionId->idLen;
 	req_lib_ckpt_sectionoverwrite.dataSize = dataSize;
+	memcpy (&req_lib_ckpt_sectionoverwrite.checkpointName,
+		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 	
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
 
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectionoverwrite,
 		sizeof (struct req_lib_ckpt_sectionoverwrite), MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
 	if (sectionId->idLen) {
 		error = saSendRetry (ckptCheckpointInstance->fd, sectionId->id,
 			sectionId->idLen, MSG_NOSIGNAL);
-		if (error != SA_OK) {
+		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 	}
 	error = saSendRetry (ckptCheckpointInstance->fd, dataBuffer, dataSize, MSG_NOSIGNAL);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -1264,19 +1328,19 @@
 error_exit:
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
-	return (error == SA_OK ? res_lib_ckpt_sectionoverwrite.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectionoverwrite.header.error : error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointRead (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	SaCkptIOVectorElementT *ioVector,
 	SaUint32T numberOfElements,
 	SaUint32T *erroneousVectorIndex)
 {
-	SaErrorT error = SA_OK;
+	SaAisErrorT error = SA_AIS_OK;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_sectionread req_lib_ckpt_sectionread;
 	struct res_lib_ckpt_sectionread res_lib_ckpt_sectionread;
@@ -1284,12 +1348,16 @@
 	int i;
 	struct iovec iov[3];
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
+	if ((ckptCheckpointInstance->checkpointOpenFlags & SA_CKPT_CHECKPOINT_READ) == 0) {
+		return (SA_AIS_ERR_ACCESS);
+	}
+
 	req_lib_ckpt_sectionread.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONREAD;
 
 	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
@@ -1302,6 +1370,9 @@
 		req_lib_ckpt_sectionread.dataOffset = ioVector[i].dataOffset;
 		req_lib_ckpt_sectionread.dataSize = ioVector[i].dataSize;
 
+		memcpy (&req_lib_ckpt_sectionread.checkpointName,
+			&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
+
 		iov[0].iov_base = (char *)&req_lib_ckpt_sectionread;
 		iov[0].iov_len = sizeof (struct req_lib_ckpt_sectionread);
 		iov[1].iov_base = ioVector[i].sectionId.id;
@@ -1316,7 +1387,7 @@
 		 */
 		error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_sectionread,
 			sizeof (struct res_lib_ckpt_sectionread), MSG_WAITALL | MSG_NOSIGNAL);
-		if (error != SA_OK) {
+		if (error != SA_AIS_OK) {
 				goto error_exit;
 		}
 		
@@ -1328,11 +1399,11 @@
 		if (dataLength > 0) {
 			error = saRecvRetry (ckptCheckpointInstance->fd, ioVector[i].dataBuffer,
 				dataLength, MSG_WAITALL | MSG_NOSIGNAL);
-			if (error != SA_OK) {
+			if (error != SA_AIS_OK) {
 					goto error_exit;
 			}
 		}
-		if (res_lib_ckpt_sectionread.header.error != SA_OK) {
+		if (res_lib_ckpt_sectionread.header.error != SA_AIS_OK) {
 			if (erroneousVectorIndex) {
 				*erroneousVectorIndex = i;
 			}
@@ -1348,24 +1419,24 @@
 error_exit:
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
-	return (error == SA_OK ? res_lib_ckpt_sectionread.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_sectionread.header.error : error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointSynchronize (
-	const SaCkptCheckpointHandleT *checkpointHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
 	SaTimeT timeout)
 {
-	SaErrorT error;
+	SaAisErrorT error;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
 	struct req_lib_ckpt_checkpointsynchronize req_lib_ckpt_checkpointsynchronize;
 	struct res_lib_ckpt_checkpointsynchronize res_lib_ckpt_checkpointsynchronize;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		return (error);
 	}
 
@@ -1377,7 +1448,7 @@
 	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointsynchronize,
 		sizeof (struct req_lib_ckpt_checkpointsynchronize), MSG_NOSIGNAL);
 
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
@@ -1389,30 +1460,30 @@
 error_exit:
 	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
 
-	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
+	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
-	return (error == SA_OK ? res_lib_ckpt_checkpointsynchronize.header.error : error);
+	return (error == SA_AIS_OK ? res_lib_ckpt_checkpointsynchronize.header.error : error);
 }
 
-SaErrorT
+SaAisErrorT
 saCkptCheckpointSynchronizeAsync (
-	const SaCkptHandleT *ckptHandle,
-	SaInvocationT invocation,
-	const SaCkptCheckpointHandleT *checkpointHandle)
+	SaCkptHandleT ckptHandle,
+	SaCkptCheckpointHandleT checkpointHandle,
+	SaInvocationT invocation)
 {
 
-	return (SA_OK);
+	return (SA_AIS_OK);
 
 /* TODO not implemented in executive
 
 	struct ckptInstance *ckptInstance;
 	struct ckptCheckpointInstance *ckptCheckpointInstance;
-	SaErrorT error;
+	SaAisErrorT error;
 	struct req_lib_ckpt_checkpointsynchronizeasync req_lib_ckpt_checkpointsynchronizeasync;
 
-	error = saHandleInstanceGet (&checkpointHandleDatabase, *checkpointHandle,
+	error = saHandleInstanceGet (&checkpointHandleDatabase, checkpointHandle,
 		(void *)&ckptCheckpointInstance);
-	if (error != SA_OK) {
+	if (error != SA_AIS_OK) {
 
 		return (error);
 	}
Files defect-245.orig/test/.sa_error.c.swp and defect-245/test/.sa_error.c.swp differ
Files defect-245.orig/test/.testckpt.c.swo and defect-245/test/.testckpt.c.swo differ
Files defect-245.orig/test/.testckpt.c.swp and defect-245/test/.testckpt.c.swp differ
diff -uNr defect-245.orig/test/Makefile defect-245/test/Makefile
--- defect-245.orig/test/Makefile	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/test/Makefile	2005-02-07 14:23:18.000000000 -0700
@@ -102,8 +102,8 @@
 testclm: testclm.o $(LIBRARIES)
 	$(CC) $(LDFLAGS) -o testclm testclm.o $(LIBS)
 
-testckpt: testckpt.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testckpt testckpt.o $(LIBS)
+testckpt: testckpt.o sa_error.o $(LIBRARIES)
+	$(CC) $(LDFLAGS) -o testckpt testckpt.o sa_error.o $(LIBS)
 
 ckptbench: ckptbench.o $(LIBRARIES)
 	$(CC) $(LDFLAGS) -o ckptbench ckptbench.o $(LIBS)
@@ -149,13 +149,13 @@
 testamf6.o: ../include/ais_types.h ../include/ais_amf.h
 testamfth.o: ../include/ais_types.h ../include/ais_amf.h ../include/ais_msg.h
 testamfth.o: ../include/evs.h ../include/saClm.h ../include/ipc_gen.h
-testckpt.o: ../include/ais_types.h ../include/ais_ckpt.h
-ckptstress.o: ../include/ais_types.h ../include/ais_ckpt.h
+testckpt.o: ../include/ais_types.h ../include/saCkpt.h
+ckptstress.o: ../include/ais_types.h ../include/saCkpt.h
 testparse.o: ../include/ais_types.h ../exec/parse.h ../include/list.h
 testparse.o: ../exec/aispoll.h ../exec/totempg.h ../exec/totemsrp.h
 testparse.o: ../exec/print.h ../include/saClm.h ../include/ais_types.h
-ckptbench.o: ../include/ais_types.h ../include/ais_ckpt.h
-ckptbenchth.o: ../include/ais_types.h ../include/ais_ckpt.h
+ckptbench.o: ../include/ais_types.h ../include/saCkpt.h
+ckptbenchth.o: ../include/ais_types.h ../include/saCkpt.h
 testevt.o: ../include/ais_types.h ../include/saEvt.h
 testevs.o: ../include/evs.h
 evsbench.o: ../include/ais_types.h ../include/evs.h
diff -uNr defect-245.orig/test/ckptbench.c defect-245/test/ckptbench.c
--- defect-245.orig/test/ckptbench.c	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/test/ckptbench.c	2005-02-06 14:36:37.000000000 -0700
@@ -50,7 +50,7 @@
 #include <arpa/inet.h>
 
 #include "ais_types.h"
-#include "ais_ckpt.h"
+#include "saCkpt.h"
 
 int alarm_notice;
 
@@ -63,7 +63,12 @@
 	}
 }
 
-SaVersionT version = { 'A', 1, 1 };
+SaVersionT version = { 'B', 1, 1 };
+
+SaCkptCallbacksT callbacks = {
+    0,
+    0
+};
 
 SaNameT checkpointName = { 5, "abra\0" };
 
@@ -77,13 +82,13 @@
 };
 
 SaCkptSectionIdT sectionId1 = {
-	"section ID #1",
-	14
+	14,
+	"section ID #1"
 };
 
 SaCkptSectionIdT sectionId2 = {
-	"section ID #2",
-	14
+	14,
+	"section ID #2"
 };
 SaCkptSectionCreationAttributesT sectionCreationAttributes1 = {
 	&sectionId1,
@@ -102,8 +107,8 @@
 SaCkptIOVectorElementT ReadVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		readBuffer1,
 		sizeof (readBuffer1),
@@ -112,8 +117,8 @@
 	},
 	{
 		{
-			"section ID #2",
-			14
+			14,
+			"section ID #2"
 		},
 		readBuffer2,
 		sizeof (readBuffer2),
@@ -129,8 +134,8 @@
 SaCkptIOVectorElementT WriteVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		data, /*"written data #1, this should extend past end of old section data", */
 		DATASIZE, /*sizeof ("data #1, this should extend past end of old section data") + 1, */
@@ -140,8 +145,8 @@
 #ifdef COMPILE_OUT
 	{
 		{
-			"section ID #2",
-			14
+			14,
+			"section ID #2"
 		},
 		data, /*"written data #2, this should extend past end of old section data" */
 		DATASIZE, /*sizeof ("written data #2, this should extend past end of old section data") + 1, */
@@ -168,7 +173,7 @@
 		/*
 		 * Test checkpoint write
 		 */
-		error = saCkptCheckpointWrite (&checkpointHandle,
+		error = saCkptCheckpointWrite (checkpointHandle,
 			WriteVectorElements,
 			1,
 			&erroroneousVectorIndex);
@@ -197,6 +202,7 @@
 }
 
 int main (void) {
+	SaCkptHandleT ckptHandle;
 	SaCkptCheckpointHandleT checkpointHandle;
 	SaErrorT error;
 	int size;
@@ -204,16 +210,19 @@
 	
 	signal (SIGALRM, sigalrm_handler);
 
-	error = saCkptCheckpointOpen (&checkpointName,
+    error = saCkptInitialize (&ckptHandle, &callbacks, &version);
+
+	error = saCkptCheckpointOpen (ckptHandle,
+		&checkpointName,
 		&checkpointCreationAttributes,
 		SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
 		0,
 		&checkpointHandle);
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes1,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes2,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
@@ -224,5 +233,7 @@
 		ckpt_benchmark (checkpointHandle, size);
 		size += 1000;
 	}
+
+    error = saCkptFinalize (ckptHandle);
 	return (0);
 }
diff -uNr defect-245.orig/test/ckptbenchth.c defect-245/test/ckptbenchth.c
--- defect-245.orig/test/ckptbenchth.c	2005-02-06 12:51:56.000000000 -0700
+++ defect-245/test/ckptbenchth.c	2005-02-06 15:02:16.000000000 -0700
@@ -46,7 +46,7 @@
 #include <pthread.h>
 
 #include "ais_types.h"
-#include "ais_ckpt.h"
+#include "saCkpt.h"
 
 void printSaNameT (SaNameT *name)
 {
@@ -57,7 +57,12 @@
 	}
 }
 
-SaVersionT version = { 'A', 1, 1 };
+SaVersionT version = { 'B', 1, 1 };
+
+SaCkptCallbacksT callbacks = {
+    0,
+    0
+};
 
 SaCkptCheckpointCreationAttributesT checkpointCreationAttributes = {
 	SA_CKPT_WR_ALL_REPLICAS,
@@ -69,13 +74,13 @@
 };
 
 SaCkptSectionIdT sectionId1 = {
-	"section ID #1",
-	14
+	14,
+	"section ID #1"
 };
 
 SaCkptSectionIdT sectionId2 = {
-	"section ID #2",
-	14
+	14,
+	"section ID #2"
 };
 SaCkptSectionCreationAttributesT sectionCreationAttributes1 = {
 	&sectionId1,
@@ -94,8 +99,8 @@
 SaCkptIOVectorElementT ReadVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		readBuffer1,
 		sizeof (readBuffer1),
@@ -104,8 +109,8 @@
 	},
 	{
 		{
-			"section ID #2",
-			14
+			14,
+			"section ID #2"
 		},
 		readBuffer2,
 		sizeof (readBuffer2),
@@ -121,8 +126,8 @@
 SaCkptIOVectorElementT WriteVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		data, /*"written data #1, this should extend past end of old section data", */
 		DATASIZE, /*sizeof ("data #1, this should extend past end of old section data") + 1, */
@@ -132,8 +137,8 @@
 #ifdef COMPILE_OUT
 	{
 		{
-			"section ID #2",
-			14
+			14,
+			"section ID #2"
 		},
 		data, /*"written data #2, this should extend past end of old section data" */
 		DATASIZE, /*sizeof ("written data #2, this should extend past end of old section data") + 1, */
@@ -146,6 +151,7 @@
 int runs = 0;
 
 struct threaddata {
+	SaCkptHandleT ckptHandle;
 	SaCkptCheckpointHandleT checkpointHandle;
 	int write_count;
 	int write_size;
@@ -156,6 +162,7 @@
 {
 	
 	SaCkptCheckpointHandleT checkpointHandle;
+	SaCkptHandleT ckptHandle;
 	int write_count;
 	int write_size;
 	SaErrorT error;
@@ -164,6 +171,7 @@
 	int ckptinv;
 
 	checkpointHandle = td->checkpointHandle;
+	ckptHandle = td->ckptHandle;
 	write_count = td->write_count;
 	write_size = td->write_size;
 
@@ -174,7 +182,7 @@
 		 * Test checkpoint write
 		 */
 		do {
-		error = saCkptCheckpointWrite (&checkpointHandle,
+		error = saCkptCheckpointWrite (checkpointHandle,
 			WriteVectorElements,
 			1,
 			&erroroneousVectorIndex);
@@ -193,8 +201,8 @@
 }
 
 
-void threaded_bench (SaCkptCheckpointHandleT *checkpointHandles, int threads, int write_count,
-	int write_size)
+void threaded_bench (SaCkptHandleT *ckptHandles, SaCkptCheckpointHandleT *checkpointHandles,
+	int threads, int write_count, int write_size)
 {
 	struct timeval tv1, tv2, tv_elapsed;
 	struct threaddata td[100];
@@ -206,6 +214,7 @@
 	gettimeofday (&tv1, NULL);
 
 	for (i = 0; i < threads; i++) {
+		td[i].ckptHandle = ckptHandles[i];
 		td[i].checkpointHandle = checkpointHandles[i];
 		td[i].write_count = write_count;
 		td[i].write_size = write_size;
@@ -235,6 +244,7 @@
 
 #define CHECKPOINT_THREADS 50
 int main (void) {
+	SaCkptHandleT ckptHandles[500];
 	SaCkptCheckpointHandleT checkpointHandles[500];
 	SaErrorT error;
 	int size;
@@ -246,16 +256,19 @@
 	 */
 	for (i  = 0; i < CHECKPOINT_THREADS; i++) {
 		sprintf (checkpointName.value, "checkpoint%d \n", i);
-		error = saCkptCheckpointOpen (&checkpointName,
+		error = saCkptInitialize (&ckptHandles[i], &callbacks, &version);
+
+		error = saCkptCheckpointOpen (ckptHandles[i],
+			&checkpointName,
 			&checkpointCreationAttributes,
 			SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
 			0,
 			&checkpointHandles[i]);
-		error = saCkptSectionCreate (&checkpointHandles[i],
+		error = saCkptSectionCreate (checkpointHandles[i],
 			&sectionCreationAttributes1,
 			"Initial Data #0",
 			strlen ("Initial Data #0") + 1);
-		error = saCkptSectionCreate (&checkpointHandles[i],
+		error = saCkptSectionCreate (checkpointHandles[i],
 			&sectionCreationAttributes2,
 			"Initial Data #0",
 			strlen ("Initial Data #0") + 1);
@@ -266,7 +279,7 @@
 		size = 100000; /* initial size */
 		printf ("THREADS %d\n", i);
 		for (j = 0; j < 5; j++) { /* number of runs with i threads */
-			threaded_bench (checkpointHandles, i, count, size);
+			threaded_bench (ckptHandles, checkpointHandles, i, count, size);
 			/*
 			 * Adjust count to 95% of previous count
 			 * adjust size upwards by 1500
diff -uNr defect-245.orig/test/ckptstress.c defect-245/test/ckptstress.c
--- defect-245.orig/test/ckptstress.c	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/test/ckptstress.c	2005-02-06 14:33:33.000000000 -0700
@@ -43,7 +43,7 @@
 #include <sys/un.h>
 
 #include "ais_types.h"
-#include "ais_ckpt.h"
+#include "saCkpt.h"
 
 int ckptinv;
 void printSaNameT (SaNameT *name)
@@ -55,7 +55,12 @@
 	}
 }
 
-SaVersionT version = { 'A', 1, 1 };
+SaVersionT version = { 'B', 1, 1 };
+
+SaCkptCallbacksT callbacks = {
+    0,
+    0
+};
 
 SaNameT checkpointName = { 5, "abra\0" };
 
@@ -69,13 +74,13 @@
 };
 
 SaCkptSectionIdT sectionId1 = {
-	"section ID #1",
-	14
+	14,
+	"section ID #1"
 };
 
 SaCkptSectionIdT sectionId2 = {
-	"section ID #2",
-	14
+	14,
+	"section ID #2"
 };
 SaCkptSectionCreationAttributesT sectionCreationAttributes1 = {
 	&sectionId1,
@@ -94,8 +99,8 @@
 SaCkptIOVectorElementT ReadVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		readBuffer1,
 		sizeof (readBuffer1),
@@ -104,8 +109,8 @@
 	},
 	{
 		{
-			"section ID #2",
-			14
+			14,
+			"section ID #2"
 		},
 		readBuffer2,
 		sizeof (readBuffer2),
@@ -119,8 +124,8 @@
 SaCkptIOVectorElementT WriteVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		data, /*"written data #1, this should extend past end of old section data", */
 		DATASIZE, /*sizeof ("written data #1, this should extend past end of old section data") + 1, */
@@ -130,8 +135,8 @@
 #ifdef COMPILE_OUT
 	{
 		{
-			"section ID #2",
-			14
+			14,
+			"section ID #2"
 		},
 		data, /*"written data #2, this should extend past end of old section data" */
 		DATASIZE, /*sizeof ("written data #2, this should extend past end of old section data") + 1, */
@@ -144,18 +149,22 @@
 void *th_dispatch (void *arg)
 {
 	int th = (int)arg;
+	SaCkptHandleT ckptHandle;
 	SaCkptCheckpointHandleT handle;
 	SaErrorT error;
 	int i;
 	SaUint32T erroroneousVectorIndex = 0;
 
-	error = saCkptCheckpointOpen (&checkpointName,
+    error = saCkptInitialize (&ckptHandle, &callbacks, &version);
+
+	error = saCkptCheckpointOpen (ckptHandle,
+		&checkpointName,
 		&checkpointCreationAttributes,
 		SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
 		0,
 		&handle);
 	for (i = 0; i < 1000; i++) {
-		error = saCkptCheckpointWrite (&handle,
+		error = saCkptCheckpointWrite (handle,
 			WriteVectorElements,
 			1,/* placing two here with only one vector element causes an assertion failure !! */
 			&erroroneousVectorIndex);
@@ -164,29 +173,36 @@
 			printf ("Thread %d: Error from write.\n", th);
 		}
 	}
+
+    error = saCkptFinalize (ckptHandle);
+
 	return (0);
 }
 
 int main (void) {
+	SaCkptHandleT ckptHandle;
 	SaCkptCheckpointHandleT checkpointHandle;
 	SaErrorT error;
 	int i;
 	pthread_t dispatch_thread;
 
-	error = saCkptCheckpointOpen (&checkpointName,
+    error = saCkptInitialize (&ckptHandle, &callbacks, &version);
+
+	error = saCkptCheckpointOpen (ckptHandle,
+		&checkpointName,
 		&checkpointCreationAttributes,
 		SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
 		0,
 		&checkpointHandle);
 	printf ("first open result %d (should be 1)\n", error);
 
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes1,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
 printf ("create2 error is %d\n", error);
 
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes2,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
@@ -196,5 +212,8 @@
 		pthread_create (&dispatch_thread, NULL, th_dispatch, (void *)i);
 	}
 	pthread_join (dispatch_thread, NULL);
+
+    error = saCkptInitialize (&ckptHandle, &callbacks, &version);
+
 	return (0);
 }
diff -uNr defect-245.orig/test/sa_error.c defect-245/test/sa_error.c
--- defect-245.orig/test/sa_error.c	2005-02-06 12:51:55.000000000 -0700
+++ defect-245/test/sa_error.c	2005-02-07 14:54:06.000000000 -0700
@@ -1,4 +1,6 @@
+#include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include <errno.h>
 #include "ais_types.h"
 
@@ -44,3 +46,20 @@
 	strncpy(str, sa_error_list[error], len);
 	return 0;
 }
+
+char *get_sa_error_b (SaAisErrorT error) {
+	return (sa_error_list[error]);
+}
+
+char *get_test_output (SaAisErrorT result, SaAisErrorT expected) {
+        static *test_result[256];
+
+        if (result == expected) {
+                return ("PASSED");
+        } else {
+                sprintf (test_result,
+                        "FAILED expected %s got %s",
+			get_sa_error_b(expected), get_sa_error_b(result));
+                return (test_result);
+        }
+}
diff -uNr defect-245.orig/test/sa_error.h defect-245/test/sa_error.h
--- defect-245.orig/test/sa_error.h	1969-12-31 17:00:00.000000000 -0700
+++ defect-245/test/sa_error.h	2005-02-07 14:01:38.000000000 -0700
@@ -0,0 +1,5 @@
+extern int get_sa_error(SaErrorT error, char *str, int len);
+
+extern char *get_sa_error_b (SaAisErrorT error);
+
+extern char *get_test_output (SaAisErrorT result, SaAisErrorT expected);
diff -uNr defect-245.orig/test/testckpt.c defect-245/test/testckpt.c
--- defect-245.orig/test/testckpt.c	2005-02-06 12:51:56.000000000 -0700
+++ defect-245/test/testckpt.c	2005-02-07 15:20:23.000000000 -0700
@@ -44,7 +44,8 @@
 #include <sys/time.h>
 
 #include "ais_types.h"
-#include "ais_ckpt.h"
+#include "saCkpt.h"
+#include "sa_error.h"
 
 #define SECONDS_TO_EXPIRE 4
 
@@ -58,7 +59,7 @@
 	}
 }
 
-SaVersionT version = { 'A', 1, 1 };
+SaVersionT version = { 'B', 1, 1 };
 
 SaNameT checkpointName = { 5, "abra\0" };
 
@@ -72,14 +73,15 @@
 };
 
 SaCkptSectionIdT sectionId1 = {
-	"section ID #1",
-	14
+	14,
+	"section ID #1"
 };
 
 SaCkptSectionIdT sectionId2 = {
-	"section ID #2",
-	14
+	14,
+	"section ID #2"
 };
+
 SaCkptSectionCreationAttributesT sectionCreationAttributes1 = {
 	&sectionId1,
 	SA_TIME_END
@@ -97,8 +99,8 @@
 SaCkptIOVectorElementT ReadVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		readBuffer1,
 		sizeof (readBuffer1),
@@ -107,8 +109,8 @@
 	},
 	{
 		{
-			"section ID #2",
-			14
+			14,
+			"section ID #2"
 		},
 		readBuffer2,
 		sizeof (readBuffer2),
@@ -122,8 +124,8 @@
 SaCkptIOVectorElementT WriteVectorElements[] = {
 	{
 		{
-			"section ID #1",
-			14
+			14,
+			"section ID #1"
 		},
 		data, /*"written data #1, this should extend past end of old section data", */
 		DATASIZE, /*sizeof ("data #1, this should extend past end of old section data") + 1, */
@@ -133,8 +135,8 @@
 #ifdef COMPILE_OUT
 	{
 		{
-			"section ID #2",
 			14
+			"section ID #2",
 		},
 		data, /*"written data #2, this should extend past end of old section data" */
 		DATASIZE, /*sizeof ("written data #2, this should extend past end of old section data") + 1, */
@@ -144,12 +146,18 @@
 #endif
 };
 
+SaCkptCallbacksT callbacks = {
+ 	0,
+	0
+};
+
 int main (void) {
+	SaCkptHandleT ckptHandle;
 	SaCkptCheckpointHandleT checkpointHandle;
 	SaCkptCheckpointHandleT checkpointHandle2;
 	SaCkptCheckpointHandleT checkpointHandleRead;
-	SaCkptCheckpointStatusT checkpointStatus;
-	SaCkptSectionIteratorT sectionIterator;
+	SaCkptCheckpointDescriptorT checkpointStatus;
+	SaCkptSectionIterationHandleT sectionIterator;
 	SaCkptSectionDescriptorT sectionDescriptor;
 	SaUint32T erroroneousVectorIndex = 0;
 	SaErrorT error;
@@ -157,30 +165,39 @@
 	struct timeval tv_end;
 	struct timeval tv_elapsed;
 	
-	error = saCkptCheckpointOpen (&checkpointName,
+    error = saCkptInitialize (&ckptHandle, &callbacks, &version);
+	
+	error = saCkptCheckpointOpen (ckptHandle,
+		&checkpointName,
 		&checkpointCreationAttributes,
 		SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
 		0,
 		&checkpointHandle);
-	printf ("first open result %d (should be 1)\n", error);
+	printf ("%s: initial open of checkpoint\n",
+		get_test_output (error, SA_AIS_OK));
 
 	gettimeofday (&tv_start, 0);
 	sectionCreationAttributes1.expirationTime = ((unsigned long long)(tv_start.tv_sec + SECONDS_TO_EXPIRE)) * ((unsigned long long)1000000000) + ((unsigned long long)(tv_start.tv_usec) * ((unsigned long long)1000));
 
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes1,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
+
+	printf ("%s: checkpoint section create\n",
+		get_test_output (error, SA_AIS_OK));
+
 	if (error != SA_OK) {
-		error = saCkptSectionExpirationTimeSet (&checkpointHandle,
+		error = saCkptSectionExpirationTimeSet (checkpointHandle,
 			&sectionId1,
 			sectionCreationAttributes1.expirationTime);
+		printf ("%s: checkpoint section expiration set\n",
+			get_test_output (error, SA_AIS_OK));
 	}
 
-printf ("create1 error is %d\n", error);
 printf ("Please wait, testing expiry of checkpoint sections.\n");
 	do {
-	error = saCkptCheckpointRead (&checkpointHandle,
+	error = saCkptCheckpointRead (checkpointHandle,
 		ReadVectorElements,
 		1,
 		&erroroneousVectorIndex);
@@ -189,15 +206,18 @@
 	timersub (&tv_end, &tv_start, &tv_elapsed);
 	printf ("Elapsed Time to expiry is %ld.%ld (should be about %d seconds)\n", tv_elapsed.tv_sec, tv_elapsed.tv_usec, SECONDS_TO_EXPIRE);
 
-	error = saCkptCheckpointRetentionDurationSet (&checkpointHandle,
+	error = saCkptCheckpointRetentionDurationSet (checkpointHandle,
 						      5000000000LL);
-	printf ("RetentionDurationSet is %d\n", error);
+	printf ("%s: RetentionDurationSet\n",
+		get_test_output (error, SA_AIS_OK));
 
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes2,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
-printf ("create2 error is %d\n", error);
+
+	printf ("%s: Section creation\n",
+		get_test_output (error, SA_AIS_OK));
 	printf ("saCkptSectionCreate result %d (should be 1)\n", error);
 #ifdef cmpout
 for (ckptinv = 0; ckptinv < 500000; ckptinv++) {
@@ -205,7 +225,7 @@
 	/*
 	 * Test checkpoint write
 	 */
-	error = saCkptCheckpointWrite (&checkpointHandle,
+	error = saCkptCheckpointWrite (checkpointHandle,
 		WriteVectorElements,
 		1,
 		&erroroneousVectorIndex);
@@ -217,115 +237,131 @@
 exit (1);
 #endif
 
-	error = saCkptCheckpointUnlink (&checkpointName);
-	printf ("unlink result %d (should be 1)\n", error);
+	error = saCkptCheckpointUnlink (ckptHandle, &checkpointName);
+	printf ("%s: Unlinking checkpoint\n", 
+		get_test_output (error, SA_AIS_OK));
 
-	error = saCkptCheckpointOpen (&checkpointName,
+	error = saCkptCheckpointOpen (ckptHandle,
+		&checkpointName,
 		&checkpointCreationAttributes,
 		SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
 		0,
 		&checkpointHandle2);
-	printf ("open after unlink result %d (should be 7)\n", error);
+	printf ("%s: Opening unlinked checkpoint\n", 
+		get_test_output (error, 7));
 
-	error = saCkptCheckpointClose (&checkpointHandle);
-	printf ("close result %d (should be 1)\n", error);
+	error = saCkptCheckpointClose (checkpointHandle);
+	printf ("%s: Closing checkpoint\n", 
+		get_test_output (error, SA_AIS_OK));
 
-	error = saCkptCheckpointOpen (&checkpointName,
+	error = saCkptCheckpointOpen (ckptHandle,
+		&checkpointName,
 		&checkpointCreationAttributes,
 		SA_CKPT_CHECKPOINT_READ,
 		0,
 		&checkpointHandleRead);
-	printf ("read only open result %d (should be 1)\n", error);
 
-	error = saCkptCheckpointOpen (&checkpointName,
+	printf ("%s: Open checkpoint read only\n",
+		get_test_output (error, SA_AIS_OK));
+
+
+	error = saCkptCheckpointOpen (ckptHandle,
+		&checkpointName,
 		&checkpointCreationAttributes,
 		SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
 		0,
 		&checkpointHandle);
-	printf ("open after unlink/close result %d (should be 1)\n", error);
+	printf ("%s: open after unlink/close\n",
+		get_test_output (error, SA_AIS_OK));
 
-	error = saCkptCheckpointRetentionDurationSet (&checkpointHandle,
+	error = saCkptCheckpointRetentionDurationSet (checkpointHandle,
 						      5000000000LL);
-printf ("Retention duration set error is %d\n", error);
-	printf ("set checkpoint retention duration result %d (should be 1)\n", error);
+	printf ("%s: set checkpoint retention duration\n",
+		get_test_output (error, SA_AIS_OK));
 
-	error = saCkptCheckpointStatusGet (&checkpointHandle,
+	error = saCkptCheckpointStatusGet (checkpointHandle,
 		&checkpointStatus);
-	printf ("saCkptCheckpointStatusGet result %d (should be 1)\n", error);
+	printf ("%s: Get checkpoint status\n",
+		get_test_output (error, SA_AIS_OK));
 	if (error == SA_OK) {
 		printf ("Memory used %d in %d sections.\n", (int)checkpointStatus.memoryUsed,
 			(int)checkpointStatus.numberOfSections);
 	}
 	
-	error = saCkptSectionCreate (&checkpointHandleRead,
+	error = saCkptSectionCreate (checkpointHandleRead,
 		&sectionCreationAttributes1,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
-	printf ("saCkptSectionCreate result %d (should be 11)\n", error);
+	printf ("%s: Create checkpoint section on read only checkpoint\n",
+		get_test_output (error, SA_AIS_ERR_ACCESS));
 
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes1,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
-	printf ("saCkptSectionCreate result %d (should be 1)\n", error);
+	printf ("%s: Create checkpoint section on writeable checkpoint\n",
+		get_test_output (error, SA_AIS_OK));
 		
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes1,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
-	printf ("saCkptSectionCreate result %d (should be 14)\n", error);
+	printf ("%s: Create checkpoint section when one already exists\n",
+		get_test_output (error, 14));
 		
-#ifdef COMPILE_OUT
-	error = saCkptSectionDelete (&checkpointHandle,
+	error = saCkptSectionDelete (checkpointHandle,
 		&sectionId1);
-	printf ("saCkptSectionDelete result %d (should be 1)\n", error);
+	printf ("%s: deleting checkpoint handle\n",
+		get_test_output (error, SA_AIS_OK));
 		
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes1,
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
-	printf ("saCkptSectionCreate result %d (should be 1)\n", error);
-#endif
+	printf ("%s: replacing deleted checkpoint section\n",
+		get_test_output (error, SA_AIS_OK));
 
-	error = saCkptSectionExpirationTimeSet (&checkpointHandle,
+	error = saCkptSectionExpirationTimeSet (checkpointHandle,
 		&sectionId2,
 		SA_TIME_END);
-	printf ("saCkptSectionExpirationTimeSet result %d (should be 1)\n", error);
+	printf ("%s: Setting expiration time for section 2\n",
+		get_test_output (error, SA_AIS_OK));
 		
-
-	error = saCkptSectionOverwrite (&checkpointHandle,
+	error = saCkptSectionOverwrite (checkpointHandle,
 		&sectionId1,
 		"Overwrite Data #1",
 		strlen ("Overwrite Data #1") + 1);
-	printf ("saCkptSectionOverwrite result %d (should be 1)\n", error);
+	printf ("%s: overwriting checkpoint section 1\n",
+		get_test_output (error, SA_AIS_OK));
 
 	/*
 	 * Test checkpoint read
 	 */
 	memset (readBuffer1, 0, sizeof (readBuffer1));
 	memset (readBuffer2, 0, sizeof (readBuffer2));
-	error = saCkptSectionCreate (&checkpointHandle,
+	error = saCkptSectionCreate (checkpointHandle,
 		&sectionCreationAttributes2,
 		"Initial Data #2",
 		strlen ("Initial Data #2") + 1);
-	printf ("saCkptSectionCreate result %d (should be 1)\n", error);
+	printf ("%s: creating checkpoint for read test\n",
+		get_test_output (error, SA_AIS_OK));
 
-	error = saCkptCheckpointRead (&checkpointHandle,
+	error = saCkptCheckpointRead (checkpointHandle,
 		ReadVectorElements,
 		2,
 		&erroroneousVectorIndex);
-	printf ("saCkptCheckpointRead result %d (should be 1)\n", error);
+	printf ("%s: checkpoint read operation",
+		get_test_output (error, SA_AIS_OK));
 	printf ("Buffers after checkpoint read\n");
 	printf (" buffer #1: '%s'\n", readBuffer1);
 	printf (" buffer #2: '%s'\n", readBuffer2);
 
-//sleep (20);
 #ifdef COMPILE_OUT
 for (ckptinv = 0; ckptinv < 2000; ckptinv++) {
 	/*
 	 * Test checkpoint write
 	 */
-	error = saCkptCheckpointWrite (&checkpointHandle,
+	error = saCkptCheckpointWrite (checkpointHandle,
 		WriteVectorElements,
 		2,
 		&erroroneousVectorIndex);
@@ -337,7 +373,7 @@
 }
 exit (1);
 #endif
-	error = saCkptCheckpointRead (&checkpointHandle,
+	error = saCkptCheckpointRead (checkpointHandle,
 		ReadVectorElements,
 		2,
 		&erroroneousVectorIndex);
@@ -346,26 +382,30 @@
 //	printf (" buffer #1: '%s'\n", readBuffer1);
 //	printf (" buffer #2: '%s'\n", readBuffer2);
 
-	error = saCkptCheckpointStatusGet (&checkpointHandle,
+	error = saCkptCheckpointStatusGet (checkpointHandle,
 		&checkpointStatus);
-	printf ("saCkptCheckpointStatusGet result %d (should be 1)\n", error);
+	printf ("%s: get checkpoint status\n",
+		get_test_output (error, SA_AIS_OK));
 	if (error == SA_OK) {
-		printf ("Memory used %d in %d sections.\n", (int)checkpointStatus.memoryUsed,
+		printf ("Memory used %d in %d sections.\n",
+			(int)checkpointStatus.memoryUsed,
 			(int)checkpointStatus.numberOfSections);
 	}
-	error = saCkptSectionIteratorInitialize (&checkpointHandle,
+	error = saCkptSectionIterationInitialize (checkpointHandle,
 		0,
 		0,
 		&sectionIterator);
-	printf ("saCkptSectionIteratorInitialize result %d (should be 1)\n", error);
+	printf ("%s: initialize section iterator\n",
+		get_test_output (error, SA_AIS_OK));
 
 	/*
 	 * Iterate all sections
 	 */
 	do {
-		error = saCkptSectionIteratorNext (&sectionIterator,
+		error = saCkptSectionIterationNext (sectionIterator,
 			&sectionDescriptor);
-		printf ("saCkptSectionIteratorNext result %d (should be 1)\n", error);
+		printf ("%s: Get next section in iteartion\n",
+			get_test_output (error, SA_AIS_OK));
 		if (error == SA_OK) {
 			printf ("Section '%s' expires %llx size %d state %x update %llx\n",
 				sectionDescriptor.sectionId.id,
@@ -375,8 +415,10 @@
 				sectionDescriptor.lastUpdate);
 		}
 	} while (error == SA_OK);
+	printf ("The last iteration should fail\n");
 
-	error = saCkptSectionIteratorFinalize (&sectionIterator);
-	printf ("saCkptSectionIteratorFinalize result %d (should be 1)\n", error);
+	error = saCkptSectionIterationFinalize (sectionIterator);
+	printf ("%s: Finalize iteration\n",
+		get_test_output (error, SA_AIS_OK));
 	return (0);
 }


More information about the Openais mailing list