Просмотр исходного кода

API changes and code to make cfg and cpg service operate properly with corosync.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1600 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 лет назад
Родитель
Сommit
aa1cd3c1f6

+ 1 - 1
corosync/Makefile.inc

@@ -38,7 +38,7 @@ endif
 # OPENAIS_BUILD can be defined as RELEASE or DEBUG
 #
 ifndef OPENAIS_BUILD
-	OPENAIS_BUILD=RELEASE
+	OPENAIS_BUILD=DEBUG
 endif
 
 # OPENAIS_PROFILE

+ 0 - 1
corosync/exec/Makefile

@@ -1,5 +1,4 @@
 # Copyright (c) 2002-2006 MontaVista Software, Inc.
-# Copyright (c) 2006 Sun Microsystems, Inc.
 # Copyright (c) 2006-2008 Red Hat, Inc.
 # 
 # All rights reserved.

+ 1 - 1
corosync/exec/coropoll.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003-2004 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 22 - 22
corosync/exec/flow.c

@@ -34,9 +34,9 @@
 
 /*
  * New messages are allowed from the library ONLY when the processor has not
- * received a OPENAIS_FLOW_CONTROL_STATE_ENABLED from any processor.  If a
- * OPENAIS_FLOW_CONTROL_STATE_ENABLED message is sent, it must later be
- *  cancelled by a OPENAIS_FLOW_CONTROL_STATE_DISABLED message.  A configuration
+ * received a COROSYNC_FLOW_CONTROL_STATE_ENABLED from any processor.  If a
+ * COROSYNC_FLOW_CONTROL_STATE_ENABLED message is sent, it must later be
+ *  cancelled by a COROSYNC_FLOW_CONTROL_STATE_DISABLED message.  A configuration
  * change with the flow controlled processor leaving the configuration will
  * also cancel flow control.
  */
@@ -67,12 +67,12 @@ struct flow_control_message {
 	unsigned int service __attribute__((aligned(8)));
 	char id[1024] __attribute__((aligned(8)));
 	unsigned int id_len __attribute__((aligned(8)));
-	enum openais_flow_control_state flow_control_state __attribute__((aligned(8)));
+	enum corosync_flow_control_state flow_control_state __attribute__((aligned(8)));
 };
 
 struct flow_control_node_state {
 	unsigned int nodeid;
-	enum openais_flow_control_state flow_control_state;
+	enum corosync_flow_control_state flow_control_state;
 };
 
 struct flow_control_service {
@@ -80,10 +80,10 @@ struct flow_control_service {
 	unsigned int service;
 	char id[1024];
 	unsigned int id_len;
-	void (*flow_control_state_set_fn) (void *context, enum openais_flow_control_state flow_control_state);
+	void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state);
 	void *context;
 	unsigned int processor_count;
-	enum openais_flow_control_state flow_control_state;
+	enum corosync_flow_control_state flow_control_state;
 	struct list_head list;
 	struct list_head list_all;
 };
@@ -107,7 +107,7 @@ static unsigned int flow_control_member_list_entries;
 
 static inline int flow_control_xmit (
 	struct flow_control_service *flow_control_service,
-	enum openais_flow_control_state flow_control_state)
+	enum corosync_flow_control_state flow_control_state)
 {
 	struct flow_control_message flow_control_message;
 	struct iovec iovec;
@@ -164,11 +164,11 @@ static void flow_control_deliver_fn (
 		 * Determine if any flow control is enabled on any nodes and set
 		 * the internal variable appropriately
 		 */
-		flow_control_service->flow_control_state = OPENAIS_FLOW_CONTROL_STATE_DISABLED;
+		flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED;
 		flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state);
 		for (i = 0; i < flow_control_service->processor_count; i++) {
-			if (flow_control_service->flow_control_node_state[i].flow_control_state == OPENAIS_FLOW_CONTROL_STATE_ENABLED) {
-				flow_control_service->flow_control_state = OPENAIS_FLOW_CONTROL_STATE_ENABLED;
+			if (flow_control_service->flow_control_node_state[i].flow_control_state == COROSYNC_FLOW_CONTROL_STATE_ENABLED) {
+				flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED;
 				flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state);
 			}
 		}
@@ -203,7 +203,7 @@ static void flow_control_confchg_fn (
 		 */
 		for (i = 0; i < member_list_entries; i++) {
 			flow_control_node_state_temp[i].nodeid = member_list[i];
-			flow_control_node_state_temp[i].flow_control_state = OPENAIS_FLOW_CONTROL_STATE_DISABLED;
+			flow_control_node_state_temp[i].flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED;
 
 			/*
 			 * Determine if previous state was set for this processor
@@ -230,10 +230,10 @@ static void flow_control_confchg_fn (
 		 * Turn on all flow control after a configuration change
 		 */
 		flow_control_service->processor_count = flow_control_member_list_entries;
-		flow_control_service->flow_control_state = OPENAIS_FLOW_CONTROL_STATE_DISABLED;
+		flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED;
 		for (i = 0; i < member_list_entries; i++) {
-			if (flow_control_service->flow_control_node_state[i].flow_control_state == OPENAIS_FLOW_CONTROL_STATE_ENABLED) {
-				flow_control_service->flow_control_state = OPENAIS_FLOW_CONTROL_STATE_ENABLED;
+			if (flow_control_service->flow_control_node_state[i].flow_control_state == COROSYNC_FLOW_CONTROL_STATE_ENABLED) {
+				flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED;
 				flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state);
 			}
 		}
@@ -312,7 +312,7 @@ unsigned int openais_flow_control_create (
 	unsigned int service,
 	void *id,
 	unsigned int id_len,
-	void (*flow_control_state_set_fn) (void *context, enum openais_flow_control_state flow_control_state),
+	void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state),
 	void *context)
 {
 	struct flow_control_service *flow_control_service;
@@ -336,7 +336,7 @@ unsigned int openais_flow_control_create (
 	 */
 	memset (flow_control_service, 0, sizeof (struct flow_control_service));
 
-	flow_control_service->flow_control_state = OPENAIS_FLOW_CONTROL_STATE_DISABLED;
+	flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED;
 	flow_control_service->service = service;
 	memcpy (flow_control_service->id, id, id_len);
 	flow_control_service->id_len = id_len;
@@ -388,7 +388,7 @@ unsigned int openais_flow_control_destroy (
 		if ((flow_control_service->id_len == id_len) &&
 			(memcmp (flow_control_service->id, id, id_len) == 0)) {
 			flow_control_xmit (flow_control_service,
-				OPENAIS_FLOW_CONTROL_STATE_DISABLED);
+				COROSYNC_FLOW_CONTROL_STATE_DISABLED);
 			list_del (&flow_control_service->list);
 			list_del (&flow_control_service->list_all);
 			free (flow_control_service);
@@ -424,8 +424,8 @@ unsigned int openais_flow_control_disable (
 		list = list->next) {
 
 		flow_control_service = list_entry (list, struct flow_control_service, list);
-		flow_control_service->flow_control_state = OPENAIS_FLOW_CONTROL_STATE_DISABLED;
-		flow_control_xmit (flow_control_service, OPENAIS_FLOW_CONTROL_STATE_DISABLED);
+		flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED;
+		flow_control_xmit (flow_control_service, COROSYNC_FLOW_CONTROL_STATE_DISABLED);
 	}
 	hdb_handle_put (&flow_control_hdb, flow_control_handle);
 
@@ -457,8 +457,8 @@ unsigned int openais_flow_control_enable (
 
 
 		flow_control_service = list_entry (list, struct flow_control_service, list);
-		flow_control_service->flow_control_state = OPENAIS_FLOW_CONTROL_STATE_ENABLED;
-		flow_control_xmit (flow_control_service, OPENAIS_FLOW_CONTROL_STATE_ENABLED);
+		flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED;
+		flow_control_xmit (flow_control_service, COROSYNC_FLOW_CONTROL_STATE_ENABLED);
 	}
 	hdb_handle_put (&flow_control_hdb, flow_control_handle);
 

+ 5 - 4
corosync/exec/flow.h

@@ -36,9 +36,10 @@
 #ifndef FLOW_H_DEFINED
 #define FLOW_H_DEFINED
 
-enum openais_flow_control_state {
-	OPENAIS_FLOW_CONTROL_STATE_DISABLED,
-	OPENAIS_FLOW_CONTROL_STATE_ENABLED
+#define COROSYNC_FLOW_CONTROL_STATE
+enum corosync_flow_control_state {
+	COROSYNC_FLOW_CONTROL_STATE_DISABLED,
+	COROSYNC_FLOW_CONTROL_STATE_ENABLED
 };
 
 unsigned int openais_flow_control_initialize (void);
@@ -55,7 +56,7 @@ unsigned int openais_flow_control_create (
 	unsigned int service,
 	void *id,
 	unsigned int id_len,
-	void (*flow_control_state_set_fn) (void *context, enum openais_flow_control_state flow_control_state),
+	void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state),
 	void *context);
 
 unsigned int openais_flow_control_destroy (

+ 12 - 12
corosync/exec/ipc.c

@@ -83,8 +83,8 @@
 #include "objdb.h"
 #include "config.h"
 #include "tlist.h"
-#define LOG_SERVICE LOG_SERVICE_IPC
 #include "logsys.h"
+#include "coroapi.h"
 
 #include "util.h"
 
@@ -149,7 +149,7 @@ struct conn_info {
 	unsigned int flow_control_handle;	/* flow control identifier */
 	unsigned int flow_control_enabled;	/* flow control enabled bit */
 	unsigned int flow_control_local_count;	/* flow control local count */
-	enum openais_flow_control flow_control;	/* Does this service use IPC flow control */
+	enum corosync_lib_flow_control flow_control;	/* Does this service use IPC flow control */
 	pthread_mutex_t flow_control_mutex;
         int (*lib_exit_fn) (void *conn);
 	struct timerlist timerlist;
@@ -292,7 +292,7 @@ static int dispatch_init_send_response (
 
 	conn_info->flow_control = ais_service[conn_info->service]->flow_control;
 	conn_info->conn_info_partner->flow_control = ais_service[conn_info->service]->flow_control;
-	if (ais_service[conn_info->service]->flow_control == OPENAIS_FLOW_CONTROL_REQUIRED) {
+	if (ais_service[conn_info->service]->flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) {
 		openais_flow_control_ipc_init (
 			&conn_info->flow_control_handle,
 			conn_info->service);
@@ -629,7 +629,7 @@ static void ipc_flow_control (struct conn_info *conn_info)
 	/*
 	 * IPC group-wide flow control
 	 */
-	if (conn_info->flow_control == OPENAIS_FLOW_CONTROL_REQUIRED) {
+	if (conn_info->flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) {
 		if (conn_info->flow_control_enabled == 0 &&
 			((fcc + FLOW_CONTROL_ENTRIES_ENABLE) > SIZEQUEUE)) {
 
@@ -875,9 +875,9 @@ retry_recv:
 			/*
 			 * Not an init service, but a standard service
 			 */
-			if (header->id < 0 || header->id > ais_service[service]->lib_service_count) {
+			if (header->id < 0 || header->id > ais_service[service]->lib_engine_count) {
 				log_printf (LOG_LEVEL_SECURITY, "Invalid header id is %d min 0 max %d\n",
-				header->id, ais_service[service]->lib_service_count);
+				header->id, ais_service[service]->lib_engine_count);
 				return ;
 			}
 
@@ -894,22 +894,22 @@ retry_recv:
 
 			send_ok =
 				(sync_primary_designated() == 1) && (
-				(ais_service[service]->lib_service[header->id].flow_control == OPENAIS_FLOW_CONTROL_NOT_REQUIRED) ||
-				((ais_service[service]->lib_service[header->id].flow_control == OPENAIS_FLOW_CONTROL_REQUIRED) &&
+				(ais_service[service]->lib_engine[header->id].flow_control == COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED) ||
+				((ais_service[service]->lib_engine[header->id].flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) &&
 				(send_ok_joined) &&
 				(sync_in_process() == 0)));
 
 			if (send_ok) {
-				ais_service[service]->lib_service[header->id].lib_handler_fn(conn_info, header);
+				ais_service[service]->lib_engine[header->id].lib_handler_fn(conn_info, header);
 			} else {
 
 				/*
 				 * Overload, tell library to retry
 				 */
 				res_overlay.header.size =
-					ais_service[service]->lib_service[header->id].response_size;
+					ais_service[service]->lib_engine[header->id].response_size;
 				res_overlay.header.id =
-					ais_service[service]->lib_service[header->id].response_id;
+					ais_service[service]->lib_engine[header->id].response_id;
 				res_overlay.header.error = SA_AIS_ERR_TRY_AGAIN;
 				openais_conn_send_response (
 					conn_info,
@@ -1270,7 +1270,7 @@ void openais_ipc_flow_control_create (
 	unsigned int service,
 	char *id,
 	int id_len,
-	void (*flow_control_state_set_fn) (void *conn, enum openais_flow_control_state),
+	void (*flow_control_state_set_fn) (void *conn, enum corosync_flow_control_state),
 	void *context)
 {
 	struct conn_info *conn_info = (struct conn_info *)conn;

+ 3 - 1
corosync/exec/ipc.h

@@ -35,6 +35,8 @@
 #ifndef IPC_H_DEFINED
 #define IPC_H_DEFINED
 
+#include "flow.h"
+
 #ifndef TIMER_HANDLE
 typedef void * timer_handle;
 #define TIMER_HANDLE
@@ -75,7 +77,7 @@ extern void openais_ipc_flow_control_create (
 	unsigned int service,
 	char *id,
 	int id_len,
-	void (*flow_control_state_set_fn) (void *context, enum openais_flow_control_state flow_control_state_set),
+	void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state_set),
 	void *context);
 	
 extern void openais_ipc_flow_control_destroy (

+ 13 - 5
corosync/exec/main.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2002-2006 MontaVista Software, Inc.
- * Copyright (c) 2006 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -81,6 +80,7 @@
 #include "util.h"
 #include "flow.h"
 #include "version.h"
+#include "coroapi.h"
 
 LOGSYS_DECLARE_SYSTEM ("corosync",
 	LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_BUFFER_BEFORE_CONFIG,
@@ -447,12 +447,12 @@ static void deliver_fn (
 	service = header->id >> 16;
 	fn_id = header->id & 0xffff;
 	if (endian_conversion_required) {
-		assert(ais_service[service]->exec_service[fn_id].exec_endian_convert_fn != NULL);
-		ais_service[service]->exec_service[fn_id].exec_endian_convert_fn
+		assert(ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn != NULL);
+		ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn
 			(header);
 	}
 
-	ais_service[service]->exec_service[fn_id].exec_handler_fn
+	ais_service[service]->exec_engine[fn_id].exec_handler_fn
 		(header, nodeid);
 }
 
@@ -462,6 +462,14 @@ void main_get_config_modules(struct config_iface_ver0 ***modules, int *num)
 	*num = num_config_modules;
 }
 
+int main_mcast (
+        struct iovec *iovec,
+        int iov_len,
+        unsigned int guarantee)
+{
+	return (totempg_groups_mcast_joined (openais_group_handle, iovec, iov_len, guarantee));
+}
+
 int main (int argc, char **argv)
 {
 	char *error_string;

+ 5 - 0
corosync/exec/main.h

@@ -65,4 +65,9 @@ extern unsigned long long *(*main_clm_get_by_nodeid) (unsigned int node_id);
 
 extern void main_get_config_modules(struct config_iface_ver0 ***modules, int *num);
 
+extern int main_mcast (
+	struct iovec *iovec,
+	int iov_len,
+	unsigned int guarantee);
+
 #endif /* AIS_EXEC_H_DEFINED */

+ 1 - 1
corosync/exec/mainconfig.h

@@ -45,7 +45,7 @@ struct dynamic_service {
 	char *name;
 	unsigned int ver;
 	unsigned int handle;
-	struct openais_service_handler_iface_ver0 *iface_ver0;
+	struct openais_service_engine_iface_ver0 *iface_ver0;
 };
 #define MAX_DYNAMIC_SERVICES 128
 

+ 46 - 7
corosync/exec/service.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2006 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -46,6 +46,14 @@
 #include "util.h"
 #include "logsys.h"
 
+#include "timer.h"
+#include "totempg.h"
+#include "totemip.h"
+#include "main.h"
+#include "ipc.h"
+
+#include "../include/coroapi.h"
+
 LOGSYS_DECLARE_SUBSYS ("SERV", LOG_INFO);
 
 struct default_service {
@@ -53,11 +61,40 @@ struct default_service {
 	int ver;
 };
 
+static struct corosync_api_v1 corosync_api_v1 = {
+	.timer_add_duration = openais_timer_add_duration,
+	.timer_add_absolute = openais_timer_add_absolute,
+	.timer_delete = openais_timer_delete,
+	.timer_time_get = NULL,
+	.ipc_source_set = message_source_set,
+	.ipc_source_is_local = message_source_is_local,
+	.ipc_private_data_get = openais_conn_private_data_get,
+	.ipc_response_send = NULL,
+	.ipc_dispatch_send = NULL,
+	.conn_send_response = openais_conn_send_response,
+	.conn_partner_get = openais_conn_partner_get,
+	.ipc_refcnt_inc =  openais_ipc_flow_control_local_increment,
+	.ipc_refcnt_dec = openais_ipc_flow_control_local_decrement,
+	.ipc_fc_create = openais_ipc_flow_control_create,
+	.ipc_fc_destroy = openais_ipc_flow_control_destroy,
+	.totem_nodeid_get = totempg_my_nodeid_get,
+	.totem_ring_reenable = totempg_ring_reenable,
+	.totem_mcast = main_mcast,
+	.service_link_and_init = openais_service_link_and_init,
+	.service_unlink_and_exit = openais_service_unlink_and_exit,
+	.totem_ifaces_get = totempg_ifaces_get,
+	.totem_ifaces_print = totempg_ifaces_print,
+	.totem_ip_print = totemip_print,
+	.error_memory_failure = NULL
+};
+
 static struct default_service default_services[] = {
+/*
 	{
 		.name			 = "corosync_evs",
 		.ver			 = 0,
 	},
+*/
 	{
 
 		.name			 = "corosync_cfg",
@@ -67,13 +104,15 @@ static struct default_service default_services[] = {
 		.name			 = "corosync_cpg",
 		.ver			 = 0,
 	},
+/*
 	{
 		.name			 = "corosync_confdb",
 		.ver			 = 0,
 	},
+*/
 };
 
-struct openais_service_handler *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT];
+struct corosync_service_engine *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT];
 
 static unsigned int object_internal_configuration_handle;
 
@@ -112,10 +151,10 @@ unsigned int openais_service_link_and_init (
 	char *service_name,
 	unsigned int service_ver)
 {
-	struct openais_service_handler_iface_ver0 *iface_ver0;
+	struct corosync_service_engine_iface_ver0 *iface_ver0;
 	void *iface_ver0_p;
 	unsigned int handle;
-	struct openais_service_handler *service;
+	struct corosync_service_engine *service;
 	unsigned int res;
 	unsigned int object_service_handle;
 
@@ -130,7 +169,7 @@ unsigned int openais_service_link_and_init (
 		&iface_ver0_p,
 		(void *)0);
 
-	iface_ver0 = (struct openais_service_handler_iface_ver0 *)iface_ver0_p;
+	iface_ver0 = (struct corosync_service_engine_iface_ver0 *)iface_ver0_p;
 
 	if (iface_ver0 == 0) {
 		log_printf(LOG_LEVEL_ERROR, "Service failed to load '%s'.\n", service_name);
@@ -141,7 +180,7 @@ unsigned int openais_service_link_and_init (
 	/*
 	 * Initialize service
 	 */
-	service = iface_ver0->openais_get_service_handler_ver0();
+	service = iface_ver0->corosync_get_service_engine_ver0();
 
 	ais_service[service->id] = service;
 	if (service->config_init_fn) {
@@ -149,7 +188,7 @@ unsigned int openais_service_link_and_init (
 	}
 
 	if (service->exec_init_fn) {
-		res = service->exec_init_fn (objdb);
+		res = service->exec_init_fn (objdb, &corosync_api_v1);
 	}
 
 	/*

+ 1 - 53
corosync/exec/service.h

@@ -35,57 +35,6 @@
 #ifndef OPENAIS_SERVICE_H_DEFINED
 #define OPENAIS_SERVICE_H_DEFINED
 
-#define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
-#define SERVICE_HANDLER_MAXIMUM_COUNT 64
-
-enum openais_flow_control {
-	OPENAIS_FLOW_CONTROL_REQUIRED = 1,
-	OPENAIS_FLOW_CONTROL_NOT_REQUIRED = 2
-};
-
-struct openais_lib_handler {
-	void (*lib_handler_fn) (void *conn, void *msg);
-	int response_size;
-	int response_id;
-	enum openais_flow_control flow_control;
-};
-
-struct openais_exec_handler {
-	void (*exec_handler_fn) (void *msg, unsigned int nodeid);
-	void (*exec_endian_convert_fn) (void *msg);
-};
-
-struct openais_service_handler {
-	char *name;
-	unsigned short id;
-	unsigned int private_data_size;
-	enum openais_flow_control flow_control;
-	int (*lib_init_fn) (void *conn);
-	int (*lib_exit_fn) (void *conn);
-	struct openais_lib_handler *lib_service;
-	int lib_service_count;
-	struct openais_exec_handler *exec_service;
-	int (*exec_init_fn) (struct objdb_iface_ver0 *);
-	int (*exec_exit_fn) (struct objdb_iface_ver0 *);
-	int (*config_init_fn) (struct objdb_iface_ver0 *);
-	void (*exec_dump_fn) (void);
-	int exec_service_count;
-	void (*confchg_fn) (
-		enum totem_configuration_type configuration_type,
-		unsigned int *member_list, int member_list_entries,
-		unsigned int *left_list, int left_list_entries,
-		unsigned int *joined_list, int joined_list_entries,
-		struct memb_ring_id *ring_id);
-	void (*sync_init) (void);
-	int (*sync_process) (void);
-	void (*sync_activate) (void);
-	void (*sync_abort) (void);
-};
-
-struct openais_service_handler_iface_ver0 {
-	struct openais_service_handler *(*openais_get_service_handler_ver0) (void);
-};
-
 /*
  * Link and initialize a service
  */
@@ -108,13 +57,12 @@ extern unsigned int openais_service_unlink_and_exit (
 extern unsigned int openais_service_unlink_all (
     struct objdb_iface_ver0 *objdb);
 
-
 /*
  * Load all of the default services
  */
 extern unsigned int openais_service_defaults_link_and_init (
 	struct objdb_iface_ver0 *objdb);
 
-extern struct openais_service_handler *ais_service[];
+extern struct corosync_service_engine *ais_service[];
 
 #endif /* SERVICE_H_DEFINED */

+ 1 - 2
corosync/exec/timer.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2002-2006 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 3 - 2
corosync/exec/totem.h

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * Author: Steven Dake (sdake@redhat.com)
  *
@@ -149,6 +148,7 @@ struct totem_config {
 	char *vsf_type;
 };
 
+#define TOTEM_CONFIGURATION_TYPE
 enum totem_configuration_type {
 	TOTEM_CONFIGURATION_REGULAR,
 	TOTEM_CONFIGURATION_TRANSITIONAL	
@@ -159,6 +159,7 @@ enum totem_callback_token_type {
 	TOTEM_CALLBACK_TOKEN_SENT = 2
 };
 
+#define MEMB_RING_ID
 struct memb_ring_id {
 	struct totem_ip_address rep;
 	unsigned long long seq;

+ 1 - 0
corosync/exec/totemip.h

@@ -52,6 +52,7 @@ void totemip_nosigpipe(int s);
 #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
 
 /* These are the things that get passed around */
+#define TOTEM_IP_ADDRESS
 struct totem_ip_address
 {
 	unsigned int   nodeid;

+ 1 - 2
corosync/exec/totemnet.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 1 - 2
corosync/exec/totempg.c

@@ -1,8 +1,7 @@
 /*
  * Copyright (c) 2003-2005 MontaVista Software, Inc.
  * Copyright (c) 2005 OSDL.
- * Copyright (c) 2006 Sun Microsystems, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 1 - 3
corosync/exec/totemrrp.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -1696,7 +1695,6 @@ int totemrrp_ring_reenable (
 	int res = 0;
 	unsigned int i;
 
-printf ("totemrrp ring reenable\n");
 	res = hdb_handle_get (&totemrrp_instance_database, handle,
 		(void *)&instance);
 	if (res != 0) {

+ 1 - 2
corosync/exec/totemsrp.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2003-2006 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 1 - 2
corosync/exec/vsf_ykd.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005 MontaVista Software, Inc.
- * Copyright (c) 2006 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 0 - 1
corosync/include/evs.h

@@ -1,6 +1,5 @@
 /*
  * Copyright (c) 2004 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
  *
  * All rights reserved.
  *

+ 1 - 2
corosync/include/hdb.h

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2002-2006 MontaVista Software, Inc.
- * Copyright (c) 2006 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 0 - 0
corosync/exec/jhash.h → corosync/include/jhash.h


+ 1 - 3
corosync/include/mar_cpg.h

@@ -1,9 +1,7 @@
 /*
- * Copyright (c) 2006 Red Hat, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  * Author: Patrick Caulfield (pcaulfie@redhat.com)
  *
- * Copyright (c) 2006 Sun Microsystems, Inc.
- *
  * All rights reserved.
  *
  * This software licensed under BSD license, the text of which follows:

+ 1 - 1
corosync/include/mar_gen.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2006 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 1 - 1
corosync/include/saAis.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002-2003 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 1 - 1
corosync/include/swab.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2005 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 0 - 1
corosync/lcr/lcr_ifact.c

@@ -1,6 +1,5 @@
 /*
  * Copyright (C) 2006 Steven Dake (sdake@redhat.com)
- * Copyright (c) 2006 Sun Microsystems, Inc.
  *
  * This software licensed under BSD license, the text of which follows:
  * 

+ 0 - 1
corosync/lcr/uic.c

@@ -1,6 +1,5 @@
 /*
  * Copyright (c) 2006 Steven Dake (sdake@redhat.com)
- * Copyright (c) 2006 Sun Microsystems, Inc.
  *
  * This software licensed under BSD license, the text of which follows:
  * 

+ 0 - 1
corosync/lcr/uis.c

@@ -1,6 +1,5 @@
 /*
  * Copyright (c) 2006 Steven Dake (sdake@redhat.com)
- * Copyright (c) 2006 Sun Microsystems, Inc.
  *
  * This software licensed under BSD license, the text of which follows:
  * 

+ 1 - 1
corosync/lib/evs.c

@@ -2,7 +2,7 @@
  * vi: set autoindent tabstop=4 shiftwidth=4 :
 
  * Copyright (c) 2004-2005 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 1 - 1
corosync/lib/util.c

@@ -2,7 +2,7 @@
  * vi: set autoindent tabstop=4 shiftwidth=4 :
  *
  * Copyright (c) 2002-2006 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 0 - 3
corosync/services/Makefile

@@ -104,6 +104,3 @@ confdb.o: confdb.c
 
 cpg.o: cpg.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
-
-cfg.o: cfg.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

+ 49 - 56
corosync/services/cfg.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005-2006 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -53,20 +52,10 @@
 #include "../include/ipc_gen.h"
 #include "../include/ipc_cfg.h"
 #include "../include/list.h"
-#include "totem.h"
-#include "totempg.h"
-#include "flow.h"
-#include "tlist.h"
-#include "ipc.h"
 #include "../include/queue.h"
 #include "../lcr/lcr_comp.h"
-#include "objdb.h"
-#include "service.h"
-#include "totempg.h"
-#include "mempool.h"
-#include "util.h"
-#include "logsys.h"
-#include "main.h"
+#include "../exec/logsys.h"
+#include "../include/coroapi.h"
 
 LOGSYS_DECLARE_SUBSYS ("CFG", LOG_INFO);
 
@@ -81,7 +70,9 @@ static void cfg_confchg_fn (
 	unsigned int *joined_list, int joined_list_entries,
 	struct memb_ring_id *ring_id);
 
-static int cfg_exec_init_fn (struct objdb_iface_ver0 *objdb);
+static int cfg_exec_init_fn (struct objdb_iface_ver0 *objdb, struct corosync_api_v1 *corosync_api_v1);
+
+static struct corosync_api_v1 *api;
 
 static int cfg_lib_init_fn (void *conn);
 
@@ -126,59 +117,59 @@ static void message_handler_req_lib_cfg_serviceunload (
 /*
  * Service Handler Definition
  */
-static struct openais_lib_handler cfg_lib_service[] =
+static struct corosync_lib_handler cfg_lib_engine[] =
 {
 	{ /* 0 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_ringstatusget,
 		.response_size		= sizeof (struct res_lib_cfg_ringstatusget),
 		.response_id		= MESSAGE_RES_CFG_RINGSTATUSGET,
-		.flow_control		= OPENAIS_FLOW_CONTROL_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
 	},
 	{ /* 1 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_ringreenable,
 		.response_size		= sizeof (struct res_lib_cfg_ringreenable),
 		.response_id		= MESSAGE_RES_CFG_RINGREENABLE,
-		.flow_control		= OPENAIS_FLOW_CONTROL_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
 	},
 	{ /* 2 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_statetrack,
 		.response_size		= sizeof (struct res_lib_cfg_statetrack),
 		.response_id		= MESSAGE_RES_CFG_STATETRACKSTART,
-		.flow_control		= OPENAIS_FLOW_CONTROL_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
 	},
 	{ /* 3 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_statetrackstop,
 		.response_size		= sizeof (struct res_lib_cfg_statetrackstop),
 		.response_id		= MESSAGE_RES_CFG_STATETRACKSTOP,
-		.flow_control		= OPENAIS_FLOW_CONTROL_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
 	},
 	{ /* 4 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_administrativestateset,
 		.response_size		= sizeof (struct res_lib_cfg_administrativestateset),
 		.response_id		= MESSAGE_RES_CFG_ADMINISTRATIVESTATESET,
-		.flow_control		= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 5 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_administrativestateget,
 		.response_size		= sizeof (struct res_lib_cfg_administrativestateget),
 		.response_id		= MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET,
-		.flow_control		= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 6 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_serviceload,
 		.response_size		= sizeof (struct res_lib_cfg_serviceload),
 		.response_id		= MESSAGE_RES_CFG_SERVICELOAD,
-		.flow_control		= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 7 */
 		.lib_handler_fn		= message_handler_req_lib_cfg_serviceunload,
 		.response_size		= sizeof (struct res_lib_cfg_serviceunload),
 		.response_id		= MESSAGE_RES_CFG_SERVICEUNLOAD,
-		.flow_control		= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control		= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	}
 };
 
-static struct openais_exec_handler cfg_exec_service[] =
+static struct corosync_exec_handler cfg_exec_engine[] =
 {
 	{
 		message_handler_req_exec_cfg_ringreenable
@@ -188,18 +179,18 @@ static struct openais_exec_handler cfg_exec_service[] =
 /*
  * Exports the interface for the service
  */
-struct openais_service_handler cfg_service_handler = {
-	.name					= "openais configuration service",
+struct corosync_service_engine cfg_service_engine = {
+	.name					= "corosync configuration service",
 	.id					= CFG_SERVICE,
 	.private_data_size			= 0,
-	.flow_control				= OPENAIS_FLOW_CONTROL_NOT_REQUIRED, 
+	.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED, 
 	.lib_init_fn				= cfg_lib_init_fn,
 	.lib_exit_fn				= cfg_lib_exit_fn,
-	.lib_service				= cfg_lib_service,
-	.lib_service_count			= sizeof (cfg_lib_service) / sizeof (struct openais_lib_handler),
+	.lib_engine				= cfg_lib_engine,
+	.lib_engine_count			= sizeof (cfg_lib_engine) / sizeof (struct corosync_lib_handler),
 	.exec_init_fn				= cfg_exec_init_fn,
-	.exec_service				= cfg_exec_service,
-	.exec_service_count			= 0, /* sizeof (cfg_aisexec_handler_fns) / sizeof (openais_exec_handler), */
+	.exec_engine				= cfg_exec_engine,
+	.exec_engine_count			= 0, /* sizeof (cfg_aisexec_handler_fns) / sizeof (coroync_exec_handler), */
 	.confchg_fn				= cfg_confchg_fn,
 };
 
@@ -208,15 +199,15 @@ static struct objdb_iface_ver0 *my_objdb;
 /*
  * Dynamic Loader definition
  */
-static struct openais_service_handler *cfg_get_handler_ver0 (void);
+static struct corosync_service_engine *cfg_get_handler_ver0 (void);
 
-static struct openais_service_handler_iface_ver0 cfg_service_handler_iface = {
-	.openais_get_service_handler_ver0	= cfg_get_handler_ver0
+static struct corosync_service_engine_iface_ver0 cfg_service_engine_iface = {
+	.corosync_get_service_engine_ver0	= cfg_get_handler_ver0
 };
 
-static struct lcr_iface openais_cfg_ver0[1] = {
+static struct lcr_iface corosync_cfg_ver0[1] = {
 	{
-		.name				= "openais_cfg",
+		.name				= "corosync_cfg",
 		.version			= 0,
 		.versions_replace		= 0,
 		.versions_replace_count		= 0,
@@ -230,16 +221,16 @@ static struct lcr_iface openais_cfg_ver0[1] = {
 
 static struct lcr_comp cfg_comp_ver0 = {
 	.iface_count				= 1,
-	.ifaces					= openais_cfg_ver0
+	.ifaces					= corosync_cfg_ver0
 };
 
-static struct openais_service_handler *cfg_get_handler_ver0 (void)
+static struct corosync_service_engine *cfg_get_handler_ver0 (void)
 {
-	return (&cfg_service_handler);
+	return (&cfg_service_engine);
 }
 
 __attribute__ ((constructor)) static void register_this_component (void) {
-	lcr_interfaces_set (&openais_cfg_ver0[0], &cfg_service_handler_iface);
+	lcr_interfaces_set (&corosync_cfg_ver0[0], &cfg_service_engine_iface);
 
 	lcr_component_register (&cfg_comp_ver0);
 }
@@ -251,9 +242,12 @@ struct req_exec_cfg_ringreenable {
 
 /* IMPL */
 
-static int cfg_exec_init_fn (struct objdb_iface_ver0 *objdb)
+static int cfg_exec_init_fn (
+	struct objdb_iface_ver0 *objdb,
+	struct corosync_api_v1 *corosync_api_v1)
 {
 	my_objdb = objdb;
+	api = corosync_api_v1;
 	return (0);
 }
 
@@ -292,12 +286,12 @@ static void message_handler_req_exec_cfg_ringreenable (
 	struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
 
 	ENTER("");
-	totempg_ring_reenable ();
-        if (message_source_is_local(&req_exec_cfg_ringreenable->source)) {
+	api->totem_ring_reenable ();
+        if (api->ipc_source_is_local(&req_exec_cfg_ringreenable->source)) {
 		res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE;
 		res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable);
 		res_lib_cfg_ringreenable.header.error = SA_AIS_OK;
-		openais_conn_send_response (
+		api->conn_send_response (
 			req_exec_cfg_ringreenable->source.conn,
 			&res_lib_cfg_ringreenable,
 			sizeof (struct res_lib_cfg_ringreenable));
@@ -326,8 +320,8 @@ static void message_handler_req_lib_cfg_ringstatusget (
 	res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget);
 	res_lib_cfg_ringstatusget.header.error = SA_AIS_OK;
 
-	totempg_ifaces_get (
-		totempg_my_nodeid_get(),
+	api->totem_ifaces_get (
+		api->totem_nodeid_get(),
 		interfaces,
 		&status,
 		&iface_count);
@@ -335,13 +329,13 @@ static void message_handler_req_lib_cfg_ringstatusget (
 	res_lib_cfg_ringstatusget.interface_count = iface_count;
 
 	for (i = 0; i < iface_count; i++) {
-		totem_ip_string = (char *)totemip_print (&interfaces[i]);
+		totem_ip_string = (char *)api->totem_ip_print (&interfaces[i]);
 		strcpy ((char *)&res_lib_cfg_ringstatusget.interface_status[i],
 			status[i]);
 		strcpy ((char *)&res_lib_cfg_ringstatusget.interface_name[i],
 			totem_ip_string);
 	}
-	openais_conn_send_response (
+	api->conn_send_response (
 		conn,
 		&res_lib_cfg_ringstatusget,
 		sizeof (struct res_lib_cfg_ringstatusget));
@@ -361,13 +355,12 @@ static void message_handler_req_lib_cfg_ringreenable (
 		sizeof (struct req_exec_cfg_ringreenable);
 	req_exec_cfg_ringreenable.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
 		MESSAGE_REQ_EXEC_CFG_RINGREENABLE);
-	message_source_set (&req_exec_cfg_ringreenable.source, conn);
+	api->ipc_source_set (&req_exec_cfg_ringreenable.source, conn);
 
 	iovec.iov_base = (char *)&req_exec_cfg_ringreenable;
 	iovec.iov_len = sizeof (struct req_exec_cfg_ringreenable);
 
-	assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1,
-		TOTEMPG_SAFE) == 0);
+	assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
 
 	LEAVE("");
 }
@@ -418,7 +411,7 @@ static void message_handler_req_lib_cfg_serviceload (
 	struct res_lib_cfg_serviceload res_lib_cfg_serviceload;
 
 	ENTER("");
-	openais_service_link_and_init (
+	api->service_link_and_init (
 		my_objdb,
 		(char *)req_lib_cfg_serviceload->service_name,
 		req_lib_cfg_serviceload->service_ver);
@@ -426,7 +419,7 @@ static void message_handler_req_lib_cfg_serviceload (
 	res_lib_cfg_serviceload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD;
 	res_lib_cfg_serviceload.header.size = sizeof (struct res_lib_cfg_serviceload);
 	res_lib_cfg_serviceload.header.error = SA_AIS_OK;
-	openais_conn_send_response (
+	api->conn_send_response (
 		conn,
 		&res_lib_cfg_serviceload,
 		sizeof (struct res_lib_cfg_serviceload));
@@ -442,14 +435,14 @@ static void message_handler_req_lib_cfg_serviceunload (
 	struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload;
 
 	ENTER("");
-	openais_service_unlink_and_exit (
+	api->service_unlink_and_exit (
 		my_objdb,
 		(char *)req_lib_cfg_serviceunload->service_name,
 		req_lib_cfg_serviceunload->service_ver);
 	res_lib_cfg_serviceunload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD;
 	res_lib_cfg_serviceunload.header.size = sizeof (struct res_lib_cfg_serviceunload);
 	res_lib_cfg_serviceunload.header.error = SA_AIS_OK;
-	openais_conn_send_response (
+	api->conn_send_response (
 		conn,
 		&res_lib_cfg_serviceunload,
 		sizeof (struct res_lib_cfg_serviceunload));

+ 85 - 92
corosync/services/cpg.c

@@ -1,6 +1,5 @@
 /*
- * Copyright (c) 2006, 2008 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -32,7 +31,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
-#ifndef OPENAIS_BSD
+#ifndef COROSYNC_BSD
 #include <alloca.h>
 #endif
 #include <sys/types.h>
@@ -52,27 +51,18 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#include "../exec/logsys.h"
+
 #include "../include/saAis.h"
-#include "../include/saClm.h"
 #include "../include/ipc_gen.h"
 #include "../include/ipc_cpg.h"
 #include "../include/mar_cpg.h"
 #include "../include/list.h"
 #include "../include/queue.h"
 #include "../lcr/lcr_comp.h"
-#include "totempg.h"
-#include "main.h"
-#include "flow.h"
-#include "tlist.h"
-#include "ipc.h"
-#include "mempool.h"
-#include "objdb.h"
-#include "service.h"
-#include "jhash.h"
-#include "swab.h"
-#include "ipc.h"
-#include "flow.h"
-#include "logsys.h"
+#include "../include/coroapi.h"
+#include "../exec/logsys.h"
+#include "../include/jhash.h"
 
 LOGSYS_DECLARE_SUBSYS ("CPG", LOG_INFO);
 
@@ -111,7 +101,7 @@ struct process_info {
 	void *conn;
 	void *trackerconn;
 	struct group_info *group;
-	enum openais_flow_control_state flow_control_state;
+	enum corosync_flow_control_state flow_control_state;
 	struct list_head list; /* on the group_info members list */
 };
 
@@ -122,6 +112,8 @@ struct join_list_entry {
 
 static struct list_head group_lists[GROUP_HASH_SIZE];
 
+static struct corosync_api_v1 *api = NULL;
+
 /*
  * Service Interfaces required by service_message_handler struct
  */
@@ -132,7 +124,7 @@ static void cpg_confchg_fn (
 	unsigned int *joined_list, int joined_list_entries,
 	struct memb_ring_id *ring_id);
 
-static int cpg_exec_init_fn (struct objdb_iface_ver0 *objdb);
+static int cpg_exec_init_fn (struct objdb_iface_ver0 *objdb, struct corosync_api_v1 *);
 
 static int cpg_lib_init_fn (void *conn);
 
@@ -193,59 +185,59 @@ static void cpg_sync_abort (void);
 /*
  * Library Handler Definition
  */
-static struct openais_lib_handler cpg_lib_service[] =
+static struct corosync_lib_handler cpg_lib_engine[] =
 {
 	{ /* 0 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_join,
 		.response_size				= sizeof (struct res_lib_cpg_join),
 		.response_id				= MESSAGE_RES_CPG_JOIN,
-		.flow_control				= OPENAIS_FLOW_CONTROL_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
 	},
 	{ /* 1 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_leave,
 		.response_size				= sizeof (struct res_lib_cpg_leave),
 		.response_id				= MESSAGE_RES_CPG_LEAVE,
-		.flow_control				= OPENAIS_FLOW_CONTROL_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
 	},
 	{ /* 2 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_mcast,
 		.response_size				= sizeof (struct res_lib_cpg_mcast),
 		.response_id				= MESSAGE_RES_CPG_MCAST,
-		.flow_control				= OPENAIS_FLOW_CONTROL_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
 	},
 	{ /* 3 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_membership,
 		.response_size				= sizeof (mar_res_header_t),
 		.response_id				= MESSAGE_RES_CPG_MEMBERSHIP,
-		.flow_control				= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 4 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_trackstart,
 		.response_size				= sizeof (struct res_lib_cpg_trackstart),
 		.response_id				= MESSAGE_RES_CPG_TRACKSTART,
-		.flow_control				= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 5 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_trackstop,
 		.response_size				= sizeof (struct res_lib_cpg_trackstart),
 		.response_id				= MESSAGE_RES_CPG_TRACKSTOP,
-		.flow_control				= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 6 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_local_get,
 		.response_size				= sizeof (struct res_lib_cpg_local_get),
 		.response_id				= MESSAGE_RES_CPG_LOCAL_GET,
-		.flow_control				= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
 	{ /* 7 */
 		.lib_handler_fn				= message_handler_req_lib_cpg_groups_get,
 		.response_size				= sizeof (struct res_lib_cpg_groups_get),
 		.response_id				= MESSAGE_RES_CPG_GROUPS_GET,
-		.flow_control				= OPENAIS_FLOW_CONTROL_NOT_REQUIRED
+		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
 	}
 };
 
-static struct openais_exec_handler cpg_exec_service[] =
+static struct corosync_exec_handler cpg_exec_engine[] =
 {
 	{ /* 0 */
 		.exec_handler_fn	= message_handler_req_exec_cpg_procjoin,
@@ -269,19 +261,19 @@ static struct openais_exec_handler cpg_exec_service[] =
 	},
 };
 
-struct openais_service_handler cpg_service_handler = {
-	.name				        = "openais cluster closed process group service v1.01",
+struct corosync_service_engine cpg_service_engine = {
+	.name				        = "corosync cluster closed process group service v1.01",
 	.id					= CPG_SERVICE,
 	.private_data_size			= sizeof (struct process_info),
-	.flow_control				= OPENAIS_FLOW_CONTROL_REQUIRED,
+	.flow_control				= COROSYNC_LIB_FLOW_CONTROL_REQUIRED,
 	.lib_init_fn				= cpg_lib_init_fn,
 	.lib_exit_fn				= cpg_lib_exit_fn,
-	.lib_service				= cpg_lib_service,
-	.lib_service_count			= sizeof (cpg_lib_service) / sizeof (struct openais_lib_handler),
+	.lib_engine				= cpg_lib_engine,
+	.lib_engine_count			= sizeof (cpg_lib_engine) / sizeof (struct corosync_lib_handler),
 	.exec_init_fn				= cpg_exec_init_fn,
 	.exec_dump_fn				= NULL,
-	.exec_service				= cpg_exec_service,
-	.exec_service_count		        = sizeof (cpg_exec_service) / sizeof (struct openais_exec_handler),
+	.exec_engine				= cpg_exec_engine,
+	.exec_engine_count		        = sizeof (cpg_exec_engine) / sizeof (struct corosync_exec_handler),
 	.confchg_fn                             = cpg_confchg_fn,
 	.sync_init                              = cpg_sync_init,
 	.sync_process                           = cpg_sync_process,
@@ -292,15 +284,15 @@ struct openais_service_handler cpg_service_handler = {
 /*
  * Dynamic loader definition
  */
-static struct openais_service_handler *cpg_get_service_handler_ver0 (void);
+static struct corosync_service_engine *cpg_get_service_engine_ver0 (void);
 
-static struct openais_service_handler_iface_ver0 cpg_service_handler_iface = {
-	.openais_get_service_handler_ver0		= cpg_get_service_handler_ver0
+static struct corosync_service_engine_iface_ver0 cpg_service_engine_iface = {
+	.corosync_get_service_engine_ver0		= cpg_get_service_engine_ver0
 };
 
-static struct lcr_iface openais_cpg_ver0[1] = {
+static struct lcr_iface corosync_cpg_ver0[1] = {
 	{
-		.name				= "openais_cpg",
+		.name				= "corosync_cpg",
 		.version			= 0,
 		.versions_replace		= 0,
 		.versions_replace_count         = 0,
@@ -314,17 +306,17 @@ static struct lcr_iface openais_cpg_ver0[1] = {
 
 static struct lcr_comp cpg_comp_ver0 = {
 	.iface_count			= 1,
-	.ifaces			        = openais_cpg_ver0
+	.ifaces			        = corosync_cpg_ver0
 };
 
 
-static struct openais_service_handler *cpg_get_service_handler_ver0 (void)
+static struct corosync_service_engine *cpg_get_service_engine_ver0 (void)
 {
-	return (&cpg_service_handler);
+	return (&cpg_service_engine);
 }
 
 __attribute__ ((constructor)) static void cpg_comp_register (void) {
-        lcr_interfaces_set (&openais_cpg_ver0[0], &cpg_service_handler_iface);
+        lcr_interfaces_set (&corosync_cpg_ver0[0], &cpg_service_engine_iface);
 
 	lcr_component_register (&cpg_comp_ver0);
 }
@@ -449,14 +441,14 @@ static int notify_lib_joinlist(
 	}
 
 	if (conn) {
-		openais_conn_send_response(conn, buf, size);
+		api->conn_send_response(conn, buf, size);
 	}
 	else {
 		/* Send it to all listeners */
 		for (iter = gi->members.next, tmp=iter->next; iter != &gi->members; iter = tmp, tmp=iter->next) {
 			struct process_info *pi = list_entry(iter, struct process_info, list);
 			if (pi->trackerconn && (pi->flags & PI_FLAG_MEMBER)) {
-				if (openais_conn_send_response(pi->trackerconn, buf, size) == -1) {
+				if (api->conn_send_response(pi->trackerconn, buf, size) == -1) {
 					// Error ??
 				}
 			}
@@ -473,7 +465,7 @@ static void remove_group(struct group_info *gi)
 }
 
 
-static int cpg_exec_init_fn (struct objdb_iface_ver0 *objdb)
+static int cpg_exec_init_fn (struct objdb_iface_ver0 *objdb, struct corosync_api_v1 *corosync_api)
 {
 	int i;
 
@@ -481,12 +473,13 @@ static int cpg_exec_init_fn (struct objdb_iface_ver0 *objdb)
 		list_init(&group_lists[i]);
 	}
 
+	api = corosync_api;
 	return (0);
 }
 
 static int cpg_lib_exit_fn (void *conn)
 {
-	struct process_info *pi = (struct process_info *)openais_conn_private_data_get (conn);
+	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct group_info *gi = pi->group;
 	mar_cpg_address_t notify_info;
 
@@ -494,7 +487,7 @@ static int cpg_lib_exit_fn (void *conn)
 
 	if (gi) {
 		notify_info.pid = pi->pid;
-		notify_info.nodeid = totempg_my_nodeid_get();
+		notify_info.nodeid = api->totem_nodeid_get();
 		notify_info.reason = CONFCHG_CPG_REASON_PROCDOWN;
 		cpg_node_joinleave_send(gi, pi, MESSAGE_REQ_EXEC_CPG_PROCLEAVE, CONFCHG_CPG_REASON_PROCDOWN);
 		list_del(&pi->list);
@@ -551,7 +544,7 @@ static void send_group_list_callbacks(int num_groups, void *conn)
 	struct group_info *gi;
 	uint32_t hash;
 	int max_proc_count=0;
-	int size;
+	int size = 0;
 	int group_counter = 0;
 	char *buf = NULL;
 	struct res_lib_cpg_groups_get_callback *res;
@@ -602,7 +595,7 @@ static void send_group_list_callbacks(int num_groups, void *conn)
 					retgi++;
 				}
 			}
-			openais_conn_send_response(conn, buf, size);
+			api->conn_send_response(conn, buf, size);
 		}
 	}
 	if (buf)
@@ -625,7 +618,7 @@ static int cpg_node_joinleave_send (struct group_info *gi, struct process_info *
 	req_exec_cpg_iovec.iov_base = (char *)&req_exec_cpg_procjoin;
 	req_exec_cpg_iovec.iov_len = sizeof(req_exec_cpg_procjoin);
 
-	result = totempg_groups_mcast_joined (openais_group_handle, &req_exec_cpg_iovec, 1, TOTEMPG_AGREED);
+	result = api->totem_mcast (&req_exec_cpg_iovec, 1, TOTEM_AGREED);
 
 	return (result);
 }
@@ -718,8 +711,8 @@ static void cpg_confchg_fn (
 				lowest_nodeid = member_list[i];
 		}
 
-		log_printf(LOG_LEVEL_DEBUG, "confchg, low nodeid=%d, us = %d\n", lowest_nodeid, totempg_my_nodeid_get());
-		if (lowest_nodeid == totempg_my_nodeid_get()) {
+		log_printf(LOG_LEVEL_DEBUG, "confchg, low nodeid=%d, us = %d\n", lowest_nodeid, api->totem_nodeid_get());
+		if (lowest_nodeid == api->totem_nodeid_get()) {
 
 			req_exec_cpg_downlist.header.id = SERVICE_ID_MAKE(CPG_SERVICE, MESSAGE_REQ_EXEC_CPG_DOWNLIST);
 			req_exec_cpg_downlist.header.size = sizeof(struct req_exec_cpg_downlist);
@@ -737,7 +730,7 @@ static void cpg_confchg_fn (
 		req_exec_cpg_iovec.iov_base = (char *)&req_exec_cpg_downlist;
 		req_exec_cpg_iovec.iov_len = req_exec_cpg_downlist.header.size;
 
-		totempg_groups_mcast_joined (openais_group_handle, &req_exec_cpg_iovec, 1, TOTEMPG_AGREED);
+		api->totem_mcast (&req_exec_cpg_iovec, 1, TOTEM_AGREED);
 		req_exec_cpg_downlist.left_nodes = 0;
 		log_printf(LOG_LEVEL_DEBUG, "confchg, sent downlist\n");
 	}
@@ -745,7 +738,7 @@ static void cpg_confchg_fn (
 
 static void cpg_flow_control_state_set_fn (
 	void *context,
-	enum openais_flow_control_state flow_control_state)
+	enum corosync_flow_control_state flow_control_state)
 {
 	struct process_info *process_info = (struct process_info *)context;
 
@@ -820,7 +813,7 @@ static void do_proc_join(
 		if (pi->pid == pid && pi->nodeid == nodeid) {
 
 			/* It could be a local join message */
-			if ((nodeid == totempg_my_nodeid_get()) &&
+			if ((nodeid == api->totem_nodeid_get()) &&
 				(!pi->flags & PI_FLAG_MEMBER)) {
 				goto local_join;
 			} else {
@@ -957,7 +950,7 @@ static void message_handler_req_exec_cpg_joinlist (
 		nodeid);
 
 	/* Ignore our own messages */
-	if (nodeid == totempg_my_nodeid_get()) {
+	if (nodeid == api->totem_nodeid_get()) {
 		return;
 	}
 
@@ -993,9 +986,9 @@ static void message_handler_req_exec_cpg_mcast (
 	res_lib_cpg_mcast->pid = req_exec_cpg_mcast->pid;
 	res_lib_cpg_mcast->nodeid = nodeid;
 	res_lib_cpg_mcast->flow_control_state = CPG_FLOW_CONTROL_DISABLED;
-	if (message_source_is_local (&req_exec_cpg_mcast->source)) {
-		openais_ipc_flow_control_local_decrement (req_exec_cpg_mcast->source.conn);
-		process_info = (struct process_info *)openais_conn_private_data_get (req_exec_cpg_mcast->source.conn);
+	if (api->ipc_source_is_local (&req_exec_cpg_mcast->source)) {
+		api->ipc_refcnt_dec (req_exec_cpg_mcast->source.conn);
+		process_info = (struct process_info *)api->ipc_private_data_get (req_exec_cpg_mcast->source.conn);
 		res_lib_cpg_mcast->flow_control_state = process_info->flow_control_state;
 	}
 	memcpy(&res_lib_cpg_mcast->group_name, &gi->group_name,
@@ -1007,7 +1000,7 @@ static void message_handler_req_exec_cpg_mcast (
 	for (iter = gi->members.next; iter != &gi->members; iter = iter->next) {
 		struct process_info *pi = list_entry(iter, struct process_info, list);
 		if (pi->trackerconn && (pi->flags & PI_FLAG_MEMBER)) {
-			openais_conn_send_response(
+			api->conn_send_response(
 				pi->trackerconn,
 				buf,
 				res_lib_cpg_mcast->header.size);
@@ -1036,7 +1029,7 @@ static int cpg_exec_send_joinlist(void)
 			gi = list_entry(iter, struct group_info, list);
 			for (iter2 = gi->members.next; iter2 != &gi->members; iter2 = iter2->next) {
 				struct process_info *pi = list_entry(iter2, struct process_info, list);
-				if (pi->pid && pi->nodeid == totempg_my_nodeid_get()) {
+				if (pi->pid && pi->nodeid == api->totem_nodeid_get()) {
 					count++;
 				}
 			}
@@ -1063,7 +1056,7 @@ static int cpg_exec_send_joinlist(void)
 			for (iter2 = gi->members.next; iter2 != &gi->members; iter2 = iter2->next) {
 
 				struct process_info *pi = list_entry(iter2, struct process_info, list);
-				if (pi->pid && pi->nodeid == totempg_my_nodeid_get()) {
+				if (pi->pid && pi->nodeid == api->totem_nodeid_get()) {
 					memcpy(&jle->group_name, &gi->group_name, sizeof(mar_cpg_name_t));
 					jle->pid = pi->pid;
 					jle++;
@@ -1078,12 +1071,12 @@ static int cpg_exec_send_joinlist(void)
 	req_exec_cpg_iovec.iov_base = buf;
 	req_exec_cpg_iovec.iov_len = res->size;
 
-	return totempg_groups_mcast_joined (openais_group_handle, &req_exec_cpg_iovec, 1, TOTEMPG_AGREED);
+	return (api->totem_mcast (&req_exec_cpg_iovec, 1, TOTEM_AGREED));
 }
 
 static int cpg_lib_init_fn (void *conn)
 {
-	struct process_info *pi = (struct process_info *)openais_conn_private_data_get (conn);
+	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	pi->conn = conn;
 
 	log_printf(LOG_LEVEL_DEBUG, "lib_init_fn: conn=%p, pi=%p\n", conn, pi);
@@ -1094,7 +1087,7 @@ static int cpg_lib_init_fn (void *conn)
 static void message_handler_req_lib_cpg_join (void *conn, void *message)
 {
 	struct req_lib_cpg_join *req_lib_cpg_join = (struct req_lib_cpg_join *)message;
-	struct process_info *pi = (struct process_info *)openais_conn_private_data_get (conn);
+	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct res_lib_cpg_join res_lib_cpg_join;
 	struct group_info *gi;
 	SaAisErrorT error = SA_AIS_OK;
@@ -1113,7 +1106,7 @@ static void message_handler_req_lib_cpg_join (void *conn, void *message)
 		goto join_err;
 	}
 
-	openais_ipc_flow_control_create (
+	api->ipc_fc_create (
 		conn,
 		CPG_SERVICE,
 		req_lib_cpg_join->group_name.value,
@@ -1122,7 +1115,7 @@ static void message_handler_req_lib_cpg_join (void *conn, void *message)
 		pi);
 
 	/* Add a node entry for us */
-	pi->nodeid = totempg_my_nodeid_get();
+	pi->nodeid = api->totem_nodeid_get();
 	pi->pid = req_lib_cpg_join->pid;
 	pi->group = gi;
 	list_add(&pi->list, &gi->members);
@@ -1134,13 +1127,13 @@ join_err:
 	res_lib_cpg_join.header.size = sizeof(res_lib_cpg_join);
 	res_lib_cpg_join.header.id = MESSAGE_RES_CPG_JOIN;
 	res_lib_cpg_join.header.error = error;
-	openais_conn_send_response(conn, &res_lib_cpg_join, sizeof(res_lib_cpg_join));
+	api->conn_send_response(conn, &res_lib_cpg_join, sizeof(res_lib_cpg_join));
 }
 
 /* Leave message from the library */
 static void message_handler_req_lib_cpg_leave (void *conn, void *message)
 {
-	struct process_info *pi = (struct process_info *)openais_conn_private_data_get (conn);
+	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct res_lib_cpg_leave res_lib_cpg_leave;
 	struct group_info *gi;
 	SaAisErrorT error = SA_AIS_OK;
@@ -1158,7 +1151,7 @@ static void message_handler_req_lib_cpg_leave (void *conn, void *message)
 	cpg_node_joinleave_send(gi, pi, MESSAGE_REQ_EXEC_CPG_PROCLEAVE, CONFCHG_CPG_REASON_LEAVE);
 	pi->group = NULL;
 
-	openais_ipc_flow_control_destroy (
+	api->ipc_fc_destroy (
 		conn,
 		CPG_SERVICE,
 		(unsigned char *)gi->group_name.value,
@@ -1169,14 +1162,14 @@ leave_ret:
 	res_lib_cpg_leave.header.size = sizeof(res_lib_cpg_leave);
 	res_lib_cpg_leave.header.id = MESSAGE_RES_CPG_LEAVE;
 	res_lib_cpg_leave.header.error = error;
-	openais_conn_send_response(conn, &res_lib_cpg_leave, sizeof(res_lib_cpg_leave));
+	api->conn_send_response(conn, &res_lib_cpg_leave, sizeof(res_lib_cpg_leave));
 }
 
 /* Mcast message from the library */
 static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
 {
 	struct req_lib_cpg_mcast *req_lib_cpg_mcast = (struct req_lib_cpg_mcast *)message;
-	struct process_info *pi = (struct process_info *)openais_conn_private_data_get (conn);
+	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct group_info *gi = pi->group;
 	struct iovec req_exec_cpg_iovec[2];
 	struct req_exec_cpg_mcast req_exec_cpg_mcast;
@@ -1192,7 +1185,7 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
 		res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
 		res_lib_cpg_mcast.header.error = SA_AIS_ERR_ACCESS; /* TODO Better error code ?? */
 		res_lib_cpg_mcast.flow_control_state = CPG_FLOW_CONTROL_DISABLED;
-		openais_conn_send_response(conn, &res_lib_cpg_mcast,
+		api->conn_send_response(conn, &res_lib_cpg_mcast,
 			sizeof(res_lib_cpg_mcast));
 		return;
 	}
@@ -1202,7 +1195,7 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
 		MESSAGE_REQ_EXEC_CPG_MCAST);
 	req_exec_cpg_mcast.pid = pi->pid;
 	req_exec_cpg_mcast.msglen = msglen;
-	message_source_set (&req_exec_cpg_mcast.source, conn);
+	api->ipc_source_set (&req_exec_cpg_mcast.source, conn);
 	memcpy(&req_exec_cpg_mcast.group_name, &gi->group_name,
 		sizeof(mar_cpg_name_t));
 
@@ -1212,20 +1205,20 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
 	req_exec_cpg_iovec[1].iov_len = msglen;
 
 	// TODO: guarantee type...
-	result = totempg_groups_mcast_joined (openais_group_handle, req_exec_cpg_iovec, 2, TOTEMPG_AGREED);
-	openais_ipc_flow_control_local_increment (conn);
+	result = api->totem_mcast (req_exec_cpg_iovec, 2, TOTEM_AGREED);
+	api->ipc_refcnt_inc (conn);
 
 	res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast);
 	res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
 	res_lib_cpg_mcast.header.error = SA_AIS_OK;
 	res_lib_cpg_mcast.flow_control_state = pi->flow_control_state;
-	openais_conn_send_response(conn, &res_lib_cpg_mcast,
+	api->conn_send_response(conn, &res_lib_cpg_mcast,
 		sizeof(res_lib_cpg_mcast));
 }
 
 static void message_handler_req_lib_cpg_membership (void *conn, void *message)
 {
-	struct process_info *pi = (struct process_info *)openais_conn_private_data_get (conn);
+	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 
 	log_printf(LOG_LEVEL_DEBUG, "got membership request on %p\n", conn);
 	if (!pi->group) {
@@ -1233,7 +1226,7 @@ static void message_handler_req_lib_cpg_membership (void *conn, void *message)
 		res.size = sizeof(res);
 		res.id = MESSAGE_RES_CPG_MEMBERSHIP;
 		res.error = SA_AIS_ERR_ACCESS; /* TODO Better error code */
-		openais_conn_send_response(conn, &res, sizeof(res));
+		api->conn_send_response(conn, &res, sizeof(res));
 		return;
 	}
 
@@ -1259,15 +1252,15 @@ static void message_handler_req_lib_cpg_trackstart (void *conn, void *message)
 	}
 
 	/* Find the partner connection and add us to it's process_info struct */
-	otherconn = openais_conn_partner_get (conn);
-	otherpi = (struct process_info *)openais_conn_private_data_get (conn);
+	otherconn = api->conn_partner_get (conn);
+	otherpi = (struct process_info *)api->ipc_private_data_get (conn);
 	otherpi->trackerconn = conn;
 
 tstart_ret:
 	res_lib_cpg_trackstart.header.size = sizeof(res_lib_cpg_trackstart);
 	res_lib_cpg_trackstart.header.id = MESSAGE_RES_CPG_TRACKSTART;
 	res_lib_cpg_trackstart.header.error = SA_AIS_OK;
-	openais_conn_send_response(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart));
+	api->conn_send_response(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart));
 }
 
 static void message_handler_req_lib_cpg_trackstop (void *conn, void *message)
@@ -1288,15 +1281,15 @@ static void message_handler_req_lib_cpg_trackstop (void *conn, void *message)
 	}
 
 	/* Find the partner connection and add us to it's process_info struct */
-	otherconn = openais_conn_partner_get (conn);
-	otherpi = (struct process_info *)openais_conn_private_data_get (conn);
+	otherconn = api->conn_partner_get (conn);
+	otherpi = (struct process_info *)api->ipc_private_data_get (conn);
 	otherpi->trackerconn = NULL;
 
 tstop_ret:
 	res_lib_cpg_trackstop.header.size = sizeof(res_lib_cpg_trackstop);
 	res_lib_cpg_trackstop.header.id = MESSAGE_RES_CPG_TRACKSTOP;
 	res_lib_cpg_trackstop.header.error = SA_AIS_OK;
-	openais_conn_send_response(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop));
+	api->conn_send_response(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop));
 }
 
 static void message_handler_req_lib_cpg_local_get (void *conn, void *message)
@@ -1306,9 +1299,9 @@ static void message_handler_req_lib_cpg_local_get (void *conn, void *message)
 	res_lib_cpg_local_get.header.size = sizeof(res_lib_cpg_local_get);
 	res_lib_cpg_local_get.header.id = MESSAGE_RES_CPG_LOCAL_GET;
 	res_lib_cpg_local_get.header.error = SA_AIS_OK;
-	res_lib_cpg_local_get.local_nodeid = totempg_my_nodeid_get ();
+	res_lib_cpg_local_get.local_nodeid = api->totem_nodeid_get ();
 
-	openais_conn_send_response(conn, &res_lib_cpg_local_get,
+	api->conn_send_response(conn, &res_lib_cpg_local_get,
 		sizeof(res_lib_cpg_local_get));
 }
 
@@ -1321,11 +1314,11 @@ static void message_handler_req_lib_cpg_groups_get (void *conn, void *message)
 	res_lib_cpg_groups_get.header.error = SA_AIS_OK;
 	res_lib_cpg_groups_get.num_groups = count_groups();
 
-	openais_conn_send_response(conn, &res_lib_cpg_groups_get,
+	api->conn_send_response(conn, &res_lib_cpg_groups_get,
 		sizeof(res_lib_cpg_groups_get));
 
 	/* Now do the callbacks for each group */
 	send_group_list_callbacks(res_lib_cpg_groups_get.num_groups,
-		openais_conn_partner_get (conn));
+		api->conn_partner_get (conn));
 }
 

+ 1 - 2
corosync/services/evs.c

@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2004-2006 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *

+ 4 - 113
corosync/test/Makefile

@@ -1,6 +1,5 @@
 # Copyright (c) 2002-2004 MontaVista Software, Inc.
 # Copyright (c) 2006-2008 Red Hat, Inc.
-# Copyright (c) 2006 Sun Microsystems, Inc.
 # 
 # All rights reserved.
 # 
@@ -38,59 +37,22 @@ ifeq (${OPENAIS_COMPAT}, SOLARIS)
 	override LDFLAGS += -lnsl -lsocket -lrt
 endif
 
-LIBRARIES= ../lib/libSaClm.a ../lib/libSaAmf.a ../lib/libSaCkpt.a ../lib/libSaEvt.a ../lib/libSaLck.a ../lib/libSaMsg.a ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a
+LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a
 LIBS = $(LIBRARIES) 
-BINARIES=testclm testamf1 \
-	testckpt ckptstress ckptbench \
-	ckptbenchth ckpt-rd ckpt-wr testevt testevs \
-	evsbench subscription publish evtbench unlink testclm2 testlck \
-	testmsg testmsg2 testcpg testcpg2 cpgbench testconfdb openais-cfgtool \
-	logsys_s logsys_t1 logsys_t2
+BINARIES= testevs evsbench testmsg2 testcpg testcpg2 \
+		cpgbench testconfdb openais-cfgtool
 
 override CFLAGS += -I../include
 override LDFLAGS += -L../lib
 
 EXTRA_CFLAGS = -I$(srcdir)include
-TEST_SRC =  testclm.c testamf1.c \
-	testamf4.c testamf5.c testamf6.c testamfth.c  \
-	testckpt.c ckptstress.c ckptbench.c  \
-	ckptbenchth.c testevt.c testevs.c evsbench.c \
-	subscription.c publish.c evtbench.c \
-	sa_error.c unlink.c testclm2.c testlck.c testmsg.c testmsg2.c \
-	logsys_s1.c logsys_s2.c logsys_s.c logsys_t1.c logsys_t2.c
+TEST_SRC = sa_error.c logsys_s1.c logsys_s2.c logsys_s.c logsys_t1.c logsys_t2.c
 
 all: $(BINARIES)
 
 testtimer: testtimer.o $(LIBRARIES)
 	$(CC) $(LDFLAGS) -o testtimer testtimer.o ../exec/timer.o
 
-testamf: testamf.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamf testamf.o $(LIBS)
-
-testamf1: testamf1.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamf1 testamf1.o $(LIBS)
-
-testamf2: testamf2.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamf2 testamf2.o $(LIBS)
-
-testamf3: testamf3.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamf3 testamf3.o $(LIBS)
-
-testamf4: testamf4.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamf4 testamf4.o $(LIBS)
-
-testamf5: testamf5.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamf5 testamf5.o $(LIBS)
-
-testamf6: testamf6.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamf6 testamf6.o $(LIBS)
-
-testamfth: testamfth.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testamfth testamfth.o $(LIBS)
-
-testevt: testevt.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testevt testevt.o sa_error.o $(LIBS)
-
 testevs: testevs.o $(LIBS)
 	$(CC) $(LDFLAGS) -o testevs testevs.o $(LIBS)
 
@@ -100,54 +62,6 @@ testevsth: testevsth.o $(LIBS)
 evsbench: evsbench.o $(LIBS)
 	$(CC) $(LDFLAGS) -o evsbench evsbench.o $(LIBS)
 
-testclm: testclm.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testclm testclm.o $(LIBS)
-
-testckpt: testckpt.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testckpt testckpt.o sa_error.o $(LIBS)
-
-ckptbench: ckptbench.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o ckptbench ckptbench.o sa_error.o $(LIBS)
-
-ckptbenchth: ckptbenchth.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o ckptbenchth ckptbenchth.o sa_error.o $(LIBS)
-
-ckptstress: ckptstress.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o ckptstress ckptstress.o $(LIBS)
-
-subscription: subscription.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o subscription subscription.o sa_error.o $(LIBS)
-
-publish: publish.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o publish publish.o sa_error.o $(LIBS)
-
-unlink: unlink.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o unlink unlink.o sa_error.o $(LIBS)
-
-evtbench: evtbench.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o evtbench evtbench.o sa_error.o $(LIBS)
-
-test: test.o $(LIBRARIES)
-	g++ $(LDFLAGS) -o test test.o $(LIBS)
-
-ckpt-rd: ckpt-rd.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o ckpt-rd ckpt-rd.o sa_error.o $(LIBS)
-
-ckpt-wr: ckpt-wr.o sa_error.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o ckpt-wr ckpt-wr.o sa_error.o $(LIBS)
-
-testclm2: testclm2.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testclm2 testclm2.o $(LIBS)
-
-testlck: testlck.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testlck testlck.o $(LIBS)
-
-testmsg: testmsg.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testmsg testmsg.o $(LIBS)
-
-testmsg2: testmsg2.o $(LIBRARIES)
-	$(CC) $(LDFLAGS) -o testmsg2 testmsg2.o $(LIBS)
-
 testcpg: testcpg.o $(LIBRARIES)
 	$(CC) $(LDFLAGS) -o testcpg testcpg.o $(LIBS)
 
@@ -180,26 +94,3 @@ clean:
 
 depend:
 	makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(TEST_SRC) > /dev/null 2>&1
-# DO NOT DELETE
-
-testclm.o: ../include/saAis.h ../include/saClm.h
-testamf.o: ../include/saAis.h ../include/saAmf.h ../include/saClm.h
-testamf1.o: ../include/saAis.h ../include/saAmf.h
-testamf2.o: ../include/saAis.h ../include/saAmf.h
-testamf3.o: ../include/saAis.h ../include/saAmf.h
-testamf4.o: ../include/saAis.h ../include/saAmf.h
-testamf5.o: ../include/saAis.h ../include/saAmf.h
-testamf6.o: ../include/saAis.h ../include/saAmf.h
-testamfth.o: ../include/saAis.h ../include/saAmf.h ../include/saClm.h
-testckpt.o: ../include/saAis.h ../include/saCkpt.h sa_error.h
-ckptstress.o: ../include/saAis.h ../include/saCkpt.h
-ckptbench.o: ../include/saAis.h ../include/saCkpt.h
-ckptbenchth.o: ../include/saAis.h ../include/saCkpt.h
-testevt.o: ../include/saAis.h ../include/saEvt.h
-testevs.o: ../include/evs.h
-evsbench.o: ../include/saAis.h ../include/evs.h
-subscription.o: ../include/saAis.h ../include/saEvt.h
-publish.o: ../include/saAis.h ../include/saEvt.h
-evtbench.o: ../include/saAis.h ../include/saEvt.h
-sa_error.o: ../include/saAis.h
-unlink.o: ../include/saAis.h ../include/saEvt.h

+ 1 - 1
corosync/test/testevs.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004 MontaVista Software, Inc.
- * Copyright (c) 2006 Sun Microsystems, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
  *
  * All rights reserved.
  *