Re: [PATCH] sync: kill evil and syncv1 in one shot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changes to util.h need to go in separate patch

I am not hot on changing the return codes from the binary

Patch looks ok although needs proper testing.


On 03/07/2012 03:12 AM, Fabio M. Di Nitto wrote:
> From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>
> 
> Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
> ---
>  exec/Makefile.am            |    8 +-
>  exec/apidef.c               |    1 -
>  exec/cfg.c                  |    3 +-
>  exec/cpg.c                  |    7 +-
>  exec/evil.c                 |  540 -------------------------------
>  exec/evil.h                 |   55 ----
>  exec/evs.c                  |    3 +-
>  exec/ipc_glue.c             |   43 ---
>  exec/main.c                 |  113 +------
>  exec/mainconfig.c           |   31 --
>  exec/mainconfig.h           |    4 -
>  exec/mon.c                  |    3 +-
>  exec/pload.c                |    3 +-
>  exec/quorum.c               |    1 -
>  exec/sync.c                 |  744 +++++++++++++++++++++++++------------------
>  exec/sync.h                 |   45 +--
>  exec/syncv2.c               |  623 ------------------------------------
>  exec/syncv2.h               |   62 ----
>  exec/util.c                 |   15 +-
>  exec/util.h                 |   31 +--
>  exec/votequorum.c           |    3 +-
>  exec/vsf_quorum.c           |    3 +-
>  exec/wd.c                   |    3 +-
>  include/corosync/coroapi.h  |   19 +-
>  include/corosync/corodefs.h |   30 +--
>  25 files changed, 508 insertions(+), 1885 deletions(-)
>  delete mode 100644 exec/evil.c
>  delete mode 100644 exec/evil.h
>  delete mode 100644 exec/syncv2.c
>  delete mode 100644 exec/syncv2.h
> 
> diff --git a/exec/Makefile.am b/exec/Makefile.am
> index 07a77c5..2e33033 100644
> --- a/exec/Makefile.am
> +++ b/exec/Makefile.am
> @@ -47,10 +47,10 @@ sbin_PROGRAMS		= corosync
>  
>  libtotem_pg_a_SOURCES	= $(TOTEM_SRC)
>  
> -corosync_SOURCES	= evil.c vsf_ykd.c coroparse.c vsf_quorum.c syncv2.c \
> +corosync_SOURCES	= vsf_ykd.c coroparse.c vsf_quorum.c sync.c \
>  			  logsys.c cfg.c cmap.c cpg.c evs.c mon.c pload.c \
>  			  votequorum.c wd.c util.c schedwrk.c main.c \
> -			  apidef.c quorum.c sync.c icmap.c timer.c \
> +			  apidef.c quorum.c icmap.c timer.c \
>  			  ipc_glue.c service.c mainconfig.c totemconfig.c
>  corosync_LDADD		= -ltotem_pg -lcorosync_common $(LIBQB_LIBS) $(statgrab_LIBS)
>  corosync_DEPENDENCIES	= libtotem_pg.so.$(SONAME) ../common_lib/libcorosync_common.so
> @@ -64,10 +64,10 @@ SHARED_LIBS_SO		= $(SHARED_LIBS:%.so.$(SONAME)=%.so)
>  SHARED_LIBS_SO_TWO	= $(SHARED_LIBS:%.so.$(SONAME)=%.so.$(SOMAJOR))
>  
>  noinst_HEADERS		= apidef.h crypto.h mainconfig.h main.h \
> -			  quorum.h service.h sync.h timer.h totemconfig.h \
> +			  quorum.h service.h timer.h totemconfig.h \
>  			  totemmrp.h totemnet.h totemudp.h totemiba.h totemrrp.h \
>  			  totemudpu.h totemsrp.h util.h vsf.h schedwrk.h \
> -			  evil.h syncv2.h fsm.h votequorum.h vsf_ykd.h
> +			  sync.h fsm.h votequorum.h vsf_ykd.h
>  
>  if BUILD_DARWIN
>  libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
> diff --git a/exec/apidef.c b/exec/apidef.c
> index bc3a559..d48cbcb 100644
> --- a/exec/apidef.c
> +++ b/exec/apidef.c
> @@ -48,7 +48,6 @@
>  #include <corosync/logsys.h>
>  #include "util.h"
>  #include "timer.h"
> -#include "sync.h"
>  #include "quorum.h"
>  #include "schedwrk.h"
>  #include "main.h"
> diff --git a/exec/cfg.c b/exec/cfg.c
> index 29ea8bb..659bd99 100644
> --- a/exec/cfg.c
> +++ b/exec/cfg.c
> @@ -234,8 +234,7 @@ struct corosync_service_engine cfg_service_engine = {
>  	.exec_init_fn				= cfg_exec_init_fn,
>  	.exec_engine				= cfg_exec_engine,
>  	.exec_engine_count			= sizeof (cfg_exec_engine) / sizeof (struct corosync_exec_handler),
> -	.confchg_fn				= cfg_confchg_fn,
> -	.sync_mode				= CS_SYNC_V1
> +	.confchg_fn				= cfg_confchg_fn
>  };
>  
>  struct corosync_service_engine *cfg_get_service_engine_ver0 (void)
> diff --git a/exec/cpg.c b/exec/cpg.c
> index bf8692b..da60d80 100644
> --- a/exec/cpg.c
> +++ b/exec/cpg.c
> @@ -285,7 +285,7 @@ static void downlist_messages_delete (void);
>  
>  static void downlist_master_choose_and_send (void);
>  
> -static void cpg_sync_init_v2 (
> +static void cpg_sync_init (
>  	const unsigned int *trans_list,
>  	size_t trans_list_entries,
>  	const unsigned int *member_list,
> @@ -406,8 +406,7 @@ struct corosync_service_engine cpg_service_engine = {
>  	.exec_dump_fn				= NULL,
>  	.exec_engine				= cpg_exec_engine,
>  	.exec_engine_count		        = sizeof (cpg_exec_engine) / sizeof (struct corosync_exec_handler),
> -	.sync_mode				= CS_SYNC_V1_APIV2,
> -	.sync_init                              = (sync_init_v1_fn_t)cpg_sync_init_v2,
> +	.sync_init                              = cpg_sync_init,
>  	.sync_process                           = cpg_sync_process,
>  	.sync_activate                          = cpg_sync_activate,
>  	.sync_abort                             = cpg_sync_abort
> @@ -459,7 +458,7 @@ struct downlist_msg {
>  
>  static struct req_exec_cpg_downlist g_req_exec_cpg_downlist;
>  
> -static void cpg_sync_init_v2 (
> +static void cpg_sync_init (
>  	const unsigned int *trans_list,
>  	size_t trans_list_entries,
>  	const unsigned int *member_list,
> diff --git a/exec/evil.c b/exec/evil.c
> deleted file mode 100644
> index bd1ba2d..0000000
> --- a/exec/evil.c
> +++ /dev/null
> @@ -1,540 +0,0 @@
> -/*
> - * Copyright (c) 2002-2006 MontaVista Software, Inc.
> - * Copyright (c) 2006-2012 Red Hat, Inc.
> - *
> - * All rights reserved.
> - *
> - * Author: Steven Dake (sdake@xxxxxxxxxx)
> - *
> - * 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.
> - */
> -/*
> - * Don't look, you will be disappointed
> - */
> -
> -#include <config.h>
> -
> -#include <pthread.h>
> -#include <assert.h>
> -#include <sys/types.h>
> -#include <sys/poll.h>
> -#include <sys/uio.h>
> -#include <sys/mman.h>
> -#include <sys/socket.h>
> -#include <sys/un.h>
> -#include <sys/time.h>
> -#include <sys/resource.h>
> -#include <sys/stat.h>
> -#if defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN)
> -#include <sys/sysctl.h>
> -#else
> -#include <sys/sysinfo.h>
> -#endif
> -#include <netinet/in.h>
> -#include <arpa/inet.h>
> -#include <unistd.h>
> -#include <fcntl.h>
> -#include <stdlib.h>
> -#include <stdio.h>
> -#include <errno.h>
> -#include <sched.h>
> -#include <time.h>
> -
> -#include <corosync/totem/totempg.h>
> -#include <corosync/swab.h>
> -#include <corosync/corotypes.h>
> -#include <corosync/corodefs.h>
> -#include <corosync/list.h>
> -#include <corosync/config.h>
> -#include <corosync/coroapi.h>
> -#include <corosync/logsys.h>
> -#include <qb/qbipcs.h>
> -#include "sync.h"
> -#include "evil.h"
> -
> -static unsigned int my_evt_checked_in = 0;
> -
> -static unsigned int my_member_list_entries;
> -
> -static struct corosync_api_v1 *api = NULL;
> -
> -static void clm_sync_init (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id);
> -
> -static int clm_sync_process (void);
> -
> -static void clm_sync_activate (void);
> -
> -static void clm_sync_abort (void);
> -
> -static void evt_sync_init (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id);
> -
> -static int evt_sync_process (void);
> -
> -static void evt_sync_activate (void);
> -
> -static void evt_sync_abort (void);
> -
> -static int clm_hack_init (void);
> -
> -static void deliver_fn_evt_compat (
> -	unsigned int nodeid,
> -	unsigned int service,
> -	unsigned int fn_id,
> -	const void *msg,
> -	unsigned int endian_conversion_required);
> -
> -static struct sync_callbacks clm_sync_operations = {
> -	.api_version		= 1,
> -	.name			= "dummy CLM service",
> -	.sync_init_api.sync_init_v1 = clm_sync_init,
> -	.sync_process		= clm_sync_process,
> -	.sync_activate		= clm_sync_activate,
> -	.sync_abort		= clm_sync_abort,
> -};
> -
> -static struct sync_callbacks evt_sync_operations = {
> -	.api_version		= 1,
> -	.name			= "dummy EVT service",
> -	.sync_init_api.sync_init_v1 = evt_sync_init,
> -	.sync_process		= evt_sync_process,
> -	.sync_activate		= evt_sync_activate,
> -	.sync_abort		= evt_sync_abort,
> -};
> -
> -
> -static void sync_dummy_init (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id)
> -{
> -}
> -
> -static int sync_dummy_process (void)
> -{
> -	return (0);
> -}
> -
> -static void sync_dummy_activate (void)
> -{
> -}
> -
> -static void sync_dummy_abort (void)
> -{
> -}
> -
> -void evil_init (struct corosync_api_v1 *api_in)
> -{
> -	api = api_in;
> -	clm_hack_init ();
> -}
> -
> -extern int evil_callbacks_load (int sync_id,
> -	struct sync_callbacks *callbacks)
> -{
> -	int sync_dummy_found = 1;
> -	int callbacks_init = 1;
> -
> -	memset (callbacks, 0, sizeof (struct sync_callbacks));
> -	switch (sync_id) {
> -		case EVS_SERVICE:
> -			callbacks_init = 0;
> -			break;
> -		case CLM_SERVICE:
> -			/*
> -			 * ugh
> -			 */
> -			memcpy (callbacks, &clm_sync_operations, sizeof (struct sync_callbacks));
> -			callbacks_init = 0;
> -			break;
> -		case AMF_SERVICE:
> -			callbacks->name = "dummy AMF service";
> -			break;
> -		case CKPT_SERVICE:
> -			callbacks->name = "dummy CKPT service";
> -			break;
> -		case EVT_SERVICE:
> -			/*
> -			 * double ugh
> -			 */
> -			memcpy (callbacks, &evt_sync_operations, sizeof (struct sync_callbacks));
> -			callbacks_init = 0;
> -			break;
> -		case LCK_SERVICE:
> -			callbacks_init = 0;
> -			break;
> -		case MSG_SERVICE:
> -			callbacks_init = 0;
> -			break;
> -		case CFG_SERVICE:
> -			callbacks_init = 0;
> -			break;
> -		case CPG_SERVICE:
> -			callbacks->name = "dummy CPG service";
> -			break;
> -		case CONFDB_SERVICE:
> -			callbacks_init = 0;
> -			break;
> -		default:
> -			callbacks_init = 0;
> -			sync_dummy_found = 0;
> -			break;
> -
> -	}
> -	if (callbacks_init) {
> -		callbacks->sync_init_api.sync_init_v1 = sync_dummy_init;
> -		callbacks->sync_process = sync_dummy_process;
> -		callbacks->sync_activate = sync_dummy_activate;
> -		callbacks->sync_abort = sync_dummy_abort;
> -	}
> -
> -	if (sync_dummy_found == 0) {
> -		return (-1);
> -	}
> -	return (0);
> -}
> -
> -void evil_deliver_fn (
> -	unsigned int nodeid,
> -	unsigned int service,
> -	unsigned int fn_id,
> -	const void *msg,
> -	unsigned int endian_conversion_required)
> -{
> -	if (service == EVT_SERVICE) {
> -		deliver_fn_evt_compat (
> -			nodeid,
> -			service,
> -			fn_id,
> -			msg,
> -			endian_conversion_required);
> -	}
> -}
> -
> -/*
> - * This sends the clm nodejoin message required by clm services
> - * on whitetank as well as the event service
> - */
> -enum clm_message_req_types {
> -	MESSAGE_REQ_EXEC_CLM_NODEJOIN = 0
> -};
> -
> -#define MAR_CLM_MAX_ADDRESS_LENGTH 64
> -
> -#define SA_MAX_NAME_LENGTH 256
> -
> -typedef enum {
> -	MAR_CLM_AF_INET = 1,
> -	MAR_CLM_AF_INET6 = 2
> -} mar_clm_node_address_family_t;
> -
> -typedef struct {
> -	unsigned short length __attribute__((aligned(8)));
> -	mar_clm_node_address_family_t family __attribute__((aligned(8)));
> -	unsigned char value[MAR_CLM_MAX_ADDRESS_LENGTH] __attribute__((aligned(8)));
> -} mar_clm_node_address_t;
> -
> -typedef uint8_t mar_uint8_t;
> -
> -typedef uint16_t mar_uint16_t;
> -
> -typedef uint32_t mar_uint32_t;
> -
> -typedef uint64_t mar_uint64_t;
> -
> -typedef struct {
> -	mar_uint16_t length __attribute__((aligned(8)));
> -	mar_uint8_t value[SA_MAX_NAME_LENGTH] __attribute__((aligned(8)));
> -} mar_name_t;
> -
> -typedef struct {
> -	mar_uint32_t node_id __attribute__((aligned(8)));
> -	mar_clm_node_address_t node_address __attribute__((aligned(8)));
> -	mar_name_t node_name __attribute__((aligned(8)));
> -	mar_uint32_t member __attribute__((aligned(8)));
> -	mar_uint64_t boot_timestamp __attribute__((aligned(8)));
> -	mar_uint64_t initial_view_number __attribute__((aligned(8)));
> -} mar_clm_cluster_node_t;
> -
> -mar_clm_cluster_node_t my_cluster_node;
> -
> -struct req_exec_clm_nodejoin {
> -	struct qb_ipc_request_header header __attribute__((aligned(8)));
> -	mar_clm_cluster_node_t cluster_node __attribute__((aligned(8)));
> -};
> -
> -static void my_cluster_node_load (void)
> -{
> -	struct totem_ip_address interfaces[INTERFACE_MAX];
> -	unsigned int iface_count;
> -	char **status;
> -	const char *iface_string;
> -
> -	totempg_ifaces_get (
> -		totempg_my_nodeid_get (),
> -		interfaces,
> -		&status,
> -		&iface_count);
> -
> -	iface_string = totemip_print (&interfaces[0]);
> -
> -	sprintf ((char *)my_cluster_node.node_address.value, "%s",
> -		iface_string);
> -	my_cluster_node.node_address.length =
> -		strlen ((char *)my_cluster_node.node_address.value);
> -	if (totempg_my_family_get () == AF_INET) {
> -		my_cluster_node.node_address.family = MAR_CLM_AF_INET;
> -	} else
> -	if (totempg_my_family_get () == AF_INET6) {
> -		my_cluster_node.node_address.family = MAR_CLM_AF_INET6;
> -	} else {
> -		assert (0);
> -	}
> -
> -	strcpy ((char *)my_cluster_node.node_name.value,
> -		(char *)my_cluster_node.node_address.value);
> -	my_cluster_node.node_name.length =
> -		my_cluster_node.node_address.length;
> -	my_cluster_node.node_id = totempg_my_nodeid_get ();
> -	my_cluster_node.member = 1;
> -}
> -
> -static int clm_hack_init (void)
> -{
> -
> -#if defined(COROSYNC_LINUX)
> -	struct sysinfo s_info;
> -	time_t current_time;
> -	sysinfo (&s_info);
> -	current_time = time (NULL);
> -	 /* (currenttime (s) - uptime (s)) * 1 billion (ns) / 1 (s) */
> -	my_cluster_node.boot_timestamp = ((uint64_t)(current_time - s_info.uptime)) * 1000000000ULL;
> -#elif defined(COROSYNC_BSD) || defined(COROSYNC_DARWIN)
> -	int mib[2] = { CTL_KERN, KERN_BOOTTIME };
> -	struct timeval boot_time;
> -	size_t size = sizeof(boot_time);
> -
> -	if ( sysctl(mib, 2, &boot_time, &size, NULL, 0) == -1 )
> -		boot_time.tv_sec = time (NULL);
> -	 /* (currenttime (s) - uptime (s)) * 1 billion (ns) / 1 (s) */
> -	my_cluster_node.boot_timestamp = ((uint64_t)boot_time.tv_sec) * 1000000000ULL;
> -#else /* defined(CTL_KERN) && defined(KERN_BOOTTIME) */
> -	#warning "no bootime support"
> -#endif
> -
> -	return (0);
> -}
> -
> -static int clm_nodejoin_send (void)
> -{
> -	struct req_exec_clm_nodejoin req_exec_clm_nodejoin;
> -	struct iovec req_exec_clm_iovec;
> -	int result;
> -
> -	my_cluster_node_load ();
> -
> -	req_exec_clm_nodejoin.header.size = sizeof (struct req_exec_clm_nodejoin);
> -	req_exec_clm_nodejoin.header.id =
> -		SERVICE_ID_MAKE (CLM_SERVICE, MESSAGE_REQ_EXEC_CLM_NODEJOIN);
> -
> -	my_cluster_node.initial_view_number = 0;
> -
> -	memcpy (&req_exec_clm_nodejoin.cluster_node, &my_cluster_node,
> -		sizeof (mar_clm_cluster_node_t));
> -
> -	req_exec_clm_iovec.iov_base = (char *)&req_exec_clm_nodejoin;
> -	req_exec_clm_iovec.iov_len = sizeof (req_exec_clm_nodejoin);
> -
> -	result = api->totem_mcast (&req_exec_clm_iovec, 1, TOTEMPG_AGREED);
> -
> -	return (result);
> -}
> -
> -/*
> - * This is a noop for this service
> - */
> -static void clm_sync_init (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id)
> -{
> -	return;
> -}
> -
> -static int clm_sync_process (void)
> -{
> -	/*
> -	 * Send node information to other nodes
> -	 */
> -	return (clm_nodejoin_send ());
> -}
> -
> -/*
> - * This is a noop for this service
> - */
> -static void clm_sync_activate (void)
> -{
> -	return;
> -}
> -
> -/*
> - * This is a noop for this service
> - */
> -static void clm_sync_abort (void)
> -{
> -	return;
> -}
> -
> -enum evt_sync_states {
> -	EVT_SYNC_PART_ONE,
> -	EVT_SYNC_PART_TWO,
> -	EVT_SYNC_PART_THREE,
> -	EVT_SYNC_PART_FOUR,
> -	EVT_SYNC_DONE
> -};
> -
> -static enum evt_sync_states evt_sync_state;
> -
> -enum evt_chan_ops {
> -	EVT_OPEN_CHAN_OP,               /* chc_chan */
> -	EVT_CLOSE_CHAN_OP,              /* chc_close_unlink_chan */
> -	EVT_UNLINK_CHAN_OP,             /* chc_close_unlink_chan */
> -	EVT_CLEAR_RET_OP,               /* chc_event_id */
> -	EVT_SET_ID_OP,                  /* chc_set_id */
> -	EVT_CONF_DONE,                  /* no data used */
> -	EVT_OPEN_COUNT,                 /* chc_set_opens */
> -	EVT_OPEN_COUNT_DONE             /* no data used */
> -};
> -
> -enum evt_message_req_types {
> -	MESSAGE_REQ_EXEC_EVT_EVENTDATA = 0,
> -	MESSAGE_REQ_EXEC_EVT_CHANCMD = 1,
> -	MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA = 2
> -};
> -
> -struct req_evt_chan_command {
> -	struct qb_ipc_request_header chc_head __attribute__((aligned(8)));
> -	mar_uint32_t chc_op __attribute__((aligned(8)));
> -};
> -
> -static void evt_sync_init (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id)
> -{
> -	my_member_list_entries = member_list_entries;
> -	my_evt_checked_in = 0;
> -
> -	evt_sync_state = EVT_SYNC_PART_ONE;
> -	return;
> -}
> -
> -static int evt_sync_process (void)
> -{
> -	int res;
> -	struct req_evt_chan_command cpkt;
> -	struct iovec chn_iovec;
> -
> -	memset(&cpkt, 0, sizeof(cpkt));
> -	cpkt.chc_head.id =
> -		SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
> -	cpkt.chc_head.size = sizeof(cpkt);
> -	chn_iovec.iov_base = &cpkt;
> -	chn_iovec.iov_len = cpkt.chc_head.size;
> -
> -	if (evt_sync_state == EVT_SYNC_PART_ONE) {
> -		cpkt.chc_op = EVT_OPEN_COUNT_DONE;
> -
> -		res = api->totem_mcast(&chn_iovec, 1,TOTEMPG_AGREED);
> -		if (res == -1) {
> -			return (res);
> -		}
> -		evt_sync_state = EVT_SYNC_PART_TWO;
> -	}
> -	if (evt_sync_state == EVT_SYNC_PART_THREE) {
> -		cpkt.chc_op = EVT_CONF_DONE;
> -		res = api->totem_mcast(&chn_iovec, 1,TOTEMPG_AGREED);
> -		if (res == -1) {
> -			return (res);
> -		}
> -		evt_sync_state = EVT_SYNC_PART_FOUR;
> -	}
> -	if (evt_sync_state == EVT_SYNC_DONE) {
> -		return (0);
> -	}
> -	return (-1);
> -}
> -
> -static void evt_sync_activate (void)
> -{
> -	return;
> -}
> -
> -static void evt_sync_abort (void)
> -{
> -	return;
> -}
> -
> -static void deliver_fn_evt_compat (
> -	unsigned int nodeid,
> -	unsigned int service,
> -	unsigned int fn_id,
> -	const void *msg,
> -	unsigned int endian_conversion_required)
> -{
> -	const struct req_evt_chan_command *cpkt = msg;
> -	unsigned int operation;
> -
> -	if (fn_id != MESSAGE_REQ_EXEC_EVT_CHANCMD) {
> -		return;
> -	}
> -	operation = cpkt->chc_op;
> -
> -	if (endian_conversion_required) {
> -		operation = swab32 (operation);
> -	}
> -
> -	switch (operation) {
> -	case EVT_OPEN_COUNT_DONE:
> -		if (++my_evt_checked_in == my_member_list_entries) {
> -			evt_sync_state = EVT_SYNC_PART_THREE;
> -			my_evt_checked_in = 0;
> -		}
> -		break;
> -	case EVT_CONF_DONE:
> -		if (++my_evt_checked_in == my_member_list_entries) {
> -			evt_sync_state = EVT_SYNC_DONE;
> -			my_evt_checked_in = 0;
> -		}
> -		break;
> -	}
> -}
> diff --git a/exec/evil.h b/exec/evil.h
> deleted file mode 100644
> index 390712f..0000000
> --- a/exec/evil.h
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -/*
> - * Copyright (c) 2002-2006 MontaVista Software, Inc.
> - * Copyright (c) 2006-2009 Red Hat, Inc.
> - *
> - * All rights reserved.
> - *
> - * Author: Steven Dake (sdake@xxxxxxxxxx)
> - *
> - * 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.
> - */
> -/*
> - * Don't look, you will be disappointed
> - */
> -
> -#ifndef EVIL_H_DEFINED
> -#define EVIL_H_DEFINED
> -
> -extern void evil_init (struct corosync_api_v1 *api_in);
> -
> -extern int evil_callbacks_load (
> -	int sync_id,
> -        struct sync_callbacks *callbacks);
> -
> -extern void evil_deliver_fn (
> -        unsigned int nodeid,
> -        unsigned int service,
> -        unsigned int fn_id,
> -        const void *msg,
> -        unsigned int endian_conversion_required);
> -
> -#endif /* EVIL_H_DEFINED */
> diff --git a/exec/evs.c b/exec/evs.c
> index 5cb5754..6667341 100644
> --- a/exec/evs.c
> +++ b/exec/evs.c
> @@ -152,8 +152,7 @@ struct corosync_service_engine evs_service_engine = {
>  	.exec_engine_count	= sizeof (evs_exec_engine) / sizeof (struct corosync_exec_handler),
>  	.confchg_fn		= evs_confchg_fn,
>  	.exec_init_fn		= evs_exec_init_fn,
> -	.exec_dump_fn		= NULL,
> -	.sync_mode		= CS_SYNC_V1
> +	.exec_dump_fn		= NULL
>  };
>  
>  static DECLARE_LIST_INIT (confchg_notify);
> diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c
> index 12789ad..71a804a 100644
> --- a/exec/ipc_glue.c
> +++ b/exec/ipc_glue.c
> @@ -56,7 +56,6 @@
>  
>  #include "mainconfig.h"
>  #include "sync.h"
> -#include "syncv2.h"
>  #include "timer.h"
>  #include "main.h"
>  #include "util.h"
> @@ -122,63 +121,21 @@ static const char* cs_ipcs_serv_short_name(int32_t service_id)
>  	case EVS_SERVICE:
>  		name = "evs";
>  		break;
> -	case CLM_SERVICE:
> -		name = "saClm";
> -		break;
> -	case AMF_SERVICE:
> -		name = "saAmf";
> -		break;
> -	case CKPT_SERVICE:
> -		name = "saCkpt";
> -		break;
> -	case EVT_SERVICE:
> -		name = "saEvt";
> -		break;
> -	case LCK_SERVICE:
> -		name = "saLck";
> -		break;
> -	case MSG_SERVICE:
> -		name = "saMsg";
> -		break;
>  	case CFG_SERVICE:
>  		name = "cfg";
>  		break;
>  	case CPG_SERVICE:
>  		name = "cpg";
>  		break;
> -	case CMAN_SERVICE:
> -		name = "cman";
> -		break;
> -	case PCMK_SERVICE:
> -		name = "pacemaker.engine";
> -		break;
> -	case CONFDB_SERVICE:
> -		name = "confdb";
> -		break;
>  	case QUORUM_SERVICE:
>  		name = "quorum";
>  		break;
>  	case PLOAD_SERVICE:
>  		name = "pload";
>  		break;
> -	case TMR_SERVICE:
> -		name = "saTmr";
> -		break;
>  	case VOTEQUORUM_SERVICE:
>  		name = "votequorum";
>  		break;
> -	case NTF_SERVICE:
> -		name = "saNtf";
> -		break;
> -	case AMF_V2_SERVICE:
> -		name = "saAmfV2";
> -		break;
> -	case TST_SV1_SERVICE:
> -		name = "tst";
> -		break;
> -	case TST_SV2_SERVICE:
> -		name = "tst2";
> -		break;
>  	case MON_SERVICE:
>  		name = "mon";
>  		break;
> diff --git a/exec/main.c b/exec/main.c
> index 158dea9..9ffc353 100644
> --- a/exec/main.c
> +++ b/exec/main.c
> @@ -115,13 +115,11 @@
>  #include "totemconfig.h"
>  #include "main.h"
>  #include "sync.h"
> -#include "syncv2.h"
>  #include "timer.h"
>  #include "util.h"
>  #include "apidef.h"
>  #include "service.h"
>  #include "schedwrk.h"
> -#include "evil.h"
>  
>  #ifdef HAVE_SMALL_MEMORY_FOOTPRINT
>  #define IPC_LOGSYS_SIZE			1024*64
> @@ -146,8 +144,6 @@ static struct totem_logging_configuration totem_logging_configuration;
>  
>  static struct corosync_api_v1 *api = NULL;
>  
> -static enum cs_sync_mode minimum_sync_mode;
> -
>  static int sync_in_process = 1;
>  
>  static qb_loop_t *corosync_poll_handle;
> @@ -258,72 +254,17 @@ static void corosync_sync_completed (void)
>  	cs_ipcs_sync_state_changed(sync_in_process);
>  }
>  
> -static int corosync_sync_callbacks_retrieve (int sync_id,
> -	struct sync_callbacks *callbacks)
> -{
> -	unsigned int corosync_service_index;
> -	int res;
> -
> -	for (corosync_service_index = 0;
> -		corosync_service_index < SERVICE_HANDLER_MAXIMUM_COUNT;
> -		corosync_service_index++) {
> -
> -		if (corosync_service[corosync_service_index] != NULL
> -			&& (corosync_service[corosync_service_index]->sync_mode == CS_SYNC_V1
> -				|| corosync_service[corosync_service_index]->sync_mode == CS_SYNC_V1_APIV2)) {
> -			if (corosync_service_index == sync_id) {
> -				break;
> -			}
> -		}
> -	}
> -	/*
> -	 * Try to load backwards compat sync engines
> -	 */
> -	if (corosync_service_index == SERVICE_HANDLER_MAXIMUM_COUNT) {
> -		res = evil_callbacks_load (sync_id, callbacks);
> -		return (res);
> -	}
> -	callbacks->name = corosync_service[corosync_service_index]->name;
> -	callbacks->sync_init_api.sync_init_v1 = corosync_service[corosync_service_index]->sync_init;
> -	callbacks->api_version = 1;
> -	if (corosync_service[corosync_service_index]->sync_mode == CS_SYNC_V1_APIV2) {
> -		callbacks->api_version = 2;
> -	}
> -	callbacks->sync_process = corosync_service[corosync_service_index]->sync_process;
> -	callbacks->sync_activate = corosync_service[corosync_service_index]->sync_activate;
> -	callbacks->sync_abort = corosync_service[corosync_service_index]->sync_abort;
> -	return (0);
> -}
> -
> -static int corosync_sync_v2_callbacks_retrieve (
> +static int corosync_sync_callbacks_retrieve (
>  	int service_id,
>  	struct sync_callbacks *callbacks)
>  {
> -	int res;
> -
> -	if (minimum_sync_mode == CS_SYNC_V2 && service_id == CLM_SERVICE && corosync_service[CLM_SERVICE] == NULL) {
> -		res = evil_callbacks_load (service_id, callbacks);
> -		return (res);
> -	}
> -	if (minimum_sync_mode == CS_SYNC_V2 && service_id == EVT_SERVICE && corosync_service[EVT_SERVICE] == NULL) {
> -		res = evil_callbacks_load (service_id, callbacks);
> -		return (res);
> -	}
>  	if (corosync_service[service_id] == NULL) {
>  		return (-1);
>  	}
> -	if (minimum_sync_mode == CS_SYNC_V1 && corosync_service[service_id]->sync_mode != CS_SYNC_V2) {
> -		return (-1);
> -	}
>  
>  	callbacks->name = corosync_service[service_id]->name;
>  
> -	callbacks->api_version = 1;
> -	if (corosync_service[service_id]->sync_mode == CS_SYNC_V1_APIV2) {
> -		callbacks->api_version = 2;
> -	}
> -
> -	callbacks->sync_init_api.sync_init_v1 = corosync_service[service_id]->sync_init;
> +	callbacks->sync_init = corosync_service[service_id]->sync_init;
>  	callbacks->sync_process = corosync_service[service_id]->sync_process;
>  	callbacks->sync_activate = corosync_service[service_id]->sync_activate;
>  	callbacks->sync_abort = corosync_service[service_id]->sync_abort;
> @@ -406,13 +347,13 @@ static void confchg_fn (
>  	}
>  
>  	if (abort_activate) {
> -		sync_v2_abort ();
> +		sync_abort ();
>  	}
> -	if (minimum_sync_mode == CS_SYNC_V2 && configuration_type == TOTEM_CONFIGURATION_TRANSITIONAL) {
> -		sync_v2_save_transitional (member_list, member_list_entries, ring_id);
> +	if (configuration_type == TOTEM_CONFIGURATION_TRANSITIONAL) {
> +		sync_save_transitional (member_list, member_list_entries, ring_id);
>  	}
> -	if (minimum_sync_mode == CS_SYNC_V2 && configuration_type == TOTEM_CONFIGURATION_REGULAR) {
> -		sync_v2_start (member_list, member_list_entries, ring_id);
> +	if (configuration_type == TOTEM_CONFIGURATION_REGULAR) {
> +		sync_start (member_list, member_list_entries, ring_id);
>  	}
>  }
>  
> @@ -677,11 +618,6 @@ static void deliver_fn (
>  	service = id >> 16;
>  	fn_id = id & 0xffff;
>  
> -	if (corosync_service[service] == NULL && service == EVT_SERVICE) {
> -		evil_deliver_fn (nodeid, service, fn_id, msg,
> -			endian_conversion_required);
> -	}
> -
>  	if (!corosync_service[service]) {
>  		return;
>  	}
> @@ -928,33 +864,13 @@ static void main_service_ready (void)
>  		log_printf (LOGSYS_LEVEL_ERROR, "Could not initialize default services");
>  		corosync_exit_error (COROSYNC_DONE_INIT_SERVICES);
>  	}
> -	evil_init (api);
>  	cs_ipcs_init();
>  	corosync_totem_stats_init ();
>  	corosync_fplay_control_init ();
>  	corosync_totem_dynamic_init ();
> -	if (minimum_sync_mode == CS_SYNC_V2) {
> -		log_printf (LOGSYS_LEVEL_NOTICE,
> -		       "Compatibility mode set to none.  Using V2 of the synchronization engine.");
> -		sync_v2_init (
> -			corosync_sync_v2_callbacks_retrieve,
> -			corosync_sync_completed);
> -	} else
> -	if (minimum_sync_mode == CS_SYNC_V1) {
> -		log_printf (LOGSYS_LEVEL_NOTICE,
> -			"Compatibility mode set to whitetank.  Using V1 and V2 of the synchronization engine.");
> -		sync_register (
> -			corosync_sync_callbacks_retrieve,
> -			sync_v2_memb_list_determine,
> -			sync_v2_memb_list_abort,
> -			sync_v2_start);
> -
> -		sync_v2_init (
> -			corosync_sync_v2_callbacks_retrieve,
> -			corosync_sync_completed);
> -	}
> -
> -
> +	sync_init (
> +		corosync_sync_callbacks_retrieve,
> +		corosync_sync_completed);
>  }
>  
>  static enum e_corosync_done corosync_flock (const char *lockfile, pid_t pid)
> @@ -1121,7 +1037,7 @@ int main (int argc, char **argv, char **envp)
>  
>  	if (icmap_init() != CS_OK) {
>  		log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't initialize configuration component.");
> -		corosync_exit_error (COROSYNC_DONE_OBJDB);
> +		corosync_exit_error (COROSYNC_DONE_ICMAP);
>  	}
>  
>  	/*
> @@ -1204,13 +1120,6 @@ int main (int argc, char **argv, char **envp)
>  	totem_config.totem_logging_configuration.log_printf = _logsys_log_printf;
>  	logsys_config_apply();
>  
> -	res = corosync_main_config_compatibility_read (&minimum_sync_mode,
> -		&error_string);
> -	if (res == -1) {
> -		log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
> -		corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
> -	}
> -
>  	/*
>  	 * Now we are fully initialized.
>  	 */
> diff --git a/exec/mainconfig.c b/exec/mainconfig.c
> index 25bd157..bf860d0 100644
> --- a/exec/mainconfig.c
> +++ b/exec/mainconfig.c
> @@ -540,34 +540,3 @@ parse_error:
>  	*error_string = error_string_response;
>  	return (-1);
>  }
> -
> -int corosync_main_config_compatibility_read (
> -        enum cs_sync_mode *minimum_sync_mode,
> -        const char **error_string)
> -{
> -	const char *error_reason = error_string_response;
> -	char *value;
> -
> -	*minimum_sync_mode = CS_SYNC_V1;
> -	if (icmap_get_string("compatibility", &value) == CS_OK) {
> -		if (strcmp (value, "whitetank") == 0) {
> -			*minimum_sync_mode = CS_SYNC_V1;
> -		} else
> -		if (strcmp (value, "none") == 0) {
> -			*minimum_sync_mode = CS_SYNC_V2;
> -		} else {
> -
> -			snprintf (error_string_response, sizeof (error_string_response),
> -				"Invalid compatibility option '%s' specified, must be none or whitetank.\n", value);
> -			goto parse_error;
> -		}
> -		free(value);
> -	}
> -
> -	return 0;
> -
> -parse_error:
> -	*error_string = error_reason;
> -	free(value);
> -	return (-1);
> -}
> diff --git a/exec/mainconfig.h b/exec/mainconfig.h
> index ad64c83..0c3dce7 100644
> --- a/exec/mainconfig.h
> +++ b/exec/mainconfig.h
> @@ -52,8 +52,4 @@ struct dynamic_service {
>  extern int corosync_main_config_read (
>  	const char **error_string);
>  
> -extern int corosync_main_config_compatibility_read (
> -	enum cs_sync_mode *minimum_sync_mode,
> -	const char **error_string);
> -
>  #endif /* MAINCONFIG_H_DEFINED */
> diff --git a/exec/mon.c b/exec/mon.c
> index 913dc36..f220abd 100644
> --- a/exec/mon.c
> +++ b/exec/mon.c
> @@ -75,8 +75,7 @@ struct corosync_service_engine mon_service_engine = {
>  	.exec_engine_count	= 0,
>  	.confchg_fn		= NULL,
>  	.exec_init_fn		= mon_exec_init_fn,
> -	.exec_dump_fn		= NULL,
> -	.sync_mode		= CS_SYNC_V2
> +	.exec_dump_fn		= NULL
>  };
>  
>  static DECLARE_LIST_INIT (confchg_notify);
> diff --git a/exec/pload.c b/exec/pload.c
> index 893f577..8301477 100644
> --- a/exec/pload.c
> +++ b/exec/pload.c
> @@ -164,8 +164,7 @@ struct corosync_service_engine pload_service_engine = {
>  	.exec_engine_count	= sizeof (pload_exec_engine) / sizeof (struct corosync_exec_handler),
>  	.confchg_fn		= pload_confchg_fn,
>  	.exec_init_fn		= pload_exec_init_fn,
> -	.exec_dump_fn		= NULL,
> -	.sync_mode		= CS_SYNC_V2
> +	.exec_dump_fn		= NULL
>  };
>  
>  static DECLARE_LIST_INIT (confchg_notify);
> diff --git a/exec/quorum.c b/exec/quorum.c
> index 7470150..d4837a2 100644
> --- a/exec/quorum.c
> +++ b/exec/quorum.c
> @@ -58,7 +58,6 @@
>  
>  #include "quorum.h"
>  #include "main.h"
> -#include "sync.h"
>  #include "vsf.h"
>  
>  LOGSYS_DECLARE_SUBSYS ("QUORUM");
> diff --git a/exec/sync.c b/exec/sync.c
> index be42568..2998988 100644
> --- a/exec/sync.c
> +++ b/exec/sync.c
> @@ -1,6 +1,5 @@
>  /*
> - * Copyright (c) 2005-2006 MontaVista Software, Inc.
> - * Copyright (c) 2006-2012 Red Hat, Inc.
> + * Copyright (c) 2009-2012 Red Hat, Inc.
>   *
>   * All rights reserved.
>   *
> @@ -56,63 +55,104 @@
>  #include <corosync/totem/totem.h>
>  #include <corosync/logsys.h>
>  #include <qb/qbipc_common.h>
> +#include "schedwrk.h"
>  #include "quorum.h"
>  #include "sync.h"
>  
>  LOGSYS_DECLARE_SUBSYS ("SYNC");
>  
>  #define MESSAGE_REQ_SYNC_BARRIER 0
> +#define MESSAGE_REQ_SYNC_SERVICE_BUILD 1
> +#define MESSAGE_REQ_SYNC_MEMB_DETERMINE 2
>  
> -struct barrier_data {
> -	unsigned int nodeid;
> -	int completed;
> +enum sync_process_state {
> +	INIT,
> +	PROCESS,
> +	ACTIVATE
>  };
>  
> -static const struct memb_ring_id *sync_ring_id;
> +enum sync_state {
> +	SYNC_SERVICELIST_BUILD,
> +	SYNC_PROCESS,
> +	SYNC_BARRIER
> +};
> +
> +struct service_entry {
> +	int service_id;
> +	void (*sync_init) (
> +		const unsigned int *trans_list,
> +		size_t trans_list_entries,
> +		const unsigned int *member_list,
> +		size_t member_list_entries,
> +		const struct memb_ring_id *ring_id);
> +	void (*sync_abort) (void);
> +	int (*sync_process) (void);
> +	void (*sync_activate) (void);
> +	enum sync_process_state state;
> +	char name[128];
> +};
> +
> +struct processor_entry {
> +	int nodeid;
> +	int received;
> +};
>  
> -static int (*sync_callbacks_retrieve) (int sync_id, struct sync_callbacks *callack);
> +struct req_exec_memb_determine_message {
> +	struct qb_ipc_request_header header __attribute__((aligned(8)));
> +	struct memb_ring_id ring_id __attribute__((aligned(8)));
> +};
>  
> -static void (*sync_started) (
> -	const struct memb_ring_id *ring_id);
> +struct req_exec_service_build_message {
> +	struct qb_ipc_request_header header __attribute__((aligned(8)));
> +	struct memb_ring_id ring_id __attribute__((aligned(8)));
> +	int service_list_entries __attribute__((aligned(8)));
> +	int service_list[128] __attribute__((aligned(8)));
> +};
>  
> -static void (*sync_aborted) (void);
> +struct req_exec_barrier_message {
> +	struct qb_ipc_request_header header __attribute__((aligned(8)));
> +	struct memb_ring_id ring_id __attribute__((aligned(8)));
> +};
>  
> -static struct sync_callbacks sync_callbacks;
> +static enum sync_state my_state = SYNC_BARRIER;
>  
> -static int sync_processing = 0;
> +static struct memb_ring_id my_ring_id;
>  
> -static void (*sync_next_start) (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id);
> +static struct memb_ring_id my_memb_determine_ring_id;
> +
> +static int my_memb_determine = 0;
>  
> -static int sync_recovery_index = 0;
> +static unsigned int my_memb_determine_list[PROCESSOR_COUNT_MAX];
>  
> -static void *sync_callback_token_handle = 0;
> +static unsigned int my_memb_determine_list_entries = 0;
>  
> -static struct barrier_data barrier_data_confchg[PROCESSOR_COUNT_MAX];
> +static int my_processing_idx = 0;
>  
> -static size_t barrier_data_confchg_entries;
> +static hdb_handle_t my_schedwrk_handle;
>  
> -static struct barrier_data barrier_data_process[PROCESSOR_COUNT_MAX];
> +static struct processor_entry my_processor_list[PROCESSOR_COUNT_MAX];
>  
>  static unsigned int my_member_list[PROCESSOR_COUNT_MAX];
>  
>  static unsigned int my_trans_list[PROCESSOR_COUNT_MAX];
>  
> -static unsigned int my_member_list_entries;
> +static size_t my_member_list_entries = 0;
> +
> +static size_t my_trans_list_entries = 0;
>  
> -static unsigned int my_trans_list_entries;
> +static int my_processor_list_entries = 0;
>  
> -static int sync_barrier_send (const struct memb_ring_id *ring_id);
> +static struct service_entry my_service_list[128];
>  
> -static int sync_start_process (enum totem_callback_token_type type,
> -			       const void *data);
> +static int my_service_list_entries = 0;
>  
> -static void sync_service_init (struct memb_ring_id *ring_id);
> +static const struct memb_ring_id sync_ring_id;
>  
> -static int sync_service_process (enum totem_callback_token_type type,
> -				 const void *data);
> +static struct service_entry my_initial_service_list[PROCESSOR_COUNT_MAX];
> +
> +static int my_initial_service_list_entries;
> +
> +static void (*sync_synchronization_completed) (void);
>  
>  static void sync_deliver_fn (
>  	unsigned int nodeid,
> @@ -120,21 +160,9 @@ static void sync_deliver_fn (
>  	unsigned int msg_len,
>  	int endian_conversion_required);
>  
> -static void sync_confchg_fn (
> -	enum totem_configuration_type configuration_type,
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const unsigned int *left_list,
> -	size_t left_list_entries,
> -	const unsigned int *joined_list,
> -	size_t joined_list_entries,
> -	const struct memb_ring_id *ring_id);
> -
> -static void sync_primary_callback_fn (
> -        const unsigned int *view_list,
> -        size_t view_list_entries,
> -        const struct memb_ring_id *ring_id);
> +static int schedwrk_processor (const void *context);
>  
> +static void sync_process_enter (void);
>  
>  static struct totempg_group sync_group = {
>      .group      = "sync",
> @@ -143,344 +171,450 @@ static struct totempg_group sync_group = {
>  
>  static void *sync_group_handle;
>  
> -struct req_exec_sync_barrier_start {
> -	struct qb_ipc_request_header header;
> -	struct memb_ring_id ring_id;
> -};
> -
> -/*
> - * Send a barrier data structure
> - */
> -static int sync_barrier_send (const struct memb_ring_id *ring_id)
> +int sync_init (
> +        int (*sync_callbacks_retrieve) (
> +                int service_id,
> +                struct sync_callbacks *callbacks),
> +        void (*synchronization_completed) (void))
>  {
> -	struct req_exec_sync_barrier_start req_exec_sync_barrier_start;
> -	struct iovec iovec;
> -	int res;
> +	unsigned int res;
> +	int i;
> +	struct sync_callbacks sync_callbacks;
>  
> -	req_exec_sync_barrier_start.header.size = sizeof (struct req_exec_sync_barrier_start);
> -	req_exec_sync_barrier_start.header.id = MESSAGE_REQ_SYNC_BARRIER;
> +	res = totempg_groups_initialize (
> +		&sync_group_handle,
> +		sync_deliver_fn,
> +		NULL);
> +	if (res == -1) {
> +		log_printf (LOGSYS_LEVEL_ERROR,
> +			"Couldn't initialize groups interface.");
> +		return (-1);
> +	}
>  
> -	memcpy (&req_exec_sync_barrier_start.ring_id, ring_id,
> -		sizeof (struct memb_ring_id));
> +	res = totempg_groups_join (
> +		sync_group_handle,
> +		&sync_group,
> +		1);
> +	if (res == -1) {
> +		log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group.");
> +		return (-1);
> +	}
>  
> -	iovec.iov_base = (char *)&req_exec_sync_barrier_start;
> -	iovec.iov_len = sizeof (req_exec_sync_barrier_start);
> +	sync_synchronization_completed = synchronization_completed;
> +	for (i = 0; i < 64; i++) {
> +		res = sync_callbacks_retrieve (i, &sync_callbacks);
> +		if (res == -1) {
> +			continue;
> +		}
> +		if (sync_callbacks.sync_init == NULL) {
> +			continue;
> +		}
> +		my_initial_service_list[my_initial_service_list_entries].state =
> +			INIT;
> +		my_initial_service_list[my_initial_service_list_entries].service_id = i;
> +		strcpy (my_initial_service_list[my_initial_service_list_entries].name,
> +			sync_callbacks.name);
> +		my_initial_service_list[my_initial_service_list_entries].sync_init = sync_callbacks.sync_init;
> +		my_initial_service_list[my_initial_service_list_entries].sync_process = sync_callbacks.sync_process;
> +		my_initial_service_list[my_initial_service_list_entries].sync_abort = sync_callbacks.sync_abort;
> +		my_initial_service_list[my_initial_service_list_entries].sync_activate = sync_callbacks.sync_activate;
> +		my_initial_service_list_entries += 1;
> +	}
> +	return (0);
> +}
> +
> +static void sync_barrier_handler (unsigned int nodeid, const void *msg)
> +{
> +	const struct req_exec_barrier_message *req_exec_barrier_message = msg;
> +	int i;
> +	int barrier_reached = 1;
>  
> -	res = totempg_groups_mcast_joined (sync_group_handle, &iovec, 1, TOTEMPG_AGREED);
> +	if (memcmp (&my_ring_id, &req_exec_barrier_message->ring_id,
> +		sizeof (struct memb_ring_id)) != 0) {
>  
> -	return (res);
> +		log_printf (LOGSYS_LEVEL_DEBUG, "barrier for old ring - discarding");
> +		return;
> +	}
> +	for (i = 0; i < my_processor_list_entries; i++) {
> +		if (my_processor_list[i].nodeid == nodeid) {
> +			my_processor_list[i].received = 1;
> +		}
> +	}
> +	for (i = 0; i < my_processor_list_entries; i++) {
> +		if (my_processor_list[i].received == 0) {
> +			barrier_reached = 0;
> +		}
> +	}
> +	if (barrier_reached) {
> +		log_printf (LOGSYS_LEVEL_DEBUG, "Committing synchronization for %s",
> +			my_service_list[my_processing_idx].name);
> +		my_service_list[my_processing_idx].state = ACTIVATE;
> +		my_service_list[my_processing_idx].sync_activate ();
> +
> +		my_processing_idx += 1;
> +		if (my_service_list_entries == my_processing_idx) {
> +			my_memb_determine_list_entries = 0;
> +			sync_synchronization_completed ();
> +		} else {
> +			sync_process_enter ();
> +		}
> +	}
>  }
>  
> -static void sync_start_init (const struct memb_ring_id *ring_id)
> +static void dummy_sync_init (
> +	const unsigned int *trans_list,
> +	size_t trans_list_entries,
> +	const unsigned int *member_list,
> +	size_t member_list_entries,
> +	const struct memb_ring_id *ring_id)
>  {
> -	totempg_callback_token_create (
> -		&sync_callback_token_handle,
> -		TOTEM_CALLBACK_TOKEN_SENT,
> -		0, /* don't delete after callback */
> -		sync_start_process,
> -		ring_id);
>  }
>  
> -static void sync_service_init (struct memb_ring_id *ring_id)
> +static void dummy_sync_abort (void)
>  {
> -	if (sync_callbacks.api_version == 1) {
> -		sync_callbacks.sync_init_api.sync_init_v1 (my_member_list,
> -			my_member_list_entries, ring_id);
> -	} else {
> -		sync_callbacks.sync_init_api.sync_init_v2 (my_trans_list,
> -			my_trans_list_entries,
> -			my_member_list, my_member_list_entries, ring_id);
> -	}
> -	totempg_callback_token_destroy (&sync_callback_token_handle);
> -
> -	/*
> -	 * Create the token callback for the processing
> -	 */
> -	totempg_callback_token_create (
> -		&sync_callback_token_handle,
> -		TOTEM_CALLBACK_TOKEN_SENT,
> -		0, /* don't delete after callback */
> -		sync_service_process,
> -		ring_id);
>  }
>  
> -static int sync_start_process (enum totem_callback_token_type type,
> -			       const void *data)
> +static int dummy_sync_process (void)
>  {
> -	int res;
> -	const struct memb_ring_id *ring_id = data;
> -
> -	res = sync_barrier_send (ring_id);
> -	if (res == 0) {
> -		/*
> -		 * Delete the token callback for the barrier
> -		 */
> -		totempg_callback_token_destroy (&sync_callback_token_handle);
> -	}
>  	return (0);
>  }
>  
> -static void sync_callbacks_load (void)
> +static void dummy_sync_activate (void)
>  {
> -	int res;
> +}
>  
> -	for (;;) {
> -		res = sync_callbacks_retrieve (sync_recovery_index,
> -			&sync_callbacks);
> +static int service_entry_compare (const void *a, const void *b)
> +{
> +	const struct service_entry *service_entry_a = a;
> +	const struct service_entry *service_entry_b = b;
>  
> -		/*
> -		 * No more service handlers have sync callbacks at this time
> -	`	 */
> -		if (res == -1) {
> -			sync_processing = 0;
> -			break;
> -		}
> -		sync_recovery_index += 1;
> -		if (sync_callbacks.sync_init_api.sync_init_v1) {
> -			break;
> -		}
> -	}
> +	return (service_entry_a->service_id > service_entry_b->service_id);
>  }
>  
> -static int sync_service_process (enum totem_callback_token_type type,
> -				 const void *data)
> +static void sync_memb_determine (unsigned int nodeid, const void *msg)
>  {
> -	int res;
> -	const struct memb_ring_id *ring_id = data;
> +	const struct req_exec_memb_determine_message *req_exec_memb_determine_message = msg;
> +	int found = 0;
> +	int i;
>  
> +	if (memcmp (&req_exec_memb_determine_message->ring_id,
> +		&my_memb_determine_ring_id, sizeof (struct memb_ring_id)) != 0) {
>  
> -	/*
> -	 * If process operation not from this ring id, then ignore it and stop
> -	 * processing
> -	 */
> -	if (memcmp (ring_id, sync_ring_id, sizeof (struct memb_ring_id)) != 0) {
> -		return (0);
> +		log_printf (LOGSYS_LEVEL_DEBUG, "memb determine for old ring - discarding");
> +		return;
>  	}
>  
> -	/*
> -	 * If process returns 0, then its time to activate
> -	 * and start the next service's synchronization
> -	 */
> -	res = sync_callbacks.sync_process ();
> -	if (res != 0) {
> -		return (0);
> +	my_memb_determine = 1;
> +	for (i = 0; i < my_memb_determine_list_entries; i++) {
> +		if (my_memb_determine_list[i] == nodeid) {
> +			found = 1;
> +		}
>  	}
> -	totempg_callback_token_destroy (&sync_callback_token_handle);
> +	if (found == 0) {
> +		my_memb_determine_list[my_memb_determine_list_entries] = nodeid;
> +		my_memb_determine_list_entries += 1;
> +	}
> +}
>  
> -	sync_start_init (ring_id);
> +static void sync_service_build_handler (unsigned int nodeid, const void *msg)
> +{
> +	const struct req_exec_service_build_message *req_exec_service_build_message = msg;
> +	int i, j;
> +	int barrier_reached = 1;
> +	int found;
> +	int qsort_trigger = 0;
>  
> -	return (0);
> +	if (memcmp (&my_ring_id, &req_exec_service_build_message->ring_id,
> +		sizeof (struct memb_ring_id)) != 0) {
> +		log_printf (LOGSYS_LEVEL_DEBUG, "service build for old ring - discarding");
> +		return;
> +	}
> +	for (i = 0; i < req_exec_service_build_message->service_list_entries; i++) {
> +
> +		found = 0;
> +		for (j = 0; j < my_service_list_entries; j++) {
> +			if (req_exec_service_build_message->service_list[i] ==
> +				my_service_list[j].service_id) {
> +				found = 1;
> +				break;
> +			}
> +		}
> +		if (found == 0) {
> +			my_service_list[my_service_list_entries].state =
> +				INIT;
> +			my_service_list[my_service_list_entries].service_id =
> +				req_exec_service_build_message->service_list[i];
> +			sprintf (my_service_list[my_service_list_entries].name,
> +				"External Service (id = %d)\n",
> +				req_exec_service_build_message->service_list[i]);
> +			my_service_list[my_service_list_entries].sync_init =
> +				dummy_sync_init;
> +			my_service_list[my_service_list_entries].sync_abort =
> +				dummy_sync_abort;
> +			my_service_list[my_service_list_entries].sync_process =
> +				dummy_sync_process;
> +			my_service_list[my_service_list_entries].sync_activate =
> +				dummy_sync_activate;
> +			my_service_list_entries += 1;
> +
> +			qsort_trigger = 1;
> +		}
> +	}
> +	if (qsort_trigger) {
> +		qsort (my_service_list, my_service_list_entries,
> +			sizeof (struct service_entry), service_entry_compare);
> +	}
> +	for (i = 0; i < my_processor_list_entries; i++) {
> +		if (my_processor_list[i].nodeid == nodeid) {
> +			my_processor_list[i].received = 1;
> +		}
> +	}
> +	for (i = 0; i < my_processor_list_entries; i++) {
> +		if (my_processor_list[i].received == 0) {
> +			barrier_reached = 0;
> +		}
> +	}
> +	if (barrier_reached) {
> +		sync_process_enter ();
> +	}
>  }
>  
> -int sync_register (
> -	int (*callbacks_retrieve) (
> -		int sync_id,
> -		struct sync_callbacks *callbacks),
> -
> -	void (*started) (
> -		const struct memb_ring_id *ring_id),
> +static void sync_deliver_fn (
> +	unsigned int nodeid,
> +	const void *msg,
> +	unsigned int msg_len,
> +	int endian_conversion_required)
> +{
> +	struct qb_ipc_request_header *header = (struct qb_ipc_request_header *)msg;
>  
> -	void (*aborted) (void),
> +	switch (header->id) {
> +		case MESSAGE_REQ_SYNC_BARRIER:
> +			sync_barrier_handler (nodeid, msg);
> +			break;
> +		case MESSAGE_REQ_SYNC_SERVICE_BUILD:
> +			sync_service_build_handler (nodeid, msg);
> +			break;
> +		case MESSAGE_REQ_SYNC_MEMB_DETERMINE:
> +			sync_memb_determine (nodeid, msg);
> +			break;
> +	}
> +}
>  
> -	void (*next_start) (
> -		const unsigned int *member_list,
> -		size_t member_list_entries,
> -		const struct memb_ring_id *ring_id))
> +static void memb_determine_message_transmit (void)
>  {
> -	unsigned int res;
> +	struct iovec iovec;
> +	struct req_exec_memb_determine_message req_exec_memb_determine_message;
>  
> -	res = totempg_groups_initialize (
> -		&sync_group_handle,
> -		sync_deliver_fn,
> -		sync_confchg_fn);
> -	if (res == -1) {
> -		log_printf (LOGSYS_LEVEL_ERROR,
> -			"Couldn't initialize groups interface.");
> -		return (-1);
> -	}
> +	req_exec_memb_determine_message.header.size = sizeof (struct req_exec_memb_determine_message);
> +	req_exec_memb_determine_message.header.id = MESSAGE_REQ_SYNC_MEMB_DETERMINE;
>  
> -	res = totempg_groups_join (
> -		sync_group_handle,
> -		&sync_group,
> -		1);
> -	if (res == -1) {
> -		log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group.");
> -		return (-1);
> -	}
> +	memcpy (&req_exec_memb_determine_message.ring_id,
> +		&my_memb_determine_ring_id,
> +		sizeof (struct memb_ring_id));
>  
> -	sync_callbacks_retrieve = callbacks_retrieve;
> -	sync_next_start = next_start;
> -	sync_started = started;
> -	sync_aborted = aborted;
> -	return (0);
> -}
> +	iovec.iov_base = (char *)&req_exec_memb_determine_message;
> +	iovec.iov_len = sizeof (req_exec_memb_determine_message);
>  
> +	(void)totempg_groups_mcast_joined (sync_group_handle,
> +		&iovec, 1, TOTEMPG_AGREED);
> +}
>  
> -static void sync_primary_callback_fn (
> -	const unsigned int *view_list,
> -	size_t view_list_entries,
> -	const struct memb_ring_id *ring_id)
> +static void barrier_message_transmit (void)
>  {
> -	int i;
> +	struct iovec iovec;
> +	struct req_exec_barrier_message req_exec_barrier_message;
>  
> +	req_exec_barrier_message.header.size = sizeof (struct req_exec_barrier_message);
> +	req_exec_barrier_message.header.id = MESSAGE_REQ_SYNC_BARRIER;
>  
> -	/*
> -	 * Execute configuration change for synchronization service
> -	 */
> -	sync_processing = 1;
> +	memcpy (&req_exec_barrier_message.ring_id, &my_ring_id,
> +		sizeof (struct memb_ring_id));
>  
> -	totempg_callback_token_destroy (&sync_callback_token_handle);
> +	iovec.iov_base = (char *)&req_exec_barrier_message;
> +	iovec.iov_len = sizeof (req_exec_barrier_message);
>  
> -	sync_recovery_index = 0;
> -	memset (&barrier_data_confchg, 0, sizeof (barrier_data_confchg));
> -	for (i = 0; i < view_list_entries; i++) {
> -		barrier_data_confchg[i].nodeid = view_list[i];
> -		barrier_data_confchg[i].completed = 0;
> -	}
> -	memcpy (barrier_data_process, barrier_data_confchg,
> -		sizeof (barrier_data_confchg));
> -	barrier_data_confchg_entries = view_list_entries;
> -	sync_start_init (sync_ring_id);
> +	(void)totempg_groups_mcast_joined (sync_group_handle,
> +		&iovec, 1, TOTEMPG_AGREED);
>  }
>  
> -static struct memb_ring_id deliver_ring_id;
> -
> -static void sync_endian_convert (struct req_exec_sync_barrier_start
> -				 *req_exec_sync_barrier_start)
> +static void service_build_message_transmit (struct req_exec_service_build_message *service_build_message)
>  {
> -	totemip_copy_endian_convert(&req_exec_sync_barrier_start->ring_id.rep,
> -		&req_exec_sync_barrier_start->ring_id.rep);
> -	req_exec_sync_barrier_start->ring_id.seq = swab64 (req_exec_sync_barrier_start->ring_id.seq);
> +	struct iovec iovec;
> +
> +	service_build_message->header.size = sizeof (struct req_exec_service_build_message);
> +	service_build_message->header.id = MESSAGE_REQ_SYNC_SERVICE_BUILD;
> +
> +	memcpy (&service_build_message->ring_id, &my_ring_id,
> +		sizeof (struct memb_ring_id));
> +
> +	iovec.iov_base = (void *)service_build_message;
> +	iovec.iov_len = sizeof (struct req_exec_service_build_message);
>  
> +	(void)totempg_groups_mcast_joined (sync_group_handle,
> +		&iovec, 1, TOTEMPG_AGREED);
>  }
>  
> -static void sync_deliver_fn (
> -	unsigned int nodeid,
> -	const void *msg,
> -	unsigned int msg_len,
> -	int endian_conversion_required)
> +static void sync_barrier_enter (void)
>  {
> -	struct req_exec_sync_barrier_start *req_exec_sync_barrier_start =
> -		(struct req_exec_sync_barrier_start *)msg;
> -	unsigned int barrier_completed;
> -	int i;
> -
> -	log_printf (LOGSYS_LEVEL_DEBUG, "confchg entries %lu",
> -		    (unsigned long int) barrier_data_confchg_entries);
> -	if (endian_conversion_required) {
> -		sync_endian_convert (req_exec_sync_barrier_start);
> -	}
> +	my_state = SYNC_BARRIER;
> +	barrier_message_transmit ();
> +}
>  
> -	barrier_completed = 1;
> +static void sync_process_enter (void)
> +{
> +	int i;
>  
> -	memcpy (&deliver_ring_id, &req_exec_sync_barrier_start->ring_id,
> -		sizeof (struct memb_ring_id));
> +	my_state = SYNC_PROCESS;
>  
>  	/*
> -	 * Is this barrier from this configuration, if not, ignore it
> +	 * No sync services
>  	 */
> -	if (memcmp (&req_exec_sync_barrier_start->ring_id, sync_ring_id,
> -		sizeof (struct memb_ring_id)) != 0) {
> +	if (my_service_list_entries == 0) {
> +		my_state = SYNC_SERVICELIST_BUILD;
> +		my_memb_determine_list_entries = 0;
> +		sync_synchronization_completed ();
>  		return;
>  	}
> -
> -	/*
> -	 * Set completion for source_addr's address
> -	 */
> -	for (i = 0; i < barrier_data_confchg_entries; i++) {
> -		if (nodeid == barrier_data_process[i].nodeid) {
> -			barrier_data_process[i].completed = 1;
> -			log_printf (LOGSYS_LEVEL_DEBUG,
> -				"Barrier Start Received From %d",
> -				barrier_data_process[i].nodeid);
> -			break;
> -		}
> +	for (i = 0; i < my_processor_list_entries; i++) {
> +		my_processor_list[i].received = 0;
>  	}
> +	schedwrk_create (&my_schedwrk_handle,
> +		schedwrk_processor,
> +		NULL);
> +}
>  
> -	/*
> -	 * Test if barrier is complete
> -	 */
> -	for (i = 0; i < barrier_data_confchg_entries; i++) {
> -		log_printf (LOGSYS_LEVEL_DEBUG,
> -			"Barrier completion status for nodeid %d = %d. ",
> -			barrier_data_process[i].nodeid,
> -			barrier_data_process[i].completed);
> -		if (barrier_data_process[i].completed == 0) {
> -			barrier_completed = 0;
> -		}
> -	}
> -	if (barrier_completed) {
> -		log_printf (LOGSYS_LEVEL_DEBUG,
> -			"Synchronization barrier completed");
> +static void sync_servicelist_build_enter (
> +	const unsigned int *member_list,
> +	size_t member_list_entries,
> +	const struct memb_ring_id *ring_id)
> +{
> +	struct req_exec_service_build_message service_build;
> +	int i;
> +
> +	my_state = SYNC_SERVICELIST_BUILD;
> +	for (i = 0; i < member_list_entries; i++) {
> +		my_processor_list[i].nodeid = member_list[i];
> +		my_processor_list[i].received = 0;
>  	}
> -	/*
> -	 * This sync is complete so activate and start next service sync
> -	 */
> -	if (barrier_completed && sync_callbacks.sync_activate) {
> -		sync_callbacks.sync_activate ();
> +	my_processor_list_entries = member_list_entries;
>  
> -		log_printf (LOGSYS_LEVEL_DEBUG,
> -			"Committing synchronization for (%s)",
> -			sync_callbacks.name);
> +	memcpy (my_member_list, member_list,
> +		member_list_entries * sizeof (unsigned int));
> +	my_member_list_entries = member_list_entries;
> +
> +	my_processing_idx = 0;
> +
> +	memcpy (my_service_list, my_initial_service_list,
> +		sizeof (struct service_entry) *
> +			my_initial_service_list_entries);
> +	my_service_list_entries = my_initial_service_list_entries;
> +
> +	for (i = 0; i < my_initial_service_list[i].service_id; i++) {
> +		service_build.service_list[i] =
> +			my_initial_service_list[i].service_id;
>  	}
> +	service_build.service_list_entries = i;
>  
> -	/*
> -	 * Start synchronization if the barrier has completed
> -	 */
> -	if (barrier_completed) {
> -		memcpy (barrier_data_process, barrier_data_confchg,
> -			sizeof (barrier_data_confchg));
> -
> -		sync_callbacks_load();
> -
> -		/*
> -		 * if sync service found, execute it
> -		 */
> -		if (sync_processing && sync_callbacks.sync_init_api.sync_init_v1) {
> -			log_printf (LOGSYS_LEVEL_DEBUG,
> -				"Synchronization actions starting for (%s)",
> -				sync_callbacks.name);
> -			sync_service_init (&deliver_ring_id);
> +	service_build_message_transmit (&service_build);
> +}
> +
> +static int schedwrk_processor (const void *context)
> +{
> +	int res = 0;
> +
> +	if (my_service_list[my_processing_idx].state == INIT) {
> +		unsigned int old_trans_list[PROCESSOR_COUNT_MAX];
> +		size_t old_trans_list_entries = 0;
> +		int o, m;
> +		my_service_list[my_processing_idx].state = PROCESS;
> +
> +		memcpy (old_trans_list, my_trans_list, my_trans_list_entries *
> +			sizeof (unsigned int));
> +		old_trans_list_entries = my_trans_list_entries;
> +
> +		my_trans_list_entries = 0;
> +		for (o = 0; o < old_trans_list_entries; o++) {
> +			for (m = 0; m < my_member_list_entries; m++) {
> +				if (old_trans_list[o] == my_member_list[m]) {
> +					my_trans_list[my_trans_list_entries] = my_member_list[m];
> +					my_trans_list_entries++;
> +					break;
> +				}
> +			}
>  		}
> -		if (sync_processing == 0) {
> -			sync_next_start (my_member_list, my_member_list_entries, sync_ring_id);
> +
> +		my_service_list[my_processing_idx].sync_init (my_trans_list,
> +			my_trans_list_entries, my_member_list,
> +			my_member_list_entries,
> +			&my_ring_id);
> +	}
> +	if (my_service_list[my_processing_idx].state == PROCESS) {
> +		my_service_list[my_processing_idx].state = PROCESS;
> +		res = my_service_list[my_processing_idx].sync_process ();
> +		if (res == 0) {
> +			sync_barrier_enter();
> +		} else {
> +			return (-1);
>  		}
>  	}
> -	return;
> +	return (0);
>  }
>  
> -static void sync_confchg_fn (
> -	enum totem_configuration_type configuration_type,
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const unsigned int *left_list,
> -	size_t left_list_entries,
> -	const unsigned int *joined_list,
> -	size_t joined_list_entries,
> -	const struct memb_ring_id *ring_id)
> +void sync_start (
> +        const unsigned int *member_list,
> +        size_t member_list_entries,
> +        const struct memb_ring_id *ring_id)
>  {
> -	sync_ring_id = ring_id;
> +	ENTER();
> +	memcpy (&my_ring_id, ring_id, sizeof (struct memb_ring_id));
>  
> -	if (configuration_type != TOTEM_CONFIGURATION_REGULAR) {
> -		memcpy (my_trans_list, member_list, member_list_entries *
> -			sizeof (unsigned int));
> -		my_trans_list_entries = member_list_entries;
> -		return;
> +	if (my_memb_determine) {
> +		my_memb_determine = 0;
> +		sync_servicelist_build_enter (my_memb_determine_list,
> +			my_memb_determine_list_entries, ring_id);
> +	} else {
> +		sync_servicelist_build_enter (member_list, member_list_entries,
> +			ring_id);
>  	}
> -	memcpy (my_member_list, member_list, member_list_entries * sizeof (unsigned int));
> -	my_member_list_entries = member_list_entries;
> +}
> +
> +void sync_save_transitional (
> +        const unsigned int *member_list,
> +        size_t member_list_entries,
> +        const struct memb_ring_id *ring_id)
> +{
> +	ENTER();
> +	memcpy (my_trans_list, member_list, member_list_entries *
> +		sizeof (unsigned int));
> +	my_trans_list_entries = member_list_entries;
> +}
>  
> -	sync_aborted ();
> -	if (sync_processing && sync_callbacks.sync_abort != NULL) {
> -		sync_callbacks.sync_abort ();
> -		sync_callbacks.sync_activate = NULL;
> +void sync_abort (void)
> +{
> +	ENTER();
> +	if (my_state == SYNC_PROCESS) {
> +		schedwrk_destroy (my_schedwrk_handle);
> +		my_service_list[my_processing_idx].sync_abort ();
>  	}
>  
> -	sync_started (
> -		ring_id);
> +	/* this will cause any "old" barrier messages from causing
> +	 * problems.
> +	 */
> +	memset (&my_ring_id, 0,	sizeof (struct memb_ring_id));
> +}
>  
> -	sync_primary_callback_fn (
> -		member_list,
> -		member_list_entries,
> -		ring_id);
> +void sync_memb_list_determine (const struct memb_ring_id *ring_id)
> +{
> +	ENTER();
> +	memcpy (&my_memb_determine_ring_id, ring_id,
> +		sizeof (struct memb_ring_id));
> +
> +	memb_determine_message_transmit ();
> +}
> +
> +void sync_memb_list_abort (void)
> +{
> +	ENTER();
> +	my_memb_determine_list_entries = 0;
> +	memset (&my_memb_determine_ring_id, 0, sizeof (struct memb_ring_id));
>  }
> diff --git a/exec/sync.h b/exec/sync.h
> index 7913a0a..ee2f076 100644
> --- a/exec/sync.h
> +++ b/exec/sync.h
> @@ -1,6 +1,5 @@
>  /*
> - * Copyright (c) 2002-2004 MontaVista Software, Inc.
> - * Copyright (c) 2006-2010 Red Hat, Inc.
> + * Copyright (c) 2009-2010 Red Hat, Inc.
>   *
>   * All rights reserved.
>   *
> @@ -36,47 +35,39 @@
>  #ifndef SYNC_H_DEFINED
>  #define SYNC_H_DEFINED
>  
> -#include <netinet/in.h>
> -#include <corosync/totem/totempg.h>
> -#include "totemsrp.h"
> -
> -union sync_init_api {
> -	void (*sync_init_v1) (
> -		const unsigned int *member_list,
> -		size_t member_list_entries,
> -		const struct memb_ring_id *ring_id);
> -
> -	void (*sync_init_v2) (
> +struct sync_callbacks {
> +	void (*sync_init) (
>  		const unsigned int *trans_list,
>  		size_t trans_list_entries,
>  		const unsigned int *member_list,
>  		size_t member_list_entries,
>  		const struct memb_ring_id *ring_id);
> -};
> -
> -struct sync_callbacks {
> -	int api_version;
> -	union sync_init_api sync_init_api;
>  	int (*sync_process) (void);
>  	void (*sync_activate) (void);
>  	void (*sync_abort) (void);
>  	const char *name;
>  };
>  
> -int sync_register (
> +extern int sync_init (
>  	int (*sync_callbacks_retrieve) (
> -		int sync_id,
> +		int service_id,
>  		struct sync_callbacks *callbacks),
> +	void (*synchronization_completed) (void));
>  
> -	void (*sync_started) (
> -		const struct memb_ring_id *ring_id),
> +extern void sync_start (
> +        const unsigned int *member_list,
> +        size_t member_list_entries,
> +        const struct memb_ring_id *ring_id);
>  
> -	void (*sync_aborted) (void),
> +extern void sync_save_transitional (
> +        const unsigned int *member_list,
> +        size_t member_list_entries,
> +        const struct memb_ring_id *ring_id);
>  
> -	void (*next_start) (
> -		const unsigned int *member_list,
> -		size_t member_list_entries,
> -		const struct memb_ring_id *ring_id));
> +extern void sync_abort (void);
> +
> +extern void sync_memb_list_determine (const struct memb_ring_id *ring_id);
>  
> +extern void sync_memb_list_abort (void);
>  
>  #endif /* SYNC_H_DEFINED */
> diff --git a/exec/syncv2.c b/exec/syncv2.c
> deleted file mode 100644
> index e50c23e..0000000
> --- a/exec/syncv2.c
> +++ /dev/null
> @@ -1,623 +0,0 @@
> -/*
> - * Copyright (c) 2009-2012 Red Hat, Inc.
> - *
> - * All rights reserved.
> - *
> - * Author: Steven Dake (sdake@xxxxxxxxxx)
> - *
> - * This software licensed under BSD license, the text of which follows:
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are met:
> - *
> - * - Redistributions of source code must retain the above copyright notice,
> - *   this list of conditions and the following disclaimer.
> - * - Redistributions in binary form must reproduce the above copyright notice,
> - *   this list of conditions and the following disclaimer in the documentation
> - *   and/or other materials provided with the distribution.
> - * - Neither the name of the MontaVista Software, Inc. nor the names of its
> - *   contributors may be used to endorse or promote products derived from this
> - *   software without specific prior written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
> - * THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -#include <config.h>
> -
> -#include <sys/types.h>
> -#include <sys/socket.h>
> -#include <sys/un.h>
> -#include <sys/ioctl.h>
> -#include <netinet/in.h>
> -#include <sys/uio.h>
> -#include <unistd.h>
> -#include <fcntl.h>
> -#include <stdlib.h>
> -#include <stdio.h>
> -#include <errno.h>
> -#include <time.h>
> -#include <unistd.h>
> -#include <netinet/in.h>
> -#include <arpa/inet.h>
> -
> -#include <corosync/corotypes.h>
> -#include <corosync/swab.h>
> -#include <corosync/totem/totempg.h>
> -#include <corosync/totem/totem.h>
> -#include <corosync/logsys.h>
> -#include <qb/qbipc_common.h>
> -#include "schedwrk.h"
> -#include "quorum.h"
> -#include "sync.h"
> -#include "syncv2.h"
> -
> -LOGSYS_DECLARE_SUBSYS ("SYNCV2");
> -
> -#define MESSAGE_REQ_SYNC_BARRIER 0
> -#define MESSAGE_REQ_SYNC_SERVICE_BUILD 1
> -#define MESSAGE_REQ_SYNC_MEMB_DETERMINE 2
> -
> -enum sync_process_state {
> -	INIT,
> -	PROCESS,
> -	ACTIVATE
> -};
> -
> -enum sync_state {
> -	SYNC_SERVICELIST_BUILD,
> -	SYNC_PROCESS,
> -	SYNC_BARRIER
> -};
> -
> -struct service_entry {
> -	int service_id;
> -	int api_version;
> -	union sync_init_api sync_init_api;
> -	void (*sync_abort) (void);
> -	int (*sync_process) (void);
> -	void (*sync_activate) (void);
> -	enum sync_process_state state;
> -	char name[128];
> -};
> -
> -struct processor_entry {
> -	int nodeid;
> -	int received;
> -};
> -
> -struct req_exec_memb_determine_message {
> -	struct qb_ipc_request_header header __attribute__((aligned(8)));
> -	struct memb_ring_id ring_id __attribute__((aligned(8)));
> -};
> -
> -struct req_exec_service_build_message {
> -	struct qb_ipc_request_header header __attribute__((aligned(8)));
> -	struct memb_ring_id ring_id __attribute__((aligned(8)));
> -	int service_list_entries __attribute__((aligned(8)));
> -	int service_list[128] __attribute__((aligned(8)));
> -};
> -
> -struct req_exec_barrier_message {
> -	struct qb_ipc_request_header header __attribute__((aligned(8)));
> -	struct memb_ring_id ring_id __attribute__((aligned(8)));
> -};
> -
> -static enum sync_state my_state = SYNC_BARRIER;
> -
> -static struct memb_ring_id my_ring_id;
> -
> -static struct memb_ring_id my_memb_determine_ring_id;
> -
> -static int my_memb_determine = 0;
> -
> -static unsigned int my_memb_determine_list[PROCESSOR_COUNT_MAX];
> -
> -static unsigned int my_memb_determine_list_entries = 0;
> -
> -static int my_processing_idx = 0;
> -
> -static hdb_handle_t my_schedwrk_handle;
> -
> -static struct processor_entry my_processor_list[PROCESSOR_COUNT_MAX];
> -
> -static unsigned int my_member_list[PROCESSOR_COUNT_MAX];
> -
> -static unsigned int my_trans_list[PROCESSOR_COUNT_MAX];
> -
> -static size_t my_member_list_entries = 0;
> -
> -static size_t my_trans_list_entries = 0;
> -
> -static int my_processor_list_entries = 0;
> -
> -static struct service_entry my_service_list[128];
> -
> -static int my_service_list_entries = 0;
> -
> -static const struct memb_ring_id sync_ring_id;
> -
> -static struct service_entry my_initial_service_list[PROCESSOR_COUNT_MAX];
> -
> -static int my_initial_service_list_entries;
> -
> -static void (*sync_synchronization_completed) (void);
> -
> -static void sync_deliver_fn (
> -	unsigned int nodeid,
> -	const void *msg,
> -	unsigned int msg_len,
> -	int endian_conversion_required);
> -
> -static int schedwrk_processor (const void *context);
> -
> -static void sync_process_enter (void);
> -
> -static struct totempg_group sync_group = {
> -    .group      = "syncv2",
> -    .group_len  = 6
> -};
> -
> -static void *sync_group_handle;
> -
> -int sync_v2_init (
> -        int (*sync_callbacks_retrieve) (
> -                int service_id,
> -                struct sync_callbacks *callbacks),
> -        void (*synchronization_completed) (void))
> -{
> -	unsigned int res;
> -	int i;
> -	struct sync_callbacks sync_callbacks;
> -
> -	res = totempg_groups_initialize (
> -		&sync_group_handle,
> -		sync_deliver_fn,
> -		NULL);
> -	if (res == -1) {
> -		log_printf (LOGSYS_LEVEL_ERROR,
> -			"Couldn't initialize groups interface.");
> -		return (-1);
> -	}
> -
> -	res = totempg_groups_join (
> -		sync_group_handle,
> -		&sync_group,
> -		1);
> -	if (res == -1) {
> -		log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group.");
> -		return (-1);
> -	}
> -
> -	sync_synchronization_completed = synchronization_completed;
> -	for (i = 0; i < 64; i++) {
> -		res = sync_callbacks_retrieve (i, &sync_callbacks);
> -		if (res == -1) {
> -			continue;
> -		}
> -		if (sync_callbacks.sync_init_api.sync_init_v1 == NULL) {
> -			continue;
> -		}
> -		my_initial_service_list[my_initial_service_list_entries].state =
> -			INIT;
> -		my_initial_service_list[my_initial_service_list_entries].service_id = i;
> -		strcpy (my_initial_service_list[my_initial_service_list_entries].name,
> -			sync_callbacks.name);
> -		my_initial_service_list[my_initial_service_list_entries].api_version = sync_callbacks.api_version;
> -		my_initial_service_list[my_initial_service_list_entries].sync_init_api = sync_callbacks.sync_init_api;
> -		my_initial_service_list[my_initial_service_list_entries].sync_process = sync_callbacks.sync_process;
> -		my_initial_service_list[my_initial_service_list_entries].sync_abort = sync_callbacks.sync_abort;
> -		my_initial_service_list[my_initial_service_list_entries].sync_activate = sync_callbacks.sync_activate;
> -		my_initial_service_list_entries += 1;
> -	}
> -	return (0);
> -}
> -
> -static void sync_barrier_handler (unsigned int nodeid, const void *msg)
> -{
> -	const struct req_exec_barrier_message *req_exec_barrier_message = msg;
> -	int i;
> -	int barrier_reached = 1;
> -
> -	if (memcmp (&my_ring_id, &req_exec_barrier_message->ring_id,
> -		sizeof (struct memb_ring_id)) != 0) {
> -
> -		log_printf (LOGSYS_LEVEL_DEBUG, "barrier for old ring - discarding");
> -		return;
> -	}
> -	for (i = 0; i < my_processor_list_entries; i++) {
> -		if (my_processor_list[i].nodeid == nodeid) {
> -			my_processor_list[i].received = 1;
> -		}
> -	}
> -	for (i = 0; i < my_processor_list_entries; i++) {
> -		if (my_processor_list[i].received == 0) {
> -			barrier_reached = 0;
> -		}
> -	}
> -	if (barrier_reached) {
> -		log_printf (LOGSYS_LEVEL_DEBUG, "Committing synchronization for %s",
> -			my_service_list[my_processing_idx].name);
> -		my_service_list[my_processing_idx].state = ACTIVATE;
> -		my_service_list[my_processing_idx].sync_activate ();
> -
> -		my_processing_idx += 1;
> -		if (my_service_list_entries == my_processing_idx) {
> -			my_memb_determine_list_entries = 0;
> -			sync_synchronization_completed ();
> -		} else {
> -			sync_process_enter ();
> -		}
> -	}
> -}
> -
> -static void dummy_sync_init (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id)
> -{
> -}
> -
> -static void dummy_sync_abort (void)
> -{
> -}
> -
> -static int dummy_sync_process (void)
> -{
> -	return (0);
> -}
> -
> -static void dummy_sync_activate (void)
> -{
> -}
> -
> -static int service_entry_compare (const void *a, const void *b)
> -{
> -	const struct service_entry *service_entry_a = a;
> -	const struct service_entry *service_entry_b = b;
> -
> -	return (service_entry_a->service_id > service_entry_b->service_id);
> -}
> -
> -static void sync_memb_determine (unsigned int nodeid, const void *msg)
> -{
> -	const struct req_exec_memb_determine_message *req_exec_memb_determine_message = msg;
> -	int found = 0;
> -	int i;
> -
> -	if (memcmp (&req_exec_memb_determine_message->ring_id,
> -		&my_memb_determine_ring_id, sizeof (struct memb_ring_id)) != 0) {
> -
> -		log_printf (LOGSYS_LEVEL_DEBUG, "memb determine for old ring - discarding");
> -		return;
> -	}
> -
> -	my_memb_determine = 1;
> -	for (i = 0; i < my_memb_determine_list_entries; i++) {
> -		if (my_memb_determine_list[i] == nodeid) {
> -			found = 1;
> -		}
> -	}
> -	if (found == 0) {
> -		my_memb_determine_list[my_memb_determine_list_entries] = nodeid;
> -		my_memb_determine_list_entries += 1;
> -	}
> -}
> -
> -static void sync_service_build_handler (unsigned int nodeid, const void *msg)
> -{
> -	const struct req_exec_service_build_message *req_exec_service_build_message = msg;
> -	int i, j;
> -	int barrier_reached = 1;
> -	int found;
> -	int qsort_trigger = 0;
> -
> -	if (memcmp (&my_ring_id, &req_exec_service_build_message->ring_id,
> -		sizeof (struct memb_ring_id)) != 0) {
> -		log_printf (LOGSYS_LEVEL_DEBUG, "service build for old ring - discarding");
> -		return;
> -	}
> -	for (i = 0; i < req_exec_service_build_message->service_list_entries; i++) {
> -
> -		found = 0;
> -		for (j = 0; j < my_service_list_entries; j++) {
> -			if (req_exec_service_build_message->service_list[i] ==
> -				my_service_list[j].service_id) {
> -				found = 1;
> -				break;
> -			}
> -		}
> -		if (found == 0) {
> -			my_service_list[my_service_list_entries].state =
> -				INIT;
> -			my_service_list[my_service_list_entries].service_id =
> -				req_exec_service_build_message->service_list[i];
> -			sprintf (my_service_list[my_service_list_entries].name,
> -				"External Service (id = %d)\n",
> -				req_exec_service_build_message->service_list[i]);
> -			my_service_list[my_service_list_entries].api_version = 1;
> -			my_service_list[my_service_list_entries].sync_init_api.sync_init_v1 =
> -				dummy_sync_init;
> -			my_service_list[my_service_list_entries].sync_abort =
> -				dummy_sync_abort;
> -			my_service_list[my_service_list_entries].sync_process =
> -				dummy_sync_process;
> -			my_service_list[my_service_list_entries].sync_activate =
> -				dummy_sync_activate;
> -			my_service_list_entries += 1;
> -
> -			qsort_trigger = 1;
> -		}
> -	}
> -	if (qsort_trigger) {
> -		qsort (my_service_list, my_service_list_entries,
> -			sizeof (struct service_entry), service_entry_compare);
> -	}
> -	for (i = 0; i < my_processor_list_entries; i++) {
> -		if (my_processor_list[i].nodeid == nodeid) {
> -			my_processor_list[i].received = 1;
> -		}
> -	}
> -	for (i = 0; i < my_processor_list_entries; i++) {
> -		if (my_processor_list[i].received == 0) {
> -			barrier_reached = 0;
> -		}
> -	}
> -	if (barrier_reached) {
> -		sync_process_enter ();
> -	}
> -}
> -
> -static void sync_deliver_fn (
> -	unsigned int nodeid,
> -	const void *msg,
> -	unsigned int msg_len,
> -	int endian_conversion_required)
> -{
> -	struct qb_ipc_request_header *header = (struct qb_ipc_request_header *)msg;
> -
> -	switch (header->id) {
> -		case MESSAGE_REQ_SYNC_BARRIER:
> -			sync_barrier_handler (nodeid, msg);
> -			break;
> -		case MESSAGE_REQ_SYNC_SERVICE_BUILD:
> -			sync_service_build_handler (nodeid, msg);
> -			break;
> -		case MESSAGE_REQ_SYNC_MEMB_DETERMINE:
> -			sync_memb_determine (nodeid, msg);
> -			break;
> -	}
> -}
> -
> -static void memb_determine_message_transmit (void)
> -{
> -	struct iovec iovec;
> -	struct req_exec_memb_determine_message req_exec_memb_determine_message;
> -
> -	req_exec_memb_determine_message.header.size = sizeof (struct req_exec_memb_determine_message);
> -	req_exec_memb_determine_message.header.id = MESSAGE_REQ_SYNC_MEMB_DETERMINE;
> -
> -	memcpy (&req_exec_memb_determine_message.ring_id,
> -		&my_memb_determine_ring_id,
> -		sizeof (struct memb_ring_id));
> -
> -	iovec.iov_base = (char *)&req_exec_memb_determine_message;
> -	iovec.iov_len = sizeof (req_exec_memb_determine_message);
> -
> -	(void)totempg_groups_mcast_joined (sync_group_handle,
> -		&iovec, 1, TOTEMPG_AGREED);
> -}
> -
> -static void barrier_message_transmit (void)
> -{
> -	struct iovec iovec;
> -	struct req_exec_barrier_message req_exec_barrier_message;
> -
> -	req_exec_barrier_message.header.size = sizeof (struct req_exec_barrier_message);
> -	req_exec_barrier_message.header.id = MESSAGE_REQ_SYNC_BARRIER;
> -
> -	memcpy (&req_exec_barrier_message.ring_id, &my_ring_id,
> -		sizeof (struct memb_ring_id));
> -
> -	iovec.iov_base = (char *)&req_exec_barrier_message;
> -	iovec.iov_len = sizeof (req_exec_barrier_message);
> -
> -	(void)totempg_groups_mcast_joined (sync_group_handle,
> -		&iovec, 1, TOTEMPG_AGREED);
> -}
> -
> -static void service_build_message_transmit (struct req_exec_service_build_message *service_build_message)
> -{
> -	struct iovec iovec;
> -
> -	service_build_message->header.size = sizeof (struct req_exec_service_build_message);
> -	service_build_message->header.id = MESSAGE_REQ_SYNC_SERVICE_BUILD;
> -
> -	memcpy (&service_build_message->ring_id, &my_ring_id,
> -		sizeof (struct memb_ring_id));
> -
> -	iovec.iov_base = (void *)service_build_message;
> -	iovec.iov_len = sizeof (struct req_exec_service_build_message);
> -
> -	(void)totempg_groups_mcast_joined (sync_group_handle,
> -		&iovec, 1, TOTEMPG_AGREED);
> -}
> -
> -static void sync_barrier_enter (void)
> -{
> -	my_state = SYNC_BARRIER;
> -	barrier_message_transmit ();
> -}
> -
> -static void sync_process_enter (void)
> -{
> -	int i;
> -
> -	my_state = SYNC_PROCESS;
> -
> -	/*
> -	 * No syncv2 services
> -	 */
> -	if (my_service_list_entries == 0) {
> -		my_state = SYNC_SERVICELIST_BUILD;
> -		my_memb_determine_list_entries = 0;
> -		sync_synchronization_completed ();
> -		return;
> -	}
> -	for (i = 0; i < my_processor_list_entries; i++) {
> -		my_processor_list[i].received = 0;
> -	}
> -	schedwrk_create (&my_schedwrk_handle,
> -		schedwrk_processor,
> -		NULL);
> -}
> -
> -static void sync_servicelist_build_enter (
> -	const unsigned int *member_list,
> -	size_t member_list_entries,
> -	const struct memb_ring_id *ring_id)
> -{
> -	struct req_exec_service_build_message service_build;
> -	int i;
> -
> -	my_state = SYNC_SERVICELIST_BUILD;
> -	for (i = 0; i < member_list_entries; i++) {
> -		my_processor_list[i].nodeid = member_list[i];
> -		my_processor_list[i].received = 0;
> -	}
> -	my_processor_list_entries = member_list_entries;
> -
> -	memcpy (my_member_list, member_list,
> -		member_list_entries * sizeof (unsigned int));
> -	my_member_list_entries = member_list_entries;
> -
> -	my_processing_idx = 0;
> -
> -	memcpy (my_service_list, my_initial_service_list,
> -		sizeof (struct service_entry) *
> -			my_initial_service_list_entries);
> -	my_service_list_entries = my_initial_service_list_entries;
> -
> -	for (i = 0; i < my_initial_service_list[i].service_id; i++) {
> -		service_build.service_list[i] =
> -			my_initial_service_list[i].service_id;
> -	}
> -	service_build.service_list_entries = i;
> -
> -	service_build_message_transmit (&service_build);
> -}
> -
> -static int schedwrk_processor (const void *context)
> -{
> -	int res = 0;
> -
> -	if (my_service_list[my_processing_idx].state == INIT) {
> -		my_service_list[my_processing_idx].state = PROCESS;
> -		if (my_service_list[my_processing_idx].api_version == 1) {
> -			my_service_list[my_processing_idx].sync_init_api.sync_init_v1 (my_member_list,
> -				my_member_list_entries,
> -				&my_ring_id);
> -		} else {
> -			unsigned int old_trans_list[PROCESSOR_COUNT_MAX];
> -			size_t old_trans_list_entries = 0;
> -			int o, m;
> -
> -			memcpy (old_trans_list, my_trans_list, my_trans_list_entries *
> -				sizeof (unsigned int));
> -			old_trans_list_entries = my_trans_list_entries;
> -
> -			my_trans_list_entries = 0;
> -			for (o = 0; o < old_trans_list_entries; o++) {
> -				for (m = 0; m < my_member_list_entries; m++) {
> -					if (old_trans_list[o] == my_member_list[m]) {
> -						my_trans_list[my_trans_list_entries] = my_member_list[m];
> -						my_trans_list_entries++;
> -						break;
> -					}
> -				}
> -			}
> -
> -			my_service_list[my_processing_idx].sync_init_api.sync_init_v2 (my_trans_list,
> -				my_trans_list_entries, my_member_list,
> -				my_member_list_entries,
> -				&my_ring_id);
> -		}
> -	}
> -	if (my_service_list[my_processing_idx].state == PROCESS) {
> -		my_service_list[my_processing_idx].state = PROCESS;
> -		res = my_service_list[my_processing_idx].sync_process ();
> -		if (res == 0) {
> -			sync_barrier_enter();
> -		} else {
> -			return (-1);
> -		}
> -	}
> -	return (0);
> -}
> -
> -void sync_v2_start (
> -        const unsigned int *member_list,
> -        size_t member_list_entries,
> -        const struct memb_ring_id *ring_id)
> -{
> -	ENTER();
> -	memcpy (&my_ring_id, ring_id, sizeof (struct memb_ring_id));
> -
> -	if (my_memb_determine) {
> -		my_memb_determine = 0;
> -		sync_servicelist_build_enter (my_memb_determine_list,
> -			my_memb_determine_list_entries, ring_id);
> -	} else {
> -		sync_servicelist_build_enter (member_list, member_list_entries,
> -			ring_id);
> -	}
> -}
> -
> -void sync_v2_save_transitional (
> -        const unsigned int *member_list,
> -        size_t member_list_entries,
> -        const struct memb_ring_id *ring_id)
> -{
> -	ENTER();
> -	memcpy (my_trans_list, member_list, member_list_entries *
> -		sizeof (unsigned int));
> -	my_trans_list_entries = member_list_entries;
> -}
> -
> -void sync_v2_abort (void)
> -{
> -	ENTER();
> -	if (my_state == SYNC_PROCESS) {
> -		schedwrk_destroy (my_schedwrk_handle);
> -		my_service_list[my_processing_idx].sync_abort ();
> -	}
> -
> -	/* this will cause any "old" barrier messages from causing
> -	 * problems.
> -	 */
> -	memset (&my_ring_id, 0,	sizeof (struct memb_ring_id));
> -}
> -
> -void sync_v2_memb_list_determine (const struct memb_ring_id *ring_id)
> -{
> -	ENTER();
> -	memcpy (&my_memb_determine_ring_id, ring_id,
> -		sizeof (struct memb_ring_id));
> -
> -	memb_determine_message_transmit ();
> -}
> -
> -void sync_v2_memb_list_abort (void)
> -{
> -	ENTER();
> -	my_memb_determine_list_entries = 0;
> -	memset (&my_memb_determine_ring_id, 0, sizeof (struct memb_ring_id));
> -}
> diff --git a/exec/syncv2.h b/exec/syncv2.h
> deleted file mode 100644
> index 5cb318a..0000000
> --- a/exec/syncv2.h
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/*
> - * Copyright (c) 2009-2010 Red Hat, Inc.
> - *
> - * All rights reserved.
> - *
> - * Author: Steven Dake (sdake@xxxxxxxxxx)
> - *
> - * 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 SYNCV2_H_DEFINED
> -#define SYNCV2_H_DEFINED
> -
> -#include "sync.h"
> -
> -extern int sync_v2_init (
> -	int (*sync_callbacks_retrieve) (
> -		int service_id,
> -		struct sync_callbacks *callbacks),
> -	void (*synchronization_completed) (void));
> -
> -extern void sync_v2_start (
> -        const unsigned int *member_list,
> -        size_t member_list_entries,
> -        const struct memb_ring_id *ring_id);
> -
> -extern void sync_v2_save_transitional (
> -        const unsigned int *member_list,
> -        size_t member_list_entries,
> -        const struct memb_ring_id *ring_id);
> -
> -extern void sync_v2_abort (void);
> -
> -extern void sync_v2_memb_list_determine (const struct memb_ring_id *ring_id);
> -
> -extern void sync_v2_memb_list_abort (void);
> -
> -#endif /* SYNC_H_DEFINED */
> diff --git a/exec/util.c b/exec/util.c
> index 9a44275..c0d5c8b 100644
> --- a/exec/util.c
> +++ b/exec/util.c
> @@ -59,27 +59,14 @@ struct service_names {
>  static struct service_names servicenames[] =
>  {
>  	{ "EVS", EVS_SERVICE },
> -	{ "CLM", CLM_SERVICE },
> -	{ "AMF", AMF_SERVICE },
> -	{ "CKPT", CKPT_SERVICE },
> -	{ "EVT", EVT_SERVICE },
> -	{ "LCK", LCK_SERVICE },
> -	{ "MSG", MSG_SERVICE },
>  	{ "CFG", CFG_SERVICE },
>  	{ "CPG", CPG_SERVICE },
> -	{ "CMAN", CMAN_SERVICE },
> -	{ "PCMK", PCMK_SERVICE },
> -	{ "CONFDB", CONFDB_SERVICE },
>  	{ "QUORUM", QUORUM_SERVICE },
>  	{ "PLOAD", PLOAD_SERVICE },
> -	{ "TMR", TMR_SERVICE },
>  	{ "VOTEQUORUM", VOTEQUORUM_SERVICE },
> -	{ "NTF", NTF_SERVICE },
> -	{ "AMF", AMF_V2_SERVICE },
> -	{ "TST", TST_SV1_SERVICE },
> -	{ "TST", TST_SV2_SERVICE },
>  	{ "MON", MON_SERVICE },
>  	{ "WD", WD_SERVICE },
> +	{ "CMAP", CMAP_SERVICE },
>  	{ NULL, -1 }
>  };
>  
> diff --git a/exec/util.h b/exec/util.h
> index 36a1a8a..56a3d25 100644
> --- a/exec/util.h
> +++ b/exec/util.h
> @@ -46,26 +46,17 @@ extern cs_time_t clust_time_now(void);
>  
>  enum e_corosync_done {
>  	COROSYNC_DONE_EXIT = 0,
> -	COROSYNC_DONE_UID_DETERMINE = 1,
> -	COROSYNC_DONE_GID_DETERMINE = 2,
> -	COROSYNC_DONE_MEMPOOL_INIT = 3,
> -	COROSYNC_DONE_FORK = 4,
> -	COROSYNC_DONE_LIBCOROSYNC_SOCKET = 5,
> -	COROSYNC_DONE_LIBCOROSYNC_BIND = 6,
> -	COROSYNC_DONE_READKEY = 7,
> -	COROSYNC_DONE_MAINCONFIGREAD = 8,
> -	COROSYNC_DONE_LOGSETUP = 9,
> -	COROSYNC_DONE_AMFCONFIGREAD = 10,
> -	COROSYNC_DONE_DYNAMICLOAD = 11,
> -	COROSYNC_DONE_OBJDB = 12,
> -	COROSYNC_DONE_INIT_SERVICES = 13,
> -	COROSYNC_DONE_OUT_OF_MEMORY = 14,
> -	COROSYNC_DONE_FATAL_ERR = 15,
> -	COROSYNC_DONE_DIR_NOT_PRESENT = 16,
> -	COROSYNC_DONE_AQUIRE_LOCK = 17,
> -	COROSYNC_DONE_ALREADY_RUNNING = 18,
> -	COROSYNC_DONE_STD_TO_NULL_REDIR = 19,
> -	COROSYNC_DONE_SERVICE_ENGINE_INIT = 20
> +	COROSYNC_DONE_FORK = 1,
> +	COROSYNC_DONE_MAINCONFIGREAD = 2,
> +	COROSYNC_DONE_LOGSETUP = 3,
> +	COROSYNC_DONE_ICMAP = 4,
> +	COROSYNC_DONE_INIT_SERVICES = 5,
> +	COROSYNC_DONE_FATAL_ERR = 6,
> +	COROSYNC_DONE_DIR_NOT_PRESENT = 7,
> +	COROSYNC_DONE_AQUIRE_LOCK = 8,
> +	COROSYNC_DONE_ALREADY_RUNNING = 9,
> +	COROSYNC_DONE_STD_TO_NULL_REDIR = 10,
> +	COROSYNC_DONE_SERVICE_ENGINE_INIT = 11
>  };
>  
>  
> diff --git a/exec/votequorum.c b/exec/votequorum.c
> index 4d1fda8..3362c66 100644
> --- a/exec/votequorum.c
> +++ b/exec/votequorum.c
> @@ -380,8 +380,7 @@ static struct corosync_service_engine votequorum_service_engine = {
>  	.exec_exit_fn			= votequorum_exec_exit_fn,
>  	.exec_engine			= votequorum_exec_engine,
>  	.exec_engine_count		= sizeof (votequorum_exec_engine) / sizeof (struct corosync_exec_handler),
> -	.confchg_fn			= votequorum_confchg_fn,
> -	.sync_mode			= CS_SYNC_V1
> +	.confchg_fn			= votequorum_confchg_fn
>  };
>  
>  struct corosync_service_engine *votequorum_get_service_engine_ver0 (void)
> diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c
> index 54abd1e..9cab2d2 100644
> --- a/exec/vsf_quorum.c
> +++ b/exec/vsf_quorum.c
> @@ -194,8 +194,7 @@ static struct corosync_service_engine quorum_service_handler = {
>  	.lib_exit_fn				= quorum_lib_exit_fn,
>  	.lib_engine				= quorum_lib_service,
>  	.exec_init_fn				= quorum_exec_init_fn,
> -	.lib_engine_count			= sizeof (quorum_lib_service) / sizeof (struct corosync_lib_handler),
> -	.sync_mode				= CS_SYNC_V1
> +	.lib_engine_count			= sizeof (quorum_lib_service) / sizeof (struct corosync_lib_handler)
>  };
>  
>  struct corosync_service_engine *vsf_quorum_get_service_engine_ver0 (void)
> diff --git a/exec/wd.c b/exec/wd.c
> index 4066388..5194ea7 100644
> --- a/exec/wd.c
> +++ b/exec/wd.c
> @@ -105,8 +105,7 @@ struct corosync_service_engine wd_service_engine = {
>  	.confchg_fn		= NULL,
>  	.exec_init_fn		= wd_exec_init_fn,
>  	.exec_exit_fn		= wd_exec_exit_fn,
> -	.exec_dump_fn		= NULL,
> -	.sync_mode		= CS_SYNC_V2
> +	.exec_dump_fn		= NULL
>  };
>  
>  static DECLARE_LIST_INIT (confchg_notify);
> diff --git a/include/corosync/coroapi.h b/include/corosync/coroapi.h
> index d78f8aa..cbadeeb 100644
> --- a/include/corosync/coroapi.h
> +++ b/include/corosync/coroapi.h
> @@ -142,12 +142,6 @@ enum cs_flow_control_state {
>  
>  #endif /* COROSYNC_FLOW_CONTROL_STATE */
>  
> -enum cs_sync_mode {
> -	CS_SYNC_V1	 = 0,
> -	CS_SYNC_V2	 = 1,
> -	CS_SYNC_V1_APIV2 = 2
> -};
> -
>  typedef enum {
>  	COROSYNC_FATAL_ERROR_EXIT = -1,
>  	COROSYNC_LIBAIS_SOCKET = -6,
> @@ -429,11 +423,6 @@ struct corosync_service_engine_iface_ver0 {
>          struct corosync_service_engine *(*corosync_get_service_engine_ver0) (void);
>  };
>  
> -typedef void (*sync_init_v1_fn_t) (
> -		const unsigned int *member_list,
> -		size_t member_list_entries,
> -		const struct memb_ring_id *ring_id) ;
> -
>  struct corosync_service_engine {
>  	const char *name;
>  	unsigned short id;
> @@ -459,8 +448,12 @@ struct corosync_service_engine {
>  		const unsigned int *left_list, size_t left_list_entries,
>  		const unsigned int *joined_list, size_t joined_list_entries,
>  		const struct memb_ring_id *ring_id);
> -	enum cs_sync_mode sync_mode;
> -	sync_init_v1_fn_t sync_init;
> +	void (*sync_init) (
> +		const unsigned int *trans_list,
> +		size_t trans_list_entries,
> +		const unsigned int *member_list,
> +		size_t member_list_entries,
> +		const struct memb_ring_id *ring_id);
>  	int (*sync_process) (void);
>  	void (*sync_activate) (void);
>  	void (*sync_abort) (void);
> diff --git a/include/corosync/corodefs.h b/include/corosync/corodefs.h
> index 19d6a9c..c391c57 100644
> --- a/include/corosync/corodefs.h
> +++ b/include/corosync/corodefs.h
> @@ -39,28 +39,14 @@
>  
>  enum corosync_service_types {
>  	EVS_SERVICE = 0,
> -	CLM_SERVICE = 1,
> -	AMF_SERVICE = 2,
> -	CKPT_SERVICE = 3,
> -	EVT_SERVICE = 4,
> -	LCK_SERVICE = 5,
> -	MSG_SERVICE = 6,
> -	CFG_SERVICE = 7,
> -	CPG_SERVICE = 8,
> -	CMAN_SERVICE = 9,
> -	PCMK_SERVICE = 10,
> -	CONFDB_SERVICE = 11,
> -	QUORUM_SERVICE = 12,
> -	PLOAD_SERVICE = 13,
> -	TMR_SERVICE = 14,
> -	VOTEQUORUM_SERVICE = 15,
> -	NTF_SERVICE = 16,
> -	AMF_V2_SERVICE = 17,
> -	TST_SV1_SERVICE = 18,
> -	TST_SV2_SERVICE = 19,
> -	MON_SERVICE = 20,
> -	WD_SERVICE = 21,
> -	CMAP_SERVICE = 22,
> +	CFG_SERVICE = 1,
> +	CPG_SERVICE = 2,
> +	QUORUM_SERVICE = 3,
> +	PLOAD_SERVICE = 4,
> +	VOTEQUORUM_SERVICE = 5,
> +	MON_SERVICE = 6,
> +	WD_SERVICE = 7,
> +	CMAP_SERVICE = 8,
>  };
>  
>  #ifdef HAVE_SMALL_MEMORY_FOOTPRINT

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux