Kaynağa Gözat

update to new totem code.

(Logical change 1.117)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@410 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 21 yıl önce
ebeveyn
işleme
a4bf2f872d
13 değiştirilmiş dosya ile 424 ekleme ve 326 silme
  1. 1 0
      exec/aispoll.c
  2. 72 63
      exec/amf.c
  3. 89 82
      exec/ckpt.c
  4. 58 27
      exec/clm.c
  5. 29 28
      exec/crypto.c
  6. 54 27
      exec/evs.c
  7. 107 86
      exec/evt.c
  8. 7 5
      include/sq.h
  9. 1 1
      lib/Makefile
  10. 2 2
      lib/amf.c
  11. 2 2
      lib/clm.c
  12. 1 2
      lib/evs.c
  13. 1 1
      lib/evt.c

+ 1 - 0
exec/aispoll.c

@@ -36,6 +36,7 @@
 #include <sys/poll.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
 
 #include "aispoll.h"
 #include "../include/list.h"

+ 72 - 63
exec/amf.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2004 MontaVista Software, Inc.
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
  *
  * All rights reserved.
  *
@@ -49,7 +49,7 @@
 #include "../include/ais_msg.h"
 #include "../include/list.h"
 #include "../include/queue.h"
-#include "gmi.h"
+#include "totempg.h"
 #include "aispoll.h"
 #include "mempool.h"
 #include "util.h"
@@ -85,7 +85,7 @@ struct mcast_data {
 	int			priority;
 };
 
-static void *tok_call_handle = NULL;
+//TODO static void *tok_call_handle = NULL;
 
 static int recovery = 0;
 
@@ -256,10 +256,13 @@ static void amf_confchg_njoin (
 	void *data);
 
 static int amf_confchg_fn (
-	enum gmi_configuration_type configuration_type,
-    struct sockaddr_in *member_list, int member_list_entries,
-    struct sockaddr_in *left_list, int left_list_entries,
-    struct sockaddr_in *joined_list, int joined_list_entries);
+	enum totempg_configuration_type configuration_type,
+    struct in_addr *member_list, void *member_list_private,
+		int member_list_entries,
+    struct in_addr *left_list, void *left_list_private,
+		int left_list_entries,
+    struct in_addr *joined_list, void *joined_list_private,
+		int joined_list_entries);
 
 /***
 static void amf_dump (void);
@@ -275,17 +278,17 @@ static void amf_mcast (struct iovec *iovec, int iov_len, int priority);
 
 static int amf_mcast_retain ();
 
-static int message_handler_req_exec_amf_componentregister (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_amf_componentregister (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_amf_componentunregister (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_amf_componentunregister (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_amf_errorreport (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_amf_errorreport (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_amf_errorcancelall (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_amf_errorcancelall (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_amf_readinessstateset (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_amf_readinessstateset (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_amf_hastateset (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_amf_hastateset (void *message, struct in_addr source_addr, int endian_conversion_required);
 
 static int message_handler_req_amf_init (struct conn_info *conn_info, void *message);
 
@@ -336,77 +339,77 @@ struct libais_handler amf_libais_handlers[] =
 		.libais_handler_fn	= message_handler_req_lib_activatepoll,
 		.response_size		= sizeof (struct res_lib_activatepoll),
 		.response_id		= MESSAGE_RES_LIB_ACTIVATEPOLL, // TODO RESPONSE
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 1 */
 		.libais_handler_fn	= message_handler_req_amf_componentregister,
 		.response_size		= sizeof (struct res_lib_amf_componentregister),
 		.response_id		= MESSAGE_RES_AMF_COMPONENTREGISTER,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 2 */
 		.libais_handler_fn	= message_handler_req_amf_componentunregister,
 		.response_size		= sizeof (struct res_lib_amf_componentunregister),
 		.response_id		= MESSAGE_RES_AMF_COMPONENTUNREGISTER,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 3 */
 		.libais_handler_fn	= message_handler_req_amf_readinessstateget,
 		.response_size		= sizeof (struct res_lib_amf_readinessstateget),
 		.response_id		= MESSAGE_RES_AMF_READINESSSTATEGET,
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 4 */
 		.libais_handler_fn	= message_handler_req_amf_hastateget,
 		.response_size		= sizeof (struct res_lib_amf_hastateget),
 		.response_id		= MESSAGE_RES_AMF_READINESSSTATEGET,
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 5 */
 		.libais_handler_fn	= message_handler_req_amf_protectiongrouptrackstart,
 		.response_size		= sizeof (struct res_lib_amf_protectiongrouptrackstart),
 		.response_id		= MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTART,
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 6 */
 		.libais_handler_fn	= message_handler_req_amf_protectiongrouptrackstop,
 		.response_size		= sizeof (struct res_lib_amf_protectiongrouptrackstop),
 		.response_id		= MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTOP,
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 7 */
 		.libais_handler_fn	= message_handler_req_amf_errorreport,
 		.response_size		= sizeof (struct res_lib_amf_errorreport),
 		.response_id		= MESSAGE_RES_AMF_ERRORREPORT,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 8 */
 		.libais_handler_fn	= message_handler_req_amf_errorcancelall,
 		.response_size		= sizeof (struct res_lib_amf_errorcancelall),
 		.response_id		= MESSAGE_RES_AMF_ERRORCANCELALL,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 9 */
 		.libais_handler_fn	= message_handler_req_amf_stoppingcomplete,
 		.response_size		= sizeof (struct res_lib_amf_stoppingcomplete),
 		.response_id		= MESSAGE_RES_AMF_STOPPINGCOMPLETE, // TODO 
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 10 */
 		.libais_handler_fn	= message_handler_req_amf_response,
 		.response_size		= sizeof (struct res_lib_amf_response),
 		.response_id		= MESSAGE_RES_AMF_RESPONSE, // TODO
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 11 */
 		.libais_handler_fn	= message_handler_req_amf_componentcapabilitymodelget,
 		.response_size		= sizeof (struct res_lib_amf_componentcapabilitymodelget),
 		.response_id		= MESSAGE_RES_AMF_COMPONENTCAPABILITYMODELGET,
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	}
 };
 
-int (*amf_aisexec_handler_fns[]) (void *, struct in_addr source_addr) = {
+int (*amf_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian_conversion_required) = {
 	message_handler_req_exec_amf_componentregister,
 	message_handler_req_exec_amf_componentunregister,
 	message_handler_req_exec_amf_errorreport,
@@ -419,7 +422,7 @@ int (*amf_aisexec_handler_fns[]) (void *, struct in_addr source_addr) = {
  * Exports the interface for the service
  */
 struct service_handler amf_service_handler = {
-	.libais_handlers			=	amf_libais_handlers,
+	.libais_handlers			= amf_libais_handlers,
 	.libais_handlers_count		= sizeof (amf_libais_handlers) / sizeof (struct libais_handler),
 	.aisexec_handler_fns		= amf_aisexec_handler_fns,
 	.aisexec_handler_fns_count	= sizeof (amf_aisexec_handler_fns) / sizeof (int (*)),
@@ -537,13 +540,13 @@ static void component_unregister_priority (
 	iovecs[0].iov_base = (char *)&req_exec_amf_componentunregister;
 	iovecs[0].iov_len = sizeof (req_exec_amf_componentunregister);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, priority) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, priority) == 0);
 }
 
 static void component_unregister (
 	struct saAmfComponent *component)
 {
-	component_unregister_priority (component, GMI_PRIO_MED);
+	component_unregister_priority (component, TOTEMPG_PRIO_MED);
 	return;
 }
 
@@ -807,9 +810,9 @@ static void ha_state_group_set (
 	iovecs[0].iov_len = sizeof (req_exec_amf_hastateset);
 
 	if (recovery == 1) {
-		priority = GMI_PRIO_RECOVERY;
+		priority = TOTEMPG_PRIO_RECOVERY;
 	} else {
-		priority = GMI_PRIO_HIGH;
+		priority = TOTEMPG_PRIO_HIGH;
 	}
 
 	amf_mcast (iovecs, 1, priority);
@@ -905,9 +908,9 @@ static void readiness_state_group_set (
 	iovecs[0].iov_len = sizeof (req_exec_amf_readinessstateset);
 
 	if (recovery == 1) {
-		priority = GMI_PRIO_RECOVERY;
+		priority = TOTEMPG_PRIO_RECOVERY;
 	} else {
-		priority = GMI_PRIO_HIGH;
+		priority = TOTEMPG_PRIO_HIGH;
 	}
 
 	amf_mcast (iovecs, 1, priority);
@@ -1542,7 +1545,7 @@ void error_report (
 	iovecs[0].iov_base = (char *)&req_exec_amf_errorreport;
 	iovecs[0].iov_len = sizeof (req_exec_amf_errorreport);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 }
 
 int healthcheck_instance = 0;
@@ -1700,7 +1703,7 @@ struct saAmfComponent *component_in_protectiongroup_find (
 
 DECLARE_LIST_INIT (library_notification_send_listhead);
 
-static gmi_recovery_plug_handle amf_recovery_plug_handle;
+// TODO static totempg_recovery_plug_handle amf_recovery_plug_handle;
 
 static void protectiongroup_notifications_send (
 	struct saAmfComponent *changedComponent,
@@ -1932,15 +1935,16 @@ static void response_handler_csisetcallback (struct conn_info *conn_info,
 
 static int amf_exec_init_fn (void)
 {
+#ifdef TODO
 	int res;
-
-	res = gmi_recovery_plug_create (&amf_recovery_plug_handle);
+	res = totempg_recovery_plug_create (&amf_recovery_plug_handle);
 	if (res != 0) {
 		log_printf(LOG_LEVEL_ERROR,
 		"Could not create recovery plug for amf service.\n");
 
 		return (-1);
 	}
+#endif
 	return (0);
 }
 
@@ -1950,7 +1954,7 @@ void amf_confchg_njoin (struct saAmfComponent *component ,void *data)
 		return;
 	}
 
-	component_register_priority (component, GMI_PRIO_RECOVERY);
+	component_register_priority (component, TOTEMPG_PRIO_RECOVERY);
 	return;
 }
 
@@ -2011,10 +2015,13 @@ void amf_confchg_nleave (struct saAmfComponent *component ,void *data)
 }
 
 static int amf_confchg_fn (
-	enum gmi_configuration_type configuration_type,
-    struct sockaddr_in *member_list, int member_list_entries,
-    struct sockaddr_in *left_list, int left_list_entries,
-    struct sockaddr_in *joined_list, int joined_list_entries)
+	enum totempg_configuration_type configuration_type,
+    struct in_addr *member_list, void *member_list_private,
+		int member_list_entries,
+    struct in_addr *left_list, void *left_list_private,
+		int left_list_entries,
+    struct in_addr *joined_list, void *joined_list_private,
+		int joined_list_entries)
 {
 	int i;
 
@@ -2030,13 +2037,15 @@ static int amf_confchg_fn (
 	 * If node leave, component unregister
 	 */
 	for (i = 0; i<left_list_entries ; i++) {
-		enumerate_components (amf_confchg_nleave, (void *)&(left_list[i].sin_addr));
+		enumerate_components (amf_confchg_nleave, (void *)&(left_list[i]));
 	}
 
-	if (configuration_type == GMI_CONFIGURATION_REGULAR) {
-		gmi_recovery_plug_unplug (amf_recovery_plug_handle);
+#ifdef TODO
+	if (configuration_type == TOTEMPG_CONFIGURATION_REGULAR) {
+		totempg_recovery_plug_unplug (amf_recovery_plug_handle);
 		recovery = 0;
 	}
+#endif
 
 	return (0);
 }
@@ -2067,7 +2076,7 @@ int amf_exit_fn (struct conn_info *conn_info)
 	return (0);
 }
 
-static int message_handler_req_exec_amf_componentregister (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_amf_componentregister (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_amf_componentregister *req_exec_amf_componentregister = (struct req_exec_amf_componentregister *)message;
 	struct res_lib_amf_componentregister res_lib_amf_componentregister;
@@ -2229,7 +2238,7 @@ static void amf_synchronize (void *message, struct in_addr source_addr)
 	return;
 }
 
-static int message_handler_req_exec_amf_componentunregister (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_amf_componentunregister (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_amf_componentunregister *req_exec_amf_componentunregister = (struct req_exec_amf_componentunregister *)message;
 	struct res_lib_amf_componentunregister res_lib_amf_componentunregister;
@@ -2297,7 +2306,7 @@ static int message_handler_req_exec_amf_componentunregister (void *message, stru
 	return (0);
 }
 
-static int message_handler_req_exec_amf_errorreport (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_amf_errorreport (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_amf_errorreport *req_exec_amf_errorreport = (struct req_exec_amf_errorreport *)message;
 	struct res_lib_amf_errorreport res_lib_amf_errorreport;
@@ -2338,7 +2347,7 @@ static int message_handler_req_exec_amf_errorreport (void *message, struct in_ad
 	return (0);
 }
 
-static int message_handler_req_exec_amf_errorcancelall (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_amf_errorcancelall (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_amf_errorcancelall *req_exec_amf_errorcancelall = (struct req_exec_amf_errorcancelall *)message;
 	struct res_lib_amf_errorcancelall res_lib_amf_errorcancelall;
@@ -2387,7 +2396,7 @@ static int message_handler_req_exec_amf_errorcancelall (void *message, struct in
  * node.  That cluster node API has verified the readiness state, so its time to let
  * the rest of the cluster nodes know about the readiness state change.
  */
-static int message_handler_req_exec_amf_readinessstateset (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_amf_readinessstateset (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_amf_readinessstateset *req_exec_amf_readinessstateset = (struct req_exec_amf_readinessstateset *)message;
 	struct saAmfComponent *component;
@@ -2412,7 +2421,7 @@ static int message_handler_req_exec_amf_readinessstateset (void *message, struct
  * node.  That cluster node API has verified the ha state, so its time to let
  * the rest of the cluster nodes know about the HA state change.
  */
-static int message_handler_req_exec_amf_hastateset (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_amf_hastateset (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_amf_hastateset *req_exec_amf_hastateset = (struct req_exec_amf_hastateset *)message;
 	struct saAmfComponent *component;
@@ -2509,7 +2518,7 @@ static int message_handler_req_amf_componentregister (struct conn_info *conn_inf
 	iovecs[0].iov_base = (char *)&req_exec_amf_componentregister;
 	iovecs[0].iov_len = sizeof (req_exec_amf_componentregister);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 	return (0);
 }
 
@@ -2538,7 +2547,7 @@ static int message_handler_req_amf_componentunregister (struct conn_info *conn_i
 	iovecs[0].iov_base = (char *)&req_exec_amf_componentunregister;
 	iovecs[0].iov_len = sizeof (req_exec_amf_componentunregister);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 	return (0);
 }
 
@@ -2719,7 +2728,7 @@ static int message_handler_req_amf_errorreport (struct conn_info *conn_info, voi
 //	iovecs[1].iov_base = (char *)&req_lib_amf_errorreport;
 //	iovecs[1].iov_len = sizeof (req_lib_amf_errorreport);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -2749,7 +2758,7 @@ static int message_handler_req_amf_errorcancelall (struct conn_info *conn_info,
 //	iovecs[1].iov_base = (char *)&req_lib_amf_errorcancelall;
 //	iovecs[1].iov_len = sizeof (req_lib_amf_errorcancelall);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -2852,8 +2861,8 @@ static int message_handler_req_amf_componentcapabilitymodelget (struct conn_info
 }
 
 #ifdef COMPILE_OUT
-int gmi_mcast2 (
-	struct gmi_groupname *groupname,
+int totempg_mcast2 (
+	struct totempg_groupname *groupname,
 	struct iovec *iovec,
 	int iov_len,
 	int priority)
@@ -2865,7 +2874,7 @@ int gmi_mcast2 (
 	}
 
 	amf_mcast_retain ();
-	gmi_mcast (groupname, iovec, iov_len, priority);
+	totempg_mcast (groupname, iovec, iov_len, TOTEMPG_AGREED, priority);
 }
 #endif
 
@@ -2876,11 +2885,11 @@ static void amf_mcast (struct iovec *iovec, int iovec_num, int priority)
 	struct mcast_data *mcast;
 
 	if (mcast_list.next == &mcast_list) {
-		ret = gmi_mcast (&aisexec_groupname, iovec, iovec_num, priority);
+		ret = totempg_mcast (iovec, iovec_num, TOTEMPG_AGREED, priority);
 		if (ret == 0) {
 			return;
 		}
-		assert (gmi_token_callback_create (&tok_call_handle, amf_mcast_retain, NULL) == 0);
+// TODO		assert (totempg_token_callback_create (&tok_call_handle, amf_mcast_retain, NULL) == 0);
 	}
 
 	mcast = (struct mcast_data *) malloc (sizeof(*mcast));
@@ -2917,7 +2926,7 @@ static int amf_mcast_retain ()
 	int priority;
 	int ret;
 
-	for (priority=GMI_PRIO_RECOVERY; priority<GMI_PRIO_LOW; priority++) {
+	for (priority = TOTEMPG_PRIO_RECOVERY; priority < TOTEMPG_PRIO_LOW; priority++) {
 	for (list=mcast_list.next; list != &mcast_list; list=list_next) {
 
 		mdata = list_entry (list, struct mcast_data, mlist);
@@ -2928,10 +2937,10 @@ static int amf_mcast_retain ()
 
 		list_del (list);
 
-		ret = gmi_mcast (&aisexec_groupname, mdata->iovec, mdata->iovec_num, mdata->priority);
+		ret = totempg_mcast (mdata->iovec, mdata->iovec_num, TOTEMPG_AGREED, mdata->priority);
 		if (ret == -1) {
 			list_add (list ,&mcast_list);
-		assert (gmi_token_callback_create (&tok_call_handle, amf_mcast_retain, NULL) == 0);
+// TODO		assert (totempg_token_callback_create (&tok_call_handle, amf_mcast_retain, NULL) == 0);
 			break;
 		}
 

+ 89 - 82
exec/ckpt.c

@@ -53,7 +53,7 @@
 #include "util.h"
 #include "parse.h"
 #include "main.h"
-#include "gmi.h"
+#include "totempg.h"
 
 #define LOG_SERVICE LOG_SERVICE_CKPT
 #include "print.h"
@@ -62,7 +62,7 @@ DECLARE_LIST_INIT(checkpointListHead);
 
 DECLARE_LIST_INIT(checkpointIteratorListHead);
 
-static gmi_recovery_plug_handle ckpt_checkpoint_recovery_plug_handle;
+//TODO static totempg_recovery_plug_handle ckpt_checkpoint_recovery_plug_handle;
 
 static int ckpt_checkpoint_exec_init_fn (void);
 
@@ -72,27 +72,27 @@ static int ckptSectionIteratorApiFinalize (struct conn_info *conn_info);
 
 static int message_handler_req_lib_activatepoll (struct conn_info *, void *message);
 
-static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_checkpointclose (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_checkpointclose (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_checkpointunlink (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_checkpointunlink (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_checkpointretentiondurationexpire (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_checkpointretentiondurationexpire (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_sectioncreate (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_sectioncreate (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_sectiondelete (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_sectiondelete (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_sectionexpirationtimeset (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_sectionexpirationtimeset (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_sectionwrite (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_sectionwrite (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_sectionoverwrite (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_sectionoverwrite (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_exec_ckpt_sectionread (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_ckpt_sectionread (void *message, struct in_addr source_addr, int endian_conversion_required);
 
 static int message_handler_req_lib_ckpt_init (struct conn_info *conn_info, void *message);
 
@@ -132,14 +132,19 @@ static int message_handler_req_lib_ckpt_sectioniteratorinitialize (struct conn_i
 static int message_handler_req_lib_ckpt_sectioniteratornext (struct conn_info *conn_info, void *message);
 
 static int ckpt_checkpoint_confchg_fn (
-	enum gmi_configuration_type configuration_type,
-	struct sockaddr_in *member_list, int member_list_entries,
-	struct sockaddr_in *left_list, int left_list_entries,
-	struct sockaddr_in *joined_list, int joined_list_entries) {
-
-	if (configuration_type == GMI_CONFIGURATION_REGULAR) {
-		gmi_recovery_plug_unplug (ckpt_checkpoint_recovery_plug_handle);
+	enum totempg_configuration_type configuration_type,
+	struct in_addr *member_list, void *member_list_private,
+		int member_list_entries,
+	struct in_addr *left_list, void *left_list_private,
+		int left_list_entries,
+	struct in_addr *joined_list, void *joined_list_private,
+		int joined_list_entries) {
+
+#ifdef TODO
+	if (configuration_type == TOTEMPG_CONFIGURATION_REGULAR) {
+		totempg_recovery_plug_unplug (ckpt_checkpoint_recovery_plug_handle);
 	}
+#endif
 
 	return (0);
 }
@@ -150,14 +155,14 @@ struct libais_handler ckpt_libais_handlers[] =
 		.libais_handler_fn			= message_handler_req_lib_activatepoll,
 		.response_size				= sizeof (struct res_lib_activatepoll),
 		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL,
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio					= TOTEMPG_PRIO_RECOVERY
 	}
 };
 
 /*
  * TODO
  */
-int (*ckpt_aisexec_handler_fns[]) (void *, struct in_addr source_addr) = {
+int (*ckpt_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian_conversion_required) = {
 };
 
 /*
@@ -181,96 +186,96 @@ struct libais_handler ckpt_checkpoint_libais_handlers[] =
 		.libais_handler_fn	= message_handler_req_lib_activatepoll,
 		.response_size		= sizeof (struct res_lib_activatepoll),
 		.response_id		= MESSAGE_RES_LIB_ACTIVATEPOLL,
-		.gmi_prio			= GMI_PRIO_RECOVERY
+		.totempg_prio		= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 1 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointopen,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointopen),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 2 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointopenasync,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointopenasync),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 3 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointunlink,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointunlink),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 4 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointretentiondurationset,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointretentiondurationset),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
-		.gmi_prio			= GMI_PRIO_LOW
+		.totempg_prio		= TOTEMPG_PRIO_LOW
 	},
 	{ /* 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,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 6 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointstatusget,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointstatusget),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 7 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectioncreate,
 		.response_size		= sizeof (struct res_lib_ckpt_sectioncreate),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 8 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectiondelete,
 		.response_size		= sizeof (struct res_lib_ckpt_sectiondelete),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 9 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionexpirationtimeset,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionexpirationtimeset),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
-		.gmi_prio			= GMI_PRIO_LOW
+		.totempg_prio		= TOTEMPG_PRIO_LOW
 	},
 	{ /* 10 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionwrite,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionwrite),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE,
-		.gmi_prio			= GMI_PRIO_LOW
+		.totempg_prio		= TOTEMPG_PRIO_LOW
 	},
 	{ /* 11 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionoverwrite,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionoverwrite),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE,
-		.gmi_prio			= GMI_PRIO_LOW
+		.totempg_prio		= TOTEMPG_PRIO_LOW
 	},
 	{ /* 12 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionread,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionread),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD,
-		.gmi_prio			= GMI_PRIO_LOW
+		.totempg_prio		= TOTEMPG_PRIO_LOW
 	},
 	{ /* 13 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointsynchronize,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointsynchronize),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 	{ /* 14 */
 		.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,
-		.gmi_prio			= GMI_PRIO_MED
+		.totempg_prio		= TOTEMPG_PRIO_MED
 	},
 };
 
 
-static int (*ckpt_checkpoint_aisexec_handler_fns[]) (void *msg, struct in_addr source_addr) = {
+static int (*ckpt_checkpoint_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,
@@ -302,23 +307,23 @@ struct libais_handler ckpt_sectioniterator_libais_handlers[] =
 		.libais_handler_fn			= message_handler_req_lib_activatepoll,
 		.response_size				= sizeof (struct res_lib_activatepoll),
 		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL,
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 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,
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 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,
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	}
 };
 
-static int (*ckpt_sectioniterator_aisexec_handler_fns[]) (void *msg, struct in_addr source_addr) = {
+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 = {
@@ -387,7 +392,7 @@ void checkpoint_section_release (struct saCkptCheckpointSection *section)
 	list_del (&section->list);
 	free (section->sectionDescriptor.sectionId.id); 
 	free (section->sectionData);
-	poll_timer_delete (*gmi_poll_handle, section->expiration_timer);
+	poll_timer_delete (aisexec_poll_handle, section->expiration_timer);
 	free (section);
 }
 
@@ -396,7 +401,7 @@ void checkpoint_release (struct saCkptCheckpoint *checkpoint)
 	struct list_head *list;
 	struct saCkptCheckpointSection *section;
 
-	poll_timer_delete (*gmi_poll_handle, checkpoint->retention_timer);
+	poll_timer_delete (aisexec_poll_handle, checkpoint->retention_timer);
 
 	/*
 	 * Release all checkpoint sections for this checkpoint
@@ -432,8 +437,8 @@ int sendCkptCheckpointClose (struct saCkptCheckpoint *checkpoint) {
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointclose;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointclose);
 
-	if (gmi_send_ok (GMI_PRIO_HIGH, sizeof (struct req_exec_ckpt_checkpointclose))) {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_HIGH) == 0);
+	if (totempg_send_ok (TOTEMPG_PRIO_HIGH, sizeof (struct req_exec_ckpt_checkpointclose))) {
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_HIGH) == 0);
 		return (0);
 	}
 
@@ -442,14 +447,16 @@ int sendCkptCheckpointClose (struct saCkptCheckpoint *checkpoint) {
 
 static int ckpt_checkpoint_exec_init_fn (void)
 {
+#ifdef TODO
 	int res;
 
-	res = gmi_recovery_plug_create (&ckpt_checkpoint_recovery_plug_handle);
+	res = totempg_recovery_plug_create (&ckpt_checkpoint_recovery_plug_handle);
 	if (res != 0) {
 		log_printf(LOG_LEVEL_ERROR,
 		"Could not create recovery plug for clm service.\n");
 		return (-1);
 	}
+#endif 
 	return (0);
 }
 
@@ -497,7 +504,7 @@ static int message_handler_req_lib_activatepoll (struct conn_info *conn_info, vo
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_ckpt_checkpointopen *req_exec_ckpt_checkpointopen = (struct req_exec_ckpt_checkpointopen *)message;
 	struct req_lib_ckpt_checkpointopen *req_lib_ckpt_checkpointopen = (struct req_lib_ckpt_checkpointopen *)&req_exec_ckpt_checkpointopen->req_lib_ckpt_checkpointopen;
@@ -578,7 +585,7 @@ static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct i
 	/*
 	 * Reset retention duration since this checkpoint was just opened
 	 */
-	poll_timer_delete (*gmi_poll_handle, ckptCheckpoint->retention_timer);
+	poll_timer_delete (aisexec_poll_handle, ckptCheckpoint->retention_timer);
 	ckptCheckpoint->retention_timer = 0;
 
 	/*
@@ -644,10 +651,10 @@ void timer_function_retention (void *data)
 	iovec.iov_base = (char *)&req_exec_ckpt_checkpointretentiondurationexpire;
 	iovec.iov_len = sizeof (req_exec_ckpt_checkpointretentiondurationexpire);
 
-	assert (gmi_mcast (&aisexec_groupname, &iovec, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (&iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 }
 
-extern int message_handler_req_exec_ckpt_checkpointclose (void *message, struct in_addr source_addr)
+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 saCkptCheckpoint *checkpoint = 0;
@@ -671,7 +678,7 @@ extern int message_handler_req_exec_ckpt_checkpointclose (void *message, struct
 		checkpoint_release (checkpoint);
 	} else
 	if (checkpoint->referenceCount == 0) {
-		poll_timer_add (*gmi_poll_handle,
+		poll_timer_add (aisexec_poll_handle,
 			checkpoint->checkpointCreationAttributes.retentionDuration / 1000000,
 			checkpoint,
 			timer_function_retention,
@@ -681,7 +688,7 @@ extern int message_handler_req_exec_ckpt_checkpointclose (void *message, struct
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_checkpointunlink (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_ckpt_checkpointunlink (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_ckpt_checkpointunlink *req_exec_ckpt_checkpointunlink = (struct req_exec_ckpt_checkpointunlink *)message;
 
@@ -726,7 +733,7 @@ error_exit:
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_ckpt_checkpointretentiondurationset *req_exec_ckpt_checkpointretentiondurationset = (struct req_exec_ckpt_checkpointretentiondurationset *)message;
 	struct res_lib_ckpt_checkpointretentiondurationset res_lib_ckpt_checkpointretentiondurationset;
@@ -739,9 +746,9 @@ static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *m
 		checkpoint->checkpointCreationAttributes.retentionDuration = req_exec_ckpt_checkpointretentiondurationset->retentionDuration;
 
 		if (checkpoint->expired == 0 && checkpoint->referenceCount == 0) {
-			poll_timer_delete (*gmi_poll_handle, checkpoint->retention_timer);
+			poll_timer_delete (aisexec_poll_handle, checkpoint->retention_timer);
 
-			poll_timer_add (*gmi_poll_handle,
+			poll_timer_add (aisexec_poll_handle,
 				checkpoint->checkpointCreationAttributes.retentionDuration / 1000000,
 				checkpoint,
 				timer_function_retention,
@@ -764,7 +771,7 @@ static int message_handler_req_exec_ckpt_checkpointretentiondurationset (void *m
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_checkpointretentiondurationexpire (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_ckpt_checkpointretentiondurationexpire (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_ckpt_checkpointretentiondurationexpire *req_exec_ckpt_checkpointretentiondurationexpire = (struct req_exec_ckpt_checkpointretentiondurationexpire *)message;
 	struct req_exec_ckpt_checkpointunlink req_exec_ckpt_checkpointunlink;
@@ -790,12 +797,12 @@ static int message_handler_req_exec_ckpt_checkpointretentiondurationexpire (void
 		iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointunlink;
 		iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointunlink);
 
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 	}
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_sectioncreate (void *message, struct in_addr source_addr) {
+static int message_handler_req_exec_ckpt_sectioncreate (void *message, struct in_addr source_addr, int endian_conversion_required) {
 	struct req_exec_ckpt_sectioncreate *req_exec_ckpt_sectioncreate = (struct req_exec_ckpt_sectioncreate *)message;
 	struct req_lib_ckpt_sectioncreate *req_lib_ckpt_sectioncreate = (struct req_lib_ckpt_sectioncreate *)&req_exec_ckpt_sectioncreate->req_lib_ckpt_sectioncreate;
 	struct res_lib_ckpt_sectioncreate res_lib_ckpt_sectioncreate;
@@ -876,7 +883,7 @@ static int message_handler_req_exec_ckpt_sectioncreate (void *message, struct in
 	ckptCheckpointSection->expiration_timer = 0;
 
 	if (req_lib_ckpt_sectioncreate->expirationTime != SA_TIME_END) {
-		poll_timer_add (*gmi_poll_handle,
+		poll_timer_add (aisexec_poll_handle,
 			abstime_to_msec (ckptCheckpointSection->sectionDescriptor.expirationTime),
 			ckptCheckpointSection,
 			timer_function_section_expire,
@@ -902,7 +909,7 @@ error_exit:
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_sectiondelete (void *message, struct in_addr source_addr) {
+static int message_handler_req_exec_ckpt_sectiondelete (void *message, struct in_addr source_addr, int endian_conversion_required) {
 	struct req_exec_ckpt_sectiondelete *req_exec_ckpt_sectiondelete = (struct req_exec_ckpt_sectiondelete *)message;
 	struct req_lib_ckpt_sectiondelete *req_lib_ckpt_sectiondelete = (struct req_lib_ckpt_sectiondelete *)&req_exec_ckpt_sectiondelete->req_lib_ckpt_sectiondelete;
 	struct res_lib_ckpt_sectiondelete res_lib_ckpt_sectiondelete;
@@ -957,7 +964,7 @@ error_exit:
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_sectionexpirationtimeset (void *message, struct in_addr source_addr) {
+static int message_handler_req_exec_ckpt_sectionexpirationtimeset (void *message, struct in_addr source_addr, int endian_conversion_required) {
 	struct req_exec_ckpt_sectionexpirationtimeset *req_exec_ckpt_sectionexpirationtimeset = (struct req_exec_ckpt_sectionexpirationtimeset *)message;
 	struct req_lib_ckpt_sectionexpirationtimeset *req_lib_ckpt_sectionexpirationtimeset = (struct req_lib_ckpt_sectionexpirationtimeset *)&req_exec_ckpt_sectionexpirationtimeset->req_lib_ckpt_sectionexpirationtimeset;
 	struct res_lib_ckpt_sectionexpirationtimeset res_lib_ckpt_sectionexpirationtimeset;
@@ -995,11 +1002,11 @@ static int message_handler_req_exec_ckpt_sectionexpirationtimeset (void *message
 
 	ckptCheckpointSection->sectionDescriptor.expirationTime = req_lib_ckpt_sectionexpirationtimeset->expirationTime;
 
-	poll_timer_delete (*gmi_poll_handle, ckptCheckpointSection->expiration_timer);
+	poll_timer_delete (aisexec_poll_handle, ckptCheckpointSection->expiration_timer);
 	ckptCheckpointSection->expiration_timer = 0;
 
 	if (req_lib_ckpt_sectionexpirationtimeset->expirationTime != SA_TIME_END) {
-		poll_timer_add (*gmi_poll_handle,
+		poll_timer_add (aisexec_poll_handle,
 			abstime_to_msec (ckptCheckpointSection->sectionDescriptor.expirationTime),
 			ckptCheckpointSection,
 			timer_function_section_expire,
@@ -1019,7 +1026,7 @@ error_exit:
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_sectionwrite (void *message, struct in_addr source_addr) {
+static int message_handler_req_exec_ckpt_sectionwrite (void *message, struct in_addr source_addr, int endian_conversion_required) {
 	struct req_exec_ckpt_sectionwrite *req_exec_ckpt_sectionwrite = (struct req_exec_ckpt_sectionwrite *)message;
 	struct req_lib_ckpt_sectionwrite *req_lib_ckpt_sectionwrite = (struct req_lib_ckpt_sectionwrite *)&req_exec_ckpt_sectionwrite->req_lib_ckpt_sectionwrite;
 	struct res_lib_ckpt_sectionwrite res_lib_ckpt_sectionwrite;
@@ -1098,7 +1105,7 @@ error_exit:
 	return (0);
 }
 
-static int message_handler_req_exec_ckpt_sectionoverwrite (void *message, struct in_addr source_addr) {
+static int message_handler_req_exec_ckpt_sectionoverwrite (void *message, struct in_addr source_addr, int endian_conversion_required) {
 	struct req_exec_ckpt_sectionoverwrite *req_exec_ckpt_sectionoverwrite = (struct req_exec_ckpt_sectionoverwrite *)message;
 	struct req_lib_ckpt_sectionoverwrite *req_lib_ckpt_sectionoverwrite = (struct req_lib_ckpt_sectionoverwrite *)&req_exec_ckpt_sectionoverwrite->req_lib_ckpt_sectionoverwrite;
 	struct res_lib_ckpt_sectionoverwrite res_lib_ckpt_sectionoverwrite;
@@ -1169,7 +1176,7 @@ error_exit:
 	}
 	return (0);
 }
-static int message_handler_req_exec_ckpt_sectionread (void *message, struct in_addr source_addr) {
+static int message_handler_req_exec_ckpt_sectionread (void *message, struct in_addr source_addr, int endian_conversion_required) {
 	struct req_exec_ckpt_sectionread *req_exec_ckpt_sectionread = (struct req_exec_ckpt_sectionread *)message;
 	struct req_lib_ckpt_sectionread *req_lib_ckpt_sectionread = (struct req_lib_ckpt_sectionread *)&req_exec_ckpt_sectionread->req_lib_ckpt_sectionread;
 	struct res_lib_ckpt_sectionread res_lib_ckpt_sectionread;
@@ -1349,7 +1356,7 @@ static int message_handler_req_lib_ckpt_checkpointopen (struct conn_info *conn_i
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointopen;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointopen);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -1380,7 +1387,7 @@ static int message_handler_req_lib_ckpt_checkpointunlink (struct conn_info *conn
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointunlink;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointunlink);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -1406,7 +1413,7 @@ static int message_handler_req_lib_ckpt_checkpointretentiondurationset (struct c
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointretentiondurationset;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointretentiondurationset);
 
-	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
+	assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 
 	return (0);
 }
@@ -1524,9 +1531,9 @@ printf ("|\n");
 #endif
 	if (iovecs[1].iov_len > 0) {
 		log_printf (LOG_LEVEL_DEBUG, "IOV_BASE is %p\n", iovecs[1].iov_base);
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_MED) == 0);
+		assert (totempg_mcast (iovecs, 2, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 	} else {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 	}
 
 	return (0);
@@ -1564,9 +1571,9 @@ static int message_handler_req_lib_ckpt_sectiondelete (struct conn_info *conn_in
 	iovecs[1].iov_len = req_lib_ckpt_sectiondelete->header.size - sizeof (struct req_lib_ckpt_sectiondelete);
 
 	if (iovecs[1].iov_len > 0) {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_MED) == 0);
+		assert (totempg_mcast (iovecs, 2, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 	} else {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED) == 0);
 	}
 
 	return (0);
@@ -1604,9 +1611,9 @@ static int message_handler_req_lib_ckpt_sectionexpirationtimeset (struct conn_in
 
 	if (iovecs[1].iov_len > 0) {
 		log_printf (LOG_LEVEL_DEBUG, "IOV_BASE is %p\n", iovecs[1].iov_base);
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 2, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	} else {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	}
 
 	return (0);
@@ -1662,9 +1669,9 @@ static int message_handler_req_lib_ckpt_sectionwrite (struct conn_info *conn_inf
 
 //printf ("LIB writing checkpoint section is %s\n", ((char *)req_lib_ckpt_sectionwrite) + sizeof (struct req_lib_ckpt_sectionwrite));
 	if (iovecs[1].iov_len > 0) {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 2, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	} else {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	}
 
 	return (0);
@@ -1717,9 +1724,9 @@ static int message_handler_req_lib_ckpt_sectionoverwrite (struct conn_info *conn
 	iovecs[1].iov_len = req_lib_ckpt_sectionoverwrite->header.size - sizeof (struct req_lib_ckpt_sectionoverwrite);
 
 	if (iovecs[1].iov_len > 0) {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 2, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	} else {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	}
 
 	return (0);
@@ -1772,9 +1779,9 @@ static int message_handler_req_lib_ckpt_sectionread (struct conn_info *conn_info
 	iovecs[1].iov_len = req_lib_ckpt_sectionread->header.size - sizeof (struct req_lib_ckpt_sectionread);
 
 	if (iovecs[1].iov_len > 0) {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 2, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	} else {
-		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
+		assert (totempg_mcast (iovecs, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW) == 0);
 	}
 
 	return (0);

+ 58 - 27
exec/clm.c

@@ -45,6 +45,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <time.h>
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
@@ -53,7 +54,7 @@
 #include "../include/list.h"
 #include "../include/queue.h"
 #include "aispoll.h"
-#include "gmi.h"
+#include "totempg.h"
 #include "parse.h"
 #include "main.h"
 #include "mempool.h"
@@ -73,7 +74,7 @@ int clusterNodeEntries = 0;
 
 static DECLARE_LIST_INIT (library_notification_send_listhead);
 
-static gmi_recovery_plug_handle clm_recovery_plug_handle;
+//TODOstatic totempg_recovery_plug_handle clm_recovery_plug_handle;
 
 SaClmClusterNodeT *clm_get_by_nodeid (struct in_addr node_id)
 {
@@ -98,12 +99,15 @@ SaClmClusterNodeT *clm_get_by_nodeid (struct in_addr node_id)
 static int clm_exec_init_fn (void);
 
 static int clm_confchg_fn (
-	enum gmi_configuration_type configuration_type,
-    struct sockaddr_in *member_list, int member_list_entries,
-    struct sockaddr_in *left_list, int left_list_entries,
-    struct sockaddr_in *joined_list, int joined_list_entries);
+	enum totempg_configuration_type configuration_type,
+    struct in_addr *member_list, void *member_list_private,
+		int member_list_entries,
+    struct in_addr *left_list, void *left_list_private,
+		int left_list_entries,
+    struct in_addr *joined_list, void *joined_list_private,
+		int joined_list_entries);
 
-static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr, int endian_conversion_required);
 
 static int message_handler_req_clm_init (struct conn_info *conn_info,
 	void *message);
@@ -131,35 +135,35 @@ struct libais_handler clm_libais_handlers[] =
 		.libais_handler_fn			= message_handler_req_lib_activatepoll,
 		.response_size				= sizeof (struct res_lib_activatepoll),
 		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL, // TODO RESPONSE
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 1 */
 		.libais_handler_fn			= message_handler_req_clm_trackstart,
 		.response_size				= sizeof (struct res_clm_trackstart),
 		.response_id				= MESSAGE_RES_CLM_TRACKSTART, // TODO RESPONSE
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 2 */
 		.libais_handler_fn			= message_handler_req_clm_trackstop,
 		.response_size				= sizeof (struct res_clm_trackstop),
 		.response_id				= MESSAGE_RES_CLM_TRACKSTOP, // TODO RESPONSE
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 3 */
 		.libais_handler_fn			= message_handler_req_clm_nodeget,
 		.response_size				= sizeof (struct res_clm_nodeget),
 		.response_id				= MESSAGE_RES_CLM_NODEGET, // TODO RESPONSE
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 4 */
 		.libais_handler_fn			= message_handler_req_clm_nodegetasync,
 		.response_size				= sizeof (struct res_clm_nodegetasync),
 		.response_id				= MESSAGE_RES_CLM_NODEGETCALLBACK, // TODO RESPONSE
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	}
 };
 
-static int (*clm_aisexec_handler_fns[]) (void *, struct in_addr source_addr) = {
+static int (*clm_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian_conversion_required) = {
 	message_handler_req_exec_clm_nodejoin
 };
 	
@@ -177,14 +181,16 @@ struct service_handler clm_service_handler = {
 
 static int clm_exec_init_fn (void)
 {
-	int res;
 
-    res = gmi_recovery_plug_create (&clm_recovery_plug_handle);
+/* TODO
+	int res;
+    res = totempg_recovery_plug_create (&clm_recovery_plug_handle);
 	if (res != 0) {
        log_printf(LOG_LEVEL_ERROR,
             "Could not create recovery plug for clm service.\n");
 		return (-1);
 	}
+*/
 
 	memset (clusterNodes, 0, sizeof (SaClmClusterNodeT) * NODE_MAX);
 
@@ -380,16 +386,20 @@ static int clmNodeJoinSend (void)
 	req_exec_clm_iovec.iov_base = (char *)&req_exec_clm_nodejoin;
 	req_exec_clm_iovec.iov_len = sizeof (req_exec_clm_nodejoin);
 
-	result = gmi_mcast (&aisexec_groupname, &req_exec_clm_iovec, 1, GMI_PRIO_RECOVERY);
+	result = totempg_mcast (&req_exec_clm_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_RECOVERY);
 
 	return (result);
 }
 
 static int clm_confchg_fn (
-	enum gmi_configuration_type configuration_type,
-    struct sockaddr_in *member_list, int member_list_entries,
-    struct sockaddr_in *left_list, int left_list_entries,
-    struct sockaddr_in *joined_list, int joined_list_entries) {
+	enum totempg_configuration_type configuration_type,
+    struct in_addr *member_list, void *member_list_private,
+		int member_list_entries,
+    struct in_addr *left_list, void *left_list_private,
+		int left_list_entries,
+    struct in_addr *joined_list, void *joined_list_private,
+		int joined_list_entries)
+{
 
 	int i;
 	SaClmNodeIdT nodes[NODE_MAX];
@@ -397,16 +407,16 @@ static int clm_confchg_fn (
 	log_printf (LOG_LEVEL_NOTICE, "CLM CONFIGURATION CHANGE\n");
 	log_printf (LOG_LEVEL_NOTICE, "New Configuration:\n");
 	for (i = 0; i < member_list_entries; i++) {
-		log_printf (LOG_LEVEL_NOTICE, "\t%s\n", inet_ntoa (member_list[i].sin_addr));
+		log_printf (LOG_LEVEL_NOTICE, "\t%s\n", inet_ntoa (member_list[i]));
 	}
 	log_printf (LOG_LEVEL_NOTICE, "Members Left:\n");
 	for (i = 0; i < left_list_entries; i++) {
-		log_printf (LOG_LEVEL_NOTICE, "\t%s\n", inet_ntoa (left_list[i].sin_addr));
+		log_printf (LOG_LEVEL_NOTICE, "\t%s\n", inet_ntoa (left_list[i]));
 	}
 
 	log_printf (LOG_LEVEL_NOTICE, "Members Joined:\n");
 	for (i = 0; i < joined_list_entries; i++) {
-		log_printf (LOG_LEVEL_NOTICE, "\t%s\n", inet_ntoa (joined_list[i].sin_addr));
+		log_printf (LOG_LEVEL_NOTICE, "\t%s\n", inet_ntoa (joined_list[i]));
 	}
 
 	/*
@@ -416,24 +426,45 @@ static int clm_confchg_fn (
 		assert (clmNodeJoinSend () == 0);
 	}
 	for (i = 0; i < left_list_entries; i++) {
-		nodes[i] = left_list[i].sin_addr.s_addr;
+		nodes[i] = left_list[i].s_addr;
 	}
 
 	libraryNotificationLeave (nodes, i);
 
-	if (configuration_type == GMI_CONFIGURATION_REGULAR) {
-		gmi_recovery_plug_unplug (clm_recovery_plug_handle);
+/* TODO
+	if (configuration_type == TOTEMPG_CONFIGURATION_REGULAR) {
+		totempg_recovery_plug_unplug (clm_recovery_plug_handle);
 	}
+*/
 
 	return (0);
 }
 
-static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr)
+static void exec_clm_nodejoin_endian_conversion (struct req_exec_clm_nodejoin *in,
+	struct req_exec_clm_nodejoin *out)
+{
+	// TODO this isn't complete yet
+	// TODO SaNameT needs to be packed and aligned
+	memmove (&out->clusterNode.nodeName.value[0],
+		&in->clusterNode.nodeName.value[2],
+		SA_MAX_NAME_LENGTH);
+}
+
+static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_clm_nodejoin *req_exec_clm_nodejoin = (struct req_exec_clm_nodejoin *)message;
+	struct req_exec_clm_nodejoin req_exec_clm_nodejoin_storage;
 	int found;
 	int i;
 
+	if (endian_conversion_required) {
+		exec_clm_nodejoin_endian_conversion (message, &req_exec_clm_nodejoin_storage);
+		req_exec_clm_nodejoin = &req_exec_clm_nodejoin_storage;
+	} else {
+		req_exec_clm_nodejoin = (struct req_exec_clm_nodejoin *)message;
+	}
+
+		
 	log_printf (LOG_LEVEL_NOTICE, "got nodejoin message %s\n", req_exec_clm_nodejoin->clusterNode.nodeName.value);
 	
 	/*

+ 29 - 28
exec/crypto.c

@@ -13,6 +13,11 @@
 #include <malloc.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/poll.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "crypto.h"
 
@@ -21,8 +26,22 @@
 typedef unsigned long ulong32;
 typedef unsigned long long ulong64;
 
+/*
+ * Tested on arm2401, i386, x86_64 
+ */
+#if defined(__arm__) 
+#define ENDIAN_BIG
 #define ENDIAN_32BITWORD
+#endif
+#if defined(__i386__) 
 #define ENDIAN_LITTLE
+#define ENDIAN_32BITWORD
+#endif
+#if defined(__x86_64__)
+#define ENDIAN_LITTLE
+#define ENDIAN_64BITWORD
+#endif
+
 /* ---- HELPER MACROS ---- */
 #ifdef ENDIAN_NEUTRAL
 
@@ -277,9 +296,6 @@ int func_name (hash_state * md, const unsigned char *buf, unsigned long len)
  * The mycrypt_macros.h file
  */
 
-#define ENDIAN_32BITWORD
-#define ENDIAN_LITTLE
-
 /* ---- HELPER MACROS ---- */
 #ifdef ENDIAN_NEUTRAL
 
@@ -1222,31 +1238,16 @@ const struct _hash_descriptor *hash_descriptor[] =
 static unsigned long rng_nix(unsigned char *buf, unsigned long len, 
                              void (*callback)(void))
 {
-#ifdef NO_FILE
-    return 0;
-#else
-    FILE *f;
-    unsigned long x;
-#ifdef TRY_URANDOM_FIRST
-    f = fopen("/dev/urandom", "rb");
-    if (f == NULL)
-#endif /* TRY_URANDOM_FIRST */
-       f = fopen("/dev/random", "rb");
-
-    if (f == NULL) {
-       return 0;
-    }
-    
-    /* disable buffering */
-    if (setvbuf(f, NULL, _IONBF, 0) != 0) {
-       fclose(f);
-       return 0;
-    }   
- 
-    x = (unsigned long)fread(buf, 1, (size_t)len, f);
-    fclose(f);
-    return x;
-#endif /* NO_FILE */
+	int fd;
+	int rb;
+
+	fd = open ("/dev/urandom", O_RDONLY);
+	
+	rb = read (fd, buf, len);
+
+	close (fd);
+
+	return (rb);
 }
 
 /* on ANSI C platforms with 100 < CLOCKS_PER_SEC < 10000 */

+ 54 - 27
exec/evs.c

@@ -53,7 +53,7 @@
 #include "../include/list.h"
 #include "../include/queue.h"
 #include "aispoll.h"
-#include "gmi.h"
+#include "totempg.h"
 #include "parse.h"
 #include "main.h"
 #include "mempool.h"
@@ -70,12 +70,15 @@ static DECLARE_LIST_INIT (confchg_notify);
 static int evs_executive_initialize (void);
 
 static int evs_confchg_fn (
-	enum gmi_configuration_type configuration_type,
-    struct sockaddr_in *member_list, int member_list_entries,
-    struct sockaddr_in *left_list, int left_list_entries,
-    struct sockaddr_in *joined_list, int joined_list_entries);
+	enum totempg_configuration_type configuration_type,
+    struct in_addr *member_list, void *member_list_private,
+		int member_list_entries,
+    struct in_addr *left_list, void *left_list_private,
+		int left_list_entries,
+    struct in_addr *joined_list, void *joined_list_private,
+		int joined_list_entries);
 
-static int message_handler_req_exec_mcast (void *message, struct in_addr source_addr);
+static int message_handler_req_exec_mcast (void *message, struct in_addr source_addr, int endian_conversion_required);
 
 static int message_handler_req_evs_init (struct conn_info *conn_info,
 	void *message);
@@ -96,35 +99,35 @@ struct libais_handler evs_libais_handlers[] =
 		.libais_handler_fn			= message_handler_req_lib_activatepoll,
 		.response_size				= sizeof (struct res_lib_activatepoll),
 		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL, // TODO RESPONSE
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 1 */
 		.libais_handler_fn			= message_handler_req_evs_join,
 		.response_size				= sizeof (struct res_lib_evs_join),
 		.response_id				= MESSAGE_RES_EVS_JOIN,
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 2 */
 		.libais_handler_fn			= message_handler_req_evs_leave,
 		.response_size				= sizeof (struct res_lib_evs_leave),
 		.response_id				= MESSAGE_RES_EVS_LEAVE,
-		.gmi_prio					= GMI_PRIO_RECOVERY
+		.totempg_prio				= TOTEMPG_PRIO_RECOVERY
 	},
 	{ /* 3 */
 		.libais_handler_fn			= message_handler_req_evs_mcast_joined,
 		.response_size				= sizeof (struct res_lib_evs_mcast_joined),
 		.response_id				= MESSAGE_RES_EVS_MCAST_JOINED,
-		.gmi_prio					= GMI_PRIO_LOW
+		.totempg_prio				= TOTEMPG_PRIO_LOW
 	},
 	{ /* 4 */
 		.libais_handler_fn			= message_handler_req_evs_mcast_groups,
 		.response_size				= sizeof (struct res_lib_evs_mcast_groups),
 		.response_id				= MESSAGE_RES_EVS_MCAST_GROUPS,
-		.gmi_prio					= GMI_PRIO_LOW
+		.totempg_prio				= TOTEMPG_PRIO_LOW
 	}
 };
 
-static int (*evs_aisexec_handler_fns[]) (void *, struct in_addr source_addr) = {
+static int (*evs_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian_conversion_required) = {
 	message_handler_req_exec_mcast
 };
 	
@@ -152,10 +155,14 @@ static int evs_exit_fn (struct conn_info *conn_info)
 }
 
 static int evs_confchg_fn (
-	enum gmi_configuration_type configuration_type,
-    struct sockaddr_in *member_list, int member_list_entries,
-    struct sockaddr_in *left_list, int left_list_entries,
-    struct sockaddr_in *joined_list, int joined_list_entries) {
+	enum totempg_configuration_type configuration_type,
+    struct in_addr *member_list, void *member_list_private,
+		int member_list_entries,
+    struct in_addr *left_list, void *left_list_private,
+		int left_list_entries,
+    struct in_addr *joined_list, void *joined_list_private,
+		int joined_list_entries)
+{
 
 	int i;
 	struct list_head *list;
@@ -170,15 +177,15 @@ static int evs_confchg_fn (
 	res_evs_confchg_callback.header.error = SA_OK;
 
 	for (i = 0; i < member_list_entries; i++) {
-		res_evs_confchg_callback.member_list[i].s_addr = member_list[i].sin_addr.s_addr;
+		res_evs_confchg_callback.member_list[i].s_addr = member_list[i].s_addr;
 	}
 	res_evs_confchg_callback.member_list_entries = member_list_entries;
 	for (i = 0; i < left_list_entries; i++) {
-		res_evs_confchg_callback.left_list[i].s_addr = left_list[i].sin_addr.s_addr;
+		res_evs_confchg_callback.left_list[i].s_addr = left_list[i].s_addr;
 	}
 	res_evs_confchg_callback.left_list_entries = left_list_entries;
 	for (i = 0; i < joined_list_entries; i++) {
-		res_evs_confchg_callback.joined_list[i].s_addr = joined_list[i].sin_addr.s_addr;
+		res_evs_confchg_callback.joined_list[i].s_addr = joined_list[i].s_addr;
 	}
 	res_evs_confchg_callback.joined_list_entries = joined_list_entries;
 
@@ -336,11 +343,13 @@ static int message_handler_req_evs_leave (struct conn_info *conn_info, void *mes
 
 static int message_handler_req_evs_mcast_joined (struct conn_info *conn_info, void *message)
 {
-	evs_error_t error = EVS_OK;
+	evs_error_t error = EVS_ERR_TRY_AGAIN;
 	struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)message;
 	struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined;
 	struct iovec req_exec_evs_mcast_iovec[3];
 	struct req_exec_evs_mcast req_exec_evs_mcast;
+	int send_ok = 0;
+	int res;
 
 	req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast);
 	req_exec_evs_mcast.header.id = MESSAGE_REQ_EXEC_EVS_MCAST;
@@ -353,9 +362,18 @@ static int message_handler_req_evs_mcast_joined (struct conn_info *conn_info, vo
 	req_exec_evs_mcast_iovec[1].iov_len = conn_info->ais_ci.u.libevs_ci.group_entries * sizeof (struct evs_group);
 	req_exec_evs_mcast_iovec[2].iov_base = &req_lib_evs_mcast_joined->msg;
 	req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len;
-	
-	assert (gmi_mcast (&aisexec_groupname, req_exec_evs_mcast_iovec, 3,
-		req_lib_evs_mcast_joined->priority) == 0);
+// TODO this doesn't seem to work for some reason	
+	send_ok = totempg_send_ok (req_lib_evs_mcast_joined->priority,
+		5000 + req_lib_evs_mcast_joined->msg_len); 
+
+		res = totempg_mcast (req_exec_evs_mcast_iovec, 3, TOTEMPG_AGREED,
+			req_lib_evs_mcast_joined->priority);
+	if (res == 0) {
+		error = EVS_OK;
+	} else {
+		printf ("res is wrong\n");
+	}
+error = EVS_OK;
 
 	res_lib_evs_mcast_joined.header.size = sizeof (struct res_lib_evs_mcast_joined);
 	res_lib_evs_mcast_joined.header.id = MESSAGE_RES_EVS_MCAST_JOINED;
@@ -369,12 +387,14 @@ static int message_handler_req_evs_mcast_joined (struct conn_info *conn_info, vo
 
 static int message_handler_req_evs_mcast_groups (struct conn_info *conn_info, void *message)
 {
-	evs_error_t error = EVS_OK;
+	evs_error_t error = EVS_ERR_TRY_AGAIN;
 	struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)message;
 	struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups;
 	struct iovec req_exec_evs_mcast_iovec[3];
 	struct req_exec_evs_mcast req_exec_evs_mcast;
 	char *msg_addr;
+	int send_ok = 0;
+	int res;
 
 	req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast);
 	req_exec_evs_mcast.header.id = MESSAGE_REQ_EXEC_EVS_MCAST;
@@ -392,8 +412,14 @@ static int message_handler_req_evs_mcast_groups (struct conn_info *conn_info, vo
 	req_exec_evs_mcast_iovec[2].iov_base = msg_addr;
 	req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_groups->msg_len;
 	
-	assert (gmi_mcast (&aisexec_groupname, req_exec_evs_mcast_iovec, 3,
-		req_lib_evs_mcast_groups->priority) == 0);
+// TODO this is wacky
+	send_ok = totempg_send_ok (req_lib_evs_mcast_groups->priority,
+		 5000 + req_lib_evs_mcast_groups->msg_len);
+	res = totempg_mcast (req_exec_evs_mcast_iovec, 3, TOTEMPG_AGREED,
+		req_lib_evs_mcast_groups->priority);
+	if (res == 0) {
+		error = EVS_OK;
+	}
 
 	res_lib_evs_mcast_groups.header.size = sizeof (struct res_lib_evs_mcast_groups);
 	res_lib_evs_mcast_groups.header.id = MESSAGE_RES_EVS_MCAST_GROUPS;
@@ -404,7 +430,7 @@ static int message_handler_req_evs_mcast_groups (struct conn_info *conn_info, vo
 
 	return (0);
 }
-static int message_handler_req_exec_mcast (void *message, struct in_addr source_addr)
+static int message_handler_req_exec_mcast (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_evs_mcast *req_exec_evs_mcast = (struct req_exec_evs_mcast *)message;
 	struct res_evs_deliver_callback res_evs_deliver_callback;
@@ -450,6 +476,7 @@ static int message_handler_req_exec_mcast (void *message, struct in_addr source_
 				req_exec_evs_mcast->msg_len);
 		}
 	}
+//TODO printf ("Got evs message %s\n", msg_addr);
 
 	return (0);
 }

+ 107 - 86
exec/evt.c

@@ -1,4 +1,6 @@
 /*
+ *	vi: set autoindent tabstop=4 shiftwidth=4 :
+ *
  * Copyright (c) 2004 Mark Haverkamp
  * Copyright (c) 2004 Open Source Development Lab
  *
@@ -34,6 +36,8 @@
 #define DUMP_CHAN_INFO
 #define RECOVERY_DEBUG LOG_LEVEL_DEBUG
 #define CHAN_DEL_DEBUG LOG_LEVEL_DEBUG
+#define CHAN_OPEN_DEBUG LOG_LEVEL_DEBUG
+#define REMOTE_OP_DEBUG LOG_LEVEL_DEBUG
 
 #include <sys/types.h>
 #include <malloc.h>
@@ -52,7 +56,7 @@
 #include "mempool.h"
 #include "parse.h"
 #include "main.h"
-#include "gmi.h"
+#include "totempg.h"
 #include "hdb.h"
 #include "clm.h"
 #include "evt.h"
@@ -73,11 +77,15 @@ static int lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
 		void *message);
 static int lib_evt_event_data_get(struct conn_info *conn_info, 
 		void *message);
+
 static int evt_conf_change(
-		enum gmi_configuration_type configuration_type,
-		struct sockaddr_in *member_list, int member_list_entries,
-		struct sockaddr_in *left_list, int left_list_entries,
-		struct sockaddr_in *joined_list, int joined_list_entries);
+		enum totempg_configuration_type configuration_type,
+		struct in_addr *member_list, void *member_list_private,
+			int member_list_entries,
+		struct in_addr *left_list, void *left_list_private,
+			int left_list_entries,
+		struct in_addr *joined_list, void *joined_list_private,
+			int joined_list_entries);
 
 static int evt_initialize(struct conn_info *conn_info, void *msg);
 static int evt_finalize(struct conn_info *conn_info);
@@ -88,58 +96,58 @@ static struct libais_handler evt_libais_handlers[] = {
 	.libais_handler_fn = 	message_handler_req_lib_activatepoll,
 	.response_size = 		sizeof(struct res_lib_activatepoll),
 	.response_id = 			MESSAGE_RES_LIB_ACTIVATEPOLL,
-	.gmi_prio = 			GMI_PRIO_RECOVERY
+	.totempg_prio = 			TOTEMPG_PRIO_RECOVERY
 	},
 	{
 	.libais_handler_fn = 	lib_evt_open_channel,
 	.response_size = 		sizeof(struct res_evt_channel_open),
 	.response_id = 			MESSAGE_RES_EVT_OPEN_CHANNEL,
-	.gmi_prio = 			GMI_PRIO_MED
+	.totempg_prio = 			TOTEMPG_PRIO_MED
 	},
 	{
 	.libais_handler_fn = 	lib_evt_close_channel,
 	.response_size = 		sizeof(struct res_evt_channel_close),
 	.response_id = 			MESSAGE_RES_EVT_CLOSE_CHANNEL,
-	.gmi_prio = 			GMI_PRIO_RECOVERY
+	.totempg_prio = 			TOTEMPG_PRIO_RECOVERY
 	},
 	{
 	.libais_handler_fn = 	lib_evt_event_subscribe,
 	.response_size = 		sizeof(struct res_evt_event_subscribe),
 	.response_id = 			MESSAGE_RES_EVT_SUBSCRIBE,
-	.gmi_prio = 			GMI_PRIO_RECOVERY
+	.totempg_prio = 			TOTEMPG_PRIO_RECOVERY
 	},
 	{
 	.libais_handler_fn = 	lib_evt_event_unsubscribe,
 	.response_size = 		sizeof(struct res_evt_event_unsubscribe),
 	.response_id = 			MESSAGE_RES_EVT_UNSUBSCRIBE,
-	.gmi_prio = 			GMI_PRIO_RECOVERY
+	.totempg_prio = 			TOTEMPG_PRIO_RECOVERY
 	},
 	{
 	.libais_handler_fn = 	lib_evt_event_publish,
 	.response_size = 		sizeof(struct res_evt_event_publish),
 	.response_id = 			MESSAGE_RES_EVT_PUBLISH,
-	.gmi_prio = 			GMI_PRIO_LOW
+	.totempg_prio = 			TOTEMPG_PRIO_LOW
 	},
 	{
 	.libais_handler_fn = 	lib_evt_event_clear_retentiontime,
 	.response_size = 		sizeof(struct res_evt_event_clear_retentiontime),
 	.response_id = 			MESSAGE_REQ_EVT_CLEAR_RETENTIONTIME,
-	.gmi_prio = 			GMI_PRIO_MED
+	.totempg_prio = 			TOTEMPG_PRIO_MED
 	},
 	{
 	.libais_handler_fn = 	lib_evt_event_data_get,
 	.response_size = 		sizeof(struct lib_event_data),
 	.response_id = 			MESSAGE_RES_EVT_EVENT_DATA,
-	.gmi_prio = 			GMI_PRIO_RECOVERY
+	.totempg_prio = 			TOTEMPG_PRIO_RECOVERY
 	},
 };
 
 	
-static int evt_remote_evt(void *msg, struct in_addr source_addr);
-static int evt_remote_recovery_evt(void *msg, struct in_addr source_addr);
-static int evt_remote_chan_op(void *msg, struct in_addr source_addr);
+static int evt_remote_evt(void *msg, struct in_addr source_addr, int endian_conversion_required);
+static int evt_remote_recovery_evt(void *msg, struct in_addr source_addr, int endian_conversion_required);
+static int evt_remote_chan_op(void *msg, struct in_addr source_addr, int endian_conversion_required);
 
-static int (*evt_exec_handler_fns[]) (void *m, struct in_addr s) = {
+static int (*evt_exec_handler_fns[]) (void *m, struct in_addr s, int endian_conversion_required) = {
 	evt_remote_evt,
 	evt_remote_chan_op,
 	evt_remote_recovery_evt
@@ -159,7 +167,7 @@ struct service_handler evt_service_handler = {
 	.exec_dump_fn				= 0
 };
 
-static gmi_recovery_plug_handle evt_recovery_plug_handle;
+// TODOstatic totempg_recovery_plug_handle evt_recovery_plug_handle;
 
 /* 
  * list of all retained events 
@@ -394,7 +402,7 @@ DECLARE_LIST_INIT(mnd);
  * checked_in:		keep track during config change.
  * any_joined:		did any nodes join on this change?
  * recovery_node:	True if we're the recovery node.
- * tok_call_handle:	gmi token callback handle for recovery.
+ * tok_call_handle:	totempg token callback handle for recovery.
  * next_retained:	pointer to next retained message to send during recovery.
  * next_chan:		pointer to next channel to send during recovery.
  *
@@ -835,7 +843,10 @@ static SaErrorT evt_open_channel(SaNameT *cn, SaUint8T flgs)
 	cpkt.u.chc_chan = *cn;
 	chn_iovec.iov_base = &cpkt;
 	chn_iovec.iov_len = cpkt.chc_head.size;
-	res = gmi_mcast (&aisexec_groupname, &chn_iovec, 1, GMI_PRIO_MED);
+	log_printf(CHAN_OPEN_DEBUG, "evt_open_channel: Send open mcast\n");
+	res = totempg_mcast (&chn_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED);
+	log_printf(CHAN_OPEN_DEBUG, "evt_open_channel: Open mcast result: %d\n",
+				res);
 	if (res != 0) {
 			ret = SA_ERR_SYSTEM;
 	}
@@ -868,7 +879,7 @@ static SaErrorT evt_close_channel(SaNameT *cn)
 	cpkt.u.chc_chan = *cn;
 	chn_iovec.iov_base = &cpkt;
 	chn_iovec.iov_len = cpkt.chc_head.size;
-	res = gmi_mcast (&aisexec_groupname, &chn_iovec, 1, GMI_PRIO_MED);
+	res = totempg_mcast (&chn_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED);
 	if (res != 0) {
 			ret = SA_ERR_SYSTEM;
 	}
@@ -1044,8 +1055,7 @@ static int send_next_retained(void *data)
 			evt->ed_event.led_head.id = MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA;
 			chn_iovec.iov_base = &evt->ed_event;
 			chn_iovec.iov_len = evt->ed_event.led_head.size;
-			res = gmi_mcast(&aisexec_groupname, &chn_iovec, 1, 
-				GMI_PRIO_RECOVERY);
+			res = totempg_mcast(&chn_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_RECOVERY);
 
 			if (res != 0) {
 			/*
@@ -1061,8 +1071,7 @@ static int send_next_retained(void *data)
 		cpkt.chc_op = EVT_CONF_DONE;
 		chn_iovec.iov_base = &cpkt;
 		chn_iovec.iov_len = cpkt.chc_head.size;
-		res = gmi_mcast (&aisexec_groupname, &chn_iovec, 1, 
-												GMI_PRIO_RECOVERY);
+		res = totempg_mcast (&chn_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_RECOVERY);
 	}
 	tok_call_handle = 0;
 	return 0;
@@ -1076,7 +1085,7 @@ static void send_retained()
 {
 	struct req_evt_chan_command cpkt;
 	struct iovec chn_iovec;
-	int res;
+	int res = 0;
 
 	if (list_empty(&retained_list) || !any_joined) {
 		memset(&cpkt, 0, sizeof(cpkt));
@@ -1086,15 +1095,14 @@ static void send_retained()
 		chn_iovec.iov_base = &cpkt;
 		chn_iovec.iov_len = cpkt.chc_head.size;
 		log_printf(RECOVERY_DEBUG, "No messages to send\n");
-		res = gmi_mcast (&aisexec_groupname, &chn_iovec, 1, 
-											GMI_PRIO_RECOVERY);
+		res = totempg_mcast (&chn_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_RECOVERY);
 	} else {
 		log_printf(RECOVERY_DEBUG, 
 					"Start sending retained messages\n");
 		recovery_node = 1;
 		next_retained = retained_list.next;
-		res = gmi_token_callback_create(&tok_call_handle, send_next_retained,
-				NULL);
+// TODO		res = totempg_token_callback_create(&tok_call_handle, send_next_retained,
+//				NULL);
 	}
 	if (res != 0) {
 		log_printf(LOG_LEVEL_ERROR, "ERROR sending evt recovery data\n");
@@ -1130,8 +1138,8 @@ static int send_next_open_count(void *data)
 			cpkt.u.chc_set_opens.chc_open_count = eci->esc_local_opens;
 			chn_iovec.iov_base = &cpkt;
 			chn_iovec.iov_len = cpkt.chc_head.size;
-			res = gmi_mcast(&aisexec_groupname, &chn_iovec, 1, 
-				GMI_PRIO_RECOVERY);
+			res = totempg_mcast(&chn_iovec, 1,TOTEMPG_AGREED,  
+				TOTEMPG_PRIO_RECOVERY);
 
 			if (res != 0) {
 			/*
@@ -1147,8 +1155,8 @@ static int send_next_open_count(void *data)
 		cpkt.chc_op = EVT_OPEN_COUNT_DONE;
 		chn_iovec.iov_base = &cpkt;
 		chn_iovec.iov_len = cpkt.chc_head.size;
-		res = gmi_mcast (&aisexec_groupname, &chn_iovec, 1, 
-												GMI_PRIO_RECOVERY);
+		res = totempg_mcast (&chn_iovec, 1,TOTEMPG_AGREED,  
+												TOTEMPG_PRIO_RECOVERY);
 	}
 	tok_call_handle = 0;
 	return 0;
@@ -1172,14 +1180,14 @@ static void send_open_count()
 		chn_iovec.iov_base = &cpkt;
 		chn_iovec.iov_len = cpkt.chc_head.size;
 		log_printf(RECOVERY_DEBUG, "No channels to send\n");
-		res = gmi_mcast (&aisexec_groupname, &chn_iovec, 1, 
-											GMI_PRIO_RECOVERY);
+		res = totempg_mcast (&chn_iovec, 1,TOTEMPG_AGREED,  
+											TOTEMPG_PRIO_RECOVERY);
 	} else {
 		log_printf(RECOVERY_DEBUG, 
 					"Start sending open channel count\n");
 		next_chan = esc_head.next;
-		res = gmi_token_callback_create(&tok_call_handle, send_next_open_count,
-				NULL);
+// TODO		res = totempg_token_callback_create(&tok_call_handle, send_next_open_count,
+//				NULL);
 	}
 	if (res != 0) {
 		log_printf(LOG_LEVEL_ERROR, "ERROR sending evt recovery data\n");
@@ -1712,7 +1720,7 @@ deliver_event(struct event_data *evt,
 		ep = malloc(sizeof(*ep));
 		if (!ep) {
 			log_printf(LOG_LEVEL_WARNING, 
-						"Memory allocation error, can't deliver event\n");
+						"3Memory allocation error, can't deliver event\n");
 			return;
 		}
 		evt->ed_ref_count++;
@@ -1734,7 +1742,7 @@ deliver_event(struct event_data *evt,
 		ed = malloc(dropped_event_size);
 		if (!ed) {
 			log_printf(LOG_LEVEL_WARNING, 
-						"Memory allocation error, can't deliver event\n");
+						"4Memory allocation error, can't deliver event\n");
 			return;
 		}
 		log_printf(LOG_LEVEL_DEBUG, "Warn 0x%0llx\n", 
@@ -1746,7 +1754,7 @@ deliver_event(struct event_data *evt,
 		ep = malloc(sizeof(*ep));
 		if (!ep) {
 			log_printf(LOG_LEVEL_WARNING, 
-						"Memory allocation error, can't deliver event\n");
+						"5Memory allocation error, can't deliver event\n");
 			return;
 		}
 		ep->cel_chan_handle = eco->eco_lib_handle;
@@ -1911,7 +1919,6 @@ static int evt_initialize(struct conn_info *conn_info, void *msg)
  */
 static int lib_evt_open_channel(struct conn_info *conn_info, void *message)
 {
-	uint32_t handle;
 	SaErrorT error;
 	struct req_evt_channel_open *req;
 	struct res_evt_channel_open res;
@@ -1922,13 +1929,13 @@ static int lib_evt_open_channel(struct conn_info *conn_info, void *message)
 	req = message;
 
 
-	log_printf(LOG_LEVEL_DEBUG, 
+	log_printf(CHAN_OPEN_DEBUG, 
 			"saEvtChannelOpen (Open channel request)\n");
-	log_printf(LOG_LEVEL_DEBUG, 
+	log_printf(CHAN_OPEN_DEBUG, 
 			"handle 0x%x, to 0x%llx\n",
 			req->ico_c_handle,
 			req->ico_timeout);
-	log_printf(LOG_LEVEL_DEBUG, "flags %x, channel name(%d)  %s\n",
+	log_printf(CHAN_OPEN_DEBUG, "flags %x, channel name(%d)  %s\n",
 			req->ico_open_flag,
 			req->ico_channel_name.length,
 			req->ico_channel_name.value);
@@ -1976,7 +1983,6 @@ open_return:
 	res.ico_head.size = sizeof(res);
 	res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
 	res.ico_head.error = error;
-	res.ico_channel_handle = handle;
 	libais_send_response (conn_info, &res, sizeof(res));
 
 	return 0;
@@ -2326,7 +2332,7 @@ static int lib_evt_event_publish(struct conn_info *conn_info, void *message)
 	 */
 	pub_iovec.iov_base = req;
 	pub_iovec.iov_len = req->led_head.size;
-	result = gmi_mcast (&aisexec_groupname, &pub_iovec, 1, GMI_PRIO_LOW);
+	result = totempg_mcast (&pub_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_LOW);
 	if (result != 0) {
 			error = SA_ERR_SYSTEM;
 	}
@@ -2371,7 +2377,7 @@ static int lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
 	cpkt.u.chc_event_id = req->iec_event_id;
 	rtn_iovec.iov_base = &cpkt;
 	rtn_iovec.iov_len = cpkt.chc_head.size;
-	ret = gmi_mcast (&aisexec_groupname, &rtn_iovec, 1, GMI_PRIO_MED);
+	ret = totempg_mcast (&rtn_iovec, 1, TOTEMPG_AGREED, TOTEMPG_PRIO_MED);
 	if (ret != 0) {
 			error = SA_ERR_SYSTEM;
 	}
@@ -2464,10 +2470,13 @@ static void remove_chan_open_info(SaClmNodeIdT node_id)
  * received for each node for the detection of duplicate events.
  */
 static int evt_conf_change(
-		enum gmi_configuration_type configuration_type,
-		struct sockaddr_in *member_list, int member_list_entries,
-		struct sockaddr_in *left_list, int left_list_entries,
-		struct sockaddr_in *joined_list, int joined_list_entries)
+		enum totempg_configuration_type configuration_type,
+		struct in_addr *member_list, void *member_list_private,
+			int member_list_entries,
+		struct in_addr *left_list, void *left_list_private,
+			int left_list_entries,
+		struct in_addr *joined_list, void *joined_list_private,
+			int joined_list_entries)
 {
 	struct in_addr my_node = {SA_CLM_LOCAL_NODE_ID};
 	SaClmClusterNodeT *cn;
@@ -2480,6 +2489,17 @@ static int evt_conf_change(
 	int res;
 
 
+	/*
+	 * Set the base event id
+	 */
+	cn = clm_get_by_nodeid(my_node);
+	if (!base_id_top) {
+		log_printf(RECOVERY_DEBUG, "My node ID 0x%x\n", cn->nodeId);
+		my_node_id = cn->nodeId;
+		set_event_id(my_node_id);
+	}
+
+	return (0); // TODO 
 	log_printf(LOG_LEVEL_DEBUG, "Evt conf change %d\n", 
 			configuration_type);
 	log_printf(LOG_LEVEL_DEBUG, "m %d, j %d, l %d\n", 
@@ -2490,7 +2510,7 @@ static int evt_conf_change(
 	 * Stop any recovery callbacks in progress.
 	 */
 	if (tok_call_handle) {
-		gmi_token_callback_destroy(tok_call_handle);
+// TODO		totempg_token_callback_destroy(tok_call_handle);
 		tok_call_handle = 0;
 	}
 
@@ -2501,12 +2521,12 @@ static int evt_conf_change(
 	 * list.  Always use the left list for removing nodes.
 	 */
 	if (first) {
-			add_list = member_list;
-			add_count = member_list_entries;
+//j			add_list = member_list;
+//			add_count = member_list_entries;
 			first = 0;
 	} else {
-			add_list = joined_list;
-			add_count = joined_list_entries;
+//			add_list = joined_list;
+//			add_count = joined_list_entries;
 	}
 
 	while (add_count--) {
@@ -2531,8 +2551,8 @@ static int evt_conf_change(
 										md->mn_last_evt_id & BASE_ID_MASK;
 				chn_iovec.iov_base = &cpkt;
 				chn_iovec.iov_len = cpkt.chc_head.size;
-				res = gmi_mcast (&aisexec_groupname, &chn_iovec, 1, 
-														GMI_PRIO_RECOVERY);
+				res = totempg_mcast (&chn_iovec, 1,TOTEMPG_AGREED,  
+														TOTEMPG_PRIO_RECOVERY);
 				if (res != 0) {
 					log_printf(LOG_LEVEL_WARNING, 
 						"Unable to send event id to %s\n", 
@@ -2544,39 +2564,29 @@ static int evt_conf_change(
 	}
 
 	while (left_list_entries--) {
-		md = evt_find_node(left_list->sin_addr);
+// TODO		md = evt_find_node(left_list);
 		if (md == 0) {
 			log_printf(LOG_LEVEL_WARNING, 
 					"Can't find cluster node at %s\n",
-							inet_ntoa(left_list->sin_addr));
+							inet_ntoa(left_list[0]));
 		/*
 		 * Mark this one as down.
 		 */
 		} else {
 			log_printf(RECOVERY_DEBUG, "cluster node at %s down\n",
-							inet_ntoa(left_list->sin_addr));
+							inet_ntoa(left_list[0]));
 			md->mn_started = 0;
 			remove_chan_open_info(md->mn_node_info.nodeId);
 		}
 		left_list++;
 	}
 
-	/*
-	 * Set the base event id
-	 */
-	cn = clm_get_by_nodeid(my_node);
-	if (!base_id_top) {
-		log_printf(RECOVERY_DEBUG, "My node ID 0x%x\n", cn->nodeId);
-		my_node_id = cn->nodeId;
-		set_event_id(my_node_id);
-	}
-
 
 	/*
 	 * Notify that a config change happened.  The exec handler will
 	 * then determine what to do.
 	 */
-	if (configuration_type == GMI_CONFIGURATION_REGULAR) {
+	if (configuration_type == TOTEMPG_CONFIGURATION_REGULAR) {
 		if (in_cfg_change) {
 			log_printf(LOG_LEVEL_NOTICE, 
 				"Already in config change, Starting over, m %d, c %d\n",
@@ -2637,15 +2647,17 @@ static int evt_finalize(struct conn_info *conn_info)
  */
 static int evt_exec_init(void)
 {
-	int res;
 	log_printf(LOG_LEVEL_DEBUG, "Evt exec init request\n");
 
-	res = gmi_recovery_plug_create (&evt_recovery_plug_handle);
+#ifdef TODO
+	int res;
+	res = totempg_recovery_plug_create (&evt_recovery_plug_handle);
 	if (res != 0) {
 		log_printf(LOG_LEVEL_ERROR,
 			"Could not create recovery plug for event service.\n");
 		return (-1);
 	}
+#endif
 
 	/*
 	 * Create an event to be sent when we have to drop messages
@@ -2656,7 +2668,7 @@ static int evt_exec_init(void)
 	if (dropped_event == 0) {
 		log_printf(LOG_LEVEL_ERROR, 
 				"Memory Allocation Failure, event service not started\n");
-		res = gmi_recovery_plug_destroy (evt_recovery_plug_handle);
+// TODO		res = totempg_recovery_plug_destroy (evt_recovery_plug_handle);
 		errno = ENOMEM;
 		return -1;
 	}
@@ -2679,7 +2691,7 @@ static int evt_exec_init(void)
 /*
  * Receive the network event message and distribute it to local subscribers
  */
-static int evt_remote_evt(void *msg, struct in_addr source_addr)
+static int evt_remote_evt(void *msg, struct in_addr source_addr, int endian_conversion_required)
 {
 	/*
 	 * - retain events that have a retention time
@@ -2737,7 +2749,7 @@ static int evt_remote_evt(void *msg, struct in_addr source_addr)
 	evt = make_local_event(evtpkt, eci);
 	if (!evt) {
 		log_printf(LOG_LEVEL_WARNING, 
-						"Memory allocation error, can't deliver event\n");
+						"1Memory allocation error, can't deliver event\n");
 		errno = ENOMEM;
 		return -1;
 	}
@@ -2796,7 +2808,7 @@ inline SaTimeT calc_retention_time(SaTimeT retention,
 /*
  * Receive a recovery network event message and save it in the retained list
  */
-static int evt_remote_recovery_evt(void *msg, struct in_addr source_addr)
+static int evt_remote_recovery_evt(void *msg, struct in_addr source_addr, int endian_conversion_required)
 {
 	/*
 	 * - retain events that have a retention time
@@ -2879,7 +2891,7 @@ static int evt_remote_recovery_evt(void *msg, struct in_addr source_addr)
 		evt = make_local_event(evtpkt, eci);
 		if (!evt) {
 			log_printf(LOG_LEVEL_WARNING, 
-				"Memory allocation error, can't deliver event\n");
+				"2Memory allocation error, can't deliver event\n");
 			errno = ENOMEM;
 			return -1;
 		}
@@ -2923,6 +2935,8 @@ static void evt_chan_open_finish(struct open_chan_pending *ocp,
 	int ret = 0;
 	void *ptr;
 
+	log_printf(CHAN_OPEN_DEBUG, "Open channel finish %s\n", 
+											getSaNameT(&ocp->ocp_chan_name));
 	if (!ocp->ocp_async && ocp->ocp_timer_handle) {
 		ret = poll_timer_delete(aisexec_poll_handle, ocp->ocp_timer_handle);
 		if (ret != 0 ) {
@@ -2966,6 +2980,9 @@ static void evt_chan_open_finish(struct open_chan_pending *ocp,
 	 */
 	saHandleInstancePut(&esip->esi_hdb, handle);
 open_return:
+	log_printf(CHAN_OPEN_DEBUG, "Open channel finish %s send response %d\n", 
+											getSaNameT(&ocp->ocp_chan_name),
+											error);
 	res.ico_head.size = sizeof(res);
 	res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
 	res.ico_head.error = error;
@@ -2984,7 +3001,7 @@ open_return:
  * Used to communicate channel opens/closes, clear retention time,
  * config change updates...
  */
-static int evt_remote_chan_op(void *msg, struct in_addr source_addr)
+static int evt_remote_chan_op(void *msg, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_evt_chan_command *cpkt = msg;
 	struct in_addr local_node = {SA_CLM_LOCAL_NODE_ID};
@@ -2993,8 +3010,9 @@ static int evt_remote_chan_op(void *msg, struct in_addr source_addr)
 	struct event_svr_channel_instance *eci;
 
 
-	log_printf(LOG_LEVEL_DEBUG, "Remote channel operation request\n");
+	log_printf(REMOTE_OP_DEBUG, "Remote channel operation request\n");
 	my_node = clm_get_by_nodeid(local_node);
+	log_printf(REMOTE_OP_DEBUG, "my node ID: 0x%x\n", my_node->nodeId);
 
 	mn = evt_find_node(source_addr);
 	if (mn == NULL) {
@@ -3024,7 +3042,7 @@ static int evt_remote_chan_op(void *msg, struct in_addr source_addr)
 		struct open_chan_pending *ocp;
 		struct list_head *l, *nxt;
 
-		log_printf(LOG_LEVEL_DEBUG, "Opening channel %s for node 0x%x\n",
+		log_printf(CHAN_OPEN_DEBUG, "Opening channel %s for node 0x%x\n",
 						cpkt->u.chc_chan.value, mn->mn_node_info.nodeId);
 		eci = find_channel(&cpkt->u.chc_chan);
 
@@ -3046,15 +3064,18 @@ static int evt_remote_chan_op(void *msg, struct in_addr source_addr)
 			for (l = open_pending.next; l != &open_pending; l = nxt) {
 				nxt = l->next;
 				ocp = list_entry(l, struct open_chan_pending, ocp_entry);
+				log_printf(CHAN_OPEN_DEBUG, 
+				"Compare channel %s %s\n", ocp->ocp_chan_name.value,
+						eci->esc_channel_name.value);
 				if (name_match(&ocp->ocp_chan_name, &eci->esc_channel_name)) {
 					evt_chan_open_finish(ocp, eci);
 					break;
 				}
 			}
 		}
-		log_printf(LOG_LEVEL_DEBUG, 
+		log_printf(CHAN_OPEN_DEBUG, 
 				"Open channel %s t %d, l %d, r %d\n",
-				eci->esc_channel_name.value,
+				getSaNameT(&eci->esc_channel_name),
 				eci->esc_total_opens, eci->esc_local_opens,
 				eci->esc_retained_count);
 		break;
@@ -3199,7 +3220,7 @@ static int evt_remote_chan_op(void *msg, struct in_addr source_addr)
 				"Receive EVT_CONF_DONE from %s\n", 
 				inet_ntoa(source_addr));
 		in_cfg_change = 0;
-		gmi_recovery_plug_unplug (evt_recovery_plug_handle);
+// TODO		totempg_recovery_plug_unplug (evt_recovery_plug_handle);
 #ifdef DUMP_CHAN_INFO
 		dump_all_chans();
 #endif

+ 7 - 5
include/sq.h

@@ -96,7 +96,7 @@ static inline int sq_item_add (
 	}
 	sq_position = (sq->head + seqid - sq->head_seqid) % sq->size;
 
-//printf ("item add %d %d %d\n", sq_position, seqid, sq->head_seqid);
+//printf ("item add position %d seqid %d head seqid %d\n", sq_position, seqid, sq->head_seqid);
 	sq_item = sq->items;
 	sq_item += sq_position * sq->size_per_item;
 	assert(sq->items_inuse[sq_position] == 0);
@@ -117,11 +117,13 @@ static inline int sq_item_inuse (
 	 * be here in the first place.
 	 * To keep old messages from being inserted.
 	 */
+#ifdef COMPILE_OUT
 	if (seq_id < sq->head_seqid) {
 		fprintf(stderr, "sq_item_inuse: seqid %d, head %d\n", 
 						seq_id, sq->head_seqid);
 		return 1;
 	}
+#endif
 	sq_position = (sq->head - sq->head_seqid + seq_id) % sq->size;
 //printf ("in use %d\n", sq_position);
 	return (sq->items_inuse[sq_position]);
@@ -150,7 +152,7 @@ if (seq_id == -1) {
 assert (sq_position >= 0);
 //printf ("itme get in use %d\n", sq_position);
 	if (sq->items_inuse[sq_position] == 0) {
-//printf ("ENOENT\n");
+//printf ("not in use %d\n", sq_position);
 		return (ENOENT);
 	}
 	sq_item = sq->items;
@@ -171,12 +173,12 @@ static inline void sq_items_release (struct sq *sq, int seqid)
 
 	sq->head = (sq->head + seqid - sq->head_seqid + 1) % sq->size;
 	if ((oldhead + seqid - sq->head_seqid + 1) > sq->size) {
-		//printf ("releasing %d for %d\n", oldhead, sq->size - oldhead);
-		//printf ("releasing %d for %d\n", 0, sq->head);
+//		printf ("releasing %d for %d\n", oldhead, sq->size - oldhead);
+//		printf ("releasing %d for %d\n", 0, sq->head);
 		memset (&sq->items_inuse[oldhead], 0, sq->size - oldhead);
 		memset (sq->items_inuse, 0, sq->head * sizeof (char));
 	} else {
-		//printf ("releasing %d for %d\n", oldhead, seqid - sq->head_seqid + 1);
+//		printf ("releasing %d for %d\n", oldhead, seqid - sq->head_seqid + 1);
 		memset (&sq->items_inuse[oldhead], 0,
 			(seqid - sq->head_seqid + 1) * sizeof (char));
 	}

+ 1 - 1
lib/Makefile

@@ -86,5 +86,5 @@ clm.o: ../include/ais_types.h ../include/ais_clm.h ../include/ais_types.h
 clm.o: ../include/ais_msg.h util.h
 ckpt.o: ../include/list.h ../include/ais_types.h ../include/ais_ckpt.h
 ckpt.o: ../include/ais_types.h ../include/ais_msg.h util.h
-evt.o: ../include/ais_evt.h ../include/ais_types.h ../include/ais_msg.h ../exec/gmi.h ../exec/aispoll.h
+evt.o: ../include/ais_evt.h ../include/ais_types.h ../include/ais_msg.h
 evt.o: util.h

+ 2 - 2
lib/amf.c

@@ -246,6 +246,7 @@ saAmfDispatch (
 		 */
 		if (amfInstance->finalize == 1) {
 			error = SA_OK;
+			pthread_mutex_unlock (&amfInstance->mutex);
 			goto error_unlock;
 		}
 
@@ -391,9 +392,8 @@ saAmfDispatch (
 	} while (cont);
 
 error_unlock:
-	pthread_mutex_unlock (&amfInstance->mutex);
-error_nounlock:
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+error_nounlock:
 	return (error);
 }
 

+ 2 - 2
lib/clm.c

@@ -224,6 +224,7 @@ saClmDispatch (
 		 */
 		if (clmInstance->finalize == 1) {
 			error = SA_OK;
+			pthread_mutex_unlock (&clmInstance->mutex);
 			goto error_unlock;
 		}
 
@@ -324,9 +325,8 @@ saClmDispatch (
 	} while (cont);
 
 error_unlock:
-	pthread_mutex_unlock (&clmInstance->mutex);
-error_nounlock:
 	saHandleInstancePut (&clmHandleDatabase, *clmHandle);
+error_nounlock:
 	return (error);
 }
 

+ 1 - 2
lib/evs.c

@@ -373,9 +373,8 @@ evs_error_t evs_dispatch (
 	} while (cont);
 
 error_unlock:
-	pthread_mutex_unlock (&evs_inst->mutex);
-error_nounlock:
 	saHandleInstancePut (&evs_handle_t_db, *handle);
+error_nounlock:
 	return (error);
 }
 

+ 1 - 1
lib/evt.c

@@ -41,8 +41,8 @@
 #include <sys/socket.h>
 #include "../include/ais_evt.h"
 #include "../include/ais_msg.h"
-#include "../exec/gmi.h"
 #include "util.h"
+#include "../exec/totempg.h"
 
 static void evtHandleInstanceDestructor(void *instance);
 static void chanHandleInstanceDestructor(void *instance);