Steven Dake wrote:
> This patch creates a shared library out of the ipc system and makes it
> generically useful by third parties.  It also adds a pthread_spin_lock
> check to configure.ac.
>
> Finally it removes unnecessary serialization in coropoll which results
> in a heavy performance penalty.
>
> before applying you may have to move a few files around
>
> lib/coroipc.c -> lib/coroipcc.c
> exec/ipc.c-> exec/coroipcs.c
> exec/ipc.h -> exec/coroipcs.h
> lib/libcoroipc.versions -> lib/coroipcc.versions

In case anyone else here is using git, here's an equivalent patch
that doesn't require any manual renaming.

Just save the file below, then do e.g.,

Create a private branch named coroipcs,

  git checkout -b coroipcs

then put this change on it

  git am coroipcs-shared-libary.patch

>From f1325067413dd6b4eeb10f3d24b4d7f74b7f9f1a Mon Sep 17 00:00:00 2001
From: Steven Dake <[email protected]>
Date: Fri, 20 Mar 2009 11:35:33 +0100
Subject: [PATCH] coroipcs shared library

This patch creates a shared library out of the ipc system and makes it
generically useful by third parties.  It also adds a pthread_spin_lock
check to configure.ac.

Finally it removes unnecessary serialization in coropoll which results
in a heavy performance penalty.
---
 configure.ac                                      |    5 +-
 exec/Makefile.am                                  |   23 ++-
 exec/apidef.c                                     |   16 +-
 exec/{ipc.c => coroipcs.c}                        |  178 +++++++-------------
 exec/coroipcs.h                                   |   86 ++++++++++
 exec/coropoll.c                                   |   12 +--
 exec/ipc.h                                        |   64 -------
 exec/main.c                                       |  186 +++++++++++++++++++--
 exec/main.h                                       |    6 +-
 exec/service.c                                    |    2 +-
 include/corosync/totem/coropoll.h                 |    4 +-
 lib/Makefile.am                                   |   44 +++---
 lib/{coroipc.c => coroipcc.c}                     |    0
 lib/{libcoroipc.versions => libcoroipcc.versions} |    0
 14 files changed, 383 insertions(+), 243 deletions(-)
 rename exec/{ipc.c => coroipcs.c} (84%)
 create mode 100644 exec/coroipcs.h
 delete mode 100644 exec/ipc.h
 rename lib/{coroipc.c => coroipcc.c} (100%)
 rename lib/{libcoroipc.versions => libcoroipcc.versions} (100%)

diff --git a/configure.ac b/configure.ac
index f060733..22d99bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_PREREQ([2.61])
 AC_INIT([corosync], [0.95], [[email protected]])
 AM_INIT_AUTOMAKE

-AC_CONFIG_SRCDIR([lib/coroipc.c])
+AC_CONFIG_SRCDIR([lib/coroipcc.c])
 AC_CONFIG_HEADER([include/corosync/config.h include/corosync/cs_config.h])

 AC_CANONICAL_HOST
@@ -79,7 +79,8 @@ AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \
 		getcwd getpeerucred gettimeofday inet_ntoa memmove memset \
 		mkdir scandir select socket strcasecmp strchr strdup \
-		strerror strrchr strspn strstr])
+		strerror strrchr strspn strstr pthread_spin_lock \
+		pthread_spin_unlock])

 # add man and init dirs?
 AC_CONFIG_FILES([Makefile
diff --git a/exec/Makefile.am b/exec/Makefile.am
index 7409fcd..8f9155a 100644
--- a/exec/Makefile.am
+++ b/exec/Makefile.am
@@ -38,31 +38,34 @@ INCLUDES		= -I$(top_builddir)/include -I$(top_srcdir)/include
 TOTEM_SRC		= coropoll.c totemip.c totemnet.c totemrrp.c \
 			  totemsrp.c totemmrp.c totempg.c crypto.c wthread.c
 LOGSYS_SRC		= wthread.c logsys.c
+COROIPCS_SRC		= coroipcs.c

 LCRSO_SRC		= objdb.c vsf_ykd.c coroparse.c quorum.c vsf_quorum.c
 LCRSO_OBJS		= $(LCRSO_SRC:%.c=%.o)
 LCRSO			= $(LCRSO_SRC:%.c=%.lcrso)

-lib_LIBRARIES		= libtotem_pg.a liblogsys.a
+lib_LIBRARIES		= libtotem_pg.a liblogsys.a libcoroipcs.a
 sbin_PROGRAMS		= corosync

 libtotem_pg_a_SOURCES	= $(TOTEM_SRC)
 liblogsys_a_SOURCES	= $(LOGSYS_SRC)
+libcoroipcs_a_SOURCES	= $(COROIPCS_SRC)

-corosync_SOURCES 	= main.c mempool.c util.c sync.c apidef.c service.c ipc.c \
+corosync_SOURCES 	= main.c mempool.c util.c sync.c apidef.c service.c \
 			  timer.c totemconfig.c mainconfig.c quorum.c ../lcr/lcr_ifact.c
-corosync_LDADD	  	= -ltotem_pg -llogsys
-corosync_DEPENDENCIES	= libtotem_pg.so.$(SONAME) liblogsys.so.$(SONAME)
+corosync_LDADD	  	= -ltotem_pg -llogsys -lcoroipcs
+corosync_DEPENDENCIES	= libtotem_pg.so.$(SONAME) liblogsys.so.$(SONAME) libcoroipcs.so.$(SONAME)
 corosync_LDFLAGS	= $(OS_DYFLAGS) -L./

 TOTEM_OBJS		= $(TOTEM_SRC:%.c=%.o)
 LOGSYS_OBJS		= $(LOGSYS_SRC:%.c=%.o)
+COROIPCS_OBJS		= $(COROIPCS_SRC:%.c=%.o)

 SHARED_LIBS		= $(lib_LIBRARIES:%.a=%.so.$(SONAME))
 SHARED_LIBS_SO		= $(SHARED_LIBS:%.so.$(SONAME)=%.so)
 SHARED_LIBS_SO_TWO	= $(SHARED_LIBS:%.so.$(SONAME)=%.so.$(SOMAJOR))

-noinst_HEADERS		= apidef.h crypto.h ipc.h mainconfig.h main.h mempool.h \
+noinst_HEADERS		= apidef.h crypto.h mainconfig.h main.h mempool.h \
 			  quorum.h service.h sync.h timer.h tlist.h totemconfig.h \
 			  totemmrp.h totemnet.h totemrrp.h totemsrp.h util.h \
 			  version.h vsf.h wthread.h
@@ -79,6 +82,9 @@ libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
 liblogsys.so.$(SONAME): $(LOGSYS_OBJS)
 	$(CC) $(LDFLAGS) $(DARWIN_OPTS) $(LOGSYS_OBJS) -o $@ -lpthread

+libcoroipcs.so.$(SONAME): $(COROIPCS_OBJS)
+	$(CC) $(LDFLAGS) $(DARWIN_OPTS) $(COROIPCS_OBJS) -o $@ -lpthread
+
 else

 %.lcrso: %.o
@@ -98,6 +104,13 @@ liblogsys.so.$(SONAME): $(LOGSYS_OBJS)
 	ln -sf liblogsys.so.$(SONAME) liblogsys.so
 	ln -sf liblogsys.so.$(SONAME) liblogsys.so.$(SOMAJOR)

+libcoroipcs.so.$(SONAME): $(COROIPCS_OBJS)
+	$(CC) -shared -o $@ \
+		-Wl,-soname=libcoroipcs.so.$(SOMAJOR) \
+		$^ $(LDFLAGS) -lpthread
+	ln -sf libcoroipcs.so.$(SONAME) libcoroipcs.so
+	ln -sf libcoroipcs.so.$(SONAME) libcoroipcs.so.$(SOMAJOR)
+
 endif

 lint:
diff --git a/exec/apidef.c b/exec/apidef.c
index cad349b..dd5fd78 100644
--- a/exec/apidef.c
+++ b/exec/apidef.c
@@ -46,7 +46,7 @@
 #include <corosync/totem/totempg.h>
 #include <corosync/totem/totemip.h>
 #include "main.h"
-#include "ipc.h"
+#include "coroipcs.h"
 #include "sync.h"
 #include "quorum.h"
 #include <corosync/engine/coroapi.h>
@@ -77,13 +77,13 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = {
 	.timer_expire_time_get = corosync_timer_expire_time_get,
 	.ipc_source_set = message_source_set,
 	.ipc_source_is_local = message_source_is_local,
-	.ipc_private_data_get = cs_conn_private_data_get,
-	.ipc_response_iov_send = cs_response_iov_send,
-	.ipc_response_send = cs_response_send,
-	.ipc_dispatch_send = cs_dispatch_send,
-	.ipc_dispatch_iov_send = cs_dispatch_iov_send,
-	.ipc_refcnt_inc =  cs_conn_refcount_inc,
-	.ipc_refcnt_dec = cs_conn_refcount_dec,
+	.ipc_private_data_get = coroipcs_conn_private_data_get,
+	.ipc_response_iov_send = coroipcs_response_iov_send,
+	.ipc_response_send = coroipcs_response_send,
+	.ipc_dispatch_send = coroipcs_dispatch_send,
+	.ipc_dispatch_iov_send = coroipcs_dispatch_iov_send,
+	.ipc_refcnt_inc =  coroipcs_conn_refcount_inc,
+	.ipc_refcnt_dec = coroipcs_conn_refcount_dec,
 	.totem_nodeid_get = totempg_my_nodeid_get,
 	.totem_family_get = totempg_my_family_get,
 	.totem_ring_reenable = totempg_ring_reenable,
diff --git a/exec/ipc.c b/exec/coroipcs.c
similarity index 84%
rename from exec/ipc.c
rename to exec/coroipcs.c
index 23d3e86..81ad3ad 100644
--- a/exec/ipc.c
+++ b/exec/coroipcs.c
@@ -75,22 +75,11 @@
 #include <corosync/totem/totempg.h>
 #include <corosync/engine/objdb.h>
 #include <corosync/engine/config.h>
-#include <corosync/engine/logsys.h>

-#include "quorum.h"
 #include "poll.h"
-#include "totemsrp.h"
-#include "mempool.h"
-#include "mainconfig.h"
-#include "totemconfig.h"
+#include "coroipcs.h"
 #include "main.h"
-#include "tlist.h"
-#include "ipc.h"
-#include "sync.h"
 #include <corosync/engine/coroapi.h>
-#include "service.h"
-
-LOGSYS_DECLARE_SUBSYS ("IPC", LOG_INFO);

 #include "util.h"

@@ -105,9 +94,7 @@ LOGSYS_DECLARE_SUBSYS ("IPC", LOG_INFO);

 static unsigned int g_gid_valid = 0;

-static void (*ipc_serialize_lock_fn) (void);
-
-static void (*ipc_serialize_unlock_fn) (void);
+static struct coroipcs_init_state *api;

 DECLARE_LIST_INIT (conn_info_list_head);

@@ -152,10 +139,10 @@ struct conn_info {
 	struct shared_memory *mem;
 	struct list_head outq_head;
 	void *private_data;
-	int (*lib_exit_fn) (void *conn);
 	struct list_head list;
 	char setup_msg[sizeof (mar_req_setup_t)];
 	unsigned int setup_bytes_read;
+	char *sending_allowed_private_data[64];
 };

 static int shared_mem_dispatch_bytes_left (struct conn_info *conn_info);
@@ -220,7 +207,7 @@ static inline int conn_info_destroy (struct conn_info *conn_info)
 		conn_info->state == CONN_STATE_DISCONNECT_INACTIVE) {
 		list_del (&conn_info->list);
 		close (conn_info->fd);
-		free (conn_info);
+		api->free (conn_info);
 		return (-1);
 	}

@@ -229,12 +216,14 @@ static inline int conn_info_destroy (struct conn_info *conn_info)
 		return (0);
 	}

+	api->serialize_lock ();
 	/*
 	 * Retry library exit function if busy
 	 */
 	if (conn_info->state == CONN_STATE_THREAD_DESTROYED) {
-		res = ais_service[conn_info->service]->lib_exit_fn (conn_info);
+		res = api->exit_fn_get (conn_info->service) (conn_info);
 		if (res == -1) {
+			api->serialize_unlock ();
 			return (0);
 		} else {
 			conn_info->state = CONN_STATE_LIB_EXIT_CALLED;
@@ -244,6 +233,7 @@ static inline int conn_info_destroy (struct conn_info *conn_info)
 	pthread_mutex_lock (&conn_info->mutex);
 	if (conn_info->refcount > 0) {
 		pthread_mutex_unlock (&conn_info->mutex);
+		api->serialize_unlock ();
 		return (0);
 	}
 	list_del (&conn_info->list);
@@ -260,10 +250,11 @@ static inline int conn_info_destroy (struct conn_info *conn_info)
 	 * Free allocated data needed to retry exiting library IPC connection
 	 */
 	if (conn_info->private_data) {
-		free (conn_info->private_data);
+		api->free (conn_info->private_data);
 	}
 	close (conn_info->fd);
-	free (conn_info);
+	api->free (conn_info);
+	api->serialize_unlock ();
 	return (-1);
 }

@@ -279,9 +270,7 @@ static void *pthread_ipc_consumer (void *conn)
 	int res;
 	mar_req_header_t *header;
 	struct res_overlay res_overlay;
-	struct iovec send_ok_joined_iovec;
-	int send_ok = 0;
-	int reserved_msgs = 0;
+	int send_ok;

 	for (;;) {
 		sop.sem_num = 0;
@@ -289,7 +278,7 @@ static void *pthread_ipc_consumer (void *conn)
 		sop.sem_flg = 0;
 retry_semop:
 		if (ipc_thread_active (conn_info) == 0) {
-			cs_conn_refcount_dec (conn_info);
+			coroipcs_conn_refcount_dec (conn_info);
 			pthread_exit (0);
 		}
 		res = semop (conn_info->semid, &sop, 1);
@@ -297,47 +286,38 @@ retry_semop:
 			goto retry_semop;
 		} else
 		if ((res == -1) && (errno == EINVAL || errno == EIDRM)) {
-			cs_conn_refcount_dec (conn_info);
+			coroipcs_conn_refcount_dec (conn_info);
 			pthread_exit (0);
 		}

-		cs_conn_refcount_inc (conn_info);
-
-		header = (mar_req_header_t *)conn_info->mem->req_buffer;
-
-		send_ok_joined_iovec.iov_base = (char *)header;
-		send_ok_joined_iovec.iov_len = header->size;
-
-		reserved_msgs = totempg_groups_joined_reserve (
-			corosync_group_handle,
-			&send_ok_joined_iovec, 1);
+		coroipcs_conn_refcount_inc (conn_info);

-		send_ok =
-			(corosync_quorum_is_quorate() == 1 || ais_service[conn_info->service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) && (
-			(ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) ||
-			((ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) &&
-			(reserved_msgs) &&
-			(sync_in_process() == 0)));
+                header = (mar_req_header_t *)conn_info->mem->req_buffer;

+		send_ok = api->sending_allowed (conn_info->service,
+			header->id,
+			header,	
+			conn_info->sending_allowed_private_data);
+	
 		if (send_ok) {
-			ipc_serialize_lock_fn();
-			ais_service[conn_info->service]->lib_engine[header->id].lib_handler_fn (conn_info, header);
-			ipc_serialize_unlock_fn();
+			api->serialize_lock();
+			api->handler_fn_get (conn_info->service, header->id) (conn_info, header);
+			api->serialize_unlock();
 		} else {
 			/*
 			 * Overload, tell library to retry
 			 */
 			res_overlay.header.size =
-					ais_service[conn_info->service]->lib_engine[header->id].response_size;
+				api->response_size_get (conn_info->service, header->id);
 			res_overlay.header.id =
-				ais_service[conn_info->service]->lib_engine[header->id].response_id;
+				api->response_id_get (conn_info->service, header->id);
 			res_overlay.header.error = CS_ERR_TRY_AGAIN;
-			cs_response_send (conn_info, &res_overlay, 
+			coroipcs_response_send (conn_info, &res_overlay, 
 				res_overlay.header.size);
 		}

-		totempg_groups_joined_release (reserved_msgs);
-		cs_conn_refcount_dec (conn);
+		api->sending_allowed_release (conn_info->sending_allowed_private_data);
+		coroipcs_conn_refcount_dec (conn);
 	}
 	pthread_exit (0);
 }
@@ -398,7 +378,7 @@ req_setup_recv (
 	if (getpeereid(conn_info->fd, &euid, &egid) != -1 &&
 	    (euid == 0 || egid == g_gid_valid)) {
 		if (conn_info->state == CONN_IO_STATE_INITIALIZING) {
-			log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated because gid is %d, expecting %d\n", egid, g_gid_valid);
+			api->log_printf ("Connection not authenticated because gid is %d, expecting %d\n", egid, g_gid_valid);
 			return (-1);
 		}
 	}
@@ -420,10 +400,10 @@ req_setup_recv (
 		ucred_free(uc);
 	}
 	if (conn_info->authenticated == 0) {
-		log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated because gid is %d, expecting %d\n", (int)egid, g_gid_valid);
+		api->log_printf ("Connection not authenticated because gid is %d, expecting %d\n", (int)egid, g_gid_valid);
  	}
 #else /* HAVE_GETPEERUCRED */
- 	log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated "
+ 	api->log_printf (LOG_LEVEL_SECURITY, "Connection not authenticated "
  		"because platform does not support "
  		"authentication with sockets, continuing "
  		"with a fake authentication\n");
@@ -466,8 +446,7 @@ retry_recv:
 		if (cred->uid == 0 || cred->gid == g_gid_valid) {
 		} else {
 			ipc_disconnect (conn_info);
-			log_printf (LOG_LEVEL_SECURITY,
-				"Connection not authenticated because gid is %d, expecting %d\n",
+			api->log_printf ("Connection not authenticated because gid is %d, expecting %d\n",
 				cred->gid, g_gid_valid);
 			return (-1);
 		}
@@ -530,7 +509,7 @@ static int poll_handler_connection (
 		/*
 		 * Is the service registered ?
 		 */
-		if (!ais_service[req_setup->service]) {
+		if (api->service_available (req_setup->service) == 0) {
 			ipc_disconnect (conn_info);
 			return (0);
 		}
@@ -554,11 +533,11 @@ static int poll_handler_connection (
 		conn_info->refcount = 1; 
 		conn_info->state = CONN_STATE_THREAD_ACTIVE;

-		conn_info->private_data = malloc (ais_service[conn_info->service]->private_data_size);
+		conn_info->private_data = api->malloc (api->private_data_size_get (conn_info->service));
 		memset (conn_info->private_data, 0,
-			ais_service[conn_info->service]->private_data_size);
-		ais_service[conn_info->service]->lib_init_fn (conn_info);
+			api->private_data_size_get (conn_info->service));

+		api->init_fn_get (conn_info->service) (conn_info);

 		pthread_attr_init (&conn_info->thread_attr);
 		/*
@@ -585,7 +564,7 @@ static int poll_handler_connection (
 		}
 	} else
 	if (revent & POLLIN) {
-		cs_conn_refcount_inc (conn_info);
+		coroipcs_conn_refcount_inc (conn_info);
 		res = recv (fd, &buf, 1, MSG_NOSIGNAL);
 		if (res == 1) {
 			switch (buf) {
@@ -601,7 +580,7 @@ static int poll_handler_connection (
 				res = 0;
 				break;
 			}
-			cs_conn_refcount_dec (conn_info);
+			coroipcs_conn_refcount_dec (conn_info);
 		}
 #if defined(COROSYNC_SOLARIS) || defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN)
 		/* On many OS poll never return POLLHUP or POLLERR.
@@ -614,7 +593,7 @@ static int poll_handler_connection (
 #endif
 	}

-	cs_conn_refcount_inc (conn_info);
+	coroipcs_conn_refcount_inc (conn_info);
 	pthread_mutex_lock (&conn_info->mutex);
 	if ((conn_info->state == CONN_STATE_THREAD_ACTIVE) && (revent & POLLOUT)) {
 		buf = !list_empty (&conn_info->outq_head);
@@ -642,7 +621,7 @@ static int poll_handler_connection (
 		}
 	}
 	pthread_mutex_unlock (&conn_info->mutex);
-	cs_conn_refcount_dec (conn_info);
+	coroipcs_conn_refcount_dec (conn_info);

 	return (0);
 }
@@ -667,7 +646,7 @@ static int conn_info_create (int fd)
 {
 	struct conn_info *conn_info;

-	conn_info = malloc (sizeof (struct conn_info));
+	conn_info = api->malloc (sizeof (struct conn_info));
 	if (conn_info == NULL) {
 		return (-1);
 	}
@@ -722,14 +701,14 @@ retry_accept:
 	}

 	if (new_fd == -1) {
-		log_printf (LOG_LEVEL_ERROR, "ERROR: Could not accept Library connection: %s\n", strerror (errno));
+		api->log_printf ("Could not accept Library connection: %s\n", strerror (errno));
 		return (0); /* This is an error, but -1 would indicate disconnect from poll loop */
 	}

 	totemip_nosigpipe(new_fd);
 	res = fcntl (new_fd, F_SETFL, O_NONBLOCK);
 	if (res == -1) {
-		log_printf (LOG_LEVEL_ERROR, "Could not set non-blocking operation on library connection: %s\n", strerror (errno));
+		api->log_printf ("Could not set non-blocking operation on library connection: %s\n", strerror (errno));
 		close (new_fd);
 		return (0); /* This is an error, but -1 would indicate disconnect from poll loop */
 	}
@@ -745,8 +724,6 @@ retry_accept:
 	setsockopt(new_fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on));
 #endif

-	log_printf (LOG_LEVEL_DEBUG, "connection received from libais client %d.\n", new_fd);
-
 	res = conn_info_create (new_fd);
 	if (res != 0) {
 		close (new_fd);
@@ -754,57 +731,32 @@ retry_accept:

 	return (0);
 }
+
 /*
  * Exported functions
  */
-
-int message_source_is_local(mar_message_source_t *source)
-{
-	int ret = 0;
-
-	assert (source != NULL);
-	if (source->nodeid == totempg_my_nodeid_get ()) {
-		ret = 1;
-	}
-	return ret;
-}
-
-void message_source_set (
-	mar_message_source_t *source,
-	void *conn)
-{
-	assert ((source != NULL) && (conn != NULL));
-	memset (source, 0, sizeof (mar_message_source_t));
-	source->nodeid = totempg_my_nodeid_get ();
-	source->conn = conn;
-}
-
-void cs_ipc_init (
-	unsigned int gid_valid,
-	void (*serialize_lock_fn) (void),
-	void (*serialize_unlock_fn) (void))
+extern void coroipcs_ipc_init (
+        struct coroipcs_init_state *init_state)
 {
 	int libais_server_fd;
 	struct sockaddr_un un_addr;
 	int res;

-	ipc_serialize_lock_fn = serialize_lock_fn;
-
-	ipc_serialize_unlock_fn = serialize_unlock_fn;
+	api = init_state;

 	/*
 	 * Create socket for libais clients, name socket, listen for connections
 	 */
 	libais_server_fd = socket (PF_UNIX, SOCK_STREAM, 0);
 	if (libais_server_fd == -1) {
-		log_printf (LOG_LEVEL_ERROR ,"Cannot create libais client connections socket.\n");
+		api->log_printf ("Cannot create libais client connections socket.\n");
 		corosync_exit_error (AIS_DONE_LIBAIS_SOCKET);
 	};

 	totemip_nosigpipe (libais_server_fd);
 	res = fcntl (libais_server_fd, F_SETFL, O_NONBLOCK);
 	if (res == -1) {
-		log_printf (LOG_LEVEL_ERROR, "Could not set non-blocking operation on server socket: %s\n", strerror (errno));
+		api->log_printf ("Could not set non-blocking operation on server socket: %s\n", strerror (errno));
 		corosync_exit_error (AIS_DONE_LIBAIS_SOCKET);
 	}

@@ -824,7 +776,7 @@ void cs_ipc_init (

 	res = bind (libais_server_fd, (struct sockaddr *)&un_addr, AIS_SUN_LEN(&un_addr));
 	if (res) {
-		log_printf (LOG_LEVEL_ERROR, "ERROR: Could not bind AF_UNIX: %s.\n", strerror (errno));
+		api->log_printf ("Could not bind AF_UNIX: %s.\n", strerror (errno));
 		corosync_exit_error (AIS_DONE_LIBAIS_BIND);
 	}
 	listen (libais_server_fd, SERVER_BACKLOG);
@@ -835,10 +787,10 @@ void cs_ipc_init (
         poll_dispatch_add (corosync_poll_handle, libais_server_fd,
                 POLLIN|POLLNVAL, 0, poll_handler_accept);

-	g_gid_valid = gid_valid;
+	g_gid_valid = 0;//gid_valid;
 }

-void cs_ipc_exit (void)
+void coroipcs_ipc_exit (void)
 {
 	struct list_head *list;
 	struct conn_info *conn_info;
@@ -859,14 +811,14 @@ void cs_ipc_exit (void)
 /*
  * Get the conn info private data
  */
-void *cs_conn_private_data_get (void *conn)
+void *coroipcs_conn_private_data_get (void *conn)
 {
 	struct conn_info *conn_info = (struct conn_info *)conn;

 	return (conn_info->private_data);
 }

-int cs_response_send (void *conn, void *msg, int mlen)
+int coroipcs_response_send (void *conn, void *msg, int mlen)
 {
 	struct conn_info *conn_info = (struct conn_info *)conn;
 	struct sembuf sop;
@@ -888,7 +840,7 @@ retry_semop:
 	return (0);
 }

-int cs_response_iov_send (void *conn, struct iovec *iov, int iov_len)
+int coroipcs_response_iov_send (void *conn, struct iovec *iov, int iov_len)
 {
 	struct conn_info *conn_info = (struct conn_info *)conn;
 	struct sembuf sop;
@@ -1022,8 +974,8 @@ static void outq_flush (struct conn_info *conn_info) {
 			iov.iov_len = outq_item->mlen;
 			msg_send (conn_info, &iov, 1, MSG_SEND_UNLOCKED);
 			list_del (list);
-			free (iov.iov_base);
-			free (outq_item);
+			api->free (iov.iov_base);
+			api->free (outq_item);
 		} else {
 			break;
 		}
@@ -1096,14 +1048,14 @@ static void msg_send_or_queue (void *conn, struct iovec *iov, int iov_len)
 		bytes_msg += iov[i].iov_len;
 	}
 	if (bytes_left < bytes_msg || list_empty (&conn_info->outq_head) == 0) {
-		outq_item = malloc (sizeof (struct outq_item));
+		outq_item = api->malloc (sizeof (struct outq_item));
 		if (outq_item == NULL) {
 			ipc_disconnect (conn);
 			return;
 		}
-		outq_item->msg = malloc (bytes_msg);
+		outq_item->msg = api->malloc (bytes_msg);
 		if (outq_item->msg == 0) {
-			free (outq_item);
+			api->free (outq_item);
 			ipc_disconnect (conn);
 			return;
 		}
@@ -1129,7 +1081,7 @@ static void msg_send_or_queue (void *conn, struct iovec *iov, int iov_len)
 	msg_send (conn, iov, iov_len, MSG_SEND_LOCKED);
 }

-void cs_conn_refcount_inc (void *conn)
+void coroipcs_conn_refcount_inc (void *conn)
 {
 	struct conn_info *conn_info = (struct conn_info *)conn;

@@ -1138,7 +1090,7 @@ void cs_conn_refcount_inc (void *conn)
 	pthread_mutex_unlock (&conn_info->mutex);
 }

-void cs_conn_refcount_dec (void *conn)
+void coroipcs_conn_refcount_dec (void *conn)
 {
 	struct conn_info *conn_info = (struct conn_info *)conn;

@@ -1147,7 +1099,7 @@ void cs_conn_refcount_dec (void *conn)
 	pthread_mutex_unlock (&conn_info->mutex);
 }

-int cs_dispatch_send (void *conn, void *msg, int mlen)
+int coroipcs_dispatch_send (void *conn, void *msg, int mlen)
 {
 	struct iovec iov;

@@ -1158,7 +1110,7 @@ int cs_dispatch_send (void *conn, void *msg, int mlen)
 	return (0);
 }

-int cs_dispatch_iov_send (void *conn, struct iovec *iov, int iov_len)
+int coroipcs_dispatch_iov_send (void *conn, struct iovec *iov, int iov_len)
 {
 	msg_send_or_queue (conn, iov, iov_len);
 	return (0);
diff --git a/exec/coroipcs.h b/exec/coroipcs.h
new file mode 100644
index 0000000..0cf14f2
--- /dev/null
+++ b/exec/coroipcs.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2006-2009 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake ([email protected])
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef COROIPCS_H_DEFINED
+#define COROIPCS_H_DEFINED
+
+#include <stdlib.h>
+
+typedef int (*coroipcs_init_fn_lvalue) (void *conn);
+typedef int (*coroipcs_exit_fn_lvalue) (void *conn);
+typedef void (*coroipcs_handler_fn_lvalue) (void *conn, void *msg);
+
+struct coroipcs_init_state {
+	void *(*malloc) (size_t size);
+	void (*free) (void *ptr);
+        void (*log_printf) (
+                const char *format,
+                ...) __attribute__((format(printf, 1, 2)));
+
+	int (*service_available)(unsigned int service);
+	int (*private_data_size_get)(unsigned int service);
+	int (*security_valid)(int uid, int gid);
+	void (*serialize_lock)(void);
+	void (*serialize_unlock)(void);
+	int (*response_size_get)(unsigned int service, unsigned int id);
+	int (*response_id_get)(unsigned int service, unsigned int id);
+	int (*sending_allowed)(unsigned int service, unsigned int id,
+		void *msg, void *sending_allowed_private_data);
+	void (*sending_allowed_release)(void *sending_allowed_private_data);
+
+	coroipcs_init_fn_lvalue (*init_fn_get)(unsigned int service);
+	coroipcs_exit_fn_lvalue (*exit_fn_get)(unsigned int service);
+	coroipcs_handler_fn_lvalue (*handler_fn_get)(unsigned int service, unsigned int id);
+};
+
+extern void coroipcs_ipc_init (
+	struct coroipcs_init_state *init_state);
+
+extern void *coroipcs_conn_private_data_get (void *conn);
+
+extern int coroipcs_response_send (void *conn, void *msg, int mlen);
+
+extern int coroipcs_response_iov_send (void *conn, struct iovec *iov, int iov_len);
+
+extern int coroipcs_dispatch_send (void *conn, void *msg, int mlen);
+
+extern int coroipcs_dispatch_iov_send (void *conn, struct iovec *iov, int iov_len);
+
+extern void coroipcs_conn_refcount_inc (void *conn);
+
+extern void coroipcs_conn_refcount_dec (void *conn);
+
+extern void coroipcs_ipc_exit (void);
+
+#endif /* COROIPCS_H_DEFINED */
diff --git a/exec/coropoll.c b/exec/coropoll.c
index 0453400..297f62f 100644
--- a/exec/coropoll.c
+++ b/exec/coropoll.c
@@ -60,8 +60,6 @@ struct poll_instance {
 	struct pollfd *ufds;
 	int poll_entry_count;
 	struct timerlist timerlist;
-	void (*serialize_lock_fn) (void);
-	void (*serialize_unlock_fn) (void);
 	int stop_requested;
 };

@@ -74,9 +72,7 @@ static struct hdb_handle_database poll_instance_database = {
 	.iterator	= 0
 };

-hdb_handle_t poll_create (
-	void (*serialize_lock_fn) (void),
-	void (*serialize_unlock_fn) (void))
+hdb_handle_t poll_create (void)
 {
 	hdb_handle_t handle;
 	struct poll_instance *poll_instance;
@@ -97,8 +93,6 @@ hdb_handle_t poll_create (
 	poll_instance->ufds = 0;
 	poll_instance->poll_entry_count = 0;
 	poll_instance->stop_requested = 0;
-	poll_instance->serialize_lock_fn = serialize_lock_fn;
-	poll_instance->serialize_unlock_fn = serialize_unlock_fn;
 	timerlist_init (&poll_instance->timerlist);

 	return (handle);
@@ -408,13 +402,11 @@ retry_poll:
 			if (poll_instance->ufds[i].fd != -1 &&
 				poll_instance->ufds[i].revents) {

-				poll_instance->serialize_lock_fn();
 				res = poll_instance->poll_entries[i].dispatch_fn (handle,
 					poll_instance->ufds[i].fd, 
 					poll_instance->ufds[i].revents,
 					poll_instance->poll_entries[i].data);

-				poll_instance->serialize_unlock_fn();
 				/*
 				 * Remove dispatch functions that return -1
 				 */
@@ -423,9 +415,7 @@ retry_poll:
 				}
 			}
 		}
-		poll_instance->serialize_lock_fn();
 		timerlist_expire (&poll_instance->timerlist);
-		poll_instance->serialize_unlock_fn();
 	} /* for (;;) */

 	hdb_handle_put (&poll_instance_database, handle);
diff --git a/exec/ipc.h b/exec/ipc.h
deleted file mode 100644
index f2499fe..0000000
--- a/exec/ipc.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2006-2009 Red Hat, Inc.
- *
- * All rights reserved.
- *
- * Author: Steven Dake ([email protected])
- *
- * This software licensed under BSD license, the text of which follows:
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * - Neither the name of the MontaVista Software, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived from this
- *   software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IPC_H_DEFINED
-#define IPC_H_DEFINED
-
-extern void message_source_set (mar_message_source_t *source, void *conn);
-
-extern int message_source_is_local (mar_message_source_t *source);
-
-extern void cs_ipc_init (
-	unsigned int gid_valid,
-        void (*serialize_lock_fn) (void),
-        void (*serialize_unlock_fn) (void)
-);
-
-extern void *cs_conn_private_data_get (void *conn);
-
-extern int cs_response_send (void *conn, void *msg, int mlen);
-
-extern int cs_response_iov_send (void *conn, struct iovec *iov, int iov_len);
-
-extern int cs_dispatch_send (void *conn, void *msg, int mlen);
-
-extern int cs_dispatch_iov_send (void *conn, struct iovec *iov, int iov_len);
-
-extern void cs_conn_refcount_inc (void *conn);
-
-extern void cs_conn_refcount_dec (void *conn);
-
-extern void cs_ipc_exit (void);
-
-#endif /* IPC_H_DEFINED */
diff --git a/exec/main.c b/exec/main.c
index 4c67a35..3a70ff3 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002-2006 MontaVista Software, Inc.
- * Copyright (c) 2006-2008 Red Hat, Inc.
+ * Copyright (c) 2006-2009 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -75,7 +75,7 @@
 #include "main.h"
 #include "sync.h"
 #include "tlist.h"
-#include "ipc.h"
+#include "coroipcs.h"
 #include "timer.h"
 #include "util.h"
 #include "apidef.h"
@@ -95,7 +95,11 @@ LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO);

 static unsigned int service_count = 32;

+#if defined(HAVE_PTHREAD_SPIN_LOCK)
+static pthread_spinlock_t serialize_spin;
+#else
 static pthread_mutex_t serialize_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif

 static struct totem_logging_configuration totem_logging_configuration;

@@ -146,7 +150,7 @@ static void *corosync_exit (void *arg)

 	poll_stop (0);
 	totempg_finalize ();
-	cs_ipc_exit ();
+	coroipcs_ipc_exit ();
 	corosync_exit_error (AIS_DONE_EXIT);

 	/* never reached */
@@ -203,15 +207,28 @@ static int pool_sizes[] = { 0, 0, 0, 0, 0, 4096, 0, 1, 0, /* 256 */
 					1024, 0, 1, 4096, 0, 0, 0, 0, /* 65536 */
 					1, 1, 1, 1, 1, 1, 1, 1, 1 };

-void serialize_mutex_lock (void)
+#if defined(HAVE_PTHREAD_SPIN_LOCK)
+void serialize_lock (void)
+{
+	pthread_spin_lock (&serialize_spin);
+}
+
+void serialize_unlock (void)
+{
+	pthread_spin_unlock (&serialize_spin);
+}
+#else
+void serialize_lock (void)
 {
 	pthread_mutex_lock (&serialize_mutex);
 }

-void serialize_mutex_unlock (void)
+void serialize_unlock (void)
 {
 	pthread_mutex_unlock (&serialize_mutex);
 }
+#endif
+


 static void corosync_sync_completed (void)
@@ -258,6 +275,7 @@ static void confchg_fn (
 {
 	int i;

+	serialize_lock ();
 	memcpy (&corosync_ring_id, ring_id, sizeof (struct memb_ring_id));

 	/*
@@ -271,6 +289,7 @@ static void confchg_fn (
 				joined_list, joined_list_entries, ring_id);
 		}
 	}
+	serialize_unlock ();
 }

 static void priv_drop (struct main_config *main_config)
@@ -427,6 +446,9 @@ static void deliver_fn (
 	fn_id = header->id & 0xffff;
 	if (!ais_service[service])
 		return;
+
+	serialize_lock();
+
 	if (endian_conversion_required) {
 		assert(ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn != NULL);
 		ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn
@@ -435,6 +457,8 @@ static void deliver_fn (

 	ais_service[service]->exec_engine[fn_id].exec_handler_fn
 		(header, nodeid);
+
+	serialize_unlock();
 }

 void main_get_config_modules(struct config_iface_ver0 ***modules, int *num)
@@ -451,6 +475,140 @@ int main_mcast (
 	return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee));
 }

+int message_source_is_local (mar_message_source_t *source)
+{
+	int ret = 0;
+
+	assert (source != NULL);
+	if (source->nodeid == totempg_my_nodeid_get ()) {
+		ret = 1;
+	}
+	return ret;
+}
+
+void message_source_set (
+	mar_message_source_t *source,
+	void *conn)
+{
+	assert ((source != NULL) && (conn != NULL));
+	memset (source, 0, sizeof (mar_message_source_t));
+	source->nodeid = totempg_my_nodeid_get ();
+	source->conn = conn;
+}
+
+/*
+ * Provides the glue from corosync to the IPC Service
+ */
+static int corosync_private_data_size_get (unsigned int service)
+{
+	return (ais_service[service]->private_data_size);
+}
+
+static coroipcs_init_fn_lvalue corosync_init_fn_get (unsigned int service)
+{
+	return (ais_service[service]->lib_init_fn);
+}
+
+static coroipcs_exit_fn_lvalue corosync_exit_fn_get (unsigned int service)
+{
+	return (ais_service[service]->lib_exit_fn);
+}
+
+static coroipcs_handler_fn_lvalue corosync_handler_fn_get (unsigned int service, unsigned int id)
+{
+	return (ais_service[service]->lib_engine[id].lib_handler_fn);
+}
+
+
+static int corosync_service_available (unsigned int service)
+{
+	return (ais_service[service]);
+}
+
+static int corosync_response_size_get (unsigned int service, unsigned int id)
+{
+	return (ais_service[service]->lib_engine[id].response_size);
+
+}
+
+static int corosync_response_id_get (unsigned int service, unsigned int id)
+{
+	return (ais_service[service]->lib_engine[id].response_id);
+}
+
+
+struct sending_allowed_private_data_struct {
+	int reserved_msgs;
+};
+
+static int corosync_sending_allowed (
+	unsigned int service,
+	unsigned int id, 
+	void *msg,
+	void *sending_allowed_private_data)
+{
+	struct sending_allowed_private_data_struct *pd =
+		(struct sending_allowed_private_data_struct *)sending_allowed_private_data;
+	struct iovec reserve_iovec;
+	mar_req_header_t *header = (mar_req_header_t *)msg;
+	int sending_allowed;
+
+	reserve_iovec.iov_base = (char *)header;
+	reserve_iovec.iov_len = header->size;
+
+	pd->reserved_msgs = totempg_groups_joined_reserve (
+		corosync_group_handle,
+		&reserve_iovec, 1);
+
+	sending_allowed =
+		(corosync_quorum_is_quorate() == 1 ||
+		ais_service[service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) &&
+		((ais_service[service]->lib_engine[id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) ||
+		((ais_service[service]->lib_engine[id].flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) &&
+		(pd->reserved_msgs) &&
+		(sync_in_process() == 0)));
+
+	return (sending_allowed);
+}
+
+static void corosync_sending_allowed_release (void *sending_allowed_private_data)
+{
+	struct sending_allowed_private_data_struct *pd =
+		(struct sending_allowed_private_data_struct *)sending_allowed_private_data;
+
+	totempg_groups_joined_release (pd->reserved_msgs);
+}
+
+static int ipc_subsys_id = -1;
+
+static void ipc_log_printf (char *format, ...) {
+        va_list ap;
+
+        va_start (ap, format);
+	
+       _logsys_log_printf (ipc_subsys_id, __FUNCTION__,	
+                __FILE__, __LINE__, LOG_LEVEL_ERROR, format, ap);
+
+        va_end (ap);
+}
+
+struct coroipcs_init_state ipc_init_state = {
+	.malloc				= malloc,
+	.free				= free,
+	.log_printf			= ipc_log_printf,
+	.service_available		= corosync_service_available,
+	.private_data_size_get		= corosync_private_data_size_get,
+	.serialize_lock			= serialize_lock,
+	.serialize_unlock		= serialize_unlock,
+	.sending_allowed		= corosync_sending_allowed,
+	.sending_allowed_release	= corosync_sending_allowed_release,
+	.response_size_get		= corosync_response_size_get,
+	.response_id_get		= corosync_response_id_get,
+	.init_fn_get			= corosync_init_fn_get,
+	.exit_fn_get			= corosync_exit_fn_get,
+	.handler_fn_get			= corosync_handler_fn_get
+};
+
 int main (int argc, char **argv)
 {
 	const char *error_string;
@@ -467,6 +625,10 @@ int main (int argc, char **argv)
 	int res, ch;
 	int background, setprio;

+#if defined(HAVE_PTHREAD_SPIN_LOCK)
+	pthread_spin_init (&serialize_spin, 0);
+#endif
+
  	/* default configuration
 	 */
 	background = 1;
@@ -505,14 +667,12 @@ int main (int argc, char **argv)
 	(void)signal (SIGQUIT, sigquit_handler);
 	
 	corosync_timer_init (
-		serialize_mutex_lock,
-		serialize_mutex_unlock);
+		serialize_lock,
+		serialize_unlock);

 	log_printf (LOG_LEVEL_NOTICE, "Corosync Executive Service: started and ready to provide service.\n");

-	corosync_poll_handle = poll_create (
-		serialize_mutex_lock,
-		serialize_mutex_unlock);
+	corosync_poll_handle = poll_create ();

 	/*
 	 * Load the object database interface
@@ -682,9 +842,9 @@ int main (int argc, char **argv)

 	corosync_mempool_init ();

-	cs_ipc_init (main_config.gid,
-		serialize_mutex_lock,
-		serialize_mutex_unlock);
+	ipc_subsys_id = _logsys_subsys_create ("IPC", LOG_INFO);
+
+	coroipcs_ipc_init (&ipc_init_state);

 	/*
 	 * Start main processing loop
diff --git a/exec/main.h b/exec/main.h
index cbe00f6..42c4d2d 100644
--- a/exec/main.h
+++ b/exec/main.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002-2006 MontaVista Software, Inc.
- * Copyright (c) 2006-2007 Red Hat, Inc.
+ * Copyright (c) 2006-2009 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -62,4 +62,8 @@ extern int main_mcast (
 	int iov_len,
 	unsigned int guarantee);

+extern void message_source_set (mar_message_source_t *source, void *conn);
+
+extern int message_source_is_local (mar_message_source_t *source);
+
 #endif /* MAIN_H_DEFINED */
diff --git a/exec/service.c b/exec/service.c
index 4da06b5..3746cd0 100644
--- a/exec/service.c
+++ b/exec/service.c
@@ -51,7 +51,7 @@
 #include <corosync/totem/totempg.h>
 #include <corosync/totem/totemip.h>
 #include "main.h"
-#include "ipc.h"
+#include "coroipcs.h"
 #include <corosync/engine/coroapi.h>
 #include "service.h"

diff --git a/include/corosync/totem/coropoll.h b/include/corosync/totem/coropoll.h
index a2d089c..57edf88 100644
--- a/include/corosync/totem/coropoll.h
+++ b/include/corosync/totem/coropoll.h
@@ -39,9 +39,7 @@

 typedef void * poll_timer_handle;

-hdb_handle_t poll_create (
-	void (*serialize_lock) (void),
-	void (*serialize_unlock) (void));
+hdb_handle_t poll_create (void);

 int poll_destroy (hdb_handle_t hdb_handle_t);

diff --git a/lib/Makefile.am b/lib/Makefile.am
index a853983..32c8341 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -37,23 +37,23 @@ AM_CFLAGS		= -fPIC
 INCLUDES		= -I$(top_builddir)/include -I$(top_srcdir)/include

 lib_LIBRARIES		= libcpg.a libconfdb.a libevs.a libcfg.a libquorum.a \
-			  libvotequorum.a libpload.a libcoroipc.a
+			  libvotequorum.a libpload.a libcoroipcc.a
 SHARED_LIBS		= $(lib_LIBRARIES:%.a=%.so.$(SONAME))
 SHARED_LIBS_SO		= $(lib_LIBRARIES:%.a=%.so)
 SHARED_LIBS_SO_TWO	= $(lib_LIBRARIES:%.a=%.so.$(SOMAJOR))

-libcpg_a_SOURCES	= coroipc.c cpg.c
-libcfg_a_SOURCES	= coroipc.c cfg.c
-libevs_a_SOURCES	= coroipc.c evs.c
-libpload_a_SOURCES	= coroipc.c pload.c
-libquorum_a_SOURCES	= coroipc.c quorum.c
-libvotequorum_a_SOURCES	= coroipc.c votequorum.c
-libconfdb_a_SOURCES	= coroipc.c confdb.c sa-confdb.c
-libcoroipc_a_SOURCES	= coroipc.c
+libcpg_a_SOURCES	= coroipcc.c cpg.c
+libcfg_a_SOURCES	= coroipcc.c cfg.c
+libevs_a_SOURCES	= coroipcc.c evs.c
+libpload_a_SOURCES	= coroipcc.c pload.c
+libquorum_a_SOURCES	= coroipcc.c quorum.c
+libvotequorum_a_SOURCES	= coroipcc.c votequorum.c
+libconfdb_a_SOURCES	= coroipcc.c confdb.c sa-confdb.c
+libcoroipcc_a_SOURCES	= coroipcc.c

 noinst_HEADERS		= sa-confdb.h util.h \
 			  libcfg.versions libconfdb.versions \
-			  libcoroipc.versions libcpg.versions \
+			  libcoroipcc.versions libcpg.versions \
 			  libevs.versions libpload.versions \
 			  libquorum.versions libvotequorum.versions

@@ -62,26 +62,26 @@ noinst_HEADERS		= sa-confdb.h util.h \

 if BUILD_DARWIN

-libcoroipc.so.$(SONAME): coroipc.o
-	$(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o -o $@
+libcoroipcc.so.$(SONAME): coroipcc.o
+	$(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipcc.o -o $@

-libconfdb.so.$(SONAME): coroipc.o confdb.o sa-confdb.o 
-	$(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ -ldl
+libconfdb.so.$(SONAME): coroipcc.o confdb.o sa-confdb.o 
+	$(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipcc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ -ldl

-lib%.so.$(SONAME): coroipc.o %.o
+lib%.so.$(SONAME): coroipcc.o %.o
 	$(CC) $(DARWIN_OPTS) $^ -o $@

 else

-libcoroipc.so.$(SONAME): coroipc.o
+libcoroipcc.so.$(SONAME): coroipcc.o
 	$(CC) -shared -o $@ \
-		-Wl,-soname=libcoroipc.so.$(SOMAJOR) \
-		-Wl,-version-script=$(srcdir)/libcoroipc.versions \
+		-Wl,-soname=libcoroipcc.so.$(SOMAJOR) \
+		-Wl,-version-script=$(srcdir)/libcoroipcc.versions \
 		$^ $(LDFLAGS) $(AM_LDFLAGS)
-	ln -sf libcoroipc.so.$(SONAME) libcoroipc.so
-	ln -sf libcoroipc.so.$(SONAME) libcoroipc.so.$(SOMAJOR)
+	ln -sf libcoroipcc.so.$(SONAME) libcoroipcc.so
+	ln -sf libcoroipcc.so.$(SONAME) libcoroipcc.so.$(SOMAJOR)

-libconfdb.so.$(SONAME): coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o
+libconfdb.so.$(SONAME): coroipcc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o
 	$(CC) -shared -o $@ \
 		-Wl,-soname=libconfdb.so.$(SOMAJOR) \
 		-Wl,-version-script=$(srcdir)/libconfdb.versions \
@@ -89,7 +89,7 @@ libconfdb.so.$(SONAME): coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o
 	ln -sf libconfdb.so.$(SONAME) libconfdb.so
 	ln -sf libconfdb.so.$(SONAME) libconfdb.so.$(SOMAJOR)

-lib%.so.$(SONAME): coroipc.o %.o
+lib%.so.$(SONAME): coroipcc.o %.o
 	$(CC) -shared -o $@ \
 		-Wl,-soname=lib$*.so.$(SOMAJOR) \
 		-Wl,-version-script=$(srcdir)/lib$*.versions \
diff --git a/lib/coroipc.c b/lib/coroipcc.c
similarity index 100%
rename from lib/coroipc.c
rename to lib/coroipcc.c
diff --git a/lib/libcoroipc.versions b/lib/libcoroipcc.versions
similarity index 100%
rename from lib/libcoroipc.versions
rename to lib/libcoroipcc.versions
-- 
1.6.2.rc1.285.gc5f54

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to