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

Initial removal of plugins

Quorum is broken in this patch.
service.h needs to be cleaned up significantly

Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Fabio Di Nitto <fdinitto@redhat.com>
Steven Dake 14 лет назад
Родитель
Сommit
f763d3ba4a
23 измененных файлов с 113 добавлено и 951 удалено
  1. 2 2
      Makefile.am
  2. 0 1
      configure.ac
  3. 6 23
      exec/Makefile.am
  4. 0 4
      exec/apidef.c
  5. 3 42
      exec/cfg.c
  6. 3 43
      exec/cmap.c
  7. 2 42
      exec/coroparse.c
  8. 3 43
      exec/cpg.c
  9. 3 43
      exec/evs.c
  10. 4 51
      exec/main.c
  11. 2 0
      exec/main.h
  12. 2 43
      exec/mon.c
  13. 3 43
      exec/pload.c
  14. 0 1
      exec/quorum.c
  15. 57 130
      exec/service.c
  16. 13 3
      exec/service.h
  17. 0 0
      exec/testquorum.c
  18. 5 56
      exec/votequorum.c
  19. 3 42
      exec/vsf_quorum.c
  20. 0 37
      exec/vsf_ykd.c
  21. 2 43
      exec/wd.c
  22. 0 103
      services/Makefile.am
  23. 0 156
      services/testquorum.c

+ 2 - 2
Makefile.am

@@ -71,7 +71,7 @@ corosysxmlxsltdir	= ${datadir}/corosync
 corosysxmlxslt_DATA	= conf/xml2conf.xsl
 endif
 
-SUBDIRS			= include lcr lib exec services tools test cts pkgconfig \
+SUBDIRS			= include lcr lib exec tools test cts pkgconfig \
 			  man init conf
 
 coverity:
@@ -104,7 +104,7 @@ test_lense.sh:
 endif
 
 lint:
-	for dir in lcr lib exec services tools test; do make -C $$dir lint; done
+	for dir in lcr lib exec tools test; do make -C $$dir lint; done
 
 .PHONY: doxygen
 doxygen:

+ 0 - 1
configure.ac

@@ -134,7 +134,6 @@ AC_CONFIG_FILES([Makefile
 		 lib/Makefile
 		 man/Makefile
 		 pkgconfig/Makefile
-		 services/Makefile
 		 test/Makefile
 		 cts/Makefile
 		 cts/agents/Makefile

+ 6 - 23
exec/Makefile.am

@@ -42,25 +42,22 @@ if BUILD_RDMA
 TOTEM_SRC		+= totemiba.c
 endif
 
-LCRSO_SRC		= vsf_ykd.c coroparse.c vsf_quorum.c
-LCRSO_OBJS		= $(LCRSO_SRC:%.c=%.o)
-LCRSO			= $(LCRSO_SRC:%.c=%.lcrso)
-
 lib_LIBRARIES		= libtotem_pg.a
 sbin_PROGRAMS		= corosync
 
 libtotem_pg_a_SOURCES	= $(TOTEM_SRC)
 
-corosync_SOURCES 	= main.c ipc_glue.c util.c sync.c apidef.c service.c \
-			  timer.c totemconfig.c mainconfig.c quorum.c schedwrk.c \
-			  ../lcr/lcr_ifact.c evil.c syncv2.c logsys.c icmap.c
+corosync_SOURCES	= evil.c vsf_ykd.c coroparse.c vsf_quorum.c syncv2.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 \
+			  ipc_glue.c service.c mainconfig.c totemconfig.c
 corosync_LDADD	  	= -ltotem_pg $(LIBQB_LIBS) $(statgrab_LIBS)
 corosync_DEPENDENCIES	= libtotem_pg.so.$(SONAME)
 corosync_LDFLAGS	= $(OS_DYFLAGS) -L./
 
 TOTEM_OBJS		= $(TOTEM_SRC:%.c=%.o)
 LOGSYS_OBJS		= $(LOGSYS_SRC:%.c=%.o)
-ICMAP_OBJS		= $(ICMAP_SRC:%.c=%.o)
 
 SHARED_LIBS		= $(lib_LIBRARIES:%.a=%.so.$(SONAME))
 SHARED_LIBS_SO		= $(SHARED_LIBS:%.so.$(SONAME)=%.so)
@@ -72,12 +69,7 @@ noinst_HEADERS		= apidef.h crypto.h mainconfig.h main.h \
 			  totemudpu.h totemsrp.h util.h vsf.h schedwrk.h \
 			  evil.h syncv2.h fsm.h
 
-EXTRA_DIST		= $(LCRSO_SRC)
-
 if BUILD_DARWIN
-%.lcrso: %.o
-	$(CC) $(LDFLAGS) $(CFLAGS) -L$(top_builddir)/exec -bundle -bind_at_load -bundle_loader ./corosync $^ -o $@
-
 libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
 	$(CC) $(LDFLAGS) $(DARWIN_OPTS) $(TOTEM_OBJS) -o $@ -lpthread
 	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
@@ -86,19 +78,12 @@ libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
 else
 
 if BUILD_SOLARIS
-%.lcrso: %.o
-	$(LD) $(LDFLAGS) -G $^ -o $@
-
 libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
 	$(LD) $(LDFLAGS) -G $(TOTEM_OBJS) -o $@ -lpthread
 	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
 	ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR)
 
 else
-
-%.lcrso: %.o
-	$(CC) $(LDFLAGS) $(CFLAGS) $(COVERAGE_LCRSO_EXTRA_LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@
-
 libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
 	$(CC) -shared -o $@ \
 		-Wl,-soname=libtotem_pg.so.$(SOMAJOR) \
@@ -120,8 +105,6 @@ install-exec-local:
 	$(INSTALL) -d $(DESTDIR)/$(libdir)
 	$(INSTALL) -m 755 $(SHARED_LIBS) $(DESTDIR)/$(libdir)
 	$(CP) -a $(SHARED_LIBS_SO) $(SHARED_LIBS_SO_TWO) $(DESTDIR)/$(libdir)
-	$(INSTALL) -d $(DESTDIR)/$(LCRSODIR)
-	$(INSTALL) -m 755 $(LCRSO) $(DESTDIR)/$(LCRSODIR)
 
 uninstall-local:
 	cd $(DESTDIR)/$(libdir) && \
@@ -130,4 +113,4 @@ uninstall-local:
 		rm -f $(LCRSO)
 
 clean-local:
-	rm -f corosync *.o *.lcrso gmon.out *.da *.bb *.bbg *.so*
+	rm -f corosync *.o gmon.out *.da *.bb *.bbg *.so*

+ 0 - 4
exec/apidef.c

@@ -137,10 +137,6 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = {
 	.quorum_register_callback = corosync_quorum_register_callback,
 	.quorum_unregister_callback = corosync_quorum_unregister_callback,
 	.quorum_initialize = corosync_quorum_initialize,
-	.service_link_and_init = corosync_service_link_and_init,
-	.service_unlink_and_exit = corosync_service_unlink_and_exit,
-	.plugin_interface_reference = lcr_ifact_reference,
-	.plugin_interface_release = lcr_ifact_release,
 	.error_memory_failure = _corosync_out_of_memory_error,
 	.fatal_error = _corosync_public_exit_error,
 	.shutdown_request = corosync_shutdown_request,

+ 3 - 42
services/cfg.c → exec/cfg.c

@@ -58,12 +58,13 @@
 #include <corosync/totem/totemip.h>
 #include <corosync/totem/totem.h>
 #include <corosync/ipc_cfg.h>
-#include <corosync/lcr/lcr_comp.h>
 #include <corosync/logsys.h>
 #include <corosync/coroapi.h>
 #include <corosync/icmap.h>
 #include <corosync/corodefs.h>
 
+#include "service.h"
+
 LOGSYS_DECLARE_SUBSYS ("CFG");
 
 enum cfg_message_req_types {
@@ -285,51 +286,11 @@ struct corosync_service_engine cfg_service_engine = {
 	.sync_mode				= CS_SYNC_V1
 };
 
-/*
- * Dynamic Loader definition
- */
-static struct corosync_service_engine *cfg_get_service_engine_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 cfg_service_engine_iface = {
-	.corosync_get_service_engine_ver0	= cfg_get_service_engine_ver0
-};
-
-static struct lcr_iface corosync_cfg_ver0[1] = {
-	{
-		.name				= "corosync_cfg",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count		= 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= NULL
-	}
-};
-
-static struct lcr_comp cfg_comp_ver0 = {
-	.iface_count				= 1,
-	.ifaces					= corosync_cfg_ver0
-};
-
-static struct corosync_service_engine *cfg_get_service_engine_ver0 (void)
+struct corosync_service_engine *cfg_get_service_engine_ver0 (void)
 {
 	return (&cfg_service_engine);
 }
 
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_interfaces_set (&corosync_cfg_ver0[0], &cfg_service_engine_iface);
-
-	lcr_component_register (&cfg_comp_ver0);
-}
-
 struct req_exec_cfg_ringreenable {
 	struct qb_ipc_request_header header __attribute__((aligned(8)));
         mar_message_source_t source __attribute__((aligned(8)));

+ 3 - 43
services/cmap.c → exec/cmap.c

@@ -51,11 +51,12 @@
 #include <corosync/list.h>
 #include <corosync/mar_gen.h>
 #include <corosync/ipc_cmap.h>
-#include <corosync/lcr/lcr_comp.h>
 #include <corosync/logsys.h>
 #include <corosync/coroapi.h>
 #include <corosync/icmap.h>
 
+#include "service.h"
+
 #define hdb_error_to_cs(_result_) qb_to_cs_error(_result_)
 
 LOGSYS_DECLARE_SUBSYS ("CMAP");
@@ -157,52 +158,11 @@ struct corosync_service_engine cmap_service_engine = {
 	.exec_exit_fn				= cmap_exec_exit_fn,
 };
 
-/*
- * Dynamic loader definition
- */
-static struct corosync_service_engine *cmap_get_service_engine_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 cmap_service_engine_iface = {
-	.corosync_get_service_engine_ver0		= cmap_get_service_engine_ver0
-};
-
-static struct lcr_iface corosync_cmap_ver0[1] = {
-	{
-		.name				= "corosync_cmap",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count         = 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= NULL
-	}
-};
-
-static struct lcr_comp cmap_comp_ver0 = {
-	.iface_count			= 1,
-	.ifaces			        = corosync_cmap_ver0
-};
-
-
-static struct corosync_service_engine *cmap_get_service_engine_ver0 (void)
+struct corosync_service_engine *cmap_get_service_engine_ver0 (void)
 {
 	return (&cmap_service_engine);
 }
 
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-        lcr_interfaces_set (&corosync_cmap_ver0[0], &cmap_service_engine_iface);
-
-	lcr_component_register (&cmap_comp_ver0);
-}
-
 static int cmap_exec_exit_fn(void)
 {
 	return 0;

+ 2 - 42
exec/coroparse.c

@@ -62,6 +62,7 @@
 #include <corosync/icmap.h>
 #include <corosync/engine/config.h>
 
+#include "main.h"
 #include "util.h"
 
 enum parser_cb_type {
@@ -186,7 +187,7 @@ static char *strchr_rs (const char *haystack, int byte)
 	return ((char *) end_address);
 }
 
-static int aisparser_readconfig (const char **error_string)
+int coroparse_configparse (const char **error_string)
 {
 	if (read_config_file_into_icmap(error_string)) {
 		return -1;
@@ -195,7 +196,6 @@ static int aisparser_readconfig (const char **error_string)
 	return 0;
 }
 
-
 static char *remove_whitespace(char *string)
 {
 	char *start;
@@ -1010,43 +1010,3 @@ static int read_config_file_into_icmap(
 
 	return res;
 }
-
-/*
- * Dynamic Loader definition
- */
-
-struct config_iface_ver0 aisparser_iface_ver0 = {
-	.config_readconfig        = aisparser_readconfig
-};
-
-struct lcr_iface corosync_aisparser_ver0[1] = {
-	{
-		.name				= "corosync_parser",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count		= 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= NULL,
-	}
-};
-
-struct corosync_service_handler *aisparser_get_handler_ver0 (void);
-
-struct lcr_comp aisparser_comp_ver0 = {
-	.iface_count				= 1,
-	.ifaces					= corosync_aisparser_ver0
-};
-
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-        lcr_interfaces_set (&corosync_aisparser_ver0[0], &aisparser_iface_ver0);
-	lcr_component_register (&aisparser_comp_ver0);
-}

+ 3 - 43
services/cpg.c → exec/cpg.c

@@ -62,13 +62,14 @@
 #include <corosync/corodefs.h>
 #include <corosync/list.h>
 #include <corosync/jhash.h>
-#include <corosync/lcr/lcr_comp.h>
 #include <corosync/logsys.h>
 #include <corosync/coroapi.h>
 
 #include <corosync/cpg.h>
 #include <corosync/ipc_cpg.h>
 
+#include "service.h"
+
 LOGSYS_DECLARE_SUBSYS ("CPG");
 
 #define GROUP_HASH_SIZE 32
@@ -413,52 +414,11 @@ struct corosync_service_engine cpg_service_engine = {
 	.sync_abort                             = cpg_sync_abort
 };
 
-/*
- * Dynamic loader definition
- */
-static struct corosync_service_engine *cpg_get_service_engine_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 cpg_service_engine_iface = {
-	.corosync_get_service_engine_ver0		= cpg_get_service_engine_ver0
-};
-
-static struct lcr_iface corosync_cpg_ver0[1] = {
-	{
-		.name				= "corosync_cpg",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count         = 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= NULL
-	}
-};
-
-static struct lcr_comp cpg_comp_ver0 = {
-	.iface_count			= 1,
-	.ifaces			        = corosync_cpg_ver0
-};
-
-
-static struct corosync_service_engine *cpg_get_service_engine_ver0 (void)
+struct corosync_service_engine *cpg_get_service_engine_ver0 (void)
 {
 	return (&cpg_service_engine);
 }
 
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-        lcr_interfaces_set (&corosync_cpg_ver0[0], &cpg_service_engine_iface);
-
-	lcr_component_register (&cpg_comp_ver0);
-}
-
 struct req_exec_cpg_procjoin {
 	struct qb_ipc_request_header header __attribute__((aligned(8)));
 	mar_cpg_name_t group_name __attribute__((aligned(8)));

+ 3 - 43
services/evs.c → exec/evs.c

@@ -56,7 +56,6 @@
 #include <qb/qbipc_common.h>
 #include <corosync/corodefs.h>
 #include <corosync/mar_gen.h>
-#include <corosync/lcr/lcr_comp.h>
 #include <corosync/coroapi.h>
 #include <corosync/logsys.h>
 #include <corosync/list.h>
@@ -64,6 +63,8 @@
 #include <corosync/evs.h>
 #include <corosync/ipc_evs.h>
 
+#include "service.h"
+
 LOGSYS_DECLARE_SUBSYS ("EVS");
 
 enum evs_exec_message_req_types {
@@ -157,52 +158,11 @@ struct corosync_service_engine evs_service_engine = {
 
 static DECLARE_LIST_INIT (confchg_notify);
 
-/*
- * Dynamic loading descriptor
- */
-
-static struct corosync_service_engine *evs_get_service_engine_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 evs_service_engine_iface = {
-	.corosync_get_service_engine_ver0	= evs_get_service_engine_ver0
-};
-
-static struct lcr_iface corosync_evs_ver0[1] = {
-	{
-		.name			= "corosync_evs",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count = 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= NULL,
-	}
-};
-
-static struct lcr_comp evs_comp_ver0 = {
-	.iface_count	= 1,
-	.ifaces		= corosync_evs_ver0
-};
-
-static struct corosync_service_engine *evs_get_service_engine_ver0 (void)
+struct corosync_service_engine *evs_get_service_engine_ver0 (void)
 {
 	return (&evs_service_engine);
 }
 
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_interfaces_set (&corosync_evs_ver0[0], &evs_service_engine_iface);
-
-	lcr_component_register (&evs_comp_ver0);
-}
-
 static int evs_exec_init_fn (
 	struct corosync_api_v1 *corosync_api)
 {

+ 4 - 51
exec/main.c

@@ -105,7 +105,6 @@
 #include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
 #include <corosync/list.h>
-#include <corosync/lcr/lcr_ifact.h>
 #include <corosync/totem/totempg.h>
 #include <corosync/engine/config.h>
 #include <corosync/logsys.h>
@@ -1043,14 +1042,6 @@ int main (int argc, char **argv, char **envp)
 {
 	const char *error_string;
 	struct totem_config totem_config;
-	hdb_handle_t config_handle;
-	unsigned int config_version = 0;
-	struct config_iface_ver0 *config;
-	void *config_p;
-	const char *config_iface_init;
-	char *config_iface;
-	char *iface;
-	char *strtok_save_pt;
 	int res, ch;
 	int background, setprio;
 	struct stat stat_out;
@@ -1133,49 +1124,11 @@ int main (int argc, char **argv, char **envp)
 
 	num_config_modules = 0;
 
-	/*
-	 * Bootstrap in the default configuration parser or use
-	 * the corosync default built in parser if the configuration parser
-	 * isn't overridden
-	 */
-	config_iface_init = getenv("COROSYNC_DEFAULT_CONFIG_IFACE");
-	if (!config_iface_init) {
-		config_iface_init = "corosync_parser";
-	}
-
-	/* Make a copy so we can deface it with strtok */
-	if ((config_iface = strdup(config_iface_init)) == NULL) {
-		log_printf (LOGSYS_LEVEL_ERROR, "exhausted virtual memory");
-		corosync_exit_error (COROSYNC_DONE_OBJDB);
-	}
-
-	iface = strtok_r(config_iface, ":", &strtok_save_pt);
-	while (iface)
-	{
-		res = lcr_ifact_reference (
-			&config_handle,
-			iface,
-			config_version,
-			&config_p,
-			0);
-
-		config = (struct config_iface_ver0 *)config_p;
-		if (res == -1) {
-			log_printf (LOGSYS_LEVEL_ERROR, "Corosync Executive couldn't open configuration component '%s'\n", iface);
-			corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
-		}
-
-		res = config->config_readconfig(&error_string);
-		if (res == -1) {
-			log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
-			corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
-		}
-		log_printf (LOGSYS_LEVEL_NOTICE, "%s", error_string);
-		config_modules[num_config_modules++] = config;
-
-		iface = strtok_r(NULL, ":", &strtok_save_pt);
+	res = coroparse_configparse(&error_string);
+	if (res == -1) {
+		log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
+		corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
 	}
-	free(config_iface);
 
 	res = corosync_main_config_read (&error_string);
 	if (res == -1) {

+ 2 - 0
exec/main.h

@@ -122,4 +122,6 @@ extern void cs_ipc_refcnt_inc(void *conn);
 
 extern void cs_ipc_refcnt_dec(void *conn);
 
+int coroparse_configparse (const char **error_string);
+
 #endif /* MAIN_H_DEFINED */

+ 2 - 43
services/mon.c → exec/mon.c

@@ -41,13 +41,13 @@
 
 #include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
-#include <corosync/lcr/lcr_comp.h>
 #include <corosync/coroapi.h>
 #include <corosync/list.h>
 #include <corosync/logsys.h>
 #include <corosync/icmap.h>
 #include "../exec/fsm.h"
 
+#include "service.h"
 
 LOGSYS_DECLARE_SUBSYS ("MON");
 
@@ -150,52 +150,11 @@ struct cs_fsm_entry mon_fsm_table[] = {
 	{ MON_S_FAILED,  MON_E_FAILURE,		NULL,			{-1} },
 };
 
-/*
- * Dynamic loading descriptor
- */
-
-static struct corosync_service_engine *mon_get_service_engine_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 mon_service_engine_iface = {
-	.corosync_get_service_engine_ver0	= mon_get_service_engine_ver0
-};
-
-static struct lcr_iface corosync_mon_ver0[1] = {
-	{
-		.name			= "corosync_mon",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count = 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= NULL,
-	}
-};
-
-static struct lcr_comp mon_comp_ver0 = {
-	.iface_count	= 1,
-	.ifaces		= corosync_mon_ver0
-};
-
-static struct corosync_service_engine *mon_get_service_engine_ver0 (void)
+struct corosync_service_engine *mon_get_service_engine_ver0 (void)
 {
 	return (&mon_service_engine);
 }
 
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_interfaces_set (&corosync_mon_ver0[0], &mon_service_engine_iface);
-
-	lcr_component_register (&mon_comp_ver0);
-}
-
 static const char * mon_res_state_to_str(struct cs_fsm* fsm,
 	int32_t state)
 {

+ 3 - 43
services/pload.c → exec/pload.c

@@ -59,13 +59,14 @@
 #include <corosync/swab.h>
 #include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
-#include <corosync/lcr/lcr_comp.h>
 #include <corosync/mar_gen.h>
 #include <corosync/coroapi.h>
 #include <corosync/ipc_pload.h>
 #include <corosync/list.h>
 #include <corosync/logsys.h>
 
+#include "service.h"
+
 LOGSYS_DECLARE_SUBSYS ("PLOAD");
 
 enum pload_exec_message_req_types {
@@ -170,52 +171,11 @@ struct corosync_service_engine pload_service_engine = {
 
 static DECLARE_LIST_INIT (confchg_notify);
 
-/*
- * Dynamic loading descriptor
- */
-
-static struct corosync_service_engine *pload_get_service_engine_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 pload_service_engine_iface = {
-	.corosync_get_service_engine_ver0	= pload_get_service_engine_ver0
-};
-
-static struct lcr_iface corosync_pload_ver0[1] = {
-	{
-		.name			= "corosync_pload",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count = 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= NULL,
-	}
-};
-
-static struct lcr_comp pload_comp_ver0 = {
-	.iface_count	= 1,
-	.ifaces		= corosync_pload_ver0
-};
-
-static struct corosync_service_engine *pload_get_service_engine_ver0 (void)
+struct corosync_service_engine *pload_get_service_engine_ver0 (void)
 {
 	return (&pload_service_engine);
 }
 
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_interfaces_set (&corosync_pload_ver0[0], &pload_service_engine_iface);
-
-	lcr_component_register (&pload_comp_ver0);
-}
-
 static int pload_exec_init_fn (
 	struct corosync_api_v1 *corosync_api)
 {

+ 0 - 1
exec/quorum.c

@@ -54,7 +54,6 @@
 #include <corosync/swab.h>
 #include <corosync/totem/totempg.h>
 #include <corosync/totem/totem.h>
-#include <corosync/lcr/lcr_ifact.h>
 #include <corosync/logsys.h>
 
 #include "quorum.h"

+ 57 - 130
exec/service.c

@@ -62,44 +62,55 @@ LOGSYS_DECLARE_SUBSYS ("SERV");
 struct default_service {
 	const char *name;
 	int ver;
+	struct corosync_service_engine *(*loader)(void);
 };
 
 static struct default_service default_services[] = {
 	{
-		.name			 = "corosync_evs",
-		.ver			 = 0,
+		.name		= "corosync_evs",
+		.ver		= 0,
+		.loader		= evs_get_service_engine_ver0
 	},
 	{
-		.name			 = "corosync_cfg",
-		.ver			 = 0,
+		.name		= "corosync_cfg",
+		.ver		= 0,
+		.loader		= cfg_get_service_engine_ver0
 	},
 	{
-		.name			 = "corosync_cpg",
-		.ver			 = 0,
+		.name		= "corosync_cpg",
+		.ver		= 0,
+		.loader		= cpg_get_service_engine_ver0
 	},
 	{
-		.name			 = "corosync_pload",
-		.ver			 = 0,
+		.name		= "corosync_pload",
+		.ver		= 0,
+		.loader		= pload_get_service_engine_ver0
 	},
 #ifdef HAVE_MONITORING
 	{
-		.name			 = "corosync_mon",
-		.ver			 = 0,
+		.name		= "corosync_mon",
+		.ver		= 0,
+		.loader		= mon_get_service_engine_ver0
 	},
 #endif
 #ifdef HAVE_WATCHDOG
 	{
-		.name			 = "corosync_wd",
-		.ver			 = 0,
+		.name		= "corosync_wd",
+		.ver		= 0,
+		.loader		= wd_get_service_engine_ver0
 	},
 #endif
+#ifdef HAVE_VOTEQUORUM
 	{
-		.name			 = "corosync_quorum",
-		.ver			 = 0,
+		.name		= "corosync_quorum",
+		.ver		= 0,
+		.loader		= votequorum_get_service_engine_ver0
 	},
+#endif
 	{
-		.name			 = "corosync_cmap",
-		.ver			 = 0,
+		.name		= "corosync_cmap",
+		.ver		= 0,
+		.loader		= cmap_get_service_engine_ver0
 	},
 };
 
@@ -121,116 +132,73 @@ int corosync_service_exiting[SERVICE_HANDLER_MAXIMUM_COUNT];
 
 static void (*service_unlink_all_complete) (void) = NULL;
 
-static unsigned int default_services_requested (struct corosync_api_v1 *corosync_api)
-{
-	char *value = NULL;
-	int res;
-
-	/*
-	 * Don't link default services if they have been disabled
-	 */
-	if (icmap_get_string("aisexec.defaultservices", &value) == CS_OK &&
-			value != NULL && strcmp(value, "no") == 0) {
-		res = 0;
-	} else {
-		res = -1;
-	}
-
-	free(value);
-	return (res);
-}
-
 unsigned int corosync_service_link_and_init (
 	struct corosync_api_v1 *corosync_api,
-	const char *service_name,
-	unsigned int service_ver)
+	struct default_service *service)
 {
-	struct corosync_service_engine_iface_ver0 *iface_ver0;
-	void *iface_ver0_p;
-	hdb_handle_t handle;
-	struct corosync_service_engine *service;
-	int res;
+	struct corosync_service_engine *service_engine;
+	int res = 0;
 	int fn;
 	char *name_sufix;
-	void* _start;
-	void* _stop;
 	char key_name[ICMAP_KEYNAME_MAXLEN];
 
-	/*
-	 * reference the service interface
-	 */
-	iface_ver0_p = NULL;
-	res = lcr_ifact_reference (
-		&handle,
-		service_name,
-		service_ver,
-		&iface_ver0_p,
-		(void *)0);
-
-	iface_ver0 = (struct corosync_service_engine_iface_ver0 *)iface_ver0_p;
-
-	if (res == -1 || iface_ver0 == 0) {
-		log_printf(LOGSYS_LEVEL_ERROR, "Service failed to load '%s'.\n", service_name);
-		return (-1);
-	}
-
-
 	/*
 	 * Initialize service
 	 */
-	service = iface_ver0->corosync_get_service_engine_ver0();
+	service_engine = service->loader();
 
-	corosync_service[service->id] = service;
+	corosync_service[service_engine->id] = service_engine;
 
 	/*
 	 * Register the log sites with libqb
 	 */
+/* SDAKE
 	_start = lcr_ifact_addr_get(handle, "__start___verbose");
 	_stop = lcr_ifact_addr_get(handle, "__stop___verbose");
 	qb_log_callsites_register(_start, _stop);
+*/
 
-	if (service->config_init_fn) {
-		res = service->config_init_fn (corosync_api);
+	if (service_engine->config_init_fn) {
+		res = service_engine->config_init_fn (corosync_api);
 	}
 
-	if (service->exec_init_fn) {
-		res = service->exec_init_fn (corosync_api);
+	if (service_engine->exec_init_fn) {
+		res = service_engine->exec_init_fn (corosync_api);
 	}
 
 	/*
 	 * Store service in cmap db
 	 */
-	snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.name", service->id);
-	icmap_set_string(key_name, service_name);
+	snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.name", service_engine->id);
+	icmap_set_string(key_name, service->name);
 
-	snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.ver", service->id);
-	icmap_set_uint32(key_name, service_ver);
+	snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.ver", service_engine->id);
+	icmap_set_uint32(key_name, service->ver);
 
-	snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.handle", service->id);
-	icmap_set_uint64(key_name, handle);
+	snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.handle", service_engine->id);
 
-	name_sufix = strrchr (service_name, '_');
+	name_sufix = strrchr (service->name, '_');
 	if (name_sufix)
 		name_sufix++;
 	else
-		name_sufix = (char*)service_name;
+		name_sufix = (char*)service->name;
 
 	snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "runtime.services.%s.service_id", name_sufix);
-	icmap_set_uint16(key_name, service->id);
+	icmap_set_uint16(key_name, service_engine->id);
 
-	for (fn = 0; fn < service->exec_engine_count; fn++) {
+	for (fn = 0; fn < service_engine->exec_engine_count; fn++) {
 		snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "runtime.services.%s.%d.tx", name_sufix, fn);
 		icmap_set_uint64(key_name, 0);
-		service_stats_tx[service->id][fn] = strdup(key_name);
+		service_stats_tx[service_engine->id][fn] = strdup(key_name);
 
 		snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "runtime.services.%s.%d.rx", name_sufix, fn);
 		icmap_set_uint64(key_name, 0);
-		service_stats_rx[service->id][fn] = strdup(key_name);
+		service_stats_rx[service_engine->id][fn] = strdup(key_name);
 	}
 
 	log_printf (LOGSYS_LEVEL_NOTICE,
-		"Service engine loaded: %s [%d]\n", service->name, service->id);
-	cs_ipcs_service_init(service);
+		"Service engine loaded: %s [%d]\n", service_engine->name, service_engine->id);
+	cs_ipcs_service_init(service_engine);
 	return (res);
 }
 
@@ -313,7 +281,6 @@ static unsigned int service_unlink_and_exit (
 	unsigned int service_ver)
 {
 	unsigned short service_id;
-	hdb_handle_t found_service_handle;
 	char *name_sufix;
 	int res;
 	const char *iter_key_name;
@@ -376,10 +343,12 @@ static unsigned int service_unlink_and_exit (
 
 		cs_ipcs_service_destroy (service_id);
 
+#ifdef SDAKE
 		snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.handle", service_id);
 		if (icmap_get_uint64(key_name, &found_service_handle) == CS_OK) {
 			lcr_ifact_release (found_service_handle);
 		}
+#endif
 
 		snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "internal_configuration.service.%u.handle", service_id);
 		icmap_delete(key_name);
@@ -399,57 +368,13 @@ unsigned int corosync_service_defaults_link_and_init (struct corosync_api_v1 *co
 {
 	unsigned int i;
 
-	icmap_iter_t iter;
-	char *found_service_name;
-	int res;
-	unsigned int found_service_ver;
-	const char *iter_key_name;
-	unsigned int service_pos;
-	char key_name[ICMAP_KEYNAME_MAXLEN];
-
-	icmap_set_ro_access("internal_configuration.", 1, 1);
-	icmap_set_ro_access("runtime.services.", 1, 1);
-
-	found_service_name = NULL;
-	iter = icmap_iter_init("service.");
-	while ((iter_key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) {
-		res = sscanf(iter_key_name, "service.%u.%s", &service_pos, key_name);
-		if (res != 2) {
-			continue;
-		}
-		if (strcmp(key_name, "name") != 0) {
-			continue;
-		}
-
-		snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "service.%u.name", service_pos);
-		free(found_service_name);
-		if (icmap_get_string(key_name, &found_service_name) != CS_OK) {
-			continue;
-		}
-
-		snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "service.%u.ver", service_pos);
-		if (icmap_get_uint32(key_name, &found_service_ver) != CS_OK) {
-			continue;
-		}
-
-		corosync_service_link_and_init (
-			corosync_api,
-			found_service_name,
-			found_service_ver);
-	}
-	icmap_iter_finalize(iter);
-
- 	if (default_services_requested (corosync_api) == 0) {
- 		return (0);
- 	}
-
 	for (i = 0;
 		i < sizeof (default_services) / sizeof (struct default_service); i++) {
 
+		default_services[i].loader();
 		corosync_service_link_and_init (
 			corosync_api,
-			default_services[i].name,
-			default_services[i].ver);
+			&default_services[i]);
 	}
 
 	return (0);
@@ -477,7 +402,9 @@ static void service_unlink_schedwrk_handler (void *data) {
 
 	corosync_service[cb_data->service_engine] = NULL;
 
+#ifdef SDAKE
 	lcr_ifact_release (cb_data->service_handle);
+#endif
 
 	qb_loop_job_add(cs_poll_handle_get(),
 		QB_LOOP_HIGH,

+ 13 - 3
exec/service.h

@@ -39,13 +39,14 @@
 
 struct corosync_api_v1;
 
+struct default_service;
+
 /**
  * Link and initialize a service
  */
-extern unsigned int corosync_service_link_and_init (
+unsigned int corosync_service_link_and_init (
 	struct corosync_api_v1 *objdb,
-	const char *service_name,
-	unsigned int service_ver);
+	struct default_service *service_engine);
 
 /**
  * Unlink and exit a service
@@ -75,4 +76,13 @@ extern int corosync_service_exiting[];
 extern const char *service_stats_rx[SERVICE_HANDLER_MAXIMUM_COUNT][64];
 extern const char *service_stats_tx[SERVICE_HANDLER_MAXIMUM_COUNT][64];
 
+struct corosync_service_engine *votequorum_get_service_engine_ver0 (void);
+struct corosync_service_engine *pload_get_service_engine_ver0 (void);
+struct corosync_service_engine *cfg_get_service_engine_ver0 (void);
+struct corosync_service_engine *evs_get_service_engine_ver0 (void);
+struct corosync_service_engine *cpg_get_service_engine_ver0 (void);
+struct corosync_service_engine *mon_get_service_engine_ver0 (void);
+struct corosync_service_engine *wd_get_service_engine_ver0 (void);
+struct corosync_service_engine *cmap_get_service_engine_ver0 (void);
+
 #endif /* SERVICE_H_DEFINED */

+ 0 - 0
exec/testquorum.c


+ 5 - 56
services/votequorum.c → exec/votequorum.c

@@ -50,6 +50,8 @@
 #include <corosync/icmap.h>
 #include <corosync/ipc_votequorum.h>
 
+#include "service.h"
+
 LOGSYS_DECLARE_SUBSYS ("VOTEQ");
 
 /*
@@ -319,15 +321,7 @@ static struct corosync_lib_handler quorum_lib_service[] =
 	}
 };
 
-/*
- * Dynamic loader/lcrso object definition
- */
-
-static struct quorum_services_api_ver1 votequorum_iface_ver0 = {
-	.init				= votequorum_init
-};
-
-static struct corosync_service_engine quorum_service_handler = {
+static struct corosync_service_engine votequorum_service_engine = {
 	.name				= "corosync vote quorum service v1.0",
 	.id				= VOTEQUORUM_SERVICE,
 	.private_data_size		= sizeof (struct quorum_pd),
@@ -344,54 +338,9 @@ static struct corosync_service_engine quorum_service_handler = {
 	.sync_mode			= CS_SYNC_V1
 };
 
-static struct corosync_service_engine *quorum_get_service_handler_ver0 (void)
+struct corosync_service_engine *votequorum_get_service_engine_ver0 (void)
 {
-	return (&quorum_service_handler);
-}
-
-static struct corosync_service_engine_iface_ver0 quorum_service_handler_iface = {
-	.corosync_get_service_engine_ver0 = quorum_get_service_handler_ver0
-};
-
-static struct lcr_iface corosync_quorum_ver0[2] = {
-	{
-		.name				= "corosync_votequorum",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count		= 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= (void **)(void *)&votequorum_iface_ver0
-	},
-	{
-		.name				= "corosync_votequorum_iface",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count		= 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= NULL
-	}
-};
-
-static struct lcr_comp quorum_comp_ver0 = {
-	.iface_count			= 2,
-	.ifaces				= corosync_quorum_ver0
-};
-
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_interfaces_set (&corosync_quorum_ver0[0], &votequorum_iface_ver0);
-	lcr_interfaces_set (&corosync_quorum_ver0[1], &quorum_service_handler_iface);
-	lcr_component_register (&quorum_comp_ver0);
+	return (&votequorum_service_engine);
 }
 
 /*

+ 3 - 42
exec/vsf_quorum.c

@@ -195,45 +195,11 @@ static struct corosync_service_engine quorum_service_handler = {
 	.sync_mode				= CS_SYNC_V1
 };
 
-static struct lcr_iface corosync_quorum_ver0[1] = {
-	{
-		.name			= "corosync_quorum",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count	= 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= NULL,
-	},
-};
-
-static struct corosync_service_engine *quorum_get_service_handler_ver0 (void)
+static struct corosync_service_engine *quorum_get_service_engine_ver0 (void)
 {
 	return (&quorum_service_handler);
 }
 
-static struct lcr_comp quorum_comp_ver0 = {
-	.iface_count			= 1,
-	.ifaces				= corosync_quorum_ver0
-};
-
-static struct corosync_service_engine_iface_ver0 quorum_service_handler_iface = {
-	.corosync_get_service_engine_ver0 = quorum_get_service_handler_ver0
-};
-
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_component_register (&quorum_comp_ver0);
-	lcr_interfaces_set (&corosync_quorum_ver0[0], &quorum_service_handler_iface);
-}
-
 /* -------------------------------------------------- */
 
 
@@ -286,16 +252,10 @@ static struct quorum_callin_functions callins = {
 
 static int quorum_exec_init_fn (struct corosync_api_v1 *api)
 {
-	hdb_handle_t q_handle;
-	char *quorum_module;
-	int res;
-	void *quorum_iface_p;
-	void* _start;
-	void* _stop;
-
 #ifdef COROSYNC_SOLARIS
 	logsys_subsys_init();
 #endif
+#ifdef SDAKE
 	corosync_api = api;
 	list_init (&lib_trackers_list);
 	list_init (&internal_trackers_list);
@@ -347,6 +307,7 @@ static int quorum_exec_init_fn (struct corosync_api_v1 *api)
 		quorum_type = 0;
 	}
 
+#endif
 	return (0);
 }
 

+ 0 - 37
exec/vsf_ykd.c

@@ -63,7 +63,6 @@
 #include <corosync/coroapi.h>
 #include <corosync/engine/quorum.h>
 #include <corosync/swab.h>
-#include <corosync/lcr/lcr_comp.h>
 
 LOGSYS_DECLARE_SUBSYS ("YKD");
 
@@ -526,39 +525,3 @@ static void ykd_init (
 
 	ykd_state_init ();
 }
-
-/*
- * lcrso object definition
- */
-static struct quorum_services_api_ver1 vsf_ykd_iface_ver0 = {
-	.init				= ykd_init,
-};
-
-static struct lcr_iface corosync_vsf_ykd_ver0[1] = {
-	{
-		.name			= "corosync_quorum_ykd",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count	= 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= (void **)(void *)&vsf_ykd_iface_ver0,
-	}
-};
-
-static struct lcr_comp vsf_ykd_comp_ver0 = {
-	.iface_count			= 1,
-	.ifaces				= corosync_vsf_ykd_ver0
-};
-
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_component_register (&vsf_ykd_comp_ver0);
-}

+ 2 - 43
services/wd.c → exec/wd.c

@@ -43,13 +43,13 @@
 
 #include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
-#include <corosync/lcr/lcr_comp.h>
 #include <corosync/coroapi.h>
 #include <corosync/list.h>
 #include <corosync/logsys.h>
 #include <corosync/icmap.h>
 #include "../exec/fsm.h"
 
+#include "service.h"
 
 typedef enum {
 	WD_RESOURCE_GOOD,
@@ -144,52 +144,11 @@ struct cs_fsm_entry wd_fsm_table[] = {
 	{ WD_S_FAILED,	WD_E_FAILURE,		NULL,			{-1} },
 };
 
-/*
- * Dynamic loading descriptor
- */
-
-static struct corosync_service_engine *wd_get_service_engine_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 wd_service_engine_iface = {
-	.corosync_get_service_engine_ver0	= wd_get_service_engine_ver0
-};
-
-static struct lcr_iface corosync_wd_ver0[1] = {
-	{
-		.name			= "corosync_wd",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count = 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= NULL,
-	}
-};
-
-static struct lcr_comp wd_comp_ver0 = {
-	.iface_count	= 1,
-	.ifaces		= corosync_wd_ver0
-};
-
-static struct corosync_service_engine *wd_get_service_engine_ver0 (void)
+struct corosync_service_engine *wd_get_service_engine_ver0 (void)
 {
 	return (&wd_service_engine);
 }
 
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_interfaces_set (&corosync_wd_ver0[0], &wd_service_engine_iface);
-
-	lcr_component_register (&wd_comp_ver0);
-}
-
 static const char * wd_res_state_to_str(struct cs_fsm* fsm,
 	int32_t state)
 {

+ 0 - 103
services/Makefile.am

@@ -1,103 +0,0 @@
-# Copyright (c) 2009 Red Hat, Inc.
-#
-# Authors: Andrew Beekhof
-#	   Steven Dake (sdake@redhat.com)
-#
-# This software licensed under BSD license, the text of which follows:
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# - Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# - Neither the name of the MontaVista Software, Inc. nor the names of its
-#   contributors may be used to endorse or promote products derived from this
-#   software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-# THE POSSIBILITY OF SUCH DAMAGE.
-
-MAINTAINERCLEANFILES    = Makefile.in
-
-AM_CFLAGS		= -fPIC
-
-INCLUDES		= -I$(top_builddir)/include -I$(top_srcdir)/include \
-			  -I$(top_builddir)/include/corosync \
-			  -I$(top_srcdir)/include/corosync
-
-SERVICE_LCRSO		= evs cfg cpg pload cmap
-if BUILD_WATCHDOG
-SERVICE_LCRSO		+= wd
-endif
-if BUILD_MONITORING
-SERVICE_LCRSO		+= mon
-endif
-
-QUORUM_LCRSO		= votequorum testquorum
-
-SOURCES			= $(SERVICE_LCRSO:%=%.c) $(QUORUM_LCRSO:%=%.c)
-
-EXTRA_DIST		= $(SOURCES)
-
-LCRSO			= $(SERVICE_LCRSO:%=service_%.lcrso) $(QUORUM_LCRSO:%=quorum_%.lcrso)
-
-LCRSO_OBJS		= $(SOURCES:%.c=%.o)
-
-if BUILD_DARWIN
-quorum_%.lcrso: %.o
-	$(CC) $(LDFLAGS) $(CFLAGS) -L$(top_builddir)/exec -llogsys -bundle -bundle_loader $(top_builddir)/exec/corosync $^ -o $@
-
-service_%.lcrso: %.o
-	$(CC) $(LDFLAGS) $(CFLAGS) -L$(top_builddir)/exec -llogsys -bundle -bundle_loader $(top_builddir)/exec/corosync $^ -o $@
-
-else
-
-if BUILD_SOLARIS
-
-quorum_%.lcrso: %.o
-	$(LD) $(LDFLAGS) -G $^ -o $@
-
-service_%.lcrso: %.o
-	$(LD) $(LDFLAGS) -G $^ -o $@
-
-else
-quorum_%.lcrso: %.o
-	$(CC) $(LDFLAGS) $(CFLAGS) $(COVERAGE_LCRSO_EXTRA_LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@
-
-service_%.lcrso: %.o
-	$(CC) $(LDFLAGS) $(CFLAGS) $(COVERAGE_LCRSO_EXTRA_LDFLAGS) -shared -Wl,-soname=$@ $^ -o $@
-endif
-
-endif
-
-%.o: %.c
-	$(CC) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
-
-lint:
-	-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
-
-all-local: $(LCRSO_OBJS) $(LCRSO)
-	@echo Built Service Engines
-
-install-exec-local:
-	$(INSTALL) -d $(DESTDIR)/$(LCRSODIR)
-	$(INSTALL) -m 755 $(LCRSO) $(DESTDIR)/$(LCRSODIR)
-
-uninstall-local:
-	cd $(DESTDIR)/$(LCRSODIR) && \
-		rm -f $(LCRSO)
-
-clean-local:
-	rm -f *.o *.a *.so* *.da *.bb *.bbg *.lcrso

+ 0 - 156
services/testquorum.c

@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2008, 2009 Red Hat, Inc.
- *
- * All rights reserved.
- *
- * Author: Christine Caulfield (ccaulfie@redhat.com)
- *
- * This software licensed under BSD license, the text of which follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * - Neither the name of Red Hat, 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 <pwd.h>
-#include <grp.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 <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/corotypes.h>
-#include <qb/qbipc_common.h>
-#include <corosync/corodefs.h>
-#include <corosync/logsys.h>
-#include <corosync/icmap.h>
-
-#include <corosync/mar_gen.h>
-#include <corosync/lcr/lcr_comp.h>
-#include <corosync/coroapi.h>
-
-#include <corosync/engine/quorum.h>
-
-LOGSYS_DECLARE_SUBSYS ("TEST");
-
-static void test_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t report);
-
-/*
- * lcrso object definition
- */
-static struct quorum_services_api_ver1 test_quorum_iface_ver0 = {
-	.init				= test_init
-};
-
-static struct lcr_iface corosync_test_quorum_ver0[1] = {
-	{
-		.name			= "testquorum",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count	= 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= (void **)(void *)&test_quorum_iface_ver0,
-	},
-};
-
-static struct lcr_comp test_quorum_comp_ver0 = {
-	.iface_count			= 1,
-	.ifaces				= corosync_test_quorum_ver0
-};
-
-#ifdef COROSYNC_SOLARIS
-void corosync_lcr_component_register (void);
-
-void corosync_lcr_component_register (void) {
-	logsys_subsys_init();
-#else
-__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
-#endif
-	lcr_interfaces_set (&corosync_test_quorum_ver0[0], &test_quorum_iface_ver0);
-	lcr_component_register (&test_quorum_comp_ver0);
-}
-
-/* -------------------------------------------------- */
-
-static quorum_set_quorate_fn_t set_quorum;
-
-static void key_change_notify(
-	int32_t event,
-	const char *key_name,
-	struct icmap_notify_value new_val,
-	struct icmap_notify_value old_val,
-	void *user_data)
-{
-	struct memb_ring_id ring_id;
-	unsigned int members[1];
-	uint8_t u8;
-
-	memset(&ring_id, 0, sizeof(ring_id));
-	if (icmap_get_uint8(key_name, &u8) == CS_OK) {
-		set_quorum(members, 0, u8, &ring_id);
-	}
-}
-
-static void quorum_callback(int quorate, void *context)
-{
-	log_printf(LOGSYS_LEVEL_DEBUG, "quorum callback: quorate = %d\n", quorate);
-}
-
-static void test_init(struct corosync_api_v1 *api,
-		      quorum_set_quorate_fn_t report)
-{
-
-	icmap_track_t icmap_track;
-
-	set_quorum = report;
-
-	/*
-	 * Register for icmap changes on quorum.quorate
-	 */
-	icmap_track_add("quorum.quorate",
-		ICMAP_TRACK_ADD | ICMAP_TRACK_DELETE | ICMAP_TRACK_MODIFY,
-		key_change_notify,
-		NULL,
-		&icmap_track);
-
-	/* Register for quorum changes too! */
-	api->quorum_register_callback(quorum_callback, NULL);
-}