Re: Can someone ack this patch please: Re: [PATCH] Move coroapi out of external headers

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

 



ACK

On 06/01/12 18:20 -0700, Steven Dake wrote:
On 01/06/2012 08:15 AM, Steven Dake wrote:
Signed-off-by: Steven Dake <sdake@xxxxxxxxxx>
---
 TODO                              |    5 +-
 corosync.spec.in                  |    1 -
 exec/apidef.c                     |    1 -
 exec/apidef.h                     |    2 +-
 exec/evil.c                       |    2 +-
 exec/main.h                       |    2 +-
 exec/mainconfig.h                 |    2 +-
 exec/service.c                    |    1 -
 exec/vsf_quorum.c                 |    2 +-
 exec/vsf_ykd.c                    |    2 +-
 include/Makefile.am               |    5 +-
 include/corosync/coroapi.h        |  469 +++++++++++++++++++++++++++++++++++++
 include/corosync/engine/coroapi.h |  469 -------------------------------------
 services/cfg.c                    |    2 +-
 services/cmap.c                   |    2 +-
 services/cpg.c                    |    2 +-
 services/evs.c                    |    2 +-
 services/mon.c                    |    2 +-
 services/pload.c                  |    2 +-
 services/testquorum.c             |    2 +-
 services/votequorum.c             |    2 +-
 services/wd.c                     |    2 +-
 22 files changed, 489 insertions(+), 492 deletions(-)
 create mode 100644 include/corosync/coroapi.h
 delete mode 100644 include/corosync/engine/coroapi.h

diff --git a/TODO b/TODO
index 6fdc5ec..e1e8a4d 100644
--- a/TODO
+++ b/TODO
@@ -10,9 +10,8 @@
  Current priority list for Needle 2.0
 --------------------------------------
 1. quorum debugging and rework
-2. remove external plug-in api
-3. allow a cluster name to autogenerate a mcastaddr
-4. ring status change via corosync-notifyd
+2. allow a cluster name to autogenerate a mcastaddr
+3. ring status change via corosync-notifyd

 --------------------------------------
  Current priority list for Needle 2.1
diff --git a/corosync.spec.in b/corosync.spec.in
index 36956fd..7e314ec 100644
--- a/corosync.spec.in
+++ b/corosync.spec.in
@@ -294,7 +294,6 @@ The Corosync Cluster Engine APIs.
 %{_includedir}/corosync/lcr/lcr_ifact.h
 %dir %{_includedir}/corosync/engine
 %{_includedir}/corosync/engine/config.h
-%{_includedir}/corosync/engine/coroapi.h
 %{_includedir}/corosync/engine/icmap.h
 %{_includedir}/corosync/engine/quorum.h
 %{_libdir}/libcfg.so
diff --git a/exec/apidef.c b/exec/apidef.c
index 795b594..6e14e55 100644
--- a/exec/apidef.c
+++ b/exec/apidef.c
@@ -54,7 +54,6 @@
 #include "schedwrk.h"
 #include "main.h"
 #include "apidef.h"
-#include <corosync/engine/coroapi.h>
 #include "service.h"

 LOGSYS_DECLARE_SUBSYS ("APIDEF");
diff --git a/exec/apidef.h b/exec/apidef.h
index efb72ca..299270c 100644
--- a/exec/apidef.h
+++ b/exec/apidef.h
@@ -35,7 +35,7 @@
 #ifndef APIDEF_H_DEFINED
 #define APIDEF_H_DEFINED

-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>

 extern struct corosync_api_v1 *apidef_get (void);

diff --git a/exec/evil.c b/exec/evil.c
index ba4bde9..092f55d 100644
--- a/exec/evil.c
+++ b/exec/evil.c
@@ -71,7 +71,7 @@
 #include <corosync/list.h>
 #include <corosync/lcr/lcr_ifact.h>
 #include <corosync/config.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/logsys.h>
 #include <qb/qbipcs.h>
 #include "sync.h"
diff --git a/exec/main.h b/exec/main.h
index 91a2706..ad73d87 100644
--- a/exec/main.h
+++ b/exec/main.h
@@ -49,7 +49,7 @@
 #include <qb/qbloop.h>
 #include <corosync/totem/totempg.h>
 #include <corosync/engine/config.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>

 extern unsigned long long *(*main_clm_get_by_nodeid) (unsigned int node_id);

diff --git a/exec/mainconfig.h b/exec/mainconfig.h
index 3de7a7e..2d5c552 100644
--- a/exec/mainconfig.h
+++ b/exec/mainconfig.h
@@ -37,7 +37,7 @@

 #include <corosync/logsys.h>
 #include <corosync/list.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>

 /**
  * All service handlers in the AIS
diff --git a/exec/service.c b/exec/service.c
index a7be311..1425bac 100644
--- a/exec/service.c
+++ b/exec/service.c
@@ -52,7 +52,6 @@
 #include <corosync/totem/totempg.h>
 #include <corosync/totem/totemip.h>
 #include "main.h"
-#include <corosync/engine/coroapi.h>
 #include "service.h"

 #include <qb/qbipcs.h>
diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c
index 79bea03..99ccda4 100644
--- a/exec/vsf_quorum.c
+++ b/exec/vsf_quorum.c
@@ -64,7 +64,7 @@
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/lcr/lcr_ifact.h>
 #include <corosync/mar_gen.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/logsys.h>
 #include <corosync/engine/quorum.h>
 #include <corosync/engine/icmap.h>
diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c
index f8cdd04..f9012be 100644
--- a/exec/vsf_ykd.c
+++ b/exec/vsf_ykd.c
@@ -60,7 +60,7 @@
 #include <corosync/corotypes.h>
 #include <qb/qbipc_common.h>
 #include <corosync/mar_gen.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/engine/quorum.h>
 #include <corosync/swab.h>
 #include <corosync/lcr/lcr_comp.h>
diff --git a/include/Makefile.am b/include/Makefile.am
index a36cfc0..a8fbaca 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -36,11 +36,12 @@ CS_H			= hdb.h cs_config.h cpg.h cfg.h evs.h mar_gen.h swab.h 	\
 			list.h corotypes.h quorum.h votequorum.h sam.h cmap.h

 CS_INTERNAL_H		= ipc_cfg.h ipc_cpg.h ipc_evs.h ipc_pload.h ipc_quorum.h 	\
-			jhash.h pload.h quorum.h sq.h ipc_votequorum.h ipc_cmap.h logsys.h
+			jhash.h pload.h quorum.h sq.h ipc_votequorum.h ipc_cmap.h \
+			logsys.h coroapi.h

 LCR_H			= lcr_ckpt.h lcr_comp.h	lcr_ifact.h

-ENGINE_H		= config.h coroapi.h quorum.h icmap.h
+ENGINE_H		= config.h quorum.h icmap.h

 TOTEM_H			= totem.h totemip.h totempg.h

diff --git a/include/corosync/coroapi.h b/include/corosync/coroapi.h
new file mode 100644
index 0000000..fa6a510
--- /dev/null
+++ b/include/corosync/coroapi.h
@@ -0,0 +1,469 @@
+/*
+ * Copyright (c) 2008, 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.
+ */
+#ifndef COROAPI_H_DEFINED
+#define COROAPI_H_DEFINED
+
+#include <stdio.h>
+#ifdef COROSYNC_BSD
+#include <sys/uio.h>
+#endif
+#include <corosync/hdb.h>
+#include <qb/qbloop.h>
+#include <corosync/swab.h>
+
+typedef struct {
+	uint32_t nodeid __attribute__((aligned(8)));
+	void *conn __attribute__((aligned(8)));
+} mar_message_source_t __attribute__((aligned(8)));
+
+static inline void swab_mar_message_source_t (mar_message_source_t *to_swab)
+{
+	swab32 (to_swab->nodeid);
+	/*
+	 * if it is from a byteswapped machine, then we can safely
+	 * ignore its conn info data structure since this is only
+	 * local to the machine
+	 */
+	to_swab->conn = NULL;
+}
+
+#ifndef TIMER_HANDLE_T
+typedef qb_loop_timer_handle corosync_timer_handle_t;
+#define TIMER_HANDLE_T 1
+#endif
+
+struct corosync_tpg_group {
+	const void *group;
+	size_t group_len;
+};
+
+#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
+
+#define INTERFACE_MAX 2
+
+#ifndef MESSAGE_QUEUE_MAX
+#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
+#define PROCESSOR_COUNT_MAX	16
+#define MESSAGE_SIZE_MAX	1024*64
+#define MESSAGE_QUEUE_MAX	512
+#else
+#define PROCESSOR_COUNT_MAX	384
+#define MESSAGE_SIZE_MAX	1024*1024
+#define MESSAGE_QUEUE_MAX	((4 * MESSAGE_SIZE_MAX) / totem_config->net_mtu)
+#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
+#endif /* MESSAGE_QUEUE_MAX */
+
+#define TOTEM_AGREED	0
+#define TOTEM_SAFE	1
+
+#define MILLI_2_NANO_SECONDS 1000000ULL
+
+#if !defined(TOTEM_IP_ADDRESS)
+struct totem_ip_address {
+	unsigned int   nodeid;
+	unsigned short family;
+	unsigned char  addr[TOTEMIP_ADDRLEN];
+} __attribute__((packed));
+#endif
+
+#if !defined(MEMB_RING_ID)
+struct memb_ring_id {
+	struct totem_ip_address rep;
+	unsigned long long seq;
+} __attribute__((packed));
+#endif
+
+#if !defined(TOTEM_CONFIGURATION_TYPE)
+enum totem_configuration_type {
+	TOTEM_CONFIGURATION_REGULAR,
+	TOTEM_CONFIGURATION_TRANSITIONAL
+};
+#endif
+
+#if !defined(TOTEM_CALLBACK_TOKEN_TYPE)
+enum totem_callback_token_type {
+	TOTEM_CALLBACK_TOKEN_RECEIVED = 1,
+	TOTEM_CALLBACK_TOKEN_SENT = 2
+};
+#endif
+
+enum cs_lib_flow_control {
+	CS_LIB_FLOW_CONTROL_REQUIRED = 1,
+	CS_LIB_FLOW_CONTROL_NOT_REQUIRED = 2
+};
+#define corosync_lib_flow_control cs_lib_flow_control
+#define COROSYNC_LIB_FLOW_CONTROL_REQUIRED CS_LIB_FLOW_CONTROL_REQUIRED
+#define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED CS_LIB_FLOW_CONTROL_NOT_REQUIRED
+
+enum cs_lib_allow_inquorate {
+	CS_LIB_DISALLOW_INQUORATE = 0, /* default */
+	CS_LIB_ALLOW_INQUORATE = 1
+};
+
+#if !defined (COROSYNC_FLOW_CONTROL_STATE)
+enum cs_flow_control_state {
+	CS_FLOW_CONTROL_STATE_DISABLED,
+	CS_FLOW_CONTROL_STATE_ENABLED
+};
+#define corosync_flow_control_state cs_flow_control_state
+#define CS_FLOW_CONTROL_STATE_DISABLED CS_FLOW_CONTROL_STATE_DISABLED
+#define CS_FLOW_CONTROL_STATE_ENABLED CS_FLOW_CONTROL_STATE_ENABLED
+
+#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,
+	COROSYNC_LIBAIS_BIND = -7,
+	COROSYNC_READKEY = -8,
+	COROSYNC_INVALID_CONFIG = -9,
+	COROSYNC_DYNAMICLOAD = -12,
+	COROSYNC_OUT_OF_MEMORY = -15,
+	COROSYNC_FATAL_ERR = -16
+} cs_fatal_error_t;
+#define corosync_fatal_error_t cs_fatal_error_t;
+
+#ifndef QUORUM_H_DEFINED
+typedef void (*quorum_callback_fn_t) (int quorate, void *context);
+
+struct quorum_callin_functions
+{
+	int (*quorate) (void);
+	int (*register_callback) (quorum_callback_fn_t callback_fn, void *context);
+	int (*unregister_callback) (quorum_callback_fn_t callback_fn, void *context);
+};
+
+typedef void (*sync_callback_fn_t) (
+	const unsigned int *view_list,
+	size_t view_list_entries,
+	int primary_designated,
+	struct memb_ring_id *ring_id);
+
+#endif /* QUORUM_H_DEFINED */
+
+struct corosync_api_v1 {
+	/*
+	 * Time and timer APIs
+	 */
+	int (*timer_add_duration) (
+		unsigned long long nanoseconds_in_future,
+		void *data,
+		void (*timer_nf) (void *data),
+		corosync_timer_handle_t *handle);
+
+	int (*timer_add_absolute) (
+		unsigned long long nanoseconds_from_epoch,
+		void *data,
+		void (*timer_fn) (void *data),
+		corosync_timer_handle_t *handle);
+
+	void (*timer_delete) (
+		corosync_timer_handle_t timer_handle);
+
+	unsigned long long (*timer_time_get) (void);
+
+	unsigned long long (*timer_expire_time_get) (
+		corosync_timer_handle_t timer_handle);
+
+	/*
+	 * IPC APIs
+	 */
+	void (*ipc_source_set) (mar_message_source_t *source, void *conn);
+
+	int (*ipc_source_is_local) (const mar_message_source_t *source);
+
+	void *(*ipc_private_data_get) (void *conn);
+
+	int (*ipc_response_send) (void *conn, const void *msg, size_t mlen);
+
+	int (*ipc_response_iov_send) (void *conn,
+				      const struct iovec *iov, unsigned int iov_len);
+
+	int (*ipc_dispatch_send) (void *conn, const void *msg, size_t mlen);
+
+	int (*ipc_dispatch_iov_send) (void *conn,
+				      const struct iovec *iov, unsigned int iov_len);
+
+	void (*ipc_refcnt_inc) (void *conn);
+
+	void (*ipc_refcnt_dec) (void *conn);
+
+	/*
+	 * Totem APIs
+	 */
+	unsigned int (*totem_nodeid_get) (void);
+
+	int (*totem_family_get) (void);
+
+	int (*totem_ring_reenable) (void);
+
+	int (*totem_mcast) (const struct iovec *iovec,
+			    unsigned int iov_len, unsigned int guarantee);
+
+	int (*totem_ifaces_get) (
+		unsigned int nodeid,
+		struct totem_ip_address *interfaces,
+		char ***status,
+		unsigned int *iface_count);
+
+	const char *(*totem_ifaces_print) (unsigned int nodeid);
+
+	const char *(*totem_ip_print) (const struct totem_ip_address *addr);
+
+	int (*totem_crypto_set) (unsigned int type);
+
+	int (*totem_callback_token_create) (
+		void **handle_out,
+		enum totem_callback_token_type type,
+		int delete,
+		int (*callback_fn) (enum totem_callback_token_type type,
+				    const void *),
+		const void *data);
+
+	/*
+	 * Totem open process groups API for those service engines
+	 * wanting their own groups
+	 */
+	int (*tpg_init) (
+		void **instance,
+
+		void (*deliver_fn) (
+			unsigned int nodeid,
+			const void *msg,
+			unsigned int msg_len,
+			int endian_conversion_required),
+
+		void (*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));
+
+	int (*tpg_exit) (
+		void *instance);
+
+	int (*tpg_join) (
+		void *instance,
+		const struct corosync_tpg_group *groups,
+		size_t group_cnt);
+
+	int (*tpg_leave) (
+		void *instance,
+		const struct corosync_tpg_group *groups,
+		size_t group_cnt);
+
+	int (*tpg_joined_mcast) (
+		void *totempg_groups_instance,
+		const struct iovec *iovec,
+		unsigned int iov_len,
+		int guarantee);
+
+	int (*tpg_joined_reserve) (
+		void *totempg_groups_instance,
+		const struct iovec *iovec,
+		unsigned int iov_len);
+
+	int (*tpg_joined_release) (
+		int reserved_msgs);
+
+	int (*tpg_groups_mcast) (
+		void *instance,
+		int guarantee,
+		const struct corosync_tpg_group *groups,
+		size_t groups_cnt,
+		const struct iovec *iovec,
+		unsigned int iov_len);
+
+	int (*tpg_groups_reserve) (
+		void *instance,
+		const struct corosync_tpg_group *groups,
+		size_t groups_cnt,
+		const struct iovec *iovec,
+		unsigned int iov_len);
+
+	int (*tpg_groups_release) (
+		int reserved_msgs);
+
+	int (*schedwrk_create) (
+		hdb_handle_t *handle,
+		int (schedwrk_fn) (const void *),
+		const void *context);
+
+	void (*schedwrk_destroy) (hdb_handle_t handle);
+
+	int (*sync_request) (
+		const char *service_name);
+
+	/*
+	 * User plugin-callable functions for quorum
+	 */
+	int (*quorum_is_quorate) (void);
+	int (*quorum_register_callback) (quorum_callback_fn_t callback_fn, void *context);
+	int (*quorum_unregister_callback) (quorum_callback_fn_t callback_fn, void *context);
+
+	/*
+	 * This one is for the quorum management plugin's use
+	 */
+	int (*quorum_initialize)(struct quorum_callin_functions *fns);
+
+	/*
+	 * Plugin loading and unloading
+	 */
+	int (*plugin_interface_reference) (
+		hdb_handle_t *handle,
+		const char *iface_name,
+		int version,
+		void **interface,
+		void *context);
+
+	int (*plugin_interface_release) (hdb_handle_t handle);
+
+	/*
+	 * Service loading and unloading APIs
+	*/
+	unsigned int (*service_link_and_init) (
+		struct corosync_api_v1 *corosync_api_v1,
+		const char *service_name,
+		unsigned int service_ver);
+
+	unsigned int (*service_unlink_and_exit) (
+		struct corosync_api_v1 *corosync_api_v1,
+		const char *service_name,
+		unsigned int service_ver);
+
+	/*
+	 * Error handling APIs
+	 */
+	void (*error_memory_failure) (void) __attribute__ ((noreturn));
+
+#define corosync_fatal_error(err) api->fatal_error ((err), __FILE__, __LINE__)
+	void (*fatal_error) (cs_fatal_error_t err,
+		const char *file,
+		unsigned int line) __attribute__ ((noreturn));
+
+	void (*shutdown_request) (void);
+
+	void (*state_dump) (void);
+
+	qb_loop_t *(*poll_handle_get) (void);
+
+	void *(*totem_get_stats)(void);
+
+	int (*schedwrk_create_nolock) (
+		hdb_handle_t *handle,
+		int (schedwrk_fn) (const void *),
+		const void *context);
+
+	int (*poll_dispatch_add) (qb_loop_t * handle,
+		int fd,
+		int events,
+		void *data,
+
+		int (*dispatch_fn) (int fd,
+			int revents,
+			void *data));
+
+
+	int (*poll_dispatch_delete) (
+		qb_loop_t * handle,
+		int fd);
+
+};
+
+#define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
+
+#define SERVICE_HANDLER_MAXIMUM_COUNT 64
+
+struct corosync_lib_handler {
+	void (*lib_handler_fn) (void *conn, const void *msg);
+	enum cs_lib_flow_control flow_control;
+};
+
+struct corosync_exec_handler {
+	void (*exec_handler_fn) (const void *msg, unsigned int nodeid);
+	void (*exec_endian_convert_fn) (void *msg);
+};
+
+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;
+	unsigned short priority; /* Lower priority are loaded first, unloaded last.
+				  * 0 is a special case which always loaded _and_ unloaded last
+				  */
+	unsigned int private_data_size;
+	enum cs_lib_flow_control flow_control;
+	enum cs_lib_allow_inquorate allow_inquorate;
+	int (*exec_init_fn) (struct corosync_api_v1 *);
+	int (*exec_exit_fn) (void);
+	void (*exec_dump_fn) (void);
+	int (*lib_init_fn) (void *conn);
+	int (*lib_exit_fn) (void *conn);
+	struct corosync_lib_handler *lib_engine;
+	int lib_engine_count;
+	struct corosync_exec_handler *exec_engine;
+	int exec_engine_count;
+	int (*config_init_fn) (struct corosync_api_v1 *);
+	void (*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);
+	enum cs_sync_mode sync_mode;
+	sync_init_v1_fn_t sync_init;
+	int (*sync_process) (void);
+	void (*sync_activate) (void);
+	void (*sync_abort) (void);
+};
+
+#endif /* COROAPI_H_DEFINED */
diff --git a/include/corosync/engine/coroapi.h b/include/corosync/engine/coroapi.h
deleted file mode 100644
index fa6a510..0000000
--- a/include/corosync/engine/coroapi.h
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-#ifndef COROAPI_H_DEFINED
-#define COROAPI_H_DEFINED
-
-#include <stdio.h>
-#ifdef COROSYNC_BSD
-#include <sys/uio.h>
-#endif
-#include <corosync/hdb.h>
-#include <qb/qbloop.h>
-#include <corosync/swab.h>
-
-typedef struct {
-	uint32_t nodeid __attribute__((aligned(8)));
-	void *conn __attribute__((aligned(8)));
-} mar_message_source_t __attribute__((aligned(8)));
-
-static inline void swab_mar_message_source_t (mar_message_source_t *to_swab)
-{
-	swab32 (to_swab->nodeid);
-	/*
-	 * if it is from a byteswapped machine, then we can safely
-	 * ignore its conn info data structure since this is only
-	 * local to the machine
-	 */
-	to_swab->conn = NULL;
-}
-
-#ifndef TIMER_HANDLE_T
-typedef qb_loop_timer_handle corosync_timer_handle_t;
-#define TIMER_HANDLE_T 1
-#endif
-
-struct corosync_tpg_group {
-	const void *group;
-	size_t group_len;
-};
-
-#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
-
-#define INTERFACE_MAX 2
-
-#ifndef MESSAGE_QUEUE_MAX
-#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
-#define PROCESSOR_COUNT_MAX	16
-#define MESSAGE_SIZE_MAX	1024*64
-#define MESSAGE_QUEUE_MAX	512
-#else
-#define PROCESSOR_COUNT_MAX	384
-#define MESSAGE_SIZE_MAX	1024*1024
-#define MESSAGE_QUEUE_MAX	((4 * MESSAGE_SIZE_MAX) / totem_config->net_mtu)
-#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
-#endif /* MESSAGE_QUEUE_MAX */
-
-#define TOTEM_AGREED	0
-#define TOTEM_SAFE	1
-
-#define MILLI_2_NANO_SECONDS 1000000ULL
-
-#if !defined(TOTEM_IP_ADDRESS)
-struct totem_ip_address {
-	unsigned int   nodeid;
-	unsigned short family;
-	unsigned char  addr[TOTEMIP_ADDRLEN];
-} __attribute__((packed));
-#endif
-
-#if !defined(MEMB_RING_ID)
-struct memb_ring_id {
-	struct totem_ip_address rep;
-	unsigned long long seq;
-} __attribute__((packed));
-#endif
-
-#if !defined(TOTEM_CONFIGURATION_TYPE)
-enum totem_configuration_type {
-	TOTEM_CONFIGURATION_REGULAR,
-	TOTEM_CONFIGURATION_TRANSITIONAL
-};
-#endif
-
-#if !defined(TOTEM_CALLBACK_TOKEN_TYPE)
-enum totem_callback_token_type {
-	TOTEM_CALLBACK_TOKEN_RECEIVED = 1,
-	TOTEM_CALLBACK_TOKEN_SENT = 2
-};
-#endif
-
-enum cs_lib_flow_control {
-	CS_LIB_FLOW_CONTROL_REQUIRED = 1,
-	CS_LIB_FLOW_CONTROL_NOT_REQUIRED = 2
-};
-#define corosync_lib_flow_control cs_lib_flow_control
-#define COROSYNC_LIB_FLOW_CONTROL_REQUIRED CS_LIB_FLOW_CONTROL_REQUIRED
-#define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED CS_LIB_FLOW_CONTROL_NOT_REQUIRED
-
-enum cs_lib_allow_inquorate {
-	CS_LIB_DISALLOW_INQUORATE = 0, /* default */
-	CS_LIB_ALLOW_INQUORATE = 1
-};
-
-#if !defined (COROSYNC_FLOW_CONTROL_STATE)
-enum cs_flow_control_state {
-	CS_FLOW_CONTROL_STATE_DISABLED,
-	CS_FLOW_CONTROL_STATE_ENABLED
-};
-#define corosync_flow_control_state cs_flow_control_state
-#define CS_FLOW_CONTROL_STATE_DISABLED CS_FLOW_CONTROL_STATE_DISABLED
-#define CS_FLOW_CONTROL_STATE_ENABLED CS_FLOW_CONTROL_STATE_ENABLED
-
-#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,
-	COROSYNC_LIBAIS_BIND = -7,
-	COROSYNC_READKEY = -8,
-	COROSYNC_INVALID_CONFIG = -9,
-	COROSYNC_DYNAMICLOAD = -12,
-	COROSYNC_OUT_OF_MEMORY = -15,
-	COROSYNC_FATAL_ERR = -16
-} cs_fatal_error_t;
-#define corosync_fatal_error_t cs_fatal_error_t;
-
-#ifndef QUORUM_H_DEFINED
-typedef void (*quorum_callback_fn_t) (int quorate, void *context);
-
-struct quorum_callin_functions
-{
-	int (*quorate) (void);
-	int (*register_callback) (quorum_callback_fn_t callback_fn, void *context);
-	int (*unregister_callback) (quorum_callback_fn_t callback_fn, void *context);
-};
-
-typedef void (*sync_callback_fn_t) (
-	const unsigned int *view_list,
-	size_t view_list_entries,
-	int primary_designated,
-	struct memb_ring_id *ring_id);
-
-#endif /* QUORUM_H_DEFINED */
-
-struct corosync_api_v1 {
-	/*
-	 * Time and timer APIs
-	 */
-	int (*timer_add_duration) (
-		unsigned long long nanoseconds_in_future,
-		void *data,
-		void (*timer_nf) (void *data),
-		corosync_timer_handle_t *handle);
-
-	int (*timer_add_absolute) (
-		unsigned long long nanoseconds_from_epoch,
-		void *data,
-		void (*timer_fn) (void *data),
-		corosync_timer_handle_t *handle);
-
-	void (*timer_delete) (
-		corosync_timer_handle_t timer_handle);
-
-	unsigned long long (*timer_time_get) (void);
-
-	unsigned long long (*timer_expire_time_get) (
-		corosync_timer_handle_t timer_handle);
-
-	/*
-	 * IPC APIs
-	 */
-	void (*ipc_source_set) (mar_message_source_t *source, void *conn);
-
-	int (*ipc_source_is_local) (const mar_message_source_t *source);
-
-	void *(*ipc_private_data_get) (void *conn);
-
-	int (*ipc_response_send) (void *conn, const void *msg, size_t mlen);
-
-	int (*ipc_response_iov_send) (void *conn,
-				      const struct iovec *iov, unsigned int iov_len);
-
-	int (*ipc_dispatch_send) (void *conn, const void *msg, size_t mlen);
-
-	int (*ipc_dispatch_iov_send) (void *conn,
-				      const struct iovec *iov, unsigned int iov_len);
-
-	void (*ipc_refcnt_inc) (void *conn);
-
-	void (*ipc_refcnt_dec) (void *conn);
-
-	/*
-	 * Totem APIs
-	 */
-	unsigned int (*totem_nodeid_get) (void);
-
-	int (*totem_family_get) (void);
-
-	int (*totem_ring_reenable) (void);
-
-	int (*totem_mcast) (const struct iovec *iovec,
-			    unsigned int iov_len, unsigned int guarantee);
-
-	int (*totem_ifaces_get) (
-		unsigned int nodeid,
-		struct totem_ip_address *interfaces,
-		char ***status,
-		unsigned int *iface_count);
-
-	const char *(*totem_ifaces_print) (unsigned int nodeid);
-
-	const char *(*totem_ip_print) (const struct totem_ip_address *addr);
-
-	int (*totem_crypto_set) (unsigned int type);
-
-	int (*totem_callback_token_create) (
-		void **handle_out,
-		enum totem_callback_token_type type,
-		int delete,
-		int (*callback_fn) (enum totem_callback_token_type type,
-				    const void *),
-		const void *data);
-
-	/*
-	 * Totem open process groups API for those service engines
-	 * wanting their own groups
-	 */
-	int (*tpg_init) (
-		void **instance,
-
-		void (*deliver_fn) (
-			unsigned int nodeid,
-			const void *msg,
-			unsigned int msg_len,
-			int endian_conversion_required),
-
-		void (*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));
-
-	int (*tpg_exit) (
-		void *instance);
-
-	int (*tpg_join) (
-		void *instance,
-		const struct corosync_tpg_group *groups,
-		size_t group_cnt);
-
-	int (*tpg_leave) (
-		void *instance,
-		const struct corosync_tpg_group *groups,
-		size_t group_cnt);
-
-	int (*tpg_joined_mcast) (
-		void *totempg_groups_instance,
-		const struct iovec *iovec,
-		unsigned int iov_len,
-		int guarantee);
-
-	int (*tpg_joined_reserve) (
-		void *totempg_groups_instance,
-		const struct iovec *iovec,
-		unsigned int iov_len);
-
-	int (*tpg_joined_release) (
-		int reserved_msgs);
-
-	int (*tpg_groups_mcast) (
-		void *instance,
-		int guarantee,
-		const struct corosync_tpg_group *groups,
-		size_t groups_cnt,
-		const struct iovec *iovec,
-		unsigned int iov_len);
-
-	int (*tpg_groups_reserve) (
-		void *instance,
-		const struct corosync_tpg_group *groups,
-		size_t groups_cnt,
-		const struct iovec *iovec,
-		unsigned int iov_len);
-
-	int (*tpg_groups_release) (
-		int reserved_msgs);
-
-	int (*schedwrk_create) (
-		hdb_handle_t *handle,
-		int (schedwrk_fn) (const void *),
-		const void *context);
-
-	void (*schedwrk_destroy) (hdb_handle_t handle);
-
-	int (*sync_request) (
-		const char *service_name);
-
-	/*
-	 * User plugin-callable functions for quorum
-	 */
-	int (*quorum_is_quorate) (void);
-	int (*quorum_register_callback) (quorum_callback_fn_t callback_fn, void *context);
-	int (*quorum_unregister_callback) (quorum_callback_fn_t callback_fn, void *context);
-
-	/*
-	 * This one is for the quorum management plugin's use
-	 */
-	int (*quorum_initialize)(struct quorum_callin_functions *fns);
-
-	/*
-	 * Plugin loading and unloading
-	 */
-	int (*plugin_interface_reference) (
-		hdb_handle_t *handle,
-		const char *iface_name,
-		int version,
-		void **interface,
-		void *context);
-
-	int (*plugin_interface_release) (hdb_handle_t handle);
-
-	/*
-	 * Service loading and unloading APIs
-	*/
-	unsigned int (*service_link_and_init) (
-		struct corosync_api_v1 *corosync_api_v1,
-		const char *service_name,
-		unsigned int service_ver);
-
-	unsigned int (*service_unlink_and_exit) (
-		struct corosync_api_v1 *corosync_api_v1,
-		const char *service_name,
-		unsigned int service_ver);
-
-	/*
-	 * Error handling APIs
-	 */
-	void (*error_memory_failure) (void) __attribute__ ((noreturn));
-
-#define corosync_fatal_error(err) api->fatal_error ((err), __FILE__, __LINE__)
-	void (*fatal_error) (cs_fatal_error_t err,
-		const char *file,
-		unsigned int line) __attribute__ ((noreturn));
-
-	void (*shutdown_request) (void);
-
-	void (*state_dump) (void);
-
-	qb_loop_t *(*poll_handle_get) (void);
-
-	void *(*totem_get_stats)(void);
-
-	int (*schedwrk_create_nolock) (
-		hdb_handle_t *handle,
-		int (schedwrk_fn) (const void *),
-		const void *context);
-
-	int (*poll_dispatch_add) (qb_loop_t * handle,
-		int fd,
-		int events,
-		void *data,
-
-		int (*dispatch_fn) (int fd,
-			int revents,
-			void *data));
-
-
-	int (*poll_dispatch_delete) (
-		qb_loop_t * handle,
-		int fd);
-
-};
-
-#define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
-
-#define SERVICE_HANDLER_MAXIMUM_COUNT 64
-
-struct corosync_lib_handler {
-	void (*lib_handler_fn) (void *conn, const void *msg);
-	enum cs_lib_flow_control flow_control;
-};
-
-struct corosync_exec_handler {
-	void (*exec_handler_fn) (const void *msg, unsigned int nodeid);
-	void (*exec_endian_convert_fn) (void *msg);
-};
-
-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;
-	unsigned short priority; /* Lower priority are loaded first, unloaded last.
-				  * 0 is a special case which always loaded _and_ unloaded last
-				  */
-	unsigned int private_data_size;
-	enum cs_lib_flow_control flow_control;
-	enum cs_lib_allow_inquorate allow_inquorate;
-	int (*exec_init_fn) (struct corosync_api_v1 *);
-	int (*exec_exit_fn) (void);
-	void (*exec_dump_fn) (void);
-	int (*lib_init_fn) (void *conn);
-	int (*lib_exit_fn) (void *conn);
-	struct corosync_lib_handler *lib_engine;
-	int lib_engine_count;
-	struct corosync_exec_handler *exec_engine;
-	int exec_engine_count;
-	int (*config_init_fn) (struct corosync_api_v1 *);
-	void (*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);
-	enum cs_sync_mode sync_mode;
-	sync_init_v1_fn_t sync_init;
-	int (*sync_process) (void);
-	void (*sync_activate) (void);
-	void (*sync_abort) (void);
-};
-
-#endif /* COROAPI_H_DEFINED */
diff --git a/services/cfg.c b/services/cfg.c
index b00ae93..a4d43f4 100644
--- a/services/cfg.c
+++ b/services/cfg.c
@@ -60,7 +60,7 @@
 #include <corosync/ipc_cfg.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/logsys.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/engine/icmap.h>
 #include <corosync/corodefs.h>

diff --git a/services/cmap.c b/services/cmap.c
index 076d8db..62e73e7 100644
--- a/services/cmap.c
+++ b/services/cmap.c
@@ -53,7 +53,7 @@
 #include <corosync/ipc_cmap.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/logsys.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/engine/icmap.h>

 #define hdb_error_to_cs(_result_) qb_to_cs_error(_result_)
diff --git a/services/cpg.c b/services/cpg.c
index 008a3ea..c7c4ead 100644
--- a/services/cpg.c
+++ b/services/cpg.c
@@ -64,7 +64,7 @@
 #include <corosync/jhash.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/logsys.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>

 #include <corosync/cpg.h>
 #include <corosync/ipc_cpg.h>
diff --git a/services/evs.c b/services/evs.c
index e8d5879..bad8154 100644
--- a/services/evs.c
+++ b/services/evs.c
@@ -57,7 +57,7 @@
 #include <corosync/corodefs.h>
 #include <corosync/mar_gen.h>
 #include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/logsys.h>
 #include <corosync/list.h>

diff --git a/services/mon.c b/services/mon.c
index a0bc705..665e768 100644
--- a/services/mon.c
+++ b/services/mon.c
@@ -42,7 +42,7 @@
 #include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
 #include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/list.h>
 #include <corosync/logsys.h>
 #include <corosync/engine/icmap.h>
diff --git a/services/pload.c b/services/pload.c
index 85a485f..c8f64ce 100644
--- a/services/pload.c
+++ b/services/pload.c
@@ -61,7 +61,7 @@
 #include <corosync/corodefs.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/mar_gen.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/ipc_pload.h>
 #include <corosync/list.h>
 #include <corosync/logsys.h>
diff --git a/services/testquorum.c b/services/testquorum.c
index 3cdf9cd..5122054 100644
--- a/services/testquorum.c
+++ b/services/testquorum.c
@@ -62,7 +62,7 @@

 #include <corosync/mar_gen.h>
 #include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>

 #include <corosync/engine/quorum.h>

diff --git a/services/votequorum.c b/services/votequorum.c
index d9930fb..126354f 100644
--- a/services/votequorum.c
+++ b/services/votequorum.c
@@ -66,7 +66,7 @@
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/logsys.h>
 #include <corosync/mar_gen.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/engine/quorum.h>
 #include <corosync/engine/icmap.h>
 #include <corosync/ipc_votequorum.h>
diff --git a/services/wd.c b/services/wd.c
index 72544ae..055cc8a 100644
--- a/services/wd.c
+++ b/services/wd.c
@@ -44,7 +44,7 @@
 #include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
 #include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/coroapi.h>
+#include <corosync/coroapi.h>
 #include <corosync/list.h>
 #include <corosync/logsys.h>
 #include <corosync/engine/icmap.h>

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss
_______________________________________________
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