From 829d4f4192121f0690dde3613039ab3f88801333 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Fri, 7 Nov 2008 04:38:05 +0000 Subject: [PATCH 001/185] Initialize branch F-10 for corosync --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..dc32377 --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-10 From 853ccfe16c126746de3d52629f6c7859f62ce5d1 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 10 Dec 2008 07:42:53 +0000 Subject: [PATCH 002/185] Update to svn trunk at revision 1707 --- corosync-trunk-1707.diff | 16570 +++++++++++++++++++++++++++++++++++++ corosync.spec | 15 +- 2 files changed, 16583 insertions(+), 2 deletions(-) create mode 100644 corosync-trunk-1707.diff diff --git a/corosync-trunk-1707.diff b/corosync-trunk-1707.diff new file mode 100644 index 0000000..4f343b8 --- /dev/null +++ b/corosync-trunk-1707.diff @@ -0,0 +1,16570 @@ +diff -Naurd corosync-0.92/exec/apidef.c corosync-trunk/exec/apidef.c +--- corosync-0.92/exec/apidef.c 2008-09-17 21:15:00.000000000 +0200 ++++ corosync-trunk/exec/apidef.c 2008-12-08 16:55:41.000000000 +0100 +@@ -46,6 +46,7 @@ + #include "main.h" + #include "ipc.h" + #include "sync.h" ++#include "quorum.h" + #include + #include "service.h" + #include +@@ -55,11 +56,16 @@ + /* + * Remove compile warnings about type name changes + */ +-typedef int (*typedef_tpg_join) (corosync_tpg_handle, struct corosync_tpg_group *, int); +-typedef int (*typedef_tpg_leave) (corosync_tpg_handle, struct corosync_tpg_group *, int); +-typedef int (*typedef_tpg_groups_mcast) (corosync_tpg_handle, int, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); +-typedef int (*typedef_tpg_groups_send_ok) (corosync_tpg_handle, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); ++typedef int (*typedef_tpg_join) (cs_tpg_handle, struct corosync_tpg_group *, int); ++typedef int (*typedef_tpg_leave) (cs_tpg_handle, struct corosync_tpg_group *, int); ++typedef int (*typedef_tpg_groups_mcast) (cs_tpg_handle, int, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); ++typedef int (*typedef_tpg_groups_send_ok) (cs_tpg_handle, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); + ++static inline void _corosync_public_exit_error ( ++ cs_fatal_error_t err, const char *file, unsigned int line) ++{ ++ _corosync_exit_error (err, file, line); ++} + + static struct corosync_api_v1 apidef_corosync_api_v1 = { + .timer_add_duration = corosync_timer_add_duration, +@@ -68,16 +74,16 @@ + .timer_time_get = NULL, + .ipc_source_set = message_source_set, + .ipc_source_is_local = message_source_is_local, +- .ipc_private_data_get = corosync_conn_private_data_get, ++ .ipc_private_data_get = cs_conn_private_data_get, + .ipc_response_send = NULL, +- .ipc_response_no_fcc = corosync_conn_send_response_no_fcc, ++ .ipc_response_no_fcc = cs_conn_send_response_no_fcc, + .ipc_dispatch_send = NULL, +- .ipc_conn_send_response = corosync_conn_send_response, +- .ipc_conn_partner_get = corosync_conn_partner_get, +- .ipc_refcnt_inc = corosync_ipc_flow_control_local_increment, +- .ipc_refcnt_dec = corosync_ipc_flow_control_local_decrement, +- .ipc_fc_create = corosync_ipc_flow_control_create, +- .ipc_fc_destroy = corosync_ipc_flow_control_destroy, ++ .ipc_conn_send_response = cs_conn_send_response, ++ .ipc_conn_partner_get = cs_conn_partner_get, ++ .ipc_refcnt_inc = cs_ipc_flow_control_local_increment, ++ .ipc_refcnt_dec = cs_ipc_flow_control_local_decrement, ++ .ipc_fc_create = cs_ipc_flow_control_create, ++ .ipc_fc_destroy = cs_ipc_flow_control_destroy, + .totem_nodeid_get = totempg_my_nodeid_get, + .totem_family_get = totempg_my_family_get, + .totem_ring_reenable = totempg_ring_reenable, +@@ -86,6 +92,7 @@ + .totem_ifaces_get = totempg_ifaces_get, + .totem_ifaces_print = totempg_ifaces_print, + .totem_ip_print = totemip_print, ++ .totem_callback_token_create = totempg_callback_token_create, + .tpg_init = totempg_groups_initialize, + .tpg_exit = NULL, /* missing from totempg api */ + .tpg_join = (typedef_tpg_join)totempg_groups_join, +@@ -95,12 +102,16 @@ + .tpg_groups_mcast = (typedef_tpg_groups_mcast)totempg_groups_mcast_groups, + .tpg_groups_send_ok = (typedef_tpg_groups_send_ok)totempg_groups_send_ok_groups, + .sync_request = sync_request, ++ .quorum_is_quorate = corosync_quorum_is_quorate, ++ .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_exit_error ++ .fatal_error = _corosync_public_exit_error + }; + + void apidef_init (struct objdb_iface_ver0 *objdb) { +diff -Naurd corosync-0.92/exec/crypto.c corosync-trunk/exec/crypto.c +--- corosync-0.92/exec/crypto.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/exec/crypto.c 2008-11-11 19:13:47.000000000 +0100 +@@ -844,7 +844,7 @@ + assert ((len & 3) == 0); + + for (i = 0; i < len; i += 4) { +- k = BYTE2WORD((unsigned char *)&buf[i]); ++ k = BYTE2WORD((unsigned char*)&buf[i]); + ADDKEY(k); + cycle(c->R); + XORNL(nltap(c)); +@@ -1250,11 +1250,11 @@ + void (*callback)(void)) + { + int fd; +- int rb; ++ unsigned long rb; + + fd = open ("/dev/urandom", O_RDONLY); + +- rb = read (fd, buf, len); ++ rb = (unsigned long)read (fd, buf, len); + + close (fd); + +diff -Naurd corosync-0.92/exec/flow.c corosync-trunk/exec/flow.c +--- corosync-0.92/exec/flow.c 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/exec/flow.c 2008-11-06 22:49:07.000000000 +0100 +@@ -34,9 +34,9 @@ + + /* + * New messages are allowed from the library ONLY when the processor has not +- * received a COROSYNC_FLOW_CONTROL_STATE_ENABLED from any processor. If a +- * COROSYNC_FLOW_CONTROL_STATE_ENABLED message is sent, it must later be +- * cancelled by a COROSYNC_FLOW_CONTROL_STATE_DISABLED message. A configuration ++ * received a CS_FLOW_CONTROL_STATE_ENABLED from any processor. If a ++ * CS_FLOW_CONTROL_STATE_ENABLED message is sent, it must later be ++ * cancelled by a CS_FLOW_CONTROL_STATE_DISABLED message. A configuration + * change with the flow controlled processor leaving the configuration will + * also cancel flow control. + */ +@@ -68,12 +68,12 @@ + unsigned int service __attribute__((aligned(8))); + char id[1024] __attribute__((aligned(8))); + unsigned int id_len __attribute__((aligned(8))); +- enum corosync_flow_control_state flow_control_state __attribute__((aligned(8))); ++ enum cs_flow_control_state flow_control_state __attribute__((aligned(8))); + }; + + struct flow_control_node_state { + unsigned int nodeid; +- enum corosync_flow_control_state flow_control_state; ++ enum cs_flow_control_state flow_control_state; + }; + + struct flow_control_service { +@@ -81,10 +81,10 @@ + unsigned int service; + char id[1024]; + unsigned int id_len; +- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state); ++ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state); + void *context; + unsigned int processor_count; +- enum corosync_flow_control_state flow_control_state; ++ enum cs_flow_control_state flow_control_state; + struct list_head list; + struct list_head list_all; + }; +@@ -108,7 +108,7 @@ + + static inline int flow_control_xmit ( + struct flow_control_service *flow_control_service, +- enum corosync_flow_control_state flow_control_state) ++ enum cs_flow_control_state flow_control_state) + { + struct flow_control_message flow_control_message; + struct iovec iovec; +@@ -165,11 +165,11 @@ + * Determine if any flow control is enabled on any nodes and set + * the internal variable appropriately + */ +- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; ++ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; + flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state); + for (i = 0; i < flow_control_service->processor_count; i++) { +- if (flow_control_service->flow_control_node_state[i].flow_control_state == COROSYNC_FLOW_CONTROL_STATE_ENABLED) { +- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED; ++ if (flow_control_service->flow_control_node_state[i].flow_control_state == CS_FLOW_CONTROL_STATE_ENABLED) { ++ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_ENABLED; + flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state); + } + } +@@ -204,7 +204,7 @@ + */ + for (i = 0; i < member_list_entries; i++) { + flow_control_node_state_temp[i].nodeid = member_list[i]; +- flow_control_node_state_temp[i].flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; ++ flow_control_node_state_temp[i].flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; + + /* + * Determine if previous state was set for this processor +@@ -231,10 +231,10 @@ + * Turn on all flow control after a configuration change + */ + flow_control_service->processor_count = flow_control_member_list_entries; +- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; ++ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; + for (i = 0; i < member_list_entries; i++) { +- if (flow_control_service->flow_control_node_state[i].flow_control_state == COROSYNC_FLOW_CONTROL_STATE_ENABLED) { +- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED; ++ if (flow_control_service->flow_control_node_state[i].flow_control_state == CS_FLOW_CONTROL_STATE_ENABLED) { ++ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_ENABLED; + flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state); + } + } +@@ -244,7 +244,7 @@ + /* + * External API + */ +-unsigned int corosync_flow_control_initialize (void) ++unsigned int cs_flow_control_initialize (void) + { + unsigned int res; + +@@ -271,7 +271,7 @@ + return (0); + } + +-unsigned int corosync_flow_control_ipc_init ( ++unsigned int cs_flow_control_ipc_init ( + unsigned int *flow_control_handle, + unsigned int service) + { +@@ -301,19 +301,19 @@ + + } + +-unsigned int corosync_flow_control_ipc_exit ( ++unsigned int cs_flow_control_ipc_exit ( + unsigned int flow_control_handle) + { + hdb_handle_destroy (&flow_control_hdb, flow_control_handle); + return (0); + } + +-unsigned int corosync_flow_control_create ( ++unsigned int cs_flow_control_create ( + unsigned int flow_control_handle, + unsigned int service, + void *id, + unsigned int id_len, +- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state), ++ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state), + void *context) + { + struct flow_control_service *flow_control_service; +@@ -337,7 +337,7 @@ + */ + memset (flow_control_service, 0, sizeof (struct flow_control_service)); + +- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; ++ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; + flow_control_service->service = service; + memcpy (flow_control_service->id, id, id_len); + flow_control_service->id_len = id_len; +@@ -363,7 +363,7 @@ + return (res); + } + +-unsigned int corosync_flow_control_destroy ( ++unsigned int cs_flow_control_destroy ( + unsigned int flow_control_identifier, + unsigned int service, + unsigned char *id, +@@ -389,7 +389,7 @@ + if ((flow_control_service->id_len == id_len) && + (memcmp (flow_control_service->id, id, id_len) == 0)) { + flow_control_xmit (flow_control_service, +- COROSYNC_FLOW_CONTROL_STATE_DISABLED); ++ CS_FLOW_CONTROL_STATE_DISABLED); + list_del (&flow_control_service->list); + list_del (&flow_control_service->list_all); + free (flow_control_service); +@@ -406,7 +406,7 @@ + * Disable the ability for new messages to be sent for this service + * with the handle id of length id_len + */ +-unsigned int corosync_flow_control_disable ( ++unsigned int cs_flow_control_disable ( + unsigned int flow_control_handle) + { + struct flow_control_instance *instance; +@@ -425,8 +425,8 @@ + list = list->next) { + + flow_control_service = list_entry (list, struct flow_control_service, list); +- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; +- flow_control_xmit (flow_control_service, COROSYNC_FLOW_CONTROL_STATE_DISABLED); ++ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; ++ flow_control_xmit (flow_control_service, CS_FLOW_CONTROL_STATE_DISABLED); + } + hdb_handle_put (&flow_control_hdb, flow_control_handle); + +@@ -438,7 +438,7 @@ + * Enable the ability for new messagess to be sent for this service + * with the handle id of length id_len + */ +-unsigned int corosync_flow_control_enable ( ++unsigned int cs_flow_control_enable ( + unsigned int flow_control_handle) + { + struct flow_control_instance *instance; +@@ -458,8 +458,8 @@ + + + flow_control_service = list_entry (list, struct flow_control_service, list); +- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED; +- flow_control_xmit (flow_control_service, COROSYNC_FLOW_CONTROL_STATE_ENABLED); ++ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_ENABLED; ++ flow_control_xmit (flow_control_service, CS_FLOW_CONTROL_STATE_ENABLED); + } + hdb_handle_put (&flow_control_hdb, flow_control_handle); + +diff -Naurd corosync-0.92/exec/flow.h corosync-trunk/exec/flow.h +--- corosync-0.92/exec/flow.h 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/exec/flow.h 2008-11-06 22:49:07.000000000 +0100 +@@ -37,38 +37,38 @@ + #define FLOW_H_DEFINED + + #define COROSYNC_FLOW_CONTROL_STATE +-enum corosync_flow_control_state { +- COROSYNC_FLOW_CONTROL_STATE_DISABLED, +- COROSYNC_FLOW_CONTROL_STATE_ENABLED ++enum cs_flow_control_state { ++ CS_FLOW_CONTROL_STATE_DISABLED, ++ CS_FLOW_CONTROL_STATE_ENABLED + }; + +-unsigned int corosync_flow_control_initialize (void); ++unsigned int cs_flow_control_initialize (void); + +-unsigned int corosync_flow_control_ipc_init ( ++unsigned int cs_flow_control_ipc_init ( + unsigned int *flow_control_identifier, + unsigned int service); + +-unsigned int corosync_flow_control_ipc_exit ( ++unsigned int cs_flow_control_ipc_exit ( + unsigned int flow_control_identifier); + +-unsigned int corosync_flow_control_create ( ++unsigned int cs_flow_control_create ( + unsigned int flow_control_handle, + unsigned int service, + void *id, + unsigned int id_len, +- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state), ++ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state), + void *context); + +-unsigned int corosync_flow_control_destroy ( ++unsigned int cs_flow_control_destroy ( + unsigned int flow_control_identifier, + unsigned int service, + unsigned char *id, + unsigned int id_len); + +-unsigned int corosync_flow_control_disable ( ++unsigned int cs_flow_control_disable ( + unsigned int flow_control_identifier); + +-unsigned int corosync_flow_control_enable ( ++unsigned int cs_flow_control_enable ( + unsigned int flow_control_identifier); + + #endif /* FLOW_H_DEFINED */ +diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c +--- corosync-0.92/exec/ipc.c 2008-09-17 21:15:00.000000000 +0200 ++++ corosync-trunk/exec/ipc.c 2008-12-08 16:55:41.000000000 +0100 +@@ -62,7 +62,7 @@ + #endif + + #include +-#include ++#include + #include + #include + #include +@@ -72,6 +72,7 @@ + #include + #include + ++#include "quorum.h" + #include "poll.h" + #include "totemsrp.h" + #include "mempool.h" +@@ -153,7 +154,7 @@ + unsigned int flow_control_handle; /* flow control identifier */ + unsigned int flow_control_enabled; /* flow control enabled bit */ + unsigned int flow_control_local_count; /* flow control local count */ +- enum corosync_lib_flow_control flow_control; /* Does this service use IPC flow control */ ++ enum cs_lib_flow_control flow_control; /* Does this service use IPC flow control */ + pthread_mutex_t flow_control_mutex; + int (*lib_exit_fn) (void *conn); + struct timerlist timerlist; +@@ -193,26 +194,26 @@ + struct conn_info *conn_info, + void *message) + { +- SaAisErrorT error = SA_AIS_ERR_ACCESS; ++ cs_error_t error = CS_ERR_ACCESS; + uintptr_t cinfo = (uintptr_t)conn_info; + mar_req_lib_response_init_t *req_lib_response_init = (mar_req_lib_response_init_t *)message; + mar_res_lib_response_init_t res_lib_response_init; + + if (conn_info->authenticated) { + conn_info->service = req_lib_response_init->resdis_header.service; +- error = SA_AIS_OK; ++ error = CS_OK; + } + res_lib_response_init.header.size = sizeof (mar_res_lib_response_init_t); + res_lib_response_init.header.id = MESSAGE_RES_INIT; + res_lib_response_init.header.error = error; + res_lib_response_init.conn_info = (mar_uint64_t)cinfo; + +- corosync_conn_send_response ( ++ cs_conn_send_response ( + conn_info, + &res_lib_response_init, + sizeof (res_lib_response_init)); + +- if (error == SA_AIS_ERR_ACCESS) { ++ if (error == CS_ERR_ACCESS) { + libais_disconnect_security (conn_info); + return (-1); + } +@@ -223,7 +224,7 @@ + struct conn_info *conn_info, + void *message) + { +- SaAisErrorT error = SA_AIS_ERR_ACCESS; ++ cs_error_t error = CS_ERR_ACCESS; + uintptr_t cinfo; + mar_req_lib_dispatch_init_t *req_lib_dispatch_init = (mar_req_lib_dispatch_init_t *)message; + mar_res_lib_dispatch_init_t res_lib_dispatch_init; +@@ -232,9 +233,9 @@ + if (conn_info->authenticated) { + conn_info->service = req_lib_dispatch_init->resdis_header.service; + if (!ais_service[req_lib_dispatch_init->resdis_header.service]) +- error = SA_AIS_ERR_NOT_SUPPORTED; ++ error = CS_ERR_NOT_SUPPORTED; + else +- error = SA_AIS_OK; ++ error = CS_OK; + + cinfo = (uintptr_t)req_lib_dispatch_init->conn_info; + conn_info->conn_info_partner = (struct conn_info *)cinfo; +@@ -252,7 +253,7 @@ + msg_conn_info = (struct conn_info *)cinfo; + msg_conn_info->conn_info_partner = conn_info; + +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + int private_data_size; + + private_data_size = ais_service[req_lib_dispatch_init->resdis_header.service]->private_data_size; +@@ -261,7 +262,7 @@ + + conn_info->conn_info_partner->private_data = conn_info->private_data; + if (conn_info->private_data == NULL) { +- error = SA_AIS_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + } else { + memset (conn_info->private_data, 0, private_data_size); + } +@@ -276,16 +277,16 @@ + res_lib_dispatch_init.header.id = MESSAGE_RES_INIT; + res_lib_dispatch_init.header.error = error; + +- corosync_conn_send_response ( ++ cs_conn_send_response ( + conn_info, + &res_lib_dispatch_init, + sizeof (res_lib_dispatch_init)); + +- if (error == SA_AIS_ERR_ACCESS) { ++ if (error == CS_ERR_ACCESS) { + libais_disconnect_security (conn_info); + return (-1); + } +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (-1); + } + +@@ -296,8 +297,8 @@ + + conn_info->flow_control = ais_service[conn_info->service]->flow_control; + conn_info->conn_info_partner->flow_control = ais_service[conn_info->service]->flow_control; +- if (ais_service[conn_info->service]->flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) { +- corosync_flow_control_ipc_init ( ++ if (ais_service[conn_info->service]->flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) { ++ cs_flow_control_ipc_init ( + &conn_info->flow_control_handle, + conn_info->service); + +@@ -448,7 +449,7 @@ + conn_info->state = CONN_STATE_DISCONNECTED; + conn_info->conn_info_partner->state = CONN_STATE_DISCONNECTED; + if (conn_info->flow_control_enabled == 1) { +- corosync_flow_control_disable (conn_info->flow_control_handle); ++ cs_flow_control_disable (conn_info->flow_control_handle); + } + return (0); + } +@@ -633,14 +634,14 @@ + /* + * IPC group-wide flow control + */ +- if (conn_info->flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) { ++ if (conn_info->flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) { + if (conn_info->flow_control_enabled == 0 && + ((fcc + FLOW_CONTROL_ENTRIES_ENABLE) > SIZEQUEUE)) { + + log_printf (LOG_LEVEL_NOTICE, "Enabling flow control [%d/%d] - [%d].\n", + entries_usedhw, SIZEQUEUE, + flow_control_local_count); +- corosync_flow_control_enable (conn_info->flow_control_handle); ++ cs_flow_control_enable (conn_info->flow_control_handle); + conn_info->flow_control_enabled = 1; + conn_info->conn_info_partner->flow_control_enabled = 1; + } +@@ -651,7 +652,7 @@ + log_printf (LOG_LEVEL_NOTICE, "Disabling flow control [%d/%d] - [%d].\n", + entries_usedhw, SIZEQUEUE, + flow_control_local_count); +- corosync_flow_control_disable (conn_info->flow_control_handle); ++ cs_flow_control_disable (conn_info->flow_control_handle); + conn_info->flow_control_enabled = 0; + conn_info->conn_info_partner->flow_control_enabled = 0; + } +@@ -660,7 +661,7 @@ + + static int conn_info_outq_flush (struct conn_info *conn_info) { + struct queue *outq; +- int res = 0; ++ ssize_t res = 0; + struct outq_item *queue_item; + struct msghdr msg_send; + struct iovec iov_send; +@@ -731,14 +732,15 @@ + + + +-struct res_overlay { ++struct ipc_res_overlay { + mar_res_header_t header __attribute((aligned(8))); + char buf[4096]; + }; + + static void libais_deliver (struct conn_info *conn_info) + { +- int res; ++ ssize_t res; ++ int dispatch_res; + mar_req_header_t *header; + int service; + struct msghdr msg_recv; +@@ -752,7 +754,7 @@ + int send_ok = 0; + int send_ok_joined = 0; + struct iovec send_ok_joined_iovec; +- struct res_overlay res_overlay; ++ struct ipc_res_overlay res_overlay; + + msg_recv.msg_iov = &iov_recv; + msg_recv.msg_iovlen = 1; +@@ -841,7 +843,7 @@ + #ifdef COROSYNC_LINUX + if (conn_info->authenticated == 0) { + cmsg = CMSG_FIRSTHDR (&msg_recv); +- assert (cmsg); ++ assert (cmsg != NULL); + cred = (struct ucred *)CMSG_DATA (cmsg); + if (cred) { + if (cred->uid == 0 || cred->gid == g_gid_valid) { +@@ -861,7 +863,8 @@ + conn_info->inb_inuse += res; + conn_info->inb_start += res; + +- while (conn_info->inb_inuse >= sizeof (mar_req_header_t) && res != -1) { ++ dispatch_res = 0; ++ while (conn_info->inb_inuse >= sizeof (mar_req_header_t) && dispatch_res != -1) { + header = (mar_req_header_t *)&conn_info->inb[conn_info->inb_start - conn_info->inb_inuse]; + + if (header->size > conn_info->inb_inuse) { +@@ -874,7 +877,7 @@ + * else handle message using service service + */ + if (service == SOCKET_SERVICE_INIT) { +- res = ais_init_service[header->id] (conn_info, header); ++ dispatch_res = ais_init_service[header->id] (conn_info, header); + } else { + /* + * Not an init service, but a standard service +@@ -897,11 +900,11 @@ + &send_ok_joined_iovec, 1); + + send_ok = +- (sync_primary_designated() == 1) && ( +- (ais_service[service]->lib_engine[header->id].flow_control == COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED) || +- ((ais_service[service]->lib_engine[header->id].flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) && ++ (corosync_quorum_is_quorate() == 1 || ais_service[service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) && ( ++ (ais_service[service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) || ++ ((ais_service[service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) && + (send_ok_joined) && +- (sync_in_process() == 0))); ++ (sync_in_process() == 0))); + + if (send_ok) { + ais_service[service]->lib_engine[header->id].lib_handler_fn(conn_info, header); +@@ -914,8 +917,8 @@ + ais_service[service]->lib_engine[header->id].response_size; + res_overlay.header.id = + ais_service[service]->lib_engine[header->id].response_id; +- res_overlay.header.error = SA_AIS_ERR_TRY_AGAIN; +- corosync_conn_send_response ( ++ res_overlay.header.error = CS_ERR_TRY_AGAIN; ++ cs_conn_send_response ( + conn_info, + &res_overlay, + res_overlay.header.size); +@@ -1030,7 +1033,7 @@ + { + } + +-void corosync_ipc_init ( ++void cs_ipc_init ( + void (*serialize_lock_fn) (void), + void (*serialize_unlock_fn) (void), + unsigned int gid_valid) +@@ -1102,7 +1105,7 @@ + /* + * Get the conn info private data + */ +-void *corosync_conn_private_data_get (void *conn) ++void *cs_conn_private_data_get (void *conn) + { + struct conn_info *conn_info = (struct conn_info *)conn; + +@@ -1116,7 +1119,7 @@ + /* + * Get the conn info partner connection + */ +-void *corosync_conn_partner_get (void *conn) ++void *cs_conn_partner_get (void *conn) + { + struct conn_info *conn_info = (struct conn_info *)conn; + +@@ -1127,25 +1130,27 @@ + } + } + +-int corosync_conn_send_response_no_fcc ( ++int cs_conn_send_response_no_fcc ( + void *conn, + void *msg, + int mlen) + { ++ int ret; + dont_call_flow_control = 1; +- corosync_conn_send_response ( ++ ret = cs_conn_send_response ( + conn, msg, mlen); + dont_call_flow_control = 0; ++ return ret; + } + +-int corosync_conn_send_response ( ++int cs_conn_send_response ( + void *conn, + void *msg, + int mlen) + { + struct queue *outq; + char *cmsg; +- int res = 0; ++ ssize_t res = 0; + int queue_empty; + struct outq_item *queue_item; + struct outq_item queue_item_out; +@@ -1282,17 +1287,17 @@ + return (0); + } + +-void corosync_ipc_flow_control_create ( ++void cs_ipc_flow_control_create ( + void *conn, + unsigned int service, + char *id, + int id_len, +- void (*flow_control_state_set_fn) (void *conn, enum corosync_flow_control_state), ++ void (*flow_control_state_set_fn) (void *conn, enum cs_flow_control_state), + void *context) + { + struct conn_info *conn_info = (struct conn_info *)conn; + +- corosync_flow_control_create ( ++ cs_flow_control_create ( + conn_info->flow_control_handle, + service, + id, +@@ -1302,7 +1307,7 @@ + conn_info->conn_info_partner->flow_control_handle = conn_info->flow_control_handle; + } + +-void corosync_ipc_flow_control_destroy ( ++void cs_ipc_flow_control_destroy ( + void *conn, + unsigned int service, + unsigned char *id, +@@ -1310,14 +1315,14 @@ + { + struct conn_info *conn_info = (struct conn_info *)conn; + +- corosync_flow_control_destroy ( ++ cs_flow_control_destroy ( + conn_info->flow_control_handle, + service, + id, + id_len); + } + +-void corosync_ipc_flow_control_local_increment ( ++void cs_ipc_flow_control_local_increment ( + void *conn) + { + struct conn_info *conn_info = (struct conn_info *)conn; +@@ -1329,7 +1334,7 @@ + pthread_mutex_unlock (&conn_info->flow_control_mutex); + } + +-void corosync_ipc_flow_control_local_decrement ( ++void cs_ipc_flow_control_local_decrement ( + void *conn) + { + struct conn_info *conn_info = (struct conn_info *)conn; +diff -Naurd corosync-0.92/exec/ipc.h corosync-trunk/exec/ipc.h +--- corosync-0.92/exec/ipc.h 2008-09-17 21:15:00.000000000 +0200 ++++ corosync-trunk/exec/ipc.h 2008-11-06 22:49:07.000000000 +0100 +@@ -46,52 +46,52 @@ + + extern int message_source_is_local (mar_message_source_t *source); + +-extern void *corosync_conn_partner_get (void *conn); ++extern void *cs_conn_partner_get (void *conn); + +-extern void *corosync_conn_private_data_get (void *conn); ++extern void *cs_conn_private_data_get (void *conn); + +-extern int corosync_conn_send_response (void *conn, void *msg, int mlen); ++extern int cs_conn_send_response (void *conn, void *msg, int mlen); + +-extern int corosync_conn_send_response_no_fcc (void *conn, void *msg,int mlen); ++extern int cs_conn_send_response_no_fcc (void *conn, void *msg,int mlen); + +-extern void corosync_ipc_init ( ++extern void cs_ipc_init ( + void (*serialize_lock_fn) (void), + void (*serialize_unlock_fn) (void), + unsigned int gid_valid); + +-extern int corosync_ipc_timer_add ( ++extern int cs_ipc_timer_add ( + void *conn, + void (*timer_fn) (void *data), + void *data, + unsigned int msec_in_future, + timer_handle *handle); + +-extern void corosync_ipc_timer_del ( ++extern void cs_ipc_timer_del ( + void *conn, + timer_handle timer_handle); + +-extern void corosync_ipc_timer_del_data ( ++extern void cs_ipc_timer_del_data ( + void *conn, + timer_handle timer_handle); + +-extern void corosync_ipc_flow_control_create ( ++extern void cs_ipc_flow_control_create ( + void *conn, + unsigned int service, + char *id, + int id_len, +- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state_set), ++ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state_set), + void *context); + +-extern void corosync_ipc_flow_control_destroy ( ++extern void cs_ipc_flow_control_destroy ( + void *conn, + unsigned int service, + unsigned char *id, + int id_len); + +-extern void corosync_ipc_flow_control_local_increment ( ++extern void cs_ipc_flow_control_local_increment ( + void *conn); + +-extern void corosync_ipc_flow_control_local_decrement ( ++extern void cs_ipc_flow_control_local_decrement ( + void *conn); + + #endif /* IPC_H_DEFINED */ +diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c +--- corosync-0.92/exec/logsys.c 2008-09-17 20:22:58.000000000 +0200 ++++ corosync-trunk/exec/logsys.c 2008-12-02 16:51:03.000000000 +0100 +@@ -1,6 +1,6 @@ + /* + * Copyright (c) 2002-2004 MontaVista Software, Inc. +- * Copyright (c) 2006-2007 Red Hat, Inc. ++ * Copyright (c) 2006-2008 Red Hat, Inc. + * + * Author: Steven Dake (sdake@redhat.com) + * Author: Lon Hohberger (lhh@redhat.com) +@@ -35,13 +35,17 @@ + */ + #include + #include ++#include + #include + #include + #include ++#include ++#include + #include + #include + #include + #include ++#include + #if defined(COROSYNC_LINUX) + #include + #endif +@@ -54,14 +58,31 @@ + #include + + #include +-#include "wthread.h" ++ ++/* ++ * These are not static so they can be read from the core file ++ */ ++int *flt_data; ++ ++int flt_data_size; ++ ++#define SUBSYS_MAX 32 ++ ++#define COMBINE_BUFFER_SIZE 2048 ++ ++struct logsys_logger { ++ char subsys[64]; ++ unsigned int priority; ++ unsigned int tags; ++ unsigned int mode; ++}; + + /* + * Configuration parameters for logging system + */ + static char *logsys_name = NULL; + +-static unsigned int logsys_mode = 0; ++static unsigned int logsys_mode = LOG_MODE_NOSUBSYS; + + static char *logsys_file = NULL; + +@@ -69,35 +90,44 @@ + + static int logsys_facility = LOG_DAEMON; + +-static int logsys_wthread_active = 0; ++static char *logsys_format = NULL; ++ ++/* ++ * operating global variables ++ */ ++static struct logsys_logger logsys_loggers[SUBSYS_MAX]; ++ ++static int wthread_active = 0; ++ ++static int wthread_should_exit = 0; + + static pthread_mutex_t logsys_config_mutex = PTHREAD_MUTEX_INITIALIZER; + +-static pthread_mutex_t logsys_new_log_mutex = PTHREAD_MUTEX_INITIALIZER; ++static unsigned int records_written = 1; + +-static struct worker_thread_group log_thread_group; ++static pthread_t logsys_thread_id; + +-static unsigned int dropped_log_entries = 0; ++static pthread_cond_t logsys_cond; + +-#ifndef MAX_LOGGERS +-#define MAX_LOGGERS 32 +-#endif +-struct logsys_logger logsys_loggers[MAX_LOGGERS]; ++static pthread_mutex_t logsys_cond_mutex; + +-int logsys_single_id = 0; ++static pthread_spinlock_t logsys_idx_spinlock; + ++static unsigned int log_rec_idx; + +-struct log_entry { +- char *file; +- int line; +- int priority; +- char str[128]; +- struct log_entry *next; +-}; ++static int logsys_buffer_full = 0; + +-static struct log_entry *head; ++static char *format_buffer="[%6s] %b"; + +-static struct log_entry *tail; ++static int log_requests_pending = 0; ++ ++static int log_requests_lost = 0; ++ ++void *logsys_rec_end; ++ ++#define FDHEAD_INDEX (flt_data_size) ++ ++#define FDTAIL_INDEX (flt_data_size + 1) + + struct log_data { + unsigned int syslog_pos; +@@ -105,324 +135,674 @@ + char *log_string; + }; + +-enum logsys_config_mutex_state { +- LOGSYS_CONFIG_MUTEX_LOCKED, +- LOGSYS_CONFIG_MUTEX_UNLOCKED +-}; +- + static void logsys_atexit (void); + +-#define LEVELMASK 0x07 /* 3 bits */ +-#define LOG_LEVEL(p) ((p) & LEVELMASK) +-#define LOGSYS_IDMASK (0x3f << 3) /* 6 bits */ +-#define LOG_ID(p) (((p) & LOGSYS_IDMASK) >> 3) +- +-static void logsys_buffer_flush (void); ++/* ++ * Helpers for _logsys_log_rec functionality ++ */ ++static inline void my_memcpy_32bit (int *dest, int *src, unsigned int words) ++{ ++ unsigned int word_idx; ++ for (word_idx = 0; word_idx < words; word_idx++) { ++ dest[word_idx] = src[word_idx]; ++ } ++} + +-void _logsys_nosubsys_set (void) ++static inline void my_memcpy_8bit (char *dest, char *src, unsigned int bytes) + { +- logsys_mode |= LOG_MODE_NOSUBSYS; ++ unsigned int byte_idx; ++ ++ for (byte_idx = 0; byte_idx < bytes; byte_idx++) { ++ dest[byte_idx] = src[byte_idx]; ++ } + } + +-int logsys_facility_id_get (const char *name) ++/* ++ * Before any write operation, a reclaim on the buffer area must be executed ++ */ ++static inline void records_reclaim (unsigned int idx, unsigned int words) + { +- unsigned int i; ++ unsigned int should_reclaim; + +- for (i = 0; facilitynames[i].c_name != NULL; i++) { +- if (strcasecmp(name, facilitynames[i].c_name) == 0) { +- return (facilitynames[i].c_val); ++ should_reclaim = 0; ++ ++ if ((idx + words) >= flt_data_size) { ++ logsys_buffer_full = 1; ++ } ++ if (logsys_buffer_full == 0) { ++ return; ++ } ++ ++ pthread_spin_lock (&logsys_idx_spinlock); ++ if (flt_data[FDTAIL_INDEX] > flt_data[FDHEAD_INDEX]) { ++ if (idx + words >= flt_data[FDTAIL_INDEX]) { ++ should_reclaim = 1; ++ } ++ } else { ++ if ((idx + words) >= (flt_data[FDTAIL_INDEX] + flt_data_size)) { ++ should_reclaim = 1; + } + } +- return (-1); ++ ++ if (should_reclaim) { ++ int words_needed = 0; ++ ++ words_needed = words + 1; ++ do { ++ unsigned int old_tail; ++ ++ words_needed -= flt_data[flt_data[FDTAIL_INDEX]]; ++ old_tail = flt_data[FDTAIL_INDEX]; ++ flt_data[FDTAIL_INDEX] = ++ (flt_data[FDTAIL_INDEX] + ++ flt_data[flt_data[FDTAIL_INDEX]]) % (flt_data_size); ++ if (log_rec_idx == old_tail) { ++ log_requests_lost += 1; ++ log_rec_idx = flt_data[FDTAIL_INDEX]; ++ } ++ } while (words_needed > 0); ++ } ++ pthread_spin_unlock (&logsys_idx_spinlock); + } + +-const char *logsys_facility_name_get (unsigned int facility) ++#define idx_word_step(idx) \ ++do { \ ++ if (idx > (flt_data_size - 1)) { \ ++ idx = 0; \ ++ } \ ++} while (0); ++ ++#define idx_buffer_step(idx) \ ++do { \ ++ if (idx > (flt_data_size - 1)) { \ ++ idx = ((idx) % (flt_data_size)); \ ++ } \ ++} while (0); ++ ++/* ++ * Internal threaded logging implementation ++ */ ++static inline int strcpy_cutoff (char *dest, char *src, int cutoff) + { +- unsigned int i; ++ unsigned int len; + +- for (i = 0; facilitynames[i].c_name != NULL; i++) { +- if (facility == facilitynames[i].c_val) { +- return (facilitynames[i].c_name); ++ if (cutoff == -1) { ++ strcpy (dest, src); ++ return (strlen (dest)); ++ } else { ++ assert (cutoff > 0); ++ strncpy (dest, src, cutoff); ++ dest[cutoff] = '\0'; ++ len = strlen (dest); ++ if (len != cutoff) { ++ memset (&dest[len], ' ', cutoff - len); + } + } +- return (NULL); ++ return (cutoff); + } + +-int logsys_priority_id_get (const char *name) ++/* ++ * %s SUBSYSTEM ++ * %n FUNCTION NAME ++ * %f FILENAME ++ * %l FILELINE ++ * %p PRIORITY ++ * %t TIMESTAMP ++ * %b BUFFER ++ * ++ * any number between % and character specify field length to pad or chop ++*/ ++static void log_printf_to_logs ( ++ char *subsys, ++ char *function_name, ++ char *file_name, ++ int file_line, ++ unsigned int level, ++ char *buffer) + { +- unsigned int i; ++ char output_buffer[COMBINE_BUFFER_SIZE]; ++ char char_time[128]; ++ char line_no[30]; ++ unsigned int format_buffer_idx = 0; ++ unsigned int output_buffer_idx = 0; ++ struct timeval tv; ++ int cutoff; ++ unsigned int len; ++ ++ while (format_buffer[format_buffer_idx]) { ++ cutoff = -1; ++ if (format_buffer[format_buffer_idx] == '%') { ++ format_buffer_idx += 1; ++ if (isdigit (format_buffer[format_buffer_idx])) { ++ cutoff = atoi (&format_buffer[format_buffer_idx]); ++ } ++ while (isdigit (format_buffer[format_buffer_idx])) { ++ format_buffer_idx += 1; ++ } ++ ++ switch (format_buffer[format_buffer_idx]) { ++ case 's': ++ len = strcpy_cutoff (&output_buffer[output_buffer_idx], subsys, cutoff); ++ output_buffer_idx += len; ++ break; + +- for (i = 0; prioritynames[i].c_name != NULL; i++) { +- if (strcasecmp(name, prioritynames[i].c_name) == 0) { +- return (prioritynames[i].c_val); ++ case 'n': ++ len = strcpy_cutoff (&output_buffer[output_buffer_idx], function_name, cutoff); ++ output_buffer_idx += len; ++ break; ++ ++ case 'l': ++ sprintf (line_no, "%d", file_line); ++ len = strcpy_cutoff (&output_buffer[output_buffer_idx], line_no, cutoff); ++ output_buffer_idx += len; ++ break; ++ ++ case 'p': ++ break; ++ ++ case 't': ++ gettimeofday (&tv, NULL); ++ (void)strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S", localtime ((time_t *)&tv.tv_sec)); ++ len = strcpy_cutoff (&output_buffer[output_buffer_idx], char_time, cutoff); ++ output_buffer_idx += len; ++ break; ++ ++ case 'b': ++ len = strcpy_cutoff (&output_buffer[output_buffer_idx], buffer, cutoff); ++ output_buffer_idx += len; ++ break; ++ } ++ format_buffer_idx += 1; ++ } else { ++ output_buffer[output_buffer_idx++] = format_buffer[format_buffer_idx++]; + } + } +- return (-1); ++ ++ output_buffer[output_buffer_idx] = '\0'; ++ ++ /* ++ * Output to syslog ++ */ ++ if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG) { ++ syslog (level, "%s", output_buffer); ++ } ++ ++ /* ++ * Terminate string with \n \0 ++ */ ++ if (logsys_mode & (LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_STDERR)) { ++ output_buffer[output_buffer_idx++] = '\n'; ++ output_buffer[output_buffer_idx] = '\0'; ++ } ++ ++ /* ++ * Output to configured file ++ */ ++ if (logsys_mode & LOG_MODE_OUTPUT_FILE) { ++ /* ++ * Output to a file ++ */ ++ (void)fwrite (output_buffer, strlen (output_buffer), 1, logsys_file_fp); ++ fflush (logsys_file_fp); ++ } ++ ++ /* ++ * Output to stderr ++ */ ++ if (logsys_mode & LOG_MODE_OUTPUT_STDERR) { ++ (void)write (STDERR_FILENO, output_buffer, strlen (output_buffer)); ++ } + } + +-const char *logsys_priority_name_get (unsigned int priority) ++static void record_print (char *buf) + { ++ int *buf_uint32t = (int *)buf; ++ unsigned int rec_size = buf_uint32t[0]; ++ unsigned int rec_ident = buf_uint32t[1]; ++ unsigned int file_line = buf_uint32t[2]; ++ unsigned int level = rec_ident >> 28; + unsigned int i; ++ unsigned int words_processed; ++ unsigned int arg_size_idx; ++ void *arguments[64]; ++ unsigned int arg_count; + +- for (i = 0; prioritynames[i].c_name != NULL; i++) { +- if (priority == prioritynames[i].c_val) { +- return (prioritynames[i].c_name); +- } ++ arg_size_idx = 4; ++ words_processed = 4; ++ arg_count = 0; ++ ++ for (i = 0; words_processed < rec_size; i++) { ++ arguments[arg_count++] = &buf_uint32t[arg_size_idx + 1]; ++ arg_size_idx += buf_uint32t[arg_size_idx] + 1; ++ words_processed += buf_uint32t[arg_size_idx] + 1; + } +- return (NULL); ++ log_printf_to_logs ( ++ (char *)arguments[0], ++ (char *)arguments[1], ++ (char *)arguments[2], ++ file_line, ++ level, ++ (char *)arguments[3]); + } ++ ++static int record_read (char *buf, int rec_idx, int *log_msg) { ++ unsigned int rec_size; ++ unsigned int rec_ident; ++ int firstcopy, secondcopy; + +-unsigned int logsys_config_subsys_set ( +- const char *subsys, +- unsigned int tags, +- unsigned int priority) +-{ +- int i; ++ rec_size = flt_data[rec_idx]; ++ rec_ident = flt_data[(rec_idx + 1) % flt_data_size]; + +- pthread_mutex_lock (&logsys_config_mutex); +- for (i = 0; i < MAX_LOGGERS; i++) { +- if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { +- logsys_loggers[i].tags = tags; +- logsys_loggers[i].priority = priority; ++ /* ++ * Not a log record ++ */ ++ if ((rec_ident & LOGSYS_TAG_LOG) == 0) { ++ *log_msg = 0; ++ return ((rec_idx + rec_size) % flt_data_size); ++ } + +- break; +- } ++ /* ++ * A log record ++ */ ++ *log_msg = 1; ++ ++ firstcopy = rec_size; ++ secondcopy = 0; ++ if (firstcopy + rec_idx > flt_data_size) { ++ firstcopy = flt_data_size - rec_idx; ++ secondcopy -= firstcopy - rec_size; ++ } ++ memcpy (&buf[0], &flt_data[rec_idx], firstcopy << 2); ++ if (secondcopy) { ++ memcpy (&buf[(firstcopy << 2)], &flt_data[0], secondcopy << 2); ++ } ++ return ((rec_idx + rec_size) % flt_data_size); ++} ++ ++static inline void wthread_signal (void) ++{ ++ if (wthread_active == 0) { ++ return; + } ++ pthread_mutex_lock (&logsys_cond_mutex); ++ pthread_cond_signal (&logsys_cond); ++ pthread_mutex_unlock (&logsys_cond_mutex); ++} + +- if (i == MAX_LOGGERS) { +- for (i = 0; i < MAX_LOGGERS; i++) { +- if (strcmp (logsys_loggers[i].subsys, "") == 0) { +- strncpy (logsys_loggers[i].subsys, subsys, +- sizeof(logsys_loggers[i].subsys)); +- logsys_loggers[i].tags = tags; +- logsys_loggers[i].priority = priority; ++static inline void wthread_wait (void) ++{ ++ pthread_mutex_lock (&logsys_cond_mutex); ++ pthread_cond_wait (&logsys_cond, &logsys_cond_mutex); ++ pthread_mutex_unlock (&logsys_cond_mutex); ++} ++ ++static inline void wthread_wait_locked (void) ++{ ++ pthread_cond_wait (&logsys_cond, &logsys_cond_mutex); ++ pthread_mutex_unlock (&logsys_cond_mutex); ++} ++ ++static void *logsys_worker_thread (void *data) ++{ ++ int log_msg; ++ char buf[COMBINE_BUFFER_SIZE]; ++ ++ /* ++ * Signal wthread_create that the initialization process may continue ++ */ ++ wthread_signal (); ++ pthread_spin_lock (&logsys_idx_spinlock); ++ log_rec_idx = flt_data[FDTAIL_INDEX]; ++ pthread_spin_unlock (&logsys_idx_spinlock); ++ ++ for (;;) { ++ wthread_wait (); ++ /* ++ * Read and copy the logging record index position ++ * It may have been updated by records_reclaim if ++ * messages were lost or or log_rec on the first new ++ * logging record available ++ */ ++ /* ++ * Process any pending log messages here ++ */ ++ for (;;) { ++ pthread_spin_lock (&logsys_idx_spinlock); ++ if (log_requests_lost > 0) { ++ printf ("lost %d log requests\n", log_requests_lost); ++ log_requests_pending -= log_requests_lost; ++ log_requests_lost = 0; ++ } ++ if (log_requests_pending == 0) { ++ pthread_spin_unlock (&logsys_idx_spinlock); + break; + } ++ log_rec_idx = record_read (buf, log_rec_idx, &log_msg); ++ if (log_msg) { ++ log_requests_pending -= 1; ++ } ++ pthread_spin_unlock (&logsys_idx_spinlock); ++ ++ /* ++ * print the stored buffer ++ */ ++ if (log_msg) { ++ record_print (buf); ++ } ++ } ++ ++ if (wthread_should_exit) { ++ pthread_exit (NULL); + } + } +- assert(i < MAX_LOGGERS); ++} + +- pthread_mutex_unlock (&logsys_config_mutex); +- return i; ++static void wthread_create (void) ++{ ++ int res; ++ ++ if (wthread_active) { ++ return; ++ } ++ ++ wthread_active = 1; ++ ++ pthread_mutex_init (&logsys_cond_mutex, NULL); ++ pthread_cond_init (&logsys_cond, NULL); ++ pthread_mutex_lock (&logsys_cond_mutex); ++ res = pthread_create (&logsys_thread_id, NULL, ++ logsys_worker_thread, NULL); ++ ++ ++ /* ++ * Wait for thread to be started ++ */ ++ wthread_wait_locked (); + } + +-inline int logsys_mkpri (int priority, int id) ++/* ++ * Internal API - exported ++ */ ++void _logsys_nosubsys_set (void) + { +- return (((id) << 3) | (priority)); ++ logsys_mode |= LOG_MODE_NOSUBSYS; + } + +-int logsys_config_subsys_get ( ++unsigned int _logsys_subsys_create ( + const char *subsys, +- unsigned int *tags, +- unsigned int *priority) ++ unsigned int priority) + { +- unsigned int i; ++ assert (subsys != NULL); + +- pthread_mutex_lock (&logsys_config_mutex); ++ return logsys_config_subsys_set ( ++ subsys, ++ LOGSYS_TAG_LOG, ++ priority); ++} + +- for (i = 0; i < MAX_LOGGERS; i++) { +- if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { +- *tags = logsys_loggers[i].tags; +- *priority = logsys_loggers[i].priority; +- pthread_mutex_unlock (&logsys_config_mutex); +- return i; ++int _logsys_wthread_create (void) ++{ ++ if ((logsys_mode & LOG_MODE_FORK) == 0) { ++ if (logsys_name != NULL) { ++ openlog (logsys_name, LOG_CONS|LOG_PID, logsys_facility); + } ++ wthread_create(); ++ atexit (logsys_atexit); + } +- +- pthread_mutex_unlock (&logsys_config_mutex); +- +- return (-1); ++ return (0); + } + +-static void buffered_log_printf ( +- char *file, +- int line, +- int priority, +- char *format, +- va_list ap) ++int _logsys_rec_init (unsigned int size) + { +- struct log_entry *entry = malloc(sizeof(struct log_entry)); ++ /* ++ * First record starts at zero ++ * Last record ends at zero ++ */ ++ flt_data = malloc ((size + 2) * sizeof (unsigned int)); ++ assert (flt_data != NULL); ++ flt_data_size = size; ++ assert (flt_data != NULL); ++ flt_data[FDHEAD_INDEX] = 0; ++ flt_data[FDTAIL_INDEX] = 0; ++ pthread_spin_init (&logsys_idx_spinlock, 0); + +- entry->file = file; +- entry->line = line; +- entry->priority = priority; +- entry->next = NULL; +- if (head == NULL) { +- head = tail = entry; +- } else { +- tail->next = entry; +- tail = entry; +- } +- vsnprintf(entry->str, sizeof(entry->str), format, ap); ++ return (0); + } + +-static void log_printf_worker_fn (void *thread_data, void *work_item) ++ ++/* ++ * u32 RECORD SIZE ++ * u32 record ident ++ * u32 arg count ++ * u32 file line ++ * u32 subsys length ++ * buffer null terminated subsys ++ * u32 filename length ++ * buffer null terminated filename ++ * u32 filename length ++ * buffer null terminated function ++ * u32 arg1 length ++ * buffer arg1 ++ * ... repeats length & arg ++ */ ++void _logsys_log_rec ( ++ int subsys, ++ char *function_name, ++ char *file_name, ++ int file_line, ++ unsigned int rec_ident, ++ ...) + { +- struct log_data *log_data = (struct log_data *)work_item; ++ va_list ap; ++ void *buf_args[64]; ++ unsigned int buf_len[64]; ++ unsigned int i; ++ unsigned int idx; ++ unsigned int arguments = 0; ++ unsigned int record_reclaim_size; ++ unsigned int index_start; ++ int words_written; + +- if (logsys_wthread_active) +- pthread_mutex_lock (&logsys_config_mutex); ++ record_reclaim_size = 0; ++ + /* +- * Output the log data ++ * Decode VA Args + */ +- if (logsys_mode & LOG_MODE_OUTPUT_FILE && logsys_file_fp != 0) { +- fprintf (logsys_file_fp, "%s", log_data->log_string); +- fflush (logsys_file_fp); ++ va_start (ap, rec_ident); ++ arguments = 3; ++ for (;;) { ++ assert (arguments < 64); ++ buf_args[arguments] = va_arg (ap, void *); ++ if (buf_args[arguments] == LOG_REC_END) { ++ break; ++ } ++ buf_len[arguments] = va_arg (ap, int); ++ record_reclaim_size += ((buf_len[arguments] + 3) >> 2) + 1; ++ arguments++; + } +- if (logsys_mode & LOG_MODE_OUTPUT_STDERR) { +- fprintf (stderr, "%s", log_data->log_string); +- fflush (stdout); ++ va_end (ap); ++ ++ /* ++ * Encode logsys subsystem identity, filename, and function ++ */ ++ buf_args[0] = logsys_loggers[subsys].subsys; ++ buf_len[0] = strlen (logsys_loggers[subsys].subsys) + 1; ++ buf_args[1] = file_name; ++ buf_len[1] = strlen (file_name) + 1; ++ buf_args[2] = function_name; ++ buf_len[2] = strlen (function_name) + 1; ++ for (i = 0; i < 3; i++) { ++ record_reclaim_size += ((buf_len[i] + 3) >> 2) + 1; + } + +- /* release mutex here in case syslog blocks */ +- if (logsys_wthread_active) +- pthread_mutex_unlock (&logsys_config_mutex); ++ idx = flt_data[FDHEAD_INDEX]; ++ index_start = idx; + +- if ((logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) && +- (!((logsys_mode & LOG_MODE_FILTER_DEBUG_FROM_SYSLOG) && +- (log_data->priority == LOG_LEVEL_DEBUG)))) { +- syslog (log_data->priority, +- &log_data->log_string[log_data->syslog_pos]); +- } +- free (log_data->log_string); +-} ++ /* ++ * Reclaim data needed for record including 4 words for the header ++ */ ++ records_reclaim (idx, record_reclaim_size + 4); + +-static void _log_printf ( +- enum logsys_config_mutex_state config_mutex_state, +- char *file, +- int line, +- int priority, +- int id, +- char *format, +- va_list ap) +-{ +- char newstring[4096]; +- char log_string[4096]; +- char char_time[512]; +- char *p = NULL; +- struct timeval tv; +- int i = 0; +- int len; +- struct log_data log_data; +- unsigned int res = 0; ++ /* ++ * Write record size of zero and rest of header information ++ */ ++ flt_data[idx++] = 0; ++ idx_word_step(idx); + +- assert (id < MAX_LOGGERS); ++ flt_data[idx++] = rec_ident; ++ idx_word_step(idx); + +- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { +- pthread_mutex_lock (&logsys_config_mutex); +- } +- pthread_mutex_lock (&logsys_new_log_mutex); ++ flt_data[idx++] = file_line; ++ idx_word_step(idx); ++ ++ flt_data[idx++] = records_written; ++ idx_word_step(idx); + /* +- ** Buffer before log has been configured has been called. +- */ +- if (logsys_mode & LOG_MODE_BUFFER_BEFORE_CONFIG) { +- buffered_log_printf(file, line, logsys_mkpri(priority, id), format, ap); +- pthread_mutex_unlock (&logsys_new_log_mutex); +- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { +- pthread_mutex_unlock (&logsys_config_mutex); +- } +- return; +- } ++ * Encode all of the arguments into the log message ++ */ ++ for (i = 0; i < arguments; i++) { ++ unsigned int bytes; ++ unsigned int full_words; ++ unsigned int total_words; + +- if (((logsys_mode & LOG_MODE_OUTPUT_FILE) || (logsys_mode & LOG_MODE_OUTPUT_STDERR)) && +- (logsys_mode & LOG_MODE_DISPLAY_TIMESTAMP)) { +- gettimeofday (&tv, NULL); +- strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S", +- localtime ((time_t *)&tv.tv_sec)); +- i = sprintf (newstring, "%s.%06ld ", char_time, (long)tv.tv_usec); +- } ++ bytes = buf_len[i]; ++ full_words = bytes >> 2; ++ total_words = (bytes + 3) >> 2; ++ ++ flt_data[idx++] = total_words; ++ idx_word_step(idx); + +- if ((priority == LOG_LEVEL_DEBUG) || (logsys_mode & LOG_MODE_DISPLAY_FILELINE)) { +- if (logsys_mode & LOG_MODE_SHORT_FILELINE) { +- p = strrchr(file, '/'); +- if (p) +- file = ++p; +- } +- sprintf (&newstring[i], "[%s:%04u] %s", file, line, format); +- } else { +- if (logsys_mode & LOG_MODE_NOSUBSYS) { +- sprintf (&newstring[i], "%s", format); +- } else { +- sprintf (&newstring[i], "[%-5s] %s", logsys_loggers[id].subsys, format); +- } +- } +- if (dropped_log_entries) { + /* +- * Get rid of \n if there is one ++ * determine if this is a wrapped write or normal write + */ +- if (newstring[strlen (newstring) - 1] == '\n') { +- newstring[strlen (newstring) - 1] = '\0'; ++ if (idx + total_words < flt_data_size) { ++ /* ++ * dont need to wrap buffer ++ */ ++ my_memcpy_32bit (&flt_data[idx], buf_args[i], full_words); ++ if (bytes % 4) { ++ my_memcpy_8bit ((char *)&flt_data[idx + full_words], ++ ((char *)buf_args[i]) + (full_words << 2), bytes % 4); ++ } ++ } else { ++ /* ++ * need to wrap buffer ++ */ ++ unsigned int first; ++ unsigned int second; ++ ++ first = flt_data_size - idx; ++ if (first > full_words) { ++ first = full_words; ++ } ++ second = full_words - first; ++ my_memcpy_32bit (&flt_data[idx], (int *)buf_args[i], first); ++ my_memcpy_32bit (&flt_data[0], ++ (int *)(((unsigned char *)buf_args[i]) + (first << 2)), ++ second); ++ if (bytes % 4) { ++ my_memcpy_8bit ((char *)&flt_data[0 + second], ++ ((char *)buf_args[i]) + (full_words << 2), bytes % 4); ++ } + } +- len = sprintf (log_string, +- "%s - prior to this log entry, corosync logger dropped '%d' messages because of overflow.", newstring, dropped_log_entries + 1); +- } else { +- len = vsprintf (log_string, newstring, ap); ++ idx += total_words; ++ idx_buffer_step (idx); ++ } ++ words_written = idx - index_start; ++ if (words_written < 0) { ++ words_written += flt_data_size; + } + + /* +- ** add line feed if not done yet +- */ +- if (log_string[len - 1] != '\n') { +- log_string[len] = '\n'; +- log_string[len + 1] = '\0'; +- } ++ * Commit the write of the record size now that the full record ++ * is in the memory buffer ++ */ ++ flt_data[index_start] = words_written; + + /* +- * Create work thread data ++ * If the index of the current head equals the current log_rec_idx, ++ * and this is not a log_printf operation, set the log_rec_idx to ++ * the new head position and commit the new head. + */ +- log_data.syslog_pos = i; +- log_data.priority = priority; +- log_data.log_string = strdup (log_string); +- if (log_data.log_string == NULL) { +- goto drop_log_msg; ++ pthread_spin_lock (&logsys_idx_spinlock); ++ if (rec_ident & LOGSYS_TAG_LOG) { ++ log_requests_pending += 1; + } +- +- if (logsys_wthread_active) { +- res = worker_thread_group_work_add (&log_thread_group, &log_data); +- if (res == 0) { +- dropped_log_entries = 0; +- } else { +- dropped_log_entries += 1; +- } +- } else { +- log_printf_worker_fn (NULL, &log_data); ++ if (log_requests_pending == 0) { ++ log_rec_idx = idx; + } ++ flt_data[FDHEAD_INDEX] = idx; ++ pthread_spin_unlock (&logsys_idx_spinlock); ++ records_written++; ++} + +- pthread_mutex_unlock (&logsys_new_log_mutex); +- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { +- pthread_mutex_unlock (&logsys_config_mutex); ++void _logsys_log_printf ( ++ int subsys, ++ char *function_name, ++ char *file_name, ++ int file_line, ++ unsigned int level, ++ char *format, ++ ...) ++{ ++ char logsys_print_buffer[COMBINE_BUFFER_SIZE]; ++ unsigned int len; ++ va_list ap; ++ ++ if (logsys_mode & LOG_MODE_NOSUBSYS) { ++ subsys = 0; ++ } ++ if (level > logsys_loggers[subsys].priority) { ++ return; ++ } ++ va_start (ap, format); ++ len = vsprintf (logsys_print_buffer, format, ap); ++ va_end (ap); ++ if (logsys_print_buffer[len - 1] == '\n') { ++ logsys_print_buffer[len - 1] = '\0'; ++ len -= 1; + } +- return; + +-drop_log_msg: +- dropped_log_entries++; +- pthread_mutex_unlock (&logsys_new_log_mutex); +- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { +- pthread_mutex_unlock (&logsys_config_mutex); ++ /* ++ * Create a log record ++ */ ++ _logsys_log_rec (subsys, ++ function_name, ++ file_name, ++ file_line, ++ (level+1) << 28, ++ logsys_print_buffer, len + 1, ++ LOG_REC_END); ++ ++ if ((logsys_mode & LOG_MODE_THREADED) == 0) { ++ /* ++ * Output (and block) if the log mode is not threaded otherwise ++ * expect the worker thread to output the log data once signaled ++ */ ++ log_printf_to_logs (logsys_loggers[subsys].subsys, ++ function_name, file_name, file_line, level, ++ logsys_print_buffer); ++ } else { ++ /* ++ * Signal worker thread to display logging output ++ */ ++ wthread_signal (); + } + } + +-unsigned int _logsys_subsys_create ( +- const char *subsys, +- unsigned int priority) ++/* ++ * External Configuration and Initialization API ++ */ ++void logsys_fork_completed (void) + { +- assert (subsys != NULL); +- +- return logsys_config_subsys_set ( +- subsys, +- LOGSYS_TAG_LOG, +- priority); ++ logsys_mode &= ~LOG_MODE_FORK; ++ _logsys_wthread_create (); + } + +- + void logsys_config_mode_set (unsigned int mode) + { + pthread_mutex_lock (&logsys_config_mutex); + logsys_mode = mode; +- if (mode & LOG_MODE_FLUSH_AFTER_CONFIG) { +- _logsys_wthread_create (); +- logsys_buffer_flush (); +- } + pthread_mutex_unlock (&logsys_config_mutex); + } + +@@ -439,7 +819,6 @@ + return (0); + } + +- pthread_mutex_lock (&logsys_new_log_mutex); + pthread_mutex_lock (&logsys_config_mutex); + + if (logsys_mode & LOG_MODE_OUTPUT_FILE) { +@@ -454,222 +833,218 @@ + file, strerror (errno)); + *error_string = error_string_response; + pthread_mutex_unlock (&logsys_config_mutex); +- pthread_mutex_unlock (&logsys_new_log_mutex); + return (-1); + } + } + + pthread_mutex_unlock (&logsys_config_mutex); +- pthread_mutex_unlock (&logsys_new_log_mutex); + return (0); + } + +-void logsys_config_facility_set (char *name, unsigned int facility) ++void logsys_format_set (char *format) + { +- pthread_mutex_lock (&logsys_new_log_mutex); + pthread_mutex_lock (&logsys_config_mutex); + +- logsys_name = name; +- logsys_facility = facility; ++ logsys_format = format; + + pthread_mutex_unlock (&logsys_config_mutex); +- pthread_mutex_unlock (&logsys_new_log_mutex); + } + +-void _logsys_config_priority_set (unsigned int id, unsigned int priority) ++void logsys_config_facility_set (char *name, unsigned int facility) + { +- pthread_mutex_lock (&logsys_new_log_mutex); ++ pthread_mutex_lock (&logsys_config_mutex); + +- logsys_loggers[id].priority = priority; ++ logsys_name = name; ++ logsys_facility = facility; + +- pthread_mutex_unlock (&logsys_new_log_mutex); ++ pthread_mutex_unlock (&logsys_config_mutex); + } + +-static void child_cleanup (void) ++int logsys_facility_id_get (const char *name) + { +- memset(&log_thread_group, 0, sizeof(log_thread_group)); +- logsys_wthread_active = 0; +- pthread_mutex_init(&logsys_config_mutex, NULL); +- pthread_mutex_init(&logsys_new_log_mutex, NULL); ++ unsigned int i; ++ ++ for (i = 0; facilitynames[i].c_name != NULL; i++) { ++ if (strcasecmp(name, facilitynames[i].c_name) == 0) { ++ return (facilitynames[i].c_val); ++ } ++ } ++ return (-1); + } + +-int _logsys_wthread_create (void) ++const char *logsys_facility_name_get (unsigned int facility) + { +- worker_thread_group_init ( +- &log_thread_group, +- 1, +- 1024, +- sizeof (struct log_data), +- 0, +- NULL, +- log_printf_worker_fn); +- +- logsys_flush(); +- +- atexit (logsys_atexit); +- pthread_atfork(NULL, NULL, child_cleanup); ++ unsigned int i; + +- if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED && logsys_name != NULL) { +- openlog (logsys_name, LOG_CONS|LOG_PID, logsys_facility); ++ for (i = 0; facilitynames[i].c_name != NULL; i++) { ++ if (facility == facilitynames[i].c_val) { ++ return (facilitynames[i].c_name); ++ } + } +- +- logsys_wthread_active = 1; +- +- return (0); ++ return (NULL); + } + +-void logsys_log_printf ( +- char *file, +- int line, +- int priority, +- char *format, +- ...) ++int logsys_priority_id_get (const char *name) + { +- int id = LOG_ID(priority); +- int level = LOG_LEVEL(priority); +- va_list ap; +- +- assert (id < MAX_LOGGERS); ++ unsigned int i; + +- if (LOG_LEVEL(priority) > logsys_loggers[id].priority) { +- return; ++ for (i = 0; prioritynames[i].c_name != NULL; i++) { ++ if (strcasecmp(name, prioritynames[i].c_name) == 0) { ++ return (prioritynames[i].c_val); ++ } + } +- +- va_start (ap, format); +- _log_printf (LOGSYS_CONFIG_MUTEX_UNLOCKED, file, line, level, id, +- format, ap); +- va_end(ap); ++ return (-1); + } + +-static void logsys_log_printf_locked ( +- char *file, +- int line, +- int priority, +- char *format, +- ...) ++const char *logsys_priority_name_get (unsigned int priority) + { +- int id = LOG_ID(priority); +- int level = LOG_LEVEL(priority); +- va_list ap; +- +- assert (id < MAX_LOGGERS); ++ unsigned int i; + +- if (LOG_LEVEL(priority) > logsys_loggers[id].priority) { +- return; ++ for (i = 0; prioritynames[i].c_name != NULL; i++) { ++ if (priority == prioritynames[i].c_val) { ++ return (prioritynames[i].c_name); ++ } + } +- +- va_start (ap, format); +- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, level, id, +- format, ap); +- va_end(ap); ++ return (NULL); + } + +-void _logsys_log_printf2 ( +- char *file, +- int line, +- int priority, +- int id, +- char *format, ...) ++unsigned int logsys_config_subsys_set ( ++ const char *subsys, ++ unsigned int tags, ++ unsigned int priority) + { +- va_list ap; ++ int i; + +- assert (id < MAX_LOGGERS); ++ pthread_mutex_lock (&logsys_config_mutex); ++ for (i = 0; i < SUBSYS_MAX; i++) { ++ if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { ++ logsys_loggers[i].tags = tags; ++ logsys_loggers[i].priority = priority; + +- va_start (ap, format); +- _log_printf (LOGSYS_CONFIG_MUTEX_UNLOCKED, file, line, priority, id, +- format, ap); +- va_end(ap); ++ break; ++ } ++ } ++ ++ if (i == SUBSYS_MAX) { ++ for (i = 0; i < SUBSYS_MAX; i++) { ++ if (strcmp (logsys_loggers[i].subsys, "") == 0) { ++ strncpy (logsys_loggers[i].subsys, subsys, ++ sizeof(logsys_loggers[i].subsys)); ++ logsys_loggers[i].tags = tags; ++ logsys_loggers[i].priority = priority; ++ break; ++ } ++ } ++ } ++ assert(i < SUBSYS_MAX); ++ ++ pthread_mutex_unlock (&logsys_config_mutex); ++ return i; + } + +-void _logsys_trace (char *file, int line, int tag, int id, char *format, ...) ++int logsys_config_subsys_get ( ++ const char *subsys, ++ unsigned int *tags, ++ unsigned int *priority) + { +- assert (id < MAX_LOGGERS); ++ unsigned int i; + + pthread_mutex_lock (&logsys_config_mutex); + +- if (tag & logsys_loggers[id].tags) { +- va_list ap; +- +- va_start (ap, format); +- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, +- LOG_LEVEL_DEBUG, id, format, ap); +- va_end(ap); ++ for (i = 0; i < SUBSYS_MAX; i++) { ++ if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { ++ *tags = logsys_loggers[i].tags; ++ *priority = logsys_loggers[i].priority; ++ pthread_mutex_unlock (&logsys_config_mutex); ++ return i; ++ } + } ++ + pthread_mutex_unlock (&logsys_config_mutex); ++ ++ return (-1); + } + +-static void logsys_atexit (void) ++int logsys_log_rec_store (char *filename) + { +- if (logsys_wthread_active) { +- worker_thread_group_wait (&log_thread_group); ++ int fd; ++ ssize_t written_size; ++ size_t size_to_write = (flt_data_size + 2) * sizeof (unsigned int); ++ ++ fd = open (filename, O_CREAT|O_RDWR, 0700); ++ if (fd == -1) { ++ return (-1); + } +- if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) { +- closelog (); ++ ++ written_size = write (fd, flt_data, size_to_write); ++ if (written_size < 0) { ++ return (-1); ++ } else if ((size_t)written_size != size_to_write) { ++ return (-1); + } ++ return (0); + } + +-static void logsys_buffer_flush (void) ++static void logsys_atexit (void) + { +- struct log_entry *entry = head; +- struct log_entry *tmp; +- +- if (logsys_mode & LOG_MODE_FLUSH_AFTER_CONFIG) { +- logsys_mode &= ~LOG_MODE_FLUSH_AFTER_CONFIG; +- +- while (entry) { +- logsys_log_printf_locked ( +- entry->file, +- entry->line, +- entry->priority, +- entry->str); +- tmp = entry; +- entry = entry->next; +- free (tmp); +- } ++ if (wthread_active) { ++ wthread_should_exit = 1; ++ wthread_signal (); ++ pthread_join (logsys_thread_id, NULL); + } +- +- head = tail = NULL; + } + +-void logsys_flush (void) ++void logsys_atsegv (void) + { +- worker_thread_group_wait (&log_thread_group); ++ if (wthread_active) { ++ wthread_should_exit = 1; ++ wthread_signal (); ++ pthread_join (logsys_thread_id, NULL); ++ } + } + +-int logsys_init (char *name, int mode, int facility, int priority, char *file) ++int logsys_init ( ++ char *name, ++ int mode, ++ int facility, ++ int priority, ++ char *file, ++ char *format, ++ int rec_size) + { + char *errstr; + +- /* logsys_subsys_id will be 0 */ +- logsys_single_id = 1; +- ++ _logsys_nosubsys_set (); ++ _logsys_subsys_create (name, priority); + strncpy (logsys_loggers[0].subsys, name, + sizeof (logsys_loggers[0].subsys)); + logsys_config_mode_set (mode); + logsys_config_facility_set (name, facility); + logsys_config_file_set (&errstr, file); +- _logsys_config_priority_set (0, priority); +- if ((mode & LOG_MODE_BUFFER_BEFORE_CONFIG) == 0) { +- _logsys_wthread_create (); +- } ++ logsys_format_set (format); ++ _logsys_rec_init (rec_size); ++ _logsys_wthread_create (); + return (0); + } + +-int logsys_conf (char *name, int mode, int facility, int priority, char *file) ++int logsys_conf ( ++ char *name, ++ int mode, ++ int facility, ++ int priority, ++ char *file) + { + char *errstr; + ++ _logsys_rec_init (100000); + strncpy (logsys_loggers[0].subsys, name, + sizeof (logsys_loggers[0].subsys)); + logsys_config_mode_set (mode); + logsys_config_facility_set (name, facility); + logsys_config_file_set (&errstr, file); +- _logsys_config_priority_set (0, priority); + return (0); + } + + void logsys_exit (void) + { +- logsys_flush (); + } +- +diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c +--- corosync-0.92/exec/main.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/exec/main.c 2008-12-08 16:55:41.000000000 +0100 +@@ -56,7 +56,7 @@ + #include + + #include +-#include ++#include + #include + #include + #include +@@ -66,6 +66,7 @@ + #include + #include + ++#include "quorum.h" + #include "totemsrp.h" + #include "mempool.h" + #include "mainconfig.h" +@@ -83,9 +84,11 @@ + #include "version.h" + + LOGSYS_DECLARE_SYSTEM ("corosync", +- LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_BUFFER_BEFORE_CONFIG, ++ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED | LOG_MODE_FORK, + NULL, +- LOG_DAEMON); ++ LOG_DAEMON, ++ "[%6s] %b", ++ 1000000); + + LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO); + +@@ -145,7 +148,6 @@ + #endif + + totempg_finalize (); +- logsys_flush (); + + corosync_exit_error (AIS_DONE_EXIT); + +@@ -170,15 +172,17 @@ + + static void sigsegv_handler (int num) + { +- signal (SIGSEGV, SIG_DFL); +- logsys_flush (); ++ (void)signal (SIGSEGV, SIG_DFL); ++ logsys_atsegv(); ++ logsys_log_rec_store ("/var/lib/corosync/fdata"); + raise (SIGSEGV); + } + + static void sigabrt_handler (int num) + { +- signal (SIGABRT, SIG_DFL); +- logsys_flush (); ++ (void)signal (SIGABRT, SIG_DFL); ++ logsys_atsegv(); ++ logsys_log_rec_store ("/var/lib/corosync/fdata"); + raise (SIGABRT); + } + +@@ -341,7 +345,7 @@ + } + + /* Create new session */ +- setsid(); ++ (void)setsid(); + + /* + * Map stdin/out/err to /dev/null. +@@ -408,7 +412,6 @@ + #endif + } + +- + static void deliver_fn ( + unsigned int nodeid, + struct iovec *iovec, +@@ -448,6 +451,8 @@ + */ + service = header->id >> 16; + fn_id = header->id & 0xffff; ++ if (!ais_service[service]) ++ return; + if (endian_conversion_required) { + assert(ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn != NULL); + ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn +@@ -494,7 +499,6 @@ + char *iface; + int res, ch; + int background, setprio; +- int totem_log_service; + + /* default configuration + */ +@@ -506,7 +510,7 @@ + switch (ch) { + case 'f': + background = 0; +- logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR|LOG_MODE_FLUSH_AFTER_CONFIG); ++ logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR|LOG_MODE_THREADED|LOG_MODE_FORK); + break; + case 'p': + setprio = 0; +@@ -527,11 +531,11 @@ + log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2002-2006 MontaVista Software, Inc and contributors.\n"); + log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2006-2008 Red Hat, Inc.\n"); + +- signal (SIGINT, sigintr_handler); +- signal (SIGUSR2, sigusr2_handler); +- signal (SIGSEGV, sigsegv_handler); +- signal (SIGABRT, sigabrt_handler); +- signal (SIGQUIT, sigquit_handler); ++ (void)signal (SIGINT, sigintr_handler); ++ (void)signal (SIGUSR2, sigusr2_handler); ++ (void)signal (SIGSEGV, sigsegv_handler); ++ (void)signal (SIGABRT, sigabrt_handler); ++ (void)signal (SIGQUIT, sigquit_handler); + + corosync_timer_init ( + serialize_mutex_lock, +@@ -639,6 +643,8 @@ + logsys_config_mode_set (main_config.logmode); + logsys_config_file_set (&error_string, main_config.logfile); + ++ logsys_fork_completed (); ++ + aisexec_uid_determine (&main_config); + + aisexec_gid_determine (&main_config); +@@ -654,13 +660,14 @@ + aisexec_mlockall (); + + totem_config.totem_logging_configuration = totem_logging_configuration; +- totem_log_service = _logsys_subsys_create ("TOTEM", LOG_INFO); +- totem_config.totem_logging_configuration.log_level_security = logsys_mkpri (LOG_LEVEL_SECURITY, totem_log_service); +- totem_config.totem_logging_configuration.log_level_error = logsys_mkpri (LOG_LEVEL_ERROR, totem_log_service); +- totem_config.totem_logging_configuration.log_level_warning = logsys_mkpri (LOG_LEVEL_WARNING, totem_log_service); +- totem_config.totem_logging_configuration.log_level_notice = logsys_mkpri (LOG_LEVEL_NOTICE, totem_log_service); +- totem_config.totem_logging_configuration.log_level_debug = logsys_mkpri (LOG_LEVEL_DEBUG, totem_log_service); +- totem_config.totem_logging_configuration.log_printf = logsys_log_printf; ++ totem_config.totem_logging_configuration.log_subsys_id = ++ _logsys_subsys_create ("TOTEM", LOG_INFO); ++ totem_config.totem_logging_configuration.log_level_security = LOG_LEVEL_SECURITY; ++ totem_config.totem_logging_configuration.log_level_error = LOG_LEVEL_ERROR; ++ totem_config.totem_logging_configuration.log_level_warning = LOG_LEVEL_WARNING; ++ totem_config.totem_logging_configuration.log_level_notice = LOG_LEVEL_NOTICE; ++ totem_config.totem_logging_configuration.log_level_debug = LOG_LEVEL_DEBUG; ++ totem_config.totem_logging_configuration.log_printf = _logsys_log_printf; + + /* + * Sleep for a while to let other nodes in the cluster +@@ -704,11 +711,9 @@ + } + + +- sync_register (corosync_sync_callbacks_retrieve, corosync_sync_completed, +- totem_config.vsf_type); +- ++ sync_register (corosync_sync_callbacks_retrieve, corosync_sync_completed); + +- res = corosync_flow_control_initialize (); ++ res = cs_flow_control_initialize (); + + /* + * Drop root privleges to user 'ais' +@@ -722,7 +727,7 @@ + + aisexec_mempool_init (); + +- corosync_ipc_init ( ++ cs_ipc_init ( + serialize_mutex_lock, + serialize_mutex_unlock, + gid_valid); +diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c +--- corosync-0.92/exec/mainconfig.c 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/exec/mainconfig.c 2008-11-06 22:49:07.000000000 +0100 +@@ -41,7 +41,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +@@ -109,8 +109,6 @@ + char *error_reason = error_string_response; + unsigned int object_find_handle; + unsigned int object_find_logsys_handle; +- int global_debug = 0; +- + + memset (main_config, 0, sizeof (struct main_config)); + +@@ -120,7 +118,7 @@ + strlen ("logging"), + &object_find_handle); + +- main_config->logmode = LOG_MODE_FLUSH_AFTER_CONFIG; ++ main_config->logmode = LOG_MODE_THREADED | LOG_MODE_FORK; + if (objdb->object_find_next ( + object_find_handle, + &object_service_handle) == 0) { +@@ -135,10 +133,10 @@ + } + if (!objdb_get_string (objdb,object_service_handle, "to_syslog", &value)) { + if (strcmp (value, "yes") == 0) { +- main_config->logmode |= LOG_MODE_OUTPUT_SYSLOG_THREADED; ++ main_config->logmode |= LOG_MODE_OUTPUT_SYSLOG; + } else + if (strcmp (value, "no") == 0) { +- main_config->logmode &= ~LOG_MODE_OUTPUT_SYSLOG_THREADED; ++ main_config->logmode &= ~LOG_MODE_OUTPUT_SYSLOG; + } + } + if (!objdb_get_string (objdb,object_service_handle, "to_stderr", &value)) { +@@ -149,18 +147,8 @@ + main_config->logmode &= ~LOG_MODE_OUTPUT_STDERR; + } + } +- +- if (!objdb_get_string (objdb,object_service_handle, "debug", &value)) { +- if (strcmp (value, "on") == 0) { +- global_debug = 1; +- } else +- if (strcmp (value, "off") == 0) { +- global_debug = 0; +- } else { +- goto parse_error; +- } +- } + if (!objdb_get_string (objdb,object_service_handle, "timestamp", &value)) { ++/* todo change format string + if (strcmp (value, "on") == 0) { + main_config->logmode |= LOG_MODE_DISPLAY_TIMESTAMP; + } else +@@ -169,12 +157,14 @@ + } else { + goto parse_error; + } ++*/ + } + if (!objdb_get_string (objdb,object_service_handle, "logfile", &value)) { + main_config->logfile = strdup (value); + } + + if (!objdb_get_string (objdb,object_service_handle, "fileline", &value)) { ++/* TODO + if (strcmp (value, "on") == 0) { + main_config->logmode |= LOG_MODE_DISPLAY_FILELINE; + } else +@@ -183,6 +173,7 @@ + } else { + goto parse_error; + } ++*/ + } + + if (!objdb_get_string (objdb,object_service_handle, "syslog_facility", &value)) { +diff -Naurd corosync-0.92/exec/main.h corosync-trunk/exec/main.h +--- corosync-0.92/exec/main.h 2008-08-20 02:57:40.000000000 +0200 ++++ corosync-trunk/exec/main.h 2008-11-06 22:49:07.000000000 +0100 +@@ -37,7 +37,7 @@ + + #define TRUE 1 + #define FALSE 0 +-#include ++#include + #include + #include + #include +diff -Naurd corosync-0.92/exec/Makefile corosync-trunk/exec/Makefile +--- corosync-0.92/exec/Makefile 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/exec/Makefile 2008-12-08 16:55:41.000000000 +0100 +@@ -59,14 +59,14 @@ + EXEC_LIBS = libtotem_pg.a liblogsys.a + + # LCR objects +-LCR_SRC = vsf_ykd.c objdb.c coroparse.c +-LCR_OBJS = vsf_ykd.o objdb.o coroparse.o ++LCR_SRC = vsf_ykd.c objdb.c coroparse.c vsf_quorum.c ++LCR_OBJS = vsf_ykd.o objdb.o coroparse.o vsf_quorum.o + + # main executive objects + MAIN_SRC = main.c mempool.c util.c sync.c apidef.c service.c ipc.c flow.c \ +- timer.c totemconfig.c mainconfig.c ++ quorum.c timer.c totemconfig.c mainconfig.c + MAIN_OBJS = main.o mempool.o util.o sync.o apidef.o service.o ipc.o flow.o \ +- timer.o totemconfig.o mainconfig.o ../lcr/lcr_ifact.o ++ quorum.o timer.o totemconfig.o mainconfig.o ../lcr/lcr_ifact.o + + ifeq (${BUILD_DYNAMIC}, 1) + #EXEC_OBJS = $(TOTEM_OBJS) $(LOGSYS_OBJS) $(MAIN_OBJS) +@@ -75,7 +75,7 @@ + + all:libtotem_pg.a libtotem_pg.so.2.0.0 liblogsys.a liblogsys.so.2.0.0 \ + ../lcr/lcr_ifact.o corosync_ \ +- objdb.lcrso vsf_ykd.lcrso coroparse.lcrso ++ objdb.lcrso vsf_ykd.lcrso coroparse.lcrso vsf_quorum.lcrso + else + EXEC_OBJS = $(MAIN_OBJS) $(LCR_OBJS) + all: libtotem_pg.a liblogsys.a corosync +@@ -90,6 +90,9 @@ + vsf_ykd.lcrso: vsf_ykd.o + $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./corosync -bind_at_load vsf_ykd.o -o $@ + ++vsf_quorum.lcrso: vsf_quorum.o ++ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./corosync -bind_at_load vsf_quorum.o -o $@ ++ + coroparse.lcrso: coroparse.o + $(CC) -bundle -bundle_loader ./corosync -bind_at_load coroparse.o -o $@ + +@@ -98,9 +101,15 @@ + vsf_ykd.lcrso: vsf_ykd.o + $(CC) -shared -Wl,-soname,vsf_ykd.lcrso vsf_ykd.o -o $@ + ++vsf_quorum.lcrso: vsf_quorum.o ++ $(CC) -shared -Wl,-soname,vsf_quorum.lcrso vsf_quorum.o -o $@ ++ + objdb.lcrso: objdb.o + $(CC) -shared -Wl,-soname,objdb.lcrso objdb.o -o $@ + ++testquorum.lcrso: testquorum.o ++ $(CC) -shared -Wl,-soname,testquorum.lcrso objdb.o -o $@ ++ + coroparse.lcrso: coroparse.o + $(CC) -shared -Wl,-soname,coroparse.lcrso coroparse.o -o $@ + endif +@@ -131,6 +140,9 @@ + + endif + ++lint: ++ -splint $(LINT_FLAGS) $(CFLAGS) *.c ++ + clean: + rm -f corosync $(OBJS) *.o *.lcrso libtotem_pg.so* libtotem_pg.a gmon.out + rm -f *.da *.bb *.bbg liblogsys.so* liblogsys.a +@@ -145,9 +157,15 @@ + vsf_ykd.o: vsf_ykd.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + ++vsf_quorum.o: vsf_quorum.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< ++ + objdb.o: objdb.c + $(CC) $(CFLAGS) -c -o $@ $< + ++testquorum.o: testquorum.c ++ $(CC) $(CFLAGS) -c -o $@ $< ++ + coroparse.o: coroparse.c + $(CC) $(CFLAGS) -c -o $@ $< + +diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c +--- corosync-0.92/exec/objdb.c 2008-09-03 12:01:31.000000000 +0200 ++++ corosync-trunk/exec/objdb.c 2008-10-30 20:32:23.000000000 +0100 +@@ -59,6 +59,7 @@ + object_key_change_notify_fn_t key_change_notify_fn; + object_create_notify_fn_t object_create_notify_fn; + object_destroy_notify_fn_t object_destroy_notify_fn; ++ object_reload_notify_fn_t object_reload_notify_fn; + struct list_head tracker_list; + struct list_head object_list; + }; +@@ -91,6 +92,9 @@ + + struct objdb_iface_ver0 objdb_iface; + struct list_head objdb_trackers_head; ++static pthread_rwlock_t reload_lock; ++static pthread_t lock_thread; ++static pthread_mutex_t meta_lock; + + static struct hdb_handle_database object_instance_database = { + .handle_count = 0, +@@ -107,6 +111,38 @@ + }; + + ++static void objdb_wrlock() ++{ ++ pthread_mutex_lock(&meta_lock); ++ pthread_rwlock_wrlock(&reload_lock); ++ lock_thread = pthread_self(); ++ pthread_mutex_unlock(&meta_lock); ++} ++ ++static void objdb_rdlock() ++{ ++ pthread_mutex_lock(&meta_lock); ++ if (lock_thread != pthread_self()) ++ pthread_rwlock_rdlock(&reload_lock); ++ pthread_mutex_unlock(&meta_lock); ++} ++ ++static void objdb_rdunlock() ++{ ++ pthread_mutex_lock(&meta_lock); ++ if (lock_thread != pthread_self()) ++ pthread_rwlock_unlock(&reload_lock); ++ pthread_mutex_unlock(&meta_lock); ++} ++ ++static void objdb_wrunlock() ++{ ++ pthread_mutex_lock(&meta_lock); ++ pthread_rwlock_unlock(&reload_lock); ++ lock_thread = 0; ++ pthread_mutex_unlock(&meta_lock); ++} ++ + static int objdb_init (void) + { + unsigned int handle; +@@ -135,6 +171,8 @@ + list_init (&instance->child_list); + list_init (&instance->track_head); + list_init (&objdb_trackers_head); ++ pthread_rwlock_init(&reload_lock, NULL); ++ pthread_mutex_init(&meta_lock, NULL); + + hdb_handle_put (&object_instance_database, handle); + return (0); +@@ -293,6 +331,30 @@ + } while (obj_pt->object_handle != OBJECT_PARENT_HANDLE); + } + ++static void object_reload_notification(int startstop, int flush) ++{ ++ struct list_head * list; ++ struct object_instance * obj_pt; ++ struct object_tracker * tracker_pt; ++ unsigned int res; ++ ++ res = hdb_handle_get (&object_instance_database, ++ OBJECT_PARENT_HANDLE, (void *)&obj_pt); ++ ++ for (list = obj_pt->track_head.next; ++ list != &obj_pt->track_head; list = list->next) { ++ ++ tracker_pt = list_entry (list, struct object_tracker, object_list); ++ ++ if (tracker_pt->object_reload_notify_fn != NULL) { ++ tracker_pt->object_reload_notify_fn(startstop, flush, ++ tracker_pt->data_pt); ++ } ++ } ++ hdb_handle_put (&object_instance_database, OBJECT_PARENT_HANDLE); ++} ++ ++ + /* + * object db create/destroy/set + */ +@@ -308,6 +370,7 @@ + int found = 0; + int i; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + parent_object_handle, (void *)&parent_instance); + if (res != 0) { +@@ -380,7 +443,7 @@ + object_instance->parent_handle, + object_instance->object_name, + object_instance->object_name_len); +- ++ objdb_rdunlock(); + return (0); + + error_put_destroy: +@@ -393,6 +456,7 @@ + hdb_handle_put (&object_instance_database, parent_object_handle); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -403,6 +467,8 @@ + int res; + struct object_instance *object_instance; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&object_instance); + if (res != 0) { +@@ -412,9 +478,11 @@ + object_instance->priv = priv; + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + return (0); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -432,6 +500,8 @@ + int i; + unsigned int val; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -493,7 +563,7 @@ + list_add_tail (&object_key->list, &instance->key_head); + object_key_changed_notification(object_handle, key_name, key_len, + value, value_len, OBJECT_KEY_CREATED); +- ++ objdb_rdunlock(); + return (0); + + error_put_key: +@@ -506,6 +576,7 @@ + hdb_handle_put (&object_instance_database, object_handle); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -554,9 +625,12 @@ + struct object_instance *instance; + unsigned int res; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { ++ objdb_rdunlock(); + return (res); + } + +@@ -572,6 +646,7 @@ + free(instance->object_name); + free(instance); + ++ objdb_rdunlock(); + return (res); + } + +@@ -583,6 +658,7 @@ + struct object_instance *instance; + unsigned int res; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -594,9 +670,11 @@ + + hdb_handle_put (&object_instance_database, object_handle); + ++ objdb_rdunlock(); + return (0); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -608,6 +686,7 @@ + struct object_instance *instance; + unsigned int res; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -619,9 +698,11 @@ + + hdb_handle_put (&object_instance_database, object_handle); + ++ objdb_rdunlock(); + return (0); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -638,6 +719,7 @@ + struct object_instance *object_instance; + struct object_find_instance *object_find_instance; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&object_instance); + if (res != 0) { +@@ -662,6 +744,8 @@ + + hdb_handle_put (&object_instance_database, object_handle); + hdb_handle_put (&object_find_instance_database, *object_find_handle); ++ ++ objdb_rdunlock(); + return (0); + + error_destroy: +@@ -671,6 +755,7 @@ + hdb_handle_put (&object_instance_database, object_handle); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -684,6 +769,7 @@ + struct list_head *list; + unsigned int found = 0; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_find_instance_database, + object_find_handle, (void *)&object_find_instance); + if (res != 0) { +@@ -714,9 +800,11 @@ + *object_handle = object_instance->object_handle; + res = 0; + } ++ objdb_rdunlock(); + return (res); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -739,6 +827,7 @@ + struct list_head *list; + int found = 0; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -766,9 +855,11 @@ + } + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + return (res); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -784,6 +875,7 @@ + struct list_head *list; + int found = 0; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -809,9 +901,11 @@ + } + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + return (res); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -827,6 +921,7 @@ + struct list_head *list; + int found = 0; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -852,9 +947,11 @@ + } + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + return (res); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -872,6 +969,7 @@ + struct list_head *list; + int found = 0; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -906,9 +1004,11 @@ + if (ret == 0) + object_key_changed_notification(object_handle, key_name, key_len, + value, value_len, OBJECT_KEY_DELETED); ++ objdb_rdunlock(); + return (ret); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -928,6 +1028,8 @@ + struct list_head *list; + int found = 0; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -983,7 +1085,7 @@ + } + } + +- if (new_value_len <= object_key->value_len) { ++ if (new_value_len != object_key->value_len) { + void *replacement_value; + replacement_value = malloc(new_value_len); + if (!replacement_value) +@@ -1003,11 +1105,13 @@ + if (ret == 0) + object_key_changed_notification(object_handle, key_name, key_len, + new_value, new_value_len, OBJECT_KEY_REPLACED); ++ objdb_rdunlock(); + return (ret); + + error_put: + hdb_handle_put (&object_instance_database, object_handle); + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -1018,6 +1122,7 @@ + int res; + struct object_instance *object_instance; + ++ objdb_rdunlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&object_instance); + if (res != 0) { +@@ -1027,9 +1132,11 @@ + *priv = object_instance->priv; + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + return (0); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -1092,6 +1199,8 @@ + unsigned int res; + struct object_instance *instance; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { +@@ -1100,9 +1209,11 @@ + instance->iter_key_list = &instance->key_head; + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + return (0); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -1119,6 +1230,8 @@ + struct list_head *list; + unsigned int found = 0; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + parent_object_handle, (void *)&instance); + if (res != 0) { +@@ -1145,9 +1258,11 @@ + } + + hdb_handle_put (&object_instance_database, parent_object_handle); ++ objdb_rdunlock(); + return (res); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -1165,6 +1280,8 @@ + struct list_head *list; + unsigned int found = 0; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + parent_object_handle, (void *)&instance); + if (res != 0) { +@@ -1197,9 +1314,11 @@ + } + + hdb_handle_put (&object_instance_database, parent_object_handle); ++ objdb_rdunlock(); + return (res); + + error_exit: ++ objdb_rdunlock(); + return (-1); + } + +@@ -1210,9 +1329,12 @@ + struct object_instance *instance; + unsigned int res; + ++ objdb_rdlock(); ++ + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { ++ objdb_rdunlock(); + return (res); + } + +@@ -1222,6 +1344,7 @@ + *parent_handle = instance->parent_handle; + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + + return (0); + } +@@ -1233,9 +1356,11 @@ + struct object_instance *instance; + unsigned int res; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { ++ objdb_rdunlock(); + return (res); + } + +@@ -1243,6 +1368,7 @@ + *object_name_len = instance->object_name_len; + + hdb_handle_put (&object_instance_database, object_handle); ++ objdb_rdunlock(); + + return (0); + } +@@ -1253,6 +1379,7 @@ + object_key_change_notify_fn_t key_change_notify_fn, + object_create_notify_fn_t object_create_notify_fn, + object_destroy_notify_fn_t object_destroy_notify_fn, ++ object_reload_notify_fn_t object_reload_notify_fn, + void * priv_data_pt) + { + struct object_instance *instance; +@@ -1271,6 +1398,7 @@ + tracker_pt->key_change_notify_fn = key_change_notify_fn; + tracker_pt->object_create_notify_fn = object_create_notify_fn; + tracker_pt->object_destroy_notify_fn = object_destroy_notify_fn; ++ tracker_pt->object_reload_notify_fn = object_reload_notify_fn; + tracker_pt->data_pt = priv_data_pt; + + list_init(&tracker_pt->object_list); +@@ -1287,6 +1415,7 @@ + static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn, + object_create_notify_fn_t object_create_notify_fn, + object_destroy_notify_fn_t object_destroy_notify_fn, ++ object_reload_notify_fn_t object_reload_notify_fn, + void * priv_data_pt) + { + struct object_instance *instance; +@@ -1305,6 +1434,7 @@ + if (tracker_pt && (tracker_pt->data_pt == priv_data_pt) && + (tracker_pt->object_create_notify_fn == object_create_notify_fn) && + (tracker_pt->object_destroy_notify_fn == object_destroy_notify_fn) && ++ (tracker_pt->object_reload_notify_fn == object_reload_notify_fn) && + (tracker_pt->key_change_notify_fn == key_change_notify_fn)) { + + /* get the object & take this tracker off of it's list. */ +@@ -1337,9 +1467,11 @@ + struct object_instance *instance; + unsigned int res; + ++ objdb_rdlock(); + res = hdb_handle_get (&object_instance_database, + object_handle, (void *)&instance); + if (res != 0) { ++ objdb_rdunlock(); + return (res); + } + +@@ -1347,6 +1479,7 @@ + + hdb_handle_put (&object_instance_database, object_handle); + ++ objdb_rdunlock(); + return (res); + } + +@@ -1358,13 +1491,19 @@ + int res; + + main_get_config_modules(&modules, &num_modules); ++ ++ objdb_wrlock(); ++ + for (i=0; iconfig_writeconfig) { + res = modules[i]->config_writeconfig(&objdb_iface, error_string); +- if (res) ++ if (res) { ++ objdb_wrunlock(); + return res; ++ } + } + } ++ objdb_wrunlock(); + return 0; + } + +@@ -1376,14 +1515,22 @@ + int res; + + main_get_config_modules(&modules, &num_modules); ++ object_reload_notification(OBJDB_RELOAD_NOTIFY_START, flush); ++ ++ objdb_wrlock(); + + for (i=0; iconfig_reloadconfig) { + res = modules[i]->config_reloadconfig(&objdb_iface, flush, error_string); +- if (res) ++ if (res) { ++ object_reload_notification(OBJDB_RELOAD_NOTIFY_FAILED, flush); ++ objdb_wrunlock(); + return res; ++ } + } + } ++ objdb_wrunlock(); ++ object_reload_notification(OBJDB_RELOAD_NOTIFY_END, flush); + return 0; + } + +diff -Naurd corosync-0.92/exec/quorum.c corosync-trunk/exec/quorum.c +--- corosync-0.92/exec/quorum.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/exec/quorum.c 2008-12-09 14:48:47.000000000 +0100 +@@ -0,0 +1,115 @@ ++/* ++ * Copyright (c) 2008 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 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "quorum.h" ++#include "main.h" ++#include "sync.h" ++#include "vsf.h" ++ ++LOGSYS_DECLARE_SUBSYS ("QUORUM", LOG_INFO); ++ ++ ++static struct quorum_callin_functions *corosync_quorum_fns = NULL; ++ ++int corosync_quorum_is_quorate (void) ++{ ++ if (corosync_quorum_fns) { ++ return corosync_quorum_fns->quorate(); ++ } ++ else { ++ return 1; ++ } ++} ++ ++int corosync_quorum_register_callback (quorum_callback_fn_t fn, void *context) ++{ ++ if (corosync_quorum_fns) { ++ return corosync_quorum_fns->register_callback(fn, context); ++ } ++ else { ++ return 0; ++ } ++} ++ ++int corosync_quorum_unregister_callback (quorum_callback_fn_t fn, void *context) ++{ ++ if (corosync_quorum_fns) { ++ return corosync_quorum_fns->unregister_callback(fn, context); ++ } ++ else { ++ return 0; ++ } ++} ++ ++int corosync_quorum_initialize (struct quorum_callin_functions *fns, ++ sync_callback_fn_t *sync_callback_fn) ++{ ++ if (corosync_quorum_fns) ++ return -1; ++ ++ corosync_quorum_fns = fns; ++ *sync_callback_fn = sync_primary_callback_fn; ++ return 0; ++} ++ ++int quorum_none(void) ++{ ++ if (corosync_quorum_fns) ++ return 0; ++ else ++ return 1; ++} +diff -Naurd corosync-0.92/exec/quorum.h corosync-trunk/exec/quorum.h +--- corosync-0.92/exec/quorum.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/exec/quorum.h 2008-12-08 16:55:41.000000000 +0100 +@@ -0,0 +1,68 @@ ++/* ++ * Copyright (c) 2008 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 the 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. ++ */ ++ ++#ifndef QUORUM_H_DEFINED ++#define QUORUM_H_DEFINED ++ ++struct memb_ring_id; ++ ++typedef void (*quorum_callback_fn_t) (int quorate, void *context); ++ ++typedef void (*sync_callback_fn_t) ( ++ unsigned int *view_list, ++ int view_list_entries, ++ int primary_designated, ++ struct memb_ring_id *ring_id); ++ ++struct quorum_callin_functions ++{ ++ int (*quorate) (void); ++ int (*register_callback) (quorum_callback_fn_t, void*); ++ int (*unregister_callback) (quorum_callback_fn_t, void*); ++}; ++ ++extern int corosync_quorum_is_quorate (void); ++ ++extern int corosync_quorum_register_callback (quorum_callback_fn_t fn, void *context); ++ ++extern int corosync_quorum_unregister_callback (quorum_callback_fn_t fn, void *context); ++ ++extern int corosync_quorum_initialize (struct quorum_callin_functions *fns, ++ sync_callback_fn_t *sync_callback_fn); ++ ++ ++extern int quorum_none(void); ++ ++ ++#endif /* QUORUM_H_DEFINED */ +diff -Naurd corosync-0.92/exec/service.c corosync-trunk/exec/service.c +--- corosync-0.92/exec/service.c 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/exec/service.c 2008-12-08 16:55:41.000000000 +0100 +@@ -78,6 +78,14 @@ + .name = "corosync_confdb", + .ver = 0, + }, ++ { ++ .name = "corosync_pload", ++ .ver = 0, ++ }, ++ { ++ .name = "corosync_quorum", ++ .ver = 0, ++ }, + }; + + struct corosync_service_engine *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT]; +diff -Naurd corosync-0.92/exec/sync.c corosync-trunk/exec/sync.c +--- corosync-0.92/exec/sync.c 2008-09-17 21:04:19.000000000 +0200 ++++ corosync-trunk/exec/sync.c 2008-12-08 16:55:41.000000000 +0100 +@@ -49,16 +49,17 @@ + #include + #include + +-#include ++#include + #include + #include + #include + #include + #include ++#include "quorum.h" + + #include "main.h" + #include "sync.h" +-#include "vsf.h" ++ + + LOGSYS_DECLARE_SUBSYS ("SYNC", LOG_INFO); + +@@ -72,8 +73,6 @@ + + static struct memb_ring_id *sync_ring_id; + +-static int vsf_none = 0; +- + static int (*sync_callbacks_retrieve) (int sync_id, struct sync_callbacks *callack); + + static struct sync_callbacks sync_callbacks; +@@ -93,8 +92,6 @@ + + static struct barrier_data barrier_data_process[PROCESSOR_COUNT_MAX]; + +-static struct corosync_vsf_iface_ver0 *vsf_iface; +- + static int sync_barrier_send (struct memb_ring_id *ring_id); + + static int sync_start_process (enum totem_callback_token_type type, void *data); +@@ -116,12 +113,6 @@ + unsigned int *joined_list, int joined_list_entries, + struct memb_ring_id *ring_id); + +-static void sync_primary_callback_fn ( +- unsigned int *view_list, +- int view_list_entries, +- int primary_designated, +- struct memb_ring_id *ring_id); +- + static struct totempg_group sync_group = { + .group = "sync", + .group_len = 4 +@@ -266,13 +257,10 @@ + + int sync_register ( + int (*callbacks_retrieve) (int sync_id, struct sync_callbacks *callack), +- void (*synchronization_completed) (void), +- char *vsf_type) ++ void (*synchronization_completed) (void)) ++ + { + unsigned int res; +- unsigned int vsf_handle; +- void *vsf_iface_p; +- char corosync_vsf_type[1024]; + + res = totempg_groups_initialize ( + &sync_group_handle, +@@ -292,42 +280,13 @@ + log_printf (LOG_LEVEL_ERROR, "Couldn't join group.\n"); + return (-1); + } +- +- if (strcmp (vsf_type, "none") == 0) { +- log_printf (LOG_LEVEL_NOTICE, +- "Not using a virtual synchrony filter.\n"); +- vsf_none = 1; +- } else { +- vsf_none = 0; +- +- sprintf (corosync_vsf_type, "corosync_vsf_%s", vsf_type); +- res = lcr_ifact_reference ( +- &vsf_handle, +- corosync_vsf_type, +- 0, +- &vsf_iface_p, +- 0); +- +- if (res == -1) { +- log_printf (LOG_LEVEL_NOTICE, +- "Couldn't load virtual synchrony filter %s\n", +- vsf_type); +- return (-1); +- } +- +- log_printf (LOG_LEVEL_NOTICE, +- "Using virtual synchrony filter %s\n", corosync_vsf_type); +- +- vsf_iface = (struct corosync_vsf_iface_ver0 *)vsf_iface_p; +- vsf_iface->init (sync_primary_callback_fn); +- } + + sync_callbacks_retrieve = callbacks_retrieve; + sync_synchronization_completed = synchronization_completed; + return (0); + } + +-static void sync_primary_callback_fn ( ++void sync_primary_callback_fn ( + unsigned int *view_list, + int view_list_entries, + int primary_designated, +@@ -335,13 +294,6 @@ + { + int i; + +- if (primary_designated) { +- log_printf (LOG_LEVEL_NOTICE, "This node is within the primary component and will provide service.\n"); +- } else { +- log_printf (LOG_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services.\n"); +- return; +- } +- + /* + * Execute configuration change for synchronization service + */ +@@ -521,7 +473,7 @@ + * If no virtual synchrony filter configured, then start + * synchronization process + */ +- if (vsf_none == 1) { ++ if (quorum_none() == 1) { + sync_primary_callback_fn ( + member_list, + member_list_entries, +@@ -546,7 +498,7 @@ + struct iovec iovec[2]; + int name_len; + +- ENTER("'%s'", name); ++ ENTER(); + + name_len = strlen (name) + 1; + msg.header.size = sizeof (msg) + name_len; +@@ -589,15 +541,6 @@ + return (sync_processing); + } + +-int sync_primary_designated (void) +-{ +- if (vsf_none == 1) { +- return (1); +- } else { +- return (vsf_iface->primary()); +- } +-} +- + /** + * Execute synchronization upon request for the named service + * @param name +@@ -608,7 +551,7 @@ + { + assert (name != NULL); + +- ENTER("'%s'", name); ++ ENTER(); + + if (sync_processing) { + return -1; +@@ -618,7 +561,7 @@ + TOTEM_CALLBACK_TOKEN_SENT, 0, /* don't delete after callback */ + sync_request_send, name); + +- LEAVE(""); ++ LEAVE(); + + return 0; + } +diff -Naurd corosync-0.92/exec/sync.h corosync-trunk/exec/sync.h +--- corosync-0.92/exec/sync.h 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/sync.h 2008-12-08 16:55:41.000000000 +0100 +@@ -47,10 +47,10 @@ + char *name; + }; + ++struct corosync_api_v1; + int sync_register ( + int (*sync_callbacks_retrieve) (int sync_id, struct sync_callbacks *callbacks), +- void (*synchronization_completed) (void), +- char *vsf_type); ++ void (*synchronization_completed) (void)); + + int sync_in_process (void); + +@@ -64,4 +64,11 @@ + */ + extern int sync_request (char *name); + ++extern void sync_primary_callback_fn ( ++ unsigned int *view_list, ++ int view_list_entries, ++ int primary_designated, ++ struct memb_ring_id *ring_id); ++ ++ + #endif /* SYNC_H_DEFINED */ +diff -Naurd corosync-0.92/exec/timer.c corosync-trunk/exec/timer.c +--- corosync-0.92/exec/timer.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/exec/timer.c 2008-11-06 22:49:07.000000000 +0100 +@@ -56,7 +56,7 @@ + #include + + #include +-#include ++#include + #include + #include + #include +diff -Naurd corosync-0.92/exec/totemconfig.h corosync-trunk/exec/totemconfig.h +--- corosync-0.92/exec/totemconfig.h 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/totemconfig.h 2008-11-06 22:49:07.000000000 +0100 +@@ -36,7 +36,7 @@ + #define TOTEMCONFIG_H_DEFINED + + #include +-#include ++#include + #include + #include + #include +diff -Naurd corosync-0.92/exec/totemip.c corosync-trunk/exec/totemip.c +--- corosync-0.92/exec/totemip.c 2008-09-16 17:35:09.000000000 +0200 ++++ corosync-trunk/exec/totemip.c 2008-12-02 15:50:51.000000000 +0100 +@@ -226,7 +226,7 @@ + sin->sin_len = sizeof(struct sockaddr_in); + #endif + sin->sin_family = ip_addr->family; +- sin->sin_port = port; ++ sin->sin_port = ntohs(port); + memcpy(&sin->sin_addr, ip_addr->addr, sizeof(struct in_addr)); + *addrlen = sizeof(struct sockaddr_in); + ret = 0; +@@ -240,7 +240,7 @@ + sin->sin6_len = sizeof(struct sockaddr_in6); + #endif + sin->sin6_family = ip_addr->family; +- sin->sin6_port = port; ++ sin->sin6_port = ntohs(port); + sin->sin6_scope_id = 2; + memcpy(&sin->sin6_addr, ip_addr->addr, sizeof(struct in6_addr)); + +@@ -472,7 +472,7 @@ + memcpy(&network, RTA_DATA(tb[IFA_BROADCAST]), sizeof(uint32_t)); + memcpy(&addr, bindnet->addr, sizeof(uint32_t)); + +- if (addr == (network & netmask)) { ++ if ((addr & netmask) == (network & netmask)) { + memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN); + found_if = 1; + } +diff -Naurd corosync-0.92/exec/totemmrp.c corosync-trunk/exec/totemmrp.c +--- corosync-0.92/exec/totemmrp.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/totemmrp.c 2008-12-01 19:44:55.000000000 +0100 +@@ -192,7 +192,7 @@ + return (res); + } + +-int totemmrp_my_nodeid_get (void) ++unsigned int totemmrp_my_nodeid_get (void) + { + return (totemsrp_my_nodeid_get (totemsrp_handle_in)); + } +diff -Naurd corosync-0.92/exec/totemnet.c corosync-trunk/exec/totemnet.c +--- corosync-0.92/exec/totemnet.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/totemnet.c 2008-10-30 23:25:56.000000000 +0100 +@@ -137,7 +137,11 @@ + + int totemnet_log_level_debug; + +- void (*totemnet_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))); ++ int totemnet_subsys_id; ++ ++ void (*totemnet_log_printf) (int subsys, char *function, char *file, ++ int line, unsigned int level, char *format, ++ ...)__attribute__((format(printf, 6, 7))); + + totemnet_handle handle; + +@@ -226,8 +230,12 @@ + instance->my_memb_entries = 1; + } + +-#define log_printf(level, format, args...) \ +- instance->totemnet_log_printf (__FILE__, __LINE__, level, format, ##args) ++#define log_printf(level, format, args...) \ ++do { \ ++ instance->totemnet_log_printf (instance->totemnet_subsys_id, \ ++ (char *)__FUNCTION__, __FILE__, __LINE__, level, \ ++ format, ##args); \ ++} while (0); + + static int authenticate_and_decrypt ( + struct totemnet_instance *instance, +@@ -1192,6 +1200,7 @@ + instance->totemnet_log_level_warning = totem_config->totem_logging_configuration.log_level_warning; + instance->totemnet_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; + instance->totemnet_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; ++ instance->totemnet_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; + instance->totemnet_log_printf = totem_config->totem_logging_configuration.log_printf; + + /* +diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c +--- corosync-0.92/exec/totempg.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/totempg.c 2008-12-01 19:44:55.000000000 +0100 +@@ -153,7 +153,10 @@ + static int totempg_log_level_warning; + static int totempg_log_level_notice; + static int totempg_log_level_debug; +-static void (*totempg_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))) = NULL; ++static int totempg_subsys_id; ++static void (*totempg_log_printf) (int subsys_id, char *function, char *file, ++ int line, unsigned int level, char *format, ++ ...) __attribute__((format(printf, 6, 7))); + + struct totem_config *totempg_totem_config; + +@@ -225,8 +228,11 @@ + + static pthread_mutex_t mcast_msg_mutex = PTHREAD_MUTEX_INITIALIZER; + +-#define log_printf(level, format, args...) \ +- totempg_log_printf (__FILE__, __LINE__, level, format, ##args) ++#define log_printf(level, format, args...) \ ++do { \ ++ totempg_log_printf (totempg_subsys_id, (char *)__FUNCTION__, \ ++ __FILE__, __LINE__, level, format, ##args); \ ++} while (0); + + static struct assembly *assembly_ref (unsigned int nodeid) + { +@@ -686,6 +692,7 @@ + totempg_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; + totempg_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; + totempg_log_printf = totem_config->totem_logging_configuration.log_printf; ++ totempg_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; + + fragmentation_data = malloc (TOTEMPG_PACKET_SIZE); + if (fragmentation_data == 0) { +@@ -721,14 +728,16 @@ + * Multicast a message + */ + static int mcast_msg ( +- struct iovec *iovec, ++ struct iovec *iovec_in, + int iov_len, + int guarantee) + { + int res = 0; + struct totempg_mcast mcast; + struct iovec iovecs[3]; ++ struct iovec iovec[64]; + int i; ++ int dest, src; + int max_packet_size = 0; + int copy_len = 0; + int copy_base = 0; +@@ -737,6 +746,18 @@ + pthread_mutex_lock (&mcast_msg_mutex); + totemmrp_new_msg_signal (); + ++ /* ++ * Remove zero length iovectors from the list ++ */ ++ assert (iov_len < 64); ++ for (dest = 0, src = 0; src < iov_len; src++) { ++ if (iovec_in[src].iov_len) { ++ memcpy (&iovec[dest++], &iovec_in[src], ++ sizeof (struct iovec)); ++ } ++ } ++ iov_len = dest; ++ + max_packet_size = TOTEMPG_PACKET_SIZE - + (sizeof (unsigned short) * (mcast_packed_msg_count + 1)); + +@@ -1243,7 +1264,7 @@ + return (iface_string); + } + +-int totempg_my_nodeid_get (void) ++unsigned int totempg_my_nodeid_get (void) + { + return (totemmrp_my_nodeid_get()); + } +diff -Naurd corosync-0.92/exec/totemrrp.c corosync-trunk/exec/totemrrp.c +--- corosync-0.92/exec/totemrrp.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/totemrrp.c 2008-10-30 23:25:56.000000000 +0100 +@@ -194,7 +194,11 @@ + + int totemrrp_log_level_debug; + +- void (*totemrrp_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))); ++ int totemrrp_subsys_id; ++ ++ void (*totemrrp_log_printf) (int subsys, char *function, char *file, ++ int line, unsigned int level, char *format, ++ ...)__attribute__((format(printf, 6, 7))); + + totemrrp_handle handle; + +@@ -459,8 +463,14 @@ + .mutex = PTHREAD_MUTEX_INITIALIZER + }; + +-#define log_printf(level, format, args...) \ +- rrp_instance->totemrrp_log_printf (__FILE__, __LINE__, level, format, ##args) ++ ++#define log_printf(level, format, args...) \ ++do { \ ++ rrp_instance->totemrrp_log_printf ( \ ++ rrp_instance->totemrrp_subsys_id, \ ++ (char *)__FUNCTION__, __FILE__, __LINE__, level, \ ++ format, ##args); \ ++} while (0); + + /* + * None Replication Implementation +@@ -1426,6 +1436,7 @@ + instance->totemrrp_log_level_warning = totem_config->totem_logging_configuration.log_level_warning; + instance->totemrrp_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; + instance->totemrrp_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; ++ instance->totemrrp_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; + instance->totemrrp_log_printf = totem_config->totem_logging_configuration.log_printf; + + instance->interfaces = totem_config->interfaces; +diff -Naurd corosync-0.92/exec/totemsrp.c corosync-trunk/exec/totemsrp.c +--- corosync-0.92/exec/totemsrp.c 2008-08-20 03:07:29.000000000 +0200 ++++ corosync-trunk/exec/totemsrp.c 2008-12-01 19:44:55.000000000 +0100 +@@ -429,7 +429,11 @@ + + int totemsrp_log_level_debug; + +- void (*totemsrp_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))); ++ int totemsrp_subsys_id; ++ ++ void (*totemsrp_log_printf) (int subsys, char *function, char *file, ++ int line, unsigned int level, char *format, ++ ...)__attribute__((format(printf, 6, 7)));; + + enum memb_state memb_state; + +@@ -607,8 +611,12 @@ + + static char *rundir = NULL; + +-#define log_printf(level, format, args...) \ +- instance->totemsrp_log_printf (__FILE__, __LINE__, level, format, ##args) ++#define log_printf(level, format, args...) \ ++do { \ ++ instance->totemsrp_log_printf (instance->totemsrp_subsys_id, \ ++ (char *)__FUNCTION__, __FILE__, __LINE__, level, \ ++ format, ##args); \ ++} while (0); + + void totemsrp_instance_initialize (struct totemsrp_instance *instance) + { +@@ -618,7 +626,7 @@ + + list_init (&instance->token_callback_sent_listhead); + +- instance->my_received_flg = 0; ++ instance->my_received_flg = 1; + + instance->my_token_seq = SEQNO_START_TOKEN - 1; + +@@ -709,6 +717,7 @@ + instance->totemsrp_log_level_warning = totem_config->totem_logging_configuration.log_level_warning; + instance->totemsrp_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; + instance->totemsrp_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; ++ instance->totemsrp_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; + instance->totemsrp_log_printf = totem_config->totem_logging_configuration.log_printf; + + /* +@@ -904,11 +913,11 @@ + return (res); + } + +-int totemsrp_my_nodeid_get ( ++unsigned int totemsrp_my_nodeid_get ( + totemsrp_handle handle) + { + struct totemsrp_instance *instance; +- int res; ++ unsigned int res; + + res = hdb_handle_get (&totemsrp_instance_database, handle, + (void *)&instance); +@@ -1686,7 +1695,7 @@ + "entering OPERATIONAL state.\n"); + instance->memb_state = MEMB_STATE_OPERATIONAL; + +- instance->my_received_flg = 0; ++ instance->my_received_flg = 1; + + return; + } +@@ -2634,6 +2643,8 @@ + { + struct srp_addr *addr; + struct memb_commit_token_memb_entry *memb_list; ++ unsigned int high_aru; ++ unsigned int i; + + addr = (struct srp_addr *)commit_token->end_of_commit_token; + memb_list = (struct memb_commit_token_memb_entry *)(addr + commit_token->addr_entries); +@@ -2655,9 +2666,40 @@ + instance->my_received_flg = + (instance->my_aru == instance->my_high_seq_received); + +- memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered; + memb_list[commit_token->memb_index].received_flg = instance->my_received_flg; + ++ memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered; ++ /* ++ * find high aru up to current memb_index for all matching ring ids ++ * if any ring id matching memb_index has aru less then high aru set ++ * received flag for that entry to false ++ */ ++ high_aru = memb_list[commit_token->memb_index].aru; ++ for (i = 0; i <= commit_token->memb_index; i++) { ++ if (memcmp (&memb_list[commit_token->memb_index].ring_id, ++ &memb_list[i].ring_id, ++ sizeof (struct memb_ring_id)) == 0) { ++ ++ if (sq_lt_compare (high_aru, memb_list[i].aru)) { ++ high_aru = memb_list[i].aru; ++ } ++ } ++ } ++ ++ for (i = 0; i <= commit_token->memb_index; i++) { ++ if (memcmp (&memb_list[commit_token->memb_index].ring_id, ++ &memb_list[i].ring_id, ++ sizeof (struct memb_ring_id)) == 0) { ++ ++ if (sq_lt_compare (memb_list[i].aru, high_aru)) { ++ memb_list[i].received_flg = 0; ++ if (i == commit_token->memb_index) { ++ instance->my_received_flg = 0; ++ } ++ } ++ } ++ } ++ + commit_token->header.nodeid = instance->my_id.addr[0].nodeid; + commit_token->memb_index += 1; + assert (commit_token->memb_index <= commit_token->addr_entries); +diff -Naurd corosync-0.92/exec/totemsrp.h corosync-trunk/exec/totemsrp.h +--- corosync-0.92/exec/totemsrp.h 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/totemsrp.h 2008-12-01 19:44:55.000000000 +0100 +@@ -104,7 +104,7 @@ + char ***status, + unsigned int *iface_count); + +-extern int totemsrp_my_nodeid_get ( ++extern unsigned int totemsrp_my_nodeid_get ( + totemsrp_handle handle); + + extern int totemsrp_my_family_get ( +diff -Naurd corosync-0.92/exec/util.c corosync-trunk/exec/util.c +--- corosync-0.92/exec/util.c 2008-09-17 21:04:19.000000000 +0200 ++++ corosync-trunk/exec/util.c 2008-11-06 22:49:07.000000000 +0100 +@@ -39,7 +39,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include "util.h" +@@ -49,7 +49,7 @@ + /* + * Compare two names. returns non-zero on match. + */ +-int name_match(SaNameT *name1, SaNameT *name2) ++int name_match(cs_name_t *name1, cs_name_t *name2) + { + if (name1->length == name2->length) { + return ((strncmp ((char *)name1->value, (char *)name2->value, +@@ -61,17 +61,17 @@ + /* + * Get the time of day and convert to nanoseconds + */ +-SaTimeT clust_time_now(void) ++cs_time_t clust_time_now(void) + { + struct timeval tv; +- SaTimeT time_now; ++ cs_time_t time_now; + + if (gettimeofday(&tv, 0)) { + return 0ULL; + } + +- time_now = (SaTimeT)(tv.tv_sec) * 1000000000ULL; +- time_now += (SaTimeT)(tv.tv_usec) * 1000ULL; ++ time_now = (cs_time_t)(tv.tv_sec) * 1000000000ULL; ++ time_now += (cs_time_t)(tv.tv_usec) * 1000ULL; + + return time_now; + } +@@ -87,20 +87,19 @@ + { + log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting " + "with status %d at %s:%u.\n", err, file, line); +- logsys_flush(); + exit (EXIT_FAILURE); + } + + #define min(a,b) ((a) < (b) ? (a) : (b)) + +-char *getSaNameT (SaNameT *name) ++char *getcs_name_t (cs_name_t *name) + { +- static char ret_name[SA_MAX_NAME_LENGTH]; ++ static char ret_name[CS_MAX_NAME_LENGTH]; + + /* if string is corrupt (non-terminated), ensure it's displayed safely */ +- if (name->length >= SA_MAX_NAME_LENGTH || name->value[name->length] != '\0') { ++ if (name->length >= CS_MAX_NAME_LENGTH || name->value[name->length] != '\0') { + memset (ret_name, 0, sizeof (ret_name)); +- memcpy (ret_name, name->value, min(name->length, SA_MAX_NAME_LENGTH -1)); ++ memcpy (ret_name, name->value, min(name->length, CS_MAX_NAME_LENGTH -1)); + return (ret_name); + } + return ((char *)name->value); +@@ -134,16 +133,16 @@ + return (end_address); + } + +-void setSaNameT (SaNameT *name, char *str) { +- strncpy ((char *)name->value, str, SA_MAX_NAME_LENGTH); +- if (strlen ((char *)name->value) > SA_MAX_NAME_LENGTH) { +- name->length = SA_MAX_NAME_LENGTH; ++void setcs_name_t (cs_name_t *name, char *str) { ++ strncpy ((char *)name->value, str, CS_MAX_NAME_LENGTH); ++ if (strlen ((char *)name->value) > CS_MAX_NAME_LENGTH) { ++ name->length = CS_MAX_NAME_LENGTH; + } else { + name->length = strlen (str); + } + } + +-int SaNameTisEqual (SaNameT *str1, char *str2) { ++int cs_name_tisEqual (cs_name_t *str1, char *str2) { + if (str1->length == strlen (str2)) { + return ((strncmp ((char *)str1->value, (char *)str2, + str1->length)) == 0); +diff -Naurd corosync-0.92/exec/util.h corosync-trunk/exec/util.h +--- corosync-0.92/exec/util.h 2008-09-17 21:04:19.000000000 +0200 ++++ corosync-trunk/exec/util.h 2008-11-06 22:49:07.000000000 +0100 +@@ -37,12 +37,12 @@ + + #include + #include +-#include ++#include + + /* + * Get the time of day and convert to nanoseconds + */ +-extern SaTimeT clust_time_now(void); ++extern cs_time_t clust_time_now(void); + + enum e_ais_done { + AIS_DONE_EXIT = -1, +@@ -66,15 +66,15 @@ + /* + * Compare two names. returns non-zero on match. + */ +-extern int name_match(SaNameT *name1, SaNameT *name2); ++extern int name_match(cs_name_t *name1, cs_name_t *name2); + extern int mar_name_match(mar_name_t *name1, mar_name_t *name2); + #define corosync_exit_error(err) _corosync_exit_error ((err), __FILE__, __LINE__) + extern void _corosync_exit_error ( + enum e_ais_done err, const char *file, unsigned int line); + void _corosync_out_of_memory_error (void); +-extern char *getSaNameT (SaNameT *name); ++extern char *getcs_name_t (cs_name_t *name); + extern char *strstr_rs (const char *haystack, const char *needle); +-extern void setSaNameT (SaNameT *name, char *str); ++extern void setcs_name_t (cs_name_t *name, char *str); + char *get_mar_name_t (mar_name_t *name); +-extern int SaNameTisEqual (SaNameT *str1, char *str2); ++extern int cs_name_tisEqual (cs_name_t *str1, char *str2); + #endif /* UTIL_H_DEFINED */ +diff -Naurd corosync-0.92/exec/vsf.h corosync-trunk/exec/vsf.h +--- corosync-0.92/exec/vsf.h 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/exec/vsf.h 2008-12-08 16:55:41.000000000 +0100 +@@ -34,12 +34,14 @@ + #ifndef VSF_H_DEFINED + #define VSF_H_DEFINED + ++struct corosync_api_v1; + struct corosync_vsf_iface_ver0 { + + /* + * Executes a callback whenever component changes + */ + int (*init) ( ++ struct corosync_api_v1 *api, + void (*primary_callback_fn) ( + unsigned int *view_list, + int view_list_entries, +diff -Naurd corosync-0.92/exec/vsf_quorum.c corosync-trunk/exec/vsf_quorum.c +--- corosync-0.92/exec/vsf_quorum.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/exec/vsf_quorum.c 2008-12-08 16:55:41.000000000 +0100 +@@ -0,0 +1,462 @@ ++/* ++ * Copyright (c) 2008 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++LOGSYS_DECLARE_SUBSYS ("QUORUM", LOG_INFO); ++ ++struct quorum_pd { ++ unsigned char track_flags; ++ int tracking_enabled; ++ struct list_head list; ++ void *conn; ++}; ++ ++struct internal_callback_pd { ++ struct list_head list; ++ quorum_callback_fn_t callback; ++ void *context; ++}; ++ ++static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg); ++static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg); ++static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg); ++static void send_library_notification(void *conn); ++static void send_internal_notification(void); ++static int quorum_exec_init_fn (struct corosync_api_v1 *api); ++static int quorum_lib_init_fn (void *conn); ++static int quorum_lib_exit_fn (void *conn); ++ ++static int primary_designated = 0; ++static struct corosync_api_v1 *corosync_api; ++static struct list_head lib_trackers_list; ++static struct list_head internal_trackers_list; ++static struct memb_ring_id quorum_ring_id; ++static int quorum_view_list_entries = 0; ++static int quorum_view_list[PROCESSOR_COUNT_MAX]; ++struct quorum_services_api_ver1 *quorum_iface = NULL; ++ ++static void (*sync_primary_callback_fn) ( ++ unsigned int *view_list, ++ int view_list_entries, ++ int primary_designated, ++ struct memb_ring_id *ring_id); ++ ++/* Internal quorum API function */ ++static void quorum_api_set_quorum(unsigned int *view_list, ++ int view_list_entries, ++ int quorum, struct memb_ring_id *ring_id) ++{ ++ primary_designated = quorum; ++ ++ if (primary_designated) { ++ log_printf (LOG_LEVEL_NOTICE, "This node is within the primary component and will provide service.\n"); ++ } else { ++ log_printf (LOG_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services.\n"); ++ } ++ ++ memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); ++ ++ quorum_view_list_entries = view_list_entries; ++ memcpy(quorum_view_list, view_list, sizeof(unsigned int)*view_list_entries); ++ ++ /* Tell sync() */ ++ sync_primary_callback_fn(view_list, view_list_entries, ++ primary_designated, &quorum_ring_id); ++ ++ /* Tell internal listeners */ ++ send_internal_notification(); ++ ++ /* Tell IPC listeners */ ++ send_library_notification(NULL); ++} ++ ++static struct corosync_lib_handler quorum_lib_service[] = ++{ ++ { /* 0 */ ++ .lib_handler_fn = message_handler_req_lib_quorum_getquorate, ++ .response_size = sizeof (struct res_lib_quorum_getquorate), ++ .response_id = MESSAGE_RES_QUORUM_GETQUORATE, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 1 */ ++ .lib_handler_fn = message_handler_req_lib_quorum_trackstart, ++ .response_size = sizeof (mar_res_header_t), ++ .response_id = MESSAGE_RES_QUORUM_NOTIFICATION, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 2 */ ++ .lib_handler_fn = message_handler_req_lib_quorum_trackstop, ++ .response_size = sizeof (mar_res_header_t), ++ .response_id = MESSAGE_RES_QUORUM_TRACKSTOP, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ } ++}; ++ ++static struct corosync_service_engine quorum_service_handler = { ++ .name = "corosync cluster quorum service v0.1", ++ .id = QUORUM_SERVICE, ++ .private_data_size = sizeof (struct quorum_pd), ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED, ++ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, ++ .lib_init_fn = quorum_lib_init_fn, ++ .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), ++}; ++ ++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) ++{ ++ 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 ++}; ++ ++__attribute__ ((constructor)) static void quorum_comp_register (void) { ++ lcr_component_register (&quorum_comp_ver0); ++ lcr_interfaces_set (&corosync_quorum_ver0[0], &quorum_service_handler_iface); ++} ++ ++/* -------------------------------------------------- */ ++ ++ ++/* ++ * Internal API functions for corosync ++ */ ++ ++static int quorum_quorate(void) ++{ ++ return primary_designated; ++} ++ ++ ++static int quorum_register_callback(quorum_callback_fn_t function, void *context) ++{ ++ struct internal_callback_pd *pd = malloc(sizeof(struct internal_callback_pd)); ++ if (!pd) ++ return -1; ++ ++ pd->context = context; ++ pd->callback = function; ++ list_add (&pd->list, &internal_trackers_list); ++ ++ return 0; ++} ++ ++static int quorum_unregister_callback(quorum_callback_fn_t function, void *context) ++{ ++ struct internal_callback_pd *pd; ++ struct list_head *tmp; ++ ++ for (tmp = internal_trackers_list.next; tmp != &internal_trackers_list; tmp = tmp->next) { ++ ++ pd = list_entry(tmp, struct internal_callback_pd, list); ++ if (pd->callback == function && pd->context == context) { ++ list_del(&pd->list); ++ return 0; ++ } ++ } ++ return -1; ++} ++ ++static struct quorum_callin_functions callins = { ++ .quorate = quorum_quorate, ++ .register_callback = quorum_register_callback, ++ .unregister_callback = quorum_unregister_callback ++}; ++ ++/* --------------------------------------------------------------------- */ ++ ++static int quorum_exec_init_fn (struct corosync_api_v1 *api) ++{ ++ unsigned int find_handle; ++ unsigned int quorum_handle = 0; ++ unsigned int q_handle; ++ char *quorum_module; ++ int res; ++ void *quorum_iface_p; ++ ++ corosync_api = api; ++ list_init (&lib_trackers_list); ++ list_init (&internal_trackers_list); ++ ++ /* ++ * Tell corosync we have a quorum engine. ++ */ ++ api->quorum_initialize(&callins, &sync_primary_callback_fn); ++ ++ /* ++ * Look for a quorum provider ++ */ ++ api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); ++ api->object_find_next(find_handle, &quorum_handle); ++ api->object_find_destroy(find_handle); ++ ++ if (quorum_handle) { ++ if ( !(res = api->object_key_get(quorum_handle, ++ "provider", ++ strlen("provider"), ++ (void *)&quorum_module, ++ NULL))) { ++ ++ res = lcr_ifact_reference ( ++ &q_handle, ++ quorum_module, ++ 0, ++ &quorum_iface_p, ++ 0); ++ ++ if (res == -1) { ++ log_printf (LOG_LEVEL_NOTICE, ++ "Couldn't load quorum provider %s\n", ++ quorum_module); ++ return (-1); ++ } ++ ++ log_printf (LOG_LEVEL_NOTICE, ++ "Using quorum provider %s\n", quorum_module); ++ ++ quorum_iface = (struct quorum_services_api_ver1 *)quorum_iface_p; ++ quorum_iface->init (api, quorum_api_set_quorum); ++ } ++ } ++ ++ return (0); ++} ++ ++static int quorum_lib_init_fn (void *conn) ++{ ++ struct quorum_pd *pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ ++ log_printf(LOG_LEVEL_DEBUG, "lib_init_fn: conn=%p\n", conn); ++ ++ list_init (&pd->list); ++ pd->conn = conn; ++ ++ return (0); ++} ++ ++static int quorum_lib_exit_fn (void *conn) ++{ ++ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ ++ log_printf(LOG_LEVEL_DEBUG, "lib_exit_fn: conn=%p\n", conn); ++ ++ if (quorum_pd->tracking_enabled) { ++ list_del (&quorum_pd->list); ++ list_init (&quorum_pd->list); ++ } ++ return (0); ++} ++ ++ ++static void send_internal_notification(void) ++{ ++ struct list_head *tmp; ++ struct internal_callback_pd *pd; ++ ++ for (tmp = internal_trackers_list.next; tmp != &internal_trackers_list; tmp = tmp->next) { ++ ++ pd = list_entry(tmp, struct internal_callback_pd, list); ++ ++ pd->callback(primary_designated, pd->context); ++ } ++} ++ ++static void send_library_notification(void *conn) ++{ ++ int size = sizeof(struct res_lib_quorum_notification) + sizeof(unsigned int)*quorum_view_list_entries; ++ char buf[size]; ++ struct res_lib_quorum_notification *res_lib_quorum_notification = (struct res_lib_quorum_notification *)buf; ++ struct list_head *tmp; ++ int i; ++ ++ log_printf(LOG_LEVEL_DEBUG, "sending quorum notification to %p, length = %d\n", conn, size); ++ ++ res_lib_quorum_notification->quorate = primary_designated; ++ res_lib_quorum_notification->ring_seq = quorum_ring_id.seq; ++ res_lib_quorum_notification->view_list_entries = quorum_view_list_entries; ++ for (i=0; iview_list[i] = quorum_view_list[i]; ++ } ++ ++ res_lib_quorum_notification->header.id = MESSAGE_RES_QUORUM_NOTIFICATION; ++ res_lib_quorum_notification->header.size = size; ++ res_lib_quorum_notification->header.error = CS_OK; ++ ++ /* Send it to all interested parties */ ++ if (conn) { ++ corosync_api->ipc_conn_send_response(conn, res_lib_quorum_notification, size); ++ } ++ else { ++ struct quorum_pd *qpd; ++ ++ for (tmp = lib_trackers_list.next; tmp != &lib_trackers_list; tmp = tmp->next) { ++ ++ qpd = list_entry(tmp, struct quorum_pd, list); ++ ++ corosync_api->ipc_conn_send_response(corosync_api->ipc_conn_partner_get(qpd->conn), ++ res_lib_quorum_notification, size); ++ } ++ } ++ return; ++} ++ ++static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg) ++{ ++ struct res_lib_quorum_getquorate res_lib_quorum_getquorate; ++ ++ log_printf(LOG_LEVEL_DEBUG, "got quorate request on %p\n", conn); ++ ++ /* send status */ ++ res_lib_quorum_getquorate.quorate = primary_designated; ++ res_lib_quorum_getquorate.header.size = sizeof(res_lib_quorum_getquorate); ++ res_lib_quorum_getquorate.header.id = MESSAGE_RES_QUORUM_GETQUORATE; ++ res_lib_quorum_getquorate.header.error = CS_OK; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_quorum_getquorate, sizeof(res_lib_quorum_getquorate)); ++} ++ ++ ++static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg) ++{ ++ struct req_lib_quorum_trackstart *req_lib_quorum_trackstart = (struct req_lib_quorum_trackstart *)msg; ++ mar_res_header_t res; ++ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ ++ log_printf(LOG_LEVEL_DEBUG, "got trackstart request on %p\n", conn); ++ ++ /* ++ * If an immediate listing of the current cluster membership ++ * is requested, generate membership list ++ */ ++ if (req_lib_quorum_trackstart->track_flags & CS_TRACK_CURRENT || ++ req_lib_quorum_trackstart->track_flags & CS_TRACK_CHANGES) { ++ log_printf(LOG_LEVEL_DEBUG, "sending initial status to %p\n", conn); ++ send_library_notification(corosync_api->ipc_conn_partner_get (conn)); ++ } ++ ++ /* ++ * Record requests for tracking ++ */ ++ if (req_lib_quorum_trackstart->track_flags & CS_TRACK_CHANGES || ++ req_lib_quorum_trackstart->track_flags & CS_TRACK_CHANGES_ONLY) { ++ ++ quorum_pd->track_flags = req_lib_quorum_trackstart->track_flags; ++ quorum_pd->tracking_enabled = 1; ++ ++ list_add (&quorum_pd->list, &lib_trackers_list); ++ } ++ ++ /* send status */ ++ res.size = sizeof(res); ++ res.id = MESSAGE_RES_QUORUM_TRACKSTART; ++ res.error = CS_OK; ++ corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t)); ++} ++ ++static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg) ++{ ++ mar_res_header_t res; ++ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ ++ log_printf(LOG_LEVEL_DEBUG, "got trackstop request on %p\n", conn); ++ ++ if (quorum_pd->tracking_enabled) { ++ res.error = CS_OK; ++ quorum_pd->tracking_enabled = 0; ++ list_del (&quorum_pd->list); ++ list_init (&quorum_pd->list); ++ } else { ++ res.error = CS_ERR_NOT_EXIST; ++ } ++ ++ /* send status */ ++ res.size = sizeof(res); ++ res.id = MESSAGE_RES_QUORUM_TRACKSTOP; ++ res.error = CS_OK; ++ corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t)); ++} ++ +diff -Naurd corosync-0.92/exec/vsf_ykd.c corosync-trunk/exec/vsf_ykd.c +--- corosync-0.92/exec/vsf_ykd.c 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/exec/vsf_ykd.c 2008-12-08 16:55:41.000000000 +0100 +@@ -56,12 +56,12 @@ + #include + + #include ++#include ++#include ++#include + #include + #include + +-#include "main.h" +-#include "vsf.h" +- + LOGSYS_DECLARE_SUBSYS ("YKD", LOG_INFO); + + #define YKD_PROCESSOR_COUNT_MAX 32 +@@ -108,7 +108,7 @@ + + struct ykd_state ykd_state; + +-static totempg_groups_handle ykd_group_handle; ++static cs_tpg_handle ykd_group_handle; + + static struct state_received state_received_confchg[YKD_PROCESSOR_COUNT_MAX]; + +@@ -140,6 +140,8 @@ + + static void *ykd_state_send_callback_token_handle = 0; + ++static struct corosync_api_v1 *api; ++ + static void (*ykd_primary_callback_fn) ( + unsigned int *view_list, + int view_list_entries, +@@ -168,15 +170,15 @@ + iovec[1].iov_base = (char *)&ykd_state; + iovec[1].iov_len = sizeof (struct ykd_state); + +- res = totempg_groups_mcast_joined (ykd_group_handle, iovec, 2, +- TOTEMPG_AGREED); ++ res = api->tpg_joined_mcast (ykd_group_handle, iovec, 2, ++ TOTEM_AGREED); + + return (res); + } + + static void ykd_state_send (void) + { +- totempg_callback_token_create ( ++ api->totem_callback_token_create ( + &ykd_state_send_callback_token_handle, + TOTEM_CALLBACK_TOKEN_SENT, + 1, /* delete after callback */ +@@ -195,15 +197,15 @@ + iovec.iov_base = (char *)&header; + iovec.iov_len = sizeof (struct ykd_header); + +- res = totempg_groups_mcast_joined (ykd_group_handle, &iovec, 1, +- TOTEMPG_AGREED); ++ res = api->tpg_joined_mcast (ykd_group_handle, &iovec, 1, ++ TOTEM_AGREED); + + return (res); + } + + static void ykd_attempt_send (void) + { +- totempg_callback_token_create ( ++ api->totem_callback_token_create ( + &ykd_attempt_send_callback_token_handle, + TOTEM_CALLBACK_TOKEN_SENT, + 1, /* delete after callback */ +@@ -460,7 +462,7 @@ + memcpy (&ykd_ring_id, ring_id, sizeof (struct memb_ring_id)); + + if (first_run) { +- ykd_state.last_primary.member_list[0] = totempg_my_nodeid_get(); ++ ykd_state.last_primary.member_list[0] = api->totem_nodeid_get(); + ykd_state.last_primary.member_list_entries = 1; + ykd_state.last_primary.session_id = 0; + first_run = 0; +@@ -493,53 +495,41 @@ + ykd_state_send (); + } + +-struct totempg_group ykd_group = { ++struct corosync_tpg_group ykd_group = { + .group = "ykd", + .group_len = 3 + }; + +-static int ykd_init ( +- void (*primary_callback_fn) ( +- unsigned int *view_list, +- int view_list_entries, +- int primary_designated, +- struct memb_ring_id *ring_id)) ++static void ykd_init ( ++ struct corosync_api_v1 *corosync_api, ++ quorum_set_quorate_fn_t set_primary) + { +- ykd_primary_callback_fn = primary_callback_fn; ++ ykd_primary_callback_fn = set_primary; ++ api = corosync_api; + +- totempg_groups_initialize ( ++ api->tpg_init ( + &ykd_group_handle, + ykd_deliver_fn, + ykd_confchg_fn); + +- totempg_groups_join ( ++ api->tpg_join ( + ykd_group_handle, + &ykd_group, + 1); + + ykd_state_init (); +- +- return (0); +-} +- +-/* +- * Returns 1 if this processor is in the primary +- */ +-static int ykd_primary (void) { +- return (primary_designated); + } + + /* + * lcrso object definition + */ +-static struct corosync_vsf_iface_ver0 vsf_ykd_iface_ver0 = { ++static struct quorum_services_api_ver1 vsf_ykd_iface_ver0 = { + .init = ykd_init, +- .primary = ykd_primary + }; + + static struct lcr_iface corosync_vsf_ykd_ver0[1] = { + { +- .name = "corosync_vsf_ykd", ++ .name = "corosync_quorum_ykd", + .version = 0, + .versions_replace = 0, + .versions_replace_count = 0, +diff -Naurd corosync-0.92/include/corosync/ais_util.h corosync-trunk/include/corosync/ais_util.h +--- corosync-0.92/include/corosync/ais_util.h 2008-08-14 16:59:50.000000000 +0200 ++++ corosync-trunk/include/corosync/ais_util.h 2008-11-06 22:49:07.000000000 +0100 +@@ -67,71 +67,71 @@ + + struct saVersionDatabase { + int versionCount; +- SaVersionT *versionsSupported; ++ cs_version_t *versionsSupported; + }; + +-SaAisErrorT saSendMsgRetry ( ++cs_error_t saSendMsgRetry ( + int s, + struct iovec *iov, + int iov_len); + +-SaAisErrorT saSendMsgReceiveReply ( ++cs_error_t saSendMsgReceiveReply ( + int s, + struct iovec *iov, + int iov_len, + void *responseMessage, + int responseLen); + +-SaAisErrorT saSendReceiveReply ( ++cs_error_t saSendReceiveReply ( + int s, + void *requestMessage, + int requestLen, + void *responseMessage, + int responseLen); + +-SaAisErrorT ++cs_error_t + saPollRetry ( + struct pollfd *ufds, + unsigned int nfds, + int timeout); + +-SaAisErrorT ++cs_error_t + saHandleCreate ( + struct saHandleDatabase *handleDatabase, + int instanceSize, +- SaUint64T *handleOut); ++ uint64_t *handleOut); + +-SaAisErrorT ++cs_error_t + saHandleDestroy ( + struct saHandleDatabase *handleDatabase, +- SaUint64T handle); ++ uint64_t handle); + +-SaAisErrorT ++cs_error_t + saHandleInstanceGet ( + struct saHandleDatabase *handleDatabase, +- SaUint64T handle, ++ uint64_t handle, + void **instance); + +-SaAisErrorT ++cs_error_t + saHandleInstancePut ( + struct saHandleDatabase *handleDatabase, +- SaUint64T handle); ++ uint64_t handle); + +-SaAisErrorT ++cs_error_t + saVersionVerify ( + struct saVersionDatabase *versionDatabase, +- SaVersionT *version); ++ cs_version_t *version); + + #define offset_of(type,member) (int)(&(((type *)0)->member)) + +-SaTimeT ++cs_time_t + clustTimeNow(void); + +-extern SaAisErrorT saServiceConnect ( ++extern cs_error_t saServiceConnect ( + int *responseOut, int *callbackOut, enum service_types service); + +-extern SaAisErrorT saRecvRetry (int s, void *msg, size_t len); ++extern cs_error_t saRecvRetry (int s, void *msg, size_t len); + +-extern SaAisErrorT saSendRetry (int s, const void *msg, size_t len); ++extern cs_error_t saSendRetry (int s, const void *msg, size_t len); + + #endif /* AIS_UTIL_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync/cfg.h +--- corosync-0.92/include/corosync/cfg.h 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/include/corosync/cfg.h 2008-11-06 22:49:07.000000000 +0100 +@@ -36,9 +36,9 @@ + #define AIS_COROSYNCCFG_H_DEFINED + + #include +-#include "saAis.h" ++#include + +-typedef SaUint64T corosync_cfg_handle_t; ++typedef uint64_t corosync_cfg_handle_t; + + typedef enum { + COROSYNC_CFG_ADMINISTRATIVETARGET_SERVICEUNIT = 0, +@@ -82,24 +82,46 @@ + COROSYNC_CFG_STATETYPE_PRESENCE = 4 + } CorosyncCfgStateTypeT; + ++/* Shutdown types. ++ REQUEST is the normal shutdown. other daemons will be consulted ++ REGARDLESS will tell other daemons but ignore their opinions ++ IMMEDIATE will shut down straight away (but still tell other nodes) ++*/ ++typedef enum { ++ COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST = 0, ++ COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS = 1, ++ COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE = 2, ++} CorosyncCfgShutdownFlagsT; ++ ++typedef enum { ++ COROSYNC_CFG_SHUTDOWN_FLAG_NO = 0, ++ COROSYNC_CFG_SHUTDOWN_FLAG_YES = 1, ++} CorosyncCfgShutdownReplyFlagsT; ++ + typedef struct { +- SaNameT name; ++ cs_name_t name; + CorosyncCfgStateTypeT stateType; + CorosyncCfgAdministrativeStateT administrativeState; + } CorosyncCfgStateNotificationT; + + typedef struct { +- SaUint32T numberOfItems; ++ uint32_t numberOfItems; + CorosyncCfgStateNotificationT *notification; + } CorosyncCfgStateNotificationBufferT; + + typedef void (*CorosyncCfgStateTrackCallbackT) ( + CorosyncCfgStateNotificationBufferT *notificationBuffer, +- SaAisErrorT error); ++ cs_error_t error); ++ ++typedef void (*CorosyncCfgShutdownCallbackT) ( ++ corosync_cfg_handle_t cfg_handle, ++ CorosyncCfgShutdownFlagsT flags); + + typedef struct { + CorosyncCfgStateTrackCallbackT + corosyncCfgStateTrackCallback; ++ CorosyncCfgShutdownCallbackT ++ corosyncCfgShutdownCallback; + } CorosyncCfgCallbacksT; + + /* +@@ -109,67 +131,84 @@ + extern "C" { + #endif + +-SaAisErrorT ++cs_error_t + corosync_cfg_initialize ( + corosync_cfg_handle_t *cfg_handle, + const CorosyncCfgCallbacksT *cfgCallbacks); + +-SaAisErrorT ++cs_error_t + corosync_cfg_fd_get ( + corosync_cfg_handle_t cfg_handle, +- SaSelectionObjectT *selectionObject); ++ int32_t *selection_fd); + +-SaAisErrorT ++cs_error_t + corosync_cfg_dispatch ( + corosync_cfg_handle_t cfg_handle, +- SaDispatchFlagsT dispatchFlags); ++ cs_dispatch_flags_t dispatchFlags); + +-SaAisErrorT ++cs_error_t + corosync_cfg_finalize ( + corosync_cfg_handle_t cfg_handle); + +-SaAisErrorT ++cs_error_t + corosync_cfg_ring_status_get ( + corosync_cfg_handle_t cfg_handle, + char ***interface_names, + char ***status, + unsigned int *interface_count); + +-SaAisErrorT ++cs_error_t + corosync_cfg_ring_reenable ( + corosync_cfg_handle_t cfg_handle); + +-SaAisErrorT ++cs_error_t + corosync_cfg_service_load ( + corosync_cfg_handle_t cfg_handle, + char *service_name, + unsigned int service_ver); + +-SaAisErrorT ++cs_error_t + corosync_cfg_service_unload ( + corosync_cfg_handle_t cfg_handle, + char *service_name, + unsigned int service_ver); + +-SaAisErrorT ++cs_error_t + corosync_cfg_administrative_state_get ( + corosync_cfg_handle_t cfg_handle, + CorosyncCfgAdministrativeTargetT administrativeTarget, + CorosyncCfgAdministrativeStateT *administrativeState); + +-SaAisErrorT ++cs_error_t + corosync_cfg_administrative_state_set ( + corosync_cfg_handle_t cfg_handle, + CorosyncCfgAdministrativeTargetT administrativeTarget, + CorosyncCfgAdministrativeStateT administrativeState); + +-SaAisErrorT ++cs_error_t ++corosync_cfg_kill_node ( ++ corosync_cfg_handle_t cfg_handle, ++ unsigned int nodeid, ++ char *reason); ++ ++cs_error_t ++corosync_cfg_try_shutdown ( ++ corosync_cfg_handle_t cfg_handle, ++ CorosyncCfgShutdownFlagsT flags); ++ ++ ++cs_error_t ++corosync_cfg_replyto_shutdown ( ++ corosync_cfg_handle_t cfg_handle, ++ CorosyncCfgShutdownReplyFlagsT flags); ++ ++cs_error_t + corosync_cfg_state_track ( + corosync_cfg_handle_t cfg_handle, +- SaUint8T trackFlags, ++ uint8_t trackFlags, + const CorosyncCfgStateNotificationT *notificationBuffer); + +-SaAisErrorT ++cs_error_t + corosync_cfg_state_track_stop ( + corosync_cfg_handle_t cfg_handle); + +diff -Naurd corosync-0.92/include/corosync/confdb.h corosync-trunk/include/corosync/confdb.h +--- corosync-0.92/include/corosync/confdb.h 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/include/corosync/confdb.h 2008-11-06 22:49:07.000000000 +0100 +@@ -34,6 +34,7 @@ + #ifndef COROSYNC_CONFDB_H_DEFINED + #define COROSYNC_CONFDB_H_DEFINED + ++#include + /** + * @addtogroup confdb_corosync + * +@@ -44,33 +45,11 @@ + #define OBJECT_PARENT_HANDLE 0 + + typedef enum { +- CONFDB_DISPATCH_ONE, +- CONFDB_DISPATCH_ALL, +- CONFDB_DISPATCH_BLOCKING +-} confdb_dispatch_t; +- +-typedef enum { + CONFDB_TRACK_DEPTH_ONE, + CONFDB_TRACK_DEPTH_RECURSIVE + } confdb_track_depth_t; + + typedef enum { +- CONFDB_OK = 1, +- CONFDB_ERR_LIBRARY = 2, +- CONFDB_ERR_TIMEOUT = 5, +- CONFDB_ERR_TRY_AGAIN = 6, +- CONFDB_ERR_INVALID_PARAM = 7, +- CONFDB_ERR_NO_MEMORY = 8, +- CONFDB_ERR_BAD_HANDLE = 9, +- CONFDB_ERR_ACCESS = 11, +- CONFDB_ERR_NOT_EXIST = 12, +- CONFDB_ERR_EXIST = 14, +- CONFDB_ERR_CONTEXT_NOT_FOUND = 17, +- CONFDB_ERR_NOT_SUPPORTED = 20, +- CONFDB_ERR_SECURITY = 29, +-} confdb_error_t; +- +-typedef enum { + OBJECT_KEY_CREATED, + OBJECT_KEY_REPLACED, + OBJECT_KEY_DELETED +@@ -112,28 +91,28 @@ + /* + * Create a new confdb connection + */ +-confdb_error_t confdb_initialize ( ++cs_error_t confdb_initialize ( + confdb_handle_t *handle, + confdb_callbacks_t *callbacks); + + /* + * Close the confdb handle + */ +-confdb_error_t confdb_finalize ( ++cs_error_t confdb_finalize ( + confdb_handle_t handle); + + + /* + * Write back the configuration + */ +-confdb_error_t confdb_write ( ++cs_error_t confdb_write ( + confdb_handle_t handle, + char *error_text); + + /* + * Reload the configuration + */ +-confdb_error_t confdb_reload ( ++cs_error_t confdb_reload ( + confdb_handle_t handle, + int flush, + char *error_text); +@@ -142,43 +121,43 @@ + * Get a file descriptor on which to poll. confdb_handle_t is NOT a + * file descriptor and may not be used directly. + */ +-confdb_error_t confdb_fd_get ( ++cs_error_t confdb_fd_get ( + confdb_handle_t handle, + int *fd); + + /* + * Dispatch configuration changes + */ +-confdb_error_t confdb_dispatch ( ++cs_error_t confdb_dispatch ( + confdb_handle_t handle, +- confdb_dispatch_t dispatch_types); ++ cs_dispatch_flags_t dispatch_types); + + /* + * Change notification + */ +-confdb_error_t confdb_track_changes ( ++cs_error_t confdb_track_changes ( + confdb_handle_t handle, + unsigned int object_handle, + unsigned int flags); + +-confdb_error_t confdb_stop_track_changes ( ++cs_error_t confdb_stop_track_changes ( + confdb_handle_t handle); + + /* + * Manipulate objects + */ +-confdb_error_t confdb_object_create ( ++cs_error_t confdb_object_create ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *object_name, + int object_name_len, + unsigned int *object_handle); + +-confdb_error_t confdb_object_destroy ( ++cs_error_t confdb_object_destroy ( + confdb_handle_t handle, + unsigned int object_handle); + +-confdb_error_t confdb_object_parent_get ( ++cs_error_t confdb_object_parent_get ( + confdb_handle_t handle, + unsigned int object_handle, + unsigned int *parent_object_handle); +@@ -186,7 +165,7 @@ + /* + * Manipulate keys + */ +-confdb_error_t confdb_key_create ( ++cs_error_t confdb_key_create ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -194,7 +173,7 @@ + void *value, + int value_len); + +-confdb_error_t confdb_key_delete ( ++cs_error_t confdb_key_delete ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -205,7 +184,7 @@ + /* + * Key queries + */ +-confdb_error_t confdb_key_get ( ++cs_error_t confdb_key_get ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -213,7 +192,7 @@ + void *value, + int *value_len); + +-confdb_error_t confdb_key_replace ( ++cs_error_t confdb_key_replace ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -223,14 +202,14 @@ + void *new_value, + int new_value_len); + +-confdb_error_t confdb_key_increment ( ++cs_error_t confdb_key_increment ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, + int key_name_len, + unsigned int *value); + +-confdb_error_t confdb_key_decrement ( ++cs_error_t confdb_key_decrement ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -243,44 +222,44 @@ + * a quick way of finding a specific object, + * "iter" returns each object in sequence. + */ +-confdb_error_t confdb_object_find_start ( ++cs_error_t confdb_object_find_start ( + confdb_handle_t handle, + unsigned int parent_object_handle); + +-confdb_error_t confdb_object_find ( ++cs_error_t confdb_object_find ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *object_name, + int object_name_len, + unsigned int *object_handle); + +-confdb_error_t confdb_object_find_destroy( ++cs_error_t confdb_object_find_destroy( + confdb_handle_t handle, + unsigned int parent_object_handle); + +-confdb_error_t confdb_object_iter_start ( ++cs_error_t confdb_object_iter_start ( + confdb_handle_t handle, + unsigned int parent_object_handle); + +-confdb_error_t confdb_object_iter ( ++cs_error_t confdb_object_iter ( + confdb_handle_t handle, + unsigned int parent_object_handle, + unsigned int *object_handle, + void *object_name, + int *object_name_len); + +-confdb_error_t confdb_object_iter_destroy( ++cs_error_t confdb_object_iter_destroy( + confdb_handle_t handle, + unsigned int parent_object_handle); + + /* + * Key iterator + */ +-confdb_error_t confdb_key_iter_start ( ++cs_error_t confdb_key_iter_start ( + confdb_handle_t handle, + unsigned int object_handle); + +-confdb_error_t confdb_key_iter ( ++cs_error_t confdb_key_iter ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +diff -Naurd corosync-0.92/include/corosync/corotypes.h corosync-trunk/include/corosync/corotypes.h +--- corosync-0.92/include/corosync/corotypes.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/corotypes.h 2008-11-07 02:34:43.000000000 +0100 +@@ -0,0 +1,178 @@ ++/* ++ * Copyright (c) 2008 Allied Telesis Labs. ++ * ++ * All rights reserved. ++ * ++ * Author: Angus Salkeld (ahsalkeld@gmail.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. ++ */ ++ ++#ifndef COROTYPES_H_DEFINED ++#define COROTYPES_H_DEFINED ++ ++#ifndef COROSYNC_SOLARIS ++#include ++#else ++#include ++#endif ++ ++typedef int64_t cs_time_t; ++ ++#define CS_FALSE 0 ++#define CS_TRUE !CS_FALSE ++#define CS_MAX_NAME_LENGTH 256 ++#define CS_TIME_END ((cs_time_t)0x7FFFFFFFFFFFFFFFULL) ++ ++typedef struct { ++ uint16_t length; ++ uint8_t value[CS_MAX_NAME_LENGTH]; ++} cs_name_t; ++ ++typedef struct { ++ char releaseCode; ++ unsigned char majorVersion; ++ unsigned char minorVersion; ++} cs_version_t; ++ ++typedef enum { ++ CS_DISPATCH_ONE = 1, ++ CS_DISPATCH_ALL = 2, ++ CS_DISPATCH_BLOCKING = 3 ++} cs_dispatch_flags_t; ++ ++#define CS_TRACK_CURRENT 0x01 ++#define CS_TRACK_CHANGES 0x02 ++#define CS_TRACK_CHANGES_ONLY 0x04 ++ ++typedef enum { ++ CS_OK = 1, ++ CS_ERR_LIBRARY = 2, ++ CS_ERR_VERSION = 3, ++ CS_ERR_INIT = 4, ++ CS_ERR_TIMEOUT = 5, ++ CS_ERR_TRY_AGAIN = 6, ++ CS_ERR_INVALID_PARAM = 7, ++ CS_ERR_NO_MEMORY = 8, ++ CS_ERR_BAD_HANDLE = 9, ++ CS_ERR_BUSY = 10, ++ CS_ERR_ACCESS = 11, ++ CS_ERR_NOT_EXIST = 12, ++ CS_ERR_NAME_TOO_LONG = 13, ++ CS_ERR_EXIST = 14, ++ CS_ERR_NO_SPACE = 15, ++ CS_ERR_INTERRUPT = 16, ++ CS_ERR_NAME_NOT_FOUND = 17, ++ CS_ERR_NO_RESOURCES = 18, ++ CS_ERR_NOT_SUPPORTED = 19, ++ CS_ERR_BAD_OPERATION = 20, ++ CS_ERR_FAILED_OPERATION = 21, ++ CS_ERR_MESSAGE_ERROR = 22, ++ CS_ERR_QUEUE_FULL = 23, ++ CS_ERR_QUEUE_NOT_AVAILABLE = 24, ++ CS_ERR_BAD_FLAGS = 25, ++ CS_ERR_TOO_BIG = 26, ++ CS_ERR_NO_SECTIONS = 27, ++ CS_ERR_CONTEXT_NOT_FOUND = 28, ++ CS_ERR_TOO_MANY_GROUPS = 30 ++} cs_error_t; ++ ++ ++/* ++ * DEPRECATED ++ */ ++#define EVS_DISPATCH_ONE CS_DISPATCH_ONE ++#define EVS_DISPATCH_ALL CS_DISPATCH_ALL ++#define EVS_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING ++#define EVS_OK CS_OK ++#define EVS_ERR_LIBRARY CS_ERR_ERR_LIBRARY ++#define EVS_ERR_TIMEOUT CS_ERR_TIMEOUT ++#define EVS_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN ++#define EVS_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM ++#define EVS_ERR_NO_MEMORY CS_ERR_NO_MEMORY ++#define EVS_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE ++#define EVS_ERR_ACCESS CS_ERR_ACCESS ++#define EVS_ERR_NOT_EXIST CS_ERR_NOT_EXIST ++#define EVS_ERR_EXIST CS_ERR_EXIST ++#define EVS_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED ++#define EVS_ERR_SECURITY CS_ERR_SECURITY ++#define EVS_ERR_TOO_MANY_GROUPS CS_ERR_TOO_MANY_GROUPS ++#define evs_error_t cs_error_t ++ ++#define CPG_DISPATCH_ONE CS_DISPATCH_ONE ++#define CPG_DISPATCH_ALL CS_DISPATCH_ALL ++#define CPG_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING ++#define CPG_OK CS_OK ++#define CPG_ERR_LIBRARY CS_ERR_ERR_LIBRARY ++#define CPG_ERR_TIMEOUT CS_ERR_TIMEOUT ++#define CPG_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN ++#define CPG_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM ++#define CPG_ERR_NO_MEMORY CS_ERR_NO_MEMORY ++#define CPG_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE ++#define CPG_ERR_ACCESS CS_ERR_ACCESS ++#define CPG_ERR_NOT_EXIST CS_ERR_NOT_EXIST ++#define CPG_ERR_EXIST CS_ERR_EXIST ++#define CPG_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED ++#define CPG_ERR_SECURITY CS_ERR_SECURITY ++#define cpg_error_t cs_error_t ++ ++#define CONFDB_DISPATCH_ONE CS_DISPATCH_ONE ++#define CONFDB_DISPATCH_ALL CS_DISPATCH_ALL ++#define CONFDB_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING ++#define CONFDB_OK CS_OK ++#define CONFDB_ERR_LIBRARY CS_ERR_ERR_LIBRARY ++#define CONFDB_ERR_TIMEOUT CS_ERR_TIMEOUT ++#define CONFDB_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN ++#define CONFDB_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM ++#define CONFDB_ERR_NO_MEMORY CS_ERR_NO_MEMORY ++#define CONFDB_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE ++#define CONFDB_ERR_ACCESS CS_ERR_ACCESS ++#define CONFDB_ERR_NOT_EXIST CS_ERR_NOT_EXIST ++#define CONFDB_ERR_EXIST CS_ERR_EXIST ++#define CONFDB_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED ++#define CONFDB_ERR_SECURITY CS_ERR_SECURITY ++#define confdb_error_t cs_error_t ++ ++#define QUORUM_DISPATCH_ONE CS_DISPATCH_ONE ++#define QUORUM_DISPATCH_ALL CS_DISPATCH_ALL ++#define QUORUM_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING ++#define QUORUM_OK CS_OK ++#define QUORUM_ERR_LIBRARY CS_ERR_ERR_LIBRARY ++#define QUORUM_ERR_TIMEOUT CS_ERR_TIMEOUT ++#define QUORUM_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN ++#define QUORUM_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM ++#define QUORUM_ERR_NO_MEMORY CS_ERR_NO_MEMORY ++#define QUORUM_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE ++#define QUORUM_ERR_ACCESS CS_ERR_ACCESS ++#define QUORUM_ERR_NOT_EXIST CS_ERR_NOT_EXIST ++#define QUORUM_ERR_EXIST CS_ERR_EXIST ++#define QUORUM_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED ++#define QUORUM_ERR_SECURITY CS_ERR_SECURITY ++#define quorum_error_t cs_error_t ++ ++#endif ++ +diff -Naurd corosync-0.92/include/corosync/cpg.h corosync-trunk/include/corosync/cpg.h +--- corosync-0.92/include/corosync/cpg.h 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/include/corosync/cpg.h 2008-11-06 22:49:07.000000000 +0100 +@@ -35,6 +35,7 @@ + #define COROSYNC_CPG_H_DEFINED + + #include ++#include + + /** + * @addtogroup cpg_corosync +@@ -44,12 +45,6 @@ + typedef uint64_t cpg_handle_t; + + typedef enum { +- CPG_DISPATCH_ONE, +- CPG_DISPATCH_ALL, +- CPG_DISPATCH_BLOCKING +-} cpg_dispatch_t; +- +-typedef enum { + CPG_TYPE_UNORDERED, /* not implemented */ + CPG_TYPE_FIFO, /* same as agreed */ + CPG_TYPE_AGREED, +@@ -61,21 +56,6 @@ + CPG_FLOW_CONTROL_ENABLED /* flow control is enabled - new messages should not be sent */ + } cpg_flow_control_state_t; + +-typedef enum { +- CPG_OK = 1, +- CPG_ERR_LIBRARY = 2, +- CPG_ERR_TIMEOUT = 5, +- CPG_ERR_TRY_AGAIN = 6, +- CPG_ERR_INVALID_PARAM = 7, +- CPG_ERR_NO_MEMORY = 8, +- CPG_ERR_BAD_HANDLE = 9, +- CPG_ERR_ACCESS = 11, +- CPG_ERR_NOT_EXIST = 12, +- CPG_ERR_EXIST = 14, +- CPG_ERR_NOT_SUPPORTED = 20, +- CPG_ERR_SECURITY = 29, +- CPG_ERR_TOO_MANY_GROUPS=30 +-} cpg_error_t; + + typedef enum { + CPG_REASON_JOIN = 1, +@@ -132,32 +112,32 @@ + /* + * Create a new cpg connection + */ +-cpg_error_t cpg_initialize ( ++cs_error_t cpg_initialize ( + cpg_handle_t *handle, + cpg_callbacks_t *callbacks); + + /* + * Close the cpg handle + */ +-cpg_error_t cpg_finalize ( ++cs_error_t cpg_finalize ( + cpg_handle_t handle); + + /* + * Get a file descriptor on which to poll. cpg_handle_t is NOT a + * file descriptor and may not be used directly. + */ +-cpg_error_t cpg_fd_get ( ++cs_error_t cpg_fd_get ( + cpg_handle_t handle, + int *fd); + + /* + * Get and set contexts for a CPG handle + */ +-cpg_error_t cpg_context_get ( ++cs_error_t cpg_context_get ( + cpg_handle_t handle, + void **context); + +-cpg_error_t cpg_context_set ( ++cs_error_t cpg_context_set ( + cpg_handle_t handle, + void *context); + +@@ -165,9 +145,9 @@ + /* + * Dispatch messages and configuration changes + */ +-cpg_error_t cpg_dispatch ( ++cs_error_t cpg_dispatch ( + cpg_handle_t handle, +- cpg_dispatch_t dispatch_types); ++ cs_dispatch_flags_t dispatch_types); + + /* + * Join one or more groups. +@@ -175,14 +155,14 @@ + * group that has been joined on handle handle. Any message multicasted + * to a group that has been previously joined will be delivered in cpg_dispatch + */ +-cpg_error_t cpg_join ( ++cs_error_t cpg_join ( + cpg_handle_t handle, + struct cpg_name *group); + + /* + * Leave one or more groups + */ +-cpg_error_t cpg_leave ( ++cs_error_t cpg_leave ( + cpg_handle_t handle, + struct cpg_name *group); + +@@ -191,7 +171,7 @@ + * The iovec described by iovec will be multicasted to all groups joined with + * the cpg_join interface for handle. + */ +-cpg_error_t cpg_mcast_joined ( ++cs_error_t cpg_mcast_joined ( + cpg_handle_t handle, + cpg_guarantee_t guarantee, + struct iovec *iovec, +@@ -200,21 +180,21 @@ + /* + * Get membership information from cpg + */ +-cpg_error_t cpg_membership_get ( ++cs_error_t cpg_membership_get ( + cpg_handle_t handle, + struct cpg_name *groupName, + struct cpg_address *member_list, + int *member_list_entries); + +-cpg_error_t cpg_local_get ( ++cs_error_t cpg_local_get ( + cpg_handle_t handle, + unsigned int *local_nodeid); + +-cpg_error_t cpg_groups_get ( ++cs_error_t cpg_groups_get ( + cpg_handle_t handle, + unsigned int *num_groups); + +-cpg_error_t cpg_flow_control_state_get ( ++cs_error_t cpg_flow_control_state_get ( + cpg_handle_t handle, + cpg_flow_control_state_t *flow_control_enabled); + +diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/include/corosync/engine/coroapi.h +--- corosync-0.92/include/corosync/engine/coroapi.h 2008-09-17 21:15:00.000000000 +0200 ++++ corosync-trunk/include/corosync/engine/coroapi.h 2008-12-08 16:55:41.000000000 +0100 +@@ -41,7 +41,7 @@ + + typedef void * corosync_timer_handle_t; + +-typedef unsigned int corosync_tpg_handle; ++typedef unsigned int cs_tpg_handle; + + struct corosync_tpg_group { + void *group; +@@ -88,17 +88,36 @@ + }; + #endif + +-enum corosync_lib_flow_control { +- COROSYNC_LIB_FLOW_CONTROL_REQUIRED = 1, +- COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED = 2 ++#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 corosync_flow_control_state { +- COROSYNC_FLOW_CONTROL_STATE_DISABLED, +- COROSYNC_FLOW_CONTROL_STATE_ENABLED ++enum cs_flow_control_state { ++ CS_FLOW_CONTROL_STATE_DISABLED, ++ CS_FLOW_CONTROL_STATE_ENABLED + }; +-#endif ++#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 */ + + typedef enum { + COROSYNC_FATAL_ERROR_EXIT = -1, +@@ -109,7 +128,8 @@ + COROSYNC_DYNAMICLOAD = -12, + COROSYNC_OUT_OF_MEMORY = -15, + COROSYNC_FATAL_ERR = -16 +-} corosync_fatal_error_t; ++} cs_fatal_error_t; ++#define corosync_fatal_error_t cs_fatal_error_t; + + #ifndef OBJECT_PARENT_HANDLE + +@@ -125,6 +145,7 @@ + int key_len; + int (*validate_callback) (void *key, int key_len, void *value, int value_len); + }; ++/* deprecated */ + + typedef enum { + OBJECT_TRACK_DEPTH_ONE, +@@ -137,6 +158,11 @@ + OBJECT_KEY_DELETED + } object_change_type_t; + ++typedef enum { ++ OBJDB_RELOAD_NOTIFY_START, ++ OBJDB_RELOAD_NOTIFY_END ++} objdb_reload_notify_type_t; ++ + typedef void (*object_key_change_notify_fn_t)(object_change_type_t change_type, + unsigned int parent_object_handle, + unsigned int object_handle, +@@ -159,8 +185,30 @@ + object_change_type_t type, + void * priv_data_pt); + ++typedef void (*object_reload_notify_fn_t) (objdb_reload_notify_type_t, int flush, ++ void *priv_data_pt); ++ + #endif /* OBJECT_PARENT_HANDLE_DEFINED */ + ++#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) ( ++ unsigned int *view_list, ++ int view_list_entries, ++ int primary_designated, ++ struct memb_ring_id *ring_id); ++ ++#endif /* QUORUM_H_DEFINED */ ++ ++ + struct corosync_api_v1 { + /* + * Object and configuration APIs +@@ -280,12 +328,14 @@ + object_key_change_notify_fn_t key_change_notify_fn, + object_create_notify_fn_t object_create_notify_fn, + object_destroy_notify_fn_t object_destroy_notify_fn, ++ object_reload_notify_fn_t object_reload_notify_fn, + void * priv_data_pt); + + void (*object_track_stop) ( + object_key_change_notify_fn_t key_change_notify_fn, + object_create_notify_fn_t object_create_notify_fn, + object_destroy_notify_fn_t object_destroy_notify_fn, ++ object_reload_notify_fn_t object_reload_notify_fn, + void * priv_data_pt); + + int (*object_write_config) (char **error_string); +@@ -357,7 +407,7 @@ + int id_len, + void (*flow_control_state_set_fn) + (void *context, +- enum corosync_flow_control_state flow_control_state_set), ++ enum cs_flow_control_state flow_control_state_set), + void *context); + + void (*ipc_fc_destroy) ( +@@ -373,7 +423,7 @@ + /* + * Totem APIs + */ +- int (*totem_nodeid_get) (void); ++ unsigned int (*totem_nodeid_get) (void); + + int (*totem_family_get) (void); + +@@ -393,12 +443,20 @@ + + char *(*totem_ip_print) (struct totem_ip_address *addr); + ++ ++ 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, void *), ++ void *data); ++ + /* + * Totem open process groups API for those service engines + * wanting their own groups + */ + int (*tpg_init) ( +- corosync_tpg_handle *handle, ++ cs_tpg_handle *handle, + + void (*deliver_fn) ( + unsigned int nodeid, +@@ -414,31 +472,31 @@ + struct memb_ring_id *ring_id)); + + int (*tpg_exit) ( +- corosync_tpg_handle handle); ++ cs_tpg_handle handle); + + int (*tpg_join) ( +- corosync_tpg_handle handle, ++ cs_tpg_handle handle, + struct corosync_tpg_group *groups, + int gruop_cnt); + + int (*tpg_leave) ( +- corosync_tpg_handle handle, ++ cs_tpg_handle handle, + struct corosync_tpg_group *groups, + int gruop_cnt); + + int (*tpg_joined_mcast) ( +- corosync_tpg_handle handle, ++ cs_tpg_handle handle, + struct iovec *iovec, + int iov_len, + int guarantee); + + int (*tpg_joined_send_ok) ( +- corosync_tpg_handle handle, ++ cs_tpg_handle handle, + struct iovec *iovec, + int iov_len); + + int (*tpg_groups_mcast) ( +- corosync_tpg_handle handle, ++ cs_tpg_handle handle, + int guarantee, + struct corosync_tpg_group *groups, + int groups_cnt, +@@ -446,7 +504,7 @@ + int iov_len); + + int (*tpg_groups_send_ok) ( +- corosync_tpg_handle handle, ++ cs_tpg_handle handle, + struct corosync_tpg_group *groups, + int groups_cnt, + struct iovec *iovec, +@@ -456,6 +514,19 @@ + 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, ++ sync_callback_fn_t *sync_callback_fn); ++ ++ /* + * Plugin loading and unloading + */ + int (*plugin_interface_reference) ( +@@ -485,7 +556,7 @@ + */ + void (*error_memory_failure) (void); + #define corosync_fatal_error(err) api->fatal_error ((err), __FILE__, __LINE__) +- void (*fatal_error) (corosync_fatal_error_t err, const char *file, unsigned int line); ++ void (*fatal_error) (cs_fatal_error_t err, const char *file, unsigned int line); + }; + + #define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) ) +@@ -496,7 +567,7 @@ + void (*lib_handler_fn) (void *conn, void *msg); + int response_size; + int response_id; +- enum corosync_lib_flow_control flow_control; ++ enum cs_lib_flow_control flow_control; + }; + + struct corosync_exec_handler { +@@ -512,7 +583,8 @@ + char *name; + unsigned short id; + unsigned int private_data_size; +- enum corosync_lib_flow_control flow_control; ++ 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); +diff -Naurd corosync-0.92/include/corosync/engine/logsys.h corosync-trunk/include/corosync/engine/logsys.h +--- corosync-0.92/include/corosync/engine/logsys.h 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/include/corosync/engine/logsys.h 2008-10-30 23:25:56.000000000 +0100 +@@ -1,6 +1,6 @@ + /* + * Copyright (c) 2002-2004 MontaVista Software, Inc. +- * Copyright (c) 2006-2007 Red Hat, Inc. ++ * Copyright (c) 2006-2008 Red Hat, Inc. + * + * Author: Steven Dake (sdake@redhat.com) + * Author: Lon Hohberger (lhh@redhat.com) +@@ -41,21 +41,14 @@ + #include + + /* +- * MODE_OUTPUT_SYSLOG_* modes are mutually exclusive ++ * All of the LOG_MODE's can be ORed together for combined behavior + */ + #define LOG_MODE_OUTPUT_FILE (1<<0) + #define LOG_MODE_OUTPUT_STDERR (1<<1) +-#define LOG_MODE_OUTPUT_SYSLOG_THREADED (1<<2) +-#define LOG_MODE_OUTPUT_SYSLOG_LOSSY (1<<3) +-#define LOG_MODE_OUTPUT_SYSLOG_BLOCKING (1<<4) +-#define LOG_MODE_DISPLAY_PRIORITY (1<<5) +-#define LOG_MODE_DISPLAY_FILELINE (1<<6) +-#define LOG_MODE_DISPLAY_TIMESTAMP (1<<7) +-#define LOG_MODE_BUFFER_BEFORE_CONFIG (1<<8) +-#define LOG_MODE_FLUSH_AFTER_CONFIG (1<<9) +-#define LOG_MODE_SHORT_FILELINE (1<<10) +-#define LOG_MODE_NOSUBSYS (1<<11) +-#define LOG_MODE_FILTER_DEBUG_FROM_SYSLOG (1<<12) ++#define LOG_MODE_OUTPUT_SYSLOG (1<<3) ++#define LOG_MODE_NOSUBSYS (1<<4) ++#define LOG_MODE_FORK (1<<5) ++#define LOG_MODE_THREADED (1<<6) + + /* + * Log priorities, compliant with syslog and SA Forum Log spec. +@@ -71,37 +64,23 @@ + #define LOG_LEVEL_DEBUG LOG_DEBUG + + /* +-** Log tags, used by _logsys_trace macros, uses 32 bits => 32 different tags +-*/ +-#define LOGSYS_TAG_LOG (1<<0) +-#define LOGSYS_TAG_ENTER (1<<1) +-#define LOGSYS_TAG_LEAVE (1<<2) +-#define LOGSYS_TAG_TRACE1 (1<<3) +-#define LOGSYS_TAG_TRACE2 (1<<4) +-#define LOGSYS_TAG_TRACE3 (1<<5) +-#define LOGSYS_TAG_TRACE4 (1<<6) +-#define LOGSYS_TAG_TRACE5 (1<<7) +-#define LOGSYS_TAG_TRACE6 (1<<8) +-#define LOGSYS_TAG_TRACE7 (1<<9) +-#define LOGSYS_TAG_TRACE8 (1<<10) ++ * The tag masks are all mutually exclusive ++ */ ++#define LOGSYS_TAG_LOG (0xff<<28) ++#define LOGSYS_TAG_ENTER (1<<27) ++#define LOGSYS_TAG_LEAVE (1<<26) ++#define LOGSYS_TAG_TRACE1 (1<<25) ++#define LOGSYS_TAG_TRACE2 (1<<24) ++#define LOGSYS_TAG_TRACE3 (1<<23) ++#define LOGSYS_TAG_TRACE4 (1<<22) ++#define LOGSYS_TAG_TRACE5 (1<<21) ++#define LOGSYS_TAG_TRACE6 (1<<20) ++#define LOGSYS_TAG_TRACE7 (1<<19) ++#define LOGSYS_TAG_TRACE8 (1<<18) + + /* + * External API + */ +- +-struct logsys_logger { +- char subsys[6]; +- unsigned int priority; +- unsigned int tags; +- unsigned int mode; +-}; +- +-extern struct logsys_logger logsys_loggers[]; +- +-extern int logsys_single_id; +- +-extern inline int logsys_mkpri (int priority, int id); +- + extern void logsys_config_mode_set ( + unsigned int mode); + +@@ -115,6 +94,9 @@ + char *name, + unsigned int facility); + ++extern void logsys_format_set ( ++ char *format); ++ + extern unsigned int logsys_config_subsys_set ( + const char *subsys, + unsigned int tags, +@@ -137,33 +119,54 @@ + extern const char *logsys_priority_name_get ( + unsigned int priority); + ++extern void logsys_fork_completed (void); ++ + extern void logsys_flush (void); + + extern void logsys_atsegv (void); + ++extern int logsys_log_rec_store (char *filename); ++ + /* + * Internal APIs that must be globally exported + */ +-extern unsigned int _logsys_subsys_create (const char *ident, ++extern unsigned int _logsys_subsys_create ( ++ const char *ident, + unsigned int priority); + + extern void _logsys_nosubsys_set (void); + +-extern int _logsys_wthread_create (void); ++extern int _logsys_rec_init (unsigned int size); + +-extern void logsys_log_printf (char *file, int line, int priority, +- char *format, ...) __attribute__((format(printf, 4, 5))); ++extern void _logsys_log_printf ( ++ int subsys, ++ char *function_name, ++ char *file_name, ++ int file_line, ++ unsigned int level, ++ char *format, ++ ...) __attribute__((format(printf, 6, 7))); + +-extern void _logsys_log_printf2 (char *file, int line, int priority, +- int id, char *format, ...) __attribute__((format(printf, 5, 6))); ++extern void _logsys_log_rec ( ++ int subsys, ++ char *function_name, ++ char *file_name, ++ int file_line, ++ unsigned int rec_ident, ++ ...); + +-extern void _logsys_trace (char *file, int line, int tag, int id, +- char *format, ...) __attribute__((format(printf, 5, 6))); ++extern int _logsys_wthread_create (void); + ++static unsigned int logsys_subsys_id __attribute__((unused)) = -1; ++ + /* + * External definitions + */ +-#define LOGSYS_DECLARE_SYSTEM(name,mode,file,facility) \ ++extern void *logsys_rec_end; ++ ++#define LOG_REC_END (&logsys_rec_end) ++ ++#define LOGSYS_DECLARE_SYSTEM(name,mode,file,facility,format,rec_size) \ + __attribute__ ((constructor)) static void logsys_system_init (void) \ + { \ + char *error_string; \ +@@ -171,13 +174,11 @@ + logsys_config_mode_set (mode); \ + logsys_config_file_set (&error_string, (file)); \ + logsys_config_facility_set (name, (facility)); \ +- if (((mode) & LOG_MODE_BUFFER_BEFORE_CONFIG) == 0) { \ +- _logsys_wthread_create (); \ +- } \ ++ logsys_format_set (format); \ ++ _logsys_rec_init (rec_size); \ ++ _logsys_wthread_create(); \ + } + +-static unsigned int logsys_subsys_id __attribute__((unused)) = -1; \ +- + #define LOGSYS_DECLARE_NOSUBSYS(priority) \ + __attribute__ ((constructor)) static void logsys_nosubsys_init (void) \ + { \ +@@ -206,161 +207,88 @@ + _logsys_subsys_create ((subsys), (priority)); \ + } + +-#define log_printf(lvl, format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if ((lvl) <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_log_printf2 (__FILE__, __LINE__, lvl, \ +- logsys_subsys_id, (format), ##args); \ +- } \ +-} while(0) +- +-#define dprintf(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_log_printf2 (__FILE__, __LINE__, LOG_DEBUG, \ +- logsys_subsys_id, (format), ##args); \ +- } \ +-} while(0) +- +-#define ENTER_VOID() do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_ENTER, \ +- logsys_subsys_id, ">%s\n", __FUNCTION__); \ +- } \ ++#define log_rec(rec_ident, args...) \ ++do { \ ++ _logsys_log_rec (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, rec_ident, ##args); \ + } while(0) + +-#define ENTER(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_ENTER, \ +- logsys_subsys_id, ">%s: " format, __FUNCTION__, \ +- ##args); \ +- } \ ++#define log_printf(lvl, format, args...) \ ++ do { \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, lvl, format, ##args); \ + } while(0) + +-#define LEAVE_VOID() do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_LEAVE, \ +- logsys_subsys_id, "<%s\n", __FUNCTION__); \ +- } \ ++#define ENTER() do { \ ++ _logsys_log_rec (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_ENTER, LOG_REC_END); \ + } while(0) + +-#define LEAVE(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_LEAVE, \ +- logsys_subsys_id, "<%s: " format, \ +- __FUNCTION__, ##args); \ +- } \ ++#define LEAVE() do { \ ++ _logsys_log_rec (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_LEAVE, LOG_REC_END); \ + } while(0) + + #define TRACE1(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE1, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE1, format, ##args);\ + } while(0) + + #define TRACE2(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE2, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE2, format, ##args);\ + } while(0) + +-#define TRACE3(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE3, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++#define TRACE3(format, args...) do { \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE3, format, ##args);\ + } while(0) + +-#define TRACE4(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE4, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++#define TRACE4(format, args...) do { \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE4, format, ##args);\ + } while(0) + + #define TRACE5(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE5, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE5, format, ##args);\ + } while(0) + + #define TRACE6(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE6, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE6, format, ##args);\ + } while(0) + + #define TRACE7(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE7, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE7, format, ##args);\ + } while(0) + + #define TRACE8(format, args...) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ +- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE8, \ +- logsys_subsys_id, (format), ##args); \ +- } \ ++ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ ++ __FILE__, __LINE__, LOGSYS_TAG_TRACE8, format, ##args);\ + } while(0) + +-extern void _logsys_config_priority_set (unsigned int id, unsigned int priority); +- +-#define logsys_config_priority_set(priority) do { \ +- if (logsys_single_id) \ +- logsys_subsys_id = 0; \ +- assert (logsys_subsys_id != -1); \ +- _logsys_config_priority_set (logsys_subsys_id, priority); \ +-} while(0) ++/* ++ * For one-time programmatic initialization and configuration of logsys ++ * instead of using the DECLARE macros. These APIs do not allow subsystems ++ */ ++int logsys_init ( ++ char *name, ++ int mode, ++ int facility, ++ int priority, ++ char *file, ++ char *format, ++ int rec_size); + +-/* simple, function-based api */ ++int logsys_conf ( ++ char *name, ++ int mode, ++ int facility, ++ int priority, ++ char *file); + +-int logsys_init (char *name, int mode, int facility, int priority, char *file); +-int logsys_conf (char *name, int mode, int facility, int priority, char *file); + void logsys_exit (void); + + #endif /* LOGSYS_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/engine/objdb.h corosync-trunk/include/corosync/engine/objdb.h +--- corosync-0.92/include/corosync/engine/objdb.h 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/include/corosync/engine/objdb.h 2008-10-27 09:25:53.000000000 +0100 +@@ -51,6 +51,13 @@ + OBJECT_KEY_DELETED + } object_change_type_t; + ++typedef enum { ++ OBJDB_RELOAD_NOTIFY_START, ++ OBJDB_RELOAD_NOTIFY_END, ++ OBJDB_RELOAD_NOTIFY_FAILED ++} objdb_reload_notify_type_t; ++ ++ + typedef void (*object_key_change_notify_fn_t)(object_change_type_t change_type, + unsigned int parent_object_handle, + unsigned int object_handle, +@@ -68,6 +75,9 @@ + void *name_pt, int name_len, + void *priv_data_pt); + ++typedef void (*object_reload_notify_fn_t) (objdb_reload_notify_type_t, int flush, ++ void *priv_data_pt); ++ + struct object_valid { + char *object_name; + int object_len; +@@ -198,12 +208,14 @@ + object_key_change_notify_fn_t key_change_notify_fn, + object_create_notify_fn_t object_create_notify_fn, + object_destroy_notify_fn_t object_destroy_notify_fn, ++ object_reload_notify_fn_t object_reload_notify_fn, + void * priv_data_pt); + + void (*object_track_stop) ( + object_key_change_notify_fn_t key_change_notify_fn, + object_create_notify_fn_t object_create_notify_fn, + object_destroy_notify_fn_t object_destroy_notify_fn, ++ object_reload_notify_fn_t object_reload_notify_fn, + void * priv_data_pt); + + int (*object_write_config) (char **error_string); +diff -Naurd corosync-0.92/include/corosync/engine/quorum.h corosync-trunk/include/corosync/engine/quorum.h +--- corosync-0.92/include/corosync/engine/quorum.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/engine/quorum.h 2008-12-09 14:51:23.000000000 +0100 +@@ -0,0 +1,44 @@ ++/* ++ * Copyright (c) 2008 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 the 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. ++ */ ++ ++#ifndef QUORUM_H_DEFINED ++#define QUORUM_H_DEFINED ++ ++typedef void (*quorum_set_quorate_fn_t) (unsigned int *view_list, int view_list_entries, ++ int quorate, struct memb_ring_id *); ++ ++struct quorum_services_api_ver1 { ++ void (*init) (struct corosync_api_v1 *api, quorum_set_quorate_fn_t); ++}; ++#endif /* QUORUM_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/evs.h corosync-trunk/include/corosync/evs.h +--- corosync-0.92/include/corosync/evs.h 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/include/corosync/evs.h 2008-11-06 22:49:07.000000000 +0100 +@@ -36,6 +36,7 @@ + + #include + #include ++#include + + /** + * @defgroup corosync Other API services provided by corosync +@@ -49,34 +50,12 @@ + typedef uint64_t evs_handle_t; + + typedef enum { +- EVS_DISPATCH_ONE, +- EVS_DISPATCH_ALL, +- EVS_DISPATCH_BLOCKING +-} evs_dispatch_t; +- +-typedef enum { + EVS_TYPE_UNORDERED, /* not implemented */ + EVS_TYPE_FIFO, /* same as agreed */ + EVS_TYPE_AGREED, + EVS_TYPE_SAFE /* not implemented */ + } evs_guarantee_t; + +-typedef enum { +- EVS_OK = 1, +- EVS_ERR_LIBRARY = 2, +- EVS_ERR_TIMEOUT = 5, +- EVS_ERR_TRY_AGAIN = 6, +- EVS_ERR_INVALID_PARAM = 7, +- EVS_ERR_NO_MEMORY = 8, +- EVS_ERR_BAD_HANDLE = 9, +- EVS_ERR_ACCESS = 11, +- EVS_ERR_NOT_EXIST = 12, +- EVS_ERR_EXIST = 14, +- EVS_ERR_NOT_SUPPORTED = 20, +- EVS_ERR_SECURITY = 29, +- EVS_ERR_TOO_MANY_GROUPS=30 +-} evs_error_t; +- + #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr)) + + /** These are the things that get passed around */ +@@ -110,30 +89,30 @@ + /* + * Create a new evs connection + */ +-evs_error_t evs_initialize ( ++cs_error_t evs_initialize ( + evs_handle_t *handle, + evs_callbacks_t *callbacks); + + /* + * Close the evs handle + */ +-evs_error_t evs_finalize ( ++cs_error_t evs_finalize ( + evs_handle_t handle); + + /* + * Get a file descriptor on which to poll. evs_handle_t is NOT a + * file descriptor and may not be used directly. + */ +-evs_error_t evs_fd_get ( ++cs_error_t evs_fd_get ( + evs_handle_t handle, + int *fd); + + /* + * Dispatch messages and configuration changes + */ +-evs_error_t evs_dispatch ( ++cs_error_t evs_dispatch ( + evs_handle_t handle, +- evs_dispatch_t dispatch_types); ++ cs_dispatch_flags_t dispatch_types); + + /* + * Join one or more groups. +@@ -141,7 +120,7 @@ + * group that has been joined on handle handle. Any message multicasted + * to a group that has been previously joined will be delivered in evs_dispatch + */ +-evs_error_t evs_join ( ++cs_error_t evs_join ( + evs_handle_t handle, + struct evs_group *groups, + int group_cnt); +@@ -149,7 +128,7 @@ + /* + * Leave one or more groups + */ +-evs_error_t evs_leave ( ++cs_error_t evs_leave ( + evs_handle_t handle, + struct evs_group *groups, + int group_cnt); +@@ -159,7 +138,7 @@ + * The iovec described by iovec will be multicasted to all groups joined with + * the evs_join interface for handle. + */ +-evs_error_t evs_mcast_joined ( ++cs_error_t evs_mcast_joined ( + evs_handle_t handle, + evs_guarantee_t guarantee, + struct iovec *iovec, +@@ -170,7 +149,7 @@ + * Messages will be multicast to groups specified in the api call and not those + * that have been joined (unless they are in the groups parameter). + */ +-evs_error_t evs_mcast_groups ( ++cs_error_t evs_mcast_groups ( + evs_handle_t handle, + evs_guarantee_t guarantee, + struct evs_group *groups, +@@ -181,7 +160,7 @@ + /* + * Get membership information from evs + */ +-evs_error_t evs_membership_get ( ++cs_error_t evs_membership_get ( + evs_handle_t handle, + unsigned int *local_nodeid, + unsigned int *member_list, +diff -Naurd corosync-0.92/include/corosync/ipc_cfg.h corosync-trunk/include/corosync/ipc_cfg.h +--- corosync-0.92/include/corosync/ipc_cfg.h 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/include/corosync/ipc_cfg.h 2008-11-06 22:49:07.000000000 +0100 +@@ -35,8 +35,8 @@ + #define AIS_IPC_CFG_H_DEFINED + + #include ++#include + #include "ipc_gen.h" +-#include "saAis.h" + #include "cfg.h" + + enum req_lib_cfg_types { +@@ -47,7 +47,10 @@ + MESSAGE_REQ_CFG_ADMINISTRATIVESTATESET = 4, + MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET = 5, + MESSAGE_REQ_CFG_SERVICELOAD = 6, +- MESSAGE_REQ_CFG_SERVICEUNLOAD = 7 ++ MESSAGE_REQ_CFG_SERVICEUNLOAD = 7, ++ MESSAGE_REQ_CFG_KILLNODE = 8, ++ MESSAGE_REQ_CFG_TRYSHUTDOWN = 9, ++ MESSAGE_REQ_CFG_REPLYTOSHUTDOWN = 10 + }; + + enum res_lib_cfg_types { +@@ -58,12 +61,15 @@ + MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 4, + MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 5, + MESSAGE_RES_CFG_SERVICELOAD = 6, +- MESSAGE_RES_CFG_SERVICEUNLOAD = 7 ++ MESSAGE_RES_CFG_SERVICEUNLOAD = 7, ++ MESSAGE_RES_CFG_KILLNODE = 8, ++ MESSAGE_RES_CFG_TRYSHUTDOWN = 9, ++ MESSAGE_RES_CFG_TESTSHUTDOWN = 10 + }; + + struct req_lib_cfg_statetrack { + mar_req_header_t header; +- SaUint8T trackFlags; ++ uint8_t trackFlags; + CorosyncCfgStateNotificationT *notificationBufferAddress; + }; + +@@ -81,7 +87,7 @@ + + struct req_lib_cfg_administrativestateset { + mar_req_header_t header; +- SaNameT compName; ++ cs_name_t compName; + CorosyncCfgAdministrativeTargetT administrativeTarget; + CorosyncCfgAdministrativeStateT administrativeState; + }; +@@ -92,7 +98,7 @@ + + struct req_lib_cfg_administrativestateget { + mar_req_header_t header; +- SaNameT compName; ++ cs_name_t compName; + CorosyncCfgAdministrativeTargetT administrativeTarget; + CorosyncCfgAdministrativeStateT administrativeState; + }; +@@ -140,6 +146,35 @@ + mar_res_header_t header __attribute__((aligned(8))); + }; + ++struct req_lib_cfg_killnode { ++ mar_req_header_t header __attribute__((aligned(8))); ++ unsigned int nodeid __attribute__((aligned(8))); ++ cs_name_t reason __attribute__((aligned(8))); ++}; ++ ++struct res_lib_cfg_killnode { ++ mar_res_header_t header __attribute__((aligned(8))); ++}; ++ ++struct req_lib_cfg_tryshutdown { ++ mar_req_header_t header __attribute__((aligned(8))); ++ unsigned int flags; ++}; ++ ++struct res_lib_cfg_tryshutdown { ++ mar_res_header_t header __attribute__((aligned(8))); ++}; ++ ++struct req_lib_cfg_replytoshutdown { ++ mar_res_header_t header __attribute__((aligned(8))); ++ unsigned int response; ++}; ++ ++struct res_lib_cfg_testshutdown { ++ mar_res_header_t header __attribute__((aligned(8))); ++ unsigned int flags; ++}; ++ + typedef enum { + AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0, + AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1, +@@ -153,4 +188,11 @@ + AIS_AMF_ADMINISTRATIVESTATE_STOPPING = 2 + } corosyncAdministrativeState; + ++typedef enum { ++ CFG_SHUTDOWN_FLAG_REQUEST = 0, ++ CFG_SHUTDOWN_FLAG_REGARDLESS = 1, ++ CFG_SHUTDOWN_FLAG_IMMEDIATE = 2, ++} CorosyncShutdownFlagsT; ++ ++ + #endif /* AIS_IPC_CFG_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/ipc_confdb.h corosync-trunk/include/corosync/ipc_confdb.h +--- corosync-0.92/include/corosync/ipc_confdb.h 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/include/corosync/ipc_confdb.h 2008-11-06 22:49:07.000000000 +0100 +@@ -35,7 +35,7 @@ + #define IPC_CONFDB_H_DEFINED + + #include +-#include "saAis.h" ++#include + #include "ipc_gen.h" + + enum req_confdb_types { +diff -Naurd corosync-0.92/include/corosync/ipc_cpg.h corosync-trunk/include/corosync/ipc_cpg.h +--- corosync-0.92/include/corosync/ipc_cpg.h 2008-09-17 21:15:00.000000000 +0200 ++++ corosync-trunk/include/corosync/ipc_cpg.h 2008-11-06 22:49:07.000000000 +0100 +@@ -35,7 +35,7 @@ + #define IPC_CPG_H_DEFINED + + #include +-#include "saAis.h" ++#include + #include "ipc_gen.h" + #include "mar_cpg.h" + +diff -Naurd corosync-0.92/include/corosync/ipc_evs.h corosync-trunk/include/corosync/ipc_evs.h +--- corosync-0.92/include/corosync/ipc_evs.h 2008-08-14 16:59:50.000000000 +0200 ++++ corosync-trunk/include/corosync/ipc_evs.h 2008-11-06 22:49:07.000000000 +0100 +@@ -34,8 +34,7 @@ + #ifndef IPC_EVS_H_DEFINED + #define IPC_EVS_H_DEFINED + +-//#include +-#include "saAis.h" ++#include + #include "evs.h" + #include "ipc_gen.h" + +diff -Naurd corosync-0.92/include/corosync/ipc_gen.h corosync-trunk/include/corosync/ipc_gen.h +--- corosync-0.92/include/corosync/ipc_gen.h 2008-08-14 16:59:50.000000000 +0200 ++++ corosync-trunk/include/corosync/ipc_gen.h 2008-11-06 22:49:07.000000000 +0100 +@@ -46,7 +46,9 @@ + MSG_SERVICE = 6, + CFG_SERVICE = 7, + CPG_SERVICE = 8, +- CONFDB_SERVICE = 10 ++ CONFDB_SERVICE = 10, ++ QUORUM_SERVICE = 11, ++ PLOAD_SERVICE = 12 + }; + + enum req_init_types { +@@ -72,7 +74,7 @@ + typedef struct { + int size; __attribute__((aligned(8))) + int id __attribute__((aligned(8))); +- SaAisErrorT error __attribute__((aligned(8))); ++ cs_error_t error __attribute__((aligned(8))); + } mar_res_header_t __attribute__((aligned(8))); + + typedef struct { +diff -Naurd corosync-0.92/include/corosync/ipc_pload.h corosync-trunk/include/corosync/ipc_pload.h +--- corosync-0.92/include/corosync/ipc_pload.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/ipc_pload.h 2008-11-06 22:49:07.000000000 +0100 +@@ -0,0 +1,71 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: 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. ++ */ ++#ifndef IPC_PLOAD_H_DEFINED ++#define IPC_PLOAD_H_DEFINED ++ ++#include ++#include "pload.h" ++#include "ipc_gen.h" ++ ++enum req_lib_evs_types { ++ MESSAGE_REQ_PLOAD_START = 0, ++}; ++ ++enum res_lib_evs_types { ++ MESSAGE_RES_PLOAD_START = 0, ++}; ++ ++struct res_lib_pload_start { ++ mar_res_header_t header; ++ unsigned int dataset[1024]; ++}; ++ ++struct res_lib_pload_mcast { ++ mar_res_header_t header; ++}; ++ ++struct req_lib_pload_start { ++ mar_req_header_t header; ++ unsigned int msg_code; ++ unsigned int msg_size; ++ unsigned int msg_count; ++ unsigned int time_interval; ++}; ++ ++struct req_lib_pload_mcast { ++ mar_req_header_t header; ++ unsigned int code; ++}; ++ ++#endif /* IPC_PLOAD_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/ipc_quorum.h corosync-trunk/include/corosync/ipc_quorum.h +--- corosync-0.92/include/corosync/ipc_quorum.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/ipc_quorum.h 2008-11-06 22:49:07.000000000 +0100 +@@ -0,0 +1,73 @@ ++/* ++ * Copyright (c) 2008 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 the MontaVista Software, Inc. nor the names of its ++ * contributors may be used to endorse or promote products derived from this ++ * software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ++ * THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++#ifndef IPC_QUORUM_H_DEFINED ++#define IPC_QUORUM_H_DEFINED ++ ++#include ++#include ++#include "corosync/ipc_gen.h" ++ ++enum req_quorum_types { ++ MESSAGE_REQ_QUORUM_GETQUORATE = 0, ++ MESSAGE_REQ_QUORUM_TRACKSTART, ++ MESSAGE_REQ_QUORUM_TRACKSTOP ++}; ++ ++enum res_quorum_types { ++ MESSAGE_RES_QUORUM_GETQUORATE = 0, ++ MESSAGE_RES_QUORUM_TRACKSTART, ++ MESSAGE_RES_QUORUM_TRACKSTOP, ++ MESSAGE_RES_QUORUM_NOTIFICATION ++}; ++ ++struct req_lib_quorum_trackstart { ++ mar_req_header_t header __attribute__((aligned(8))); ++ unsigned int track_flags; ++}; ++ ++ ++struct res_lib_quorum_getquorate { ++ mar_res_header_t header __attribute__((aligned(8))); ++ mar_uint32_t quorate; ++}; ++ ++struct res_lib_quorum_notification { ++ mar_res_header_t header __attribute__((aligned(8))); ++ mar_int32_t quorate __attribute__((aligned(8))); ++ mar_uint64_t ring_seq __attribute__((aligned(8))); ++ mar_uint32_t view_list_entries __attribute__((aligned(8))); ++ mar_uint32_t view_list[]; ++}; ++ ++#endif +diff -Naurd corosync-0.92/include/corosync/mar_gen.h corosync-trunk/include/corosync/mar_gen.h +--- corosync-0.92/include/corosync/mar_gen.h 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/include/corosync/mar_gen.h 2008-11-06 22:49:07.000000000 +0100 +@@ -43,7 +43,7 @@ + #endif + #include + +-#include ++#include + #include + + typedef int8_t mar_int8_t; +@@ -98,7 +98,7 @@ + + typedef struct { + mar_uint16_t length __attribute__((aligned(8))); +- mar_uint8_t value[SA_MAX_NAME_LENGTH] __attribute__((aligned(8))); ++ mar_uint8_t value[CS_MAX_NAME_LENGTH] __attribute__((aligned(8))); + } mar_name_t; + + static inline char *get_mar_name_t (mar_name_t *name) { +@@ -121,19 +121,19 @@ + } + + static inline void marshall_from_mar_name_t ( +- SaNameT *dest, ++ cs_name_t *dest, + mar_name_t *src) + { + dest->length = src->length; +- memcpy (dest->value, src->value, SA_MAX_NAME_LENGTH); ++ memcpy (dest->value, src->value, CS_MAX_NAME_LENGTH); + } + + static inline void marshall_to_mar_name_t ( + mar_name_t *dest, +- SaNameT *src) ++ cs_name_t *src) + { + dest->length = src->length; +- memcpy (dest->value, src->value, SA_MAX_NAME_LENGTH); ++ memcpy (dest->value, src->value, CS_MAX_NAME_LENGTH); + } + + typedef enum { +@@ -148,7 +148,7 @@ + swab_mar_uint64_t (to_swab); + } + +-#define MAR_TIME_END ((SaTimeT)0x7fffffffffffffffull) ++#define MAR_TIME_END ((int64_t)0x7fffffffffffffffull) + #define MAR_TIME_BEGIN 0x0ULL + #define MAR_TIME_UNKNOWN 0x8000000000000000ULL + +@@ -158,7 +158,7 @@ + #define MAR_TIME_ONE_MINUTE 60000000000ULL + #define MAR_TIME_ONE_HOUR 3600000000000ULL + #define MAR_TIME_ONE_DAY 86400000000000ULL +-#define MAR_TIME_MAX SA_TIME_END ++#define MAR_TIME_MAX CS_TIME_END + + #define MAR_TRACK_CURRENT 0x01 + #define MAR_TRACK_CHANGES 0x02 +diff -Naurd corosync-0.92/include/corosync/pload.h corosync-trunk/include/corosync/pload.h +--- corosync-0.92/include/corosync/pload.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/pload.h 2008-10-30 23:41:34.000000000 +0100 +@@ -0,0 +1,100 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: 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. ++ */ ++#ifndef COROSYNC_PLOAD_H_DEFINED ++#define COROSYNC_PLOAD_H_DEFINED ++ ++#include ++#include ++ ++/** ++ * @defgroup corosync Other API services provided by corosync ++ */ ++/** ++ * @addtogroup pload_corosync ++ * ++ * @{ ++ */ ++ ++typedef uint64_t pload_handle_t; ++ ++typedef enum { ++ PLOAD_OK = 1, ++ PLOAD_ERR_LIBRARY = 2, ++ PLOAD_ERR_TIMEOUT = 5, ++ PLOAD_ERR_TRY_AGAIN = 6, ++ PLOAD_ERR_INVALID_PARAM = 7, ++ PLOAD_ERR_NO_MEMORY = 8, ++ PLOAD_ERR_BAD_HANDLE = 9, ++ PLOAD_ERR_ACCESS = 11, ++ PLOAD_ERR_NOT_EXIST = 12, ++ PLOAD_ERR_EXIST = 14, ++ PLOAD_ERR_NOT_SUPPORTED = 20, ++ PLOAD_ERR_SECURITY = 29, ++ PLOAD_ERR_TOO_MANY_GROUPS=30 ++} pload_error_t; ++ ++typedef struct { ++ int callback; ++} pload_callbacks_t; ++ ++/** @} */ ++ ++/* ++ * Create a new pload connection ++ */ ++pload_error_t pload_initialize ( ++ pload_handle_t *handle, ++ pload_callbacks_t *callbacks); ++ ++/* ++ * Close the pload handle ++ */ ++pload_error_t pload_finalize ( ++ pload_handle_t handle); ++ ++/* ++ * Get a file descriptor on which to poll. pload_handle_t is NOT a ++ * file descriptor and may not be used directly. ++ */ ++pload_error_t pload_fd_get ( ++ pload_handle_t handle, ++ int *fd); ++ ++unsigned int pload_start ( ++ pload_handle_t handle, ++ unsigned int code, ++ unsigned int msg_count, ++ unsigned int msg_size); ++ ++#endif /* COROSYNC_PLOAD_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/quorum.h corosync-trunk/include/corosync/quorum.h +--- corosync-0.92/include/corosync/quorum.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/quorum.h 2008-12-08 16:55:41.000000000 +0100 +@@ -0,0 +1,97 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: Christine Caulfield (ccaulfi@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 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. ++ */ ++#ifndef COROSYNC_QUORUM_H_DEFINED ++#define COROSYNC_QUORUM_H_DEFINED ++ ++#include ++ ++typedef uint64_t quorum_handle_t; ++ ++typedef struct { ++ uint32_t nodeid; ++ uint32_t state; ++} quorum_node_t; ++ ++typedef void (*quorum_notification_fn_t) ( ++ quorum_handle_t handle, ++ uint32_t quorate, ++ uint64_t ring_seq, ++ uint32_t view_list_entries, ++ uint32_t *view_list ++ ); ++ ++typedef struct { ++ quorum_notification_fn_t quorum_notify_fn; ++} quorum_callbacks_t; ++ ++ ++/* ++ * Create a new quorum connection ++ */ ++cs_error_t quorum_initialize ( ++ quorum_handle_t *handle, ++ quorum_callbacks_t *callbacks); ++ ++/* ++ * Close the quorum handle ++ */ ++cs_error_t quorum_finalize ( ++ quorum_handle_t handle); ++ ++ ++/* ++ * Dispatch messages and configuration changes ++ */ ++cs_error_t quorum_dispatch ( ++ quorum_handle_t handle, ++ cs_dispatch_flags_t dispatch_types); ++ ++ ++/* ++ * Get quorum information. ++ */ ++cs_error_t quorum_getquorate ( ++ quorum_handle_t handle, ++ int *quorate); ++ ++/* Track node and quorum changes */ ++cs_error_t quorum_trackstart ( ++ quorum_handle_t handle, ++ unsigned int flags ); ++ ++cs_error_t quorum_trackstop ( ++ quorum_handle_t handle); ++ ++ ++#endif /* COROSYNC_QUORUM_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/saAis.h corosync-trunk/include/corosync/saAis.h +--- corosync-0.92/include/corosync/saAis.h 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/include/corosync/saAis.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,152 +0,0 @@ +-/* +- * Copyright (c) 2002-2003 MontaVista Software, Inc. +- * Copyright (c) 2006-2008 Red Hat, Inc. +- * +- * All rights reserved. +- * +- * Author: 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. +- */ +- +-#ifndef AIS_TYPES_H_DEFINED +-#define AIS_TYPES_H_DEFINED +- +-/** +- * @defgroup saf Service Availability Forum Application Interface Specification +- */ +- +-typedef enum { +- SA_FALSE = 0, +- SA_TRUE = 1 +-} SaBoolT; +- +-#ifndef COROSYNC_SOLARIS +-#include +-#else +-#include +-#endif +- +-typedef int8_t SaInt8T; +-typedef int16_t SaInt16T; +-typedef int32_t SaInt32T; +-typedef int64_t SaInt64T; +- +-typedef uint8_t SaUint8T; +-typedef uint16_t SaUint16T; +-typedef uint32_t SaUint32T; +-typedef uint64_t SaUint64T; +- +-typedef float SaFloatT; +-typedef double SaDoubleT; +-typedef char * SaStringT; +-typedef SaInt64T SaTimeT; +- +-#define SA_TIME_END ((SaTimeT)0x7FFFFFFFFFFFFFFFULL) +-#define SA_TIME_BEGIN 0x0ULL +-#define SA_TIME_UNKNOWN 0x8000000000000000ULL +- +-#define SA_TIME_ONE_MICROSECOND 1000ULL +-#define SA_TIME_ONE_MILLISECOND 1000000ULL +-#define SA_TIME_ONE_SECOND 1000000000ULL +-#define SA_TIME_ONE_MINUTE 60000000000ULL +-#define SA_TIME_ONE_HOUR 3600000000000ULL +-#define SA_TIME_ONE_DAY 86400000000000ULL +-#define SA_TIME_MAX SA_TIME_END +- +-#define SA_MAX_NAME_LENGTH 256 +- +-typedef struct { +- SaUint16T length; +- SaUint8T value[SA_MAX_NAME_LENGTH]; +-} SaNameT; +- +-typedef struct { +- char releaseCode; +- unsigned char majorVersion; +- unsigned char minorVersion; +-} SaVersionT; +- +-typedef SaUint64T SaNtfIdentifierT; +- +-#define SA_TRACK_CURRENT 0x01 +-#define SA_TRACK_CHANGES 0x02 +-#define SA_TRACK_CHANGES_ONLY 0x04 +- +-typedef enum { +- SA_DISPATCH_ONE = 1, +- SA_DISPATCH_ALL = 2, +- SA_DISPATCH_BLOCKING = 3 +-} SaDispatchFlagsT; +- +-typedef enum { +- SA_AIS_OK = 1, +- SA_AIS_ERR_LIBRARY = 2, +- SA_AIS_ERR_VERSION = 3, +- SA_AIS_ERR_INIT = 4, +- SA_AIS_ERR_TIMEOUT = 5, +- SA_AIS_ERR_TRY_AGAIN = 6, +- SA_AIS_ERR_INVALID_PARAM = 7, +- SA_AIS_ERR_NO_MEMORY = 8, +- SA_AIS_ERR_BAD_HANDLE = 9, +- SA_AIS_ERR_BUSY = 10, +- SA_AIS_ERR_ACCESS = 11, +- SA_AIS_ERR_NOT_EXIST = 12, +- SA_AIS_ERR_NAME_TOO_LONG = 13, +- SA_AIS_ERR_EXIST = 14, +- SA_AIS_ERR_NO_SPACE = 15, +- SA_AIS_ERR_INTERRUPT = 16, +- SA_AIS_ERR_NAME_NOT_FOUND = 17, +- SA_AIS_ERR_NO_RESOURCES = 18, +- SA_AIS_ERR_NOT_SUPPORTED = 19, +- SA_AIS_ERR_BAD_OPERATION = 20, +- SA_AIS_ERR_FAILED_OPERATION = 21, +- SA_AIS_ERR_MESSAGE_ERROR = 22, +- SA_AIS_ERR_QUEUE_FULL = 23, +- SA_AIS_ERR_QUEUE_NOT_AVAILABLE = 24, +- SA_AIS_ERR_BAD_FLAGS = 25, +- SA_AIS_ERR_TOO_BIG = 26, +- SA_AIS_ERR_NO_SECTIONS = 27 +-} SaAisErrorT; +- +-typedef union { +- SaInt64T int64Value; +- SaUint64T uint64Value; +- SaTimeT timeValue; +- SaFloatT floatValue; +- SaDoubleT doubleValue; +-} SaLimitValueT; +- +-typedef SaUint64T SaSelectionObjectT; +- +-typedef SaUint64T SaInvocationT; +- +-typedef SaUint64T SaSizeT; +- +-#define SA_HANDLE_INVALID 0x0ULL +- +-#endif /* AIS_TYPES_H_DEFINED */ +diff -Naurd corosync-0.92/include/corosync/totem/totem.h corosync-trunk/include/corosync/totem/totem.h +--- corosync-0.92/include/corosync/totem/totem.h 2008-08-20 02:57:40.000000000 +0200 ++++ corosync-trunk/include/corosync/totem/totem.h 2008-10-30 23:41:34.000000000 +0100 +@@ -50,26 +50,6 @@ + #define SEND_THREADS_MAX 16 + #define INTERFACE_MAX 2 + +-/* +- * Array location of various timeouts as +- * specified in corosync.conf. The last enum +- * specifies the size of the timeouts array and +- * needs to remain the last item in the list. +- */ +-enum { +- TOTEM_RETRANSMITS_BEFORE_LOSS, +- TOTEM_TOKEN, +- TOTEM_RETRANSMIT_TOKEN, +- TOTEM_HOLD_TOKEN, +- TOTEM_JOIN, +- TOTEM_CONSENSUS, +- TOTEM_MERGE, +- TOTEM_DOWNCHECK, +- TOTEM_FAIL_RECV_CONST, +- +- MAX_TOTEM_TIMEOUTS /* Last item */ +-} totem_timeout_types; +- + struct totem_interface { + struct totem_ip_address bindnet; + struct totem_ip_address boundto; +@@ -78,12 +58,21 @@ + }; + + struct totem_logging_configuration { +- void (*log_printf) (char *, int, int, char *, ...) __attribute__((format(printf, 4, 5))); ++ void (*log_printf) ( ++ int subsys, ++ char *function_name, ++ char *file_name, ++ int file_line, ++ unsigned int level, ++ char *format, ++ ...) __attribute__((format(printf, 6, 7))); ++ + int log_level_security; + int log_level_error; + int log_level_warning; + int log_level_notice; + int log_level_debug; ++ int log_subsys_id; + }; + + struct totem_config { +@@ -161,6 +150,7 @@ + TOTEM_CONFIGURATION_TRANSITIONAL + }; + ++#define TOTEM_CALLBACK_TOKEN_TYPE + enum totem_callback_token_type { + TOTEM_CALLBACK_TOKEN_RECEIVED = 1, + TOTEM_CALLBACK_TOKEN_SENT = 2 +diff -Naurd corosync-0.92/include/corosync/totem/totempg.h corosync-trunk/include/corosync/totem/totempg.h +--- corosync-0.92/include/corosync/totem/totempg.h 2008-08-14 16:59:50.000000000 +0200 ++++ corosync-trunk/include/corosync/totem/totempg.h 2008-12-01 19:44:55.000000000 +0100 +@@ -139,7 +139,7 @@ + + extern char *totempg_ifaces_print (unsigned int nodeid); + +-extern int totempg_my_nodeid_get (void); ++extern unsigned int totempg_my_nodeid_get (void); + + extern int totempg_my_family_get (void); + +diff -Naurd corosync-0.92/lcr/Makefile corosync-trunk/lcr/Makefile +--- corosync-0.92/lcr/Makefile 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/lcr/Makefile 2008-11-11 18:26:58.000000000 +0100 +@@ -84,3 +84,6 @@ + rm -f test libtest.so* *.o uic liblcr.so* liblcr.a *.lcrso *.da *.ba *.bb *.bbg \ + test_static + ++lint: ++ -splint $(LINT_FLAGS) $(CFLAGS) lcr_ifact.c uic.c uis.c ++ +diff -Naurd corosync-0.92/lcr/uic.c corosync-trunk/lcr/uic.c +--- corosync-0.92/lcr/uic.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/lcr/uic.c 2008-11-11 19:13:47.000000000 +0100 +@@ -88,7 +88,7 @@ + return 0; + } + +-struct req_msg { ++struct uic_req_msg { + int len; + char msg[0]; + }; +@@ -97,12 +97,13 @@ + { + struct msghdr msg_send; + struct iovec iov_send[2]; +- struct req_msg req_msg; ++ struct uic_req_msg req_msg; ++ ssize_t send_res; + int res; + + req_msg.len = strlen (msg) + 1; + iov_send[0].iov_base = (void *)&req_msg; +- iov_send[0].iov_len = sizeof (struct req_msg); ++ iov_send[0].iov_len = sizeof (struct uic_req_msg); + iov_send[1].iov_base = (void *)msg; + iov_send[1].iov_len = req_msg.len; + +@@ -120,12 +121,14 @@ + #endif + + retry_send: +- res = sendmsg (fd, &msg_send, 0); +- if (res == -1 && errno == EINTR) { ++ send_res = sendmsg (fd, &msg_send, 0); ++ if (send_res == -1 && errno == EINTR) { + goto retry_send; + } +- if (res == -1) { ++ if (send_res == -1) { + res = -errno; ++ } else { ++ res = (int)send_res; + } + return (res); + +diff -Naurd corosync-0.92/lcr/uis.c corosync-trunk/lcr/uis.c +--- corosync-0.92/lcr/uis.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/lcr/uis.c 2008-11-11 18:26:58.000000000 +0100 +@@ -115,14 +115,14 @@ + } + }; + +-struct req_msg { ++struct uis_req_msg { + int len; + char msg[0]; + }; + + static void lcr_uis_dispatch (int fd) + { +- struct req_msg header; ++ struct uis_req_msg header; + char msg_contents[512]; + ssize_t readsize; + +diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c +--- corosync-0.92/lib/cfg.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/lib/cfg.c 2008-11-11 18:26:58.000000000 +0100 +@@ -7,7 +7,7 @@ + * Author: 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: + * +@@ -45,14 +45,14 @@ + #include + #include + +-#include ++#include + #include + #include + #include + #include + #include + +-struct res_overlay { ++struct cfg_res_overlay { + mar_res_header_t header; + char data[4096]; + }; +@@ -64,7 +64,7 @@ + int response_fd; + int dispatch_fd; + CorosyncCfgCallbacksT callbacks; +- SaNameT compName; ++ cs_name_t compName; + int compRegistered; + int finalize; + pthread_mutex_t response_mutex; +@@ -94,31 +94,31 @@ + pthread_mutex_destroy (&cfg_instance->dispatch_mutex); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_initialize ( + corosync_cfg_handle_t *cfg_handle, + const CorosyncCfgCallbacksT *cfgCallbacks) + { + struct cfg_instance *cfg_instance; +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + + error = saHandleCreate (&cfg_hdb, sizeof (struct cfg_instance), cfg_handle); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_no_destroy; + } + + error = saHandleInstanceGet (&cfg_hdb, *cfg_handle, (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_destroy; + } + + cfg_instance->response_fd = -1; + + cfg_instance->dispatch_fd = -1; +- ++ + error = saServiceConnect (&cfg_instance->response_fd, + &cfg_instance->dispatch_fd, CFG_SERVICE); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_put_destroy; + } + +@@ -130,48 +130,49 @@ + + pthread_mutex_init (&cfg_instance->dispatch_mutex, NULL); + +- saHandleInstancePut (&cfg_hdb, *cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, *cfg_handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + + error_put_destroy: +- saHandleInstancePut (&cfg_hdb, *cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, *cfg_handle); + error_destroy: +- saHandleDestroy (&cfg_hdb, *cfg_handle); ++ (void)saHandleDestroy (&cfg_hdb, *cfg_handle); + error_no_destroy: + return (error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_fd_get ( + corosync_cfg_handle_t cfg_handle, +- SaSelectionObjectT *selectionObject) ++ int32_t *selection_fd) + { + struct cfg_instance *cfg_instance; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +- *selectionObject = cfg_instance->dispatch_fd; ++ *selection_fd = cfg_instance->dispatch_fd; + +- saHandleInstancePut (&cfg_hdb, cfg_handle); +- return (SA_AIS_OK); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); ++ return (CS_OK); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_dispatch ( + corosync_cfg_handle_t cfg_handle, +- SaDispatchFlagsT dispatchFlags) ++ cs_dispatch_flags_t dispatchFlags) + { + struct pollfd ufds; + int timeout = -1; +- SaAisErrorT error; ++ cs_error_t error; + int cont = 1; /* always continue do loop except when set to 0 */ + int dispatch_avail; + struct cfg_instance *cfg_instance; ++ struct res_lib_cfg_testshutdown *res_lib_cfg_testshutdown; + #ifdef COMPILE_OUT + struct res_lib_corosync_healthcheckcallback *res_lib_corosync_healthcheckcallback; + struct res_lib_corosync_readinessstatesetcallback *res_lib_corosync_readinessstatesetcallback; +@@ -180,18 +181,18 @@ + struct res_lib_cfg_statetrackcallback *res_lib_cfg_statetrackcallback; + #endif + CorosyncCfgCallbacksT callbacks; +- struct res_overlay dispatch_data; ++ struct cfg_res_overlay dispatch_data; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, + (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + /* +- * Timeout instantly for SA_DISPATCH_ALL ++ * Timeout instantly for CS_DISPATCH_ALL + */ +- if (dispatchFlags == SA_DISPATCH_ALL) { ++ if (dispatchFlags == CS_DISPATCH_ALL) { + timeout = 0; + } + +@@ -204,14 +205,14 @@ + ufds.revents = 0; + + error = saPollRetry (&ufds, 1, timeout); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + + pthread_mutex_lock (&cfg_instance->dispatch_mutex); + + error = saPollRetry (&ufds, 1, 0); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + +@@ -219,13 +220,13 @@ + * Handle has been finalized in another thread + */ + if (cfg_instance->finalize == 1) { +- error = SA_AIS_OK; ++ error = CS_OK; + pthread_mutex_unlock (&cfg_instance->dispatch_mutex); + goto error_unlock; + } + + dispatch_avail = ufds.revents & POLLIN; +- if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) { ++ if (dispatch_avail == 0 && dispatchFlags == CS_DISPATCH_ALL) { + pthread_mutex_unlock (&cfg_instance->dispatch_mutex); + break; /* exit do while cont is 1 loop */ + } else +@@ -240,13 +241,13 @@ + */ + error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.header, + sizeof (mar_res_header_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + if (dispatch_data.header.size > sizeof (mar_res_header_t)) { + error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.data, + dispatch_data.header.size - sizeof (mar_res_header_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + } +@@ -267,9 +268,14 @@ + * Dispatch incoming response + */ + switch (dispatch_data.header.id) { +- ++ case MESSAGE_RES_CFG_TESTSHUTDOWN: ++ if (callbacks.corosyncCfgShutdownCallback) { ++ res_lib_cfg_testshutdown = (struct res_lib_cfg_testshutdown *)&dispatch_data; ++ callbacks.corosyncCfgShutdownCallback(cfg_handle, res_lib_cfg_testshutdown->flags); ++ } ++ break; + default: +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_nounlock; + break; + } +@@ -278,31 +284,31 @@ + * Determine if more messages should be processed + */ + switch (dispatchFlags) { +- case SA_DISPATCH_ONE: ++ case CS_DISPATCH_ONE: + cont = 0; + break; +- case SA_DISPATCH_ALL: ++ case CS_DISPATCH_ALL: + break; +- case SA_DISPATCH_BLOCKING: ++ case CS_DISPATCH_BLOCKING: + break; + } + } while (cont); + + error_unlock: +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + error_nounlock: + return (error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_finalize ( + corosync_cfg_handle_t cfg_handle) + { + struct cfg_instance *cfg_instance; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -316,8 +322,8 @@ + if (cfg_instance->finalize) { + pthread_mutex_unlock (&cfg_instance->response_mutex); + pthread_mutex_unlock (&cfg_instance->dispatch_mutex); +- saHandleInstancePut (&cfg_hdb, cfg_handle); +- return (SA_AIS_ERR_BAD_HANDLE); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); ++ return (CS_ERR_BAD_HANDLE); + } + + cfg_instance->finalize = 1; +@@ -330,7 +336,7 @@ + + pthread_mutex_destroy (&cfg_instance->dispatch_mutex); + +- saHandleDestroy (&cfg_hdb, cfg_handle); ++ (void)saHandleDestroy (&cfg_hdb, cfg_handle); + + if (cfg_instance->response_fd != -1) { + shutdown (cfg_instance->response_fd, 0); +@@ -341,12 +347,12 @@ + close (cfg_instance->dispatch_fd); + } + +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + + return (error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_ring_status_get ( + corosync_cfg_handle_t cfg_handle, + char ***interface_names, +@@ -357,10 +363,10 @@ + struct req_lib_cfg_ringstatusget req_lib_cfg_ringstatusget; + struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget; + unsigned int i; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -380,13 +386,13 @@ + *interface_count = res_lib_cfg_ringstatusget.interface_count; + *interface_names = malloc (sizeof (char *) * *interface_count); + if (*interface_names == NULL) { +- return (SA_AIS_ERR_NO_MEMORY); ++ return (CS_ERR_NO_MEMORY); + } + memset (*interface_names, 0, sizeof (char *) * *interface_count); + + *status = malloc (sizeof (char *) * *interface_count); + if (*status == NULL) { +- error = SA_AIS_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + goto error_free_interface_names; + } + memset (*status, 0, sizeof (char *) * *interface_count); +@@ -394,12 +400,12 @@ + for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) { + (*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]); + if ((*(interface_names))[i] == NULL) { +- error = SA_AIS_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + goto error_free_contents; + } + (*(status))[i] = strdup (res_lib_cfg_ringstatusget.interface_status[i]); + if ((*(status))[i] == NULL) { +- error = SA_AIS_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + goto error_free_contents; + } + } +@@ -416,27 +422,27 @@ + } + + free (*status); +- ++ + error_free_interface_names: + free (*interface_names); +- ++ + no_error: +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + + return (error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_ring_reenable ( + corosync_cfg_handle_t cfg_handle) + { + struct cfg_instance *cfg_instance; + struct req_lib_cfg_ringreenable req_lib_cfg_ringreenable; + struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -452,12 +458,12 @@ + sizeof (struct res_lib_cfg_ringreenable)); + + pthread_mutex_unlock (&cfg_instance->response_mutex); +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + + return (error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_service_load ( + corosync_cfg_handle_t cfg_handle, + char *service_name, +@@ -466,10 +472,10 @@ + struct cfg_instance *cfg_instance; + struct req_lib_cfg_serviceload req_lib_cfg_serviceload; + struct res_lib_cfg_serviceload res_lib_cfg_serviceload; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -490,12 +496,12 @@ + sizeof (struct res_lib_cfg_serviceload)); + + pthread_mutex_unlock (&cfg_instance->response_mutex); +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + + return (error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_service_unload ( + corosync_cfg_handle_t cfg_handle, + char *service_name, +@@ -504,10 +510,10 @@ + struct cfg_instance *cfg_instance; + struct req_lib_cfg_serviceunload req_lib_cfg_serviceunload; + struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -528,20 +534,20 @@ + sizeof (struct res_lib_cfg_serviceunload)); + + pthread_mutex_unlock (&cfg_instance->response_mutex); +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + + return (error); + } +-SaAisErrorT ++cs_error_t + corosync_cfg_state_track ( + corosync_cfg_handle_t cfg_handle, +- SaUint8T trackFlags, ++ uint8_t trackFlags, + const CorosyncCfgStateNotificationT *notificationBuffer) + { + struct cfg_instance *cfg_instance; + struct req_lib_cfg_statetrack req_lib_cfg_statetrack; + struct res_lib_cfg_statetrack res_lib_cfg_statetrack; +- SaAisErrorT error; ++ cs_error_t error; + + req_lib_cfg_statetrack.header.size = sizeof (struct req_lib_cfg_statetrack); + req_lib_cfg_statetrack.header.id = MESSAGE_REQ_CFG_STATETRACKSTART; +@@ -550,7 +556,7 @@ + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, + (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -564,23 +570,23 @@ + + pthread_mutex_unlock (&cfg_instance->response_mutex); + +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + +- return (error == SA_AIS_OK ? res_lib_cfg_statetrack.header.error : error); ++ return (error == CS_OK ? res_lib_cfg_statetrack.header.error : error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_state_track_stop ( + corosync_cfg_handle_t cfg_handle) + { + struct cfg_instance *cfg_instance; + struct req_lib_cfg_statetrackstop req_lib_cfg_statetrackstop; + struct res_lib_cfg_statetrackstop res_lib_cfg_statetrackstop; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, + (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -597,12 +603,12 @@ + + pthread_mutex_unlock (&cfg_instance->response_mutex); + +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + +- return (error == SA_AIS_OK ? res_lib_cfg_statetrackstop.header.error : error); ++ return (error == CS_OK ? res_lib_cfg_statetrackstop.header.error : error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_admin_state_get ( + corosync_cfg_handle_t cfg_handle, + CorosyncCfgAdministrativeTargetT administrativeTarget, +@@ -611,11 +617,11 @@ + struct cfg_instance *cfg_instance; + struct req_lib_cfg_administrativestateget req_lib_cfg_administrativestateget; + struct res_lib_cfg_administrativestateget res_lib_cfg_administrativestateget; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, + (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -633,12 +639,12 @@ + + pthread_mutex_unlock (&cfg_instance->response_mutex); + +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + +- return (error == SA_AIS_OK ? res_lib_cfg_administrativestateget.header.error : error); ++ return (error == CS_OK ? res_lib_cfg_administrativestateget.header.error : error); + } + +-SaAisErrorT ++cs_error_t + corosync_cfg_admin_state_set ( + corosync_cfg_handle_t cfg_handle, + CorosyncCfgAdministrativeTargetT administrativeTarget, +@@ -647,11 +653,11 @@ + struct cfg_instance *cfg_instance; + struct req_lib_cfg_administrativestateset req_lib_cfg_administrativestateset; + struct res_lib_cfg_administrativestateset res_lib_cfg_administrativestateset; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cfg_hdb, cfg_handle, + (void *)&cfg_instance); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -670,7 +676,109 @@ + + pthread_mutex_unlock (&cfg_instance->response_mutex); + +- saHandleInstancePut (&cfg_hdb, cfg_handle); ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); + +- return (error == SA_AIS_OK ? res_lib_cfg_administrativestateset.header.error : error); ++ return (error == CS_OK ? res_lib_cfg_administrativestateset.header.error : error); ++} ++ ++cs_error_t ++corosync_cfg_kill_node ( ++ corosync_cfg_handle_t cfg_handle, ++ unsigned int nodeid, ++ char *reason) ++{ ++ struct cfg_instance *cfg_instance; ++ struct req_lib_cfg_killnode req_lib_cfg_killnode; ++ struct res_lib_cfg_killnode res_lib_cfg_killnode; ++ cs_error_t error; ++ ++ if (strlen(reason) >= CS_MAX_NAME_LENGTH) ++ return CS_ERR_NAME_TOO_LONG; ++ ++ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, ++ (void *)&cfg_instance); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ req_lib_cfg_killnode.header.id = MESSAGE_REQ_CFG_KILLNODE; ++ req_lib_cfg_killnode.header.size = sizeof (struct req_lib_cfg_killnode); ++ req_lib_cfg_killnode.nodeid = nodeid; ++ strcpy((char *)req_lib_cfg_killnode.reason.value, reason); ++ req_lib_cfg_killnode.reason.length = strlen(reason)+1; ++ ++ error = saSendReceiveReply (cfg_instance->response_fd, ++ &req_lib_cfg_killnode, ++ sizeof (struct req_lib_cfg_killnode), ++ &res_lib_cfg_killnode, ++ sizeof (struct res_lib_cfg_killnode)); ++ ++ error = res_lib_cfg_killnode.header.error; ++ ++ pthread_mutex_unlock (&cfg_instance->response_mutex); ++ ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); ++ ++ return (error == CS_OK ? res_lib_cfg_killnode.header.error : error); ++} ++ ++cs_error_t ++corosync_cfg_try_shutdown ( ++ corosync_cfg_handle_t cfg_handle, ++ CorosyncCfgShutdownFlagsT flags) ++{ ++ struct cfg_instance *cfg_instance; ++ struct req_lib_cfg_tryshutdown req_lib_cfg_tryshutdown; ++ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; ++ cs_error_t error; ++ ++ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, ++ (void *)&cfg_instance); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ req_lib_cfg_tryshutdown.header.id = MESSAGE_REQ_CFG_TRYSHUTDOWN; ++ req_lib_cfg_tryshutdown.header.size = sizeof (struct req_lib_cfg_tryshutdown); ++ req_lib_cfg_tryshutdown.flags = flags; ++ ++ error = saSendReceiveReply (cfg_instance->response_fd, ++ &req_lib_cfg_tryshutdown, ++ sizeof (struct req_lib_cfg_tryshutdown), ++ &res_lib_cfg_tryshutdown, ++ sizeof (struct res_lib_cfg_tryshutdown)); ++ ++ pthread_mutex_unlock (&cfg_instance->response_mutex); ++ ++ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); ++ ++ return (error == CS_OK ? res_lib_cfg_tryshutdown.header.error : error); ++} ++ ++cs_error_t ++corosync_cfg_replyto_shutdown ( ++ corosync_cfg_handle_t cfg_handle, ++ CorosyncCfgShutdownReplyFlagsT response) ++{ ++ struct cfg_instance *cfg_instance; ++ struct req_lib_cfg_replytoshutdown req_lib_cfg_replytoshutdown; ++ struct iovec iov; ++ cs_error_t error; ++ ++ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, ++ (void *)&cfg_instance); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ req_lib_cfg_replytoshutdown.header.id = MESSAGE_REQ_CFG_REPLYTOSHUTDOWN; ++ req_lib_cfg_replytoshutdown.header.size = sizeof (struct req_lib_cfg_replytoshutdown); ++ req_lib_cfg_replytoshutdown.response = response; ++ ++ iov.iov_base = &req_lib_cfg_replytoshutdown; ++ iov.iov_len = sizeof (struct req_lib_cfg_replytoshutdown); ++ error = saSendMsgRetry (cfg_instance->response_fd, ++ &iov, 1); ++ ++ return (error); + } +diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c +--- corosync-0.92/lib/confdb.c 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/lib/confdb.c 2008-11-11 18:26:58.000000000 +0100 +@@ -42,7 +42,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +@@ -86,7 +86,7 @@ + }; + + +-static confdb_error_t do_find_destroy(struct confdb_inst *confdb_inst, unsigned int find_handle); ++static cs_error_t do_find_destroy(struct confdb_inst *confdb_inst, unsigned int find_handle); + + + /* Safely tidy one iterator context list */ +@@ -99,7 +99,7 @@ + iter != list; iter = tmp, tmp = iter->next) { + + context = list_entry (iter, struct iter_context, list); +- do_find_destroy(confdb_inst, context->find_handle); ++ (void)do_find_destroy(confdb_inst, context->find_handle); + free(context); + } + } +@@ -137,20 +137,20 @@ + * @{ + */ + +-confdb_error_t confdb_initialize ( ++cs_error_t confdb_initialize ( + confdb_handle_t *handle, + confdb_callbacks_t *callbacks) + { +- SaAisErrorT error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + + error = saHandleCreate (&confdb_handle_t_db, sizeof (struct confdb_inst), handle); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_no_destroy; + } + + error = saHandleInstanceGet (&confdb_handle_t_db, *handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_destroy; + } + +@@ -163,7 +163,7 @@ + &confdb_inst->response_fd, + CONFDB_SERVICE); + } +- if (error != SA_AIS_OK) ++ if (error != CS_OK) + goto error_put_destroy; + + memcpy (&confdb_inst->callbacks, callbacks, sizeof (confdb_callbacks_t)); +@@ -175,26 +175,26 @@ + list_init (&confdb_inst->object_iter_head); + list_init (&confdb_inst->key_iter_head); + +- saHandleInstancePut (&confdb_handle_t_db, *handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, *handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + + error_put_destroy: +- saHandleInstancePut (&confdb_handle_t_db, *handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, *handle); + error_destroy: +- saHandleDestroy (&confdb_handle_t_db, *handle); ++ (void)saHandleDestroy (&confdb_handle_t_db, *handle); + error_no_destroy: + return (error); + } + +-confdb_error_t confdb_finalize ( ++cs_error_t confdb_finalize ( + confdb_handle_t handle) + { + struct confdb_inst *confdb_inst; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -205,15 +205,15 @@ + */ + if (confdb_inst->finalize) { + pthread_mutex_unlock (&confdb_inst->response_mutex); +- saHandleInstancePut (&confdb_handle_t_db, handle); +- return (CONFDB_ERR_BAD_HANDLE); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); ++ return (CS_ERR_BAD_HANDLE); + } + + confdb_inst->finalize = 1; + + pthread_mutex_unlock (&confdb_inst->response_mutex); + +- saHandleDestroy (&confdb_handle_t_db, handle); ++ (void)saHandleDestroy (&confdb_handle_t_db, handle); + + /* Free saved context handles */ + free_context_list(confdb_inst, &confdb_inst->object_find_head); +@@ -233,80 +233,80 @@ + close(confdb_inst->dispatch_fd); + } + } +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + +- return (CONFDB_OK); ++ return (CS_OK); + } + +-confdb_error_t confdb_fd_get ( ++cs_error_t confdb_fd_get ( + confdb_handle_t handle, + int *fd) + { +- SaAisErrorT error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + *fd = confdb_inst->dispatch_fd; + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + +-confdb_error_t confdb_context_get ( ++cs_error_t confdb_context_get ( + confdb_handle_t handle, + void **context) + { +- SaAisErrorT error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + *context = confdb_inst->context; + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + +-confdb_error_t confdb_context_set ( ++cs_error_t confdb_context_set ( + confdb_handle_t handle, + void *context) + { +- SaAisErrorT error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + confdb_inst->context = context; + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + +-struct res_overlay { ++struct confdb_res_overlay { + mar_res_header_t header __attribute__((aligned(8))); + char data[512000]; + }; + +-confdb_error_t confdb_dispatch ( ++cs_error_t confdb_dispatch ( + confdb_handle_t handle, +- confdb_dispatch_t dispatch_types) ++ cs_dispatch_flags_t dispatch_types) + { + struct pollfd ufds; + int timeout = -1; +- SaAisErrorT error; ++ cs_error_t error; + int cont = 1; /* always continue do loop except when set to 0 */ + int dispatch_avail; + struct confdb_inst *confdb_inst; +@@ -314,16 +314,16 @@ + struct res_lib_confdb_key_change_callback *res_key_changed_pt; + struct res_lib_confdb_object_create_callback *res_object_created_pt; + struct res_lib_confdb_object_destroy_callback *res_object_destroyed_pt; +- struct res_overlay dispatch_data; ++ struct confdb_res_overlay dispatch_data; + int ignore_dispatch = 0; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = CONFDB_ERR_NOT_SUPPORTED; ++ error = CS_ERR_NOT_SUPPORTED; + goto error_unlock; + } + +@@ -341,7 +341,7 @@ + ufds.revents = 0; + + error = saPollRetry (&ufds, 1, timeout); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + +@@ -351,7 +351,7 @@ + * Regather poll data in case ufds has changed since taking lock + */ + error = saPollRetry (&ufds, 1, timeout); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + +@@ -359,7 +359,7 @@ + * Handle has been finalized in another thread + */ + if (confdb_inst->finalize == 1) { +- error = CONFDB_OK; ++ error = CS_OK; + pthread_mutex_unlock (&confdb_inst->dispatch_mutex); + goto error_unlock; + } +@@ -380,14 +380,14 @@ + */ + error = saRecvRetry (confdb_inst->dispatch_fd, &dispatch_data.header, + sizeof (mar_res_header_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + if (dispatch_data.header.size > sizeof (mar_res_header_t)) { + error = saRecvRetry (confdb_inst->dispatch_fd, &dispatch_data.data, + dispatch_data.header.size - sizeof (mar_res_header_t)); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + } +@@ -443,7 +443,7 @@ + break; + + default: +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_nounlock; + break; + } +@@ -470,36 +470,36 @@ + } while (cont); + + error_unlock: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + error_nounlock: + return (error); + } + +-confdb_error_t confdb_object_create ( ++cs_error_t confdb_object_create ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *object_name, + int object_name_len, + unsigned int *object_handle) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_object_create req_lib_confdb_object_create; + struct res_lib_confdb_object_create res_lib_confdb_object_create; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_object_create(parent_object_handle, + object_name, object_name_len, + object_handle)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -518,7 +518,7 @@ + &res_lib_confdb_object_create, sizeof (struct res_lib_confdb_object_create)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -526,31 +526,31 @@ + *object_handle = res_lib_confdb_object_create.object_handle; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_object_destroy ( ++cs_error_t confdb_object_destroy ( + confdb_handle_t handle, + unsigned int object_handle) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_object_destroy req_lib_confdb_object_destroy; + mar_res_header_t res; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_object_destroy(object_handle)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -567,39 +567,39 @@ + &res, sizeof ( mar_res_header_t)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res.error; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_object_parent_get ( ++cs_error_t confdb_object_parent_get ( + confdb_handle_t handle, + unsigned int object_handle, + unsigned int *parent_object_handle) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_object_parent_get req_lib_confdb_object_parent_get; + struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_object_parent_get(object_handle, parent_object_handle)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -616,7 +616,7 @@ + &res_lib_confdb_object_parent_get, sizeof (struct res_lib_confdb_object_parent_get)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -624,28 +624,28 @@ + *parent_object_handle = res_lib_confdb_object_parent_get.parent_object_handle; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-static confdb_error_t do_find_destroy( ++static cs_error_t do_find_destroy( + struct confdb_inst *confdb_inst, + unsigned int find_handle) + { +- confdb_error_t error; ++ cs_error_t error; + struct iovec iov[2]; + struct req_lib_confdb_object_find_destroy req_lib_confdb_object_find_destroy; + mar_res_header_t res; + + if (!find_handle) +- return SA_AIS_OK; ++ return CS_OK; + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_find_destroy(find_handle)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -662,7 +662,7 @@ + &res, sizeof (mar_res_header_t)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -673,56 +673,56 @@ + return (error); + } + +-confdb_error_t confdb_object_find_destroy( ++cs_error_t confdb_object_find_destroy( + confdb_handle_t handle, + unsigned int parent_object_handle) + { + struct iter_context *context; +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + context = find_iter_context(&confdb_inst->object_find_head, parent_object_handle); + error = do_find_destroy(confdb_inst, context->find_handle); +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + list_del(&context->list); + free(context); + } + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + return error; + } + +-confdb_error_t confdb_object_iter_destroy( ++cs_error_t confdb_object_iter_destroy( + confdb_handle_t handle, + unsigned int parent_object_handle) + { + struct iter_context *context; +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + context = find_iter_context(&confdb_inst->object_iter_head, parent_object_handle); + error = do_find_destroy(confdb_inst, context->find_handle); +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + list_del(&context->list); + free(context); + } + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + return error; + } + + +-confdb_error_t confdb_key_create ( ++cs_error_t confdb_key_create ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -730,24 +730,24 @@ + void *value, + int value_len) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_key_create req_lib_confdb_key_create; + mar_res_header_t res; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_key_create(parent_object_handle, + key_name, key_name_len, + value, value_len)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -768,19 +768,19 @@ + &res, sizeof (res)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res.error; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_key_delete ( ++cs_error_t confdb_key_delete ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -788,24 +788,24 @@ + void *value, + int value_len) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_key_delete req_lib_confdb_key_delete; + mar_res_header_t res; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_key_delete(parent_object_handle, + key_name, key_name_len, + value, value_len)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -826,19 +826,19 @@ + &res, sizeof (res)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res.error; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_key_get ( ++cs_error_t confdb_key_get ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -846,24 +846,24 @@ + void *value, + int *value_len) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_key_get req_lib_confdb_key_get; + struct res_lib_confdb_key_get res_lib_confdb_key_get; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_key_get(parent_object_handle, + key_name, key_name_len, + value, value_len)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -882,47 +882,47 @@ + &res_lib_confdb_key_get, sizeof (struct res_lib_confdb_key_get)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_confdb_key_get.header.error; +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + *value_len = res_lib_confdb_key_get.value.length; + memcpy(value, res_lib_confdb_key_get.value.value, *value_len); + } + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_key_increment ( ++cs_error_t confdb_key_increment ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, + int key_name_len, + unsigned int *value) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_key_get req_lib_confdb_key_get; + struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_key_increment(parent_object_handle, + key_name, key_name_len, + value)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -941,46 +941,46 @@ + &res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_confdb_key_incdec.header.error; +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + *value = res_lib_confdb_key_incdec.value; + } + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_key_decrement ( ++cs_error_t confdb_key_decrement ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, + int key_name_len, + unsigned int *value) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_key_get req_lib_confdb_key_get; + struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_key_decrement(parent_object_handle, + key_name, key_name_len, + value)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -999,22 +999,22 @@ + &res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_confdb_key_incdec.header.error; +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + *value = res_lib_confdb_key_incdec.value; + } + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_key_replace ( ++cs_error_t confdb_key_replace ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -1024,25 +1024,25 @@ + void *new_value, + int new_value_len) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_key_replace req_lib_confdb_key_replace; + mar_res_header_t res; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_key_replace(parent_object_handle, + key_name, key_name_len, + old_value, old_value_len, + new_value, new_value_len)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + req_lib_confdb_key_replace.header.size = sizeof (struct req_lib_confdb_key_replace); +@@ -1064,28 +1064,28 @@ + &res, sizeof (res)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res.error; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_object_iter_start ( ++cs_error_t confdb_object_iter_start ( + confdb_handle_t handle, + unsigned int object_handle) + { + struct confdb_inst *confdb_inst; +- confdb_error_t error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + struct iter_context *context; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -1093,7 +1093,7 @@ + if (!context) { + context = malloc(sizeof(struct iter_context)); + if (!context) { +- error = CONFDB_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + goto ret; + } + context->parent_object_handle = object_handle; +@@ -1103,26 +1103,26 @@ + + /* Start a new find context */ + if (context->find_handle) { +- do_find_destroy(confdb_inst, context->find_handle); ++ (void)do_find_destroy(confdb_inst, context->find_handle); + context->find_handle = 0; + } + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + ret: + return error; + } + +-confdb_error_t confdb_key_iter_start ( ++cs_error_t confdb_key_iter_start ( + confdb_handle_t handle, + unsigned int object_handle) + { + struct confdb_inst *confdb_inst; +- confdb_error_t error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + struct iter_context *context; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -1130,7 +1130,7 @@ + if (!context) { + context = malloc(sizeof(struct iter_context)); + if (!context) { +- error = CONFDB_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + goto ret; + } + context->parent_object_handle = object_handle; +@@ -1140,22 +1140,22 @@ + context->find_handle = 0; + context->next_entry = 0; + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + ret: + return error; + } + +-confdb_error_t confdb_object_find_start ( ++cs_error_t confdb_object_find_start ( + confdb_handle_t handle, + unsigned int parent_object_handle) + { + struct confdb_inst *confdb_inst; +- confdb_error_t error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + struct iter_context *context; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -1163,7 +1163,7 @@ + if (!context) { + context = malloc(sizeof(struct iter_context)); + if (!context) { +- error = CONFDB_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + goto ret; + } + context->find_handle = 0; +@@ -1172,24 +1172,24 @@ + } + /* Start a new find context */ + if (context->find_handle) { +- do_find_destroy(confdb_inst, context->find_handle); ++ (void)do_find_destroy(confdb_inst, context->find_handle); + context->find_handle = 0; + } + +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + ret: + return error; + } + +-confdb_error_t confdb_object_find ( ++cs_error_t confdb_object_find ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *object_name, + int object_name_len, + unsigned int *object_handle) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct iter_context *context; +@@ -1197,26 +1197,26 @@ + struct res_lib_confdb_object_find res_lib_confdb_object_find; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + /* You MUST call confdb_object_find_start first */ + context = find_iter_context(&confdb_inst->object_find_head, parent_object_handle); + if (!context) { +- error = CONFDB_ERR_CONTEXT_NOT_FOUND; ++ error = CS_ERR_CONTEXT_NOT_FOUND; + goto error_exit; + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_object_find(parent_object_handle, + &context->find_handle, + object_handle, + object_name, &object_name_len, + 0)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -1236,7 +1236,7 @@ + &res_lib_confdb_object_find, sizeof (struct res_lib_confdb_object_find)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -1245,20 +1245,20 @@ + context->find_handle = res_lib_confdb_object_find.find_handle; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + + +-confdb_error_t confdb_object_iter ( ++cs_error_t confdb_object_iter ( + confdb_handle_t handle, + unsigned int parent_object_handle, + unsigned int *object_handle, + void *object_name, + int *object_name_len) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct iter_context *context; +@@ -1266,19 +1266,19 @@ + struct res_lib_confdb_object_iter res_lib_confdb_object_iter; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + /* You MUST call confdb_object_iter_start first */ + context = find_iter_context(&confdb_inst->object_iter_head, parent_object_handle); + if (!context) { +- error = CONFDB_ERR_CONTEXT_NOT_FOUND; ++ error = CS_ERR_CONTEXT_NOT_FOUND; + goto error_exit; + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + *object_name_len = 0; + if (confdb_sa_object_find(parent_object_handle, +@@ -1286,7 +1286,7 @@ + object_handle, + object_name, object_name_len, + 1)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto sa_exit; + } + +@@ -1304,12 +1304,12 @@ + &res_lib_confdb_object_iter, sizeof (struct res_lib_confdb_object_iter)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_confdb_object_iter.header.error; +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + *object_name_len = res_lib_confdb_object_iter.object_name.length; + memcpy(object_name, res_lib_confdb_object_iter.object_name.value, *object_name_len); + *object_handle = res_lib_confdb_object_iter.object_handle; +@@ -1318,12 +1318,12 @@ + sa_exit: + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_key_iter ( ++cs_error_t confdb_key_iter ( + confdb_handle_t handle, + unsigned int parent_object_handle, + void *key_name, +@@ -1331,7 +1331,7 @@ + void *value, + int *value_len) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct iter_context *context; +@@ -1339,25 +1339,25 @@ + struct res_lib_confdb_key_iter res_lib_confdb_key_iter; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + /* You MUST call confdb_key_iter_start first */ + context = find_iter_context(&confdb_inst->key_iter_head, parent_object_handle); + if (!context) { +- error = CONFDB_ERR_CONTEXT_NOT_FOUND; ++ error = CS_ERR_CONTEXT_NOT_FOUND; + goto error_exit; + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_key_iter(parent_object_handle, + context->next_entry, + key_name, key_name_len, + value, value_len)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto sa_exit; + } + +@@ -1375,12 +1375,12 @@ + &res_lib_confdb_key_iter, sizeof (struct res_lib_confdb_key_iter)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_confdb_key_iter.header.error; +- if (error == SA_AIS_OK) { ++ if (error == CS_OK) { + *key_name_len = res_lib_confdb_key_iter.key_name.length; + memcpy(key_name, res_lib_confdb_key_iter.key_name.value, *key_name_len); + *value_len = res_lib_confdb_key_iter.value.length; +@@ -1391,31 +1391,31 @@ + context->next_entry++; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_write ( ++cs_error_t confdb_write ( + confdb_handle_t handle, + char *error_text) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + mar_req_header_t req; + struct res_lib_confdb_write res_lib_confdb_write; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_write(error_text)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -1431,7 +1431,7 @@ + &res_lib_confdb_write, sizeof ( struct res_lib_confdb_write)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -1440,32 +1440,32 @@ + memcpy(error_text, res_lib_confdb_write.error.value, res_lib_confdb_write.error.length); + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_reload ( ++cs_error_t confdb_reload ( + confdb_handle_t handle, + int flush, + char *error_text) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct res_lib_confdb_reload res_lib_confdb_reload; + struct req_lib_confdb_reload req_lib_confdb_reload; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = SA_AIS_OK; ++ error = CS_OK; + + if (confdb_sa_reload(flush, error_text)) +- error = SA_AIS_ERR_ACCESS; ++ error = CS_ERR_ACCESS; + goto error_exit; + } + +@@ -1483,7 +1483,7 @@ + + pthread_mutex_unlock (&confdb_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -1492,29 +1492,29 @@ + memcpy(error_text, res_lib_confdb_reload.error.value, res_lib_confdb_reload.error.length); + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_track_changes ( ++cs_error_t confdb_track_changes ( + confdb_handle_t handle, + unsigned int object_handle, + unsigned int flags) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + struct req_lib_confdb_object_track_start req; + mar_res_header_t res; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = CONFDB_ERR_NOT_SUPPORTED; ++ error = CS_ERR_NOT_SUPPORTED; + goto error_exit; + } + +@@ -1532,33 +1532,33 @@ + &res, sizeof ( mar_res_header_t)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res.error; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } + +-confdb_error_t confdb_stop_track_changes (confdb_handle_t handle) ++cs_error_t confdb_stop_track_changes (confdb_handle_t handle) + { +- confdb_error_t error; ++ cs_error_t error; + struct confdb_inst *confdb_inst; + struct iovec iov[2]; + mar_req_header_t req; + mar_res_header_t res; + + error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + if (confdb_inst->standalone) { +- error = CONFDB_ERR_NOT_SUPPORTED; ++ error = CS_ERR_NOT_SUPPORTED; + goto error_exit; + } + +@@ -1574,14 +1574,14 @@ + &res, sizeof ( mar_res_header_t)); + + pthread_mutex_unlock (&confdb_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res.error; + + error_exit: +- saHandleInstancePut (&confdb_handle_t_db, handle); ++ (void)saHandleInstancePut (&confdb_handle_t_db, handle); + + return (error); + } +diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c +--- corosync-0.92/lib/cpg.c 2008-09-17 21:15:00.000000000 +0200 ++++ corosync-trunk/lib/cpg.c 2008-11-11 18:26:58.000000000 +0100 +@@ -45,7 +45,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +@@ -90,27 +90,27 @@ + * @{ + */ + +-cpg_error_t cpg_initialize ( ++cs_error_t cpg_initialize ( + cpg_handle_t *handle, + cpg_callbacks_t *callbacks) + { +- SaAisErrorT error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + + error = saHandleCreate (&cpg_handle_t_db, sizeof (struct cpg_inst), handle); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_no_destroy; + } + + error = saHandleInstanceGet (&cpg_handle_t_db, *handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_destroy; + } + + error = saServiceConnect (&cpg_inst->dispatch_fd, + &cpg_inst->response_fd, + CPG_SERVICE); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_put_destroy; + } + +@@ -120,26 +120,26 @@ + + pthread_mutex_init (&cpg_inst->dispatch_mutex, NULL); + +- saHandleInstancePut (&cpg_handle_t_db, *handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, *handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + + error_put_destroy: +- saHandleInstancePut (&cpg_handle_t_db, *handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, *handle); + error_destroy: +- saHandleDestroy (&cpg_handle_t_db, *handle); ++ (void)saHandleDestroy (&cpg_handle_t_db, *handle); + error_no_destroy: + return (error); + } + +-cpg_error_t cpg_finalize ( ++cs_error_t cpg_finalize ( + cpg_handle_t handle) + { + struct cpg_inst *cpg_inst; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -150,15 +150,15 @@ + */ + if (cpg_inst->finalize) { + pthread_mutex_unlock (&cpg_inst->response_mutex); +- saHandleInstancePut (&cpg_handle_t_db, handle); +- return (CPG_ERR_BAD_HANDLE); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); ++ return (CS_ERR_BAD_HANDLE); + } + + cpg_inst->finalize = 1; + + pthread_mutex_unlock (&cpg_inst->response_mutex); + +- saHandleDestroy (&cpg_handle_t_db, handle); ++ (void)saHandleDestroy (&cpg_handle_t_db, handle); + + /* + * Disconnect from the server +@@ -171,80 +171,80 @@ + shutdown(cpg_inst->dispatch_fd, 0); + close(cpg_inst->dispatch_fd); + } +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + +- return (CPG_OK); ++ return (CS_OK); + } + +-cpg_error_t cpg_fd_get ( ++cs_error_t cpg_fd_get ( + cpg_handle_t handle, + int *fd) + { +- SaAisErrorT error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + *fd = cpg_inst->dispatch_fd; + +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + +-cpg_error_t cpg_context_get ( ++cs_error_t cpg_context_get ( + cpg_handle_t handle, + void **context) + { +- SaAisErrorT error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + *context = cpg_inst->context; + +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + +-cpg_error_t cpg_context_set ( ++cs_error_t cpg_context_set ( + cpg_handle_t handle, + void *context) + { +- SaAisErrorT error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + cpg_inst->context = context; + +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + +-struct res_overlay { ++struct cpg_res_overlay { + mar_res_header_t header __attribute__((aligned(8))); + char data[512000]; + }; + +-cpg_error_t cpg_dispatch ( ++cs_error_t cpg_dispatch ( + cpg_handle_t handle, +- cpg_dispatch_t dispatch_types) ++ cs_dispatch_flags_t dispatch_types) + { + struct pollfd ufds; + int timeout = -1; +- SaAisErrorT error; ++ cs_error_t error; + int cont = 1; /* always continue do loop except when set to 0 */ + int dispatch_avail; + struct cpg_inst *cpg_inst; +@@ -253,7 +253,7 @@ + struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback; + struct res_lib_cpg_groups_get_callback *res_lib_cpg_groups_get_callback; + cpg_callbacks_t callbacks; +- struct res_overlay dispatch_data; ++ struct cpg_res_overlay dispatch_data; + int ignore_dispatch = 0; + struct cpg_address member_list[CPG_MEMBERS_MAX]; + struct cpg_address left_list[CPG_MEMBERS_MAX]; +@@ -264,7 +264,7 @@ + unsigned int i; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -272,7 +272,7 @@ + * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and + * wait indefinately for SA_DISPATCH_BLOCKING + */ +- if (dispatch_types == CPG_DISPATCH_ALL) { ++ if (dispatch_types == CS_DISPATCH_ALL) { + timeout = 0; + } + +@@ -282,7 +282,7 @@ + ufds.revents = 0; + + error = saPollRetry (&ufds, 1, timeout); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + +@@ -292,7 +292,7 @@ + * Regather poll data in case ufds has changed since taking lock + */ + error = saPollRetry (&ufds, 1, timeout); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + +@@ -300,13 +300,13 @@ + * Handle has been finalized in another thread + */ + if (cpg_inst->finalize == 1) { +- error = CPG_OK; ++ error = CS_OK; + pthread_mutex_unlock (&cpg_inst->dispatch_mutex); + goto error_unlock; + } + + dispatch_avail = ufds.revents & POLLIN; +- if (dispatch_avail == 0 && dispatch_types == CPG_DISPATCH_ALL) { ++ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { + pthread_mutex_unlock (&cpg_inst->dispatch_mutex); + break; /* exit do while cont is 1 loop */ + } else +@@ -321,14 +321,14 @@ + */ + error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.header, + sizeof (mar_res_header_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + if (dispatch_data.header.size > sizeof (mar_res_header_t)) { + error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.data, + dispatch_data.header.size - sizeof (mar_res_header_t)); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + } +@@ -424,7 +424,7 @@ + break; + + default: +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_nounlock; + break; + } +@@ -433,34 +433,34 @@ + * Determine if more messages should be processed + * */ + switch (dispatch_types) { +- case CPG_DISPATCH_ONE: ++ case CS_DISPATCH_ONE: + if (ignore_dispatch) { + ignore_dispatch = 0; + } else { + cont = 0; + } + break; +- case CPG_DISPATCH_ALL: ++ case CS_DISPATCH_ALL: + if (ignore_dispatch) { + ignore_dispatch = 0; + } + break; +- case CPG_DISPATCH_BLOCKING: ++ case CS_DISPATCH_BLOCKING: + break; + } + } while (cont); + + error_unlock: +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + error_nounlock: + return (error); + } + +-cpg_error_t cpg_join ( ++cs_error_t cpg_join ( + cpg_handle_t handle, + struct cpg_name *group) + { +- cpg_error_t error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + struct iovec iov[2]; + struct req_lib_cpg_join req_lib_cpg_join; +@@ -469,7 +469,7 @@ + struct res_lib_cpg_trackstart res_lib_cpg_trackstart; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -487,7 +487,7 @@ + error = saSendMsgReceiveReply (cpg_inst->dispatch_fd, iov, 1, + &res_lib_cpg_trackstart, sizeof (struct res_lib_cpg_trackstart)); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + pthread_mutex_unlock (&cpg_inst->response_mutex); + goto error_exit; + } +@@ -507,30 +507,30 @@ + + pthread_mutex_unlock (&cpg_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_cpg_join.header.error; + + error_exit: +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + + return (error); + } + +-cpg_error_t cpg_leave ( ++cs_error_t cpg_leave ( + cpg_handle_t handle, + struct cpg_name *group) + { +- cpg_error_t error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + struct iovec iov[2]; + struct req_lib_cpg_leave req_lib_cpg_leave; + struct res_lib_cpg_leave res_lib_cpg_leave; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -549,26 +549,26 @@ + &res_lib_cpg_leave, sizeof (struct res_lib_cpg_leave)); + + pthread_mutex_unlock (&cpg_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_cpg_leave.header.error; + + error_exit: +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + + return (error); + } + +-cpg_error_t cpg_mcast_joined ( ++cs_error_t cpg_mcast_joined ( + cpg_handle_t handle, + cpg_guarantee_t guarantee, + struct iovec *iovec, + int iov_len) + { + int i; +- cpg_error_t error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + struct iovec iov[64]; + struct req_lib_cpg_mcast req_lib_cpg_mcast; +@@ -576,7 +576,7 @@ + int msg_len = 0; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -602,7 +602,7 @@ + + pthread_mutex_unlock (&cpg_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -612,24 +612,24 @@ + * Also, don't set to ENABLED if the return value is TRY_AGAIN as this can lead + * to Flow Control State sync issues between AIS LIB and EXEC. + */ +- if (res_lib_cpg_mcast.header.error == CPG_OK) { ++ if (res_lib_cpg_mcast.header.error == CS_OK) { + cpg_inst->flow_control_state = res_lib_cpg_mcast.flow_control_state; + } + error = res_lib_cpg_mcast.header.error; + + error_exit: +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + + return (error); + } + +-cpg_error_t cpg_membership_get ( ++cs_error_t cpg_membership_get ( + cpg_handle_t handle, + struct cpg_name *group_name, + struct cpg_address *member_list, + int *member_list_entries) + { +- cpg_error_t error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + struct iovec iov; + struct req_lib_cpg_membership req_lib_cpg_membership_get; +@@ -637,7 +637,7 @@ + unsigned int i; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -656,7 +656,7 @@ + + pthread_mutex_unlock (&cpg_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -674,23 +674,23 @@ + } + + error_exit: +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + + return (error); + } + +-cpg_error_t cpg_local_get ( ++cs_error_t cpg_local_get ( + cpg_handle_t handle, + unsigned int *local_nodeid) + { +- cpg_error_t error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + struct iovec iov; + struct req_lib_cpg_local_get req_lib_cpg_local_get; + struct res_lib_cpg_local_get res_lib_cpg_local_get; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -707,7 +707,7 @@ + + pthread_mutex_unlock (&cpg_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -716,23 +716,23 @@ + *local_nodeid = res_lib_cpg_local_get.local_nodeid; + + error_exit: +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + + return (error); + } + +-cpg_error_t cpg_groups_get ( ++cs_error_t cpg_groups_get ( + cpg_handle_t handle, + unsigned int *num_groups) + { +- cpg_error_t error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + struct iovec iov; + struct req_lib_cpg_groups_get req_lib_cpg_groups_get; + struct res_lib_cpg_groups_get res_lib_cpg_groups_get; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -749,7 +749,7 @@ + + pthread_mutex_unlock (&cpg_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -758,26 +758,26 @@ + + /* Real output is delivered via a callback */ + error_exit: +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + + return (error); + } + +-cpg_error_t cpg_flow_control_state_get ( ++cs_error_t cpg_flow_control_state_get ( + cpg_handle_t handle, + cpg_flow_control_state_t *flow_control_state) + { +- cpg_error_t error; ++ cs_error_t error; + struct cpg_inst *cpg_inst; + + error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + *flow_control_state = cpg_inst->flow_control_state; + +- saHandleInstancePut (&cpg_handle_t_db, handle); ++ (void)saHandleInstancePut (&cpg_handle_t_db, handle); + + return (error); + } +diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c +--- corosync-0.92/lib/evs.c 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/lib/evs.c 2008-11-11 18:26:58.000000000 +0100 +@@ -48,7 +48,7 @@ + + #include + #include +-#include ++#include + #include + #include + #include +@@ -62,7 +62,7 @@ + pthread_mutex_t dispatch_mutex; + }; + +-struct res_overlay { ++struct evs_res_overlay { + mar_res_header_t header __attribute__((aligned(8))); + char data[512000]; + }; +@@ -98,29 +98,29 @@ + * test + * @param handle The handle of evs initialize + * @param callbacks The callbacks for evs_initialize +- * @returns EVS_OK ++ * @returns CS_OK + */ +-evs_error_t evs_initialize ( ++cs_error_t evs_initialize ( + evs_handle_t *handle, + evs_callbacks_t *callbacks) + { +- SaAisErrorT error; ++ cs_error_t error; + struct evs_inst *evs_inst; + + error = saHandleCreate (&evs_handle_t_db, sizeof (struct evs_inst), handle); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_no_destroy; + } + + error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_destroy; + } + + error = saServiceConnect (&evs_inst->response_fd, + &evs_inst->dispatch_fd, + EVS_SERVICE); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_put_destroy; + } + +@@ -130,26 +130,26 @@ + + pthread_mutex_init (&evs_inst->dispatch_mutex, NULL); + +- saHandleInstancePut (&evs_handle_t_db, *handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, *handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + + error_put_destroy: +- saHandleInstancePut (&evs_handle_t_db, *handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, *handle); + error_destroy: +- saHandleDestroy (&evs_handle_t_db, *handle); ++ (void)saHandleDestroy (&evs_handle_t_db, *handle); + error_no_destroy: + return (error); + } + +-evs_error_t evs_finalize ( ++cs_error_t evs_finalize ( + evs_handle_t handle) + { + struct evs_inst *evs_inst; +- SaAisErrorT error; ++ cs_error_t error; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + // TODO is the locking right here +@@ -160,15 +160,15 @@ + */ + if (evs_inst->finalize) { + pthread_mutex_unlock (&evs_inst->response_mutex); +- saHandleInstancePut (&evs_handle_t_db, handle); +- return (EVS_ERR_BAD_HANDLE); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); ++ return (CS_ERR_BAD_HANDLE); + } + + evs_inst->finalize = 1; + + pthread_mutex_unlock (&evs_inst->response_mutex); + +- saHandleDestroy (&evs_handle_t_db, handle); ++ (void)saHandleDestroy (&evs_handle_t_db, handle); + /* + * Disconnect from the server + */ +@@ -180,49 +180,49 @@ + shutdown(evs_inst->dispatch_fd, 0); + close(evs_inst->dispatch_fd); + } +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + + +- return (EVS_OK); ++ return (CS_OK); + } + +-evs_error_t evs_fd_get ( ++cs_error_t evs_fd_get ( + evs_handle_t handle, + int *fd) + { +- SaAisErrorT error; ++ cs_error_t error; + struct evs_inst *evs_inst; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + + *fd = evs_inst->dispatch_fd; + +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + +-evs_error_t evs_dispatch ( ++cs_error_t evs_dispatch ( + evs_handle_t handle, +- evs_dispatch_t dispatch_types) ++ cs_dispatch_flags_t dispatch_types) + { + struct pollfd ufds; + int timeout = -1; +- SaAisErrorT error; ++ cs_error_t error; + int cont = 1; /* always continue do loop except when set to 0 */ + int dispatch_avail; + struct evs_inst *evs_inst; + struct res_evs_confchg_callback *res_evs_confchg_callback; + struct res_evs_deliver_callback *res_evs_deliver_callback; + evs_callbacks_t callbacks; +- struct res_overlay dispatch_data; ++ struct evs_res_overlay dispatch_data; + int ignore_dispatch = 0; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -230,7 +230,7 @@ + * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and + * wait indefinately for SA_DISPATCH_BLOCKING + */ +- if (dispatch_types == EVS_DISPATCH_ALL) { ++ if (dispatch_types == CS_DISPATCH_ALL) { + timeout = 0; + } + +@@ -240,7 +240,7 @@ + ufds.revents = 0; + + error = saPollRetry (&ufds, 1, timeout); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + +@@ -250,7 +250,7 @@ + * Regather poll data in case ufds has changed since taking lock + */ + error = saPollRetry (&ufds, 1, 0); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_nounlock; + } + +@@ -258,13 +258,13 @@ + * Handle has been finalized in another thread + */ + if (evs_inst->finalize == 1) { +- error = EVS_OK; ++ error = CS_OK; + pthread_mutex_unlock (&evs_inst->dispatch_mutex); + goto error_unlock; + } + + dispatch_avail = ufds.revents & POLLIN; +- if (dispatch_avail == 0 && dispatch_types == EVS_DISPATCH_ALL) { ++ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { + pthread_mutex_unlock (&evs_inst->dispatch_mutex); + break; /* exit do while cont is 1 loop */ + } else +@@ -279,14 +279,14 @@ + */ + error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.header, + sizeof (mar_res_header_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + if (dispatch_data.header.size > sizeof (mar_res_header_t)) { + error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.data, + dispatch_data.header.size - sizeof (mar_res_header_t)); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_unlock; + } + } +@@ -327,7 +327,7 @@ + break; + + default: +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_nounlock; + break; + } +@@ -336,42 +336,42 @@ + * Determine if more messages should be processed + * */ + switch (dispatch_types) { +- case EVS_DISPATCH_ONE: ++ case CS_DISPATCH_ONE: + if (ignore_dispatch) { + ignore_dispatch = 0; + } else { + cont = 0; + } + break; +- case EVS_DISPATCH_ALL: ++ case CS_DISPATCH_ALL: + if (ignore_dispatch) { + ignore_dispatch = 0; + } + break; +- case EVS_DISPATCH_BLOCKING: ++ case CS_DISPATCH_BLOCKING: + break; + } + } while (cont); + + error_unlock: +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + error_nounlock: + return (error); + } + +-evs_error_t evs_join ( ++cs_error_t evs_join ( + evs_handle_t handle, + struct evs_group *groups, + int group_entries) + { +- evs_error_t error; ++ cs_error_t error; + struct evs_inst *evs_inst; + struct iovec iov[2]; + struct req_lib_evs_join req_lib_evs_join; + struct res_lib_evs_join res_lib_evs_join; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -392,31 +392,31 @@ + + pthread_mutex_unlock (&evs_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_evs_join.header.error; + + error_exit: +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + + return (error); + } + +-evs_error_t evs_leave ( ++cs_error_t evs_leave ( + evs_handle_t handle, + struct evs_group *groups, + int group_entries) + { +- evs_error_t error; ++ cs_error_t error; + struct evs_inst *evs_inst; + struct iovec iov[2]; + struct req_lib_evs_leave req_lib_evs_leave; + struct res_lib_evs_leave res_lib_evs_leave; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -437,26 +437,26 @@ + + pthread_mutex_unlock (&evs_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_evs_leave.header.error; + + error_exit: +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + + return (error); + } + +-evs_error_t evs_mcast_joined ( ++cs_error_t evs_mcast_joined ( + evs_handle_t handle, + evs_guarantee_t guarantee, + struct iovec *iovec, + int iov_len) + { + int i; +- evs_error_t error; ++ cs_error_t error; + struct evs_inst *evs_inst; + struct iovec iov[64]; + struct req_lib_evs_mcast_joined req_lib_evs_mcast_joined; +@@ -464,7 +464,7 @@ + int msg_len = 0; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -490,19 +490,19 @@ + + pthread_mutex_unlock (&evs_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_evs_mcast_joined.header.error; + + error_exit: +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + + return (error); + } + +-evs_error_t evs_mcast_groups ( ++cs_error_t evs_mcast_groups ( + evs_handle_t handle, + evs_guarantee_t guarantee, + struct evs_group *groups, +@@ -511,7 +511,7 @@ + int iov_len) + { + int i; +- evs_error_t error; ++ cs_error_t error; + struct evs_inst *evs_inst; + struct iovec iov[64]; + struct req_lib_evs_mcast_groups req_lib_evs_mcast_groups; +@@ -519,7 +519,7 @@ + int msg_len = 0; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + for (i = 0; i < iov_len; i++) { +@@ -544,32 +544,32 @@ + &res_lib_evs_mcast_groups, sizeof (struct res_lib_evs_mcast_groups)); + + pthread_mutex_unlock (&evs_inst->response_mutex); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = res_lib_evs_mcast_groups.header.error; + + error_exit: +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + + return (error); + } + +-evs_error_t evs_membership_get ( ++cs_error_t evs_membership_get ( + evs_handle_t handle, + unsigned int *local_nodeid, + unsigned int *member_list, + unsigned int *member_list_entries) + { +- evs_error_t error; ++ cs_error_t error; + struct evs_inst *evs_inst; + struct iovec iov; + struct req_lib_evs_membership_get req_lib_evs_membership_get; + struct res_lib_evs_membership_get res_lib_evs_membership_get; + + error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + return (error); + } + +@@ -586,7 +586,7 @@ + + pthread_mutex_unlock (&evs_inst->response_mutex); + +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -606,7 +606,7 @@ + } + + error_exit: +- saHandleInstancePut (&evs_handle_t_db, handle); ++ (void)saHandleInstancePut (&evs_handle_t_db, handle); + + return (error); + } +diff -Naurd corosync-0.92/lib/libpload.versions corosync-trunk/lib/libpload.versions +--- corosync-0.92/lib/libpload.versions 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/lib/libpload.versions 2008-10-30 23:41:34.000000000 +0100 +@@ -0,0 +1,21 @@ ++# Version and symbol export for libSaClm.so ++ ++COROSYNC_PLOAD_1.0 { ++ global: ++ pload_start; ++ ++ local: ++ saHandleCreate; ++ saHandleDestroy; ++ saHandleInstanceGet; ++ saHandleInstancePut; ++ saRecvRetry; ++ saSelectRetry; ++ saSendMsgReceiveReply; ++ saSendMsgRetry; ++ saSendReceiveReply; ++ saSendRetry; ++ saServiceConnect; ++ saVersionVerify; ++ clustTimeNow; ++}; +diff -Naurd corosync-0.92/lib/libquorum.versions corosync-trunk/lib/libquorum.versions +--- corosync-0.92/lib/libquorum.versions 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/lib/libquorum.versions 2008-12-08 16:55:41.000000000 +0100 +@@ -0,0 +1,59 @@ ++# Version and symbol export for libquorum.so ++ ++OPENAIS_QUORUM_1.0 { ++ global: ++ quorum_initialize; ++ quorum_finalize; ++ quorum_getinfo; ++ quorum_setexpected; ++ quorum_setvotes; ++ quorum_qdisk_register; ++ quorum_qdisk_unregister; ++ quorum_qdisk_poll; ++ quorum_qdisk_getinfo; ++ quorum_setdirty; ++ quorum_killnode; ++ quorum_leaving; ++ ++ local: ++ saHandleCreate; ++ saHandleDestroy; ++ saHandleInstanceGet; ++ saHandleInstancePut; ++ saRecvRetry; ++ saSelectRetry; ++ saSendMsgReceiveReply; ++ saSendMsgRetry; ++ saSendReceiveReply; ++ saSendRetry; ++ saServiceConnect; ++ saVersionVerify; ++ clustTimeNow; ++}; ++# Version and symbol export for libcpg.so ++ ++COROSYNC_QUORUM_1.0 { ++ global: ++ quorum_initialize; ++ quorum_finalize; ++ quorum_fd_get; ++ quorum_dispatch; ++ quorum_get_quorate; ++ quorum_context_get; ++ quorum_context_set; ++ ++ local: ++ saHandleCreate; ++ saHandleDestroy; ++ saHandleInstanceGet; ++ saHandleInstancePut; ++ saRecvRetry; ++ saSelectRetry; ++ saSendMsgReceiveReply; ++ saSendMsgRetry; ++ saSendReceiveReply; ++ saSendRetry; ++ saServiceConnect; ++ saVersionVerify; ++ clustTimeNow; ++}; +diff -Naurd corosync-0.92/lib/Makefile corosync-trunk/lib/Makefile +--- corosync-0.92/lib/Makefile 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/lib/Makefile 2008-11-04 02:35:15.000000000 +0100 +@@ -41,6 +41,8 @@ + libconfdb.a libconfdb.so.2.0.0 \ + libevs.a libevs.so.2.0.0 \ + libcfg.a libcfg.so.2.0.0 \ ++ libquorum.a libquorum.so.2.0.0 \ ++ libpload.a libpload.so.2.0.0 \ + libcoroutil.a libcoroutil.so.2.0.0 + + libcoroutil.a: util.o +@@ -58,14 +60,17 @@ + libcpg.so.2.0.0: util.o cpg.o + $(CC) $(DARWIN_OPTS) util.o cpg.o -o $@ + ++libquorum.so.2.0.0: util.o quorum.o ++ $(CC) $(DARWIN_OPTS) util.o quorum.o -o $@ ++ + libconfdb.so.2.0.0: util.o confdb.o sa-confdb.o + $(CC) $(LDFLAGS) $(DARWIN_OPTS) util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ + + libcfg.so.2.0.0: util.o cfg.o + $(CC) $(DARWIN_OPTS) util.o cfg.o -o $@ + +-libcpg.so.2.0.0: util.o cpg.o +- $(CC) $(DARWIN_OPTS) util.o cpg.o -o $@ ++libpload.so.2.0.0: util.o pload.o ++ $(CC) $(DARWIN_OPTS) util.o pload.o -o $@ + + else + +@@ -78,12 +83,18 @@ + libcpg.so.2.0.0: util.o cpg.o + $(CC) -shared -Wl,-soname,libcpg.so.2,-version-script=$(srcdir)$(subdir)libcpg.versions util.o cpg.o -o $@ + ++libquorum.so.2.0.0: util.o quorum.o ++ $(CC) -shared -Wl,-soname,libquorum.so.2,-version-script=$(srcdir)$(subdir)libquorum.versions util.o quorum.o -o $@ ++ + libconfdb.so.2.0.0: util.o confdb.o sa-confdb.o + $(CC) $(LDFLAGS) -shared -Wl,-soname,libconfdb.so.2,-version-script=$(srcdir)$(subdir)libconfdb.versions util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ + + libcfg.so.2.0.0: util.o cfg.o + $(CC) -shared -Wl,-soname,libcfg.so.2,-version-script=$(srcdir)$(subdir)libcfg.versions util.o cfg.o -o $@ + ++libpload.so.2.0.0: util.o pload.o ++ $(CC) -shared -Wl,-soname,libpload.so.2,-version-script=$(srcdir)$(subdir)libpload.versions util.o cfg.o -o $@ ++ + endif + + libevs.a: util.o evs.o +@@ -92,17 +103,24 @@ + libcpg.a: util.o cpg.o + $(AR) -rc libcpg.a util.o cpg.o + ++libquorum.a: util.o quorum.o ++ $(AR) -rc libquorum.a util.o quorum.o ++ + libconfdb.a: util.o confdb.o sa-confdb.o + $(AR) -rc libconfdb.a util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o + + libcfg.a: util.o cfg.o + $(AR) -rc libcfg.a util.o cfg.o + ++libpload.a: util.o pload.o ++ $(AR) -rc libpload.a util.o pload.o ++ + clean: +- rm -f *.o libcfg.so* libcoroutil.so* libcoroutil.a \ +- libevs.so* libevs.a libcpg.so* libcpg.a libcfg.a libconfdb.so* \ +- libconfdb.a libconfdb.a \ *.da *.bb *.bbg ++ rm -f *.o *.a *.so* *.da *.bb *.bbg + ++lint: ++ -splint $(LINT_FLAGS) $(CFLAGS) *.c ++ + # -fPIC rules required for all libraries + %.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $< +diff -Naurd corosync-0.92/lib/pload.c corosync-trunk/lib/pload.c +--- corosync-0.92/lib/pload.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/lib/pload.c 2008-11-11 18:25:22.000000000 +0100 +@@ -0,0 +1,238 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: 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. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static void pload_instance_destructor (void *instance); ++ ++struct pload_inst { ++ int dispatch_fd; ++ int response_fd; ++ pthread_mutex_t response_mutex; ++ pthread_mutex_t dispatch_mutex; ++ unsigned int finalize; ++}; ++ ++static struct saHandleDatabase pload_handle_t_db = { ++ .handleCount = 0, ++ .handles = 0, ++ .mutex = PTHREAD_MUTEX_INITIALIZER, ++ .handleInstanceDestructor = pload_instance_destructor ++}; ++ ++/* ++ * Clean up function for an evt instance (saEvtInitialize) handle ++ */ ++static void pload_instance_destructor (void *instance) ++{ ++ struct pload_inst *pload_inst = instance; ++ ++ pthread_mutex_destroy (&pload_inst->response_mutex); ++ pthread_mutex_destroy (&pload_inst->dispatch_mutex); ++} ++ ++ ++/** ++ * @defgroup pload_corosync The extended virtual synchrony passthrough API ++ * @ingroup corosync ++ * ++ * @{ ++ */ ++/** ++ * test ++ * @param handle The handle of pload initialize ++ * @param callbacks The callbacks for pload_initialize ++ * @returns PLOAD_OK ++ */ ++unsigned int pload_initialize ( ++ pload_handle_t *handle, ++ pload_callbacks_t *callbacks) ++{ ++ cs_error_t error; ++ struct pload_inst *pload_inst; ++ ++ error = saHandleCreate (&pload_handle_t_db, sizeof (struct pload_inst), handle); ++ if (error != CS_OK) { ++ goto error_no_destroy; ++ } ++ ++ error = saHandleInstanceGet (&pload_handle_t_db, *handle, (void *)&pload_inst); ++ if (error != CS_OK) { ++ goto error_destroy; ++ } ++ ++ error = saServiceConnect (&pload_inst->response_fd, ++ &pload_inst->dispatch_fd, ++ PLOAD_SERVICE); ++ if (error != CS_OK) { ++ goto error_put_destroy; ++ } ++ ++ pthread_mutex_init (&pload_inst->response_mutex, NULL); ++ ++ pthread_mutex_init (&pload_inst->dispatch_mutex, NULL); ++ ++ (void)saHandleInstancePut (&pload_handle_t_db, *handle); ++ ++ return (CS_OK); ++ ++error_put_destroy: ++ (void)saHandleInstancePut (&pload_handle_t_db, *handle); ++error_destroy: ++ (void)saHandleDestroy (&pload_handle_t_db, *handle); ++error_no_destroy: ++ return (error); ++} ++ ++unsigned int pload_finalize ( ++ pload_handle_t handle) ++{ ++ struct pload_inst *pload_inst; ++ cs_error_t error; ++ ++ error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++// TODO is the locking right here ++ pthread_mutex_lock (&pload_inst->response_mutex); ++ ++ /* ++ * Another thread has already started finalizing ++ */ ++ if (pload_inst->finalize) { ++ pthread_mutex_unlock (&pload_inst->response_mutex); ++ (void)saHandleInstancePut (&pload_handle_t_db, handle); ++ return (PLOAD_ERR_BAD_HANDLE); ++ } ++ ++ pload_inst->finalize = 1; ++ ++ pthread_mutex_unlock (&pload_inst->response_mutex); ++ ++ (void)saHandleDestroy (&pload_handle_t_db, handle); ++ /* ++ * Disconnect from the server ++ */ ++ if (pload_inst->response_fd != -1) { ++ shutdown(pload_inst->response_fd, 0); ++ close(pload_inst->response_fd); ++ } ++ if (pload_inst->dispatch_fd != -1) { ++ shutdown(pload_inst->dispatch_fd, 0); ++ close(pload_inst->dispatch_fd); ++ } ++ (void)saHandleInstancePut (&pload_handle_t_db, handle); ++ ++ ++ return (PLOAD_OK); ++} ++ ++unsigned int pload_fd_get ( ++ pload_handle_t handle, ++ int *fd) ++{ ++ cs_error_t error; ++ struct pload_inst *pload_inst; ++ ++ error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ *fd = pload_inst->dispatch_fd; ++ ++ (void)saHandleInstancePut (&pload_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++unsigned int pload_start ( ++ pload_handle_t handle, ++ unsigned int code, ++ unsigned int msg_count, ++ unsigned int msg_size) ++{ ++ unsigned int error; ++ struct pload_inst *pload_inst; ++ struct iovec iov; ++ struct req_lib_pload_start req_lib_pload_start; ++ struct res_lib_pload_start res_lib_pload_start; ++ ++ error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ req_lib_pload_start.header.size = sizeof (struct req_lib_pload_start); ++ req_lib_pload_start.header.id = MESSAGE_REQ_PLOAD_START; ++ req_lib_pload_start.msg_code = code; ++ req_lib_pload_start.msg_count = msg_count; ++ req_lib_pload_start.msg_size = msg_size; ++ ++ iov.iov_base = (char *)&req_lib_pload_start; ++ iov.iov_len = sizeof (struct req_lib_pload_start); ++ ++ pthread_mutex_lock (&pload_inst->response_mutex); ++ ++ error = saSendMsgReceiveReply (pload_inst->response_fd, &iov, 1, ++ &res_lib_pload_start, sizeof (struct res_lib_pload_start)); ++ ++ pthread_mutex_unlock (&pload_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_pload_start.header.error; ++ ++error_exit: ++ (void)saHandleInstancePut (&pload_handle_t_db, handle); ++ ++ return (error); ++} ++ ++/** @} */ +diff -Naurd corosync-0.92/lib/quorum.c corosync-trunk/lib/quorum.c +--- corosync-0.92/lib/quorum.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/lib/quorum.c 2008-11-11 18:26:58.000000000 +0100 +@@ -0,0 +1,493 @@ ++/* ++ * Copyright (c) 2008 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 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. ++ */ ++/* ++ * Provides a quorum API using the corosync executive ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include "corosync/quorum.h" ++#include "corosync/ipc_quorum.h" ++ ++struct quorum_inst { ++ int response_fd; ++ int dispatch_fd; ++ int finalize; ++ void *context; ++ quorum_callbacks_t callbacks; ++ pthread_mutex_t response_mutex; ++ pthread_mutex_t dispatch_mutex; ++}; ++ ++static void quorum_instance_destructor (void *instance); ++ ++static struct saHandleDatabase quorum_handle_t_db = { ++ .handleCount = 0, ++ .handles = 0, ++ .mutex = PTHREAD_MUTEX_INITIALIZER, ++ .handleInstanceDestructor = quorum_instance_destructor ++}; ++ ++/* ++ * Clean up function for a quorum instance (quorum_initialize) handle ++ */ ++static void quorum_instance_destructor (void *instance) ++{ ++ struct quorum_inst *quorum_inst = instance; ++ ++ pthread_mutex_destroy (&quorum_inst->response_mutex); ++} ++ ++cs_error_t quorum_initialize ( ++ quorum_handle_t *handle, ++ quorum_callbacks_t *callbacks) ++{ ++ cs_error_t error; ++ struct quorum_inst *quorum_inst; ++ ++ error = saHandleCreate (&quorum_handle_t_db, sizeof (struct quorum_inst), handle); ++ if (error != CS_OK) { ++ goto error_no_destroy; ++ } ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, *handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ goto error_destroy; ++ } ++ ++ error = saServiceConnect (&quorum_inst->dispatch_fd, ++ &quorum_inst->response_fd, ++ QUORUM_SERVICE); ++ if (error != CS_OK) { ++ goto error_put_destroy; ++ } ++ ++ pthread_mutex_init (&quorum_inst->response_mutex, NULL); ++ pthread_mutex_init (&quorum_inst->dispatch_mutex, NULL); ++ if (callbacks) ++ memcpy(&quorum_inst->callbacks, callbacks, sizeof (callbacks)); ++ else ++ memset(&quorum_inst->callbacks, 0, sizeof (callbacks)); ++ ++ (void)saHandleInstancePut (&quorum_handle_t_db, *handle); ++ ++ return (CS_OK); ++ ++error_put_destroy: ++ (void)saHandleInstancePut (&quorum_handle_t_db, *handle); ++error_destroy: ++ (void)saHandleDestroy (&quorum_handle_t_db, *handle); ++error_no_destroy: ++ return (error); ++} ++ ++cs_error_t quorum_finalize ( ++ quorum_handle_t handle) ++{ ++ struct quorum_inst *quorum_inst; ++ cs_error_t error; ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&quorum_inst->response_mutex); ++ ++ /* ++ * Another thread has already started finalizing ++ */ ++ if (quorum_inst->finalize) { ++ pthread_mutex_unlock (&quorum_inst->response_mutex); ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ return (CS_ERR_BAD_HANDLE); ++ } ++ ++ quorum_inst->finalize = 1; ++ ++ pthread_mutex_unlock (&quorum_inst->response_mutex); ++ ++ (void)saHandleDestroy (&quorum_handle_t_db, handle); ++ ++ /* ++ * Disconnect from the server ++ */ ++ if (quorum_inst->response_fd != -1) { ++ shutdown(quorum_inst->response_fd, 0); ++ close(quorum_inst->response_fd); ++ } ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++cs_error_t quorum_getquorate ( ++ quorum_handle_t handle, ++ int *quorate) ++{ ++ cs_error_t error; ++ struct quorum_inst *quorum_inst; ++ struct iovec iov[2]; ++ mar_req_header_t req; ++ struct res_lib_quorum_getquorate res_lib_quorum_getquorate; ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&quorum_inst->response_mutex); ++ ++ req.size = sizeof (req); ++ req.id = MESSAGE_REQ_QUORUM_GETQUORATE; ++ ++ iov[0].iov_base = (char *)&req; ++ iov[0].iov_len = sizeof (req); ++ ++ error = saSendMsgReceiveReply (quorum_inst->response_fd, iov, 1, ++ &res_lib_quorum_getquorate, sizeof (struct res_lib_quorum_getquorate)); ++ ++ pthread_mutex_unlock (&quorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_quorum_getquorate.header.error; ++ ++ *quorate = res_lib_quorum_getquorate.quorate; ++ ++error_exit: ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t quorum_fd_get ( ++ quorum_handle_t handle, ++ int *fd) ++{ ++ cs_error_t error; ++ struct quorum_inst *quorum_inst; ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ *fd = quorum_inst->dispatch_fd; ++ ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++ ++cs_error_t quorum_context_get ( ++ quorum_handle_t handle, ++ void **context) ++{ ++ cs_error_t error; ++ struct quorum_inst *quorum_inst; ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ *context = quorum_inst->context; ++ ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++cs_error_t quorum_context_set ( ++ quorum_handle_t handle, ++ void *context) ++{ ++ cs_error_t error; ++ struct quorum_inst *quorum_inst; ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ quorum_inst->context = context; ++ ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++ ++cs_error_t quorum_trackstart ( ++ quorum_handle_t handle, ++ unsigned int flags ) ++{ ++ cs_error_t error; ++ struct quorum_inst *quorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_quorum_trackstart req_lib_quorum_trackstart; ++ mar_res_header_t res; ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&quorum_inst->response_mutex); ++ ++ req_lib_quorum_trackstart.header.size = sizeof (struct req_lib_quorum_trackstart); ++ req_lib_quorum_trackstart.header.id = MESSAGE_REQ_QUORUM_TRACKSTART; ++ req_lib_quorum_trackstart.track_flags = flags; ++ ++ iov[0].iov_base = (char *)&req_lib_quorum_trackstart; ++ iov[0].iov_len = sizeof (struct req_lib_quorum_trackstart); ++ ++ error = saSendMsgReceiveReply (quorum_inst->response_fd, iov, 1, ++ &res, sizeof (res)); ++ ++ pthread_mutex_unlock (&quorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res.error; ++ ++error_exit: ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t quorum_trackstop ( ++ quorum_handle_t handle) ++{ ++ cs_error_t error; ++ struct quorum_inst *quorum_inst; ++ struct iovec iov[2]; ++ mar_req_header_t req; ++ mar_res_header_t res; ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&quorum_inst->response_mutex); ++ ++ req.size = sizeof (req); ++ req.id = MESSAGE_REQ_QUORUM_TRACKSTOP; ++ ++ iov[0].iov_base = (char *)&req; ++ iov[0].iov_len = sizeof (req); ++ ++ error = saSendMsgReceiveReply (quorum_inst->response_fd, iov, 1, ++ &res, sizeof (res)); ++ ++ pthread_mutex_unlock (&quorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res.error; ++ ++error_exit: ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++struct quorum_res_overlay { ++ mar_res_header_t header __attribute__((aligned(8))); ++ char data[512000]; ++}; ++ ++cs_error_t quorum_dispatch ( ++ quorum_handle_t handle, ++ cs_dispatch_flags_t dispatch_types) ++{ ++ struct pollfd ufds; ++ int timeout = -1; ++ cs_error_t error; ++ int cont = 1; /* always continue do loop except when set to 0 */ ++ int dispatch_avail; ++ struct quorum_inst *quorum_inst; ++ quorum_callbacks_t callbacks; ++ struct quorum_res_overlay dispatch_data; ++ struct res_lib_quorum_notification *res_lib_quorum_notification; ++ ++ if (dispatch_types != CS_DISPATCH_ONE && ++ dispatch_types != CS_DISPATCH_ALL && ++ dispatch_types != CS_DISPATCH_BLOCKING) { ++ ++ return (CS_ERR_INVALID_PARAM); ++ } ++ ++ error = saHandleInstanceGet (&quorum_handle_t_db, handle, ++ (void *)&quorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ /* ++ * Timeout instantly for CS_DISPATCH_ONE or SA_DISPATCH_ALL and ++ * wait indefinately for CS_DISPATCH_BLOCKING ++ */ ++ if (dispatch_types == CS_DISPATCH_ALL) { ++ timeout = 0; ++ } ++ ++ do { ++ ufds.fd = quorum_inst->dispatch_fd; ++ ufds.events = POLLIN; ++ ufds.revents = 0; ++ ++ pthread_mutex_lock (&quorum_inst->dispatch_mutex); ++ ++ error = saPollRetry (&ufds, 1, timeout); ++ if (error != CS_OK) { ++ goto error_unlock; ++ } ++ ++ /* ++ * Handle has been finalized in another thread ++ */ ++ if (quorum_inst->finalize == 1) { ++ error = CS_OK; ++ goto error_unlock; ++ } ++ ++ if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) { ++ error = CS_ERR_BAD_HANDLE; ++ goto error_unlock; ++ } ++ ++ dispatch_avail = ufds.revents & POLLIN; ++ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { ++ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); ++ break; /* exit do while cont is 1 loop */ ++ } else ++ if (dispatch_avail == 0) { ++ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); ++ continue; /* next poll */ ++ } ++ ++ if (ufds.revents & POLLIN) { ++ error = saRecvRetry (quorum_inst->dispatch_fd, &dispatch_data.header, ++ sizeof (mar_res_header_t)); ++ if (error != CS_OK) { ++ goto error_unlock; ++ } ++ if (dispatch_data.header.size > sizeof (mar_res_header_t)) { ++ error = saRecvRetry (quorum_inst->dispatch_fd, &dispatch_data.data, ++ dispatch_data.header.size - sizeof (mar_res_header_t)); ++ if (error != CS_OK) { ++ goto error_unlock; ++ } ++ } ++ } else { ++ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); ++ continue; ++ } ++ ++ /* ++ * Make copy of callbacks, message data, unlock instance, and call callback ++ * A risk of this dispatch method is that the callback routines may ++ * operate at the same time that quorum_finalize has been called in another thread. ++ */ ++ memcpy (&callbacks, &quorum_inst->callbacks, sizeof (quorum_callbacks_t)); ++ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); ++ ++ /* ++ * Dispatch incoming message ++ */ ++ switch (dispatch_data.header.id) { ++ ++ case MESSAGE_RES_QUORUM_NOTIFICATION: ++ if (callbacks.quorum_notify_fn == NULL) { ++ continue; ++ } ++ res_lib_quorum_notification = (struct res_lib_quorum_notification *)&dispatch_data; ++ ++ callbacks.quorum_notify_fn ( handle, ++ res_lib_quorum_notification->quorate, ++ res_lib_quorum_notification->ring_seq, ++ res_lib_quorum_notification->view_list_entries, ++ res_lib_quorum_notification->view_list); ++ break; ++ ++ default: ++ error = CS_ERR_LIBRARY; ++ goto error_put; ++ break; ++ } ++ ++ /* ++ * Determine if more messages should be processed ++ * */ ++ switch (dispatch_types) { ++ case CS_DISPATCH_ONE: ++ cont = 0; ++ break; ++ case CS_DISPATCH_ALL: ++ break; ++ case CS_DISPATCH_BLOCKING: ++ break; ++ } ++ } while (cont); ++ ++ goto error_put; ++ ++error_unlock: ++ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); ++ ++error_put: ++ (void)saHandleInstancePut (&quorum_handle_t_db, handle); ++ return (error); ++} +diff -Naurd corosync-0.92/lib/sa-confdb.c corosync-trunk/lib/sa-confdb.c +--- corosync-0.92/lib/sa-confdb.c 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/lib/sa-confdb.c 2008-11-12 18:39:37.000000000 +0100 +@@ -43,7 +43,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +@@ -80,7 +80,7 @@ + objdb = (struct objdb_iface_ver0 *)objdb_p; + + objdb->objdb_init (); +- return SA_AIS_OK; ++ return CS_OK; + } + + static int load_config() +@@ -130,7 +130,7 @@ + if (config_iface) + free(config_iface); + +- return SA_AIS_OK; ++ return CS_OK; + } + + /* Needed by objdb when it writes back the configuration */ +@@ -174,7 +174,7 @@ + int res; + + res = load_objdb(); +- if (res != SA_AIS_OK) ++ if (res != CS_OK) + return res; + + res = load_config(); +@@ -295,7 +295,6 @@ + } + + int confdb_sa_write ( +- unsigned int parent_object_handle, + char *error_text) + { + char *errtext; +@@ -309,7 +308,6 @@ + } + + int confdb_sa_reload ( +- unsigned int parent_object_handle, + int flush, + char *error_text) + { +diff -Naurd corosync-0.92/lib/sa-confdb.h corosync-trunk/lib/sa-confdb.h +--- corosync-0.92/lib/sa-confdb.h 2008-08-26 09:34:22.000000000 +0200 ++++ corosync-trunk/lib/sa-confdb.h 2008-10-06 09:46:04.000000000 +0200 +@@ -42,6 +42,8 @@ + extern int confdb_sa_key_replace(unsigned int parent_object_handle, void *key_name, int key_name_len, void *old_value, int old_value_len, void *new_value, int new_value_len); + extern int confdb_sa_object_find(unsigned int parent_object_handle, unsigned int *find_handle, unsigned int *object_handle, void *object_name, int *object_name_len, int copy_name); + extern int confdb_sa_key_iter(unsigned int parent_object_handle, unsigned int start_pos, void *key_name, int *key_name_len, void *value, int *value_len); ++extern int confdb_sa_key_increment(unsigned int parent_object_handle, void *key_name, int key_name_len, unsigned int *value); ++extern int confdb_sa_key_decrement(unsigned int parent_object_handle, void *key_name, int key_name_len, unsigned int *value); + extern int confdb_sa_find_destroy(unsigned int find_handle); + extern int confdb_sa_write(char *error_text); + extern int confdb_sa_reload(int flush, char *error_text); +diff -Naurd corosync-0.92/lib/util.c corosync-trunk/lib/util.c +--- corosync-0.92/lib/util.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/lib/util.c 2008-11-11 19:13:47.000000000 +0100 +@@ -53,7 +53,7 @@ + #include + #include + +-#include ++#include + #include + #include + +@@ -96,7 +96,7 @@ + } + #endif + +-SaAisErrorT ++cs_error_t + saServiceConnect ( + int *responseOut, + int *callbackOut, +@@ -110,7 +110,7 @@ + mar_res_lib_response_init_t res_lib_response_init; + mar_req_lib_dispatch_init_t req_lib_dispatch_init; + mar_res_lib_dispatch_init_t res_lib_dispatch_init; +- SaAisErrorT error; ++ cs_error_t error; + gid_t egid; + + /* +@@ -131,7 +131,7 @@ + #endif + responseFD = socket (PF_UNIX, SOCK_STREAM, 0); + if (responseFD == -1) { +- return (SA_AIS_ERR_NO_RESOURCES); ++ return (CS_ERR_NO_RESOURCES); + } + + socket_nosigpipe (responseFD); +@@ -139,7 +139,7 @@ + result = connect (responseFD, (struct sockaddr *)&address, AIS_SUN_LEN(&address)); + if (result == -1) { + close (responseFD); +- return (SA_AIS_ERR_TRY_AGAIN); ++ return (CS_ERR_TRY_AGAIN); + } + + req_lib_response_init.resdis_header.size = sizeof (req_lib_response_init); +@@ -148,19 +148,19 @@ + + error = saSendRetry (responseFD, &req_lib_response_init, + sizeof (mar_req_lib_response_init_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + error = saRecvRetry (responseFD, &res_lib_response_init, + sizeof (mar_res_lib_response_init_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + /* + * Check for security errors + */ +- if (res_lib_response_init.header.error != SA_AIS_OK) { ++ if (res_lib_response_init.header.error != CS_OK) { + error = res_lib_response_init.header.error; + goto error_exit; + } +@@ -171,7 +171,7 @@ + callbackFD = socket (PF_UNIX, SOCK_STREAM, 0); + if (callbackFD == -1) { + close (responseFD); +- return (SA_AIS_ERR_NO_RESOURCES); ++ return (CS_ERR_NO_RESOURCES); + } + + socket_nosigpipe (callbackFD); +@@ -180,7 +180,7 @@ + if (result == -1) { + close (callbackFD); + close (responseFD); +- return (SA_AIS_ERR_TRY_AGAIN); ++ return (CS_ERR_TRY_AGAIN); + } + + req_lib_dispatch_init.resdis_header.size = sizeof (req_lib_dispatch_init); +@@ -191,25 +191,25 @@ + + error = saSendRetry (callbackFD, &req_lib_dispatch_init, + sizeof (mar_req_lib_dispatch_init_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit_two; + } + error = saRecvRetry (callbackFD, &res_lib_dispatch_init, + sizeof (mar_res_lib_dispatch_init_t)); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit_two; + } + + /* + * Check for security errors + */ +- if (res_lib_dispatch_init.header.error != SA_AIS_OK) { ++ if (res_lib_dispatch_init.header.error != CS_OK) { + error = res_lib_dispatch_init.header.error; + goto error_exit; + } + + *callbackOut = callbackFD; +- return (SA_AIS_OK); ++ return (CS_OK); + + error_exit_two: + close (callbackFD); +@@ -218,14 +218,14 @@ + return (error); + } + +-SaAisErrorT ++cs_error_t + saRecvRetry ( + int s, + void *msg, + size_t len) + { +- SaAisErrorT error = SA_AIS_OK; +- int result; ++ cs_error_t error = CS_OK; ++ ssize_t result; + struct msghdr msg_recv; + struct iovec iov_recv; + char *rbuf = (char *)msg; +@@ -260,12 +260,12 @@ + * EOF is detected when recvmsg return 0. + */ + if (result == 0) { +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_exit; + } + #endif + if (result == -1 || result == 0) { +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_exit; + } + processed += result; +@@ -277,14 +277,14 @@ + return (error); + } + +-SaAisErrorT ++cs_error_t + saSendRetry ( + int s, + const void *msg, + size_t len) + { +- SaAisErrorT error = SA_AIS_OK; +- int result; ++ cs_error_t error = CS_OK; ++ ssize_t result; + struct msghdr msg_send; + struct iovec iov_send; + char *rbuf = (char *)msg; +@@ -315,15 +315,15 @@ + */ + if (result == -1 && processed == 0) { + if (errno == EINTR) { +- error = SA_AIS_ERR_TRY_AGAIN; ++ error = CS_ERR_TRY_AGAIN; + goto error_exit; + } + if (errno == EAGAIN) { +- error = SA_AIS_ERR_TRY_AGAIN; ++ error = CS_ERR_TRY_AGAIN; + goto error_exit; + } + if (errno == EFAULT) { +- error = SA_AIS_ERR_INVALID_PARAM; ++ error = CS_ERR_INVALID_PARAM; + goto error_exit; + } + } +@@ -340,7 +340,7 @@ + goto retry_send; + } + if (errno == EFAULT) { +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_exit; + } + } +@@ -349,7 +349,7 @@ + * return ERR_LIBRARY on any other syscall error + */ + if (result == -1) { +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_exit; + } + +@@ -362,13 +362,13 @@ + return (error); + } + +-SaAisErrorT saSendMsgRetry ( ++cs_error_t saSendMsgRetry ( + int s, + struct iovec *iov, + int iov_len) + { +- SaAisErrorT error = SA_AIS_OK; +- int result; ++ cs_error_t error = CS_OK; ++ ssize_t result; + int total_size = 0; + int i; + int csize; +@@ -404,15 +404,15 @@ + */ + if (result == -1 && iovec_saved_position == -1) { + if (errno == EINTR) { +- error = SA_AIS_ERR_TRY_AGAIN; ++ error = CS_ERR_TRY_AGAIN; + goto error_exit; + } + if (errno == EAGAIN) { +- error = SA_AIS_ERR_TRY_AGAIN; ++ error = CS_ERR_TRY_AGAIN; + goto error_exit; + } + if (errno == EFAULT) { +- error = SA_AIS_ERR_INVALID_PARAM; ++ error = CS_ERR_INVALID_PARAM; + goto error_exit; + } + } +@@ -428,7 +428,7 @@ + goto retry_sendmsg; + } + if (errno == EFAULT) { +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_exit; + } + } +@@ -437,7 +437,7 @@ + * ERR_LIBRARY for any other syscall error + */ + if (result == -1) { +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + goto error_exit; + } + +@@ -470,22 +470,22 @@ + return (error); + } + +-SaAisErrorT saSendMsgReceiveReply ( ++cs_error_t saSendMsgReceiveReply ( + int s, + struct iovec *iov, + int iov_len, + void *responseMessage, + int responseLen) + { +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + + error = saSendMsgRetry (s, iov, iov_len); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = saRecvRetry (s, responseMessage, responseLen); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -493,22 +493,22 @@ + return (error); + } + +-SaAisErrorT saSendReceiveReply ( ++cs_error_t saSendReceiveReply ( + int s, + void *requestMessage, + int requestLen, + void *responseMessage, + int responseLen) + { +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + + error = saSendRetry (s, requestMessage, requestLen); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + + error = saRecvRetry (s, responseMessage, responseLen); +- if (error != SA_AIS_OK) { ++ if (error != CS_OK) { + goto error_exit; + } + +@@ -516,13 +516,13 @@ + return (error); + } + +-SaAisErrorT ++cs_error_t + saPollRetry ( + struct pollfd *ufds, + unsigned int nfds, + int timeout) + { +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + int result; + + retry_poll: +@@ -531,18 +531,18 @@ + goto retry_poll; + } + if (result == -1) { +- error = SA_AIS_ERR_LIBRARY; ++ error = CS_ERR_LIBRARY; + } + + return (error); + } + + +-SaAisErrorT ++cs_error_t + saHandleCreate ( + struct saHandleDatabase *handleDatabase, + int instanceSize, +- SaUint64T *handleOut) ++ uint64_t *handleOut) + { + uint32_t handle; + uint32_t check; +@@ -566,7 +566,7 @@ + sizeof (struct saHandle) * handleDatabase->handleCount); + if (newHandles == NULL) { + pthread_mutex_unlock (&handleDatabase->mutex); +- return (SA_AIS_ERR_NO_MEMORY); ++ return (CS_ERR_NO_MEMORY); + } + handleDatabase->handles = newHandles; + } +@@ -575,7 +575,7 @@ + if (instance == 0) { + free (newHandles); + pthread_mutex_unlock (&handleDatabase->mutex); +- return (SA_AIS_ERR_NO_MEMORY); ++ return (CS_ERR_NO_MEMORY); + } + + +@@ -601,20 +601,20 @@ + + handleDatabase->handles[handle].check = check; + +- *handleOut = (SaUint64T)((uint64_t)check << 32 | handle); ++ *handleOut = (uint64_t)((uint64_t)check << 32 | handle); + + pthread_mutex_unlock (&handleDatabase->mutex); + +- return (SA_AIS_OK); ++ return (CS_OK); + } + + +-SaAisErrorT ++cs_error_t + saHandleDestroy ( + struct saHandleDatabase *handleDatabase, +- SaUint64T inHandle) ++ uint64_t inHandle) + { +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + uint32_t check = inHandle >> 32; + uint32_t handle = inHandle & 0xffffffff; + +@@ -622,7 +622,7 @@ + + if (check != handleDatabase->handles[handle].check) { + pthread_mutex_unlock (&handleDatabase->mutex); +- error = SA_AIS_ERR_BAD_HANDLE; ++ error = CS_ERR_BAD_HANDLE; + return (error); + } + +@@ -630,34 +630,34 @@ + + pthread_mutex_unlock (&handleDatabase->mutex); + +- saHandleInstancePut (handleDatabase, inHandle); ++ (void)saHandleInstancePut (handleDatabase, inHandle); + + return (error); + } + + +-SaAisErrorT ++cs_error_t + saHandleInstanceGet ( + struct saHandleDatabase *handleDatabase, +- SaUint64T inHandle, ++ uint64_t inHandle, + void **instance) + { + uint32_t check = inHandle >> 32; + uint32_t handle = inHandle & 0xffffffff; + +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + pthread_mutex_lock (&handleDatabase->mutex); + +- if (handle >= (SaUint64T)handleDatabase->handleCount) { +- error = SA_AIS_ERR_BAD_HANDLE; ++ if (handle >= (uint64_t)handleDatabase->handleCount) { ++ error = CS_ERR_BAD_HANDLE; + goto error_exit; + } + if (handleDatabase->handles[handle].state != SA_HANDLE_STATE_ACTIVE) { +- error = SA_AIS_ERR_BAD_HANDLE; ++ error = CS_ERR_BAD_HANDLE; + goto error_exit; + } + if (check != handleDatabase->handles[handle].check) { +- error = SA_AIS_ERR_BAD_HANDLE; ++ error = CS_ERR_BAD_HANDLE; + goto error_exit; + } + +@@ -673,20 +673,20 @@ + } + + +-SaAisErrorT ++cs_error_t + saHandleInstancePut ( + struct saHandleDatabase *handleDatabase, +- SaUint64T inHandle) ++ uint64_t inHandle) + { + void *instance; +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + uint32_t check = inHandle >> 32; + uint32_t handle = inHandle & 0xffffffff; + + pthread_mutex_lock (&handleDatabase->mutex); + + if (check != handleDatabase->handles[handle].check) { +- error = SA_AIS_ERR_BAD_HANDLE; ++ error = CS_ERR_BAD_HANDLE; + goto error_exit; + } + +@@ -707,16 +707,16 @@ + } + + +-SaAisErrorT ++cs_error_t + saVersionVerify ( + struct saVersionDatabase *versionDatabase, +- SaVersionT *version) ++ cs_version_t *version) + { + int i; +- SaAisErrorT error = SA_AIS_ERR_VERSION; ++ cs_error_t error = CS_ERR_VERSION; + + if (version == 0) { +- return (SA_AIS_ERR_INVALID_PARAM); ++ return (CS_ERR_INVALID_PARAM); + } + + /* +@@ -742,7 +742,7 @@ + * Check if we can support the major version requested. + */ + if (versionDatabase->versionsSupported[i].majorVersion >= version->majorVersion) { +- error = SA_AIS_OK; ++ error = CS_OK; + break; + } + +@@ -771,17 +771,17 @@ + /* + * Get the time of day and convert to nanoseconds + */ +-SaTimeT clustTimeNow(void) ++cs_time_t clustTimeNow(void) + { + struct timeval tv; +- SaTimeT time_now; ++ cs_time_t time_now; + + if (gettimeofday(&tv, 0)) { + return 0ULL; + } + +- time_now = (SaTimeT)(tv.tv_sec) * 1000000000ULL; +- time_now += (SaTimeT)(tv.tv_usec) * 1000ULL; ++ time_now = (cs_time_t)(tv.tv_sec) * 1000000000ULL; ++ time_now += (cs_time_t)(tv.tv_usec) * 1000ULL; + + return time_now; + } +diff -Naurd corosync-0.92/lib/util.h corosync-trunk/lib/util.h +--- corosync-0.92/lib/util.h 2008-05-12 15:48:06.000000000 +0200 ++++ corosync-trunk/lib/util.h 2008-11-06 22:49:07.000000000 +0100 +@@ -72,72 +72,72 @@ + SaVersionT *versionsSupported; + }; + +-SaAisErrorT ++cs_error_t + saServiceConnect ( + int *responseOut, + int *callbackOut, + enum service_types service); + +-SaAisErrorT ++cs_error_t + saRecvRetry ( + int s, + void *msg, + size_t len); + +-SaAisErrorT ++cs_error_t + saSendRetry ( + int s, + const void *msg, + size_t len); + +-SaAisErrorT saSendMsgRetry ( ++cs_error_t saSendMsgRetry ( + int s, + struct iovec *iov, + int iov_len); + +-SaAisErrorT saSendMsgReceiveReply ( ++cs_error_t saSendMsgReceiveReply ( + int s, + struct iovec *iov, + int iov_len, + void *responseMessage, + int responseLen); + +-SaAisErrorT saSendReceiveReply ( ++cs_error_t saSendReceiveReply ( + int s, + void *requestMessage, + int requestLen, + void *responseMessage, + int responseLen); + +-SaAisErrorT ++cs_error_t + saPollRetry ( + struct pollfd *ufds, + unsigned int nfds, + int timeout); + +-SaAisErrorT ++cs_error_t + saHandleCreate ( + struct saHandleDatabase *handleDatabase, + int instanceSize, + SaUint64T *handleOut); + +-SaAisErrorT ++cs_error_t + saHandleDestroy ( + struct saHandleDatabase *handleDatabase, + SaUint64T handle); + +-SaAisErrorT ++cs_error_t + saHandleInstanceGet ( + struct saHandleDatabase *handleDatabase, + SaUint64T handle, + void **instance); + +-SaAisErrorT ++cs_error_t + saHandleInstancePut ( + struct saHandleDatabase *handleDatabase, + SaUint64T handle); + +-SaAisErrorT ++cs_error_t + saVersionVerify ( + struct saVersionDatabase *versionDatabase, + SaVersionT *version); +diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile +--- corosync-0.92/Makefile 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/Makefile 2008-11-06 22:49:07.000000000 +0100 +@@ -115,10 +115,17 @@ + (cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean)); + rm -rf $(builddir)doc/api + ++lint: ++ (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,lint)); ++ (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,lint)); ++ (cd $(builddir)lcr; echo ==== `pwd` ===; $(call sub_make,lcr,lint)); ++ (cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,lint)); ++ (cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,lint)); ++ + COROSYNC_LIBS = evs cpg cfg coroutil confdb + + COROSYNC_HEADERS = cpg.h cfg.h evs.h ipc_gen.h mar_gen.h swab.h \ +- ais_util.h confdb.h list.h saAis.h ++ ais_util.h confdb.h list.h corotypes.h + + EXEC_LIBS = totem_pg logsys + +diff -Naurd corosync-0.92/Makefile.inc corosync-trunk/Makefile.inc +--- corosync-0.92/Makefile.inc 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/Makefile.inc 2008-12-09 14:48:47.000000000 +0100 +@@ -38,16 +38,15 @@ + # COROSYNC_BUILD can be defined as RELEASE or DEBUG + # + ifndef COROSYNC_BUILD +- COROSYNC_BUILD=DEBUG ++ COROSYNC_BUILD=RELEASE + endif + +-# COROSYNC_PROFILE +- + # default CFLAGS, LDFLAGS + # + CFLAGS = + LDFLAGS = + DYFLAGS = ++LINT_FLAGS = -weak -unrecog +posixlib +ignoresigns -fcnuse -badflag -D__gnuc_va_list=va_list -D__attribute\(x\)= + + override CFLAGS += -DLCRSODIR='"$(LCRSODIR)"' + +@@ -58,35 +57,26 @@ + # build CFLAGS, LDFLAGS + # + ifeq (${COROSYNC_BUILD}, RELEASE) +- CFLAGS += -O3 -Wall +-# -Wstrict-aliasing=2 TODO sameday fix all of these +-ifndef COROSYNC_PROFILE +- CFLAGS += -fomit-frame-pointer +-endif +- LDFLAGS += ++ override CFLAGS += -O3 -Wall ++ override LDFLAGS += + endif + ifeq (${COROSYNC_BUILD}, DEBUG) +- CFLAGS += -O0 -g -Wall -DDEBUG --time +- LDFLAGS += -g ++ override CFLAGS += -O0 -g -Wall ++ override LDFLAGS += -g + ifeq (${COROSYNC_COMPAT}, SOLARIS) + CFLAGS += -Werror -DTS_CLASS + endif + endif + ifeq (${COROSYNC_BUILD}, COVERAGE) +- CFLAGS += -O0 -g -ftest-coverage -fprofile-arcs +- LDFLAGS += -g -ftest-coverage -fprofile-arcs ++ override CFLAGS += -O0 -g -ftest-coverage -fprofile-arcs ++ override LDFLAGS += -g -ftest-coverage -fprofile-arcs + BUILD_DYNAMIC=0 + endif + +-ifdef COROSYNC_PROFILE +- CFLAGS += -pg +- LDFLAGS += -pg +-endif +- + # platform specific CFLAGS, LDFLAGS + # + ifeq (${COROSYNC_COMPAT}, LINUX) +- override CFLAGS += -DCOROSYNC_LINUX ++ override CFLAGS += -DCOROSYNC_LINUX -D_XOPEN_SOURCE=600 -D_GNU_SOURCE + override LDFLAGS += -ldl -lpthread + override DYFLAGS += -rdynamic + endif +diff -Naurd corosync-0.92/man/corosync.conf.5 corosync-trunk/man/corosync.conf.5 +--- corosync-0.92/man/corosync.conf.5 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/man/corosync.conf.5 2008-10-21 00:05:51.000000000 +0200 +@@ -435,20 +435,6 @@ + No default. + + .TP +-debug +-This specifies whether debug output is logged for all services. This is +-generally a bad idea, unless there is some specific bug or problem that must be +-found in the executive. Set the value to +-.B on +-to debug, +-.B off +-to turn off debugging. If enabled, individual loggers can be disabled using a +-.B logger_subsys +-directive. +- +-The default is off. +- +-.TP + timestamp + This specifies that a timestamp is placed on all log messages. + +diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c +--- corosync-0.92/services/cfg.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/services/cfg.c 2008-11-06 22:49:07.000000000 +0100 +@@ -7,7 +7,7 @@ + * Author: 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: + * +@@ -46,7 +46,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +@@ -60,7 +60,31 @@ + LOGSYS_DECLARE_SUBSYS ("CFG", LOG_INFO); + + enum cfg_message_req_types { +- MESSAGE_REQ_EXEC_CFG_RINGREENABLE = 0 ++ MESSAGE_REQ_EXEC_CFG_RINGREENABLE = 0, ++ MESSAGE_REQ_EXEC_CFG_KILLNODE = 1, ++ MESSAGE_REQ_EXEC_CFG_SHUTDOWN = 2 ++}; ++ ++#define DEFAULT_SHUTDOWN_TIMEOUT 5 ++ ++static struct list_head trackers_list; ++ ++/* ++ * Variables controlling a requested shutdown ++ */ ++static corosync_timer_handle_t shutdown_timer; ++static struct cfg_info *shutdown_con; ++static uint32_t shutdown_flags; ++static int shutdown_yes; ++static int shutdown_no; ++static int shutdown_expected; ++ ++struct cfg_info ++{ ++ struct list_head list; ++ void *conn; ++ void *tracker_conn; ++ enum {SHUTDOWN_REPLY_UNKNOWN, SHUTDOWN_REPLY_YES, SHUTDOWN_REPLY_NO} shutdown_reply; + }; + + static void cfg_confchg_fn ( +@@ -82,6 +106,16 @@ + void *message, + unsigned int nodeid); + ++static void message_handler_req_exec_cfg_killnode ( ++ void *message, ++ unsigned int nodeid); ++ ++static void message_handler_req_exec_cfg_shutdown ( ++ void *message, ++ unsigned int nodeid); ++ ++static void exec_cfg_killnode_endian_convert (void *msg); ++ + static void message_handler_req_lib_cfg_ringstatusget ( + void *conn, + void *msg); +@@ -114,6 +148,18 @@ + void *conn, + void *msg); + ++static void message_handler_req_lib_cfg_killnode ( ++ void *conn, ++ void *msg); ++ ++static void message_handler_req_lib_cfg_tryshutdown ( ++ void *conn, ++ void *msg); ++ ++static void message_handler_req_lib_cfg_replytoshutdown ( ++ void *conn, ++ void *msg); ++ + /* + * Service Handler Definition + */ +@@ -123,56 +169,81 @@ + .lib_handler_fn = message_handler_req_lib_cfg_ringstatusget, + .response_size = sizeof (struct res_lib_cfg_ringstatusget), + .response_id = MESSAGE_RES_CFG_RINGSTATUSGET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 1 */ + .lib_handler_fn = message_handler_req_lib_cfg_ringreenable, + .response_size = sizeof (struct res_lib_cfg_ringreenable), + .response_id = MESSAGE_RES_CFG_RINGREENABLE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 2 */ + .lib_handler_fn = message_handler_req_lib_cfg_statetrack, + .response_size = sizeof (struct res_lib_cfg_statetrack), + .response_id = MESSAGE_RES_CFG_STATETRACKSTART, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 3 */ + .lib_handler_fn = message_handler_req_lib_cfg_statetrackstop, + .response_size = sizeof (struct res_lib_cfg_statetrackstop), + .response_id = MESSAGE_RES_CFG_STATETRACKSTOP, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 4 */ + .lib_handler_fn = message_handler_req_lib_cfg_administrativestateset, + .response_size = sizeof (struct res_lib_cfg_administrativestateset), + .response_id = MESSAGE_RES_CFG_ADMINISTRATIVESTATESET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 5 */ + .lib_handler_fn = message_handler_req_lib_cfg_administrativestateget, + .response_size = sizeof (struct res_lib_cfg_administrativestateget), + .response_id = MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 6 */ + .lib_handler_fn = message_handler_req_lib_cfg_serviceload, + .response_size = sizeof (struct res_lib_cfg_serviceload), + .response_id = MESSAGE_RES_CFG_SERVICELOAD, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 7 */ + .lib_handler_fn = message_handler_req_lib_cfg_serviceunload, + .response_size = sizeof (struct res_lib_cfg_serviceunload), + .response_id = MESSAGE_RES_CFG_SERVICEUNLOAD, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 8 */ ++ .lib_handler_fn = message_handler_req_lib_cfg_killnode, ++ .response_size = sizeof (struct res_lib_cfg_killnode), ++ .response_id = MESSAGE_RES_CFG_KILLNODE, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 9 */ ++ .lib_handler_fn = message_handler_req_lib_cfg_tryshutdown, ++ .response_size = sizeof (struct res_lib_cfg_tryshutdown), ++ .response_id = MESSAGE_RES_CFG_TRYSHUTDOWN, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 10 */ ++ .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown, ++ .response_size = 0, ++ .response_id = 0, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + } + }; + + static struct corosync_exec_handler cfg_exec_engine[] = + { +- { +- message_handler_req_exec_cfg_ringreenable ++ { /* 0 */ ++ .exec_handler_fn = message_handler_req_exec_cfg_ringreenable, ++ }, ++ { /* 1 */ ++ .exec_handler_fn = message_handler_req_exec_cfg_killnode, ++ .exec_endian_convert_fn = exec_cfg_killnode_endian_convert ++ }, ++ { /* 2 */ ++ .exec_handler_fn = message_handler_req_exec_cfg_shutdown, + } + }; + +@@ -182,8 +253,9 @@ + struct corosync_service_engine cfg_service_engine = { + .name = "corosync configuration service", + .id = CFG_SERVICE, +- .private_data_size = 0, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED, ++ .private_data_size = sizeof(struct cfg_info), ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED, ++ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, + .lib_init_fn = cfg_lib_init_fn, + .lib_exit_fn = cfg_lib_exit_fn, + .lib_engine = cfg_lib_engine, +@@ -238,12 +310,24 @@ + mar_message_source_t source __attribute__((aligned(8))); + }; + ++struct req_exec_cfg_killnode { ++ mar_req_header_t header __attribute__((aligned(8))); ++ mar_uint32_t nodeid __attribute__((aligned(8))); ++ mar_name_t reason __attribute__((aligned(8))); ++}; ++ ++struct req_exec_cfg_shutdown { ++ mar_req_header_t header __attribute__((aligned(8))); ++}; ++ + /* IMPL */ + + static int cfg_exec_init_fn ( + struct corosync_api_v1 *corosync_api_v1) + { + api = corosync_api_v1; ++ ++ list_init(&trackers_list); + return (0); + } + +@@ -256,16 +340,193 @@ + { + } + ++/* ++ * Tell other nodes we are shutting down ++ */ ++static int send_shutdown() ++{ ++ struct req_exec_cfg_shutdown req_exec_cfg_shutdown; ++ struct iovec iovec; ++ ++ ENTER(); ++ req_exec_cfg_shutdown.header.size = ++ sizeof (struct req_exec_cfg_shutdown); ++ req_exec_cfg_shutdown.header.id = SERVICE_ID_MAKE (CFG_SERVICE, ++ MESSAGE_REQ_EXEC_CFG_SHUTDOWN); ++ ++ iovec.iov_base = (char *)&req_exec_cfg_shutdown; ++ iovec.iov_len = sizeof (struct req_exec_cfg_shutdown); ++ ++ assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0); ++ ++ LEAVE(); ++ return 0; ++} ++ ++static void send_test_shutdown(void * conn, int status) ++{ ++ struct res_lib_cfg_testshutdown res_lib_cfg_testshutdown; ++ struct list_head *iter; ++ ++ ENTER(); ++ res_lib_cfg_testshutdown.header.size = sizeof(struct res_lib_cfg_testshutdown); ++ res_lib_cfg_testshutdown.header.id = MESSAGE_RES_CFG_TESTSHUTDOWN; ++ res_lib_cfg_testshutdown.header.error = status; ++ res_lib_cfg_testshutdown.flags = shutdown_flags; ++ ++ if (conn) { ++ TRACE1("sending testshutdown to %p", conn); ++ api->ipc_conn_send_response(conn, &res_lib_cfg_testshutdown, ++ sizeof(res_lib_cfg_testshutdown)); ++ } else { ++ for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { ++ struct cfg_info *ci = list_entry(iter, struct cfg_info, list); ++ ++ TRACE1("sending testshutdown to %p", ci->tracker_conn); ++ api->ipc_conn_send_response(ci->tracker_conn, &res_lib_cfg_testshutdown, ++ sizeof(res_lib_cfg_testshutdown)); ++ } ++ } ++ LEAVE(); ++} ++ ++static void check_shutdown_status() ++{ ++ ENTER(); ++ ++ /* ++ * Shutdown client might have gone away ++ */ ++ if (!shutdown_con) { ++ LEAVE(); ++ return; ++ } ++ ++ /* ++ * All replies safely gathered in ? ++ */ ++ if (shutdown_yes + shutdown_no >= shutdown_expected) { ++ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; ++ ++ api->timer_delete(shutdown_timer); ++ ++ if (shutdown_yes >= shutdown_expected || ++ shutdown_flags == CFG_SHUTDOWN_FLAG_REGARDLESS) { ++ TRACE1("shutdown confirmed"); ++ ++ /* ++ * Tell other nodes we are going down ++ */ ++ send_shutdown(); ++ ++ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); ++ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; ++ res_lib_cfg_tryshutdown.header.error = CS_OK; ++ ++ /* ++ * Tell originator that shutdown was confirmed ++ */ ++ api->ipc_conn_send_response(shutdown_con->conn, &res_lib_cfg_tryshutdown, ++ sizeof(res_lib_cfg_tryshutdown)); ++ shutdown_con = NULL; ++ } ++ else { ++ ++ TRACE1("shutdown cancelled"); ++ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); ++ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; ++ res_lib_cfg_tryshutdown.header.error = CS_ERR_BUSY; ++ ++ /* ++ * Tell originator that shutdown was cancelled ++ */ ++ api->ipc_conn_send_response(shutdown_con->conn, &res_lib_cfg_tryshutdown, ++ sizeof(res_lib_cfg_tryshutdown)); ++ shutdown_con = NULL; ++ } ++ ++ log_printf(LOG_DEBUG, "shutdown decision is: (yes count: %d, no count: %d) flags=%x\n", shutdown_yes, shutdown_no, shutdown_flags); ++ } ++ LEAVE(); ++} ++ ++ ++/* ++ * Not all nodes responded to the shutdown (in time) ++ */ ++static void shutdown_timer_fn(void *arg) ++{ ++ ENTER(); ++ ++ /* ++ * Mark undecideds as "NO" ++ */ ++ shutdown_no = shutdown_expected; ++ check_shutdown_status(); ++ ++ send_test_shutdown(NULL, CS_ERR_TIMEOUT); ++ LEAVE(); ++} ++ ++static void remove_ci_from_shutdown(struct cfg_info *ci) ++{ ++ ENTER(); ++ ++ /* ++ * If the controlling shutdown process has quit, then cancel the ++ * shutdown session ++ */ ++ if (ci == shutdown_con) { ++ shutdown_con = NULL; ++ api->timer_delete(shutdown_timer); ++ } ++ ++ if (!list_empty(&ci->list)) { ++ list_del(&ci->list); ++ list_init(&ci->list); ++ ++ /* ++ * Remove our option ++ */ ++ if (shutdown_con) { ++ if (ci->shutdown_reply == SHUTDOWN_REPLY_YES) ++ shutdown_yes--; ++ if (ci->shutdown_reply == SHUTDOWN_REPLY_NO) ++ shutdown_no--; ++ } ++ ++ /* ++ * If we are leaving, then that's an implicit YES to shutdown ++ */ ++ ci->shutdown_reply = SHUTDOWN_REPLY_YES; ++ shutdown_yes++; ++ ++ check_shutdown_status(); ++ } ++ LEAVE(); ++} ++ ++ + int cfg_lib_exit_fn (void *conn) + { ++ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); ++ ++ ENTER(); ++ if (!list_empty(&ci->list)) { ++ list_del(&ci->list); ++ remove_ci_from_shutdown(ci); ++ } ++ LEAVE(); + return (0); + } + + static int cfg_lib_init_fn (void *conn) + { +- +- ENTER(""); +- LEAVE(""); ++ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); ++ ++ ENTER(); ++ list_init(&ci->list); ++ LEAVE(); + + return (0); + } +@@ -281,18 +542,64 @@ + (struct req_exec_cfg_ringreenable *)message; + struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; + +- ENTER(""); ++ ENTER(); + api->totem_ring_reenable (); + if (api->ipc_source_is_local(&req_exec_cfg_ringreenable->source)) { + res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE; + res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable); +- res_lib_cfg_ringreenable.header.error = SA_AIS_OK; ++ res_lib_cfg_ringreenable.header.error = CS_OK; + api->ipc_conn_send_response ( + req_exec_cfg_ringreenable->source.conn, + &res_lib_cfg_ringreenable, + sizeof (struct res_lib_cfg_ringreenable)); + } +- LEAVE(""); ++ LEAVE(); ++} ++ ++static void exec_cfg_killnode_endian_convert (void *msg) ++{ ++ struct req_exec_cfg_killnode *req_exec_cfg_killnode = ++ (struct req_exec_cfg_killnode *)msg; ++ ENTER(); ++ ++ swab_mar_name_t(&req_exec_cfg_killnode->reason); ++ LEAVE(); ++} ++ ++ ++static void message_handler_req_exec_cfg_killnode ( ++ void *message, ++ unsigned int nodeid) ++{ ++ struct req_exec_cfg_killnode *req_exec_cfg_killnode = ++ (struct req_exec_cfg_killnode *)message; ++ cs_name_t reason; ++ ++ ENTER(); ++ log_printf(LOG_DEBUG, "request to kill node %d(us=%d): %s\n", req_exec_cfg_killnode->nodeid, api->totem_nodeid_get(), reason.value); ++ if (req_exec_cfg_killnode->nodeid == api->totem_nodeid_get()) { ++ marshall_from_mar_name_t(&reason, &req_exec_cfg_killnode->reason); ++ log_printf(LOG_NOTICE, "Killed by node %d: %s\n", ++ nodeid, reason.value); ++ corosync_fatal_error(COROSYNC_FATAL_ERROR_EXIT); ++ } ++ LEAVE(); ++} ++ ++/* ++ * Self shutdown ++ */ ++static void message_handler_req_exec_cfg_shutdown ( ++ void *message, ++ unsigned int nodeid) ++{ ++ ENTER(); ++ ++ log_printf(LOG_NOTICE, "Node %d was shut down by sysadmin\n", nodeid); ++ if (nodeid == api->totem_nodeid_get()) { ++ corosync_fatal_error(COROSYNC_FATAL_ERROR_EXIT); ++ } ++ LEAVE(); + } + + +@@ -310,11 +617,11 @@ + char *totem_ip_string; + unsigned int i; + +- ENTER(""); ++ ENTER(); + + res_lib_cfg_ringstatusget.header.id = MESSAGE_RES_CFG_RINGSTATUSGET; + res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget); +- res_lib_cfg_ringstatusget.header.error = SA_AIS_OK; ++ res_lib_cfg_ringstatusget.header.error = CS_OK; + + api->totem_ifaces_get ( + api->totem_nodeid_get(), +@@ -336,7 +643,7 @@ + &res_lib_cfg_ringstatusget, + sizeof (struct res_lib_cfg_ringstatusget)); + +- LEAVE(""); ++ LEAVE(); + } + + static void message_handler_req_lib_cfg_ringreenable ( +@@ -346,7 +653,7 @@ + struct req_exec_cfg_ringreenable req_exec_cfg_ringreenable; + struct iovec iovec; + +- ENTER(""); ++ ENTER(); + req_exec_cfg_ringreenable.header.size = + sizeof (struct req_exec_cfg_ringreenable); + req_exec_cfg_ringreenable.header.id = SERVICE_ID_MAKE (CFG_SERVICE, +@@ -358,27 +665,56 @@ + + assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0); + +- LEAVE(""); ++ LEAVE(); + } + + static void message_handler_req_lib_cfg_statetrack ( + void *conn, + void *msg) + { ++ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); + // struct req_lib_cfg_statetrack *req_lib_cfg_statetrack = (struct req_lib_cfg_statetrack *)message; ++ struct res_lib_cfg_statetrack res_lib_cfg_statetrack; + +- ENTER(""); +- LEAVE(""); ++ ENTER(); ++ ++ /* ++ * We only do shutdown tracking at the moment ++ */ ++ if (list_empty(&ci->list)) { ++ list_add(&ci->list, &trackers_list); ++ ci->tracker_conn = api->ipc_conn_partner_get (conn); ++ ++ if (shutdown_con) { ++ /* ++ * Shutdown already in progress, ask the newcomer's opinion ++ */ ++ ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; ++ shutdown_expected++; ++ send_test_shutdown(ci->tracker_conn, CS_OK); ++ } ++ } ++ ++ res_lib_cfg_statetrack.header.size = sizeof(struct res_lib_cfg_statetrack); ++ res_lib_cfg_statetrack.header.id = MESSAGE_RES_CFG_STATETRACKSTART; ++ res_lib_cfg_statetrack.header.error = CS_OK; ++ ++ api->ipc_conn_send_response(conn, &res_lib_cfg_statetrack, ++ sizeof(res_lib_cfg_statetrack)); ++ ++ LEAVE(); + } + + static void message_handler_req_lib_cfg_statetrackstop ( + void *conn, + void *msg) + { ++ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); + // struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message; + +- ENTER(""); +- LEAVE(""); ++ ENTER(); ++ remove_ci_from_shutdown(ci); ++ LEAVE(); + } + + static void message_handler_req_lib_cfg_administrativestateset ( +@@ -386,16 +722,17 @@ + void *msg) + { + // struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message; +- ENTER(""); +- LEAVE(""); ++ ++ ENTER(); ++ LEAVE(); + } + static void message_handler_req_lib_cfg_administrativestateget ( + void *conn, + void *msg) + { + // struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message; +- ENTER(""); +- LEAVE(""); ++ ENTER(); ++ LEAVE(); + } + + static void message_handler_req_lib_cfg_serviceload ( +@@ -406,7 +743,7 @@ + (struct req_lib_cfg_serviceload *)msg; + struct res_lib_cfg_serviceload res_lib_cfg_serviceload; + +- ENTER(""); ++ ENTER(); + api->service_link_and_init ( + api, + (char *)req_lib_cfg_serviceload->service_name, +@@ -414,12 +751,12 @@ + + res_lib_cfg_serviceload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD; + res_lib_cfg_serviceload.header.size = sizeof (struct res_lib_cfg_serviceload); +- res_lib_cfg_serviceload.header.error = SA_AIS_OK; ++ res_lib_cfg_serviceload.header.error = CS_OK; + api->ipc_conn_send_response ( + conn, + &res_lib_cfg_serviceload, + sizeof (struct res_lib_cfg_serviceload)); +- LEAVE(""); ++ LEAVE(); + } + + static void message_handler_req_lib_cfg_serviceunload ( +@@ -430,17 +767,193 @@ + (struct req_lib_cfg_serviceunload *)msg; + struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload; + +- ENTER(""); ++ ENTER(); + api->service_unlink_and_exit ( + api, + (char *)req_lib_cfg_serviceunload->service_name, + req_lib_cfg_serviceunload->service_ver); + res_lib_cfg_serviceunload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD; + res_lib_cfg_serviceunload.header.size = sizeof (struct res_lib_cfg_serviceunload); +- res_lib_cfg_serviceunload.header.error = SA_AIS_OK; ++ res_lib_cfg_serviceunload.header.error = CS_OK; + api->ipc_conn_send_response ( + conn, + &res_lib_cfg_serviceunload, + sizeof (struct res_lib_cfg_serviceunload)); +- LEAVE(""); ++ LEAVE(); ++} ++ ++ ++static void message_handler_req_lib_cfg_killnode ( ++ void *conn, ++ void *msg) ++{ ++ struct req_lib_cfg_killnode *req_lib_cfg_killnode = (struct req_lib_cfg_killnode *)msg; ++ struct res_lib_cfg_killnode res_lib_cfg_killnode; ++ struct req_exec_cfg_killnode req_exec_cfg_killnode; ++ struct iovec iovec; ++ int res; ++ ++ ENTER(); ++ req_exec_cfg_killnode.header.size = ++ sizeof (struct req_exec_cfg_killnode); ++ req_exec_cfg_killnode.header.id = SERVICE_ID_MAKE (CFG_SERVICE, ++ MESSAGE_REQ_EXEC_CFG_KILLNODE); ++ req_exec_cfg_killnode.nodeid = req_lib_cfg_killnode->nodeid; ++ marshall_to_mar_name_t(&req_exec_cfg_killnode.reason, &req_lib_cfg_killnode->reason); ++ ++ iovec.iov_base = (char *)&req_exec_cfg_killnode; ++ iovec.iov_len = sizeof (struct req_exec_cfg_killnode); ++ ++ res = api->totem_mcast (&iovec, 1, TOTEM_SAFE); ++ ++ res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode); ++ res_lib_cfg_killnode.header.id = MESSAGE_RES_CFG_KILLNODE; ++ res_lib_cfg_killnode.header.error = CS_OK; ++ ++ api->ipc_conn_send_response(conn, &res_lib_cfg_killnode, ++ sizeof(res_lib_cfg_killnode)); ++ ++ LEAVE(); ++} ++ ++ ++static void message_handler_req_lib_cfg_tryshutdown ( ++ void *conn, ++ void *msg) ++{ ++ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); ++ struct req_lib_cfg_tryshutdown *req_lib_cfg_tryshutdown = (struct req_lib_cfg_tryshutdown *)msg; ++ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; ++ struct list_head *iter; ++ ++ ENTER(); ++ ++ if (req_lib_cfg_tryshutdown->flags == CFG_SHUTDOWN_FLAG_IMMEDIATE) { ++ ++ /* ++ * Tell other nodes ++ */ ++ send_shutdown(); ++ ++ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); ++ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; ++ res_lib_cfg_tryshutdown.header.error = CS_OK; ++ api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown, ++ sizeof(res_lib_cfg_tryshutdown)); ++ ++ LEAVE(); ++ return; ++ } ++ ++ /* ++ * Shutdown in progress, return an error ++ */ ++ if (shutdown_con) { ++ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; ++ ++ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); ++ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; ++ res_lib_cfg_tryshutdown.header.error = CS_ERR_EXIST; ++ ++ api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown, ++ sizeof(res_lib_cfg_tryshutdown)); ++ ++ ++ LEAVE(); ++ ++ return; ++ } ++ ++ ci->conn = conn; ++ shutdown_con = (struct cfg_info *)api->ipc_private_data_get (conn); ++ shutdown_flags = req_lib_cfg_tryshutdown->flags; ++ shutdown_yes = 0; ++ shutdown_no = 0; ++ ++ /* ++ * Count the number of listeners ++ */ ++ shutdown_expected = 0; ++ ++ for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { ++ struct cfg_info *ci = list_entry(iter, struct cfg_info, list); ++ ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; ++ shutdown_expected++; ++ } ++ ++ /* ++ * If no-one is listening for events then we can just go down now ++ */ ++ if (shutdown_expected == 0) { ++ send_shutdown(); ++ LEAVE(); ++ return; ++ } ++ else { ++ unsigned int cfg_handle; ++ unsigned int find_handle; ++ char *timeout_str; ++ unsigned int shutdown_timeout = DEFAULT_SHUTDOWN_TIMEOUT; ++ ++ /* ++ * Look for a shutdown timeout in objdb ++ */ ++ api->object_find_create(OBJECT_PARENT_HANDLE, "cfg", strlen("cfg"), &find_handle); ++ api->object_find_next(find_handle, &cfg_handle); ++ api->object_find_destroy(find_handle); ++ ++ if (cfg_handle) { ++ if ( !api->object_key_get(cfg_handle, ++ "shutdown_timeout", ++ strlen("shutdown_timeout"), ++ (void *)&timeout_str, ++ NULL)) { ++ shutdown_timeout = atoi(timeout_str); ++ } ++ } ++ ++ /* ++ * Start the timer. If we don't get a full set of replies before this goes ++ * off we'll cancel the shutdown ++ */ ++ api->timer_add_duration((unsigned long long)shutdown_timeout*1000000000, NULL, ++ shutdown_timer_fn, &shutdown_timer); ++ ++ /* ++ * Tell the users we would like to shut down ++ */ ++ send_test_shutdown(NULL, CS_OK); ++ } ++ ++ /* ++ * We don't sent a reply to the caller here. ++ * We send it when we know if we can shut down or not ++ */ ++ ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_cfg_replytoshutdown ( ++ void *conn, ++ void *msg) ++{ ++ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); ++ struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = (struct req_lib_cfg_replytoshutdown *)msg; ++ ++ ENTER(); ++ if (!shutdown_con) { ++ LEAVE(); ++ return; ++ } ++ ++ if (req_lib_cfg_replytoshutdown->response) { ++ shutdown_yes++; ++ ci->shutdown_reply = SHUTDOWN_REPLY_YES; ++ } ++ else { ++ shutdown_no++; ++ ci->shutdown_reply = SHUTDOWN_REPLY_NO; ++ } ++ check_shutdown_status(); ++ LEAVE(); + } +diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c +--- corosync-0.92/services/confdb.c 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/services/confdb.c 2008-12-08 16:55:41.000000000 +0100 +@@ -38,7 +38,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +@@ -106,103 +106,103 @@ + .lib_handler_fn = message_handler_req_lib_confdb_object_create, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_OBJECT_CREATE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 1 */ + .lib_handler_fn = message_handler_req_lib_confdb_object_destroy, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_OBJECT_DESTROY, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 2 */ + .lib_handler_fn = message_handler_req_lib_confdb_object_find, + .response_size = sizeof (struct res_lib_confdb_object_find), + .response_id = MESSAGE_RES_CONFDB_OBJECT_FIND, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 3 */ + .lib_handler_fn = message_handler_req_lib_confdb_key_create, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_KEY_CREATE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 4 */ + .lib_handler_fn = message_handler_req_lib_confdb_key_get, + .response_size = sizeof (struct res_lib_confdb_key_get), + .response_id = MESSAGE_RES_CONFDB_KEY_GET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 5 */ + .lib_handler_fn = message_handler_req_lib_confdb_key_replace, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_KEY_REPLACE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 6 */ + .lib_handler_fn = message_handler_req_lib_confdb_key_delete, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_KEY_DELETE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 7 */ + .lib_handler_fn = message_handler_req_lib_confdb_object_iter, + .response_size = sizeof (struct res_lib_confdb_object_iter), + .response_id = MESSAGE_RES_CONFDB_OBJECT_ITER, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 8 */ + .lib_handler_fn = message_handler_req_lib_confdb_object_parent_get, + .response_size = sizeof (struct res_lib_confdb_object_parent_get), + .response_id = MESSAGE_RES_CONFDB_OBJECT_PARENT_GET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 9 */ + .lib_handler_fn = message_handler_req_lib_confdb_key_iter, + .response_size = sizeof (struct res_lib_confdb_key_iter), + .response_id = MESSAGE_RES_CONFDB_KEY_ITER, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 10 */ + .lib_handler_fn = message_handler_req_lib_confdb_track_start, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_TRACK_START, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 11 */ + .lib_handler_fn = message_handler_req_lib_confdb_track_stop, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_TRACK_STOP, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 12 */ + .lib_handler_fn = message_handler_req_lib_confdb_write, + .response_size = sizeof (struct res_lib_confdb_write), + .response_id = MESSAGE_RES_CONFDB_WRITE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 13 */ + .lib_handler_fn = message_handler_req_lib_confdb_reload, + .response_size = sizeof (struct res_lib_confdb_reload), + .response_id = MESSAGE_RES_CONFDB_RELOAD, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 14 */ + .lib_handler_fn = message_handler_req_lib_confdb_object_find_destroy, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CONFDB_OBJECT_FIND_DESTROY, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 15 */ + .lib_handler_fn = message_handler_req_lib_confdb_key_increment, + .response_size = sizeof (struct res_lib_confdb_key_incdec), + .response_id = MESSAGE_RES_CONFDB_KEY_INCREMENT, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 16 */ + .lib_handler_fn = message_handler_req_lib_confdb_key_decrement, + .response_size = sizeof (struct res_lib_confdb_key_incdec), + .response_id = MESSAGE_RES_CONFDB_KEY_DECREMENT, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + }; + +@@ -211,7 +211,8 @@ + .name = "corosync cluster config database access v1.01", + .id = CONFDB_SERVICE, + .private_data_size = 0, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED, ++ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, + .lib_init_fn = confdb_lib_init_fn, + .lib_exit_fn = confdb_lib_exit_fn, + .lib_engine = confdb_lib_engine, +@@ -279,6 +280,7 @@ + api->object_track_stop(confdb_notify_lib_of_key_change, + confdb_notify_lib_of_new_object, + confdb_notify_lib_of_destroyed_object, ++ NULL, + api->ipc_conn_partner_get (conn)); + return (0); + } +@@ -288,13 +290,13 @@ + struct req_lib_confdb_object_create *req_lib_confdb_object_create = (struct req_lib_confdb_object_create *)message; + struct res_lib_confdb_object_create res_lib_confdb_object_create; + unsigned int object_handle; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_create(req_lib_confdb_object_create->parent_object_handle, + &object_handle, + req_lib_confdb_object_create->object_name.value, + req_lib_confdb_object_create->object_name.length)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res_lib_confdb_object_create.object_handle = object_handle; + res_lib_confdb_object_create.header.size = sizeof(res_lib_confdb_object_create); +@@ -307,10 +309,10 @@ + { + struct req_lib_confdb_object_destroy *req_lib_confdb_object_destroy = (struct req_lib_confdb_object_destroy *)message; + mar_res_header_t res; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_destroy(req_lib_confdb_object_destroy->object_handle)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res.size = sizeof(res); + res.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY; +@@ -322,12 +324,12 @@ + { + struct req_lib_confdb_object_find_destroy *req_lib_confdb_object_find_destroy = (struct req_lib_confdb_object_find_destroy *)message; + mar_res_header_t res; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + log_printf(LOG_LEVEL_DEBUG, "object_find_destroy for conn=%p, %d\n", conn, req_lib_confdb_object_find_destroy->find_handle); + + if (api->object_find_destroy(req_lib_confdb_object_find_destroy->find_handle)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res.size = sizeof(res); + res.id = MESSAGE_RES_CONFDB_OBJECT_FIND_DESTROY; +@@ -340,14 +342,14 @@ + { + struct req_lib_confdb_key_create *req_lib_confdb_key_create = (struct req_lib_confdb_key_create *)message; + mar_res_header_t res; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_key_create(req_lib_confdb_key_create->object_handle, + req_lib_confdb_key_create->key_name.value, + req_lib_confdb_key_create->key_name.length, + req_lib_confdb_key_create->value.value, + req_lib_confdb_key_create->value.length)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res.size = sizeof(res); + res.id = MESSAGE_RES_CONFDB_KEY_CREATE; +@@ -361,14 +363,14 @@ + struct res_lib_confdb_key_get res_lib_confdb_key_get; + int value_len; + void *value; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_key_get(req_lib_confdb_key_get->parent_object_handle, + req_lib_confdb_key_get->key_name.value, + req_lib_confdb_key_get->key_name.length, + &value, + &value_len)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + else { + memcpy(res_lib_confdb_key_get.value.value, value, value_len); + res_lib_confdb_key_get.value.length = value_len; +@@ -384,15 +386,13 @@ + { + struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message; + struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; +- int value_len; +- void *value; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_key_increment(req_lib_confdb_key_get->parent_object_handle, + req_lib_confdb_key_get->key_name.value, + req_lib_confdb_key_get->key_name.length, + &res_lib_confdb_key_incdec.value)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec); + res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_INCREMENT; +@@ -404,15 +404,13 @@ + { + struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message; + struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; +- int value_len; +- void *value; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_key_decrement(req_lib_confdb_key_get->parent_object_handle, + req_lib_confdb_key_get->key_name.value, + req_lib_confdb_key_get->key_name.length, + &res_lib_confdb_key_incdec.value)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec); + res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_DECREMENT; +@@ -424,7 +422,7 @@ + { + struct req_lib_confdb_key_replace *req_lib_confdb_key_replace = (struct req_lib_confdb_key_replace *)message; + mar_res_header_t res; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_key_replace(req_lib_confdb_key_replace->object_handle, + req_lib_confdb_key_replace->key_name.value, +@@ -433,7 +431,7 @@ + req_lib_confdb_key_replace->old_value.length, + req_lib_confdb_key_replace->new_value.value, + req_lib_confdb_key_replace->new_value.length)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res.size = sizeof(res); + res.id = MESSAGE_RES_CONFDB_KEY_REPLACE; +@@ -445,14 +443,14 @@ + { + struct req_lib_confdb_key_delete *req_lib_confdb_key_delete = (struct req_lib_confdb_key_delete *)message; + mar_res_header_t res; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_key_delete(req_lib_confdb_key_delete->object_handle, + req_lib_confdb_key_delete->key_name.value, + req_lib_confdb_key_delete->key_name.length, + req_lib_confdb_key_delete->value.value, + req_lib_confdb_key_delete->value.length)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res.size = sizeof(res); + res.id = MESSAGE_RES_CONFDB_KEY_DELETE; +@@ -465,11 +463,11 @@ + struct req_lib_confdb_object_parent_get *req_lib_confdb_object_parent_get = (struct req_lib_confdb_object_parent_get *)message; + struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get; + unsigned int object_handle; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_parent_get(req_lib_confdb_object_parent_get->object_handle, + &object_handle)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res_lib_confdb_object_parent_get.parent_object_handle = object_handle; + res_lib_confdb_object_parent_get.header.size = sizeof(res_lib_confdb_object_parent_get); +@@ -487,7 +485,7 @@ + int key_name_len; + void *value; + int value_len; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (api->object_key_iter_from(req_lib_confdb_key_iter->parent_object_handle, + req_lib_confdb_key_iter->next_entry, +@@ -495,7 +493,7 @@ + &key_name_len, + &value, + &value_len)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + else { + memcpy(res_lib_confdb_key_iter.key_name.value, key_name, key_name_len); + memcpy(res_lib_confdb_key_iter.value.value, value, value_len); +@@ -514,7 +512,7 @@ + struct req_lib_confdb_object_iter *req_lib_confdb_object_iter = (struct req_lib_confdb_object_iter *)message; + struct res_lib_confdb_object_iter res_lib_confdb_object_iter; + int object_name_len; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (!req_lib_confdb_object_iter->find_handle) { + api->object_find_create(req_lib_confdb_object_iter->parent_object_handle, +@@ -526,7 +524,7 @@ + + if (api->object_find_next(res_lib_confdb_object_iter.find_handle, + &res_lib_confdb_object_iter.object_handle)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + else { + api->object_name_get(res_lib_confdb_object_iter.object_handle, + (char *)res_lib_confdb_object_iter.object_name.value, +@@ -545,7 +543,7 @@ + { + struct req_lib_confdb_object_find *req_lib_confdb_object_find = (struct req_lib_confdb_object_find *)message; + struct res_lib_confdb_object_find res_lib_confdb_object_find; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + + if (!req_lib_confdb_object_find->find_handle) { + api->object_find_create(req_lib_confdb_object_find->parent_object_handle, +@@ -558,7 +556,7 @@ + + if (api->object_find_next(res_lib_confdb_object_find.find_handle, + &res_lib_confdb_object_find.object_handle)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res_lib_confdb_object_find.header.size = sizeof(res_lib_confdb_object_find); + res_lib_confdb_object_find.header.id = MESSAGE_RES_CONFDB_OBJECT_FIND; +@@ -571,11 +569,11 @@ + static void message_handler_req_lib_confdb_write (void *conn, void *message) + { + struct res_lib_confdb_write res_lib_confdb_write; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + char *error_string = NULL; + + if (api->object_write_config(&error_string)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res_lib_confdb_write.header.size = sizeof(res_lib_confdb_write); + res_lib_confdb_write.header.id = MESSAGE_RES_CONFDB_WRITE; +@@ -593,11 +591,11 @@ + { + struct req_lib_confdb_reload *req_lib_confdb_reload = (struct req_lib_confdb_reload *)message; + struct res_lib_confdb_reload res_lib_confdb_reload; +- int ret = SA_AIS_OK; ++ int ret = CS_OK; + char *error_string = NULL; + + if (api->object_reload_config(req_lib_confdb_reload->flush, &error_string)) +- ret = SA_AIS_ERR_ACCESS; ++ ret = CS_ERR_ACCESS; + + res_lib_confdb_reload.header.size = sizeof(res_lib_confdb_reload); + res_lib_confdb_reload.header.id = MESSAGE_RES_CONFDB_RELOAD; +@@ -624,7 +622,7 @@ + + res.header.size = sizeof(res); + res.header.id = MESSAGE_RES_CONFDB_KEY_CHANGE_CALLBACK; +- res.header.error = SA_AIS_OK; ++ res.header.error = CS_OK; + // handle & type + res.change_type = change_type; + res.parent_object_handle = parent_object_handle; +@@ -651,7 +649,7 @@ + + res.header.size = sizeof(res); + res.header.id = MESSAGE_RES_CONFDB_OBJECT_CREATE_CALLBACK; +- res.header.error = SA_AIS_OK; ++ res.header.error = CS_OK; + res.parent_object_handle = parent_object_handle; + res.object_handle = object_handle; + memcpy(res.name.value, name_pt, name_len); +@@ -668,7 +666,7 @@ + + res.header.size = sizeof(res); + res.header.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY_CALLBACK; +- res.header.error = SA_AIS_OK; ++ res.header.error = CS_OK; + res.parent_object_handle = parent_object_handle; + memcpy(res.name.value, name_pt, name_len); + res.name.length = name_len; +@@ -686,10 +684,11 @@ + confdb_notify_lib_of_key_change, + confdb_notify_lib_of_new_object, + confdb_notify_lib_of_destroyed_object, ++ NULL, + api->ipc_conn_partner_get (conn)); + res.size = sizeof(res); + res.id = MESSAGE_RES_CONFDB_TRACK_START; +- res.error = SA_AIS_OK; ++ res.error = CS_OK; + api->ipc_conn_send_response(conn, &res, sizeof(res)); + } + +@@ -700,11 +699,12 @@ + api->object_track_stop(confdb_notify_lib_of_key_change, + confdb_notify_lib_of_new_object, + confdb_notify_lib_of_destroyed_object, ++ NULL, + api->ipc_conn_partner_get (conn)); + + res.size = sizeof(res); + res.id = MESSAGE_RES_CONFDB_TRACK_STOP; +- res.error = SA_AIS_OK; ++ res.error = CS_OK; + api->ipc_conn_send_response(conn, &res, sizeof(res)); + } + +diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c +--- corosync-0.92/services/cpg.c 2008-09-17 21:15:00.000000000 +0200 ++++ corosync-trunk/services/cpg.c 2008-12-01 18:43:40.000000000 +0100 +@@ -51,7 +51,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include +@@ -99,7 +99,7 @@ + void *conn; + void *trackerconn; + struct group_info *group; +- enum corosync_flow_control_state flow_control_state; ++ enum cs_flow_control_state flow_control_state; + struct list_head list; /* on the group_info members list */ + }; + +@@ -189,49 +189,49 @@ + .lib_handler_fn = message_handler_req_lib_cpg_join, + .response_size = sizeof (struct res_lib_cpg_join), + .response_id = MESSAGE_RES_CPG_JOIN, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 1 */ + .lib_handler_fn = message_handler_req_lib_cpg_leave, + .response_size = sizeof (struct res_lib_cpg_leave), + .response_id = MESSAGE_RES_CPG_LEAVE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 2 */ + .lib_handler_fn = message_handler_req_lib_cpg_mcast, + .response_size = sizeof (struct res_lib_cpg_mcast), + .response_id = MESSAGE_RES_CPG_MCAST, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 3 */ + .lib_handler_fn = message_handler_req_lib_cpg_membership, + .response_size = sizeof (mar_res_header_t), + .response_id = MESSAGE_RES_CPG_MEMBERSHIP, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 4 */ + .lib_handler_fn = message_handler_req_lib_cpg_trackstart, + .response_size = sizeof (struct res_lib_cpg_trackstart), + .response_id = MESSAGE_RES_CPG_TRACKSTART, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 5 */ + .lib_handler_fn = message_handler_req_lib_cpg_trackstop, + .response_size = sizeof (struct res_lib_cpg_trackstart), + .response_id = MESSAGE_RES_CPG_TRACKSTOP, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 6 */ + .lib_handler_fn = message_handler_req_lib_cpg_local_get, + .response_size = sizeof (struct res_lib_cpg_local_get), + .response_id = MESSAGE_RES_CPG_LOCAL_GET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 7 */ + .lib_handler_fn = message_handler_req_lib_cpg_groups_get, + .response_size = sizeof (struct res_lib_cpg_groups_get), + .response_id = MESSAGE_RES_CPG_GROUPS_GET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + } + }; + +@@ -263,7 +263,7 @@ + .name = "corosync cluster closed process group service v1.01", + .id = CPG_SERVICE, + .private_data_size = sizeof (struct process_info), +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED, ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED, + .lib_init_fn = cpg_lib_init_fn, + .lib_exit_fn = cpg_lib_exit_fn, + .lib_engine = cpg_lib_engine, +@@ -395,7 +395,7 @@ + sizeof(mar_cpg_address_t) * (count + left_list_entries + joined_list_entries); + buf = alloca(size); + if (!buf) +- return SA_AIS_ERR_NO_SPACE; ++ return CS_ERR_NO_SPACE; + + res = (struct res_lib_cpg_confchg_callback *)buf; + res->joined_list_entries = joined_list_entries; +@@ -453,7 +453,7 @@ + } + } + +- return SA_AIS_OK; ++ return CS_OK; + } + + static void remove_group(struct group_info *gi) +@@ -694,7 +694,7 @@ + struct memb_ring_id *ring_id) + { + int i; +- uint32_t lowest_nodeid = 0xffffff; ++ uint32_t lowest_nodeid = 0xffffffff; + struct iovec req_exec_cpg_iovec; + + /* We don't send the library joinlist in here because it can end up +@@ -736,7 +736,7 @@ + + static void cpg_flow_control_state_set_fn ( + void *context, +- enum corosync_flow_control_state flow_control_state) ++ enum cs_flow_control_state flow_control_state) + { + struct res_lib_cpg_flowcontrol_callback res_lib_cpg_flowcontrol_callback; + struct process_info *process_info = (struct process_info *)context; +@@ -1105,19 +1105,19 @@ + struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn); + struct res_lib_cpg_join res_lib_cpg_join; + struct group_info *gi; +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + + log_printf(LOG_LEVEL_DEBUG, "got join request on %p, pi=%p, pi->pid=%d\n", conn, pi, pi->pid); + + /* Already joined on this conn */ + if (pi->pid) { +- error = SA_AIS_ERR_INVALID_PARAM; ++ error = CS_ERR_INVALID_PARAM; + goto join_err; + } + + gi = get_group(&req_lib_cpg_join->group_name); + if (!gi) { +- error = SA_AIS_ERR_NO_SPACE; ++ error = CS_ERR_NO_SPACE; + goto join_err; + } + +@@ -1151,12 +1151,12 @@ + struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn); + struct res_lib_cpg_leave res_lib_cpg_leave; + struct group_info *gi; +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + + log_printf(LOG_LEVEL_DEBUG, "got leave request on %p\n", conn); + + if (!pi || !pi->pid || !pi->group) { +- error = SA_AIS_ERR_INVALID_PARAM; ++ error = CS_ERR_INVALID_PARAM; + goto leave_ret; + } + gi = pi->group; +@@ -1198,7 +1198,7 @@ + if (!gi) { + res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast); + res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST; +- res_lib_cpg_mcast.header.error = SA_AIS_ERR_ACCESS; /* TODO Better error code ?? */ ++ res_lib_cpg_mcast.header.error = CS_ERR_ACCESS; /* TODO Better error code ?? */ + res_lib_cpg_mcast.flow_control_state = CPG_FLOW_CONTROL_DISABLED; + api->ipc_conn_send_response(conn, &res_lib_cpg_mcast, + sizeof(res_lib_cpg_mcast)); +@@ -1225,7 +1225,7 @@ + + res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast); + res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST; +- res_lib_cpg_mcast.header.error = SA_AIS_OK; ++ res_lib_cpg_mcast.header.error = CS_OK; + res_lib_cpg_mcast.flow_control_state = pi->flow_control_state; + api->ipc_conn_send_response(conn, &res_lib_cpg_mcast, + sizeof(res_lib_cpg_mcast)); +@@ -1240,7 +1240,7 @@ + mar_res_header_t res; + res.size = sizeof(res); + res.id = MESSAGE_RES_CPG_MEMBERSHIP; +- res.error = SA_AIS_ERR_ACCESS; /* TODO Better error code */ ++ res.error = CS_ERR_ACCESS; /* TODO Better error code */ + api->ipc_conn_send_response(conn, &res, sizeof(res)); + return; + } +@@ -1256,13 +1256,13 @@ + struct group_info *gi; + struct process_info *otherpi; + void *otherconn; +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + + log_printf(LOG_LEVEL_DEBUG, "got trackstart request on %p\n", conn); + + gi = get_group(&req_lib_cpg_trackstart->group_name); + if (!gi) { +- error = SA_AIS_ERR_NO_SPACE; ++ error = CS_ERR_NO_SPACE; + goto tstart_ret; + } + +@@ -1274,7 +1274,7 @@ + tstart_ret: + res_lib_cpg_trackstart.header.size = sizeof(res_lib_cpg_trackstart); + res_lib_cpg_trackstart.header.id = MESSAGE_RES_CPG_TRACKSTART; +- res_lib_cpg_trackstart.header.error = SA_AIS_OK; ++ res_lib_cpg_trackstart.header.error = CS_OK; + api->ipc_conn_send_response(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart)); + } + +@@ -1285,13 +1285,13 @@ + struct process_info *otherpi; + void *otherconn; + struct group_info *gi; +- SaAisErrorT error = SA_AIS_OK; ++ cs_error_t error = CS_OK; + + log_printf(LOG_LEVEL_DEBUG, "got trackstop request on %p\n", conn); + + gi = get_group(&req_lib_cpg_trackstop->group_name); + if (!gi) { +- error = SA_AIS_ERR_NO_SPACE; ++ error = CS_ERR_NO_SPACE; + goto tstop_ret; + } + +@@ -1303,7 +1303,7 @@ + tstop_ret: + res_lib_cpg_trackstop.header.size = sizeof(res_lib_cpg_trackstop); + res_lib_cpg_trackstop.header.id = MESSAGE_RES_CPG_TRACKSTOP; +- res_lib_cpg_trackstop.header.error = SA_AIS_OK; ++ res_lib_cpg_trackstop.header.error = CS_OK; + api->ipc_conn_send_response(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop)); + } + +@@ -1313,7 +1313,7 @@ + + res_lib_cpg_local_get.header.size = sizeof(res_lib_cpg_local_get); + res_lib_cpg_local_get.header.id = MESSAGE_RES_CPG_LOCAL_GET; +- res_lib_cpg_local_get.header.error = SA_AIS_OK; ++ res_lib_cpg_local_get.header.error = CS_OK; + res_lib_cpg_local_get.local_nodeid = api->totem_nodeid_get (); + + api->ipc_conn_send_response(conn, &res_lib_cpg_local_get, +@@ -1326,7 +1326,7 @@ + + res_lib_cpg_groups_get.header.size = sizeof(res_lib_cpg_groups_get); + res_lib_cpg_groups_get.header.id = MESSAGE_RES_CPG_GROUPS_GET; +- res_lib_cpg_groups_get.header.error = SA_AIS_OK; ++ res_lib_cpg_groups_get.header.error = CS_OK; + res_lib_cpg_groups_get.num_groups = count_groups(); + + api->ipc_conn_send_response(conn, &res_lib_cpg_groups_get, +diff -Naurd corosync-0.92/services/evs.c corosync-trunk/services/evs.c +--- corosync-0.92/services/evs.c 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/services/evs.c 2008-11-06 22:49:07.000000000 +0100 +@@ -49,7 +49,7 @@ + #include + + #include +-#include ++#include + #include + #include + #include +@@ -104,31 +104,31 @@ + .lib_handler_fn = message_handler_req_evs_join, + .response_size = sizeof (struct res_lib_evs_join), + .response_id = MESSAGE_RES_EVS_JOIN, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 1 */ + .lib_handler_fn = message_handler_req_evs_leave, + .response_size = sizeof (struct res_lib_evs_leave), + .response_id = MESSAGE_RES_EVS_LEAVE, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 2 */ + .lib_handler_fn = message_handler_req_evs_mcast_joined, + .response_size = sizeof (struct res_lib_evs_mcast_joined), + .response_id = MESSAGE_RES_EVS_MCAST_JOINED, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 3 */ + .lib_handler_fn = message_handler_req_evs_mcast_groups, + .response_size = sizeof (struct res_lib_evs_mcast_groups), + .response_id = MESSAGE_RES_EVS_MCAST_GROUPS, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED + }, + { /* 4 */ + .lib_handler_fn = message_handler_req_evs_membership_get, + .response_size = sizeof (struct res_lib_evs_membership_get), + .response_id = MESSAGE_RES_EVS_MEMBERSHIP_GET, +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + } + }; + +@@ -144,7 +144,7 @@ + .name = "corosync extended virtual synchrony service", + .id = EVS_SERVICE, + .private_data_size = sizeof (struct evs_pd), +- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED, ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED, + .lib_init_fn = evs_lib_init_fn, + .lib_exit_fn = evs_lib_exit_fn, + .lib_engine = evs_lib_engine, +@@ -223,7 +223,7 @@ + */ + res_evs_confchg_callback.header.size = sizeof (struct res_evs_confchg_callback); + res_evs_confchg_callback.header.id = MESSAGE_RES_EVS_CONFCHG_CALLBACK; +- res_evs_confchg_callback.header.error = SA_AIS_OK; ++ res_evs_confchg_callback.header.error = CS_OK; + + memcpy (res_evs_confchg_callback.member_list, + member_list, member_list_entries * sizeof(*member_list)); +@@ -276,21 +276,21 @@ + + static void message_handler_req_evs_join (void *conn, void *msg) + { +- evs_error_t error = EVS_OK; ++ cs_error_t error = CS_OK; + struct req_lib_evs_join *req_lib_evs_join = (struct req_lib_evs_join *)msg; + struct res_lib_evs_join res_lib_evs_join; + void *addr; + struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn); + + if (req_lib_evs_join->group_entries > 50) { +- error = EVS_ERR_TOO_MANY_GROUPS; ++ error = CS_ERR_TOO_MANY_GROUPS; + goto exit_error; + } + + addr = realloc (evs_pd->groups, sizeof (struct evs_group) * + (evs_pd->group_entries + req_lib_evs_join->group_entries)); + if (addr == NULL) { +- error = SA_AIS_ERR_NO_MEMORY; ++ error = CS_ERR_NO_MEMORY; + goto exit_error; + } + evs_pd->groups = addr; +@@ -314,7 +314,7 @@ + { + struct req_lib_evs_leave *req_lib_evs_leave = (struct req_lib_evs_leave *)msg; + struct res_lib_evs_leave res_lib_evs_leave; +- evs_error_t error = EVS_OK; ++ cs_error_t error = CS_OK; + int error_index; + int i, j; + int found; +@@ -342,7 +342,7 @@ + } + } + if (found == 0) { +- error = EVS_ERR_NOT_EXIST; ++ error = CS_ERR_NOT_EXIST; + error_index = i; + break; + } +@@ -358,7 +358,7 @@ + + static void message_handler_req_evs_mcast_joined (void *conn, void *msg) + { +- evs_error_t error = EVS_ERR_TRY_AGAIN; ++ cs_error_t error = CS_ERR_TRY_AGAIN; + struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)msg; + struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined; + struct iovec req_exec_evs_mcast_iovec[3]; +@@ -388,7 +388,7 @@ + res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); + // TODO + if (res == 0) { +- error = EVS_OK; ++ error = CS_OK; + } + + res_lib_evs_mcast_joined.header.size = sizeof (struct res_lib_evs_mcast_joined); +@@ -401,7 +401,7 @@ + + static void message_handler_req_evs_mcast_groups (void *conn, void *msg) + { +- evs_error_t error = EVS_ERR_TRY_AGAIN; ++ cs_error_t error = CS_ERR_TRY_AGAIN; + struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)msg; + struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups; + struct iovec req_exec_evs_mcast_iovec[3]; +@@ -434,7 +434,7 @@ + send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); + res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); + if (res == 0) { +- error = EVS_OK; ++ error = CS_OK; + } + + res_lib_evs_mcast_groups.header.size = sizeof (struct res_lib_evs_mcast_groups); +@@ -451,7 +451,7 @@ + + res_lib_evs_membership_get.header.size = sizeof (struct res_lib_evs_membership_get); + res_lib_evs_membership_get.header.id = MESSAGE_RES_EVS_MEMBERSHIP_GET; +- res_lib_evs_membership_get.header.error = EVS_OK; ++ res_lib_evs_membership_get.header.error = CS_OK; + res_lib_evs_membership_get.local_nodeid = api->totem_nodeid_get (); + memcpy (&res_lib_evs_membership_get.member_list, + &res_evs_confchg_callback.member_list, +@@ -488,7 +488,7 @@ + res_evs_deliver_callback.header.size = sizeof (struct res_evs_deliver_callback) + + req_exec_evs_mcast->msg_len; + res_evs_deliver_callback.header.id = MESSAGE_RES_EVS_DELIVER_CALLBACK; +- res_evs_deliver_callback.header.error = SA_AIS_OK; ++ res_evs_deliver_callback.header.error = CS_OK; + res_evs_deliver_callback.msglen = req_exec_evs_mcast->msg_len; + + msg_addr = (char *)req_exec_evs_mcast + sizeof (struct req_exec_evs_mcast) + +diff -Naurd corosync-0.92/services/Makefile corosync-trunk/services/Makefile +--- corosync-0.92/services/Makefile 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/services/Makefile 2008-12-08 16:55:41.000000000 +0100 +@@ -50,12 +50,12 @@ + endif + + # LCR objects +-LCR_SRC = evs.c cfg.c cpg.c confdb.c +-LCR_OBJS = evs.o cfg.o cpg.o confdb.o $(AMF_OBJS) ++LCR_SRC = evs.c cfg.c cpg.c confdb.c pload.c ++LCR_OBJS = evs.o cfg.o cpg.o confdb.o $(AMF_OBJS) pload.o + + override CFLAGS += -fPIC + +-all: service_evs.lcrso service_cfg.lcrso service_cpg.lcrso service_confdb.lcrso ++all: service_evs.lcrso service_cfg.lcrso service_cpg.lcrso service_confdb.lcrso service_pload.lcrso testquorum.lcrso + + ifeq (${COROSYNC_COMPAT}, DARWIN) + +@@ -71,6 +71,9 @@ + service_cpg.lcrso: cpg.o + $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load cpg.o -o $@ + ++service_pload.lcrso: pload.o ++ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load pload.o -o $@ ++ + else + + service_evs.lcrso: evs.o +@@ -85,11 +88,20 @@ + service_cpg.lcrso: cpg.o + $(CC) -shared -Wl,-soname,service_cpg.lcrso cpg.o -o $@ + ++service_pload.lcrso: pload.o ++ $(CC) -shared -Wl,-soname,service_pload.lcrso pload.o -o $@ ++ ++testquorum.lcrso: testquorum.o ++ $(CC) -shared -Wl,-soname,testquorum.lcrso testquorum.o -o $@ ++ + endif + + clean: + rm -f *.o *.lcrso + ++lint: ++ -splint $(LINT_FLAGS) $(CFLAGS) *.c ++ + depend: + makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(EXEC_SRC) $(TOTEM_SRC) $(LOGSYS_SRC) $(LCR_SRC) > /dev/null 2>&1 + +@@ -104,3 +116,6 @@ + + cpg.o: cpg.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< ++ ++testquorum.o: testquorum.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +diff -Naurd corosync-0.92/services/pload.c corosync-trunk/services/pload.c +--- corosync-0.92/services/pload.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/services/pload.c 2008-11-06 22:49:07.000000000 +0100 +@@ -0,0 +1,356 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: 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. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++LOGSYS_DECLARE_SUBSYS ("PLOAD", LOG_INFO); ++ ++enum pload_exec_message_req_types { ++ MESSAGE_REQ_EXEC_PLOAD_START = 0, ++ MESSAGE_REQ_EXEC_PLOAD_MCAST = 1 ++}; ++ ++/* ++ * Service Interfaces required by service_message_handler struct ++ */ ++static int pload_exec_init_fn ( ++ struct corosync_api_v1 *corosync_api); ++ ++static void pload_confchg_fn ( ++ enum totem_configuration_type configuration_type, ++ unsigned int *member_list, int member_list_entries, ++ unsigned int *left_list, int left_list_entries, ++ unsigned int *joined_list, int joined_list_entries, ++ struct memb_ring_id *ring_id); ++ ++static void message_handler_req_exec_pload_start (void *msg, unsigned int nodeid); ++ ++static void message_handler_req_exec_pload_mcast (void *msg, unsigned int nodeid); ++ ++static void req_exec_pload_start_endian_convert (void *msg); ++ ++static void req_exec_pload_mcast_endian_convert (void *msg); ++ ++static void message_handler_req_pload_start (void *conn, void *msg); ++ ++static int pload_lib_init_fn (void *conn); ++ ++static int pload_lib_exit_fn (void *conn); ++ ++static char buffer[1000000]; ++ ++static unsigned int msgs_delivered = 0; ++ ++static unsigned int msgs_wanted = 0; ++ ++static unsigned int msg_size = 0; ++ ++static unsigned int msg_code = 1; ++ ++static unsigned int msgs_sent = 0; ++ ++ ++static struct corosync_api_v1 *api; ++ ++struct req_exec_pload_start { ++ mar_req_header_t header; ++ unsigned int msg_code; ++ unsigned int msg_count; ++ unsigned int msg_size; ++ unsigned int time_interval; ++}; ++ ++struct req_exec_pload_mcast { ++ mar_req_header_t header; ++ unsigned int msg_code; ++}; ++ ++static struct corosync_lib_handler pload_lib_engine[] = ++{ ++ { /* 0 */ ++ .lib_handler_fn = message_handler_req_pload_start, ++ .response_size = sizeof (struct res_lib_pload_start), ++ .response_id = MESSAGE_RES_PLOAD_START, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ } ++}; ++ ++static struct corosync_exec_handler pload_exec_engine[] = ++{ ++ { ++ .exec_handler_fn = message_handler_req_exec_pload_start, ++ .exec_endian_convert_fn = req_exec_pload_start_endian_convert ++ }, ++ { ++ .exec_handler_fn = message_handler_req_exec_pload_mcast, ++ .exec_endian_convert_fn = req_exec_pload_mcast_endian_convert ++ } ++}; ++ ++struct corosync_service_engine pload_service_engine = { ++ .name = "corosync profile loading service", ++ .id = PLOAD_SERVICE, ++ .private_data_size = 0, ++ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED, ++ .lib_init_fn = pload_lib_init_fn, ++ .lib_exit_fn = pload_lib_exit_fn, ++ .lib_engine = pload_lib_engine, ++ .lib_engine_count = sizeof (pload_lib_engine) / sizeof (struct corosync_lib_handler), ++ .exec_engine = pload_exec_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 ++}; ++ ++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) ++{ ++ return (&pload_service_engine); ++} ++ ++__attribute__ ((constructor)) static void pload_comp_register (void) { ++ 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) ++{ ++ api = corosync_api; ++ ++ return 0; ++} ++ ++static void pload_confchg_fn ( ++ enum totem_configuration_type configuration_type, ++ unsigned int *member_list, int member_list_entries, ++ unsigned int *left_list, int left_list_entries, ++ unsigned int *joined_list, int joined_list_entries, ++ struct memb_ring_id *ring_id) ++{ ++} ++ ++static int pload_lib_init_fn (void *conn) ++{ ++ return (0); ++} ++ ++static int pload_lib_exit_fn (void *conn) ++{ ++ return (0); ++} ++ ++static void message_handler_req_pload_start (void *conn, void *msg) ++{ ++ struct req_lib_pload_start *req_lib_pload_start = (struct req_lib_pload_start *)msg; ++ struct req_exec_pload_start req_exec_pload_start; ++ struct iovec iov; ++ ++ req_exec_pload_start.header.id = ++ SERVICE_ID_MAKE (PLOAD_SERVICE, MESSAGE_REQ_EXEC_PLOAD_START); ++ req_exec_pload_start.msg_code = req_lib_pload_start->msg_code; ++ req_exec_pload_start.msg_size = req_lib_pload_start->msg_size; ++ req_exec_pload_start.msg_count = req_lib_pload_start->msg_count; ++ req_exec_pload_start.time_interval = req_lib_pload_start->time_interval; ++ iov.iov_base = &req_exec_pload_start; ++ iov.iov_len = sizeof (struct req_exec_pload_start); ++ ++ api->totem_mcast (&iov, 1, TOTEM_AGREED); ++} ++ ++static void req_exec_pload_start_endian_convert (void *msg) ++{ ++} ++ ++static void req_exec_pload_mcast_endian_convert (void *msg) ++{ ++} ++ ++static int msg_no = 0; ++ ++int send_message (enum totem_callback_token_type type, void *arg) ++{ ++ struct req_exec_pload_mcast req_exec_pload_mcast; ++ struct iovec iov[2]; ++ unsigned int res; ++ int iov_len = 2; ++ ++ req_exec_pload_mcast.header.id = ++ SERVICE_ID_MAKE (PLOAD_SERVICE, MESSAGE_REQ_EXEC_PLOAD_MCAST); ++ req_exec_pload_mcast.header.size = sizeof (struct req_exec_pload_mcast) + msg_size; ++ ++ iov[0].iov_base = &req_exec_pload_mcast; ++ iov[0].iov_len = sizeof (struct req_exec_pload_mcast); ++ iov[1].iov_base = buffer; ++ iov[1].iov_len = msg_size - sizeof (struct req_exec_pload_mcast); ++ if (iov[1].iov_len < 0) { ++ iov_len = 1; ++ } ++ ++ do { ++ res = api->totem_mcast (iov, iov_len, TOTEM_AGREED); ++ if (res == -1) { ++ break; ++ } else { ++ msgs_sent++; ++ msg_code++; ++ } ++ } while (msgs_sent <= msgs_wanted); ++ if (msgs_sent == msgs_wanted) { ++ return (0); ++ } else { ++ return (-1); ++ } ++} ++ ++void *token_callback; ++void start_mcasting (void) ++{ ++ api->totem_callback_token_create ( ++ &token_callback, ++ TOTEM_CALLBACK_TOKEN_RECEIVED, ++ 1, ++ send_message, ++ &token_callback); ++} ++ ++static void message_handler_req_exec_pload_start ( ++ void *msg, ++ unsigned int nodeid) ++{ ++ struct req_exec_pload_start *req_exec_pload_start = (struct req_exec_pload_start *)msg; ++ ++ msgs_wanted = req_exec_pload_start->msg_count; ++ msg_size = req_exec_pload_start->msg_size; ++ msg_code = req_exec_pload_start->msg_code; ++ ++ start_mcasting (); ++} ++ ++# define timersub(a, b, result) \ ++ do { \ ++ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ ++ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ ++ if ((result)->tv_usec < 0) { \ ++ --(result)->tv_sec; \ ++ (result)->tv_usec += 1000000; \ ++ } \ ++ } while (0) ++ ++struct timeval tv1; ++struct timeval tv2; ++struct timeval tv_elapsed; ++int last_msg_no = 0; ++ ++static void message_handler_req_exec_pload_mcast ( ++ void *msg, ++ unsigned int nodeid) ++{ ++ struct req_exec_pload_mcast *pload_mcast = (struct req_exec_pload_mcast *)msg; ++ ++ assert (pload_mcast->msg_code - 1 == last_msg_no); ++ last_msg_no = pload_mcast->msg_code; ++ if (msgs_delivered == 0) { ++ gettimeofday (&tv1, NULL); ++ } ++ msgs_delivered += 1; ++ if (msgs_delivered == msgs_wanted) { ++ gettimeofday (&tv2, NULL); ++ timersub (&tv2, &tv1, &tv_elapsed); ++ printf ("%5d Writes ", msgs_delivered); ++ printf ("%5d bytes per write ", msg_size); ++ printf ("%7.3f Seconds runtime ", ++ (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); ++ printf ("%9.3f TP/s ", ++ ((float)msgs_delivered) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); ++ printf ("%7.3f MB/s.\n", ++ ((float)msgs_delivered) * ((float)msg_size) / ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0)); ++ } ++} +diff -Naurd corosync-0.92/services/testquorum.c corosync-trunk/services/testquorum.c +--- corosync-0.92/services/testquorum.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/services/testquorum.c 2008-12-09 14:48:47.000000000 +0100 +@@ -0,0 +1,153 @@ ++/* ++ * Copyright (c) 2008 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++LOGSYS_DECLARE_SUBSYS ("TEST", LOG_INFO); ++ ++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 ++}; ++ ++__attribute__ ((constructor)) static void test_quorum_comp_register (void) { ++ 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(object_change_type_t change_type, ++ unsigned int parent_object_handle, ++ unsigned int object_handle, ++ void *object_name_pt, int object_name_len, ++ void *key_name_pt, int key_len, ++ void *key_value_pt, int key_value_len, ++ void *priv_data_pt) ++{ ++ unsigned int members[1]; ++ struct memb_ring_id ring_id; ++ ++ memset(&ring_id, 0, sizeof(ring_id)); ++ ++ /* If the 'quorum.quorate' key changes, then that changes quorum */ ++ if (strncmp(key_name_pt, "quorate", key_len) == 0) { ++ set_quorum(members, 0, atoi(key_value_pt), &ring_id); ++ } ++} ++ ++static void quorum_callback(int quorate, void *context) ++{ ++ log_printf(LOG_LEVEL_DEBUG, "quorum callback: quorate = %d\n", quorate); ++} ++ ++static void test_init(struct corosync_api_v1 *api, ++ quorum_set_quorate_fn_t report) ++{ ++ ++ unsigned int find_handle; ++ unsigned int quorum_handle = 0; ++ ++ set_quorum = report; ++ ++ /* ++ * Register for objdb changes on quorum { } ++ */ ++ api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); ++ api->object_find_next(find_handle, &quorum_handle); ++ api->object_find_destroy(find_handle); ++ ++ api->object_track_start(quorum_handle, ++ 1, ++ key_change_notify, ++ NULL, // object_create_notify ++ NULL, // object_destroy_notify ++ NULL, // object_reload_notify ++ NULL); // priv_data ++ ++ /* Register for quorum changes too! */ ++ api->quorum_register_callback(quorum_callback, NULL); ++} +diff -Naurd corosync-0.92/test/cpgbench.c corosync-trunk/test/cpgbench.c +--- corosync-0.92/test/cpgbench.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/test/cpgbench.c 2008-11-06 22:49:07.000000000 +0100 +@@ -50,7 +50,7 @@ + #include + #include + +-#include ++#include + #include + + #ifdef COROSYNC_SOLARIS +@@ -121,12 +121,12 @@ + if (flow_control_state == CPG_FLOW_CONTROL_DISABLED) { + retry: + res = cpg_mcast_joined (handle, CPG_TYPE_AGREED, &iov, 1); +- if (res == CPG_ERR_TRY_AGAIN) { ++ if (res == CS_ERR_TRY_AGAIN) { + goto retry; + } + } +- res = cpg_dispatch (handle, CPG_DISPATCH_ALL); +- if (res != CPG_OK) { ++ res = cpg_dispatch (handle, CS_DISPATCH_ALL); ++ if (res != CS_OK) { + printf ("cpg dispatch returned error %d\n", res); + exit (1); + } +@@ -162,13 +162,13 @@ + + signal (SIGALRM, sigalrm_handler); + res = cpg_initialize (&handle, &callbacks); +- if (res != CPG_OK) { ++ if (res != CS_OK) { + printf ("cpg_initialize failed with result %d\n", res); + exit (1); + } + + res = cpg_join (handle, &group_name); +- if (res != CPG_OK) { ++ if (res != CS_OK) { + printf ("cpg_join failed with result %d\n", res); + exit (1); + } +@@ -179,7 +179,7 @@ + } + + res = cpg_finalize (handle); +- if (res != CPG_OK) { ++ if (res != CS_OK) { + printf ("cpg_join failed with result %d\n", res); + exit (1); + } +diff -Naurd corosync-0.92/test/evsbench.c corosync-trunk/test/evsbench.c +--- corosync-0.92/test/evsbench.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/test/evsbench.c 2008-11-06 22:49:07.000000000 +0100 +@@ -49,7 +49,7 @@ + #include + #include + +-#include ++#include + #include + + #ifdef COROSYNC_SOLARIS +@@ -124,7 +124,7 @@ + int write_size) + { + struct timeval tv1, tv2, tv_elapsed; +- evs_error_t result; ++ cs_error_t result; + int write_count = 0; + + /* +@@ -139,12 +139,12 @@ + if (outstanding < 10) { + result = evs_mcast_joined (handle, EVS_TYPE_AGREED, &iov, 1); + +- if (result != EVS_ERR_TRY_AGAIN) { ++ if (result != CS_ERR_TRY_AGAIN) { + write_count += 1; + outstanding++; + } + } +- result = evs_dispatch (handle, EVS_DISPATCH_ALL); ++ result = evs_dispatch (handle, CS_DISPATCH_ALL); + } while (alarm_notice == 0); + gettimeofday (&tv2, NULL); + timersub (&tv2, &tv1, &tv_elapsed); +@@ -174,7 +174,7 @@ + int main (void) { + int size; + int i; +- evs_error_t result; ++ cs_error_t result; + evs_handle_t handle; + + signal (SIGALRM, sigalrm_handler); +diff -Naurd corosync-0.92/test/evsverify.c corosync-trunk/test/evsverify.c +--- corosync-0.92/test/evsverify.c 2008-09-25 07:31:42.000000000 +0200 ++++ corosync-trunk/test/evsverify.c 2008-11-06 22:49:07.000000000 +0100 +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + #include + #include "../exec/crypto.h" + +@@ -112,22 +113,22 @@ + + struct msg msg; + +-char buffer[200000]; ++unsigned char buffer[200000]; + int main (void) + { + evs_handle_t handle; +- evs_error_t result; ++ cs_error_t result; + unsigned int i = 0, j; + int fd; + unsigned int member_list[32]; + unsigned int local_nodeid; +- int member_list_entries = 32; ++ unsigned int member_list_entries = 32; + struct msg msg; + hash_state sha1_hash; + struct iovec iov[2]; + + result = evs_initialize (&handle, &callbacks); +- if (result != EVS_OK) { ++ if (result != CS_OK) { + printf ("Couldn't initialize EVS service %d\n", result); + exit (0); + } +@@ -169,10 +170,10 @@ + try_again_one: + result = evs_mcast_joined (handle, EVS_TYPE_AGREED, + iov, 2); +- if (result == EVS_ERR_TRY_AGAIN) { ++ if (result == CS_ERR_TRY_AGAIN) { + goto try_again_one; + } +- result = evs_dispatch (handle, EVS_DISPATCH_ALL); ++ result = evs_dispatch (handle, CS_DISPATCH_ALL); + } + + evs_fd_get (handle, &fd); +diff -Naurd corosync-0.92/test/logsysbench.c corosync-trunk/test/logsysbench.c +--- corosync-0.92/test/logsysbench.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/test/logsysbench.c 2008-10-30 23:25:56.000000000 +0100 +@@ -0,0 +1,171 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: 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. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++LOGSYS_DECLARE_SYSTEM ("logtest_rec", ++ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, ++ NULL, ++ LOG_DAEMON, ++ "[%6s] %b", ++ 100000); ++ ++LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); ++ ++#define LOGREC_ID_CHECKPOINT_CREATE 2 ++#define LOGREC_ARGS_CHECKPOINT_CREATE 2 ++#define ITERATIONS 1000000 ++ ++struct timeval tv1, tv2, tv_elapsed; ++ ++#define timersub(a, b, result) \ ++do { \ ++ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ ++ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ ++ if ((result)->tv_usec < 0) { \ ++ --(result)->tv_sec; \ ++ (result)->tv_usec += 1000000; \ ++ } \ ++} while (0) ++ ++void bm_start (void) ++{ ++ gettimeofday (&tv1, NULL); ++} ++void bm_finish (char *operation) ++{ ++ gettimeofday (&tv2, NULL); ++ timersub (&tv2, &tv1, &tv_elapsed); ++ ++ if (strlen (operation) > 22) { ++ printf ("%s\t\t", operation); ++ } else { ++ printf ("%s\t\t\t", operation); ++ } ++ printf ("%9.3f operations/sec\n", ++ ((float)ITERATIONS) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); ++} ++ ++char buffer[256]; ++int main (void) ++{ ++ int i; ++ char buf[1024]; ++ ++ ++ printf ("heating up cache with logrec functionality\n"); ++ for (i = 0; i < ITERATIONS; i++) { ++ log_rec (LOGREC_ID_CHECKPOINT_CREATE, ++ "recordA", 8, "recordB", 8, LOG_REC_END); ++ } ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ log_rec (LOGREC_ID_CHECKPOINT_CREATE, ++ buffer, 7, LOG_REC_END); ++ } ++ bm_finish ("log_rec 1 arguments:"); ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ log_rec (LOGREC_ID_CHECKPOINT_CREATE, ++ "recordA", 8, LOG_REC_END); ++ } ++ bm_finish ("log_rec 2 arguments:"); ++ bm_start(); ++ for (i = 0; i < 10; i++) { ++ log_rec (LOGREC_ID_CHECKPOINT_CREATE, ++ "recordA", 8, "recordB", 8, LOG_REC_END); ++ } ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ log_rec (LOGREC_ID_CHECKPOINT_CREATE, ++ "recordA", 8, "recordB", 8, "recordC", 8, LOG_REC_END); ++ } ++ bm_finish ("log_rec 3 arguments:"); ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ log_rec (LOGREC_ID_CHECKPOINT_CREATE, ++ "recordA", 8, "recordB", 8, "recordC", 8, "recordD", 8, LOG_REC_END); ++ } ++ bm_finish ("log_rec 4 arguments:"); ++ ++ /* ++ * sprintf testing ++ */ ++ printf ("heating up cache with sprintf functionality\n"); ++ for (i = 0; i < ITERATIONS; i++) { ++ sprintf (buf, "Some logging information %s", "recordA"); ++ } ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ sprintf (buf, "Some logging information %s", "recordA"); ++ } ++ bm_finish ("sprintf 1 argument:"); ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ sprintf (buf, "Some logging information %s %s", "recordA", "recordB"); ++ } ++ bm_finish ("sprintf 2 arguments:"); ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ sprintf (buf, "Some logging information %s %s %s", "recordA", "recordB", "recordC"); ++ } ++ bm_finish ("sprintf 3 arguments:"); ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ sprintf (buf, "Some logging information %s %s %s %s", "recordA", "recordB", "recordC", "recordD"); ++ } ++ bm_finish ("sprintf 4 arguments:"); ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ sprintf (buf, "Some logging information %s %s %s %d", "recordA", "recordB", "recordC", i); ++ } ++ bm_finish ("sprintf 4 arguments (1 int):"); ++ ++ logsys_log_rec_store ("fdata"); ++/* TODO ++ currently fails under some circumstances ++ ++ bm_start(); ++ for (i = 0; i < ITERATIONS; i++) { ++ log_printf (LOG_LEVEL_NOTICE, "test %d", i); ++ } ++ bm_finish("log_printf"); ++*/ ++ ++ return (0); ++} +diff -Naurd corosync-0.92/test/logsysrec.c corosync-trunk/test/logsysrec.c +--- corosync-0.92/test/logsysrec.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/test/logsysrec.c 2008-10-30 23:25:56.000000000 +0100 +@@ -0,0 +1,62 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: 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. ++ */ ++#include ++#include ++#include ++ ++LOGSYS_DECLARE_SYSTEM ("logtest_rec", ++ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, ++ NULL, ++ LOG_DAEMON, ++ "[%6s] %b", ++ 100000); ++ ++LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); ++ ++#define LOGREC_ID_CHECKPOINT_CREATE 2 ++#define LOGREC_ARGS_CHECKPOINT_CREATE 2 ++ ++int main(int argc, char **argv) ++{ ++ int i; ++ ++ for (i = 0; i < 10; i++) { ++ log_printf (LOG_LEVEL_NOTICE, "This is a test of %s\n", "stringparse"); ++ ++ log_rec (LOGREC_ID_CHECKPOINT_CREATE, "record1", 8, "record22", 9, "record333", 10, "record444", 11, LOG_REC_END); ++ } ++ logsys_log_rec_store ("fdata"); ++ ++ return 0; ++} +diff -Naurd corosync-0.92/test/logsys_s.c corosync-trunk/test/logsys_s.c +--- corosync-0.92/test/logsys_s.c 2008-05-12 15:48:06.000000000 +0200 ++++ corosync-trunk/test/logsys_s.c 2008-10-30 23:25:56.000000000 +0100 +@@ -38,7 +38,9 @@ + LOGSYS_DECLARE_SYSTEM ("logsystestsubsystems", + LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED, + NULL, +- LOG_DAEMON); ++ LOG_DAEMON, ++ "[%8s] %b", ++ 100000); + + extern void logsys_s1_print (void); + extern void logsys_s2_print (void); +diff -Naurd corosync-0.92/test/logsys_t1.c corosync-trunk/test/logsys_t1.c +--- corosync-0.92/test/logsys_t1.c 2008-06-20 08:04:03.000000000 +0200 ++++ corosync-trunk/test/logsys_t1.c 2008-10-30 23:25:56.000000000 +0100 +@@ -38,7 +38,9 @@ + LOGSYS_DECLARE_SYSTEM ("logsystestNOsubsystems", + LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED, + NULL, +- LOG_DAEMON); ++ LOG_DAEMON, ++ "%6s %b", ++ 100000); + + LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_DEBUG); + +diff -Naurd corosync-0.92/test/logsys_t2.c corosync-trunk/test/logsys_t2.c +--- corosync-0.92/test/logsys_t2.c 2008-06-20 08:04:03.000000000 +0200 ++++ corosync-trunk/test/logsys_t2.c 2008-10-30 23:25:56.000000000 +0100 +@@ -36,9 +36,11 @@ + #include "../exec/logsys.h" + + LOGSYS_DECLARE_SYSTEM ("logtest_t2", +- LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_BUFFER_BEFORE_CONFIG, ++ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, + NULL, +- LOG_DAEMON); ++ LOG_DAEMON, ++ "[%6s] %b" ++ 100000); + + LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); + +@@ -48,7 +50,7 @@ + /* + * fork could occur here and the file to output to could be set + */ +- logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_FLUSH_AFTER_CONFIG); ++ logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED); + + log_printf(LOG_NOTICE, "Hello, world!\n"); + log_printf(LOG_DEBUG, "If you see this, the logger's busted\n"); +diff -Naurd corosync-0.92/test/Makefile corosync-trunk/test/Makefile +--- corosync-0.92/test/Makefile 2008-09-25 07:31:42.000000000 +0200 ++++ corosync-trunk/test/Makefile 2008-12-08 16:55:41.000000000 +0100 +@@ -42,9 +42,9 @@ + override LDFLAGS += -lnsl -lsocket -lrt + endif + +-LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a ++LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a ../lib/libquorum.a + LIBS = $(LIBRARIES) +-BINARIES= testevs evsbench evsverify testcpg testcpg2 cpgbench testconfdb ++BINARIES= testevs evsbench evsverify testcpg testcpg2 cpgbench testconfdb logsysbench logsysrec testquorum + + override CFLAGS += -I../include + override LDFLAGS += -L../lib +@@ -75,12 +75,26 @@ + testcpg2: testcpg2.o $(LIBRARIES) + $(CC) $(LDFLAGS) -o testcpg2 testcpg2.o $(LIBS) + ++testquorum: testquorum.o $(LIBRARIES) ++ $(CC) $(LDFLAGS) -o testquorum testquorum.o $(LIBS) ++ + cpgbench: cpgbench.o $(LIBRARIES) + $(CC) $(LDFLAGS) -o cpgbench cpgbench.o $(LIBS) + + testconfdb: testconfdb.o $(LIBRARIES) + $(CC) $(LDFLAGS) -o testconfdb testconfdb.o $(LIBS) -rdynamic + ++logsysbench: logsysbench.o ../exec/liblogsys.a ++ $(CC) -o logsysbench logsysbench.o ../exec/liblogsys.a $(LDFLAGS) ++ ++logsysrec: logsysrec.o ../exec/liblogsys.a ++ $(CC) -o logsysrec logsysrec.o ../exec/liblogsys.a $(LDFLAGS) ++ ++testquorum1: testquorum1.o $(LIBRARIES) ++ $(CC) $(LDFLAGS) -o testquorum1 testquorum1.o $(LIBS) ++testquorum2: testquorum2.o $(LIBRARIES) ++ $(CC) $(LDFLAGS) -o testquorum2 testquorum2.o $(LIBS) ++ + logsys_s: logsys_s.o logsys_s1.o logsys_s2.o ../exec/liblogsys.a + $(CC) -o logsys_s logsys_s.o logsys_s1.o logsys_s2.o ../exec/liblogsys.a $(LDFLAGS) + +diff -Naurd corosync-0.92/test/sa_error.c corosync-trunk/test/sa_error.c +--- corosync-0.92/test/sa_error.c 2006-01-24 08:19:11.000000000 +0100 ++++ corosync-trunk/test/sa_error.c 2008-11-06 22:49:07.000000000 +0100 +@@ -6,39 +6,39 @@ + + const char *sa_error_list[] = { + "OUT_OF_RANGE", +- "SA_AIS_OK", +- "SA_AIS_ERR_LIBRARY", +- "SA_AIS_ERR_VERSION", +- "SA_AIS_ERR_INIT", +- "SA_AIS_ERR_TIMEOUT", +- "SA_AIS_ERR_TRY_AGAIN", +- "SA_AIS_ERR_INVALID_PARAM", +- "SA_AIS_ERR_NO_MEMORY", +- "SA_AIS_ERR_BAD_HANDLE", +- "SA_AIS_ERR_BUSY", +- "SA_AIS_ERR_ACCESS", +- "SA_AIS_ERR_NOT_EXIST", +- "SA_AIS_ERR_NAME_TOO_LONG", +- "SA_AIS_ERR_EXIST", +- "SA_AIS_ERR_NO_SPACE", +- "SA_AIS_ERR_INTERRUPT", +- "SA_AIS_ERR_NAME_NOT_FOUND", +- "SA_AIS_ERR_NO_RESOURCES", +- "SA_AIS_ERR_NOT_SUPPORTED", +- "SA_AIS_ERR_BAD_OPERATION", +- "SA_AIS_ERR_FAILED_OPERATION", +- "SA_AIS_ERR_MESSAGE_ERROR", +- "SA_AIS_ERR_QUEUE_FULL", +- "SA_AIS_ERR_QUEUE_NOT_AVAILABLE", +- "SA_AIS_ERR_BAD_CHECKPOINT", +- "SA_AIS_ERR_BAD_FLAGS", +- "SA_AIS_ERR_NO_SECTIONS", ++ "CS_OK", ++ "CS_ERR_LIBRARY", ++ "CS_ERR_VERSION", ++ "CS_ERR_INIT", ++ "CS_ERR_TIMEOUT", ++ "CS_ERR_TRY_AGAIN", ++ "CS_ERR_INVALID_PARAM", ++ "CS_ERR_NO_MEMORY", ++ "CS_ERR_BAD_HANDLE", ++ "CS_ERR_BUSY", ++ "CS_ERR_ACCESS", ++ "CS_ERR_NOT_EXIST", ++ "CS_ERR_NAME_TOO_LONG", ++ "CS_ERR_EXIST", ++ "CS_ERR_NO_SPACE", ++ "CS_ERR_INTERRUPT", ++ "CS_ERR_NAME_NOT_FOUND", ++ "CS_ERR_NO_RESOURCES", ++ "CS_ERR_NOT_SUPPORTED", ++ "CS_ERR_BAD_OPERATION", ++ "CS_ERR_FAILED_OPERATION", ++ "CS_ERR_MESSAGE_ERROR", ++ "CS_ERR_QUEUE_FULL", ++ "CS_ERR_QUEUE_NOT_AVAILABLE", ++ "CS_ERR_BAD_CHECKPOINT", ++ "CS_ERR_BAD_FLAGS", ++ "CS_ERR_NO_SECTIONS", + }; + +-int get_sa_error(SaAisErrorT error, char *str, int len) ++int get_sa_error(cs_error_t error, char *str, int len) + { +- if (error < SA_AIS_OK || +- error > SA_AIS_ERR_NO_SECTIONS || ++ if (error < CS_OK || ++ error > CS_ERR_NO_SECTIONS || + len < strlen(sa_error_list[error])) { + errno = EINVAL; + return -1; +@@ -47,11 +47,11 @@ + return 0; + } + +-char *get_sa_error_b (SaAisErrorT error) { ++char *get_sa_error_b (cs_error_t error) { + return ((char *)sa_error_list[error]); + } + +-char *get_test_output (SaAisErrorT result, SaAisErrorT expected) { ++char *get_test_output (cs_error_t result, cs_error_t expected) { + static char test_result[256]; + + if (result == expected) { +diff -Naurd corosync-0.92/test/sa_error.h corosync-trunk/test/sa_error.h +--- corosync-0.92/test/sa_error.h 2006-01-24 08:19:11.000000000 +0100 ++++ corosync-trunk/test/sa_error.h 2008-11-06 22:49:07.000000000 +0100 +@@ -1,5 +1,5 @@ +-extern int get_sa_error(SaAisErrorT error, char *str, int len); ++extern int get_sa_error(cs_error_t error, char *str, int len); + +-extern char *get_sa_error_b (SaAisErrorT error); ++extern char *get_sa_error_b (cs_error_t error); + +-extern char *get_test_output (SaAisErrorT result, SaAisErrorT expected); ++extern char *get_test_output (cs_error_t result, cs_error_t expected); +diff -Naurd corosync-0.92/test/testconfdb.c corosync-trunk/test/testconfdb.c +--- corosync-0.92/test/testconfdb.c 2008-09-03 09:58:08.000000000 +0200 ++++ corosync-trunk/test/testconfdb.c 2008-11-06 22:49:07.000000000 +0100 +@@ -41,7 +41,7 @@ + #include + #include + +-#include ++#include + #include + + #define INCDEC_VALUE 45 +@@ -68,13 +68,13 @@ + + /* Show the keys */ + res = confdb_key_iter_start(handle, parent_object_handle); +- if (res != SA_AIS_OK) { ++ if (res != CS_OK) { + printf( "error resetting key iterator for object %d: %d\n", parent_object_handle, res); + return; + } + + while ( (res = confdb_key_iter(handle, parent_object_handle, key_name, &key_name_len, +- key_value, &key_value_len)) == SA_AIS_OK) { ++ key_value, &key_value_len)) == CS_OK) { + key_name[key_name_len] = '\0'; + key_value[key_value_len] = '\0'; + for (i=0; i + #include + ++#include + #include + + void deliver( +@@ -70,17 +71,17 @@ + int fd; + + printf ("All of the nodeids should match on a single node configuration\n for the test to pass."); +- assert(CPG_OK==cpg_initialize(&handle, &cb)); +- assert(CPG_OK==cpg_local_get(handle,&nodeid)); ++ assert(CS_OK==cpg_initialize(&handle, &cb)); ++ assert(CS_OK==cpg_local_get(handle,&nodeid)); + printf("local_get: %x\n", nodeid); +- assert(CPG_OK==cpg_join(handle, &group)); ++ assert(CS_OK==cpg_join(handle, &group)); + struct iovec msg={"hello", 5}; +- assert(CPG_OK==cpg_mcast_joined(handle,CPG_TYPE_AGREED,&msg,1)); ++ assert(CS_OK==cpg_mcast_joined(handle,CPG_TYPE_AGREED,&msg,1)); + cpg_fd_get (handle, &fd); + pfd.fd = fd; + pfd.events = POLLIN; + + poll (&pfd, 1, 1000); +- cpg_dispatch(handle, CPG_DISPATCH_ALL); ++ cpg_dispatch(handle, CS_DISPATCH_ALL); + return (0); + } +diff -Naurd corosync-0.92/test/testcpg.c corosync-trunk/test/testcpg.c +--- corosync-0.92/test/testcpg.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/test/testcpg.c 2008-11-06 22:49:07.000000000 +0100 +@@ -45,7 +45,7 @@ + #include + #include + +-#include ++#include + #include + + static int quit = 0; +@@ -206,25 +206,25 @@ + } + + result = cpg_initialize (&handle, &callbacks); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not initialize Cluster Process Group API instance error %d\n", result); + exit (1); + } + result = cpg_local_get (handle, &nodeid); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not get local node id\n"); + exit (1); + } + + printf ("Local node id is %x\n", nodeid); + result = cpg_join(handle, &group_name); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not join process group, error %d\n", result); + exit (1); + } + + cpg_groups_get(handle, &num_groups); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not get list of groups, error %d\n", result); + exit (1); + } +@@ -255,7 +255,7 @@ + } + } + if (FD_ISSET (select_fd, &read_fds)) { +- if (cpg_dispatch (handle, CPG_DISPATCH_ALL) != SA_AIS_OK) ++ if (cpg_dispatch (handle, CS_DISPATCH_ALL) != CS_OK) + exit(1); + } + } while (result && !quit); +diff -Naurd corosync-0.92/test/testevs.c corosync-trunk/test/testevs.c +--- corosync-0.92/test/testevs.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/test/testevs.c 2008-11-06 22:49:07.000000000 +0100 +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include + + char *delivery_string; +@@ -99,7 +100,7 @@ + int main (void) + { + evs_handle_t handle; +- evs_error_t result; ++ cs_error_t result; + int i = 0; + int fd; + unsigned int member_list[32]; +@@ -107,7 +108,7 @@ + unsigned int member_list_entries = 32; + + result = evs_initialize (&handle, &callbacks); +- if (result != EVS_OK) { ++ if (result != CS_OK) { + printf ("Couldn't initialize EVS service %d\n", result); + exit (0); + } +@@ -142,15 +143,15 @@ + try_again_one: + result = evs_mcast_joined (handle, EVS_TYPE_AGREED, + &iov, 1); +- if (result == EVS_ERR_TRY_AGAIN) { ++ if (result == CS_ERR_TRY_AGAIN) { + //printf ("try again\n"); + goto try_again_one; + } +- result = evs_dispatch (handle, EVS_DISPATCH_ALL); ++ result = evs_dispatch (handle, CS_DISPATCH_ALL); + } + + do { +- result = evs_dispatch (handle, EVS_DISPATCH_ALL); ++ result = evs_dispatch (handle, CS_DISPATCH_ALL); + } while (deliveries < 20); + /* + * Demonstrate evs_mcast_joined +@@ -161,17 +162,17 @@ + try_again_two: + result = evs_mcast_groups (handle, EVS_TYPE_AGREED, + &groups[1], 1, &iov, 1); +- if (result == EVS_ERR_TRY_AGAIN) { ++ if (result == CS_ERR_TRY_AGAIN) { + goto try_again_two; + } + +- result = evs_dispatch (handle, EVS_DISPATCH_ALL); ++ result = evs_dispatch (handle, CS_DISPATCH_ALL); + } + /* + * Flush any pending callbacks + */ + do { +- result = evs_dispatch (handle, EVS_DISPATCH_ALL); ++ result = evs_dispatch (handle, CS_DISPATCH_ALL); + } while (deliveries < 500); + + evs_fd_get (handle, &fd); +diff -Naurd corosync-0.92/test/testquorum.c corosync-trunk/test/testquorum.c +--- corosync-0.92/test/testquorum.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/test/testquorum.c 2008-11-06 22:49:07.000000000 +0100 +@@ -0,0 +1,58 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static quorum_handle_t handle; ++ ++static void quorum_notification_fn( ++ quorum_handle_t handle, ++ uint32_t quorate, ++ uint64_t ring_id, ++ uint32_t view_list_entries, ++ uint32_t *view_list) ++{ ++ int i; ++ ++ printf("quorum notification called \n"); ++ printf(" quorate = %d\n", quorate); ++ printf(" ring id = %lld\n", ring_id); ++ printf(" num nodes = %d ", view_list_entries); ++ ++ for (i=0; i + #include + #include ++#include + #include + #include + #include +@@ -45,12 +46,12 @@ + #include + #include + +-#include ++#include + #include + + static void ringstatusget_do (void) + { +- SaAisErrorT result; ++ cs_error_t result; + corosync_cfg_handle_t handle; + unsigned int interface_count; + char **interface_names; +@@ -59,84 +60,160 @@ + + printf ("Printing ring status.\n"); + result = corosync_cfg_initialize (&handle, NULL); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not initialize corosync configuration API error %d\n", result); + exit (1); + } + +- corosync_cfg_ring_status_get (handle, +- &interface_names, +- &interface_status, +- &interface_count); +- +- for (i = 0; i < interface_count; i++) { +- printf ("RING ID %d\n", i); +- printf ("\tid\t= %s\n", interface_names[i]); +- printf ("\tstatus\t= %s\n", interface_status[i]); ++ result = corosync_cfg_ring_status_get (handle, ++ &interface_names, ++ &interface_status, ++ &interface_count); ++ if (result != CS_OK) { ++ printf ("Could not get the ring status, the error is: %d\n", result); ++ } else { ++ for (i = 0; i < interface_count; i++) { ++ printf ("RING ID %d\n", i); ++ printf ("\tid\t= %s\n", interface_names[i]); ++ printf ("\tstatus\t= %s\n", interface_status[i]); ++ } + } +- +- corosync_cfg_finalize (handle); ++ (void)corosync_cfg_finalize (handle); + } + + static void ringreenable_do (void) + { +- SaAisErrorT result; ++ cs_error_t result; + corosync_cfg_handle_t handle; + + printf ("Re-enabling all failed rings.\n"); + result = corosync_cfg_initialize (&handle, NULL); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not initialize corosync configuration API error %d\n", result); + exit (1); + } + + result = corosync_cfg_ring_reenable (handle); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not reenable ring error %d\n", result); + } + +- corosync_cfg_finalize (handle); ++ (void)corosync_cfg_finalize (handle); + } + + void service_load_do (char *service, unsigned int version) + { +- SaAisErrorT result; ++ cs_error_t result; + corosync_cfg_handle_t handle; + + printf ("Loading service '%s' version '%d'\n", service, version); + result = corosync_cfg_initialize (&handle, NULL); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not initialize corosync configuration API error %d\n", result); + exit (1); + } + result = corosync_cfg_service_load (handle, service, version); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not load service (error = %d)\n", result); + } +- corosync_cfg_finalize (handle); ++ (void)corosync_cfg_finalize (handle); + } + + void service_unload_do (char *service, unsigned int version) + { +- SaAisErrorT result; ++ cs_error_t result; + corosync_cfg_handle_t handle; + + printf ("Unloading service '%s' version '%d'\n", service, version); + result = corosync_cfg_initialize (&handle, NULL); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not initialize corosync configuration API error %d\n", result); + exit (1); + } + result = corosync_cfg_service_unload (handle, service, version); +- if (result != SA_AIS_OK) { ++ if (result != CS_OK) { + printf ("Could not unload service (error = %d)\n", result); + } +- corosync_cfg_finalize (handle); ++ (void)corosync_cfg_finalize (handle); ++} ++ ++void shutdown_callback (corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownFlagsT flags) ++{ ++ printf("shutdown callback called, flags = %d\n",flags); ++ ++ (void)corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES); ++} ++ ++void *shutdown_dispatch_thread(void *arg) ++{ ++ int res = CS_OK; ++ corosync_cfg_handle_t *handle = arg; ++ ++ while (res == CS_OK) { ++ res = corosync_cfg_dispatch(*handle, CS_DISPATCH_ALL); ++ if (res != CS_OK) ++ printf ("Could not dispatch cfg messages: %d\n", res); ++ } ++ return NULL; ++} ++ ++void shutdown_do() ++{ ++ cs_error_t result; ++ corosync_cfg_handle_t handle; ++ CorosyncCfgCallbacksT callbacks; ++ CorosyncCfgStateNotificationT notificationBuffer; ++ pthread_t dispatch_thread; ++ ++ printf ("Shutting down corosync\n"); ++ callbacks.corosyncCfgShutdownCallback = shutdown_callback; ++ ++ result = corosync_cfg_initialize (&handle, &callbacks); ++ if (result != CS_OK) { ++ printf ("Could not initialize corosync configuration API error %d\n", result); ++ exit (1); ++ } ++ ++ pthread_create(&dispatch_thread, NULL, shutdown_dispatch_thread, &handle); ++ ++ result = corosync_cfg_state_track (handle, ++ 0, ++ ¬ificationBuffer); ++ if (result != CS_OK) { ++ printf ("Could not start corosync cfg tracking error %d\n", result); ++ exit (1); ++ } ++ ++ result = corosync_cfg_try_shutdown (handle, COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST); ++ if (result != CS_OK) { ++ printf ("Could not shutdown (error = %d)\n", result); ++ } ++ ++ (void)corosync_cfg_finalize (handle); ++} ++ ++void killnode_do(unsigned int nodeid) ++{ ++ cs_error_t result; ++ corosync_cfg_handle_t handle; ++ ++ printf ("Killing node %d\n", nodeid); ++ result = corosync_cfg_initialize (&handle, NULL); ++ if (result != CS_OK) { ++ printf ("Could not initialize corosync configuration API error %d\n", result); ++ exit (1); ++ } ++ result = corosync_cfg_kill_node (handle, nodeid, "Killed by corosync-cfgtool"); ++ if (result != CS_OK) { ++ printf ("Could not kill node (error = %d)\n", result); ++ } ++ (void)corosync_cfg_finalize (handle); + } + ++ + void usage_do (void) + { +- printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version]\n\n"); ++ printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version] [-k] [nodeid]\n\n"); + printf ("A tool for displaying and configuring active parameters within corosync.\n"); + printf ("options:\n"); + printf ("\t-s\tDisplays the status of the current rings on this node.\n"); +@@ -144,15 +221,18 @@ + printf ("\t\tre-enable redundant ring operation.\n"); + printf ("\t-l\tLoad a service identified by name.\n"); + printf ("\t-u\tUnload a service identified by name.\n"); ++ printf ("\t-k\tKill a node identified by node id.\n"); ++ printf ("\t-h\tShutdown corosync cleanly on this node.\n"); + } + + int main (int argc, char *argv[]) { +- const char *options = "srl:u:v:"; ++ const char *options = "srl:u:v:k:h"; + int opt; + int service_load = 0; ++ unsigned int nodeid; + int service_unload = 0; +- char *service; +- unsigned int version; ++ char *service = NULL; ++ unsigned int version = 0; + + if (argc == 1) { + usage_do (); +@@ -173,17 +253,25 @@ + service_unload = 1; + service = strdup (optarg); + break; ++ case 'k': ++ nodeid = atoi (optarg); ++ killnode_do(nodeid); ++ break; ++ case 'h': ++ shutdown_do(); ++ break; + case 'v': + version = atoi (optarg); ++ break; + } + } + + if (service_load) { + service_load_do (service, version); +- } else ++ } else + if (service_unload) { + service_unload_do (service, version); + } +- ++ + return (0); + } +diff -Naurd corosync-0.92/tools/corosync-fplay.c corosync-trunk/tools/corosync-fplay.c +--- corosync-0.92/tools/corosync-fplay.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/tools/corosync-fplay.c 2008-11-11 18:25:22.000000000 +0100 +@@ -0,0 +1,485 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++unsigned int flt_data_size = 1000000; ++ ++unsigned int *flt_data; ++#define FDHEAD_INDEX (flt_data_size) ++#define FDTAIL_INDEX (flt_data_size + 1) ++ ++#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr)) ++ ++struct totem_ip_address { ++ unsigned int nodeid; ++ unsigned short family; ++ unsigned char addr[TOTEMIP_ADDRLEN]; ++} __attribute__((packed)); ++ ++struct memb_ring_id { ++ struct totem_ip_address rep; ++ unsigned long long seq; ++} __attribute__((packed)); ++ ++const char *totemip_print(struct totem_ip_address *addr) ++{ ++ static char buf[INET6_ADDRSTRLEN]; ++ ++ return inet_ntop(addr->family, addr->addr, buf, sizeof(buf)); ++} ++ ++char *print_string_len (unsigned char *str, unsigned int len) ++{ ++ unsigned int i; ++ static char buf[1024]; ++ memset (buf, 0, sizeof (buf)); ++ for (i = 0; i < len; i++) { ++ buf[i] = str[i]; ++ } ++ return (buf); ++} ++ ++void sync_printer_confchg_set_sync (void **record) ++{ ++ unsigned int *my_should_sync = record[0]; ++ printf ("Setting my_should_sync to %d\n", *my_should_sync); ++} ++ ++void sync_printer_set_sync_state (void **record) ++{ ++ unsigned int *my_sync_state = record[0]; ++ printf ("Setting my_sync_state to %d\n", *my_sync_state); ++} ++ ++void sync_printer_process_currentstate (void **record) ++{ ++ unsigned int *my_sync_state = record[0]; ++ printf ("Retrieving my_sync_state %d\n", *my_sync_state); ++} ++ ++void sync_printer_process_get_shouldsync (void **record) ++{ ++ unsigned int *my_should_sync = record[0]; ++ printf ("Getting my_should_sync %d\n", *my_should_sync); ++} ++ ++void sync_printer_checkpoint_release (void **record) ++{ ++ unsigned char *name = record[0]; ++ uint16_t *name_len = record[1]; ++ unsigned int *ckpt_id = record[2]; ++ unsigned int *from = record[3]; ++ ++ printf ("Checkpoint release name=[%s] id=[%d] from=[%d] len=[%d]\n", ++ print_string_len (name, *name_len), ++ *ckpt_id, ++ *from, ++ *name_len); ++} ++ ++void sync_printer_checkpoint_transmit (void **record) ++{ ++ unsigned char *name = record[0]; ++ uint16_t *name_len = record[1]; ++ unsigned int *ckpt_id = record[2]; ++ unsigned int *xmit_id = record[3]; ++ ++ printf ("xmit_id=[%d] Checkpoint transmit name=[%s] id=[%d]\n", ++ *xmit_id, print_string_len (name, *name_len), ++ *ckpt_id); ++} ++ ++void sync_printer_section_transmit (void **record) ++{ ++ unsigned char *ckpt_name = record[0]; ++ uint16_t *name_len = record[1]; ++ unsigned int *ckpt_id = record[2]; ++ unsigned int *xmit_id = record[3]; ++ unsigned char *section_name = record[4]; ++ uint16_t *section_name_len = record[5]; ++ ++ printf ("xmit_id=[%d] Section transmit checkpoint name=[%s] id=[%d] ", ++ *xmit_id, print_string_len (ckpt_name, *name_len), ++ *ckpt_id); ++ printf ("section=[%s]\n", ++ print_string_len (section_name, *section_name_len)); ++} ++void sync_printer_checkpoint_receive (void **record) ++{ ++ unsigned char *ckpt_name = record[0]; ++ uint16_t *name_len = record[1]; ++ unsigned int *ckpt_id = record[2]; ++ unsigned int *xmit_id = record[3]; ++ ++ printf ("xmit_id=[%d] Checkpoint receive checkpoint name=[%s] id=[%d]\n", ++ *xmit_id, print_string_len (ckpt_name, *name_len), *ckpt_id); ++} ++ ++void sync_printer_section_receive (void **record) ++{ ++ unsigned char *ckpt_name = record[0]; ++ uint16_t *name_len = record[1]; ++ unsigned int *ckpt_id = record[2]; ++ unsigned int *xmit_id = record[3]; ++ unsigned char *section_name = record[4]; ++ unsigned int *section_name_len = record[5]; ++ ++ printf ("xmit_id=[%d] Section receive checkpoint name=[%s] id=[%d] ", ++ *xmit_id, print_string_len (ckpt_name, *name_len), ++ *ckpt_id); ++ ++ printf ("section=[%s]\n", ++ print_string_len (section_name, *section_name_len)); ++} ++ ++void sync_printer_nada (void **record) ++{ ++printf ("nada\n"); ++} ++void sync_printer_confchg_fn (void **record) ++{ ++ unsigned int i; ++ ++ unsigned int *members = record[0]; ++ unsigned int *member_count = record[1]; ++ struct memb_ring_id *ring_id = record[2]; ++ struct in_addr addr; ++ ++ printf ("sync confchg fn ringid [ip=%s seq=%lld]\n", ++ totemip_print (&ring_id->rep), ++ ring_id->seq); ++ printf ("members [%d]:\n", *member_count); ++ for (i = 0; i < *member_count; i++) { ++ addr.s_addr = members[i]; ++ printf ("\tmember [%s]\n", inet_ntoa (addr)); ++ } ++} ++ ++void printer_totemsrp_mcast (void **record) ++{ ++ unsigned int *msgid = record[0]; ++ ++ printf ("totemsrp_mcast %d\n", *msgid); ++} ++ ++void printer_totemsrp_delv (void **record) ++{ ++ unsigned int *msgid = record[0]; ++ ++ printf ("totemsrp_delv %d\n", *msgid); ++} ++ ++void printer_totempg_mcast_fits (void **record) ++{ ++ unsigned int *index = record[0]; ++ unsigned int *iov_len = record[1]; ++ unsigned int *copy_len = record[2]; ++ unsigned int *fragment_size = record[3]; ++ unsigned int *max_packet_size = record[4]; ++ unsigned int *copy_base = record[5]; ++ unsigned char *next_fragment = record[6]; ++ ++ printf ("totempg_mcast index=[%d] iov_len=[%d] copy_len=[%d] fragment_size=[%d] max_packet_size=[%d] copy_base=[%d] next_fragment[%d]\n", ++ *index, *iov_len, *copy_len, *fragment_size, *max_packet_size, *copy_base, *next_fragment); ++} ++ ++void sync_printer_service_process (void **record) ++{ ++ struct memb_ring_id *ring_id = record[0]; ++ struct memb_ring_id *sync_ring_id = record[1]; ++ ++ printf ("sync service process callback ringid [ip=%s seq=%lld] ", ++ totemip_print (&ring_id->rep), ++ ring_id->seq); ++ printf ("sync ringid [ip=%s seq=%lld]\n", ++ totemip_print (&sync_ring_id->rep), ++ sync_ring_id->seq); ++} ++ ++struct printer_subsys_record_print { ++ int ident; ++ void (*print_fn)(void **record); ++ int record_length; ++}; ++ ++struct printer_subsys { ++ char *subsys; ++ struct printer_subsys_record_print *record_printers; ++ int record_printers_count; ++}; ++ ++#define LOGREC_ID_SYNC_CONFCHG_FN 0 ++#define LOGREC_ID_SYNC_SERVICE_PROCESS 1 ++ ++/* ++ * CKPT subsystem ++ */ ++#define LOGREC_ID_CONFCHG_SETSYNC 0 ++#define LOGREC_ID_SETSYNCSTATE 1 ++#define LOGREC_ID_SYNC_PROCESS_CURRENTSTATE 2 ++#define LOGREC_ID_SYNC_PROCESS_GETSHOULDSYNC 3 ++#define LOGREC_ID_SYNC_CHECKPOINT_TRANSMIT 4 ++#define LOGREC_ID_SYNC_SECTION_TRANSMIT 5 ++#define LOGREC_ID_SYNC_CHECKPOINT_RECEIVE 6 ++#define LOGREC_ID_SYNC_SECTION_RECEIVE 7 ++#define LOGREC_ID_SYNC_CHECKPOINT_RELEASE 8 ++ ++#define LOGREC_ID_TOTEMSRP_MCAST 0 ++#define LOGREC_ID_TOTEMSRP_DELV 1 ++#define LOGREC_ID_TOTEMPG_MCAST_FITS 2 ++ ++ ++struct printer_subsys_record_print record_print_sync[] = { ++ { ++ .ident = LOGREC_ID_SYNC_CONFCHG_FN, ++ .print_fn = sync_printer_confchg_fn, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_SERVICE_PROCESS, ++ .print_fn = sync_printer_service_process, ++ .record_length = 28 ++ } ++}; ++ ++struct printer_subsys_record_print record_print_ckpt[] = { ++ { ++ .ident = LOGREC_ID_CONFCHG_SETSYNC, ++ .print_fn = sync_printer_confchg_set_sync, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SETSYNCSTATE, ++ .print_fn = sync_printer_set_sync_state, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_PROCESS_CURRENTSTATE, ++ .print_fn = sync_printer_process_currentstate, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_PROCESS_GETSHOULDSYNC, ++ .print_fn = sync_printer_process_get_shouldsync, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_CHECKPOINT_TRANSMIT, ++ .print_fn = sync_printer_checkpoint_transmit, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_SECTION_TRANSMIT, ++ .print_fn = sync_printer_section_transmit, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_CHECKPOINT_RECEIVE, ++ .print_fn = sync_printer_checkpoint_receive, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_SECTION_RECEIVE, ++ .print_fn = sync_printer_section_receive, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_SYNC_CHECKPOINT_RELEASE, ++ .print_fn = sync_printer_checkpoint_release, ++ .record_length = 28 ++ } ++ ++}; ++struct printer_subsys_record_print record_print_totem[] = { ++ { ++ .ident = LOGREC_ID_TOTEMSRP_MCAST, ++ .print_fn = printer_totemsrp_mcast, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_TOTEMSRP_DELV, ++ .print_fn = printer_totemsrp_delv, ++ .record_length = 28 ++ }, ++ { ++ .ident = LOGREC_ID_TOTEMPG_MCAST_FITS, ++ .print_fn = printer_totempg_mcast_fits, ++ .record_length = 28 ++ } ++}; ++ ++struct printer_subsys printer_subsystems[] = { ++ { ++ .subsys = "SYNC", ++ .record_printers = record_print_sync, ++ .record_printers_count = sizeof (record_print_sync) / sizeof (struct printer_subsys_record_print) ++ }, ++ { ++ .subsys = "CKPT", ++ .record_printers = record_print_ckpt, ++ .record_printers_count = sizeof (record_print_ckpt) / sizeof (struct printer_subsys_record_print) ++ }, ++ { ++ .subsys = "TOTEM", ++ .record_printers = record_print_totem, ++ .record_printers_count = sizeof (record_print_totem) / sizeof (struct printer_subsys_record_print) ++ } ++}; ++ ++unsigned int printer_subsys_count = sizeof (printer_subsystems) / sizeof (struct printer_subsys); ++ ++unsigned int records_printed = 1; ++ ++unsigned int record[10000]; ++ ++/* ++ * Copy record, dealing with wrapping ++ */ ++int logsys_rec_get (int rec_idx) { ++ unsigned int rec_size; ++ int firstcopy, secondcopy; ++ ++ rec_size = flt_data[rec_idx]; ++ ++ firstcopy = rec_size; ++ secondcopy = 0; ++ if (firstcopy + rec_idx > flt_data_size) { ++ firstcopy = flt_data_size - rec_idx; ++ secondcopy -= firstcopy - rec_size; ++ } ++ memcpy (&record[0], &flt_data[rec_idx], firstcopy<<2); ++ if (secondcopy) { ++ memcpy (&record[firstcopy], &flt_data[0], secondcopy<<2); ++ } ++ return ((rec_idx + rec_size) % flt_data_size); ++} ++ ++void logsys_rec_print (void *record) ++{ ++ unsigned int *buf_uint32t = (unsigned int *)record; ++ unsigned int rec_size; ++ unsigned int rec_ident; ++ unsigned int line; ++ unsigned int arg_size_idx; ++ unsigned int i; ++ unsigned int j; ++ unsigned int rec_idx = 0; ++ unsigned int record_number; ++ unsigned int words_processed; ++ unsigned int found; ++ void *arguments[64]; ++ int arg_count = 0; ++ ++ rec_size = buf_uint32t[rec_idx]; ++ rec_ident = buf_uint32t[rec_idx+1]; ++ line = buf_uint32t[rec_idx+2]; ++ record_number = buf_uint32t[rec_idx+3]; ++ ++printf ("rec=[%d] ", record_number); ++ arg_size_idx = rec_idx + 4; ++ words_processed = 4; ++ for (i = 0; words_processed < rec_size; i++) { ++ arguments[arg_count++] = &buf_uint32t[arg_size_idx + 1]; ++ words_processed += buf_uint32t[arg_size_idx] + 1; ++ arg_size_idx += buf_uint32t[arg_size_idx] + 1; ++ ++ } ++ ++ found = 0; ++ for (i = 0; i < printer_subsys_count; i++) { ++ if (strcmp ((char *)arguments[0], printer_subsystems[i].subsys) == 0) { ++ for (j = 0; j < printer_subsystems[i].record_printers_count; j++) { ++ if (rec_ident == printer_subsystems[i].record_printers[j].ident) { ++ printer_subsystems[i].record_printers[j].print_fn (&arguments[3]); ++ found = 1; ++ } ++ } ++ } ++ } ++ if (rec_ident & LOGSYS_TAG_LOG) { ++ printf ("Log Message=%s\n", (char *)arguments[3]); ++ found = 1; ++ } ++ if (rec_ident & LOGSYS_TAG_ENTER) { ++ printf ("ENTERING function [%s] line [%d]\n", (char *)arguments[2], line); ++ found = 1; ++ } ++ if (rec_ident & LOGSYS_TAG_LEAVE) { ++ printf ("LEAVING function [%s] line [%d]\n", (char *)arguments[2], line); ++ found = 1; ++ } ++ if (found == 0) { ++ printf ("Unknown record type found subsys=[%s] ident=[%d]\n", ++ (char *)arguments[0], rec_ident); ++ } ++ ++ ++ if (rec_ident == 999) { ++ printf ("ENTERING function [%s] line [%d]\n", (char *)arguments[2], line); ++ found = 1; ++ } ++ if (rec_ident == 1000) { ++ printf ("LEAVING function [%s] line [%d]\n", (char *)arguments[2], line); ++ found = 1; ++ } ++ if (found == 0) { ++ printf ("Unknown record type found subsys=[%s] ident=[%d]\n", ++ (char *)arguments[0], rec_ident); ++ } ++ ++ ++#ifdef COMPILE_OUT ++printf ("\n"); ++#endif ++} ++ ++int main (void) ++{ ++ unsigned int fd; ++ int rec_idx; ++ int end_rec; ++ int record_count = 1; ++ int size_read; ++ ++ flt_data = malloc ((flt_data_size + 2) * sizeof (unsigned int)); ++ fd = open ("/var/lib/corosync/fdata", O_RDONLY); ++ size_read = (int)read (fd, flt_data, (flt_data_size + 2) * sizeof (unsigned int)); ++ ++ if (size_read != (flt_data_size + 2) * sizeof (unsigned int)) { ++ printf ("Warning: read %d bytes, but expected %d\n", ++ size_read, (flt_data_size + 2) * sizeof (unsigned int)); ++ } ++ ++ rec_idx = flt_data[FDTAIL_INDEX]; ++ end_rec = flt_data[FDHEAD_INDEX]; ++ ++ printf ("Starting replay: head [%d] tail [%d]\n", ++ flt_data[FDHEAD_INDEX], ++ flt_data[FDTAIL_INDEX]); ++ ++ for (;;) { ++ rec_idx = logsys_rec_get (rec_idx); ++ logsys_rec_print (record); ++ if (rec_idx == end_rec) { ++ break; ++ } ++ record_count += 1; ++ } ++ ++ printf ("Finishing replay: records found [%d]\n", record_count); ++ return (0); ++} +diff -Naurd corosync-0.92/tools/corosync-keygen.c corosync-trunk/tools/corosync-keygen.c +--- corosync-0.92/tools/corosync-keygen.c 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/tools/corosync-keygen.c 2008-11-11 19:13:47.000000000 +0100 +@@ -44,7 +44,7 @@ + int authkey_fd; + int random_fd; + unsigned char key[128]; +- int res; ++ ssize_t res; + + printf ("Corosync Cluster Engine Authentication key generator.\n"); + if (geteuid() != 0) { +@@ -80,7 +80,7 @@ + /* + * Set security of authorization key to uid = 0 uid = 0 mode = 0400 + */ +- res = fchown (authkey_fd, 0, 0); ++ fchown (authkey_fd, 0, 0); + fchmod (authkey_fd, 0400); + + printf ("Writing corosync key to /etc/ais/authkey.\n"); +diff -Naurd corosync-0.92/tools/corosync-objctl.c corosync-trunk/tools/corosync-objctl.c +--- corosync-0.92/tools/corosync-objctl.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/tools/corosync-objctl.c 2008-12-08 17:11:07.000000000 +0100 +@@ -32,6 +32,7 @@ + * THE POSSIBILITY OF SUCH DAMAGE. + */ + ++#include + #include + #include + #include +@@ -41,7 +42,7 @@ + #include + #include + +-#include ++#include + #include + + #define SEPERATOR '.' +@@ -104,12 +105,12 @@ + int key_name_len; + char key_value[OBJ_NAME_SIZE]; + int key_value_len; +- confdb_error_t res; ++ cs_error_t res; + int children_printed; + + /* Show the keys */ + res = confdb_key_iter_start(handle, parent_object_handle); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf(stderr, "error resetting key iterator for object %d: %d\n", parent_object_handle, res); + exit(EXIT_FAILURE); + } +@@ -120,7 +121,7 @@ + key_name, + &key_name_len, + key_value, +- &key_value_len)) == CONFDB_OK) { ++ &key_value_len)) == CS_OK) { + key_name[key_name_len] = '\0'; + key_value[key_value_len] = '\0'; + if (parent_name != NULL) +@@ -133,7 +134,7 @@ + + /* Show sub-objects */ + res = confdb_object_iter_start(handle, parent_object_handle); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf(stderr, "error resetting object iterator for object %d: %d\n", parent_object_handle, res); + exit(EXIT_FAILURE); + } +@@ -142,7 +143,7 @@ + parent_object_handle, + &object_handle, + object_name, +- &object_name_len)) == CONFDB_OK) { ++ &object_name_len)) == CS_OK) { + + object_name[object_name_len] = '\0'; + if (parent_name != NULL) { +@@ -165,7 +166,7 @@ + int result; + + result = confdb_initialize (&handle, &callbacks); +- if (result != CONFDB_OK) { ++ if (result != CS_OK) { + fprintf (stderr, "Could not initialize objdb library. Error %d\n", result); + return 1; + } +@@ -181,22 +182,23 @@ + static int print_help(void) + { + printf("\n"); +- printf ("usage: corosync-objctl object%ckey ...\n", SEPERATOR); +- printf (" corosync-objctl -c object%cchild_obj ...\n", SEPERATOR); +- printf (" corosync-objctl -d object%cchild_obj ...\n", SEPERATOR); +- printf (" corosync-objctl -w object%cchild_obj.key=value ...\n", SEPERATOR); +- printf (" corosync-objctl -a (print all objects)\n"); ++ printf ("usage: corosync-objctl object%ckey ... Print an object\n", SEPERATOR); ++ printf (" corosync-objctl -c object%cchild_obj ... Create Object\n", SEPERATOR); ++ printf (" corosync-objctl -d object%cchild_obj ... Delete object\n", SEPERATOR); ++ printf (" corosync-objctl -w object%cchild_obj.key=value ... Create a key\n", SEPERATOR); ++ printf (" corosync-objctl -t object%cchild_obj ... Track changes\n", SEPERATOR); ++ printf (" corosync-objctl -a Print all objects\n"); + printf("\n"); + return 0; + } + +-static confdb_error_t validate_name(char * obj_name_pt) ++static cs_error_t validate_name(char * obj_name_pt) + { + if ((strchr (obj_name_pt, SEPERATOR) == NULL) && + (strchr (obj_name_pt, '=') == NULL)) +- return CONFDB_OK; ++ return CS_OK; + else +- return CONFDB_ERR_INVALID_PARAM; ++ return CS_ERR_INVALID_PARAM; + } + + void get_child_name(char * name_pt, char * child_name) +@@ -251,7 +253,7 @@ + strcpy(key_name, tmp+1); + } + +-static confdb_error_t find_object (confdb_handle_t handle, ++static cs_error_t find_object (confdb_handle_t handle, + char * name_pt, + find_object_of_type_t type, + uint32_t * out_handle) +@@ -261,21 +263,21 @@ + uint32_t obj_handle; + confdb_handle_t parent_object_handle = OBJECT_PARENT_HANDLE; + char tmp_name[OBJ_NAME_SIZE]; +- confdb_error_t res; ++ cs_error_t res; + + strncpy (tmp_name, name_pt, OBJ_NAME_SIZE); + obj_name_pt = strtok_r(tmp_name, SEPERATOR_STR, &save_pt); + + while (obj_name_pt != NULL) { + res = confdb_object_find_start(handle, parent_object_handle); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf (stderr, "Could not start object_find %d\n", res); + exit (EXIT_FAILURE); + } + + res = confdb_object_find(handle, parent_object_handle, + obj_name_pt, strlen (obj_name_pt), &obj_handle); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + return res; + } + +@@ -291,11 +293,11 @@ + { + char parent_name[OBJ_NAME_SIZE]; + uint32_t obj_handle; +- confdb_error_t res; ++ cs_error_t res; + + get_parent_name(name_pt, parent_name); + res = find_object (handle, name_pt, FIND_OBJECT_OR_KEY, &obj_handle); +- if (res == CONFDB_OK) { ++ if (res == CS_OK) { + print_config_tree(handle, obj_handle, parent_name); + } + } +@@ -308,19 +310,19 @@ + char key_value[OBJ_NAME_SIZE]; + char old_key_value[OBJ_NAME_SIZE]; + int old_key_value_len; +- confdb_error_t res; ++ cs_error_t res; + + /* find the parent object */ + get_parent_name(path_pt, parent_name); + get_key(path_pt, key_name, key_value); + +- if (validate_name(key_name) != CONFDB_OK) { ++ if (validate_name(key_name) != CS_OK) { + fprintf(stderr, "Incorrect key name, can not have \"=\" or \"%c\"\n", SEPERATOR); + exit(EXIT_FAILURE); + } + res = find_object (handle, parent_name, FIND_OBJECT_ONLY, &obj_handle); + +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf(stderr, "Can't find parent object of \"%s\"\n", path_pt); + exit(EXIT_FAILURE); + } +@@ -333,7 +335,7 @@ + old_key_value, + &old_key_value_len); + +- if (res == CONFDB_OK) { ++ if (res == CS_OK) { + /* replace the current value */ + res = confdb_key_replace (handle, + obj_handle, +@@ -344,7 +346,7 @@ + key_value, + strlen(key_value)); + +- if (res != CONFDB_OK) ++ if (res != CS_OK) + fprintf(stderr, "Failed to replace the key %s=%s. Error %d\n", key_name, key_value, res); + } else { + /* not there, create a new key */ +@@ -354,7 +356,7 @@ + strlen(key_name), + key_value, + strlen(key_value)); +- if (res != CONFDB_OK) ++ if (res != CS_OK) + fprintf(stderr, "Failed to create the key %s=%s. Error %d\n", key_name, key_value, res); + } + +@@ -367,23 +369,23 @@ + uint32_t obj_handle; + uint32_t parent_object_handle = OBJECT_PARENT_HANDLE; + char tmp_name[OBJ_NAME_SIZE]; +- confdb_error_t res; ++ cs_error_t res; + + strncpy (tmp_name, name_pt, OBJ_NAME_SIZE); + obj_name_pt = strtok_r(tmp_name, SEPERATOR_STR, &save_pt); + + while (obj_name_pt != NULL) { + res = confdb_object_find_start(handle, parent_object_handle); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf (stderr, "Could not start object_find %d\n", res); + exit (EXIT_FAILURE); + } + + res = confdb_object_find(handle, parent_object_handle, + obj_name_pt, strlen (obj_name_pt), &obj_handle); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + +- if (validate_name(obj_name_pt) != CONFDB_OK) { ++ if (validate_name(obj_name_pt) != CS_OK) { + fprintf(stderr, "Incorrect object name \"%s\", \"=\" not allowed.\n", + obj_name_pt); + exit(EXIT_FAILURE); +@@ -393,7 +395,7 @@ + obj_name_pt, + strlen (obj_name_pt), + &obj_handle); +- if (res != CONFDB_OK) ++ if (res != CS_OK) + fprintf(stderr, "Failed to create object \"%s\". Error %d.\n", + obj_name_pt, res); + } +@@ -449,10 +451,13 @@ + int result; + fd_set read_fds; + int select_fd; +- SaBoolT quit = SA_FALSE; ++ int quit = CS_FALSE; + + FD_ZERO (&read_fds); +- confdb_fd_get(handle, &select_fd); ++ if (confdb_fd_get (handle, &select_fd) != CS_OK) { ++ printf ("can't get the confdb selector object.\n"); ++ return; ++ } + printf ("Type \"q\" to finish\n"); + do { + FD_SET (select_fd, &read_fds); +@@ -464,35 +469,36 @@ + if (FD_ISSET (STDIN_FILENO, &read_fds)) { + char inbuf[3]; + +- fgets(inbuf, sizeof(inbuf), stdin); +- if (strncmp(inbuf, "q", 1) == 0) +- quit = SA_TRUE; ++ if (fgets(inbuf, sizeof(inbuf), stdin) == NULL) ++ quit = CS_TRUE; ++ else if (strncmp(inbuf, "q", 1) == 0) ++ quit = CS_TRUE; + } + if (FD_ISSET (select_fd, &read_fds)) { +- if (confdb_dispatch (handle, CONFDB_DISPATCH_ALL) != CONFDB_OK) ++ if (confdb_dispatch (handle, CONFDB_DISPATCH_ALL) != CS_OK) + exit(1); + } +- } while (result && quit == SA_FALSE); ++ } while (result && quit == CS_FALSE); + +- confdb_stop_track_changes(handle); ++ (void)confdb_stop_track_changes(handle); + + } + + static void track_object(confdb_handle_t handle, char * name_pt) + { +- confdb_error_t res; ++ cs_error_t res; + uint32_t obj_handle; + + res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle); + +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf (stderr, "Could not find object \"%s\". Error %d\n", + name_pt, res); + return; + } + + res = confdb_track_changes (handle, obj_handle, CONFDB_TRACK_DEPTH_RECURSIVE); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf (stderr, "Could not enable tracking on object \"%s\". Error %d\n", + name_pt, res); + return; +@@ -501,10 +507,10 @@ + + static void stop_tracking(confdb_handle_t handle) + { +- confdb_error_t res; ++ cs_error_t res; + + res = confdb_stop_track_changes (handle); +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf (stderr, "Could not stop tracking. Error %d\n", res); + return; + } +@@ -512,14 +518,14 @@ + + static void delete_object(confdb_handle_t handle, char * name_pt) + { +- confdb_error_t res; ++ cs_error_t res; + uint32_t obj_handle; + res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle); + +- if (res == CONFDB_OK) { ++ if (res == CS_OK) { + res = confdb_object_destroy (handle, obj_handle); + +- if (res != CONFDB_OK) ++ if (res != CS_OK) + fprintf(stderr, "Failed to find object \"%s\" to delete. Error %d\n", name_pt, res); + } else { + char parent_name[OBJ_NAME_SIZE]; +@@ -531,7 +537,7 @@ + get_key(name_pt, key_name, key_value); + res = find_object (handle, parent_name, FIND_OBJECT_ONLY, &obj_handle); + +- if (res != CONFDB_OK) { ++ if (res != CS_OK) { + fprintf(stderr, "Failed to find the key's parent object \"%s\". Error %d\n", parent_name, res); + exit (EXIT_FAILURE); + } +@@ -543,7 +549,7 @@ + key_value, + strlen(key_value)); + +- if (res != CONFDB_OK) ++ if (res != CS_OK) + fprintf(stderr, "Failed to delete key \"%s=%s\" from object \"%s\". Error %d\n", + key_name, key_value, parent_name, res); + } +@@ -552,8 +558,8 @@ + + int main (int argc, char *argv[]) { + confdb_handle_t handle; +- confdb_error_t result; +- char c; ++ cs_error_t result; ++ int c; + + action = ACTION_READ; + +@@ -603,7 +609,7 @@ + } + + result = confdb_initialize (&handle, &callbacks); +- if (result != CONFDB_OK) { ++ if (result != CS_OK) { + fprintf (stderr, "Failed to initialize the objdb API. Error %d\n", result); + exit (EXIT_FAILURE); + } +@@ -633,7 +639,7 @@ + } + + result = confdb_finalize (handle); +- if (result != CONFDB_OK) { ++ if (result != CS_OK) { + fprintf (stderr, "Error finalizing objdb API. Error %d\n", result); + exit(EXIT_FAILURE); + } +diff -Naurd corosync-0.92/tools/corosync-pload.c corosync-trunk/tools/corosync-pload.c +--- corosync-0.92/tools/corosync-pload.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/tools/corosync-pload.c 2008-11-06 22:49:07.000000000 +0100 +@@ -0,0 +1,76 @@ ++/* ++ * Copyright (c) 2008 Red Hat, Inc. ++ * ++ * All rights reserved. ++ * ++ * Author: 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#define timersub(a, b, result) \ ++do { \ ++ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ ++ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ ++ if ((result)->tv_usec < 0) { \ ++ --(result)->tv_sec; \ ++ (result)->tv_usec += 1000000; \ ++ } \ ++} while (0) ++ ++int main (void) { ++ pload_error_t result; ++ pload_handle_t handle; ++ ++ result = pload_initialize (&handle, NULL); ++ printf ("Init result %d\n", result); ++ result = pload_start ( ++ handle, ++ 0, /* code */ ++ 150000000, /* count */ ++ 300); /* size */ ++ return (0); ++} +diff -Naurd corosync-0.92/tools/Makefile corosync-trunk/tools/Makefile +--- corosync-0.92/tools/Makefile 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/tools/Makefile 2008-11-11 18:28:22.000000000 +0100 +@@ -41,8 +41,8 @@ + override LDFLAGS += -lnsl -lsocket -lrt + endif + +-LIBS = ../lib/libconfdb.a ../lib/libcfg.a +-BINARIES=corosync-objctl corosync-cfgtool corosync-keygen ++LIBS = ../lib/libconfdb.a ../lib/libcfg.a ../lib/libpload.a ++BINARIES=corosync-objctl corosync-cfgtool corosync-keygen corosync-fplay corosync-pload + APPS_SRC=$(addsuffix .c,$(BINARIES)) + EXTRA_CFLAGS = -I$(srcdir)include + +@@ -57,9 +57,22 @@ + corosync-keygen: corosync-keygen.o + $(CC) $(LDFLAGS) -o $@ $< + ++corosync-fplay: corosync-fplay.o ++ $(CC) $(LDFLAGS) -o $@ $< ++ ++corosync-pload: corosync-pload.o ++ $(CC) $(LDFLAGS) -o $@ $< $(LIBS) ++ + clean: + rm -f *.o $(BINARIES) + ++lint: ++ -splint $(LINT_FLAGS) $(CFLAGS) corosync-objctl.c ++ -splint $(LINT_FLAGS) $(CFLAGS) corosync-cfgtool.c ++ -splint $(LINT_FLAGS) $(CFLAGS) corosync-keygen.c ++ -splint $(LINT_FLAGS) $(CFLAGS) corosync-fplay.c ++ -splint $(LINT_FLAGS) $(CFLAGS) corosync-pload.c ++ + %.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< + diff --git a/corosync.spec b/corosync.spec index d15f780..1ee6f6f 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,11 +1,14 @@ +%define alphatag svn1707 + Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.92 -Release: 3%{?alphatag:.%{alphatag}}%{?dist} +Release: 4%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz +Patch0: corosync-trunk-1707.diff BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(pre): /usr/sbin/useradd @@ -30,6 +33,7 @@ The Corosync Cluster Engine APIs. %prep %setup -q -n corosync-%{version} +%patch0 -p1 %build @@ -89,6 +93,9 @@ fi %{_libexecdir}/lcrso/service_cpg.lcrso %{_libexecdir}/lcrso/service_evs.lcrso %{_libexecdir}/lcrso/service_confdb.lcrso +%{_libexecdir}/lcrso/service_pload.lcrso +%{_libexecdir}/lcrso/testquorum.lcrso +%{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso %dir %{_libdir}/corosync %{_libdir}/corosync/libcfg.so.* @@ -107,10 +114,10 @@ fi %dir %{_docdir}/%{name}-%{version} %doc %{_docdir}/%{name}-%{version}/README.devmap %dir %{_includedir}/corosync/ -%{_includedir}/corosync/saAis.h %{_includedir}/corosync/ais_util.h %{_includedir}/corosync/cfg.h %{_includedir}/corosync/confdb.h +%{_includedir}/corosync/corotypes.h %{_includedir}/corosync/cpg.h %{_includedir}/corosync/evs.h %{_includedir}/corosync/hdb.h @@ -148,6 +155,10 @@ fi %{_mandir}/man8/logsys_overview.8* %changelog +* Wed Dec 10 2008 Fabio M. Di Nitto - 0.92-4.svn1707 +- Update to svn trunk at revision 1707 from upstream. +- Update spec file to include new lcrso services and include file. + * Mon Oct 13 2008 Dennis Gilmore - 0.92-3 - remove ExclusiveArch line From 7fcf8fa1b527e5d491acbd0124a7ed701cbcafe9 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 15 Dec 2008 18:15:18 +0000 Subject: [PATCH 003/185] Update to new svn snapshot --- ...runk-1707.diff => corosync-trunk-1709.diff | 253 +++++++++++++++++- corosync.spec | 11 +- 2 files changed, 260 insertions(+), 4 deletions(-) rename corosync-trunk-1707.diff => corosync-trunk-1709.diff (98%) diff --git a/corosync-trunk-1707.diff b/corosync-trunk-1709.diff similarity index 98% rename from corosync-trunk-1707.diff rename to corosync-trunk-1709.diff index 4f343b8..072cedc 100644 --- a/corosync-trunk-1707.diff +++ b/corosync-trunk-1709.diff @@ -3581,6 +3581,249 @@ diff -Naurd corosync-0.92/exec/timer.c corosync-trunk/exec/timer.c #include #include #include +diff -Naurd corosync-0.92/exec/totemconfig.c corosync-trunk/exec/totemconfig.c +--- corosync-0.92/exec/totemconfig.c 2008-08-20 02:57:40.000000000 +0200 ++++ corosync-trunk/exec/totemconfig.c 2008-12-12 12:27:27.000000000 +0100 +@@ -76,6 +76,13 @@ + #define RRP_PROBLEM_COUNT_THRESHOLD_MIN 5 + + static char error_string_response[512]; ++static struct objdb_iface_ver0 *global_objdb; ++ ++static void add_totem_config_notification( ++ struct objdb_iface_ver0 *objdb, ++ struct totem_config *totem_config, ++ unsigned int totem_object_handle); ++ + + /* These just makes the code below a little neater */ + static inline int objdb_get_string ( +@@ -163,6 +170,50 @@ + return (0); + } + ++static void totem_volatile_config_read ( ++ struct objdb_iface_ver0 *objdb, ++ struct totem_config *totem_config, ++ unsigned int object_totem_handle) ++{ ++ objdb_get_int (objdb,object_totem_handle, "token", &totem_config->token_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "token_retransmit", &totem_config->token_retransmit_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "hold", &totem_config->token_hold_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "token_retransmits_before_loss_const", &totem_config->token_retransmits_before_loss_const); ++ ++ objdb_get_int (objdb,object_totem_handle, "join", &totem_config->join_timeout); ++ objdb_get_int (objdb,object_totem_handle, "send_join", &totem_config->send_join_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "consensus", &totem_config->consensus_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "merge", &totem_config->merge_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "downcheck", &totem_config->downcheck_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "fail_recv_const", &totem_config->fail_to_recv_const); ++ ++ objdb_get_int (objdb,object_totem_handle, "seqno_unchanged_const", &totem_config->seqno_unchanged_const); ++ ++ objdb_get_int (objdb,object_totem_handle, "rrp_token_expired_timeout", &totem_config->rrp_token_expired_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_timeout", &totem_config->rrp_problem_count_timeout); ++ ++ objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_threshold", &totem_config->rrp_problem_count_threshold); ++ ++ objdb_get_int (objdb,object_totem_handle, "heartbeat_failures_allowed", &totem_config->heartbeat_failures_allowed); ++ ++ objdb_get_int (objdb,object_totem_handle, "max_network_delay", &totem_config->max_network_delay); ++ ++ objdb_get_int (objdb,object_totem_handle, "window_size", &totem_config->window_size); ++ objdb_get_string (objdb, object_totem_handle, "vsftype", &totem_config->vsf_type); ++ ++ objdb_get_int (objdb,object_totem_handle, "max_messages", &totem_config->max_messages); ++ ++} ++ ++ + extern int totem_config_read ( + struct objdb_iface_ver0 *objdb, + struct totem_config *totem_config, +@@ -222,41 +273,10 @@ + + objdb_get_int (objdb,object_totem_handle, "netmtu", &totem_config->net_mtu); + +- objdb_get_int (objdb,object_totem_handle, "token", &totem_config->token_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "token_retransmit", &totem_config->token_retransmit_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "hold", &totem_config->token_hold_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "token_retransmits_before_loss_const", &totem_config->token_retransmits_before_loss_const); +- +- objdb_get_int (objdb,object_totem_handle, "join", &totem_config->join_timeout); +- objdb_get_int (objdb,object_totem_handle, "send_join", &totem_config->send_join_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "consensus", &totem_config->consensus_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "merge", &totem_config->merge_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "downcheck", &totem_config->downcheck_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "fail_recv_const", &totem_config->fail_to_recv_const); +- +- objdb_get_int (objdb,object_totem_handle, "seqno_unchanged_const", &totem_config->seqno_unchanged_const); +- +- objdb_get_int (objdb,object_totem_handle, "rrp_token_expired_timeout", &totem_config->rrp_token_expired_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_timeout", &totem_config->rrp_problem_count_timeout); +- +- objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_threshold", &totem_config->rrp_problem_count_threshold); +- +- objdb_get_int (objdb,object_totem_handle, "heartbeat_failures_allowed", &totem_config->heartbeat_failures_allowed); +- +- objdb_get_int (objdb,object_totem_handle, "max_network_delay", &totem_config->max_network_delay); +- +- objdb_get_int (objdb,object_totem_handle, "window_size", &totem_config->window_size); +- objdb_get_string (objdb, object_totem_handle, "vsftype", &totem_config->vsf_type); +- +- objdb_get_int (objdb,object_totem_handle, "max_messages", &totem_config->max_messages); ++ /* ++ * Get things that might change in the future ++ */ ++ totem_volatile_config_read (objdb, totem_config, object_totem_handle); + + objdb->object_find_create ( + object_totem_handle, +@@ -297,6 +317,8 @@ + + objdb->object_find_destroy (object_find_interface_handle); + ++ add_totem_config_notification(objdb, totem_config, object_totem_handle); ++ + return 0; + } + +@@ -323,7 +345,7 @@ + error_reason = "No multicast address specified"; + goto parse_error; + } +- ++ + if (totem_config->interfaces[i].ip_port == 0) { + error_reason = "No multicast port specified"; + goto parse_error; +@@ -331,7 +353,7 @@ + + if (totem_config->interfaces[i].mcast_addr.family == AF_INET6 && + totem_config->node_id == 0) { +- ++ + error_reason = "An IPV6 network requires that a node ID be specified."; + goto parse_error; + } +@@ -498,7 +520,7 @@ + totem_config->rrp_token_expired_timeout = + totem_config->token_retransmit_timeout; + } +- ++ + if (totem_config->rrp_token_expired_timeout < MINIMUM_TIMEOUT) { + sprintf (local_error_reason, "The RRP token expired timeout parameter (%d ms) may not be less then (%d ms).", + totem_config->rrp_token_expired_timeout, MINIMUM_TIMEOUT); +@@ -658,3 +680,92 @@ + return (-1); + + } ++ ++static void totem_key_change_notify(object_change_type_t change_type, ++ unsigned int parent_object_handle, ++ unsigned int object_handle, ++ void *object_name_pt, int object_name_len, ++ void *key_name_pt, int key_len, ++ void *key_value_pt, int key_value_len, ++ void *priv_data_pt) ++{ ++ struct totem_config *totem_config = priv_data_pt; ++ ++ if (memcmp(object_name_pt, "totem", object_name_len) == 0) ++ totem_volatile_config_read(global_objdb, ++ totem_config, ++ object_handle); // CHECK ++} ++ ++static void totem_objdb_reload_notify(objdb_reload_notify_type_t type, int flush, ++ void *priv_data_pt) ++{ ++ struct totem_config *totem_config = priv_data_pt; ++ unsigned int totem_object_handle; ++ ++ /* ++ * A new totem {} key might exist, cancel the ++ * existing notification at the start of reload, ++ * and start a new one on the new object when ++ * it's all settled. ++ */ ++ ++ if (type == OBJDB_RELOAD_NOTIFY_START) { ++ global_objdb->object_track_stop( ++ totem_key_change_notify, ++ NULL, ++ NULL, ++ NULL, ++ NULL); ++ } ++ ++ if (type == OBJDB_RELOAD_NOTIFY_END || ++ type == OBJDB_RELOAD_NOTIFY_FAILED) { ++ ++ ++ if (!totem_handle_find(global_objdb, ++ &totem_object_handle)) { ++ add_totem_config_notification(global_objdb, totem_config, totem_object_handle); ++ ++ /* ++ * Reload the configuration ++ */ ++ totem_volatile_config_read(global_objdb, ++ totem_config, ++ totem_object_handle); ++ ++ } ++ else { ++ log_printf(LOG_LEVEL_ERROR, "totem objdb tracking stopped, cannot find totem{} handle on objdb\n"); ++ } ++ } ++} ++ ++ ++static void add_totem_config_notification( ++ struct objdb_iface_ver0 *objdb, ++ struct totem_config *totem_config, ++ unsigned int totem_object_handle) ++{ ++ ++ global_objdb = objdb; ++ objdb->object_track_start(totem_object_handle, ++ 1, ++ totem_key_change_notify, ++ NULL, // object_create_notify, ++ NULL, // object_destroy_notify, ++ NULL, // object_reload_notify ++ totem_config); // priv_data ++ ++ /* ++ * Reload notify must be on the parent object ++ */ ++ objdb->object_track_start(OBJECT_PARENT_HANDLE, ++ 1, ++ NULL, // key_change_notify, ++ NULL, // object_create_notify, ++ NULL, // object_destroy_notify, ++ totem_objdb_reload_notify, // object_reload_notify ++ totem_config); // priv_data ++ ++} diff -Naurd corosync-0.92/exec/totemconfig.h corosync-trunk/exec/totemconfig.h --- corosync-0.92/exec/totemconfig.h 2008-08-14 18:44:26.000000000 +0200 +++ corosync-trunk/exec/totemconfig.h 2008-11-06 22:49:07.000000000 +0100 @@ -11964,7 +12207,7 @@ diff -Naurd corosync-0.92/lib/util.h corosync-trunk/lib/util.h SaVersionT *version); diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile --- corosync-0.92/Makefile 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/Makefile 2008-11-06 22:49:07.000000000 +0100 ++++ corosync-trunk/Makefile 2008-12-11 10:42:17.000000000 +0100 @@ -115,10 +115,17 @@ (cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean)); rm -rf $(builddir)doc/api @@ -11984,6 +12227,14 @@ diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile EXEC_LIBS = totem_pg logsys +@@ -196,6 +203,7 @@ + install -m 644 $(srcdir)include/corosync/engine/coroapi.h $(DESTDIR)$(INCLUDEDIR_ENGINE) + install -m 644 $(srcdir)include/corosync/engine/objdb.h $(DESTDIR)$(INCLUDEDIR_ENGINE) + install -m 644 $(srcdir)include/corosync/engine/logsys.h $(DESTDIR)$(INCLUDEDIR_ENGINE) ++ install -m 644 $(srcdir)include/corosync/engine/quorum.h $(DESTDIR)$(INCLUDEDIR_ENGINE) + install -m 644 $(srcdir)include/corosync/engine/config.h $(DESTDIR)$(INCLUDEDIR_ENGINE) + install -m 644 $(srcdir)man/*.3 $(DESTDIR)$(MANDIR)/man3 + install -m 644 $(srcdir)man/*.5 $(DESTDIR)$(MANDIR)/man5 diff -Naurd corosync-0.92/Makefile.inc corosync-trunk/Makefile.inc --- corosync-0.92/Makefile.inc 2008-09-03 09:58:08.000000000 +0200 +++ corosync-trunk/Makefile.inc 2008-12-09 14:48:47.000000000 +0100 diff --git a/corosync.spec b/corosync.spec index 1ee6f6f..329deb3 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,14 +1,14 @@ -%define alphatag svn1707 +%define alphatag svn1709 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.92 -Release: 4%{?alphatag:.%{alphatag}}%{?dist} +Release: 5%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: corosync-trunk-1707.diff +Patch0: corosync-trunk-1709.diff BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(pre): /usr/sbin/useradd @@ -139,6 +139,7 @@ fi %{_includedir}/corosync/engine/coroapi.h %{_includedir}/corosync/engine/logsys.h %{_includedir}/corosync/engine/objdb.h +%{_includedir}/corosync/engine/quorum.h %{_libdir}/corosync/libcfg.so %{_libdir}/corosync/libcpg.so %{_libdir}/corosync/libconfdb.so @@ -155,6 +156,10 @@ fi %{_mandir}/man8/logsys_overview.8* %changelog +* Mon Dec 15 2008 Fabio M. Di Nitto - 0.92-5.svn1709 +- Update to svn trunk at revision 1709 from upstream. +- Update spec file to include new include files. + * Wed Dec 10 2008 Fabio M. Di Nitto - 0.92-4.svn1707 - Update to svn trunk at revision 1707 from upstream. - Update spec file to include new lcrso services and include file. From 36df0fa194462b4d64b57be59fd98e3def9da693 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 27 Jan 2009 10:44:56 +0000 Subject: [PATCH 004/185] Update to latest svn snapshot --- ...runk-1709.diff => corosync-trunk-1750.diff | 6808 +++++++++++++++-- corosync.spec | 19 +- 2 files changed, 6272 insertions(+), 555 deletions(-) rename corosync-trunk-1709.diff => corosync-trunk-1750.diff (69%) diff --git a/corosync-trunk-1709.diff b/corosync-trunk-1750.diff similarity index 69% rename from corosync-trunk-1709.diff rename to corosync-trunk-1750.diff index 072cedc..a37d6c4 100644 --- a/corosync-trunk-1709.diff +++ b/corosync-trunk-1750.diff @@ -81,10 +81,132 @@ diff -Naurd corosync-0.92/exec/apidef.c corosync-trunk/exec/apidef.c }; void apidef_init (struct objdb_iface_ver0 *objdb) { +diff -Naurd corosync-0.92/exec/coropoll.c corosync-trunk/exec/coropoll.c +--- corosync-0.92/exec/coropoll.c 2008-08-14 18:44:26.000000000 +0200 ++++ corosync-trunk/exec/coropoll.c 2009-01-20 18:59:10.000000000 +0100 +@@ -59,6 +59,7 @@ + struct timerlist timerlist; + void (*serialize_lock_fn) (void); + void (*serialize_unlock_fn) (void); ++ int stop_requested; + }; + + /* +@@ -92,6 +93,7 @@ + poll_instance->poll_entries = 0; + poll_instance->ufds = 0; + poll_instance->poll_entry_count = 0; ++ poll_instance->stop_requested = 0; + poll_instance->serialize_lock_fn = serialize_lock_fn; + poll_instance->serialize_unlock_fn = serialize_unlock_fn; + timerlist_init (&poll_instance->timerlist); +@@ -291,18 +293,18 @@ + struct poll_instance *poll_instance; + int res = 0; + ++ if (timer_handle_out == NULL) { ++ res -ENOENT; ++ goto error_exit; ++ } ++ + res = hdb_handle_get (&poll_instance_database, handle, + (void *)&poll_instance); + if (res != 0) { + res = -ENOENT; +- + goto error_exit; + } + +- if (timer_handle_out == 0) { +- res = -ENOENT; +- } +- + timerlist_add_duration (&poll_instance->timerlist, + timer_fn, data, ((unsigned long long)msec_duration) * 1000000ULL, timer_handle_out); + +@@ -336,6 +338,27 @@ + return (res); + } + ++int poll_stop ( ++ poll_handle handle) ++{ ++ struct poll_instance *poll_instance; ++ unsigned int res; ++ ++ res = hdb_handle_get (&poll_instance_database, handle, ++ (void *)&poll_instance); ++ if (res != 0) { ++ res = -ENOENT; ++ goto error_exit; ++ } ++ ++ poll_instance->stop_requested = 1; ++ ++ hdb_handle_put (&poll_instance_database, handle); ++error_exit: ++ return (res); ++} ++ ++ + int poll_run ( + poll_handle handle) + { +@@ -366,6 +389,10 @@ + retry_poll: + res = poll (poll_instance->ufds, + poll_instance->poll_entry_count, expire_timeout_msec); ++ if (poll_instance->stop_requested) { ++ printf ("poll should stop\n"); ++ return (0); ++ } + if (errno == EINTR && res == -1) { + goto retry_poll; + } else +@@ -403,9 +430,6 @@ + return (-1); + } + +-int poll_stop ( +- poll_handle handle); +- + #ifdef COMPILE_OUT + void poll_print_state ( + poll_handle handle, diff -Naurd corosync-0.92/exec/crypto.c corosync-trunk/exec/crypto.c --- corosync-0.92/exec/crypto.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/exec/crypto.c 2008-11-11 19:13:47.000000000 +0100 -@@ -844,7 +844,7 @@ ++++ corosync-trunk/exec/crypto.c 2009-01-26 21:22:28.000000000 +0100 +@@ -20,13 +20,14 @@ + #endif + #include + #include ++#include + + #include "crypto.h" + + #define CONST64(n) n ## ULL + +-typedef unsigned long ulong32; +-typedef unsigned long long ulong64; ++typedef uint32_t ulong32; ++typedef uint64_t ulong64; + + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define ENDIAN_LITTLE +@@ -41,10 +42,10 @@ + #endif + + #if defined(COROSYNC_LINUX) +-#if __WORDIZE == 64 ++#if __WORDSIZE == 64 + #define ENDIAN_64BITWORD + #endif +-#if __WORDIZE == 32 ++#if __WORDSIZE == 32 + #define ENDIAN_32BITWORD + #endif + #else +@@ -844,7 +845,7 @@ assert ((len & 3) == 0); for (i = 0; i < len; i += 4) { @@ -93,7 +215,7 @@ diff -Naurd corosync-0.92/exec/crypto.c corosync-trunk/exec/crypto.c ADDKEY(k); cycle(c->R); XORNL(nltap(c)); -@@ -1250,11 +1250,11 @@ +@@ -1250,11 +1251,11 @@ void (*callback)(void)) { int fd; @@ -107,6 +229,27 @@ diff -Naurd corosync-0.92/exec/crypto.c corosync-trunk/exec/crypto.c close (fd); +diff -Naurd corosync-0.92/exec/crypto.h corosync-trunk/exec/crypto.h +--- corosync-0.92/exec/crypto.h 2004-09-15 22:20:07.000000000 +0200 ++++ corosync-trunk/exec/crypto.h 2009-01-26 21:22:28.000000000 +0100 +@@ -1,6 +1,8 @@ + #ifndef CRYPTO_H_DEFINED + #define CRYPTO_H_DEFINED + ++#include ++ + #define DIGEST_SHA1 0 + #define PRNG_SOBER 0 + +@@ -88,7 +90,7 @@ + unsigned char *dst, unsigned long *dstlen); + + struct sober128_prng { +- unsigned long R[17], /* Working storage for the shift register */ ++ uint32_t R[17], /* Working storage for the shift register */ + initR[17], /* saved register contents */ + konst, /* key dependent constant */ + sbuf; /* partial word encryption buffer */ diff -Naurd corosync-0.92/exec/flow.c corosync-trunk/exec/flow.c --- corosync-0.92/exec/flow.c 2008-08-14 18:54:46.000000000 +0200 +++ corosync-trunk/exec/flow.c 2008-11-06 22:49:07.000000000 +0100 @@ -361,7 +504,7 @@ diff -Naurd corosync-0.92/exec/flow.h corosync-trunk/exec/flow.h #endif /* FLOW_H_DEFINED */ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c --- corosync-0.92/exec/ipc.c 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/exec/ipc.c 2008-12-08 16:55:41.000000000 +0100 ++++ corosync-trunk/exec/ipc.c 2008-12-28 10:25:17.000000000 +0100 @@ -62,7 +62,7 @@ #endif @@ -498,7 +641,29 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c } return (0); } -@@ -633,14 +634,14 @@ +@@ -486,6 +487,7 @@ + struct sched_param sched_param; + int res; + pthread_mutex_t *rel_mutex; ++ pthread_mutex_t *rel2_mutex; + unsigned int service; + struct conn_info *cinfo_partner; + void *private_data; +@@ -523,11 +525,12 @@ + + case CONN_STATE_DISCONNECTED: + rel_mutex = conn_info->shared_mutex; ++ rel2_mutex = &conn_info->mutex; + private_data = conn_info->private_data; + cinfo_partner = conn_info->conn_info_partner; + conn_info_destroy (conn); + if (service == SOCKET_SERVICE_INIT) { +- pthread_mutex_unlock (&conn_info->mutex); ++ pthread_mutex_unlock (rel2_mutex); + } else { + pthread_mutex_unlock (rel_mutex); + } +@@ -633,34 +636,37 @@ /* * IPC group-wide flow control */ @@ -513,18 +678,28 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c - corosync_flow_control_enable (conn_info->flow_control_handle); + cs_flow_control_enable (conn_info->flow_control_handle); conn_info->flow_control_enabled = 1; - conn_info->conn_info_partner->flow_control_enabled = 1; +- conn_info->conn_info_partner->flow_control_enabled = 1; ++ if (conn_info->conn_info_partner) { ++ conn_info->conn_info_partner->flow_control_enabled = 1; ++ } } -@@ -651,7 +652,7 @@ + if (conn_info->flow_control_enabled == 1 && +- + fcc <= FLOW_CONTROL_ENTRIES_DISABLE) { + log_printf (LOG_LEVEL_NOTICE, "Disabling flow control [%d/%d] - [%d].\n", entries_usedhw, SIZEQUEUE, flow_control_local_count); - corosync_flow_control_disable (conn_info->flow_control_handle); + cs_flow_control_disable (conn_info->flow_control_handle); conn_info->flow_control_enabled = 0; - conn_info->conn_info_partner->flow_control_enabled = 0; +- conn_info->conn_info_partner->flow_control_enabled = 0; ++ if (conn_info->conn_info_partner) { ++ conn_info->conn_info_partner->flow_control_enabled = 0; ++ } } -@@ -660,7 +661,7 @@ + } + } static int conn_info_outq_flush (struct conn_info *conn_info) { struct queue *outq; @@ -533,7 +708,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c struct outq_item *queue_item; struct msghdr msg_send; struct iovec iov_send; -@@ -731,14 +732,15 @@ +@@ -731,14 +737,15 @@ @@ -551,7 +726,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c mar_req_header_t *header; int service; struct msghdr msg_recv; -@@ -752,7 +754,7 @@ +@@ -752,7 +759,7 @@ int send_ok = 0; int send_ok_joined = 0; struct iovec send_ok_joined_iovec; @@ -560,7 +735,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c msg_recv.msg_iov = &iov_recv; msg_recv.msg_iovlen = 1; -@@ -841,7 +843,7 @@ +@@ -841,7 +848,7 @@ #ifdef COROSYNC_LINUX if (conn_info->authenticated == 0) { cmsg = CMSG_FIRSTHDR (&msg_recv); @@ -569,7 +744,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c cred = (struct ucred *)CMSG_DATA (cmsg); if (cred) { if (cred->uid == 0 || cred->gid == g_gid_valid) { -@@ -861,7 +863,8 @@ +@@ -861,7 +868,8 @@ conn_info->inb_inuse += res; conn_info->inb_start += res; @@ -579,7 +754,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c header = (mar_req_header_t *)&conn_info->inb[conn_info->inb_start - conn_info->inb_inuse]; if (header->size > conn_info->inb_inuse) { -@@ -874,7 +877,7 @@ +@@ -874,7 +882,7 @@ * else handle message using service service */ if (service == SOCKET_SERVICE_INIT) { @@ -588,7 +763,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c } else { /* * Not an init service, but a standard service -@@ -897,11 +900,11 @@ +@@ -897,11 +905,11 @@ &send_ok_joined_iovec, 1); send_ok = @@ -604,7 +779,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c if (send_ok) { ais_service[service]->lib_engine[header->id].lib_handler_fn(conn_info, header); -@@ -914,8 +917,8 @@ +@@ -914,8 +922,8 @@ ais_service[service]->lib_engine[header->id].response_size; res_overlay.header.id = ais_service[service]->lib_engine[header->id].response_id; @@ -615,7 +790,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c conn_info, &res_overlay, res_overlay.header.size); -@@ -1030,7 +1033,7 @@ +@@ -1030,7 +1038,7 @@ { } @@ -624,7 +799,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c void (*serialize_lock_fn) (void), void (*serialize_unlock_fn) (void), unsigned int gid_valid) -@@ -1102,7 +1105,7 @@ +@@ -1102,7 +1110,7 @@ /* * Get the conn info private data */ @@ -633,7 +808,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c { struct conn_info *conn_info = (struct conn_info *)conn; -@@ -1116,7 +1119,7 @@ +@@ -1116,7 +1124,7 @@ /* * Get the conn info partner connection */ @@ -642,7 +817,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c { struct conn_info *conn_info = (struct conn_info *)conn; -@@ -1127,25 +1130,27 @@ +@@ -1127,25 +1135,27 @@ } } @@ -674,7 +849,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c int queue_empty; struct outq_item *queue_item; struct outq_item queue_item_out; -@@ -1282,17 +1287,17 @@ +@@ -1282,17 +1292,17 @@ return (0); } @@ -695,7 +870,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c conn_info->flow_control_handle, service, id, -@@ -1302,7 +1307,7 @@ +@@ -1302,7 +1312,7 @@ conn_info->conn_info_partner->flow_control_handle = conn_info->flow_control_handle; } @@ -704,7 +879,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c void *conn, unsigned int service, unsigned char *id, -@@ -1310,14 +1315,14 @@ +@@ -1310,14 +1320,14 @@ { struct conn_info *conn_info = (struct conn_info *)conn; @@ -721,7 +896,7 @@ diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c void *conn) { struct conn_info *conn_info = (struct conn_info *)conn; -@@ -1329,7 +1334,7 @@ +@@ -1329,7 +1339,7 @@ pthread_mutex_unlock (&conn_info->flow_control_mutex); } @@ -801,12 +976,12 @@ diff -Naurd corosync-0.92/exec/ipc.h corosync-trunk/exec/ipc.h #endif /* IPC_H_DEFINED */ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c --- corosync-0.92/exec/logsys.c 2008-09-17 20:22:58.000000000 +0200 -+++ corosync-trunk/exec/logsys.c 2008-12-02 16:51:03.000000000 +0100 ++++ corosync-trunk/exec/logsys.c 2009-01-26 14:15:57.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2004 MontaVista Software, Inc. - * Copyright (c) 2006-2007 Red Hat, Inc. -+ * Copyright (c) 2006-2008 Red Hat, Inc. ++ * Copyright (c) 2006-2009 Red Hat, Inc. * * Author: Steven Dake (sdake@redhat.com) * Author: Lon Hohberger (lhh@redhat.com) @@ -828,12 +1003,34 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c #if defined(COROSYNC_LINUX) #include #endif -@@ -54,14 +58,31 @@ +@@ -54,14 +58,54 @@ #include #include -#include "wthread.h" + ++/* similar to syslog facilities/priorities tables, ++ * make a tag table for internal use ++ */ ++ ++#ifdef SYSLOG_NAMES ++CODE tagnames[] = ++ { ++ { "log", LOGSYS_TAG_LOG }, ++ { "enter", LOGSYS_TAG_ENTER }, ++ { "leave", LOGSYS_TAG_LEAVE }, ++ { "trace1", LOGSYS_TAG_TRACE1 }, ++ { "trace2", LOGSYS_TAG_TRACE2 }, ++ { "trace3", LOGSYS_TAG_TRACE3 }, ++ { "trace4", LOGSYS_TAG_TRACE4 }, ++ { "trace5", LOGSYS_TAG_TRACE5 }, ++ { "trace6", LOGSYS_TAG_TRACE6 }, ++ { "trace7", LOGSYS_TAG_TRACE7 }, ++ { "trace8", LOGSYS_TAG_TRACE8 }, ++ { NULL, -1 } ++ }; ++#endif ++ +/* + * These are not static so they can be read from the core file + */ @@ -847,6 +1044,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c + +struct logsys_logger { + char subsys[64]; ++ unsigned int facility; + unsigned int priority; + unsigned int tags; + unsigned int mode; @@ -862,7 +1060,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c static char *logsys_file = NULL; -@@ -69,35 +90,44 @@ +@@ -69,35 +113,44 @@ static int logsys_facility = LOG_DAEMON; @@ -925,7 +1123,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c struct log_data { unsigned int syslog_pos; -@@ -105,324 +135,674 @@ +@@ -105,324 +158,674 @@ char *log_string; }; @@ -1163,7 +1361,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c + /* + * Output to configured file + */ -+ if (logsys_mode & LOG_MODE_OUTPUT_FILE) { ++ if ((logsys_mode & LOG_MODE_OUTPUT_FILE) && logsys_file_fp) { + /* + * Output to a file + */ @@ -1824,7 +2022,24 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c pthread_mutex_unlock (&logsys_config_mutex); } -@@ -439,7 +819,6 @@ +@@ -431,22 +834,28 @@ + return logsys_mode; + } + ++static void logsys_close_logfile() ++{ ++ if (logsys_file_fp != NULL) { ++ fclose (logsys_file_fp); ++ logsys_file_fp = NULL; ++ } ++} ++ + int logsys_config_file_set (char **error_string, char *file) + { + static char error_string_response[512]; + + if (file == NULL) { ++ logsys_close_logfile(); return (0); } @@ -1832,14 +2047,24 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c pthread_mutex_lock (&logsys_config_mutex); if (logsys_mode & LOG_MODE_OUTPUT_FILE) { -@@ -454,222 +833,218 @@ + logsys_file = file; +- if (logsys_file_fp != NULL) { +- fclose (logsys_file_fp); +- } ++ logsys_close_logfile(); + logsys_file_fp = fopen (file, "a+"); + if (logsys_file_fp == 0) { + sprintf (error_string_response, +@@ -454,222 +863,243 @@ file, strerror (errno)); *error_string = error_string_response; pthread_mutex_unlock (&logsys_config_mutex); - pthread_mutex_unlock (&logsys_new_log_mutex); return (-1); } - } +- } ++ } else ++ logsys_close_logfile(); pthread_mutex_unlock (&logsys_config_mutex); - pthread_mutex_unlock (&logsys_new_log_mutex); @@ -1916,44 +2141,24 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c + return (facilitynames[i].c_name); + } } -- -- logsys_wthread_active = 1; -- -- return (0); + return (NULL); - } ++} --void logsys_log_printf ( -- char *file, -- int line, -- int priority, -- char *format, -- ...) +- logsys_wthread_active = 1; +int logsys_priority_id_get (const char *name) - { -- int id = LOG_ID(priority); -- int level = LOG_LEVEL(priority); -- va_list ap; -- -- assert (id < MAX_LOGGERS); ++{ + unsigned int i; -- if (LOG_LEVEL(priority) > logsys_loggers[id].priority) { -- return; +- return (0); + for (i = 0; prioritynames[i].c_name != NULL; i++) { + if (strcasecmp(name, prioritynames[i].c_name) == 0) { + return (prioritynames[i].c_val); + } - } -- -- va_start (ap, format); -- _log_printf (LOGSYS_CONFIG_MUTEX_UNLOCKED, file, line, level, id, -- format, ap); -- va_end(ap); ++ } + return (-1); } --static void logsys_log_printf_locked ( +-void logsys_log_printf ( - char *file, - int line, - int priority, @@ -1977,41 +2182,92 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c } - - va_start (ap, format); -- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, level, id, +- _log_printf (LOGSYS_CONFIG_MUTEX_UNLOCKED, file, line, level, id, - format, ap); - va_end(ap); + return (NULL); } +-static void logsys_log_printf_locked ( +- char *file, +- int line, +- int priority, +- char *format, +- ...) ++int logsys_tag_id_get (const char *name) + { +- int id = LOG_ID(priority); +- int level = LOG_LEVEL(priority); +- va_list ap; +- +- assert (id < MAX_LOGGERS); ++ unsigned int i; + +- if (LOG_LEVEL(priority) > logsys_loggers[id].priority) { +- return; ++ for (i = 0; tagnames[i].c_name != NULL; i++) { ++ if (strcasecmp(name, tagnames[i].c_name) == 0) { ++ return (tagnames[i].c_val); ++ } + } +- +- va_start (ap, format); +- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, level, id, +- format, ap); +- va_end(ap); ++ return (-1); + } + -void _logsys_log_printf2 ( - char *file, - int line, - int priority, - int id, - char *format, ...) -+unsigned int logsys_config_subsys_set ( -+ const char *subsys, -+ unsigned int tags, -+ unsigned int priority) ++const char *logsys_tag_name_get (unsigned int tag) { - va_list ap; -+ int i; - +- - assert (id < MAX_LOGGERS); -+ pthread_mutex_lock (&logsys_config_mutex); -+ for (i = 0; i < SUBSYS_MAX; i++) { -+ if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { -+ logsys_loggers[i].tags = tags; -+ logsys_loggers[i].priority = priority; ++ unsigned int i; - va_start (ap, format); - _log_printf (LOGSYS_CONFIG_MUTEX_UNLOCKED, file, line, priority, id, - format, ap); - va_end(ap); ++ for (i = 0; tagnames[i].c_name != NULL; i++) { ++ if (tag == tagnames[i].c_val) { ++ return (tagnames[i].c_name); ++ } ++ } ++ return (NULL); + } + +-void _logsys_trace (char *file, int line, int tag, int id, char *format, ...) ++unsigned int logsys_config_subsys_set ( ++ const char *subsys, ++ unsigned int tags, ++ unsigned int priority) + { +- assert (id < MAX_LOGGERS); ++ int i; + + pthread_mutex_lock (&logsys_config_mutex); ++ for (i = 0; i < SUBSYS_MAX; i++) { ++ if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { ++ logsys_loggers[i].tags = tags; ++ logsys_loggers[i].priority = priority; + +- if (tag & logsys_loggers[id].tags) { +- va_list ap; + break; + } + } -+ + +- va_start (ap, format); +- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, +- LOG_LEVEL_DEBUG, id, format, ap); +- va_end(ap); + if (i == SUBSYS_MAX) { + for (i = 0; i < SUBSYS_MAX; i++) { + if (strcmp (logsys_loggers[i].subsys, "") == 0) { @@ -2022,31 +2278,28 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c + break; + } + } -+ } + } + assert(i < SUBSYS_MAX); + -+ pthread_mutex_unlock (&logsys_config_mutex); + pthread_mutex_unlock (&logsys_config_mutex); + return i; } --void _logsys_trace (char *file, int line, int tag, int id, char *format, ...) +-static void logsys_atexit (void) +int logsys_config_subsys_get ( + const char *subsys, + unsigned int *tags, + unsigned int *priority) { -- assert (id < MAX_LOGGERS); +- if (logsys_wthread_active) { +- worker_thread_group_wait (&log_thread_group); +- } +- if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) { +- closelog (); + unsigned int i; - - pthread_mutex_lock (&logsys_config_mutex); - -- if (tag & logsys_loggers[id].tags) { -- va_list ap; -- -- va_start (ap, format); -- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, -- LOG_LEVEL_DEBUG, id, format, ap); -- va_end(ap); ++ ++ pthread_mutex_lock (&logsys_config_mutex); ++ + for (i = 0; i < SUBSYS_MAX; i++) { + if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { + *tags = logsys_loggers[i].tags; @@ -2056,45 +2309,27 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c + } } + - pthread_mutex_unlock (&logsys_config_mutex); ++ pthread_mutex_unlock (&logsys_config_mutex); + + return (-1); } --static void logsys_atexit (void) -+int logsys_log_rec_store (char *filename) - { -- if (logsys_wthread_active) { -- worker_thread_group_wait (&log_thread_group); -+ int fd; -+ ssize_t written_size; -+ size_t size_to_write = (flt_data_size + 2) * sizeof (unsigned int); -+ -+ fd = open (filename, O_CREAT|O_RDWR, 0700); -+ if (fd == -1) { -+ return (-1); - } -- if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) { -- closelog (); -+ -+ written_size = write (fd, flt_data, size_to_write); -+ if (written_size < 0) { -+ return (-1); -+ } else if ((size_t)written_size != size_to_write) { -+ return (-1); - } -+ return (0); - } - -static void logsys_buffer_flush (void) -+static void logsys_atexit (void) ++int logsys_log_rec_store (char *filename) { - struct log_entry *entry = head; - struct log_entry *tmp; -- ++ int fd; ++ ssize_t written_size; ++ size_t size_to_write = (flt_data_size + 2) * sizeof (unsigned int); + - if (logsys_mode & LOG_MODE_FLUSH_AFTER_CONFIG) { - logsys_mode &= ~LOG_MODE_FLUSH_AFTER_CONFIG; -- ++ fd = open (filename, O_CREAT|O_RDWR, 0700); ++ if (fd == -1) { ++ return (-1); ++ } + - while (entry) { - logsys_log_printf_locked ( - entry->file, @@ -2105,13 +2340,23 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c - entry = entry->next; - free (tmp); - } ++ written_size = write (fd, flt_data, size_to_write); ++ if (written_size < 0) { ++ return (-1); ++ } else if ((size_t)written_size != size_to_write) { ++ return (-1); + } ++ return (0); ++} + +- head = tail = NULL; ++static void logsys_atexit (void) ++{ + if (wthread_active) { + wthread_should_exit = 1; + wthread_signal (); + pthread_join (logsys_thread_id, NULL); - } -- -- head = tail = NULL; ++ } } -void logsys_flush (void) @@ -2184,8 +2429,17 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c - diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c --- corosync-0.92/exec/main.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/exec/main.c 2008-12-08 16:55:41.000000000 +0100 -@@ -56,7 +56,7 @@ ++++ corosync-trunk/exec/main.c 2009-01-23 17:12:13.000000000 +0100 +@@ -34,8 +34,6 @@ + */ + #include + #include +-#include +-#include + #include + #include + #include +@@ -56,7 +54,7 @@ #include #include @@ -2194,7 +2448,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c #include #include #include -@@ -66,6 +66,7 @@ +@@ -66,6 +64,7 @@ #include #include @@ -2202,7 +2456,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c #include "totemsrp.h" #include "mempool.h" #include "mainconfig.h" -@@ -83,9 +84,11 @@ +@@ -83,18 +82,16 @@ #include "version.h" LOGSYS_DECLARE_SYSTEM ("corosync", @@ -2216,7 +2470,16 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO); -@@ -145,7 +148,6 @@ + #define SERVER_BACKLOG 5 + +-static int ais_uid = 0; +- +-static int gid_valid = 0; +- + static unsigned int service_count = 32; + + static pthread_mutex_t serialize_mutex = PTHREAD_MUTEX_INITIALIZER; +@@ -145,7 +142,6 @@ #endif totempg_finalize (); @@ -2224,7 +2487,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c corosync_exit_error (AIS_DONE_EXIT); -@@ -170,15 +172,17 @@ +@@ -170,15 +166,17 @@ static void sigsegv_handler (int num) { @@ -2246,7 +2509,48 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c raise (SIGABRT); } -@@ -341,7 +345,7 @@ +@@ -271,36 +269,11 @@ + } + } + +-static void aisexec_uid_determine (struct main_config *main_config) +-{ +- struct passwd *passwd; +- +- passwd = getpwnam(main_config->user); +- if (passwd == 0) { +- log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' user is not found in /etc/passwd, please read the documentation.\n", main_config->user); +- corosync_exit_error (AIS_DONE_UID_DETERMINE); +- } +- ais_uid = passwd->pw_uid; +- endpwent (); +-} +- +-static void aisexec_gid_determine (struct main_config *main_config) +-{ +- struct group *group; +- group = getgrnam (main_config->group); +- if (group == 0) { +- log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' group is not found in /etc/group, please read the documentation.\n", group->gr_name); +- corosync_exit_error (AIS_DONE_GID_DETERMINE); +- } +- gid_valid = group->gr_gid; +- endgrent (); +-} +- +-static void aisexec_priv_drop (void) ++static void priv_drop (struct main_config *main_config) + { +-return; +- setuid (ais_uid); +- setegid (ais_uid); ++return; /* TODO: we are still not dropping privs */ ++ setuid (main_config->uid); ++ setegid (main_config->gid); + } + + static void aisexec_mempool_init (void) +@@ -341,7 +314,7 @@ } /* Create new session */ @@ -2255,7 +2559,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c /* * Map stdin/out/err to /dev/null. -@@ -408,7 +412,6 @@ +@@ -408,7 +381,6 @@ #endif } @@ -2263,7 +2567,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c static void deliver_fn ( unsigned int nodeid, struct iovec *iovec, -@@ -448,6 +451,8 @@ +@@ -448,6 +420,8 @@ */ service = header->id >> 16; fn_id = header->id & 0xffff; @@ -2272,7 +2576,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c if (endian_conversion_required) { assert(ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn != NULL); ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn -@@ -494,7 +499,6 @@ +@@ -494,7 +468,6 @@ char *iface; int res, ch; int background, setprio; @@ -2280,7 +2584,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c /* default configuration */ -@@ -506,7 +510,7 @@ +@@ -506,7 +479,7 @@ switch (ch) { case 'f': background = 0; @@ -2289,7 +2593,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c break; case 'p': setprio = 0; -@@ -527,11 +531,11 @@ +@@ -527,11 +500,11 @@ log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2002-2006 MontaVista Software, Inc and contributors.\n"); log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2006-2008 Red Hat, Inc.\n"); @@ -2306,16 +2610,22 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c corosync_timer_init ( serialize_mutex_lock, -@@ -639,6 +643,8 @@ - logsys_config_mode_set (main_config.logmode); - logsys_config_file_set (&error_string, main_config.logfile); +@@ -635,14 +608,6 @@ + corosync_exit_error (AIS_DONE_MAINCONFIGREAD); + } -+ logsys_fork_completed (); -+ - aisexec_uid_determine (&main_config); - - aisexec_gid_determine (&main_config); -@@ -654,13 +660,14 @@ +- logsys_config_facility_set ("corosync", main_config.syslog_facility); +- logsys_config_mode_set (main_config.logmode); +- logsys_config_file_set (&error_string, main_config.logfile); +- +- aisexec_uid_determine (&main_config); +- +- aisexec_gid_determine (&main_config); +- + /* + * Set round robin realtime scheduling with priority 99 + * Lock all memory to avoid page faults which may interrupt +@@ -654,13 +619,14 @@ aisexec_mlockall (); totem_config.totem_logging_configuration = totem_logging_configuration; @@ -2337,7 +2647,7 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c /* * Sleep for a while to let other nodes in the cluster -@@ -704,11 +711,9 @@ +@@ -704,11 +670,9 @@ } @@ -2351,7 +2661,12 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c /* * Drop root privleges to user 'ais' -@@ -722,7 +727,7 @@ +@@ -718,14 +682,14 @@ + * CAP_SYS_NICE (setscheduler) + * CAP_IPC_LOCK (mlockall) + */ +- aisexec_priv_drop (); ++ priv_drop (&main_config); aisexec_mempool_init (); @@ -2359,29 +2674,63 @@ diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c + cs_ipc_init ( serialize_mutex_lock, serialize_mutex_unlock, - gid_valid); +- gid_valid); ++ main_config.gid); + + /* + * Start main processing loop diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c --- corosync-0.92/exec/mainconfig.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/mainconfig.c 2008-11-06 22:49:07.000000000 +0100 -@@ -41,7 +41,7 @@ ++++ corosync-trunk/exec/mainconfig.c 2009-01-23 17:12:13.000000000 +0100 +@@ -40,8 +40,10 @@ + #include #include #include ++#include ++#include -#include +#include #include #include #include -@@ -109,8 +109,6 @@ +@@ -51,6 +53,12 @@ + #include "mempool.h" + + static char error_string_response[512]; ++static struct objdb_iface_ver0 *global_objdb; ++ ++static void add_logsys_config_notification( ++ struct objdb_iface_ver0 *objdb, ++ struct main_config *main_config); ++ + + /* This just makes the code below a little neater */ + static inline int objdb_get_string ( +@@ -98,7 +106,10 @@ + unsigned int tags; + } logsys_logger; + +-int corosync_main_config_read ( ++ ++ ++ ++int corosync_main_config_read_logging ( + struct objdb_iface_ver0 *objdb, + char **error_string, + struct main_config *main_config) +@@ -109,10 +120,6 @@ char *error_reason = error_string_response; unsigned int object_find_handle; unsigned int object_find_logsys_handle; - int global_debug = 0; - +- +- memset (main_config, 0, sizeof (struct main_config)); - memset (main_config, 0, sizeof (struct main_config)); - -@@ -120,7 +118,7 @@ + objdb->object_find_create ( + OBJECT_PARENT_HANDLE, +@@ -120,7 +127,7 @@ strlen ("logging"), &object_find_handle); @@ -2390,7 +2739,7 @@ diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c if (objdb->object_find_next ( object_find_handle, &object_service_handle) == 0) { -@@ -135,10 +133,10 @@ +@@ -135,10 +142,10 @@ } if (!objdb_get_string (objdb,object_service_handle, "to_syslog", &value)) { if (strcmp (value, "yes") == 0) { @@ -2403,7 +2752,7 @@ diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c } } if (!objdb_get_string (objdb,object_service_handle, "to_stderr", &value)) { -@@ -149,18 +147,8 @@ +@@ -149,18 +156,8 @@ main_config->logmode &= ~LOG_MODE_OUTPUT_STDERR; } } @@ -2423,11 +2772,17 @@ diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c if (strcmp (value, "on") == 0) { main_config->logmode |= LOG_MODE_DISPLAY_TIMESTAMP; } else -@@ -169,12 +157,14 @@ +@@ -169,12 +166,20 @@ } else { goto parse_error; } +*/ ++ } ++ ++ /* free old string on reload */ ++ if (main_config->logfile) { ++ free(main_config->logfile); ++ main_config->logfile = NULL; } if (!objdb_get_string (objdb,object_service_handle, "logfile", &value)) { main_config->logfile = strdup (value); @@ -2438,7 +2793,7 @@ diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c if (strcmp (value, "on") == 0) { main_config->logmode |= LOG_MODE_DISPLAY_FILELINE; } else -@@ -183,6 +173,7 @@ +@@ -183,41 +188,21 @@ } else { goto parse_error; } @@ -2446,6 +2801,260 @@ diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c } if (!objdb_get_string (objdb,object_service_handle, "syslog_facility", &value)) { +- if (strcmp (value, "daemon") == 0) { +- main_config->syslog_facility = LOG_DAEMON; +- } else +- if (strcmp (value, "local0") == 0) { +- main_config->syslog_facility = LOG_LOCAL0; +- } else +- if (strcmp (value, "local1") == 0) { +- main_config->syslog_facility = LOG_LOCAL1; +- } else +- if (strcmp (value, "local2") == 0) { +- main_config->syslog_facility = LOG_LOCAL2; +- } else +- if (strcmp (value, "local3") == 0) { +- main_config->syslog_facility = LOG_LOCAL3; +- } else +- if (strcmp (value, "local4") == 0) { +- main_config->syslog_facility = LOG_LOCAL4; +- } else +- if (strcmp (value, "local5") == 0) { +- main_config->syslog_facility = LOG_LOCAL5; +- } else +- if (strcmp (value, "local6") == 0) { +- main_config->syslog_facility = LOG_LOCAL6; +- } else +- if (strcmp (value, "local7") == 0) { +- main_config->syslog_facility = LOG_LOCAL7; +- } else { ++ main_config->syslog_facility = logsys_facility_id_get(value); ++ if (main_config->syslog_facility < 0) { + error_reason = "unknown syslog facility specified"; + goto parse_error; + } + } + ++ logsys_config_facility_set ("corosync", main_config->syslog_facility); ++ logsys_config_mode_set (main_config->logmode); ++ logsys_config_file_set (error_string, main_config->logfile); ++ + objdb->object_find_create ( + object_service_handle, + "logger_subsys", +@@ -239,6 +224,13 @@ + error_reason = "subsys required for logger directive"; + goto parse_error; + } ++ if (!objdb_get_string (objdb, object_logger_subsys_handle, "syslog_level", &value)) { ++ logsys_logger.priority = logsys_priority_id_get(value); ++ if (logsys_logger.priority < 0) { ++ error_reason = "unknown syslog priority specified"; ++ goto parse_error; ++ } ++ } + if (!objdb_get_string (objdb, object_logger_subsys_handle, "debug", &value)) { + if (strcmp (value, "on") == 0) { + logsys_logger.priority = LOG_LEVEL_DEBUG; +@@ -253,31 +245,14 @@ + char *token = strtok (value, "|"); + + while (token != NULL) { +- if (strcmp (token, "enter") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_ENTER; +- } else if (strcmp (token, "leave") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_LEAVE; +- } else if (strcmp (token, "trace1") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE1; +- } else if (strcmp (token, "trace2") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE2; +- } else if (strcmp (token, "trace3") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE3; +- } else if (strcmp (token, "trace4") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE4; +- } else if (strcmp (token, "trace5") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE5; +- } else if (strcmp (token, "trace6") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE6; +- } else if (strcmp (token, "trace7") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE7; +- } else if (strcmp (token, "trace8") == 0) { +- logsys_logger.tags |= LOGSYS_TAG_TRACE8; +- } else { ++ int val; ++ ++ val = logsys_tag_id_get(token); ++ if (val < 0) { + error_reason = "bad tags value"; + goto parse_error; + } +- ++ logsys_logger.tags |= val; + token = strtok(NULL, "|"); + } + } +@@ -295,6 +270,61 @@ + + objdb->object_find_destroy (object_find_handle); + ++ return 0; ++ ++parse_error: ++ sprintf (error_string_response, ++ "parse error in config: %s.\n", ++ error_reason); ++ ++ *error_string = error_string_response; ++ return (-1); ++} ++ ++static int uid_determine (char *req_user) ++{ ++ struct passwd *passwd; ++ int ais_uid = 0; ++ ++ passwd = getpwnam(req_user); ++ if (passwd == 0) { ++ log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' user is not found in /etc/passwd, please read the documentation.\n", req_user); ++ corosync_exit_error (AIS_DONE_UID_DETERMINE); ++ } ++ ais_uid = passwd->pw_uid; ++ endpwent (); ++ return ais_uid; ++} ++ ++static int gid_determine (char *req_group) ++{ ++ struct group *group; ++ int ais_gid = 0; ++ ++ group = getgrnam (req_group); ++ if (group == 0) { ++ log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' group is not found in /etc/group, please read the documentation.\n", req_group); ++ corosync_exit_error (AIS_DONE_GID_DETERMINE); ++ } ++ ais_gid = group->gr_gid; ++ endgrent (); ++ return ais_gid; ++} ++ ++int corosync_main_config_read ( ++ struct objdb_iface_ver0 *objdb, ++ char **error_string, ++ struct main_config *main_config) ++{ ++ unsigned int object_service_handle; ++ char *value; ++ char *error_reason = error_string_response; ++ unsigned int object_find_handle; ++ ++ memset (main_config, 0, sizeof (struct main_config)); ++ ++ corosync_main_config_read_logging(objdb, error_string, main_config); ++ + objdb->object_find_create ( + OBJECT_PARENT_HANDLE, + "aisexec", +@@ -306,22 +336,18 @@ + &object_service_handle) == 0) { + + if (!objdb_get_string (objdb,object_service_handle, "user", &value)) { +- main_config->user = strdup(value); +- } ++ main_config->uid = uid_determine(value); ++ } else ++ main_config->uid = uid_determine("ais"); ++ + if (!objdb_get_string (objdb,object_service_handle, "group", &value)) { +- main_config->group = strdup(value); +- } ++ main_config->gid = gid_determine(value); ++ } else ++ main_config->gid = gid_determine("ais"); + } + + objdb->object_find_destroy (object_find_handle); + +- /* Default user/group */ +- if (!main_config->user) +- main_config->user = "ais"; +- +- if (!main_config->group) +- main_config->group = "ais"; +- + if ((main_config->logmode & LOG_MODE_OUTPUT_FILE) && + (main_config->logfile == NULL)) { + error_reason = "logmode set to 'file' but no logfile specified"; +@@ -331,6 +357,10 @@ + if (main_config->syslog_facility == 0) + main_config->syslog_facility = LOG_DAEMON; + ++ add_logsys_config_notification(objdb, main_config); ++ ++ logsys_fork_completed (); ++ + return 0; + + parse_error: +@@ -341,3 +371,38 @@ + *error_string = error_string_response; + return (-1); + } ++ ++ ++static void main_objdb_reload_notify(objdb_reload_notify_type_t type, int flush, ++ void *priv_data_pt) ++{ ++ struct main_config *main_config = priv_data_pt; ++ char *error_string; ++ ++ if (type == OBJDB_RELOAD_NOTIFY_END) { ++ ++ /* ++ * Reload the logsys configuration ++ */ ++ corosync_main_config_read_logging(global_objdb, ++ &error_string, ++ main_config); ++ } ++} ++ ++static void add_logsys_config_notification( ++ struct objdb_iface_ver0 *objdb, ++ struct main_config *main_config) ++{ ++ ++ global_objdb = objdb; ++ ++ objdb->object_track_start(OBJECT_PARENT_HANDLE, ++ 1, ++ NULL, ++ NULL, ++ NULL, ++ main_objdb_reload_notify, ++ main_config); ++ ++} +diff -Naurd corosync-0.92/exec/mainconfig.h corosync-trunk/exec/mainconfig.h +--- corosync-0.92/exec/mainconfig.h 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/exec/mainconfig.h 2009-01-23 17:12:13.000000000 +0100 +@@ -61,13 +61,13 @@ + /* + * user/group to run as + */ +- char *user; +- char *group; ++ int uid; ++ int gid; + }; + + extern int corosync_main_config_read ( + struct objdb_iface_ver0 *objdb, + char **error_string, + struct main_config *main_config); +- ++ + #endif /* MAINCONFIG_H_DEFINED */ diff -Naurd corosync-0.92/exec/main.h corosync-trunk/exec/main.h --- corosync-0.92/exec/main.h 2008-08-20 02:57:40.000000000 +0200 +++ corosync-trunk/exec/main.h 2008-11-06 22:49:07.000000000 +0100 @@ -2543,7 +3152,15 @@ diff -Naurd corosync-0.92/exec/Makefile corosync-trunk/exec/Makefile diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c --- corosync-0.92/exec/objdb.c 2008-09-03 12:01:31.000000000 +0200 -+++ corosync-trunk/exec/objdb.c 2008-10-30 20:32:23.000000000 +0100 ++++ corosync-trunk/exec/objdb.c 2009-01-23 16:41:06.000000000 +0100 +@@ -1,6 +1,6 @@ + /* + * Copyright (c) 2006 MontaVista Software, Inc. +- * Copyright (c) 2007-2008 Red Hat, Inc. ++ * Copyright (c) 2007-2009 Red Hat, Inc. + * + * All rights reserved. + * @@ -59,6 +59,7 @@ object_key_change_notify_fn_t key_change_notify_fn; object_create_notify_fn_t object_create_notify_fn; @@ -2807,7 +3424,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_find_instance_database, object_find_handle, (void *)&object_find_instance); if (res != 0) { -@@ -714,9 +800,11 @@ +@@ -714,16 +800,35 @@ *object_handle = object_instance->object_handle; res = 0; } @@ -2819,7 +3436,31 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -739,6 +827,7 @@ + static int object_find_destroy ( + unsigned int object_find_handle) + { ++ struct object_find_instance *object_find_instance; ++ unsigned int res; ++ ++ objdb_rdlock(); ++ res = hdb_handle_get (&object_find_instance_database, ++ object_find_handle, (void *)&object_find_instance); ++ if (res != 0) { ++ goto error_exit; ++ } ++ hdb_handle_put(&object_find_instance_database, object_find_handle); ++ hdb_handle_destroy(&object_find_instance_database, object_find_handle); ++ ++ objdb_rdunlock(); + return (0); ++ ++error_exit: ++ objdb_rdunlock(); ++ return (-1); + } + + static int object_key_get ( +@@ -739,6 +844,7 @@ struct list_head *list; int found = 0; @@ -2827,7 +3468,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, object_handle, (void *)&instance); if (res != 0) { -@@ -766,9 +855,11 @@ +@@ -766,9 +872,11 @@ } hdb_handle_put (&object_instance_database, object_handle); @@ -2839,7 +3480,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -784,6 +875,7 @@ +@@ -784,6 +892,7 @@ struct list_head *list; int found = 0; @@ -2847,7 +3488,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, object_handle, (void *)&instance); if (res != 0) { -@@ -809,9 +901,11 @@ +@@ -809,9 +918,11 @@ } hdb_handle_put (&object_instance_database, object_handle); @@ -2859,7 +3500,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -827,6 +921,7 @@ +@@ -827,6 +938,7 @@ struct list_head *list; int found = 0; @@ -2867,7 +3508,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, object_handle, (void *)&instance); if (res != 0) { -@@ -852,9 +947,11 @@ +@@ -852,9 +964,11 @@ } hdb_handle_put (&object_instance_database, object_handle); @@ -2879,7 +3520,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -872,6 +969,7 @@ +@@ -872,6 +986,7 @@ struct list_head *list; int found = 0; @@ -2887,7 +3528,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, object_handle, (void *)&instance); if (res != 0) { -@@ -906,9 +1004,11 @@ +@@ -906,9 +1021,11 @@ if (ret == 0) object_key_changed_notification(object_handle, key_name, key_len, value, value_len, OBJECT_KEY_DELETED); @@ -2899,7 +3540,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -928,6 +1028,8 @@ +@@ -928,6 +1045,8 @@ struct list_head *list; int found = 0; @@ -2908,7 +3549,33 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, object_handle, (void *)&instance); if (res != 0) { -@@ -983,7 +1085,7 @@ +@@ -950,6 +1069,7 @@ + + if (found) { + int i; ++ int found_validator = 0; + + /* + * Do validation check if validation is configured for the parent object +@@ -962,7 +1082,7 @@ + instance->object_key_valid_list[i].key_name, + key_len) == 0)) { + +- found = 1; ++ found_validator = 1; + break; + } + } +@@ -970,7 +1090,7 @@ + /* + * Item not found in validation list + */ +- if (found == 0) { ++ if (found_validator == 0) { + goto error_put; + } else { + if (instance->object_key_valid_list[i].validate_callback) { +@@ -983,7 +1103,7 @@ } } @@ -2917,7 +3584,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c void *replacement_value; replacement_value = malloc(new_value_len); if (!replacement_value) -@@ -1003,11 +1105,13 @@ +@@ -1003,11 +1123,13 @@ if (ret == 0) object_key_changed_notification(object_handle, key_name, key_len, new_value, new_value_len, OBJECT_KEY_REPLACED); @@ -2931,7 +3598,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -1018,6 +1122,7 @@ +@@ -1018,6 +1140,7 @@ int res; struct object_instance *object_instance; @@ -2939,7 +3606,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, object_handle, (void *)&object_instance); if (res != 0) { -@@ -1027,9 +1132,11 @@ +@@ -1027,9 +1150,11 @@ *priv = object_instance->priv; hdb_handle_put (&object_instance_database, object_handle); @@ -2951,7 +3618,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -1092,6 +1199,8 @@ +@@ -1092,6 +1217,8 @@ unsigned int res; struct object_instance *instance; @@ -2960,7 +3627,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, object_handle, (void *)&instance); if (res != 0) { -@@ -1100,9 +1209,11 @@ +@@ -1100,9 +1227,11 @@ instance->iter_key_list = &instance->key_head; hdb_handle_put (&object_instance_database, object_handle); @@ -2972,7 +3639,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -1119,6 +1230,8 @@ +@@ -1119,6 +1248,8 @@ struct list_head *list; unsigned int found = 0; @@ -2981,7 +3648,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, parent_object_handle, (void *)&instance); if (res != 0) { -@@ -1145,9 +1258,11 @@ +@@ -1145,9 +1276,11 @@ } hdb_handle_put (&object_instance_database, parent_object_handle); @@ -2993,7 +3660,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -1165,6 +1280,8 @@ +@@ -1165,6 +1298,8 @@ struct list_head *list; unsigned int found = 0; @@ -3002,7 +3669,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c res = hdb_handle_get (&object_instance_database, parent_object_handle, (void *)&instance); if (res != 0) { -@@ -1197,9 +1314,11 @@ +@@ -1197,9 +1332,11 @@ } hdb_handle_put (&object_instance_database, parent_object_handle); @@ -3014,7 +3681,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (-1); } -@@ -1210,9 +1329,12 @@ +@@ -1210,9 +1347,12 @@ struct object_instance *instance; unsigned int res; @@ -3027,7 +3694,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (res); } -@@ -1222,6 +1344,7 @@ +@@ -1222,6 +1362,7 @@ *parent_handle = instance->parent_handle; hdb_handle_put (&object_instance_database, object_handle); @@ -3035,7 +3702,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (0); } -@@ -1233,9 +1356,11 @@ +@@ -1233,9 +1374,11 @@ struct object_instance *instance; unsigned int res; @@ -3047,7 +3714,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (res); } -@@ -1243,6 +1368,7 @@ +@@ -1243,6 +1386,7 @@ *object_name_len = instance->object_name_len; hdb_handle_put (&object_instance_database, object_handle); @@ -3055,7 +3722,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (0); } -@@ -1253,6 +1379,7 @@ +@@ -1253,6 +1397,7 @@ object_key_change_notify_fn_t key_change_notify_fn, object_create_notify_fn_t object_create_notify_fn, object_destroy_notify_fn_t object_destroy_notify_fn, @@ -3063,7 +3730,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c void * priv_data_pt) { struct object_instance *instance; -@@ -1271,6 +1398,7 @@ +@@ -1271,6 +1416,7 @@ tracker_pt->key_change_notify_fn = key_change_notify_fn; tracker_pt->object_create_notify_fn = object_create_notify_fn; tracker_pt->object_destroy_notify_fn = object_destroy_notify_fn; @@ -3071,7 +3738,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c tracker_pt->data_pt = priv_data_pt; list_init(&tracker_pt->object_list); -@@ -1287,6 +1415,7 @@ +@@ -1287,6 +1433,7 @@ static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn, object_create_notify_fn_t object_create_notify_fn, object_destroy_notify_fn_t object_destroy_notify_fn, @@ -3079,7 +3746,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c void * priv_data_pt) { struct object_instance *instance; -@@ -1305,6 +1434,7 @@ +@@ -1305,6 +1452,7 @@ if (tracker_pt && (tracker_pt->data_pt == priv_data_pt) && (tracker_pt->object_create_notify_fn == object_create_notify_fn) && (tracker_pt->object_destroy_notify_fn == object_destroy_notify_fn) && @@ -3087,7 +3754,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c (tracker_pt->key_change_notify_fn == key_change_notify_fn)) { /* get the object & take this tracker off of it's list. */ -@@ -1337,9 +1467,11 @@ +@@ -1337,9 +1485,11 @@ struct object_instance *instance; unsigned int res; @@ -3099,7 +3766,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (res); } -@@ -1347,6 +1479,7 @@ +@@ -1347,6 +1497,7 @@ hdb_handle_put (&object_instance_database, object_handle); @@ -3107,7 +3774,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return (res); } -@@ -1358,13 +1491,19 @@ +@@ -1358,13 +1509,19 @@ int res; main_get_config_modules(&modules, &num_modules); @@ -3128,7 +3795,7 @@ diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c return 0; } -@@ -1376,14 +1515,22 @@ +@@ -1376,14 +1533,22 @@ int res; main_get_config_modules(&modules, &num_modules); @@ -3345,19 +4012,15 @@ diff -Naurd corosync-0.92/exec/quorum.h corosync-trunk/exec/quorum.h +#endif /* QUORUM_H_DEFINED */ diff -Naurd corosync-0.92/exec/service.c corosync-trunk/exec/service.c --- corosync-0.92/exec/service.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/service.c 2008-12-08 16:55:41.000000000 +0100 -@@ -78,6 +78,14 @@ ++++ corosync-trunk/exec/service.c 2009-01-27 09:59:14.000000000 +0100 +@@ -78,6 +78,10 @@ .name = "corosync_confdb", .ver = 0, }, + { + .name = "corosync_pload", + .ver = 0, -+ }, -+ { -+ .name = "corosync_quorum", -+ .ver = 0, -+ }, ++ } }; struct corosync_service_engine *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT]; @@ -3838,7 +4501,7 @@ diff -Naurd corosync-0.92/exec/totemconfig.h corosync-trunk/exec/totemconfig.h #include diff -Naurd corosync-0.92/exec/totemip.c corosync-trunk/exec/totemip.c --- corosync-0.92/exec/totemip.c 2008-09-16 17:35:09.000000000 +0200 -+++ corosync-trunk/exec/totemip.c 2008-12-02 15:50:51.000000000 +0100 ++++ corosync-trunk/exec/totemip.c 2009-01-26 21:46:45.000000000 +0100 @@ -226,7 +226,7 @@ sin->sin_len = sizeof(struct sockaddr_in); #endif @@ -3857,7 +4520,17 @@ diff -Naurd corosync-0.92/exec/totemip.c corosync-trunk/exec/totemip.c sin->sin6_scope_id = 2; memcpy(&sin->sin6_addr, ip_addr->addr, sizeof(struct in6_addr)); -@@ -472,7 +472,7 @@ +@@ -376,7 +376,8 @@ + int totemip_iface_check(struct totem_ip_address *bindnet, + struct totem_ip_address *boundto, + int *interface_up, +- int *interface_num) ++ int *interface_num, ++ int mask_high_bit) + { + int fd; + struct { +@@ -472,7 +473,7 @@ memcpy(&network, RTA_DATA(tb[IFA_BROADCAST]), sizeof(uint32_t)); memcpy(&addr, bindnet->addr, sizeof(uint32_t)); @@ -3866,6 +4539,25 @@ diff -Naurd corosync-0.92/exec/totemip.c corosync-trunk/exec/totemip.c memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN); found_if = 1; } +@@ -514,6 +515,18 @@ + } + } + finished: ++ /* ++ * Mask 32nd bit off to workaround bugs in other poeples code ++ * if configuration requests it. ++ */ ++ if (ipaddr.family == AF_INET && ipaddr.nodeid == 0) { ++ unsigned int nodeid = 0; ++ memcpy (&nodeid, ipaddr.addr, sizeof (int)); ++ if (mask_high_bit) { ++ nodeid &= 0x7FFFFFFF; ++ } ++ ipaddr.nodeid = nodeid; ++ } + totemip_copy (boundto, &ipaddr); + close(fd); + return 0; diff -Naurd corosync-0.92/exec/totemmrp.c corosync-trunk/exec/totemmrp.c --- corosync-0.92/exec/totemmrp.c 2008-08-14 18:44:26.000000000 +0200 +++ corosync-trunk/exec/totemmrp.c 2008-12-01 19:44:55.000000000 +0100 @@ -3880,7 +4572,7 @@ diff -Naurd corosync-0.92/exec/totemmrp.c corosync-trunk/exec/totemmrp.c } diff -Naurd corosync-0.92/exec/totemnet.c corosync-trunk/exec/totemnet.c --- corosync-0.92/exec/totemnet.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totemnet.c 2008-10-30 23:25:56.000000000 +0100 ++++ corosync-trunk/exec/totemnet.c 2009-01-25 22:15:25.000000000 +0100 @@ -137,7 +137,11 @@ int totemnet_log_level_debug; @@ -3909,7 +4601,28 @@ diff -Naurd corosync-0.92/exec/totemnet.c corosync-trunk/exec/totemnet.c static int authenticate_and_decrypt ( struct totemnet_instance *instance, -@@ -1192,6 +1200,7 @@ +@@ -691,18 +699,9 @@ + int res; + + res = totemip_iface_check (bindnet, bound_to, +- interface_up, interface_num); ++ interface_up, interface_num, +++ 0); // TODO andrew can address this instance->totem_config->clear_node_high_bit); + +- /* +- * If the desired binding is to an IPV4 network and nodeid isn't +- * specified, retrieve the node id from this_ip network address +- * +- * IPV6 networks must have a node ID specified since the node id +- * field is only 32 bits. +- */ +- if (bound_to->family == AF_INET && bound_to->nodeid == 0) { +- memcpy (&bound_to->nodeid, bound_to->addr, sizeof (int)); +- } + + return (res); + } +@@ -1192,6 +1191,7 @@ instance->totemnet_log_level_warning = totem_config->totem_logging_configuration.log_level_warning; instance->totemnet_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; instance->totemnet_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; @@ -3919,7 +4632,7 @@ diff -Naurd corosync-0.92/exec/totemnet.c corosync-trunk/exec/totemnet.c /* diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c --- corosync-0.92/exec/totempg.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totempg.c 2008-12-01 19:44:55.000000000 +0100 ++++ corosync-trunk/exec/totempg.c 2009-01-25 22:25:25.000000000 +0100 @@ -153,7 +153,10 @@ static int totempg_log_level_warning; static int totempg_log_level_notice; @@ -3932,7 +4645,21 @@ diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c struct totem_config *totempg_totem_config; -@@ -225,8 +228,11 @@ +@@ -165,6 +168,13 @@ + struct list_head list; + }; + ++enum throw_away_mode_t { ++ THROW_AWAY_INACTIVE, ++ THROW_AWAY_ACTIVE ++}; ++ ++static enum throw_away_mode_t throw_away_mode = THROW_AWAY_INACTIVE; ++ + DECLARE_LIST_INIT(assembly_list_inuse); + + DECLARE_LIST_INIT(assembly_list_free); +@@ -225,8 +235,11 @@ static pthread_mutex_t mcast_msg_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -3946,7 +4673,78 @@ diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c static struct assembly *assembly_ref (unsigned int nodeid) { -@@ -686,6 +692,7 @@ +@@ -558,43 +571,32 @@ + * the continued message. + */ + start = 0; +- if (continuation) { + +- if (continuation != assembly->last_frag_num) { +- log_printf (totempg_log_level_error, +- "Message continuation doesn't match previous frag e: %u - a: %u\n", +- assembly->last_frag_num, continuation); +- continuation = 0; +- } ++ if (throw_away_mode == THROW_AWAY_ACTIVE) { ++ /* Throw away the first msg block */ ++ if (mcast->fragmented == 0 || mcast->fragmented == 1) { ++ throw_away_mode = THROW_AWAY_INACTIVE; + +- if ((assembly->index == 0) || +- (!continuation && assembly->index)) { +- log_printf (totempg_log_level_error, +- "Throwing away broken message: continuation %u, index %u\n", +- continuation, assembly->index); +- continuation = 0; +- } +- +- /* +- * we decided to throw away the first continued message +- * in this buffer, if continuation was set to zero. +- */ +- if (!continuation) { + assembly->index += msg_lens[0]; + iov_delv.iov_base = &assembly->data[assembly->index]; + iov_delv.iov_len = msg_lens[1]; + start = 1; + } +- +- } +- +- for (i = start; i < msg_count; i++) { +- app_deliver_fn(nodeid, &iov_delv, 1, +- endian_conversion_required); +- assembly->index += msg_lens[i]; +- iov_delv.iov_base = &assembly->data[assembly->index]; +- if (i < (msg_count - 1)) { +- iov_delv.iov_len = msg_lens[i + 1]; ++ } else ++ if (throw_away_mode == THROW_AWAY_INACTIVE) { ++ if (continuation == assembly->last_frag_num) { ++ assembly->last_frag_num = mcast->fragmented; ++ for (i = start; i < msg_count; i++) { ++ app_deliver_fn(nodeid, &iov_delv, 1, ++ endian_conversion_required); ++ assembly->index += msg_lens[i]; ++ iov_delv.iov_base = &assembly->data[assembly->index]; ++ if (i < (msg_count - 1)) { ++ iov_delv.iov_len = msg_lens[i + 1]; ++ } ++ } ++ } else { ++ throw_away_mode = THROW_AWAY_ACTIVE; + } + } + +@@ -609,7 +611,6 @@ + /* + * Message is fragmented, keep around assembly list + */ +- assembly->last_frag_num = mcast->fragmented; + if (mcast->msg_count > 1) { + memmove (&assembly->data[0], + &assembly->data[assembly->index], +@@ -686,6 +687,7 @@ totempg_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; totempg_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; totempg_log_printf = totem_config->totem_logging_configuration.log_printf; @@ -3954,7 +4752,7 @@ diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c fragmentation_data = malloc (TOTEMPG_PACKET_SIZE); if (fragmentation_data == 0) { -@@ -721,14 +728,16 @@ +@@ -721,14 +723,16 @@ * Multicast a message */ static int mcast_msg ( @@ -3972,7 +4770,7 @@ diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c int max_packet_size = 0; int copy_len = 0; int copy_base = 0; -@@ -737,6 +746,18 @@ +@@ -737,6 +741,18 @@ pthread_mutex_lock (&mcast_msg_mutex); totemmrp_new_msg_signal (); @@ -3991,7 +4789,15 @@ diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c max_packet_size = TOTEMPG_PACKET_SIZE - (sizeof (unsigned short) * (mcast_packed_msg_count + 1)); -@@ -1243,7 +1264,7 @@ +@@ -774,6 +790,7 @@ + iovec[i].iov_base + copy_base, copy_len); + fragment_size += copy_len; + mcast_packed_msg_lens[mcast_packed_msg_count] += copy_len; ++ next_fragment = 1; + copy_len = 0; + copy_base = 0; + i++; +@@ -1243,7 +1260,7 @@ return (iface_string); } @@ -4043,7 +4849,7 @@ diff -Naurd corosync-0.92/exec/totemrrp.c corosync-trunk/exec/totemrrp.c instance->interfaces = totem_config->interfaces; diff -Naurd corosync-0.92/exec/totemsrp.c corosync-trunk/exec/totemsrp.c --- corosync-0.92/exec/totemsrp.c 2008-08-20 03:07:29.000000000 +0200 -+++ corosync-trunk/exec/totemsrp.c 2008-12-01 19:44:55.000000000 +0100 ++++ corosync-trunk/exec/totemsrp.c 2009-01-20 18:41:45.000000000 +0100 @@ -429,7 +429,11 @@ int totemsrp_log_level_debug; @@ -4163,6 +4969,15 @@ diff -Naurd corosync-0.92/exec/totemsrp.c corosync-trunk/exec/totemsrp.c commit_token->header.nodeid = instance->my_id.addr[0].nodeid; commit_token->memb_index += 1; assert (commit_token->memb_index <= commit_token->addr_entries); +@@ -2944,6 +2986,8 @@ + goto error_exit; + } + ++ token_hold_cancel_send (instance); ++ + callback_handle = (struct token_callback_instance *)malloc (sizeof (struct token_callback_instance)); + if (callback_handle == 0) { + return (-1); diff -Naurd corosync-0.92/exec/totemsrp.h corosync-trunk/exec/totemsrp.h --- corosync-0.92/exec/totemsrp.h 2008-08-14 18:44:26.000000000 +0200 +++ corosync-trunk/exec/totemsrp.h 2008-12-01 19:44:55.000000000 +0100 @@ -4177,7 +4992,7 @@ diff -Naurd corosync-0.92/exec/totemsrp.h corosync-trunk/exec/totemsrp.h extern int totemsrp_my_family_get ( diff -Naurd corosync-0.92/exec/util.c corosync-trunk/exec/util.c --- corosync-0.92/exec/util.c 2008-09-17 21:04:19.000000000 +0200 -+++ corosync-trunk/exec/util.c 2008-11-06 22:49:07.000000000 +0100 ++++ corosync-trunk/exec/util.c 2008-12-18 09:28:46.000000000 +0100 @@ -39,7 +39,7 @@ #include #include @@ -4223,7 +5038,8 @@ diff -Naurd corosync-0.92/exec/util.c corosync-trunk/exec/util.c log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting " "with status %d at %s:%u.\n", err, file, line); - logsys_flush(); - exit (EXIT_FAILURE); +- exit (EXIT_FAILURE); ++ exit (err); } #define min(a,b) ((a) < (b) ? (a) : (b)) @@ -4323,8 +5139,8 @@ diff -Naurd corosync-0.92/exec/vsf.h corosync-trunk/exec/vsf.h int view_list_entries, diff -Naurd corosync-0.92/exec/vsf_quorum.c corosync-trunk/exec/vsf_quorum.c --- corosync-0.92/exec/vsf_quorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/exec/vsf_quorum.c 2008-12-08 16:55:41.000000000 +0100 -@@ -0,0 +1,462 @@ ++++ corosync-trunk/exec/vsf_quorum.c 2009-01-08 12:12:10.000000000 +0100 +@@ -0,0 +1,468 @@ +/* + * Copyright (c) 2008 Red Hat, Inc. + * @@ -4630,6 +5446,12 @@ diff -Naurd corosync-0.92/exec/vsf_quorum.c corosync-trunk/exec/vsf_quorum.c + quorum_iface->init (api, quorum_api_set_quorum); + } + } ++ if (!quorum_iface) { ++ /* ++ * With no quorum provider, we are always quorate ++ */ ++ primary_designated = 1; ++ } + + return (0); +} @@ -5031,8 +5853,16 @@ diff -Naurd corosync-0.92/include/corosync/ais_util.h corosync-trunk/include/cor #endif /* AIS_UTIL_H_DEFINED */ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync/cfg.h --- corosync-0.92/include/corosync/cfg.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/cfg.h 2008-11-06 22:49:07.000000000 +0100 -@@ -36,9 +36,9 @@ ++++ corosync-trunk/include/corosync/cfg.h 2009-01-19 09:31:21.000000000 +0100 +@@ -1,6 +1,6 @@ + /* + * Copyright (c) 2005 MontaVista Software, Inc. +- * Copyright (c) 2006 Red Hat, Inc. ++ * Copyright (c) 2006-2009 Red Hat, Inc. + * + * All rights reserved. + * +@@ -36,33 +36,33 @@ #define AIS_COROSYNCCFG_H_DEFINED #include @@ -5044,10 +5874,50 @@ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync typedef enum { COROSYNC_CFG_ADMINISTRATIVETARGET_SERVICEUNIT = 0, -@@ -82,24 +82,46 @@ - COROSYNC_CFG_STATETYPE_PRESENCE = 4 - } CorosyncCfgStateTypeT; + COROSYNC_CFG_ADMINISTRATIVETARGET_SERVICEGROUP = 1, + COROSYNC_CFG_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2, + COROSYNC_CFG_ADMINISTRATIVETARGET_NODE = 3 +-} CorosyncCfgAdministrativeTargetT; ++} corosync_cfg_administrative_target_t; + typedef enum { + COROSYNC_CFG_ADMINISTRATIVESTATE_UNLOCKED = 0, + COROSYNC_CFG_ADMINISTRATIVESTATE_LOCKED = 1, + COROSYNC_CFG_ADMINISTRATIVESTATE_STOPPING = 2 +-} CorosyncCfgAdministrativeStateT; ++} corosync_cfg_administrative_state_t; + + typedef enum { + COROSYNC_CFG_OPERATIONALSTATE_ENABLED = 1, + COROSYNC_CFG_OPERATIONALSTATE_DISABLED = 2 +-} CorosyncCfgOperationalStateT; ++} corosync_cfg_operational_state_t; + + typedef enum { + COROSYNC_CFG_READINESSSTATE_OUTOFSERVICE = 1, + COROSYNC_CFG_READINESSSTATE_INSERVICE = 2, + COROSYNC_CFG_READINESSSTATE_STOPPING = 3 +-} CorosyncCfgReadinessStateT; ++} corosync_cfg_readiness_state_t; + + typedef enum { + COROSYNC_CFG_PRESENCESTATE_UNINSTANTIATED = 1, +@@ -72,7 +72,7 @@ + COROSYNC_CFG_PRESENCESTATE_RESTARTING = 5, + COROSYNC_CFG_PRESENCESTATE_INSTANTIATION_FAILED = 6, + COROSYNC_CFG_PRESENCESTATE_TERMINATION_FAILED = 7 +-} CorosyncCfgPresenceStateT; ++} corosync_cfg_presence_state_t; + + typedef enum { + COROSYNC_CFG_STATETYPE_OPERATIONAL = 0, +@@ -80,27 +80,63 @@ + COROSYNC_CFG_STATETYPE_READINESS = 2, + COROSYNC_CFG_STATETYPE_HA = 3, + COROSYNC_CFG_STATETYPE_PRESENCE = 4 +-} CorosyncCfgStateTypeT; ++} corosync_cfg_state_type_t; ++ +/* Shutdown types. + REQUEST is the normal shutdown. other daemons will be consulted + REGARDLESS will tell other daemons but ignore their opinions @@ -5057,44 +5927,69 @@ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync + COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST = 0, + COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS = 1, + COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE = 2, -+} CorosyncCfgShutdownFlagsT; ++} corosync_cfg_shutdown_flags_t; + +typedef enum { + COROSYNC_CFG_SHUTDOWN_FLAG_NO = 0, + COROSYNC_CFG_SHUTDOWN_FLAG_YES = 1, -+} CorosyncCfgShutdownReplyFlagsT; -+ ++} corosync_cfg_shutdown_reply_flags_t; + typedef struct { - SaNameT name; +- CorosyncCfgStateTypeT stateType; +- CorosyncCfgAdministrativeStateT administrativeState; +-} CorosyncCfgStateNotificationT; + cs_name_t name; - CorosyncCfgStateTypeT stateType; - CorosyncCfgAdministrativeStateT administrativeState; - } CorosyncCfgStateNotificationT; ++ corosync_cfg_state_type_t state_type; ++ corosync_cfg_administrative_state_t administrative_state; ++} corosync_cfg_state_notification_t; typedef struct { - SaUint32T numberOfItems; -+ uint32_t numberOfItems; - CorosyncCfgStateNotificationT *notification; - } CorosyncCfgStateNotificationBufferT; +- CorosyncCfgStateNotificationT *notification; +-} CorosyncCfgStateNotificationBufferT; ++ uint32_t number_of_items; ++ corosync_cfg_state_notification_t *notification; ++} corosync_cfg_state_notification_buffer_t; - typedef void (*CorosyncCfgStateTrackCallbackT) ( - CorosyncCfgStateNotificationBufferT *notificationBuffer, +-typedef void (*CorosyncCfgStateTrackCallbackT) ( +- CorosyncCfgStateNotificationBufferT *notificationBuffer, - SaAisErrorT error); ++typedef void (*corosync_cfg_state_track_callback_t) ( ++ corosync_cfg_state_notification_buffer_t *notification_buffer, + cs_error_t error); + -+typedef void (*CorosyncCfgShutdownCallbackT) ( ++typedef void (*corosync_cfg_shutdown_callback_t) ( + corosync_cfg_handle_t cfg_handle, -+ CorosyncCfgShutdownFlagsT flags); ++ corosync_cfg_shutdown_flags_t flags); typedef struct { - CorosyncCfgStateTrackCallbackT - corosyncCfgStateTrackCallback; -+ CorosyncCfgShutdownCallbackT -+ corosyncCfgShutdownCallback; - } CorosyncCfgCallbacksT; +- CorosyncCfgStateTrackCallbackT +- corosyncCfgStateTrackCallback; +-} CorosyncCfgCallbacksT; ++ corosync_cfg_state_track_callback_t corosync_cfg_state_track_callback; ++ corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback; ++} corosync_cfg_callbacks_t; ++ ++/* ++ * A node address. This is a complete sockaddr_in[6] ++ * To explain: ++ * If you cast cna_address to a 'struct sockaddr', the sa_family field ++ * will be AF_INET or AF_INET6. Armed with that knowledge you can then ++ * cast it to a sockaddr_in or sockaddr_in6 and pull out the address. ++ * No other sockaddr fields are valid. ++ * Also, you must ignore any part of the sockaddr beyond the length supplied ++ */ ++typedef struct ++{ ++ int addressLength; ++ char address[sizeof(struct sockaddr_in6)]; ++} corosync_cfg_node_address_t; ++ /* -@@ -109,67 +131,84 @@ + * Interfaces +@@ -109,70 +145,97 @@ extern "C" { #endif @@ -5102,7 +5997,8 @@ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync +cs_error_t corosync_cfg_initialize ( corosync_cfg_handle_t *cfg_handle, - const CorosyncCfgCallbacksT *cfgCallbacks); +- const CorosyncCfgCallbacksT *cfgCallbacks); ++ const corosync_cfg_callbacks_t *cfg_callbacks); -SaAisErrorT +cs_error_t @@ -5116,7 +6012,7 @@ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync corosync_cfg_dispatch ( corosync_cfg_handle_t cfg_handle, - SaDispatchFlagsT dispatchFlags); -+ cs_dispatch_flags_t dispatchFlags); ++ cs_dispatch_flags_t dispatch_flags); -SaAisErrorT +cs_error_t @@ -5154,15 +6050,19 @@ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync +cs_error_t corosync_cfg_administrative_state_get ( corosync_cfg_handle_t cfg_handle, - CorosyncCfgAdministrativeTargetT administrativeTarget, - CorosyncCfgAdministrativeStateT *administrativeState); +- CorosyncCfgAdministrativeTargetT administrativeTarget, +- CorosyncCfgAdministrativeStateT *administrativeState); ++ corosync_cfg_administrative_target_t administrative_target, ++ corosync_cfg_administrative_state_t *administrative_state); -SaAisErrorT +cs_error_t corosync_cfg_administrative_state_set ( corosync_cfg_handle_t cfg_handle, - CorosyncCfgAdministrativeTargetT administrativeTarget, - CorosyncCfgAdministrativeStateT administrativeState); +- CorosyncCfgAdministrativeTargetT administrativeTarget, +- CorosyncCfgAdministrativeStateT administrativeState); ++ corosync_cfg_administrative_target_t administrative_target, ++ corosync_cfg_administrative_state_t administrative_state); -SaAisErrorT +cs_error_t @@ -5174,26 +6074,40 @@ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync +cs_error_t +corosync_cfg_try_shutdown ( + corosync_cfg_handle_t cfg_handle, -+ CorosyncCfgShutdownFlagsT flags); ++ corosync_cfg_shutdown_flags_t flags); + + +cs_error_t +corosync_cfg_replyto_shutdown ( + corosync_cfg_handle_t cfg_handle, -+ CorosyncCfgShutdownReplyFlagsT flags); ++ corosync_cfg_shutdown_reply_flags_t flags); + +cs_error_t corosync_cfg_state_track ( corosync_cfg_handle_t cfg_handle, - SaUint8T trackFlags, -+ uint8_t trackFlags, - const CorosyncCfgStateNotificationT *notificationBuffer); +- const CorosyncCfgStateNotificationT *notificationBuffer); ++ uint8_t track_flags, ++ const corosync_cfg_state_notification_t *notification_buffer); -SaAisErrorT +cs_error_t corosync_cfg_state_track_stop ( corosync_cfg_handle_t cfg_handle); ++ ++cs_error_t ++corosync_cfg_get_node_addrs ( ++ corosync_cfg_handle_t cfg_handle, ++ int nodeid, ++ int max_addrs, ++ int *num_addrs, ++ corosync_cfg_node_address_t *addrs); ++ ++ + #ifdef __cplusplus + } + #endif diff -Naurd corosync-0.92/include/corosync/confdb.h corosync-trunk/include/corosync/confdb.h --- corosync-0.92/include/corosync/confdb.h 2008-09-03 09:58:08.000000000 +0200 +++ corosync-trunk/include/corosync/confdb.h 2008-11-06 22:49:07.000000000 +0100 @@ -5762,7 +6676,7 @@ diff -Naurd corosync-0.92/include/corosync/cpg.h corosync-trunk/include/corosync diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/include/corosync/engine/coroapi.h --- corosync-0.92/include/corosync/engine/coroapi.h 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/include/corosync/engine/coroapi.h 2008-12-08 16:55:41.000000000 +0100 ++++ corosync-trunk/include/corosync/engine/coroapi.h 2009-01-20 14:19:05.000000000 +0100 @@ -41,7 +41,7 @@ typedef void * corosync_timer_handle_t; @@ -5834,19 +6748,20 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu typedef enum { OBJECT_TRACK_DEPTH_ONE, -@@ -137,6 +158,11 @@ +@@ -137,6 +158,12 @@ OBJECT_KEY_DELETED } object_change_type_t; +typedef enum { + OBJDB_RELOAD_NOTIFY_START, -+ OBJDB_RELOAD_NOTIFY_END ++ OBJDB_RELOAD_NOTIFY_END, ++ OBJDB_RELOAD_NOTIFY_FAILED +} objdb_reload_notify_type_t; + typedef void (*object_key_change_notify_fn_t)(object_change_type_t change_type, unsigned int parent_object_handle, unsigned int object_handle, -@@ -159,8 +185,30 @@ +@@ -159,8 +186,30 @@ object_change_type_t type, void * priv_data_pt); @@ -5877,7 +6792,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu struct corosync_api_v1 { /* * Object and configuration APIs -@@ -280,12 +328,14 @@ +@@ -280,12 +329,14 @@ object_key_change_notify_fn_t key_change_notify_fn, object_create_notify_fn_t object_create_notify_fn, object_destroy_notify_fn_t object_destroy_notify_fn, @@ -5892,7 +6807,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu void * priv_data_pt); int (*object_write_config) (char **error_string); -@@ -357,7 +407,7 @@ +@@ -357,7 +408,7 @@ int id_len, void (*flow_control_state_set_fn) (void *context, @@ -5901,7 +6816,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu void *context); void (*ipc_fc_destroy) ( -@@ -373,7 +423,7 @@ +@@ -373,7 +424,7 @@ /* * Totem APIs */ @@ -5910,7 +6825,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu int (*totem_family_get) (void); -@@ -393,12 +443,20 @@ +@@ -393,12 +444,20 @@ char *(*totem_ip_print) (struct totem_ip_address *addr); @@ -5932,7 +6847,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu void (*deliver_fn) ( unsigned int nodeid, -@@ -414,31 +472,31 @@ +@@ -414,31 +473,31 @@ struct memb_ring_id *ring_id)); int (*tpg_exit) ( @@ -5970,7 +6885,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu int guarantee, struct corosync_tpg_group *groups, int groups_cnt, -@@ -446,7 +504,7 @@ +@@ -446,7 +505,7 @@ int iov_len); int (*tpg_groups_send_ok) ( @@ -5979,7 +6894,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu struct corosync_tpg_group *groups, int groups_cnt, struct iovec *iovec, -@@ -456,6 +514,19 @@ +@@ -456,6 +515,19 @@ char *service_name); /* @@ -5999,7 +6914,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu * Plugin loading and unloading */ int (*plugin_interface_reference) ( -@@ -485,7 +556,7 @@ +@@ -485,7 +557,7 @@ */ void (*error_memory_failure) (void); #define corosync_fatal_error(err) api->fatal_error ((err), __FILE__, __LINE__) @@ -6008,7 +6923,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu }; #define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) ) -@@ -496,7 +567,7 @@ +@@ -496,7 +568,7 @@ void (*lib_handler_fn) (void *conn, void *msg); int response_size; int response_id; @@ -6017,7 +6932,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu }; struct corosync_exec_handler { -@@ -512,7 +583,8 @@ +@@ -512,7 +584,8 @@ char *name; unsigned short id; unsigned int private_data_size; @@ -6029,7 +6944,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/inclu void (*exec_dump_fn) (void); diff -Naurd corosync-0.92/include/corosync/engine/logsys.h corosync-trunk/include/corosync/engine/logsys.h --- corosync-0.92/include/corosync/engine/logsys.h 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/include/corosync/engine/logsys.h 2008-10-30 23:25:56.000000000 +0100 ++++ corosync-trunk/include/corosync/engine/logsys.h 2009-01-16 09:59:09.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2004 MontaVista Software, Inc. @@ -6126,10 +7041,16 @@ diff -Naurd corosync-0.92/include/corosync/engine/logsys.h corosync-trunk/includ extern unsigned int logsys_config_subsys_set ( const char *subsys, unsigned int tags, -@@ -137,33 +119,54 @@ +@@ -137,33 +119,60 @@ extern const char *logsys_priority_name_get ( unsigned int priority); ++extern int logsys_tag_id_get ( ++ const char *name); ++ ++extern const char *logsys_tag_name_get ( ++ unsigned int tag); ++ +extern void logsys_fork_completed (void); + extern void logsys_flush (void); @@ -6190,7 +7111,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/logsys.h corosync-trunk/includ __attribute__ ((constructor)) static void logsys_system_init (void) \ { \ char *error_string; \ -@@ -171,13 +174,11 @@ +@@ -171,13 +180,11 @@ logsys_config_mode_set (mode); \ logsys_config_file_set (&error_string, (file)); \ logsys_config_facility_set (name, (facility)); \ @@ -6207,7 +7128,7 @@ diff -Naurd corosync-0.92/include/corosync/engine/logsys.h corosync-trunk/includ #define LOGSYS_DECLARE_NOSUBSYS(priority) \ __attribute__ ((constructor)) static void logsys_nosubsys_init (void) \ { \ -@@ -206,161 +207,88 @@ +@@ -206,161 +213,88 @@ _logsys_subsys_create ((subsys), (priority)); \ } @@ -6638,8 +7559,15 @@ diff -Naurd corosync-0.92/include/corosync/evs.h corosync-trunk/include/corosync unsigned int *member_list, diff -Naurd corosync-0.92/include/corosync/ipc_cfg.h corosync-trunk/include/corosync/ipc_cfg.h --- corosync-0.92/include/corosync/ipc_cfg.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/ipc_cfg.h 2008-11-06 22:49:07.000000000 +0100 -@@ -35,8 +35,8 @@ ++++ corosync-trunk/include/corosync/ipc_cfg.h 2009-01-19 09:31:21.000000000 +0100 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2005 MontaVista Software, Inc. ++ * Copyright (c) 2009 Red Hat, Inc. + * + * All rights reserved. + * +@@ -35,8 +36,8 @@ #define AIS_IPC_CFG_H_DEFINED #include @@ -6649,7 +7577,7 @@ diff -Naurd corosync-0.92/include/corosync/ipc_cfg.h corosync-trunk/include/coro #include "cfg.h" enum req_lib_cfg_types { -@@ -47,7 +47,10 @@ +@@ -47,7 +48,11 @@ MESSAGE_REQ_CFG_ADMINISTRATIVESTATESET = 4, MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET = 5, MESSAGE_REQ_CFG_SERVICELOAD = 6, @@ -6657,11 +7585,12 @@ diff -Naurd corosync-0.92/include/corosync/ipc_cfg.h corosync-trunk/include/coro + MESSAGE_REQ_CFG_SERVICEUNLOAD = 7, + MESSAGE_REQ_CFG_KILLNODE = 8, + MESSAGE_REQ_CFG_TRYSHUTDOWN = 9, -+ MESSAGE_REQ_CFG_REPLYTOSHUTDOWN = 10 ++ MESSAGE_REQ_CFG_REPLYTOSHUTDOWN = 10, ++ MESSAGE_REQ_CFG_GET_NODE_ADDRS = 11 }; enum res_lib_cfg_types { -@@ -58,12 +61,15 @@ +@@ -58,13 +63,17 @@ MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 4, MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 5, MESSAGE_RES_CFG_SERVICELOAD = 6, @@ -6669,35 +7598,64 @@ diff -Naurd corosync-0.92/include/corosync/ipc_cfg.h corosync-trunk/include/coro + MESSAGE_RES_CFG_SERVICEUNLOAD = 7, + MESSAGE_RES_CFG_KILLNODE = 8, + MESSAGE_RES_CFG_TRYSHUTDOWN = 9, -+ MESSAGE_RES_CFG_TESTSHUTDOWN = 10 ++ MESSAGE_RES_CFG_TESTSHUTDOWN = 10, ++ MESSAGE_RES_CFG_GET_NODE_ADDRS = 11 }; struct req_lib_cfg_statetrack { mar_req_header_t header; - SaUint8T trackFlags; -+ uint8_t trackFlags; - CorosyncCfgStateNotificationT *notificationBufferAddress; +- CorosyncCfgStateNotificationT *notificationBufferAddress; ++ uint8_t track_flags; ++ corosync_cfg_state_notification_t *notification_buffer_address; }; -@@ -81,7 +87,7 @@ + struct res_lib_cfg_statetrack { +@@ -81,9 +90,9 @@ struct req_lib_cfg_administrativestateset { mar_req_header_t header; - SaNameT compName; -+ cs_name_t compName; - CorosyncCfgAdministrativeTargetT administrativeTarget; - CorosyncCfgAdministrativeStateT administrativeState; +- CorosyncCfgAdministrativeTargetT administrativeTarget; +- CorosyncCfgAdministrativeStateT administrativeState; ++ cs_name_t comp_name; ++ corosync_cfg_administrative_target_t administrative_target; ++ corosync_cfg_administrative_state_t administrative_state; }; -@@ -92,7 +98,7 @@ + + struct res_lib_cfg_administrativestateset { +@@ -92,9 +101,9 @@ struct req_lib_cfg_administrativestateget { mar_req_header_t header; - SaNameT compName; -+ cs_name_t compName; - CorosyncCfgAdministrativeTargetT administrativeTarget; - CorosyncCfgAdministrativeStateT administrativeState; +- CorosyncCfgAdministrativeTargetT administrativeTarget; +- CorosyncCfgAdministrativeStateT administrativeState; ++ cs_name_t comp_name; ++ corosync_cfg_administrative_target_t administrative_target; ++ corosync_cfg_administrative_state_t administrative_state; }; -@@ -140,6 +146,35 @@ + + struct res_lib_cfg_administrativestateget { +@@ -122,7 +131,7 @@ + + struct req_lib_cfg_serviceload { + mar_res_header_t header __attribute__((aligned(8))); +- char *service_name[256] __attribute__((aligned(8))); ++ char service_name[256] __attribute__((aligned(8))); + unsigned int service_ver; + }; + +@@ -132,7 +141,7 @@ + + struct req_lib_cfg_serviceunload { + mar_res_header_t header __attribute__((aligned(8))); +- char *service_name[256] __attribute__((aligned(8))); ++ char service_name[256] __attribute__((aligned(8))); + unsigned int service_ver; + }; + +@@ -140,17 +149,65 @@ mar_res_header_t header __attribute__((aligned(8))); }; @@ -6729,21 +7687,41 @@ diff -Naurd corosync-0.92/include/corosync/ipc_cfg.h corosync-trunk/include/coro + mar_res_header_t header __attribute__((aligned(8))); + unsigned int flags; +}; ++ ++struct req_lib_cfg_get_node_addrs { ++ mar_req_header_t header __attribute__((aligned(8))); ++ unsigned int nodeid; ++}; ++ ++struct res_lib_cfg_get_node_addrs { ++ mar_res_header_t header __attribute__((aligned(8))); ++ unsigned int family; ++ unsigned int num_addrs; ++ char addrs[TOTEMIP_ADDRLEN][0]; ++}; + typedef enum { AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0, AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1, -@@ -153,4 +188,11 @@ - AIS_AMF_ADMINISTRATIVESTATE_STOPPING = 2 - } corosyncAdministrativeState; + AIS_AMF_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2, + AIS_AMF_ADMINISTRATIVETARGET_NODE = 3 +-} corosyncAdministrativeTarget; ++} corosync_administrative_target_t; + typedef enum { + AIS_AMF_ADMINISTRATIVESTATE_UNLOCKED = 0, + AIS_AMF_ADMINISTRATIVESTATE_LOCKED = 1, + AIS_AMF_ADMINISTRATIVESTATE_STOPPING = 2 +-} corosyncAdministrativeState; ++} corosync_administrative_state_t; ++ +typedef enum { + CFG_SHUTDOWN_FLAG_REQUEST = 0, + CFG_SHUTDOWN_FLAG_REGARDLESS = 1, + CFG_SHUTDOWN_FLAG_IMMEDIATE = 2, -+} CorosyncShutdownFlagsT; -+ ++} corosync_shutdown_flags_t; + + #endif /* AIS_IPC_CFG_H_DEFINED */ diff -Naurd corosync-0.92/include/corosync/ipc_confdb.h corosync-trunk/include/corosync/ipc_confdb.h --- corosync-0.92/include/corosync/ipc_confdb.h 2008-09-03 09:58:08.000000000 +0200 @@ -6759,7 +7737,7 @@ diff -Naurd corosync-0.92/include/corosync/ipc_confdb.h corosync-trunk/include/c enum req_confdb_types { diff -Naurd corosync-0.92/include/corosync/ipc_cpg.h corosync-trunk/include/corosync/ipc_cpg.h --- corosync-0.92/include/corosync/ipc_cpg.h 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/include/corosync/ipc_cpg.h 2008-11-06 22:49:07.000000000 +0100 ++++ corosync-trunk/include/corosync/ipc_cpg.h 2009-01-08 07:29:16.000000000 +0100 @@ -35,7 +35,7 @@ #define IPC_CPG_H_DEFINED @@ -6769,6 +7747,15 @@ diff -Naurd corosync-0.92/include/corosync/ipc_cpg.h corosync-trunk/include/coro #include "ipc_gen.h" #include "mar_cpg.h" +@@ -143,7 +143,7 @@ + + struct req_lib_cpg_membership { + mar_req_header_t header __attribute__((aligned(8))); +- mar_cpg_name_t group_name __attribute__((aligned(8))); ++// mar_cpg_name_t group_name __attribute__((aligned(8))); + }; + + struct res_lib_cpg_confchg_callback { diff -Naurd corosync-0.92/include/corosync/ipc_evs.h corosync-trunk/include/corosync/ipc_evs.h --- corosync-0.92/include/corosync/ipc_evs.h 2008-08-14 16:59:50.000000000 +0200 +++ corosync-trunk/include/corosync/ipc_evs.h 2008-11-06 22:49:07.000000000 +0100 @@ -6957,6 +7944,159 @@ diff -Naurd corosync-0.92/include/corosync/ipc_quorum.h corosync-trunk/include/c +}; + +#endif +diff -Naurd corosync-0.92/include/corosync/ipc_votequorum.h corosync-trunk/include/corosync/ipc_votequorum.h +--- corosync-0.92/include/corosync/ipc_votequorum.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/ipc_votequorum.h 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,149 @@ ++/* ++ * Copyright (c) 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 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 CONTIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ++ * THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++#ifndef IPC_VOTEQUORUM_H_DEFINED ++#define IPC_VOTEQUORUM_H_DEFINED ++ ++#include "corosync/corotypes.h" ++#include "corosync/ipc_gen.h" ++ ++// ILLEGAL value!! ++#define VOTEQUORUM_SERVICE 15 ++ ++#define VOTEQUORUM_MAX_QDISK_NAME_LEN 255 ++ ++ ++enum req_votequorum_types { ++ MESSAGE_REQ_VOTEQUORUM_GETINFO = 0, ++ MESSAGE_REQ_VOTEQUORUM_SETEXPECTED, ++ MESSAGE_REQ_VOTEQUORUM_SETVOTES, ++ MESSAGE_REQ_VOTEQUORUM_QDISK_REGISTER, ++ MESSAGE_REQ_VOTEQUORUM_QDISK_UNREGISTER, ++ MESSAGE_REQ_VOTEQUORUM_QDISK_POLL, ++ MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO, ++ MESSAGE_REQ_VOTEQUORUM_SETSTATE, ++ MESSAGE_REQ_VOTEQUORUM_LEAVING, ++ MESSAGE_REQ_VOTEQUORUM_TRACKSTART, ++ MESSAGE_REQ_VOTEQUORUM_TRACKSTOP ++}; ++ ++enum res_votequorum_types { ++ MESSAGE_RES_VOTEQUORUM_STATUS = 0, ++ MESSAGE_RES_VOTEQUORUM_GETINFO, ++ MESSAGE_RES_VOTEQUORUM_QDISK_GETINFO, ++ MESSAGE_RES_VOTEQUORUM_TRACKSTART, ++ MESSAGE_RES_VOTEQUORUM_NOTIFICATION ++}; ++ ++struct req_lib_votequorum_setvotes { ++ mar_req_header_t header __attribute__((aligned(8))); ++ unsigned int votes; ++ int nodeid; ++}; ++ ++struct req_lib_votequorum_qdisk_register { ++ mar_req_header_t header __attribute__((aligned(8))); ++ unsigned int votes; ++ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; ++}; ++ ++struct req_lib_votequorum_qdisk_poll { ++ mar_req_header_t header __attribute__((aligned(8))); ++ int state; ++}; ++ ++struct req_lib_votequorum_setexpected { ++ mar_req_header_t header __attribute__((aligned(8))); ++ unsigned int expected_votes; ++}; ++ ++struct req_lib_votequorum_trackstart { ++ mar_req_header_t header __attribute__((aligned(8))); ++ uint64_t context; ++ unsigned int track_flags; ++}; ++ ++struct req_lib_votequorum_general { ++ mar_req_header_t header __attribute__((aligned(8))); ++}; ++ ++#define VOTEQUORUM_REASON_KILL_REJECTED 1 ++#define VOTEQUORUM_REASON_KILL_APPLICATION 2 ++#define VOTEQUORUM_REASON_KILL_REJOIN 3 ++ ++struct req_lib_votequorum_getinfo { ++ mar_req_header_t header __attribute__((aligned(8))); ++ int nodeid; ++}; ++ ++struct res_lib_votequorum_status { ++ mar_res_header_t header __attribute__((aligned(8))); ++}; ++ ++#define VOTEQUORUM_INFO_FLAG_HASSTATE 1 ++#define VOTEQUORUM_INFO_FLAG_DISALLOWED 2 ++#define VOTEQUORUM_INFO_FLAG_TWONODE 4 ++#define VOTEQUORUM_INFO_FLAG_QUORATE 8 ++ ++struct res_lib_votequorum_getinfo { ++ mar_res_header_t header __attribute__((aligned(8))); ++ int nodeid; ++ unsigned int votes; ++ unsigned int expected_votes; ++ unsigned int highest_expected; ++ unsigned int total_votes; ++ unsigned int quorum; ++ unsigned int flags; ++}; ++ ++struct res_lib_votequorum_qdisk_getinfo { ++ mar_res_header_t header __attribute__((aligned(8))); ++ unsigned int votes; ++ unsigned int state; ++ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; ++}; ++ ++struct votequorum_node { ++ mar_uint32_t nodeid; ++ mar_uint32_t state; ++}; ++ ++struct res_lib_votequorum_notification { ++ mar_res_header_t header __attribute__((aligned(8))); ++ mar_uint32_t quorate __attribute__((aligned(8))); ++ mar_uint64_t context __attribute__((aligned(8))); ++ mar_uint32_t node_list_entries __attribute__((aligned(8))); ++ struct votequorum_node node_list[] __attribute__((aligned(8))); ++}; ++ ++#endif diff -Naurd corosync-0.92/include/corosync/mar_gen.h corosync-trunk/include/corosync/mar_gen.h --- corosync-0.92/include/corosync/mar_gen.h 2008-08-15 08:15:26.000000000 +0200 +++ corosync-trunk/include/corosync/mar_gen.h 2008-11-06 22:49:07.000000000 +0100 @@ -7442,6 +8582,18 @@ diff -Naurd corosync-0.92/include/corosync/totem/totem.h corosync-trunk/include/ enum totem_callback_token_type { TOTEM_CALLBACK_TOKEN_RECEIVED = 1, TOTEM_CALLBACK_TOKEN_SENT = 2 +diff -Naurd corosync-0.92/include/corosync/totem/totemip.h corosync-trunk/include/corosync/totem/totemip.h +--- corosync-0.92/include/corosync/totem/totemip.h 2008-08-14 16:59:50.000000000 +0200 ++++ corosync-trunk/include/corosync/totem/totemip.h 2009-01-25 22:15:25.000000000 +0100 +@@ -72,7 +72,7 @@ + extern int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr, + uint16_t port, struct sockaddr_storage *saddr, int *addrlen); + extern int totemip_parse(struct totem_ip_address *totemip, char *addr, int family); +-extern int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num); ++extern int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num, int mask_high_bit); + + /* These two simulate a zero in_addr by clearing the family field */ + static inline void totemip_zero_set(struct totem_ip_address *addr) diff -Naurd corosync-0.92/include/corosync/totem/totempg.h corosync-trunk/include/corosync/totem/totempg.h --- corosync-0.92/include/corosync/totem/totempg.h 2008-08-14 16:59:50.000000000 +0200 +++ corosync-trunk/include/corosync/totem/totempg.h 2008-12-01 19:44:55.000000000 +0100 @@ -7454,6 +8606,208 @@ diff -Naurd corosync-0.92/include/corosync/totem/totempg.h corosync-trunk/includ extern int totempg_my_family_get (void); +diff -Naurd corosync-0.92/include/corosync/votequorum.h corosync-trunk/include/corosync/votequorum.h +--- corosync-0.92/include/corosync/votequorum.h 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/include/corosync/votequorum.h 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,198 @@ ++/* ++ * Copyright (c) 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 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 CONTIBUTORS "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 COROSYNC_VOTEQUORUM_H_DEFINED ++#define COROSYNC_VOTEQUORUM_H_DEFINED ++ ++typedef uint64_t votequorum_handle_t; ++ ++ ++#define VOTEQUORUM_MAX_QDISK_NAME_LEN 255 ++ ++#define VOTEQUORUM_INFO_FLAG_HASSTATE 1 ++#define VOTEQUORUM_INFO_FLAG_DISALLOWED 2 ++#define VOTEQUORUM_INFO_FLAG_TWONODE 4 ++#define VOTEQUORUM_INFO_FLAG_QUORATE 8 ++ ++#define NODESTATE_JOINING 1 ++#define NODESTATE_MEMBER 2 ++#define NODESTATE_DEAD 3 ++#define NODESTATE_LEAVING 4 ++#define NODESTATE_DISALLOWED 5 ++ ++ ++/** @} */ ++ ++struct votequorum_info { ++ unsigned int node_id; ++ unsigned int node_votes; ++ unsigned int node_expected_votes; ++ unsigned int highest_expected; ++ unsigned int total_votes; ++ unsigned int quorum; ++ unsigned int flags; ++}; ++ ++struct votequorum_qdisk_info { ++ unsigned int votes; ++ unsigned int state; ++ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; ++}; ++ ++typedef struct { ++ uint32_t nodeid; ++ uint32_t state; ++} votequorum_node_t; ++ ++ ++typedef void (*votequorum_notification_fn_t) ( ++ votequorum_handle_t handle, ++ uint64_t context, ++ uint32_t quorate, ++ uint32_t node_list_entries, ++ votequorum_node_t node_list[] ++ ); ++ ++typedef struct { ++ votequorum_notification_fn_t votequorum_notify_fn; ++} votequorum_callbacks_t; ++ ++ ++/* ++ * Create a new quorum connection ++ */ ++cs_error_t votequorum_initialize ( ++ votequorum_handle_t *handle, ++ votequorum_callbacks_t *callbacks); ++ ++/* ++ * Close the quorum handle ++ */ ++cs_error_t votequorum_finalize ( ++ votequorum_handle_t handle); ++ ++ ++/* ++ * Dispatch messages and configuration changes ++ */ ++cs_error_t votequorum_dispatch ( ++ votequorum_handle_t handle, ++ cs_dispatch_flags_t dispatch_types); ++ ++ ++/* ++ * Get quorum information. ++ */ ++cs_error_t votequorum_getinfo ( ++ votequorum_handle_t handle, ++ unsigned int nodeid, ++ struct votequorum_info *info); ++ ++/* ++ * set expected_votes ++ */ ++cs_error_t votequorum_setexpected ( ++ votequorum_handle_t handle, ++ unsigned int expected_votes); ++ ++/* ++ * set votes for a node ++ */ ++cs_error_t votequorum_setvotes ( ++ votequorum_handle_t handle, ++ unsigned int nodeid, ++ unsigned int votes); ++ ++/* ++ * Register a quorum device ++ * it will be DEAD until polled ++ */ ++cs_error_t votequorum_qdisk_register ( ++ votequorum_handle_t handle, ++ char *name, ++ unsigned int votes); ++ ++/* ++ * Unregister a quorum device ++ */ ++cs_error_t votequorum_qdisk_unregister ( ++ votequorum_handle_t handle); ++ ++/* ++ * Poll a quorum device ++ */ ++cs_error_t votequorum_qdisk_poll ( ++ votequorum_handle_t handle, ++ unsigned int state); ++ ++/* ++ * Get quorum device information ++ */ ++cs_error_t votequorum_qdisk_getinfo ( ++ votequorum_handle_t handle, ++ struct votequorum_qdisk_info *info); ++ ++/* ++ * Set the "hasstate" bit for this node ++ */ ++cs_error_t votequorum_setstate ( ++ votequorum_handle_t handle); ++ ++/* Track node and quorum changes */ ++cs_error_t votequorum_trackstart ( ++ votequorum_handle_t handle, ++ uint64_t context, ++ unsigned int flags ); ++ ++cs_error_t votequorum_trackstop ( ++ votequorum_handle_t handle); ++ ++/* ++ * Set our LEAVING flag. we should exit soon after this ++ */ ++cs_error_t votequorum_leaving ( ++ votequorum_handle_t handle); ++ ++/* ++ * Save and retrieve private data/context ++ */ ++cs_error_t votequorum_context_get ( ++ votequorum_handle_t handle, ++ void **context); ++ ++cs_error_t votequorum_context_set ( ++ votequorum_handle_t handle, ++ void *context); ++ ++#endif /* COROSYNC_VOTEQUORUM_H_DEFINED */ diff -Naurd corosync-0.92/lcr/Makefile corosync-trunk/lcr/Makefile --- corosync-0.92/lcr/Makefile 2008-08-15 08:15:26.000000000 +0200 +++ corosync-trunk/lcr/Makefile 2008-11-11 18:26:58.000000000 +0100 @@ -7532,8 +8886,15 @@ diff -Naurd corosync-0.92/lcr/uis.c corosync-trunk/lcr/uis.c diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c --- corosync-0.92/lib/cfg.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lib/cfg.c 2008-11-11 18:26:58.000000000 +0100 -@@ -7,7 +7,7 @@ ++++ corosync-trunk/lib/cfg.c 2009-01-19 09:31:21.000000000 +0100 +@@ -1,13 +1,13 @@ + /* + * Copyright (c) 2002-2005 MontaVista Software, Inc. +- * Copyright (c) 2006-2007 Red Hat, Inc. ++ * Copyright (c) 2006-2009 Red Hat, Inc. + * + * All rights reserved. + * * Author: Steven Dake (sdake@redhat.com) * * This software licensed under BSD license, the text of which follows: @@ -7542,13 +8903,20 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -@@ -45,14 +45,14 @@ +@@ -40,19 +40,21 @@ + #include + #include + #include ++#include + #include + #include #include #include -#include +#include #include ++#include #include #include #include @@ -7559,16 +8927,43 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c mar_res_header_t header; char data[4096]; }; -@@ -64,7 +64,7 @@ +@@ -63,15 +65,15 @@ + struct cfg_instance { int response_fd; int dispatch_fd; - CorosyncCfgCallbacksT callbacks; +- CorosyncCfgCallbacksT callbacks; - SaNameT compName; -+ cs_name_t compName; - int compRegistered; +- int compRegistered; ++ corosync_cfg_callbacks_t callbacks; ++ cs_name_t comp_name; ++ int comp_registered; int finalize; pthread_mutex_t response_mutex; -@@ -94,31 +94,31 @@ + pthread_mutex_t dispatch_mutex; + }; + +-static void cfg_handleInstanceDestructor (void *); ++static void cfg_handle_instance_destructor (void *); + + /* + * All instances in one database +@@ -80,13 +82,13 @@ + .handleCount = 0, + .handles = 0, + .mutex = PTHREAD_MUTEX_INITIALIZER, +- .handleInstanceDestructor = cfg_handleInstanceDestructor ++ .handleInstanceDestructor = cfg_handle_instance_destructor + }; + + /* + * Implementation + */ +-void cfg_handleInstanceDestructor (void *instance) ++void cfg_handle_instance_destructor (void *instance) + { + struct cfg_instance *cfg_instance = instance; + +@@ -94,84 +96,85 @@ pthread_mutex_destroy (&cfg_instance->dispatch_mutex); } @@ -7576,7 +8971,8 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c +cs_error_t corosync_cfg_initialize ( corosync_cfg_handle_t *cfg_handle, - const CorosyncCfgCallbacksT *cfgCallbacks) +- const CorosyncCfgCallbacksT *cfgCallbacks) ++ const corosync_cfg_callbacks_t *cfg_callbacks) { struct cfg_instance *cfg_instance; - SaAisErrorT error = SA_AIS_OK; @@ -7606,7 +9002,13 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c goto error_put_destroy; } -@@ -130,48 +130,49 @@ +- if (cfgCallbacks) { +- memcpy (&cfg_instance->callbacks, cfgCallbacks, sizeof (CorosyncCfgCallbacksT)); ++ if (cfg_callbacks) { ++ memcpy (&cfg_instance->callbacks, cfg_callbacks, sizeof (corosync_cfg_callbacks_t)); + } + + pthread_mutex_init (&cfg_instance->response_mutex, NULL); pthread_mutex_init (&cfg_instance->dispatch_mutex, NULL); @@ -7657,7 +9059,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c corosync_cfg_dispatch ( corosync_cfg_handle_t cfg_handle, - SaDispatchFlagsT dispatchFlags) -+ cs_dispatch_flags_t dispatchFlags) ++ cs_dispatch_flags_t dispatch_flags) { struct pollfd ufds; int timeout = -1; @@ -7670,11 +9072,13 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c #ifdef COMPILE_OUT struct res_lib_corosync_healthcheckcallback *res_lib_corosync_healthcheckcallback; struct res_lib_corosync_readinessstatesetcallback *res_lib_corosync_readinessstatesetcallback; -@@ -180,18 +181,18 @@ +@@ -179,19 +182,19 @@ + struct res_lib_corosync_csiremovecallback *res_lib_corosync_csiremovecallback; struct res_lib_cfg_statetrackcallback *res_lib_cfg_statetrackcallback; #endif - CorosyncCfgCallbacksT callbacks; +- CorosyncCfgCallbacksT callbacks; - struct res_overlay dispatch_data; ++ corosync_cfg_callbacks_t callbacks; + struct cfg_res_overlay dispatch_data; error = saHandleInstanceGet (&cfg_hdb, cfg_handle, @@ -7689,11 +9093,11 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c + * Timeout instantly for CS_DISPATCH_ALL */ - if (dispatchFlags == SA_DISPATCH_ALL) { -+ if (dispatchFlags == CS_DISPATCH_ALL) { ++ if (dispatch_flags == CS_DISPATCH_ALL) { timeout = 0; } -@@ -204,14 +205,14 @@ +@@ -204,14 +207,14 @@ ufds.revents = 0; error = saPollRetry (&ufds, 1, timeout); @@ -7710,7 +9114,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c goto error_nounlock; } -@@ -219,13 +220,13 @@ +@@ -219,13 +222,13 @@ * Handle has been finalized in another thread */ if (cfg_instance->finalize == 1) { @@ -7722,11 +9126,11 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c dispatch_avail = ufds.revents & POLLIN; - if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) { -+ if (dispatch_avail == 0 && dispatchFlags == CS_DISPATCH_ALL) { ++ if (dispatch_avail == 0 && dispatch_flags == CS_DISPATCH_ALL) { pthread_mutex_unlock (&cfg_instance->dispatch_mutex); break; /* exit do while cont is 1 loop */ } else -@@ -240,13 +241,13 @@ +@@ -240,13 +243,13 @@ */ error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.header, sizeof (mar_res_header_t)); @@ -7742,15 +9146,23 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c goto error_unlock; } } -@@ -267,9 +268,14 @@ +@@ -260,16 +263,21 @@ + * A risk of this dispatch method is that the callback routines may + * operate at the same time that cfgFinalize has been called in another thread. + */ +- memcpy (&callbacks, &cfg_instance->callbacks, sizeof (CorosyncCfgCallbacksT)); ++ memcpy (&callbacks, &cfg_instance->callbacks, sizeof (corosync_cfg_callbacks_t)); + pthread_mutex_unlock (&cfg_instance->dispatch_mutex); + + /* * Dispatch incoming response */ switch (dispatch_data.header.id) { - + case MESSAGE_RES_CFG_TESTSHUTDOWN: -+ if (callbacks.corosyncCfgShutdownCallback) { ++ if (callbacks.corosync_cfg_shutdown_callback) { + res_lib_cfg_testshutdown = (struct res_lib_cfg_testshutdown *)&dispatch_data; -+ callbacks.corosyncCfgShutdownCallback(cfg_handle, res_lib_cfg_testshutdown->flags); ++ callbacks.corosync_cfg_shutdown_callback(cfg_handle, res_lib_cfg_testshutdown->flags); + } + break; default: @@ -7759,11 +9171,13 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c goto error_nounlock; break; } -@@ -278,31 +284,31 @@ +@@ -277,32 +285,32 @@ + /* * Determine if more messages should be processed */ - switch (dispatchFlags) { +- switch (dispatchFlags) { - case SA_DISPATCH_ONE: ++ switch (dispatch_flags) { + case CS_DISPATCH_ONE: cont = 0; break; @@ -7798,7 +9212,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -316,8 +322,8 @@ +@@ -316,8 +324,8 @@ if (cfg_instance->finalize) { pthread_mutex_unlock (&cfg_instance->response_mutex); pthread_mutex_unlock (&cfg_instance->dispatch_mutex); @@ -7809,7 +9223,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c } cfg_instance->finalize = 1; -@@ -330,7 +336,7 @@ +@@ -330,7 +338,7 @@ pthread_mutex_destroy (&cfg_instance->dispatch_mutex); @@ -7818,7 +9232,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c if (cfg_instance->response_fd != -1) { shutdown (cfg_instance->response_fd, 0); -@@ -341,12 +347,12 @@ +@@ -341,12 +349,12 @@ close (cfg_instance->dispatch_fd); } @@ -7833,7 +9247,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c corosync_cfg_ring_status_get ( corosync_cfg_handle_t cfg_handle, char ***interface_names, -@@ -357,10 +363,10 @@ +@@ -357,10 +365,10 @@ struct req_lib_cfg_ringstatusget req_lib_cfg_ringstatusget; struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget; unsigned int i; @@ -7846,7 +9260,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -380,13 +386,13 @@ +@@ -380,13 +388,13 @@ *interface_count = res_lib_cfg_ringstatusget.interface_count; *interface_names = malloc (sizeof (char *) * *interface_count); if (*interface_names == NULL) { @@ -7862,7 +9276,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c goto error_free_interface_names; } memset (*status, 0, sizeof (char *) * *interface_count); -@@ -394,12 +400,12 @@ +@@ -394,12 +402,12 @@ for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) { (*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]); if ((*(interface_names))[i] == NULL) { @@ -7877,7 +9291,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c goto error_free_contents; } } -@@ -416,27 +422,27 @@ +@@ -416,27 +424,27 @@ } free (*status); @@ -7911,7 +9325,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -452,12 +458,12 @@ +@@ -452,12 +460,12 @@ sizeof (struct res_lib_cfg_ringreenable)); pthread_mutex_unlock (&cfg_instance->response_mutex); @@ -7926,7 +9340,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c corosync_cfg_service_load ( corosync_cfg_handle_t cfg_handle, char *service_name, -@@ -466,10 +472,10 @@ +@@ -466,10 +474,10 @@ struct cfg_instance *cfg_instance; struct req_lib_cfg_serviceload req_lib_cfg_serviceload; struct res_lib_cfg_serviceload res_lib_cfg_serviceload; @@ -7939,7 +9353,16 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -490,12 +496,12 @@ +@@ -477,7 +485,7 @@ + req_lib_cfg_serviceload.header.id = MESSAGE_REQ_CFG_SERVICELOAD; + memset (&req_lib_cfg_serviceload.service_name, 0, + sizeof (req_lib_cfg_serviceload.service_name)); +- strncpy ((char *)req_lib_cfg_serviceload.service_name, service_name, ++ strncpy (req_lib_cfg_serviceload.service_name, service_name, + sizeof (req_lib_cfg_serviceload.service_name) - 1); + req_lib_cfg_serviceload.service_ver = service_ver; + +@@ -490,12 +498,12 @@ sizeof (struct res_lib_cfg_serviceload)); pthread_mutex_unlock (&cfg_instance->response_mutex); @@ -7954,7 +9377,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c corosync_cfg_service_unload ( corosync_cfg_handle_t cfg_handle, char *service_name, -@@ -504,10 +510,10 @@ +@@ -504,10 +512,10 @@ struct cfg_instance *cfg_instance; struct req_lib_cfg_serviceunload req_lib_cfg_serviceunload; struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload; @@ -7967,7 +9390,16 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -528,20 +534,20 @@ +@@ -515,7 +523,7 @@ + req_lib_cfg_serviceunload.header.id = MESSAGE_REQ_CFG_SERVICEUNLOAD; + memset (&req_lib_cfg_serviceunload.service_name, 0, + sizeof (req_lib_cfg_serviceunload.service_name)); +- strncpy ((char *)req_lib_cfg_serviceunload.service_name, service_name, ++ strncpy (req_lib_cfg_serviceunload.service_name, service_name, + sizeof (req_lib_cfg_serviceunload.service_name) - 1); + req_lib_cfg_serviceunload.service_ver = service_ver; + +@@ -528,29 +536,29 @@ sizeof (struct res_lib_cfg_serviceunload)); pthread_mutex_unlock (&cfg_instance->response_mutex); @@ -7981,8 +9413,9 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c corosync_cfg_state_track ( corosync_cfg_handle_t cfg_handle, - SaUint8T trackFlags, -+ uint8_t trackFlags, - const CorosyncCfgStateNotificationT *notificationBuffer) +- const CorosyncCfgStateNotificationT *notificationBuffer) ++ uint8_t track_flags, ++ const corosync_cfg_state_notification_t *notification_buffer) { struct cfg_instance *cfg_instance; struct req_lib_cfg_statetrack req_lib_cfg_statetrack; @@ -7992,7 +9425,10 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c req_lib_cfg_statetrack.header.size = sizeof (struct req_lib_cfg_statetrack); req_lib_cfg_statetrack.header.id = MESSAGE_REQ_CFG_STATETRACKSTART; -@@ -550,7 +556,7 @@ +- req_lib_cfg_statetrack.trackFlags = trackFlags; +- req_lib_cfg_statetrack.notificationBufferAddress = (CorosyncCfgStateNotificationT *)notificationBuffer; ++ req_lib_cfg_statetrack.track_flags = track_flags; ++ req_lib_cfg_statetrack.notification_buffer_address = (corosync_cfg_state_notification_t *)notification_buffer; error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); @@ -8001,7 +9437,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -564,23 +570,23 @@ +@@ -564,23 +572,23 @@ pthread_mutex_unlock (&cfg_instance->response_mutex); @@ -8030,7 +9466,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -597,12 +603,12 @@ +@@ -597,31 +605,33 @@ pthread_mutex_unlock (&cfg_instance->response_mutex); @@ -8045,8 +9481,11 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c +cs_error_t corosync_cfg_admin_state_get ( corosync_cfg_handle_t cfg_handle, - CorosyncCfgAdministrativeTargetT administrativeTarget, -@@ -611,11 +617,11 @@ +- CorosyncCfgAdministrativeTargetT administrativeTarget, +- CorosyncCfgAdministrativeStateT *administrativeState) ++ corosync_cfg_administrative_target_t administrative_target, ++ corosync_cfg_administrative_state_t *administrative_state) + { struct cfg_instance *cfg_instance; struct req_lib_cfg_administrativestateget req_lib_cfg_administrativestateget; struct res_lib_cfg_administrativestateget res_lib_cfg_administrativestateget; @@ -8060,7 +9499,16 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -633,12 +639,12 @@ + req_lib_cfg_administrativestateget.header.id = MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET; + req_lib_cfg_administrativestateget.header.size = sizeof (struct req_lib_cfg_administrativestateget); +- req_lib_cfg_administrativestateget.administrativeTarget = administrativeTarget; ++ req_lib_cfg_administrativestateget.administrative_target = administrative_target; ++ ++ pthread_mutex_lock (&cfg_instance->response_mutex); + + error = saSendReceiveReply (cfg_instance->response_fd, + &req_lib_cfg_administrativestateget, +@@ -633,32 +643,34 @@ pthread_mutex_unlock (&cfg_instance->response_mutex); @@ -8075,8 +9523,11 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c +cs_error_t corosync_cfg_admin_state_set ( corosync_cfg_handle_t cfg_handle, - CorosyncCfgAdministrativeTargetT administrativeTarget, -@@ -647,11 +653,11 @@ +- CorosyncCfgAdministrativeTargetT administrativeTarget, +- CorosyncCfgAdministrativeStateT administrativeState) ++ corosync_cfg_administrative_target_t administrative_target, ++ corosync_cfg_administrative_state_t administrative_state) + { struct cfg_instance *cfg_instance; struct req_lib_cfg_administrativestateset req_lib_cfg_administrativestateset; struct res_lib_cfg_administrativestateset res_lib_cfg_administrativestateset; @@ -8090,7 +9541,18 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c return (error); } -@@ -670,7 +676,109 @@ + req_lib_cfg_administrativestateset.header.id = MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET; + req_lib_cfg_administrativestateset.header.size = sizeof (struct req_lib_cfg_administrativestateset); +- req_lib_cfg_administrativestateset.administrativeTarget = administrativeTarget; +- req_lib_cfg_administrativestateset.administrativeState = administrativeState; ++ req_lib_cfg_administrativestateset.administrative_target = administrative_target; ++ req_lib_cfg_administrativestateset.administrative_state = administrative_state; ++ ++ pthread_mutex_lock (&cfg_instance->response_mutex); + + error = saSendReceiveReply (cfg_instance->response_fd, + &req_lib_cfg_administrativestateset, +@@ -670,7 +682,191 @@ pthread_mutex_unlock (&cfg_instance->response_mutex); @@ -8127,6 +9589,8 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c + strcpy((char *)req_lib_cfg_killnode.reason.value, reason); + req_lib_cfg_killnode.reason.length = strlen(reason)+1; + ++ pthread_mutex_lock (&cfg_instance->response_mutex); ++ + error = saSendReceiveReply (cfg_instance->response_fd, + &req_lib_cfg_killnode, + sizeof (struct req_lib_cfg_killnode), @@ -8145,7 +9609,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c +cs_error_t +corosync_cfg_try_shutdown ( + corosync_cfg_handle_t cfg_handle, -+ CorosyncCfgShutdownFlagsT flags) ++ corosync_cfg_shutdown_flags_t flags) +{ + struct cfg_instance *cfg_instance; + struct req_lib_cfg_tryshutdown req_lib_cfg_tryshutdown; @@ -8162,6 +9626,8 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c + req_lib_cfg_tryshutdown.header.size = sizeof (struct req_lib_cfg_tryshutdown); + req_lib_cfg_tryshutdown.flags = flags; + ++ pthread_mutex_lock (&cfg_instance->response_mutex); ++ + error = saSendReceiveReply (cfg_instance->response_fd, + &req_lib_cfg_tryshutdown, + sizeof (struct req_lib_cfg_tryshutdown), @@ -8178,7 +9644,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c +cs_error_t +corosync_cfg_replyto_shutdown ( + corosync_cfg_handle_t cfg_handle, -+ CorosyncCfgShutdownReplyFlagsT response) ++ corosync_cfg_shutdown_reply_flags_t response) +{ + struct cfg_instance *cfg_instance; + struct req_lib_cfg_replytoshutdown req_lib_cfg_replytoshutdown; @@ -8197,14 +9663,99 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c + + iov.iov_base = &req_lib_cfg_replytoshutdown; + iov.iov_len = sizeof (struct req_lib_cfg_replytoshutdown); ++ ++ pthread_mutex_lock (&cfg_instance->response_mutex); + error = saSendMsgRetry (cfg_instance->response_fd, + &iov, 1); + -+ return (error); ++ pthread_mutex_unlock (&cfg_instance->response_mutex); ++ ++ return (error); ++} ++ ++cs_error_t corosync_cfg_get_node_addrs ( ++ corosync_cfg_handle_t cfg_handle, ++ int nodeid, ++ int max_addrs, ++ int *num_addrs, ++ corosync_cfg_node_address_t *addrs) ++{ ++ cs_error_t error; ++ char buf[PIPE_BUF]; ++ struct req_lib_cfg_get_node_addrs req_lib_cfg_get_node_addrs; ++ struct res_lib_cfg_get_node_addrs * res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf; ++ struct cfg_instance *cfg_instance; ++ int addrlen; ++ int i; ++ struct iovec iov[2]; ++ ++ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, ++ (void *)&cfg_instance); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&cfg_instance->response_mutex); ++ ++ req_lib_cfg_get_node_addrs.header.size = sizeof (req_lib_cfg_get_node_addrs); ++ req_lib_cfg_get_node_addrs.header.id = MESSAGE_REQ_CFG_GET_NODE_ADDRS; ++ req_lib_cfg_get_node_addrs.nodeid = nodeid; ++ ++ iov[0].iov_base = (char *)&req_lib_cfg_get_node_addrs; ++ iov[0].iov_len = sizeof (req_lib_cfg_get_node_addrs); ++ ++ error = saSendMsgReceiveReply (cfg_instance->response_fd, iov, 1, ++ res_lib_cfg_get_node_addrs, sizeof (mar_res_header_t)); ++ ++ if (error == CS_OK && res_lib_cfg_get_node_addrs->header.size > sizeof(mar_res_header_t)) { ++ error = saRecvRetry (cfg_instance->response_fd, (char *)res_lib_cfg_get_node_addrs + sizeof (mar_res_header_t), ++ res_lib_cfg_get_node_addrs->header.size - sizeof (mar_res_header_t)); ++ } ++ pthread_mutex_unlock (&cfg_instance->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ if (res_lib_cfg_get_node_addrs->family == AF_INET) ++ addrlen = sizeof(struct sockaddr_in); ++ if (res_lib_cfg_get_node_addrs->family == AF_INET6) ++ addrlen = sizeof(struct sockaddr_in6); ++ ++ for (i=0; inum_addrs; i++) { ++ addrs[i].addressLength = addrlen; ++ struct sockaddr_in *in; ++ struct sockaddr_in6 *in6; ++ ++ if (res_lib_cfg_get_node_addrs->family == AF_INET) { ++ in = (struct sockaddr_in *)addrs[i].address; ++ in->sin_family = AF_INET; ++ memcpy(&in->sin_addr, &res_lib_cfg_get_node_addrs->addrs[i][0], sizeof(struct in_addr)); ++ } ++ if (res_lib_cfg_get_node_addrs->family == AF_INET6) { ++ in6 = (struct sockaddr_in6 *)addrs[i].address; ++ in6->sin6_family = AF_INET6; ++ memcpy(&in6->sin6_addr, &res_lib_cfg_get_node_addrs->addrs[i][0], sizeof(struct in6_addr)); ++ } ++ } ++ *num_addrs = res_lib_cfg_get_node_addrs->num_addrs; ++ errno = error = res_lib_cfg_get_node_addrs->header.error; ++ ++error_exit: ++ ++ pthread_mutex_unlock (&cfg_instance->response_mutex); ++ return (error); } diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c --- corosync-0.92/lib/confdb.c 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/lib/confdb.c 2008-11-11 18:26:58.000000000 +0100 ++++ corosync-trunk/lib/confdb.c 2009-01-23 16:41:06.000000000 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2008 Red Hat, Inc. ++ * Copyright (c) 2008-2009 Red Hat, Inc. + * + * All rights reserved. + * @@ -42,7 +42,7 @@ #include #include @@ -8421,13 +9972,13 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c int cont = 1; /* always continue do loop except when set to 0 */ int dispatch_avail; struct confdb_inst *confdb_inst; -@@ -314,16 +314,16 @@ +@@ -314,16 +314,15 @@ struct res_lib_confdb_key_change_callback *res_key_changed_pt; struct res_lib_confdb_object_create_callback *res_object_created_pt; struct res_lib_confdb_object_destroy_callback *res_object_destroyed_pt; - struct res_overlay dispatch_data; +- int ignore_dispatch = 0; + struct confdb_res_overlay dispatch_data; - int ignore_dispatch = 0; error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); - if (error != SA_AIS_OK) { @@ -8441,7 +9992,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_unlock; } -@@ -341,7 +341,7 @@ +@@ -341,7 +340,7 @@ ufds.revents = 0; error = saPollRetry (&ufds, 1, timeout); @@ -8450,7 +10001,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_nounlock; } -@@ -351,7 +351,7 @@ +@@ -351,7 +350,7 @@ * Regather poll data in case ufds has changed since taking lock */ error = saPollRetry (&ufds, 1, timeout); @@ -8459,7 +10010,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_nounlock; } -@@ -359,7 +359,7 @@ +@@ -359,7 +358,7 @@ * Handle has been finalized in another thread */ if (confdb_inst->finalize == 1) { @@ -8468,7 +10019,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c pthread_mutex_unlock (&confdb_inst->dispatch_mutex); goto error_unlock; } -@@ -380,14 +380,14 @@ +@@ -380,14 +379,14 @@ */ error = saRecvRetry (confdb_inst->dispatch_fd, &dispatch_data.header, sizeof (mar_res_header_t)); @@ -8485,7 +10036,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_unlock; } } -@@ -443,7 +443,7 @@ +@@ -443,7 +442,7 @@ break; default: @@ -8494,7 +10045,25 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_nounlock; break; } -@@ -470,36 +470,36 @@ +@@ -453,16 +452,9 @@ + * */ + switch (dispatch_types) { + case CONFDB_DISPATCH_ONE: +- if (ignore_dispatch) { +- ignore_dispatch = 0; +- } else { +- cont = 0; +- } ++ cont = 0; + break; + case CONFDB_DISPATCH_ALL: +- if (ignore_dispatch) { +- ignore_dispatch = 0; +- } + break; + case CONFDB_DISPATCH_BLOCKING: + break; +@@ -470,36 +462,36 @@ } while (cont); error_unlock: @@ -8537,7 +10106,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -518,7 +518,7 @@ +@@ -518,7 +510,7 @@ &res_lib_confdb_object_create, sizeof (struct res_lib_confdb_object_create)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8546,7 +10115,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -526,31 +526,31 @@ +@@ -526,31 +518,31 @@ *object_handle = res_lib_confdb_object_create.object_handle; error_exit: @@ -8584,7 +10153,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -567,39 +567,39 @@ +@@ -567,39 +559,39 @@ &res, sizeof ( mar_res_header_t)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8631,7 +10200,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -616,7 +616,7 @@ +@@ -616,7 +608,7 @@ &res_lib_confdb_object_parent_get, sizeof (struct res_lib_confdb_object_parent_get)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8640,7 +10209,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -624,28 +624,28 @@ +@@ -624,28 +616,28 @@ *parent_object_handle = res_lib_confdb_object_parent_get.parent_object_handle; error_exit: @@ -8675,7 +10244,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -662,7 +662,7 @@ +@@ -662,7 +654,7 @@ &res, sizeof (mar_res_header_t)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8684,7 +10253,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -673,56 +673,56 @@ +@@ -673,56 +665,56 @@ return (error); } @@ -8752,7 +10321,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c confdb_handle_t handle, unsigned int parent_object_handle, void *key_name, -@@ -730,24 +730,24 @@ +@@ -730,24 +722,24 @@ void *value, int value_len) { @@ -8781,7 +10350,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -768,19 +768,19 @@ +@@ -768,19 +760,19 @@ &res, sizeof (res)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8804,7 +10373,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c confdb_handle_t handle, unsigned int parent_object_handle, void *key_name, -@@ -788,24 +788,24 @@ +@@ -788,24 +780,24 @@ void *value, int value_len) { @@ -8833,7 +10402,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -826,19 +826,19 @@ +@@ -826,19 +818,19 @@ &res, sizeof (res)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8856,7 +10425,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c confdb_handle_t handle, unsigned int parent_object_handle, void *key_name, -@@ -846,24 +846,24 @@ +@@ -846,24 +838,24 @@ void *value, int *value_len) { @@ -8885,7 +10454,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -882,47 +882,47 @@ +@@ -882,47 +874,47 @@ &res_lib_confdb_key_get, sizeof (struct res_lib_confdb_key_get)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8941,7 +10510,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -941,46 +941,46 @@ +@@ -941,46 +933,46 @@ &res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -8996,7 +10565,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -999,22 +999,22 @@ +@@ -999,22 +991,22 @@ &res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9023,7 +10592,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c confdb_handle_t handle, unsigned int parent_object_handle, void *key_name, -@@ -1024,25 +1024,25 @@ +@@ -1024,25 +1016,25 @@ void *new_value, int new_value_len) { @@ -9053,7 +10622,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } req_lib_confdb_key_replace.header.size = sizeof (struct req_lib_confdb_key_replace); -@@ -1064,28 +1064,28 @@ +@@ -1064,28 +1056,28 @@ &res, sizeof (res)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9087,7 +10656,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c return (error); } -@@ -1093,7 +1093,7 @@ +@@ -1093,7 +1085,7 @@ if (!context) { context = malloc(sizeof(struct iter_context)); if (!context) { @@ -9096,7 +10665,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto ret; } context->parent_object_handle = object_handle; -@@ -1103,26 +1103,26 @@ +@@ -1103,26 +1095,26 @@ /* Start a new find context */ if (context->find_handle) { @@ -9128,7 +10697,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c return (error); } -@@ -1130,7 +1130,7 @@ +@@ -1130,7 +1122,7 @@ if (!context) { context = malloc(sizeof(struct iter_context)); if (!context) { @@ -9137,7 +10706,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto ret; } context->parent_object_handle = object_handle; -@@ -1140,22 +1140,22 @@ +@@ -1140,22 +1132,22 @@ context->find_handle = 0; context->next_entry = 0; @@ -9164,7 +10733,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c return (error); } -@@ -1163,7 +1163,7 @@ +@@ -1163,7 +1155,7 @@ if (!context) { context = malloc(sizeof(struct iter_context)); if (!context) { @@ -9173,7 +10742,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto ret; } context->find_handle = 0; -@@ -1172,24 +1172,24 @@ +@@ -1172,24 +1164,24 @@ } /* Start a new find context */ if (context->find_handle) { @@ -9202,7 +10771,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c struct confdb_inst *confdb_inst; struct iovec iov[2]; struct iter_context *context; -@@ -1197,26 +1197,26 @@ +@@ -1197,26 +1189,26 @@ struct res_lib_confdb_object_find res_lib_confdb_object_find; error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); @@ -9233,7 +10802,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1236,7 +1236,7 @@ +@@ -1236,7 +1228,7 @@ &res_lib_confdb_object_find, sizeof (struct res_lib_confdb_object_find)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9242,7 +10811,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1245,20 +1245,20 @@ +@@ -1245,20 +1237,20 @@ context->find_handle = res_lib_confdb_object_find.find_handle; error_exit: @@ -9266,7 +10835,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c struct confdb_inst *confdb_inst; struct iovec iov[2]; struct iter_context *context; -@@ -1266,19 +1266,19 @@ +@@ -1266,19 +1258,19 @@ struct res_lib_confdb_object_iter res_lib_confdb_object_iter; error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); @@ -9289,7 +10858,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c *object_name_len = 0; if (confdb_sa_object_find(parent_object_handle, -@@ -1286,7 +1286,7 @@ +@@ -1286,7 +1278,7 @@ object_handle, object_name, object_name_len, 1)) @@ -9298,7 +10867,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto sa_exit; } -@@ -1304,12 +1304,12 @@ +@@ -1304,12 +1296,12 @@ &res_lib_confdb_object_iter, sizeof (struct res_lib_confdb_object_iter)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9313,7 +10882,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c *object_name_len = res_lib_confdb_object_iter.object_name.length; memcpy(object_name, res_lib_confdb_object_iter.object_name.value, *object_name_len); *object_handle = res_lib_confdb_object_iter.object_handle; -@@ -1318,12 +1318,12 @@ +@@ -1318,12 +1310,12 @@ sa_exit: error_exit: @@ -9328,7 +10897,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c confdb_handle_t handle, unsigned int parent_object_handle, void *key_name, -@@ -1331,7 +1331,7 @@ +@@ -1331,7 +1323,7 @@ void *value, int *value_len) { @@ -9337,7 +10906,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c struct confdb_inst *confdb_inst; struct iovec iov[2]; struct iter_context *context; -@@ -1339,25 +1339,25 @@ +@@ -1339,25 +1331,25 @@ struct res_lib_confdb_key_iter res_lib_confdb_key_iter; error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); @@ -9367,7 +10936,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto sa_exit; } -@@ -1375,12 +1375,12 @@ +@@ -1375,12 +1367,12 @@ &res_lib_confdb_key_iter, sizeof (struct res_lib_confdb_key_iter)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9382,7 +10951,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c *key_name_len = res_lib_confdb_key_iter.key_name.length; memcpy(key_name, res_lib_confdb_key_iter.key_name.value, *key_name_len); *value_len = res_lib_confdb_key_iter.value.length; -@@ -1391,31 +1391,31 @@ +@@ -1391,31 +1383,31 @@ context->next_entry++; error_exit: @@ -9420,7 +10989,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1431,7 +1431,7 @@ +@@ -1431,7 +1423,7 @@ &res_lib_confdb_write, sizeof ( struct res_lib_confdb_write)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9429,7 +10998,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1440,32 +1440,32 @@ +@@ -1440,32 +1432,32 @@ memcpy(error_text, res_lib_confdb_write.error.value, res_lib_confdb_write.error.length); error_exit: @@ -9468,7 +11037,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1483,7 +1483,7 @@ +@@ -1483,7 +1475,7 @@ pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9477,7 +11046,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1492,29 +1492,29 @@ +@@ -1492,29 +1484,29 @@ memcpy(error_text, res_lib_confdb_reload.error.value, res_lib_confdb_reload.error.length); error_exit: @@ -9512,7 +11081,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1532,33 +1532,33 @@ +@@ -1532,33 +1524,33 @@ &res, sizeof ( mar_res_header_t)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9552,7 +11121,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c goto error_exit; } -@@ -1574,14 +1574,14 @@ +@@ -1574,14 +1566,14 @@ &res, sizeof ( mar_res_header_t)); pthread_mutex_unlock (&confdb_inst->response_mutex); @@ -9571,7 +11140,7 @@ diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c } diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c --- corosync-0.92/lib/cpg.c 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/lib/cpg.c 2008-11-11 18:26:58.000000000 +0100 ++++ corosync-trunk/lib/cpg.c 2009-01-08 07:29:16.000000000 +0100 @@ -45,7 +45,7 @@ #include #include @@ -9769,16 +11338,17 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c int cont = 1; /* always continue do loop except when set to 0 */ int dispatch_avail; struct cpg_inst *cpg_inst; -@@ -253,7 +253,7 @@ +@@ -253,8 +253,7 @@ struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback; struct res_lib_cpg_groups_get_callback *res_lib_cpg_groups_get_callback; cpg_callbacks_t callbacks; - struct res_overlay dispatch_data; +- int ignore_dispatch = 0; + struct cpg_res_overlay dispatch_data; - int ignore_dispatch = 0; struct cpg_address member_list[CPG_MEMBERS_MAX]; struct cpg_address left_list[CPG_MEMBERS_MAX]; -@@ -264,7 +264,7 @@ + struct cpg_address joined_list[CPG_MEMBERS_MAX]; +@@ -264,7 +263,7 @@ unsigned int i; error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); @@ -9787,7 +11357,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c return (error); } -@@ -272,7 +272,7 @@ +@@ -272,7 +271,7 @@ * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and * wait indefinately for SA_DISPATCH_BLOCKING */ @@ -9796,7 +11366,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c timeout = 0; } -@@ -282,7 +282,7 @@ +@@ -282,7 +281,7 @@ ufds.revents = 0; error = saPollRetry (&ufds, 1, timeout); @@ -9805,7 +11375,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c goto error_nounlock; } -@@ -292,7 +292,7 @@ +@@ -292,7 +291,7 @@ * Regather poll data in case ufds has changed since taking lock */ error = saPollRetry (&ufds, 1, timeout); @@ -9814,7 +11384,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c goto error_nounlock; } -@@ -300,13 +300,13 @@ +@@ -300,13 +299,13 @@ * Handle has been finalized in another thread */ if (cpg_inst->finalize == 1) { @@ -9830,7 +11400,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c pthread_mutex_unlock (&cpg_inst->dispatch_mutex); break; /* exit do while cont is 1 loop */ } else -@@ -321,14 +321,14 @@ +@@ -321,14 +320,14 @@ */ error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.header, sizeof (mar_res_header_t)); @@ -9847,7 +11417,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c goto error_unlock; } } -@@ -424,7 +424,7 @@ +@@ -424,7 +423,7 @@ break; default: @@ -9856,23 +11426,24 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c goto error_nounlock; break; } -@@ -433,34 +433,34 @@ +@@ -433,34 +432,27 @@ * Determine if more messages should be processed * */ switch (dispatch_types) { - case CPG_DISPATCH_ONE: +- if (ignore_dispatch) { +- ignore_dispatch = 0; +- } else { +- cont = 0; +- } + case CS_DISPATCH_ONE: - if (ignore_dispatch) { - ignore_dispatch = 0; - } else { - cont = 0; - } ++ cont = 0; break; - case CPG_DISPATCH_ALL: +- if (ignore_dispatch) { +- ignore_dispatch = 0; +- } + case CS_DISPATCH_ALL: - if (ignore_dispatch) { - ignore_dispatch = 0; - } break; - case CPG_DISPATCH_BLOCKING: + case CS_DISPATCH_BLOCKING: @@ -9897,7 +11468,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c struct cpg_inst *cpg_inst; struct iovec iov[2]; struct req_lib_cpg_join req_lib_cpg_join; -@@ -469,7 +469,7 @@ +@@ -469,7 +461,7 @@ struct res_lib_cpg_trackstart res_lib_cpg_trackstart; error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); @@ -9906,7 +11477,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c return (error); } -@@ -487,7 +487,7 @@ +@@ -487,7 +479,7 @@ error = saSendMsgReceiveReply (cpg_inst->dispatch_fd, iov, 1, &res_lib_cpg_trackstart, sizeof (struct res_lib_cpg_trackstart)); @@ -9915,7 +11486,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c pthread_mutex_unlock (&cpg_inst->response_mutex); goto error_exit; } -@@ -507,30 +507,30 @@ +@@ -507,30 +499,30 @@ pthread_mutex_unlock (&cpg_inst->response_mutex); @@ -9951,7 +11522,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c return (error); } -@@ -549,26 +549,26 @@ +@@ -549,26 +541,26 @@ &res_lib_cpg_leave, sizeof (struct res_lib_cpg_leave)); pthread_mutex_unlock (&cpg_inst->response_mutex); @@ -9982,7 +11553,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c struct cpg_inst *cpg_inst; struct iovec iov[64]; struct req_lib_cpg_mcast req_lib_cpg_mcast; -@@ -576,7 +576,7 @@ +@@ -576,7 +568,7 @@ int msg_len = 0; error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); @@ -9991,7 +11562,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c return (error); } -@@ -602,7 +602,7 @@ +@@ -602,7 +594,7 @@ pthread_mutex_unlock (&cpg_inst->response_mutex); @@ -10000,7 +11571,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c goto error_exit; } -@@ -612,24 +612,24 @@ +@@ -612,85 +604,108 @@ * Also, don't set to ENABLED if the return value is TRY_AGAIN as this can lead * to Flow Control State sync issues between AIS LIB and EXEC. */ @@ -10029,8 +11600,12 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c struct cpg_inst *cpg_inst; struct iovec iov; struct req_lib_cpg_membership req_lib_cpg_membership_get; -@@ -637,7 +637,7 @@ - unsigned int i; +- struct res_lib_cpg_confchg_callback res_lib_cpg_membership_get; +- unsigned int i; ++ struct res_lib_cpg_confchg_callback *res_lib_cpg_membership_get; ++ mar_res_header_t header; ++ unsigned int i, bytesleft; ++ char *buffer = NULL; error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); - if (error != SA_AIS_OK) { @@ -10038,20 +11613,72 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c return (error); } -@@ -656,7 +656,7 @@ +- req_lib_cpg_membership_get.header.size = sizeof (mar_req_header_t); ++ req_lib_cpg_membership_get.header.size = sizeof (req_lib_cpg_membership_get); + req_lib_cpg_membership_get.header.id = MESSAGE_REQ_CPG_MEMBERSHIP; +- marshall_to_mar_cpg_name_t (&req_lib_cpg_membership_get.group_name, +- group_name); - pthread_mutex_unlock (&cpg_inst->response_mutex); + iov.iov_base = (char *)&req_lib_cpg_membership_get; +- iov.iov_len = sizeof (mar_req_header_t); ++ iov.iov_len = sizeof (req_lib_cpg_membership_get); + + pthread_mutex_lock (&cpg_inst->response_mutex); + + error = saSendMsgReceiveReply (cpg_inst->response_fd, &iov, 1, +- &res_lib_cpg_membership_get, sizeof (mar_res_header_t)); ++ &header, sizeof (header)); ++ if (error != CS_OK) { ++ goto error_exit; ++ } + +- pthread_mutex_unlock (&cpg_inst->response_mutex); ++ buffer = malloc(header.size); ++ if (buffer == NULL) { ++ error = CS_ERR_NO_MEMORY; ++ goto error_exit; ++ } - if (error != SA_AIS_OK) { ++ memcpy (buffer, &header, sizeof (header)); ++ bytesleft = header.size - sizeof (header); ++ ++ error = saRecvRetry (cpg_inst->response_fd, ++ buffer + sizeof (header), bytesleft); + if (error != CS_OK) { goto error_exit; } -@@ -674,23 +674,23 @@ +- error = res_lib_cpg_membership_get.header.error; ++ error = header.error; ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ res_lib_cpg_membership_get = (struct res_lib_cpg_confchg_callback *) buffer; + + /* + * Copy results to caller + */ +- *member_list_entries = res_lib_cpg_membership_get.member_list_entries; ++ *member_list_entries = res_lib_cpg_membership_get->member_list_entries; + if (member_list) { +- for (i = 0; i < res_lib_cpg_membership_get.member_list_entries; i++) { ++ for (i = 0; i < res_lib_cpg_membership_get->member_list_entries; i++) { + marshall_from_mar_cpg_address_t (&member_list[i], +- &res_lib_cpg_membership_get.member_list[i]); ++ &res_lib_cpg_membership_get->member_list[i]); + } } error_exit: - saHandleInstancePut (&cpg_handle_t_db, handle); ++ ++ if (buffer != NULL) ++ free(buffer); ++ ++ pthread_mutex_unlock (&cpg_inst->response_mutex); ++ + (void)saHandleInstancePut (&cpg_handle_t_db, handle); return (error); @@ -10075,7 +11702,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c return (error); } -@@ -707,7 +707,7 @@ +@@ -707,7 +722,7 @@ pthread_mutex_unlock (&cpg_inst->response_mutex); @@ -10084,7 +11711,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c goto error_exit; } -@@ -716,23 +716,23 @@ +@@ -716,23 +731,23 @@ *local_nodeid = res_lib_cpg_local_get.local_nodeid; error_exit: @@ -10112,7 +11739,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c return (error); } -@@ -749,7 +749,7 @@ +@@ -749,7 +764,7 @@ pthread_mutex_unlock (&cpg_inst->response_mutex); @@ -10121,7 +11748,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c goto error_exit; } -@@ -758,26 +758,26 @@ +@@ -758,26 +773,26 @@ /* Real output is delivered via a callback */ error_exit: @@ -10155,7 +11782,7 @@ diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c } diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c --- corosync-0.92/lib/evs.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/lib/evs.c 2008-11-11 18:26:58.000000000 +0100 ++++ corosync-trunk/lib/evs.c 2008-12-28 10:25:17.000000000 +0100 @@ -48,7 +48,7 @@ #include @@ -10263,7 +11890,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c /* * Disconnect from the server */ -@@ -180,49 +180,49 @@ +@@ -180,49 +180,48 @@ shutdown(evs_inst->dispatch_fd, 0); close(evs_inst->dispatch_fd); } @@ -10316,8 +11943,8 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c struct res_evs_deliver_callback *res_evs_deliver_callback; evs_callbacks_t callbacks; - struct res_overlay dispatch_data; +- int ignore_dispatch = 0; + struct evs_res_overlay dispatch_data; - int ignore_dispatch = 0; error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); - if (error != SA_AIS_OK) { @@ -10325,7 +11952,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c return (error); } -@@ -230,7 +230,7 @@ +@@ -230,7 +229,7 @@ * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and * wait indefinately for SA_DISPATCH_BLOCKING */ @@ -10334,7 +11961,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c timeout = 0; } -@@ -240,7 +240,7 @@ +@@ -240,7 +239,7 @@ ufds.revents = 0; error = saPollRetry (&ufds, 1, timeout); @@ -10343,7 +11970,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c goto error_nounlock; } -@@ -250,7 +250,7 @@ +@@ -250,7 +249,7 @@ * Regather poll data in case ufds has changed since taking lock */ error = saPollRetry (&ufds, 1, 0); @@ -10352,7 +11979,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c goto error_nounlock; } -@@ -258,13 +258,13 @@ +@@ -258,13 +257,13 @@ * Handle has been finalized in another thread */ if (evs_inst->finalize == 1) { @@ -10368,7 +11995,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c pthread_mutex_unlock (&evs_inst->dispatch_mutex); break; /* exit do while cont is 1 loop */ } else -@@ -279,14 +279,14 @@ +@@ -279,14 +278,14 @@ */ error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.header, sizeof (mar_res_header_t)); @@ -10385,7 +12012,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c goto error_unlock; } } -@@ -327,7 +327,7 @@ +@@ -327,7 +326,7 @@ break; default: @@ -10394,23 +12021,24 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c goto error_nounlock; break; } -@@ -336,42 +336,42 @@ +@@ -336,42 +335,35 @@ * Determine if more messages should be processed * */ switch (dispatch_types) { - case EVS_DISPATCH_ONE: +- if (ignore_dispatch) { +- ignore_dispatch = 0; +- } else { +- cont = 0; +- } + case CS_DISPATCH_ONE: - if (ignore_dispatch) { - ignore_dispatch = 0; - } else { - cont = 0; - } ++ cont = 0; break; - case EVS_DISPATCH_ALL: +- if (ignore_dispatch) { +- ignore_dispatch = 0; +- } + case CS_DISPATCH_ALL: - if (ignore_dispatch) { - ignore_dispatch = 0; - } break; - case EVS_DISPATCH_BLOCKING: + case CS_DISPATCH_BLOCKING: @@ -10444,7 +12072,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c return (error); } -@@ -392,31 +392,31 @@ +@@ -392,31 +384,31 @@ pthread_mutex_unlock (&evs_inst->response_mutex); @@ -10481,7 +12109,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c return (error); } -@@ -437,26 +437,26 @@ +@@ -437,26 +429,26 @@ pthread_mutex_unlock (&evs_inst->response_mutex); @@ -10512,7 +12140,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c struct evs_inst *evs_inst; struct iovec iov[64]; struct req_lib_evs_mcast_joined req_lib_evs_mcast_joined; -@@ -464,7 +464,7 @@ +@@ -464,7 +456,7 @@ int msg_len = 0; error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); @@ -10521,7 +12149,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c return (error); } -@@ -490,19 +490,19 @@ +@@ -490,19 +482,19 @@ pthread_mutex_unlock (&evs_inst->response_mutex); @@ -10544,7 +12172,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c evs_handle_t handle, evs_guarantee_t guarantee, struct evs_group *groups, -@@ -511,7 +511,7 @@ +@@ -511,7 +503,7 @@ int iov_len) { int i; @@ -10553,7 +12181,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c struct evs_inst *evs_inst; struct iovec iov[64]; struct req_lib_evs_mcast_groups req_lib_evs_mcast_groups; -@@ -519,7 +519,7 @@ +@@ -519,7 +511,7 @@ int msg_len = 0; error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); @@ -10562,7 +12190,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c return (error); } for (i = 0; i < iov_len; i++) { -@@ -544,32 +544,32 @@ +@@ -544,32 +536,32 @@ &res_lib_evs_mcast_groups, sizeof (struct res_lib_evs_mcast_groups)); pthread_mutex_unlock (&evs_inst->response_mutex); @@ -10600,7 +12228,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c return (error); } -@@ -586,7 +586,7 @@ +@@ -586,7 +578,7 @@ pthread_mutex_unlock (&evs_inst->response_mutex); @@ -10609,7 +12237,7 @@ diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c goto error_exit; } -@@ -606,7 +606,7 @@ +@@ -606,7 +598,7 @@ } error_exit: @@ -10645,24 +12273,18 @@ diff -Naurd corosync-0.92/lib/libpload.versions corosync-trunk/lib/libpload.vers +}; diff -Naurd corosync-0.92/lib/libquorum.versions corosync-trunk/lib/libquorum.versions --- corosync-0.92/lib/libquorum.versions 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/libquorum.versions 2008-12-08 16:55:41.000000000 +0100 -@@ -0,0 +1,59 @@ ++++ corosync-trunk/lib/libquorum.versions 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,50 @@ +# Version and symbol export for libquorum.so + +OPENAIS_QUORUM_1.0 { + global: + quorum_initialize; + quorum_finalize; -+ quorum_getinfo; -+ quorum_setexpected; -+ quorum_setvotes; -+ quorum_qdisk_register; -+ quorum_qdisk_unregister; -+ quorum_qdisk_poll; -+ quorum_qdisk_getinfo; -+ quorum_setdirty; -+ quorum_killnode; -+ quorum_leaving; ++ quorum_getquorate; ++ quorum_initialize; ++ quorum_finalize; ++ quorum_dispatch; + + local: + saHandleCreate; @@ -10679,17 +12301,89 @@ diff -Naurd corosync-0.92/lib/libquorum.versions corosync-trunk/lib/libquorum.ve + saVersionVerify; + clustTimeNow; +}; -+# Version and symbol export for libcpg.so ++# Version and symbol export for libquorum.so + +COROSYNC_QUORUM_1.0 { + global: + quorum_initialize; + quorum_finalize; -+ quorum_fd_get; ++ quorum_getquorate; + quorum_dispatch; -+ quorum_get_quorate; -+ quorum_context_get; -+ quorum_context_set; ++ ++ local: ++ saHandleCreate; ++ saHandleDestroy; ++ saHandleInstanceGet; ++ saHandleInstancePut; ++ saRecvRetry; ++ saSelectRetry; ++ saSendMsgReceiveReply; ++ saSendMsgRetry; ++ saSendReceiveReply; ++ saSendRetry; ++ saServiceConnect; ++ saVersionVerify; ++ clustTimeNow; ++}; +diff -Naurd corosync-0.92/lib/libvotequorum.versions corosync-trunk/lib/libvotequorum.versions +--- corosync-0.92/lib/libvotequorum.versions 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/lib/libvotequorum.versions 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,71 @@ ++# Version and symbol export for libvotequorum.so ++ ++OPENAIS_VOTEQUORUM_1.0 { ++ global: ++ votequorum_initialize; ++ votequorum_finalize; ++ votequorum_getinfo; ++ votequorum_setexpected; ++ votequorum_setvotes; ++ votequorum_qdisk_register; ++ votequorum_qdisk_unregister; ++ votequorum_qdisk_poll; ++ votequorum_qdisk_getinfo; ++ votequorum_setstate; ++ votequorum_leaving; ++ votequorum_trackstart; ++ votequorum_trackstop; ++ votequorum_context_get; ++ votequorum_context_set; ++ ++ local: ++ saHandleCreate; ++ saHandleDestroy; ++ saHandleInstanceGet; ++ saHandleInstancePut; ++ saRecvRetry; ++ saSelectRetry; ++ saSendMsgReceiveReply; ++ saSendMsgRetry; ++ saSendReceiveReply; ++ saSendRetry; ++ saServiceConnect; ++ saVersionVerify; ++ clustTimeNow; ++}; ++# Version and symbol export for libvotequorum.so ++ ++COROSYNC_VOTEQUORUM_1.0 { ++ global: ++ votequorum_initialize; ++ votequorum_finalize; ++ votequorum_getinfo; ++ votequorum_setexpected; ++ votequorum_setvotes; ++ votequorum_qdisk_register; ++ votequorum_qdisk_unregister; ++ votequorum_qdisk_poll; ++ votequorum_qdisk_getinfo; ++ votequorum_setdirty; ++ votequorum_killnode; ++ votequorum_leaving; ++ votequorum_trackstart; ++ votequorum_trackstop; ++ votequorum_context_get; ++ votequorum_context_set; + + local: + saHandleCreate; @@ -10708,22 +12402,28 @@ diff -Naurd corosync-0.92/lib/libquorum.versions corosync-trunk/lib/libquorum.ve +}; diff -Naurd corosync-0.92/lib/Makefile corosync-trunk/lib/Makefile --- corosync-0.92/lib/Makefile 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lib/Makefile 2008-11-04 02:35:15.000000000 +0100 -@@ -41,6 +41,8 @@ ++++ corosync-trunk/lib/Makefile 2009-01-26 11:46:08.000000000 +0100 +@@ -41,7 +41,10 @@ libconfdb.a libconfdb.so.2.0.0 \ libevs.a libevs.so.2.0.0 \ libcfg.a libcfg.so.2.0.0 \ +- libcoroutil.a libcoroutil.so.2.0.0 + libquorum.a libquorum.so.2.0.0 \ + libpload.a libpload.so.2.0.0 \ - libcoroutil.a libcoroutil.so.2.0.0 ++ libcoroutil.a libcoroutil.so.2.0.0 \ ++ libvotequorum.a libvotequorum.so.2.0.0 libcoroutil.a: util.o -@@ -58,14 +60,17 @@ + $(AR) -rc libcoroutil.a util.o +@@ -58,14 +61,20 @@ libcpg.so.2.0.0: util.o cpg.o $(CC) $(DARWIN_OPTS) util.o cpg.o -o $@ +libquorum.so.2.0.0: util.o quorum.o + $(CC) $(DARWIN_OPTS) util.o quorum.o -o $@ ++ ++libvotequorum.so.2.0.0: util.o votequorum.o ++ $(CC) $(DARWIN_OPTS) util.o votequorum.o -o $@ + libconfdb.so.2.0.0: util.o confdb.o sa-confdb.o $(CC) $(LDFLAGS) $(DARWIN_OPTS) util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ @@ -10738,12 +12438,15 @@ diff -Naurd corosync-0.92/lib/Makefile corosync-trunk/lib/Makefile else -@@ -78,12 +83,18 @@ +@@ -78,12 +87,21 @@ libcpg.so.2.0.0: util.o cpg.o $(CC) -shared -Wl,-soname,libcpg.so.2,-version-script=$(srcdir)$(subdir)libcpg.versions util.o cpg.o -o $@ +libquorum.so.2.0.0: util.o quorum.o + $(CC) -shared -Wl,-soname,libquorum.so.2,-version-script=$(srcdir)$(subdir)libquorum.versions util.o quorum.o -o $@ ++ ++libvotequorum.so.2.0.0: util.o votequorum.o ++ $(CC) -shared -Wl,-soname,libvotequorum.so.2,-version-script=$(srcdir)$(subdir)libvotequorum.versions util.o votequorum.o -o $@ + libconfdb.so.2.0.0: util.o confdb.o sa-confdb.o $(CC) $(LDFLAGS) -shared -Wl,-soname,libconfdb.so.2,-version-script=$(srcdir)$(subdir)libconfdb.versions util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ @@ -10757,12 +12460,15 @@ diff -Naurd corosync-0.92/lib/Makefile corosync-trunk/lib/Makefile endif libevs.a: util.o evs.o -@@ -92,17 +103,24 @@ +@@ -92,17 +110,27 @@ libcpg.a: util.o cpg.o $(AR) -rc libcpg.a util.o cpg.o +libquorum.a: util.o quorum.o + $(AR) -rc libquorum.a util.o quorum.o ++ ++libvotequorum.a: util.o votequorum.o ++ $(AR) -rc libvotequorum.a util.o votequorum.o + libconfdb.a: util.o confdb.o sa-confdb.o $(AR) -rc libconfdb.a util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o @@ -12205,13 +13911,839 @@ diff -Naurd corosync-0.92/lib/util.h corosync-trunk/lib/util.h saVersionVerify ( struct saVersionDatabase *versionDatabase, SaVersionT *version); +diff -Naurd corosync-0.92/lib/votequorum.c corosync-trunk/lib/votequorum.c +--- corosync-0.92/lib/votequorum.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/lib/votequorum.c 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,821 @@ ++/* ++ * Copyright (c) 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 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 CONTIBUTORS "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. ++ */ ++ ++/* ++ * Provides a quorum API using the corosync executive ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include "corosync/votequorum.h" ++#include "corosync/ipc_votequorum.h" ++ ++struct votequorum_inst { ++ int response_fd; ++ int dispatch_fd; ++ int finalize; ++ void *context; ++ votequorum_callbacks_t callbacks; ++ pthread_mutex_t response_mutex; ++ pthread_mutex_t dispatch_mutex; ++}; ++ ++static void votequorum_instance_destructor (void *instance); ++ ++static struct saHandleDatabase votequorum_handle_t_db = { ++ .handleCount = 0, ++ .handles = 0, ++ .mutex = PTHREAD_MUTEX_INITIALIZER, ++ .handleInstanceDestructor = votequorum_instance_destructor ++}; ++ ++/* ++ * Clean up function for a quorum instance (votequorum_initialize) handle ++ */ ++static void votequorum_instance_destructor (void *instance) ++{ ++ struct votequorum_inst *votequorum_inst = instance; ++ ++ pthread_mutex_destroy (&votequorum_inst->response_mutex); ++} ++ ++cs_error_t votequorum_initialize ( ++ votequorum_handle_t *handle, ++ votequorum_callbacks_t *callbacks) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ ++ error = saHandleCreate (&votequorum_handle_t_db, sizeof (struct votequorum_inst), handle); ++ if (error != CS_OK) { ++ goto error_no_destroy; ++ } ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, *handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ goto error_destroy; ++ } ++ ++ error = saServiceConnect (&votequorum_inst->dispatch_fd, ++ &votequorum_inst->response_fd, ++ VOTEQUORUM_SERVICE); ++ if (error != CS_OK) { ++ goto error_put_destroy; ++ } ++ ++ pthread_mutex_init (&votequorum_inst->response_mutex, NULL); ++ pthread_mutex_init (&votequorum_inst->dispatch_mutex, NULL); ++ if (callbacks) ++ memcpy(&votequorum_inst->callbacks, callbacks, sizeof (callbacks)); ++ else ++ memset(&votequorum_inst->callbacks, 0, sizeof (callbacks)); ++ ++ saHandleInstancePut (&votequorum_handle_t_db, *handle); ++ ++ return (CS_OK); ++ ++error_put_destroy: ++ saHandleInstancePut (&votequorum_handle_t_db, *handle); ++error_destroy: ++ saHandleDestroy (&votequorum_handle_t_db, *handle); ++error_no_destroy: ++ return (error); ++} ++ ++cs_error_t votequorum_finalize ( ++ votequorum_handle_t handle) ++{ ++ struct votequorum_inst *votequorum_inst; ++ cs_error_t error; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ /* ++ * Another thread has already started finalizing ++ */ ++ if (votequorum_inst->finalize) { ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ return (CS_ERR_BAD_HANDLE); ++ } ++ ++ votequorum_inst->finalize = 1; ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ saHandleDestroy (&votequorum_handle_t_db, handle); ++ ++ /* ++ * Disconnect from the server ++ */ ++ if (votequorum_inst->response_fd != -1) { ++ shutdown(votequorum_inst->response_fd, 0); ++ close(votequorum_inst->response_fd); ++ } ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++ ++cs_error_t votequorum_getinfo ( ++ votequorum_handle_t handle, ++ unsigned int nodeid, ++ struct votequorum_info *info) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_getinfo req_lib_votequorum_getinfo; ++ struct res_lib_votequorum_getinfo res_lib_votequorum_getinfo; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_getinfo.header.size = sizeof (struct req_lib_votequorum_getinfo); ++ req_lib_votequorum_getinfo.header.id = MESSAGE_REQ_VOTEQUORUM_GETINFO; ++ req_lib_votequorum_getinfo.nodeid = nodeid; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_getinfo; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_getinfo); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_getinfo, sizeof (struct res_lib_votequorum_getinfo)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_getinfo.header.error; ++ ++ info->node_id = res_lib_votequorum_getinfo.nodeid; ++ info->node_votes = res_lib_votequorum_getinfo.votes; ++ info->node_expected_votes = res_lib_votequorum_getinfo.expected_votes; ++ info->highest_expected = res_lib_votequorum_getinfo.highest_expected; ++ info->total_votes = res_lib_votequorum_getinfo.total_votes; ++ info->quorum = res_lib_votequorum_getinfo.quorum; ++ info->flags = res_lib_votequorum_getinfo.flags; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_setexpected ( ++ votequorum_handle_t handle, ++ unsigned int expected_votes) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_setexpected req_lib_votequorum_setexpected; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_setexpected.header.size = sizeof (struct req_lib_votequorum_setexpected); ++ req_lib_votequorum_setexpected.header.id = MESSAGE_REQ_VOTEQUORUM_SETEXPECTED; ++ req_lib_votequorum_setexpected.expected_votes = expected_votes; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_setexpected; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_setexpected); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_setvotes ( ++ votequorum_handle_t handle, ++ unsigned int nodeid, ++ unsigned int votes) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_setvotes req_lib_votequorum_setvotes; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_setvotes.header.size = sizeof (struct req_lib_votequorum_setvotes); ++ req_lib_votequorum_setvotes.header.id = MESSAGE_REQ_VOTEQUORUM_SETVOTES; ++ req_lib_votequorum_setvotes.nodeid = nodeid; ++ req_lib_votequorum_setvotes.votes = votes; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_setvotes; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_setvotes); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_qdisk_register ( ++ votequorum_handle_t handle, ++ char *name, ++ unsigned int votes) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_qdisk_register req_lib_votequorum_qdisk_register; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ if (strlen(name) > VOTEQUORUM_MAX_QDISK_NAME_LEN) ++ return CS_ERR_INVALID_PARAM; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_qdisk_register.header.size = sizeof (struct req_lib_votequorum_qdisk_register); ++ req_lib_votequorum_qdisk_register.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_REGISTER; ++ strcpy(req_lib_votequorum_qdisk_register.name, name); ++ req_lib_votequorum_qdisk_register.votes = votes; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_qdisk_register; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_qdisk_register); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_qdisk_poll ( ++ votequorum_handle_t handle, ++ unsigned int state) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_qdisk_poll req_lib_votequorum_qdisk_poll; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_qdisk_poll.header.size = sizeof (struct req_lib_votequorum_qdisk_poll); ++ req_lib_votequorum_qdisk_poll.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_POLL; ++ req_lib_votequorum_qdisk_poll.state = state; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_qdisk_poll; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_qdisk_poll); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_qdisk_unregister ( ++ votequorum_handle_t handle) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_general req_lib_votequorum_general; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); ++ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_UNREGISTER; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_general; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++ ++ ++cs_error_t votequorum_qdisk_getinfo ( ++ votequorum_handle_t handle, ++ struct votequorum_qdisk_info *qinfo) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_general req_lib_votequorum_general; ++ struct res_lib_votequorum_qdisk_getinfo res_lib_votequorum_qdisk_getinfo; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); ++ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_general; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_qdisk_getinfo, sizeof (struct res_lib_votequorum_qdisk_getinfo)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_qdisk_getinfo.header.error; ++ ++ qinfo->votes = res_lib_votequorum_qdisk_getinfo.votes; ++ qinfo->state = res_lib_votequorum_qdisk_getinfo.state; ++ strcpy(qinfo->name, res_lib_votequorum_qdisk_getinfo.name); ++ ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_setstate ( ++ votequorum_handle_t handle) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_general req_lib_votequorum_general; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); ++ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_SETSTATE; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_general; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_leaving ( ++ votequorum_handle_t handle) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_general req_lib_votequorum_general; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); ++ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_LEAVING; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_general; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_trackstart ( ++ votequorum_handle_t handle, ++ uint64_t context, ++ unsigned int flags ) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_trackstart req_lib_votequorum_trackstart; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_trackstart.header.size = sizeof (struct req_lib_votequorum_trackstart); ++ req_lib_votequorum_trackstart.header.id = MESSAGE_REQ_VOTEQUORUM_TRACKSTART; ++ req_lib_votequorum_trackstart.track_flags = flags; ++ req_lib_votequorum_trackstart.context = context; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_trackstart; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_trackstart); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++cs_error_t votequorum_trackstop ( ++ votequorum_handle_t handle) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ struct iovec iov[2]; ++ struct req_lib_votequorum_general req_lib_votequorum_general; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ pthread_mutex_lock (&votequorum_inst->response_mutex); ++ ++ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); ++ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_TRACKSTOP; ++ ++ iov[0].iov_base = (char *)&req_lib_votequorum_general; ++ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); ++ ++ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, ++ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); ++ ++ pthread_mutex_unlock (&votequorum_inst->response_mutex); ++ ++ if (error != CS_OK) { ++ goto error_exit; ++ } ++ ++ error = res_lib_votequorum_status.header.error; ++ ++error_exit: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (error); ++} ++ ++ ++cs_error_t votequorum_context_get ( ++ votequorum_handle_t handle, ++ void **context) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ *context = votequorum_inst->context; ++ ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++cs_error_t votequorum_context_set ( ++ votequorum_handle_t handle, ++ void *context) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ votequorum_inst->context = context; ++ ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++ ++struct res_overlay { ++ mar_res_header_t header __attribute__((aligned(8))); ++ char data[512000]; ++}; ++ ++cs_error_t votequorum_dispatch ( ++ votequorum_handle_t handle, ++ cs_dispatch_flags_t dispatch_types) ++{ ++ struct pollfd ufds; ++ int timeout = -1; ++ cs_error_t error; ++ int cont = 1; /* always continue do loop except when set to 0 */ ++ int dispatch_avail; ++ struct votequorum_inst *votequorum_inst; ++ votequorum_callbacks_t callbacks; ++ struct res_overlay dispatch_data; ++ struct res_lib_votequorum_notification *res_lib_votequorum_notification; ++ ++ if (dispatch_types != CS_DISPATCH_ONE && ++ dispatch_types != CS_DISPATCH_ALL && ++ dispatch_types != CS_DISPATCH_BLOCKING) { ++ ++ return (CS_ERR_INVALID_PARAM); ++ } ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, ++ (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ /* ++ * Timeout instantly for CS_DISPATCH_ONE or CS_DISPATCH_ALL and ++ * wait indefinately for CS_DISPATCH_BLOCKING ++ */ ++ if (dispatch_types == CS_DISPATCH_ALL) { ++ timeout = 0; ++ } ++ ++ do { ++ ufds.fd = votequorum_inst->dispatch_fd; ++ ufds.events = POLLIN; ++ ufds.revents = 0; ++ ++ pthread_mutex_lock (&votequorum_inst->dispatch_mutex); ++ ++ error = saPollRetry (&ufds, 1, timeout); ++ if (error != CS_OK) { ++ goto error_unlock; ++ } ++ ++ /* ++ * Handle has been finalized in another thread ++ */ ++ if (votequorum_inst->finalize == 1) { ++ error = CS_OK; ++ goto error_unlock; ++ } ++ ++ if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) { ++ error = CS_ERR_BAD_HANDLE; ++ goto error_unlock; ++ } ++ ++ dispatch_avail = ufds.revents & POLLIN; ++ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { ++ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); ++ break; /* exit do while cont is 1 loop */ ++ } else ++ if (dispatch_avail == 0) { ++ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); ++ continue; /* next poll */ ++ } ++ ++ if (ufds.revents & POLLIN) { ++ error = saRecvRetry (votequorum_inst->dispatch_fd, &dispatch_data.header, ++ sizeof (mar_res_header_t)); ++ if (error != CS_OK) { ++ goto error_unlock; ++ } ++ if (dispatch_data.header.size > sizeof (mar_res_header_t)) { ++ error = saRecvRetry (votequorum_inst->dispatch_fd, &dispatch_data.data, ++ dispatch_data.header.size - sizeof (mar_res_header_t)); ++ if (error != CS_OK) { ++ goto error_unlock; ++ } ++ } ++ } else { ++ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); ++ continue; ++ } ++ ++ /* ++ * Make copy of callbacks, message data, unlock instance, and call callback ++ * A risk of this dispatch method is that the callback routines may ++ * operate at the same time that votequorum_finalize has been called in another thread. ++ */ ++ memcpy (&callbacks, &votequorum_inst->callbacks, sizeof (votequorum_callbacks_t)); ++ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); ++ ++ /* ++ * Dispatch incoming message ++ */ ++ switch (dispatch_data.header.id) { ++ ++ case MESSAGE_RES_VOTEQUORUM_NOTIFICATION: ++ if (callbacks.votequorum_notify_fn == NULL) { ++ continue; ++ } ++ res_lib_votequorum_notification = (struct res_lib_votequorum_notification *)&dispatch_data; ++ ++ callbacks.votequorum_notify_fn ( handle, ++ res_lib_votequorum_notification->context, ++ res_lib_votequorum_notification->quorate, ++ res_lib_votequorum_notification->node_list_entries, ++ (votequorum_node_t *)res_lib_votequorum_notification->node_list ); ++ ; ++ break; ++ ++ default: ++ error = CS_ERR_LIBRARY; ++ goto error_put; ++ break; ++ } ++ ++ /* ++ * Determine if more messages should be processed ++ * */ ++ switch (dispatch_types) { ++ case CS_DISPATCH_ONE: ++ cont = 0; ++ break; ++ case CS_DISPATCH_ALL: ++ break; ++ case CS_DISPATCH_BLOCKING: ++ break; ++ } ++ } while (cont); ++ ++ goto error_put; ++ ++error_unlock: ++ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); ++ ++error_put: ++ saHandleInstancePut (&votequorum_handle_t_db, handle); ++ return (error); ++} diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile --- corosync-0.92/Makefile 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/Makefile 2008-12-11 10:42:17.000000000 +0100 ++++ corosync-trunk/Makefile 2009-01-26 11:46:08.000000000 +0100 @@ -115,10 +115,17 @@ (cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean)); rm -rf $(builddir)doc/api +-COROSYNC_LIBS = evs cpg cfg coroutil confdb +lint: + (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,lint)); + (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,lint)); @@ -12219,14 +14751,41 @@ diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile + (cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,lint)); + (cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,lint)); + - COROSYNC_LIBS = evs cpg cfg coroutil confdb ++COROSYNC_LIBS = evs cpg cfg coroutil confdb quorum votequorum COROSYNC_HEADERS = cpg.h cfg.h evs.h ipc_gen.h mar_gen.h swab.h \ - ais_util.h confdb.h list.h saAis.h -+ ais_util.h confdb.h list.h corotypes.h ++ ais_util.h confdb.h quorum.h list.h corotypes.h votequorum.h EXEC_LIBS = totem_pg logsys +@@ -145,7 +152,7 @@ + install -m 755 exec/lib$$eLib.so.2.* $(DESTDIR)$(LIBDIR); \ + if [ "xYES" = "x$(STATICLIBS)" ]; then \ + install -m 755 exec/lib$$eLib.a $(DESTDIR)$(LIBDIR); \ +- if [ ${OPENCOROSYNC_COMPAT} = "DARWIN" ]; then \ ++ if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ + ranlib $(DESTDIR)$(LIBDIR)/lib$$eLib.a; \ + fi \ + fi \ +@@ -161,7 +168,7 @@ + install -m 755 lib/lib$$aLib.so.2.* $(DESTDIR)$(LIBDIR); \ + if [ "xYES" = "x$(STATICLIBS)" ]; then \ + install -m 755 lib/lib$$aLib.a $(DESTDIR)$(LIBDIR); \ +- if [ ${OPENCOROSYNC_COMPAT} = "DARWIN" ]; then \ ++ if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ + ranlib $(DESTDIR)$(LIBDIR)/lib$$aLib.a; \ + fi \ + fi \ +@@ -177,7 +184,7 @@ + install -m 755 $(builddir)tools/corosync-cfgtool $(DESTDIR)$(SBINDIR) + install -m 755 $(builddir)tools/corosync-keygen $(DESTDIR)$(SBINDIR) + +- if [ ! -f $(DESTDIR)$(ETCDIR)/penais.conf ] ; then \ ++ if [ ! -f $(DESTDIR)$(ETCDIR)/corosync.conf ] ; then \ + install -m 644 $(srcdir)conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \ + fi + @@ -196,6 +203,7 @@ install -m 644 $(srcdir)include/corosync/engine/coroapi.h $(DESTDIR)$(INCLUDEDIR_ENGINE) install -m 644 $(srcdir)include/corosync/engine/objdb.h $(DESTDIR)$(INCLUDEDIR_ENGINE) @@ -12300,6 +14859,35 @@ diff -Naurd corosync-0.92/Makefile.inc corosync-trunk/Makefile.inc override LDFLAGS += -ldl -lpthread override DYFLAGS += -rdynamic endif +diff -Naurd corosync-0.92/man/confdb_overview.8 corosync-trunk/man/confdb_overview.8 +--- corosync-0.92/man/confdb_overview.8 2008-08-15 08:15:26.000000000 +0200 ++++ corosync-trunk/man/confdb_overview.8 2009-01-26 11:46:08.000000000 +0100 +@@ -34,16 +34,24 @@ + .TH CONFDB_OVERVIEW 8 2006-03-06 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" + .SH OVERVIEW + The CONFDB library is delivered with the corosync project. This library is used +-to examine manipulate the configuratin databser used by corosync. ++to examine manipulate the configuration database used by corosync. + .PP + The library provides a mechanism to: ++.PP + * Create new objects ++.PP + * Create new key/value pairs within those objects ++.PP + * Remove existing keys ++.PP + * Remove an existing object and all it sub-objects and keys ++.PP + * Read keys and values ++.PP + * Iterate keys within an object ++.PP + * Iterate subobjects within a parent object ++.PP + * Find a named object + .PP + .SH BUGS diff -Naurd corosync-0.92/man/corosync.conf.5 corosync-trunk/man/corosync.conf.5 --- corosync-0.92/man/corosync.conf.5 2008-08-15 08:15:26.000000000 +0200 +++ corosync-trunk/man/corosync.conf.5 2008-10-21 00:05:51.000000000 +0200 @@ -12324,10 +14912,1087 @@ diff -Naurd corosync-0.92/man/corosync.conf.5 corosync-trunk/man/corosync.conf.5 timestamp This specifies that a timestamp is placed on all log messages. +diff -Naurd corosync-0.92/man/index.html corosync-trunk/man/index.html +--- corosync-0.92/man/index.html 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/man/index.html 2009-01-26 11:46:08.000000000 +0100 +@@ -85,5 +85,30 @@ +
+ confdb_object_parent_get(3): Description of the confdb_object_parent_get interface. + ++
++votequorum_overview(8): An overview of the vote-based quorum service ++
++votequorum_initialize(3): Description of the votequorum interface. ++
++votequorum_finalize(3): Description of the votequorum interface. ++
++votequorum_fd_get(3): Description of the votequorum interface. ++
++votequorum_getinfo(3): Description of the votequorum interface. ++
++votequorum_leaving(3): Description of the votequorum interface. ++
++votequorum_setexpected(3): Description of the votequorum interface. ++
++votequorum_setvotes(3): Description of the votequorum interface. ++
++votequorum_qdisk_register(3): Description of the votequorum interface. ++
++votequorum_qdisk_unregister(3): Description of the votequorum interface. ++
++votequorum_qdisk_poll(3): Description of the votequorum interface. ++
++votequorum_qdisk_getinfo(3): Description of the votequorum interface. ++
+ + +diff -Naurd corosync-0.92/man/Makefile corosync-trunk/man/Makefile +--- corosync-0.92/man/Makefile 2008-08-14 18:54:46.000000000 +0200 ++++ corosync-trunk/man/Makefile 2009-01-26 11:46:08.000000000 +0100 +@@ -74,6 +74,19 @@ + groff -mandoc -Thtml confdb_object_parent_get.3 > html/confdb_object_parent_get.html + groff -mandoc -Thtml confdb_overview.8 > html/confdb_overview.html + ++ groff -mandoc -Thtml votequorum_overview.8 > html/votequorum_overview.html ++ groff -mandoc -Thtml votequorum_initialize.3 > html/votequorum_initialize.html ++ groff -mandoc -Thtml votequorum_finalize.3 > html/votequorum_finalize.html ++ groff -mandoc -Thtml votequorum_fd_get.3 > html/votequorum_fd_get.html ++ groff -mandoc -Thtml votequorum_dispatch.3 > html/votequorum_dispatch.html ++ groff -mandoc -Thtml votequorum_getinfo.3 > html/votequorum_getinfo.html ++ groff -mandoc -Thtml votequorum_leaving.3 > html/votequorum_leaving.html ++ groff -mandoc -Thtml votequorum_setexpected.3 > html/votequorum_setexpected.html ++ groff -mandoc -Thtml votequorum_setvotes.3 > html/votequorum_setvotes.html ++ groff -mandoc -Thtml votequorum_qdisk_register.3 > html/votequorum_qdisk_register.html ++ groff -mandoc -Thtml votequorum_qdisk_unregister.3 > html/votequorum_qdisk_unregister.html ++ groff -mandoc -Thtml votequorum_qdisk_poll.3 > html/votequorum_poll.html ++ groff -mandoc -Thtml votequorum_qdisk_getinfo.3 > html/votequorum_qdisk_getinfo.html + cp index.html html + + clean: +diff -Naurd corosync-0.92/man/votequorum_dispatch.3 corosync-trunk/man/votequorum_dispatch.3 +--- corosync-0.92/man/votequorum_dispatch.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_dispatch.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,96 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_DISPATCH 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_dispatch \- Dispatches callbacks from the votequorum service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_dispatch(votequorum_handle_t " handle ", votequorum_dispatch_t *" dispatch_types ");" ++.SH DESCRIPTION ++The ++.B votequorum_dispatch ++function is used to dispatch configuration changes. ++.PP ++Each application may have several connections to the votequorum API. Each application ++uses the ++.I handle ++argument to uniquely identify the connection. ++.PP ++The ++.I dispatch_types ++argument is used to identify the type of dispatch to execute. The possible types are ++defined by the structure: ++ ++.IP ++.RS ++.ne 18 ++.nf ++.ta 4n 30n 33n ++typedef enum { ++ CS_DISPATCH_ONE, ++ CS_DISPATCH_ALL, ++ CS_DISPATCH_BLOCKING ++} votequorum_dispatch_t; ++.ta ++.fi ++.RE ++.IP ++.PP ++.PP ++The dispatch values have the following meanings: ++.TP ++.B CS_DISPATCH_ONE ++Dispatch at least one callback, blocking until the callback is dispatched. ++.TP ++.B CS_DISPATCH_ALL ++Dispatch all waiting callbacks without blocking to wait for any callbacks. ++.TP ++.B CS_DISPATCH_BLOCKING ++Dispatch all callbacks blocking indefinitely. This is used in a threaded ++program where a thread is created, and then votequorum_dispatch() is called immediately ++from the created thread to execute callbacks. ++ ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_fd_get (3), ++ ++.PP +diff -Naurd corosync-0.92/man/votequorum_fd_get.3 corosync-trunk/man/votequorum_fd_get.3 +--- corosync-0.92/man/votequorum_fd_get.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_fd_get.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,64 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_FD_GET 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_fd_get \- Dispatches callbacks from the votequorum service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_fd_get(votequorum_handle_t " handle ", int *" fd ");" ++.SH DESCRIPTION ++The ++.B votequorum_fd_get ++function is used to retrieve the file descriptor that may be used with the poll ++system call to determine when ++.B votequorum_dispatch(3) ++won't block. The ++.I handle ++argument may not be used directly with ++.B poll ++because it is not the file descriptor, but instead an internal identifier used ++by the votequorum library. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_finalize.3 corosync-trunk/man/votequorum_finalize.3 +--- corosync-0.92/man/votequorum_finalize.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_finalize.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,61 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_FINALIZE 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_finalize \- Terminate a connection to the votequorum service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_finalize(votequorum_handle_t " handle ");" ++.SH DESCRIPTION ++The ++.B votequorum_finalize ++function is used to close a connection to the configuration dabatase API. ++Once the connection is finalized, the handle may not be used again by applications. ++No more callbacks will be dispatched from the ++.B votequorum_dispatch function. ++.PP ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++ ++.PP +diff -Naurd corosync-0.92/man/votequorum_getinfo.3 corosync-trunk/man/votequorum_getinfo.3 +--- corosync-0.92/man/votequorum_getinfo.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_getinfo.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,91 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_GETINFO 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_getinfo \- Get information about the VoteQuorum service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_getinfo(votequorum_handle_t *" handle ", unsigned int " nodeid ", struct votequorum_info *" info "); ++.SH DESCRIPTION ++The ++.B votequorum_getinfo ++function is used to get information about the voteing system and its nodes. ++ ++The votequorum_info structure is defined as follows: ++.PP ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.ta 4n 20n 32n ++ ++struct votequorum_info { ++ unsigned int node_id; ++ unsigned int node_votes; ++ unsigned int node_expected_votes; ++ unsigned int highest_expected; ++ unsigned int total_votes; ++ unsigned int quorum; ++ unsigned int flags; ++}; ++ ++#define VOTEQUORUM_INFO_FLAG_DIRTY 1 ++#define VOTEQUORUM_INFO_FLAG_DISALLOWED 2 ++#define VOTEQUORUM_INFO_FLAG_TWONODE 4 ++#define VOTEQUORUM_INFO_FLAG_QUORATE 8 ++ ++.ta ++.fi ++.RE ++.IP ++.PP ++.PP ++The members starting node_ hold information specific to the requested nodeid, the other are ++general to the voting system. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH BUGS ++Callbacks are not support at the moment. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_finalize (3), ++.BR votequorum_fd_get (3), ++.BR votequorum_dispatch (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_initialize.3 corosync-trunk/man/votequorum_initialize.3 +--- corosync-0.92/man/votequorum_initialize.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_initialize.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,106 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_INITIALIZE 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_initialize \- Create a new connection to the VoteQuorum service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_initialize(votequorum_handle_t *" handle ", votequorum_callbacks_t *" callbacks "); ++.SH DESCRIPTION ++The ++.B votequorum_initialize ++function is used to initialize a connection to the vote-based quorum database API. ++.PP ++Each application may have several connections to the votequorum API. Each application ++uses the ++.I handle ++argument to uniquely identify the connection. The ++.I handle ++argument is then used in other function calls to identify the connection to be used ++for communication with the votequorum service. ++.PP ++Every time the voting configuraton changes (eg a node joins or leave the cluster), the callback is called. ++The callback function is described by the following type definitions: ++ ++typedef void (*votequorum_notification_fn_t) ( ++ votequorum_handle_t handle, ++ uint64_t context, ++ uint32_t quorate, ++ uint32_t node_list_entries, ++ votequorum_node_t node_list[] ++ ); ++ ++.ta ++.fi ++.RE ++.IP ++.PP ++.PP ++The ++.I callbacks ++argument is of the type: ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++typedef struct { ++ votequorum_notification_fn_t votequorum_notify_fn; ++} votequorum_callbacks_t; ++ ++.ta ++.fi ++.RE ++.IP ++.PP ++When a configuration change occurs, the callback ++is called from the ++.B votequorum_dispatch() ++function. ++.PP ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH BUGS ++Callbacks are not support at the moment. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_finalize (3), ++.BR votequorum_fd_get (3), ++.BR votequorum_dispatch (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_leaving.3 corosync-trunk/man/votequorum_leaving.3 +--- corosync-0.92/man/votequorum_leaving.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_leaving.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,67 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_LEAVING 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_leaving \- Tell other nodes that we are leaving the cluster ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_leaving(votequorum_handle_t " handle ");" ++.SH DESCRIPTION ++The ++.B votequorum_leaving ++function is used to tell the other nodes in the cluster that this node is leaving. They ++will (when the node actually leaves) reduce quorum to keep the cluster running without ++this node. ++.PP ++This function should only be called if it is known that the node is being shut down for ++a known reason and could be out of the cluster for an extended period of time. ++.PP ++Normal behaviour is for the cluster to reduce the total number of votes, but NOT expected_votes ++when a node leave the cluster, so the cluster could become inquorate. This is correct behaviour ++and is ther eto prevent split-brain. ++.PP ++Do NOT call this function unless you know what you are doing. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_overview.8 corosync-trunk/man/votequorum_overview.8 +--- corosync-0.92/man/votequorum_overview.8 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_overview.8 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,82 @@ ++.\"/* ++.\" * Copyright (c) 2008 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_OVERVIEW 8 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH OVERVIEW ++The votequuorum library is delivered with the corosync project. It is the external interface to ++the vote-based quorum service. This service is optionally loaded into all ndes in a corosync cluster ++to avoid split-brain situations. It does this by having a number of votes assigned to each system ++in the cluster and ensuring that only when a majority of the votes are present, cluster operations are ++allowed to proceed. ++.PP ++The library provides a mechanism to: ++* Query the quorum status ++.PP ++* Get a list of nodes known to the quorum service ++.PP ++* Receive notifications of quorum state changes ++.PP ++* Change the number of votes assigned to a node ++.PP ++* Change the number of expected votes for a cluster to be quorate ++.PP ++* Connect an additional quorum device to allow small clusters to remain quorate during node outages. ++.PP ++.B votequorum ++reads its configuration from the objdb. The following keys are read when it starts up: ++.PP ++* quorum.expected_votes ++.br ++* quorum.votes ++.br ++* quorum.quorumdev_poll ++.br ++* quorum.disallowed ++.br ++* quorum.two_node ++.PP ++Most of those values can be changed while corosync is running with the following exceptions: ++.B quorum.disallowed ++cannot be changed, and ++.B two_node ++cannot be set on-the-fly, though it can be cleared. ie you can start with two nodes in the cluster ++and add a third without rebooting all the nodes. ++.PP ++.SH BUGS ++This software is not yet production, so there may still be some bugs. ++.SH "SEE ALSO" ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_fd_get (3), ++.BR votequorum_dispatch (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_qdisk_getinfo.3 corosync-trunk/man/votequorum_qdisk_getinfo.3 +--- corosync-0.92/man/votequorum_qdisk_getinfo.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_qdisk_getinfo.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,80 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_QDISK_GETINFO 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_qdisk_getinfo \- Get details of the quorum device ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_qdisk_getinfo(votequorum_handle_t " handle ", struct votequorum_qdisk_info " *info ");" ++.SH DESCRIPTION ++The ++.B votequorum_qdisk_getinfo ++Returns information about the quorum device in the following structure: ++.PP ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.ta 4n 20n 32n ++ ++struct votequorum_qdisk_info { ++ unsigned int votes; ++ unsigned int state; ++ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; ++}; ++ ++.ta ++.fi ++.RE ++.IP ++.PP ++.PP ++ ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.BR votequorum_qdisk_poll (3), ++.BR votequorum_qdisk_unregister (3), ++.BR votequorum_qdisk_getinfo (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_qdisk_poll.3 corosync-trunk/man/votequorum_qdisk_poll.3 +--- corosync-0.92/man/votequorum_qdisk_poll.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_qdisk_poll.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,69 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_QDISK_POLL 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_qdisk_poll \- Tells votequorum the result of the quorum device poll ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_qdisk_poll(votequorum_handle_t " handle ", unsigned int " state ");" ++.SH DESCRIPTION ++The ++.B votequorum_qdisk_poll ++is called by the quorum device subsyetem (not provided as part of votequorum) to tell ++the voting system if the qurum device is present/active or not. If ++.B state ++is 1 then the votes for the device are included in the quorum calculation, otherwise not. ++This routine should be called at regular intervals to ensure that the device status ++is always known to votequorum. If ++.B votequorum_qdisk_poll ++is not called after (default) 10 seconds then the device will be deeded to be dead and ++its votes removed from the cluster. This does not unregister the device. ++The default poll time can be changed by setting the object database variable ++quorum.quorumdev_poll. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.BR votequorum_qdisk_poll (3), ++.BR votequorum_qdisk_unregister (3), ++.BR votequorum_qdisk_getinfo (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_qdisk_register.3 corosync-trunk/man/votequorum_qdisk_register.3 +--- corosync-0.92/man/votequorum_qdisk_register.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_qdisk_register.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,68 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_QDISK_REGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_qdisk_register \- Registers a new quorum device ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_qdisk_register(votequorum_handle_t " handle ", char * " name ", unsigned int " votes ");" ++.SH DESCRIPTION ++The ++.B votequorum_qdisk_register ++is used to register a new quorum device. A quorum device is an external way of adding votes to a small ++cluster. The quorum device is, in effect, a pseudo node in the cluster that provide votes based on some ++external device, usually a shared disk partition or perhaps a network router. ++.br ++This call creates the device but does not mark it active. ++.B votequorum_qdisk_poll ++must be called for the votes to be included in the quorum calculation. ++.br ++Note that it is the responsibility of the quorum device subsystem (not provided as part of votequorum) ++to keep all nodes informed of the quorum device status. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.BR votequorum_qdisk_poll (3), ++.BR votequorum_qdisk_unregister (3), ++.BR votequorum_qdisk_getinfo (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_qdisk_unregister.3 corosync-trunk/man/votequorum_qdisk_unregister.3 +--- corosync-0.92/man/votequorum_qdisk_unregister.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_qdisk_unregister.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,60 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_QDISK_UNREGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_qdisk_unregister \- Unregisters a new quorum device ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_qdisk_unregister(votequorum_handle_t " handle ");" ++.SH DESCRIPTION ++The ++.B votequorum_qdisk_unregister ++unregisters a quorum device. Any votes it had will be removed from the cluster. Not that this could ++make the cluster inquorate. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.BR votequorum_qdisk_poll (3), ++.BR votequorum_qdisk_unregister (3), ++.BR votequorum_qdisk_getinfo (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_setexpected.3 corosync-trunk/man/votequorum_setexpected.3 +--- corosync-0.92/man/votequorum_setexpected.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_setexpected.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,60 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_SETEXPECTED 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_setexpected \- Sets the expected votes for the cluster ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_setexpected(votequorum_handle_t " handle ", int " expected_votes ");" ++.SH DESCRIPTION ++The ++.B votequorum_setexpected ++function is used to change the expected votes in the cluster. Expected votes is used to calculate ++quorum and should normally be the total number of votes that will exist when all the expected nodes ++are joined. Quorum will usually be half of this (rounded up). ++.br ++It is not possible to set expected votes up so that it makes the cluster inquorate using this command. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.PP +diff -Naurd corosync-0.92/man/votequorum_setvotes.3 corosync-trunk/man/votequorum_setvotes.3 +--- corosync-0.92/man/votequorum_setvotes.3 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/man/votequorum_setvotes.3 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,57 @@ ++.\"/* ++.\" * Copyright (c) 2009 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH VOTEQUORUM_VOTES 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++votequorum_setvotes \- Sets the number of votes for a node ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "int votequorum_setexpected(votequorum_handle_t " handle ", unsigned int " nodeid ", int " votes ");" ++.SH DESCRIPTION ++The ++.B votequorum_setvotes ++is used to change the number of votes that a node has. Note that it is not possible, using this function, ++to change the number of node votes such that the cluster goes inquorate. ++.SH RETURN VALUE ++This call returns the CS_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR votequorum_overview (8), ++.BR votequorum_initialize (3), ++.BR votequorum_finalize (3), ++.BR votequorum_dispatch (3), ++.BR votequorum_fd_get (3), ++.PP diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c --- corosync-0.92/services/cfg.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/services/cfg.c 2008-11-06 22:49:07.000000000 +0100 -@@ -7,7 +7,7 @@ ++++ corosync-trunk/services/cfg.c 2009-01-19 09:31:21.000000000 +0100 +@@ -1,13 +1,13 @@ + /* + * Copyright (c) 2005-2006 MontaVista Software, Inc. +- * Copyright (c) 2006-2008 Red Hat, Inc. ++ * Copyright (c) 2006-2009 Red Hat, Inc. + * + * All rights reserved. + * * Author: Steven Dake (sdake@redhat.com) * * This software licensed under BSD license, the text of which follows: @@ -12336,7 +16001,12 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -@@ -46,7 +46,7 @@ +@@ -42,16 +42,18 @@ + #include + #include + #include ++#include + #include #include #include @@ -12345,7 +16015,13 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c #include #include #include -@@ -60,7 +60,31 @@ + #include + #include ++#include + #include + #include + #include +@@ -60,7 +62,31 @@ LOGSYS_DECLARE_SUBSYS ("CFG", LOG_INFO); enum cfg_message_req_types { @@ -12378,7 +16054,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c }; static void cfg_confchg_fn ( -@@ -82,6 +106,16 @@ +@@ -82,6 +108,16 @@ void *message, unsigned int nodeid); @@ -12395,7 +16071,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c static void message_handler_req_lib_cfg_ringstatusget ( void *conn, void *msg); -@@ -114,6 +148,18 @@ +@@ -114,6 +150,22 @@ void *conn, void *msg); @@ -12410,11 +16086,15 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c +static void message_handler_req_lib_cfg_replytoshutdown ( + void *conn, + void *msg); ++ ++static void message_handler_req_lib_cfg_get_node_addrs ( ++ void *conn, ++ void *msg); + /* * Service Handler Definition */ -@@ -123,56 +169,81 @@ +@@ -123,56 +175,87 @@ .lib_handler_fn = message_handler_req_lib_cfg_ringstatusget, .response_size = sizeof (struct res_lib_cfg_ringstatusget), .response_id = MESSAGE_RES_CFG_RINGSTATUSGET, @@ -12486,6 +16166,12 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c + .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown, + .response_size = 0, + .response_id = 0, ++ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 11 */ ++ .lib_handler_fn = message_handler_req_lib_cfg_get_node_addrs, ++ .response_size = sizeof (struct res_lib_cfg_get_node_addrs), ++ .response_id = MESSAGE_RES_CFG_GET_NODE_ADDRS, + .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED } }; @@ -12506,7 +16192,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c } }; -@@ -182,8 +253,9 @@ +@@ -182,8 +265,9 @@ struct corosync_service_engine cfg_service_engine = { .name = "corosync configuration service", .id = CFG_SERVICE, @@ -12518,7 +16204,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c .lib_init_fn = cfg_lib_init_fn, .lib_exit_fn = cfg_lib_exit_fn, .lib_engine = cfg_lib_engine, -@@ -238,12 +310,24 @@ +@@ -238,12 +322,24 @@ mar_message_source_t source __attribute__((aligned(8))); }; @@ -12543,7 +16229,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c return (0); } -@@ -256,16 +340,193 @@ +@@ -256,16 +352,193 @@ { } @@ -12740,7 +16426,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c return (0); } -@@ -281,18 +542,64 @@ +@@ -281,18 +554,64 @@ (struct req_exec_cfg_ringreenable *)message; struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; @@ -12808,7 +16494,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c } -@@ -310,11 +617,11 @@ +@@ -310,11 +629,11 @@ char *totem_ip_string; unsigned int i; @@ -12822,7 +16508,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c api->totem_ifaces_get ( api->totem_nodeid_get(), -@@ -336,7 +643,7 @@ +@@ -336,7 +655,7 @@ &res_lib_cfg_ringstatusget, sizeof (struct res_lib_cfg_ringstatusget)); @@ -12831,7 +16517,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c } static void message_handler_req_lib_cfg_ringreenable ( -@@ -346,7 +653,7 @@ +@@ -346,7 +665,7 @@ struct req_exec_cfg_ringreenable req_exec_cfg_ringreenable; struct iovec iovec; @@ -12840,7 +16526,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c req_exec_cfg_ringreenable.header.size = sizeof (struct req_exec_cfg_ringreenable); req_exec_cfg_ringreenable.header.id = SERVICE_ID_MAKE (CFG_SERVICE, -@@ -358,27 +665,56 @@ +@@ -358,27 +677,56 @@ assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0); @@ -12902,7 +16588,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c } static void message_handler_req_lib_cfg_administrativestateset ( -@@ -386,16 +722,17 @@ +@@ -386,16 +734,17 @@ void *msg) { // struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message; @@ -12924,7 +16610,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c } static void message_handler_req_lib_cfg_serviceload ( -@@ -406,7 +743,7 @@ +@@ -406,7 +755,7 @@ (struct req_lib_cfg_serviceload *)msg; struct res_lib_cfg_serviceload res_lib_cfg_serviceload; @@ -12933,7 +16619,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c api->service_link_and_init ( api, (char *)req_lib_cfg_serviceload->service_name, -@@ -414,12 +751,12 @@ +@@ -414,12 +763,12 @@ res_lib_cfg_serviceload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD; res_lib_cfg_serviceload.header.size = sizeof (struct res_lib_cfg_serviceload); @@ -12948,7 +16634,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c } static void message_handler_req_lib_cfg_serviceunload ( -@@ -430,17 +767,193 @@ +@@ -430,17 +779,225 @@ (struct req_lib_cfg_serviceunload *)msg; struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload; @@ -13144,10 +16830,49 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c + } + check_shutdown_status(); + LEAVE(); ++} ++ ++static void message_handler_req_lib_cfg_get_node_addrs (void *conn, void *msg) ++{ ++ struct totem_ip_address node_ifs[INTERFACE_MAX]; ++ char buf[PIPE_BUF]; ++ char **status; ++ unsigned int num_interfaces = 0; ++ int ret = 0; ++ int i; ++ struct req_lib_cfg_get_node_addrs *req_lib_cfg_get_node_addrs = (struct req_lib_cfg_get_node_addrs *)msg; ++ struct res_lib_cfg_get_node_addrs *res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf; ++ ++ if (req_lib_cfg_get_node_addrs->nodeid == 0) ++ req_lib_cfg_get_node_addrs->nodeid = api->totem_nodeid_get(); ++ ++ api->totem_ifaces_get(req_lib_cfg_get_node_addrs->nodeid, node_ifs, &status, &num_interfaces); ++ ++ res_lib_cfg_get_node_addrs->header.size = sizeof(struct res_lib_cfg_get_node_addrs) + (num_interfaces * TOTEMIP_ADDRLEN); ++ res_lib_cfg_get_node_addrs->header.id = MESSAGE_RES_CFG_GET_NODE_ADDRS; ++ res_lib_cfg_get_node_addrs->header.error = ret; ++ res_lib_cfg_get_node_addrs->num_addrs = num_interfaces; ++ if (num_interfaces) { ++ res_lib_cfg_get_node_addrs->family = node_ifs[0].family; ++ for (i = 0; iaddrs[i][0], node_ifs[i].addr, TOTEMIP_ADDRLEN); ++ } ++ } ++ else { ++ res_lib_cfg_get_node_addrs->header.error = CS_ERR_NOT_EXIST; ++ } ++ api->ipc_conn_send_response(conn, res_lib_cfg_get_node_addrs, res_lib_cfg_get_node_addrs->header.size); } diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c --- corosync-0.92/services/confdb.c 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/services/confdb.c 2008-12-08 16:55:41.000000000 +0100 ++++ corosync-trunk/services/confdb.c 2009-01-23 16:41:06.000000000 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2008 Red Hat, Inc. ++ * Copyright (c) 2008-2009 Red Hat, Inc. + * + * All rights reserved. + * @@ -38,7 +38,7 @@ #include #include @@ -13325,22 +17050,22 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res.size = sizeof(res); res.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY; -@@ -322,12 +324,12 @@ +@@ -322,12 +324,10 @@ { struct req_lib_confdb_object_find_destroy *req_lib_confdb_object_find_destroy = (struct req_lib_confdb_object_find_destroy *)message; mar_res_header_t res; - int ret = SA_AIS_OK; +- +- log_printf(LOG_LEVEL_DEBUG, "object_find_destroy for conn=%p, %d\n", conn, req_lib_confdb_object_find_destroy->find_handle); + int ret = CS_OK; - log_printf(LOG_LEVEL_DEBUG, "object_find_destroy for conn=%p, %d\n", conn, req_lib_confdb_object_find_destroy->find_handle); - if (api->object_find_destroy(req_lib_confdb_object_find_destroy->find_handle)) - ret = SA_AIS_ERR_ACCESS; + ret = CS_ERR_ACCESS; res.size = sizeof(res); res.id = MESSAGE_RES_CONFDB_OBJECT_FIND_DESTROY; -@@ -340,14 +342,14 @@ +@@ -340,14 +340,14 @@ { struct req_lib_confdb_key_create *req_lib_confdb_key_create = (struct req_lib_confdb_key_create *)message; mar_res_header_t res; @@ -13357,7 +17082,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res.size = sizeof(res); res.id = MESSAGE_RES_CONFDB_KEY_CREATE; -@@ -361,14 +363,14 @@ +@@ -361,14 +361,14 @@ struct res_lib_confdb_key_get res_lib_confdb_key_get; int value_len; void *value; @@ -13374,7 +17099,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c else { memcpy(res_lib_confdb_key_get.value.value, value, value_len); res_lib_confdb_key_get.value.length = value_len; -@@ -384,15 +386,13 @@ +@@ -384,15 +384,13 @@ { struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message; struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; @@ -13392,7 +17117,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec); res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_INCREMENT; -@@ -404,15 +404,13 @@ +@@ -404,15 +402,13 @@ { struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message; struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; @@ -13410,7 +17135,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec); res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_DECREMENT; -@@ -424,7 +422,7 @@ +@@ -424,7 +420,7 @@ { struct req_lib_confdb_key_replace *req_lib_confdb_key_replace = (struct req_lib_confdb_key_replace *)message; mar_res_header_t res; @@ -13419,7 +17144,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c if (api->object_key_replace(req_lib_confdb_key_replace->object_handle, req_lib_confdb_key_replace->key_name.value, -@@ -433,7 +431,7 @@ +@@ -433,7 +429,7 @@ req_lib_confdb_key_replace->old_value.length, req_lib_confdb_key_replace->new_value.value, req_lib_confdb_key_replace->new_value.length)) @@ -13428,7 +17153,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res.size = sizeof(res); res.id = MESSAGE_RES_CONFDB_KEY_REPLACE; -@@ -445,14 +443,14 @@ +@@ -445,14 +441,14 @@ { struct req_lib_confdb_key_delete *req_lib_confdb_key_delete = (struct req_lib_confdb_key_delete *)message; mar_res_header_t res; @@ -13445,7 +17170,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res.size = sizeof(res); res.id = MESSAGE_RES_CONFDB_KEY_DELETE; -@@ -465,11 +463,11 @@ +@@ -465,11 +461,11 @@ struct req_lib_confdb_object_parent_get *req_lib_confdb_object_parent_get = (struct req_lib_confdb_object_parent_get *)message; struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get; unsigned int object_handle; @@ -13459,7 +17184,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res_lib_confdb_object_parent_get.parent_object_handle = object_handle; res_lib_confdb_object_parent_get.header.size = sizeof(res_lib_confdb_object_parent_get); -@@ -487,7 +485,7 @@ +@@ -487,7 +483,7 @@ int key_name_len; void *value; int value_len; @@ -13468,7 +17193,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c if (api->object_key_iter_from(req_lib_confdb_key_iter->parent_object_handle, req_lib_confdb_key_iter->next_entry, -@@ -495,7 +493,7 @@ +@@ -495,7 +491,7 @@ &key_name_len, &value, &value_len)) @@ -13477,7 +17202,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c else { memcpy(res_lib_confdb_key_iter.key_name.value, key_name, key_name_len); memcpy(res_lib_confdb_key_iter.value.value, value, value_len); -@@ -514,7 +512,7 @@ +@@ -514,7 +510,7 @@ struct req_lib_confdb_object_iter *req_lib_confdb_object_iter = (struct req_lib_confdb_object_iter *)message; struct res_lib_confdb_object_iter res_lib_confdb_object_iter; int object_name_len; @@ -13486,12 +17211,16 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c if (!req_lib_confdb_object_iter->find_handle) { api->object_find_create(req_lib_confdb_object_iter->parent_object_handle, -@@ -526,7 +524,7 @@ +@@ -525,8 +521,10 @@ + res_lib_confdb_object_iter.find_handle = req_lib_confdb_object_iter->find_handle; if (api->object_find_next(res_lib_confdb_object_iter.find_handle, - &res_lib_confdb_object_iter.object_handle)) +- &res_lib_confdb_object_iter.object_handle)) - ret = SA_AIS_ERR_ACCESS; ++ &res_lib_confdb_object_iter.object_handle)) { + ret = CS_ERR_ACCESS; ++ api->object_find_destroy(res_lib_confdb_object_iter.find_handle); ++ } else { api->object_name_get(res_lib_confdb_object_iter.object_handle, (char *)res_lib_confdb_object_iter.object_name.value, @@ -13504,16 +17233,20 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c if (!req_lib_confdb_object_find->find_handle) { api->object_find_create(req_lib_confdb_object_find->parent_object_handle, -@@ -558,7 +556,7 @@ +@@ -557,8 +555,10 @@ + res_lib_confdb_object_find.find_handle = req_lib_confdb_object_find->find_handle; if (api->object_find_next(res_lib_confdb_object_find.find_handle, - &res_lib_confdb_object_find.object_handle)) +- &res_lib_confdb_object_find.object_handle)) - ret = SA_AIS_ERR_ACCESS; ++ &res_lib_confdb_object_find.object_handle)) { + ret = CS_ERR_ACCESS; ++ api->object_find_destroy(res_lib_confdb_object_find.find_handle); ++ } res_lib_confdb_object_find.header.size = sizeof(res_lib_confdb_object_find); res_lib_confdb_object_find.header.id = MESSAGE_RES_CONFDB_OBJECT_FIND; -@@ -571,11 +569,11 @@ +@@ -571,11 +571,11 @@ static void message_handler_req_lib_confdb_write (void *conn, void *message) { struct res_lib_confdb_write res_lib_confdb_write; @@ -13527,7 +17260,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res_lib_confdb_write.header.size = sizeof(res_lib_confdb_write); res_lib_confdb_write.header.id = MESSAGE_RES_CONFDB_WRITE; -@@ -593,11 +591,11 @@ +@@ -593,11 +593,11 @@ { struct req_lib_confdb_reload *req_lib_confdb_reload = (struct req_lib_confdb_reload *)message; struct res_lib_confdb_reload res_lib_confdb_reload; @@ -13541,7 +17274,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res_lib_confdb_reload.header.size = sizeof(res_lib_confdb_reload); res_lib_confdb_reload.header.id = MESSAGE_RES_CONFDB_RELOAD; -@@ -624,7 +622,7 @@ +@@ -624,7 +624,7 @@ res.header.size = sizeof(res); res.header.id = MESSAGE_RES_CONFDB_KEY_CHANGE_CALLBACK; @@ -13550,7 +17283,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c // handle & type res.change_type = change_type; res.parent_object_handle = parent_object_handle; -@@ -651,7 +649,7 @@ +@@ -651,7 +651,7 @@ res.header.size = sizeof(res); res.header.id = MESSAGE_RES_CONFDB_OBJECT_CREATE_CALLBACK; @@ -13559,7 +17292,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res.parent_object_handle = parent_object_handle; res.object_handle = object_handle; memcpy(res.name.value, name_pt, name_len); -@@ -668,7 +666,7 @@ +@@ -668,7 +668,7 @@ res.header.size = sizeof(res); res.header.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY_CALLBACK; @@ -13568,7 +17301,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c res.parent_object_handle = parent_object_handle; memcpy(res.name.value, name_pt, name_len); res.name.length = name_len; -@@ -686,10 +684,11 @@ +@@ -686,10 +686,11 @@ confdb_notify_lib_of_key_change, confdb_notify_lib_of_new_object, confdb_notify_lib_of_destroyed_object, @@ -13581,7 +17314,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c api->ipc_conn_send_response(conn, &res, sizeof(res)); } -@@ -700,11 +699,12 @@ +@@ -700,11 +701,12 @@ api->object_track_stop(confdb_notify_lib_of_key_change, confdb_notify_lib_of_new_object, confdb_notify_lib_of_destroyed_object, @@ -13597,7 +17330,7 @@ diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c --- corosync-0.92/services/cpg.c 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/services/cpg.c 2008-12-01 18:43:40.000000000 +0100 ++++ corosync-trunk/services/cpg.c 2009-01-08 07:29:16.000000000 +0100 @@ -51,7 +51,7 @@ #include #include @@ -13692,7 +17425,15 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c res = (struct res_lib_cpg_confchg_callback *)buf; res->joined_list_entries = joined_list_entries; -@@ -453,7 +453,7 @@ +@@ -404,6 +404,7 @@ + + res->header.size = size; + res->header.id = id; ++ res->header.error = CS_OK; + memcpy(&res->group_name, &gi->group_name, sizeof(mar_cpg_name_t)); + + /* Build up the message */ +@@ -453,7 +454,7 @@ } } @@ -13701,7 +17442,16 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c } static void remove_group(struct group_info *gi) -@@ -694,7 +694,7 @@ +@@ -571,6 +572,8 @@ + return; + } + } ++ if (!buf) ++ continue; + + res = (struct res_lib_cpg_groups_get_callback *)buf; + retgi = res->member_list; +@@ -694,7 +697,7 @@ struct memb_ring_id *ring_id) { int i; @@ -13710,7 +17460,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c struct iovec req_exec_cpg_iovec; /* We don't send the library joinlist in here because it can end up -@@ -736,7 +736,7 @@ +@@ -736,7 +739,7 @@ static void cpg_flow_control_state_set_fn ( void *context, @@ -13719,7 +17469,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c { struct res_lib_cpg_flowcontrol_callback res_lib_cpg_flowcontrol_callback; struct process_info *process_info = (struct process_info *)context; -@@ -1105,19 +1105,19 @@ +@@ -1105,19 +1108,19 @@ struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn); struct res_lib_cpg_join res_lib_cpg_join; struct group_info *gi; @@ -13742,7 +17492,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c goto join_err; } -@@ -1151,12 +1151,12 @@ +@@ -1151,12 +1154,12 @@ struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn); struct res_lib_cpg_leave res_lib_cpg_leave; struct group_info *gi; @@ -13757,7 +17507,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c goto leave_ret; } gi = pi->group; -@@ -1198,7 +1198,7 @@ +@@ -1198,7 +1201,7 @@ if (!gi) { res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast); res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST; @@ -13766,7 +17516,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c res_lib_cpg_mcast.flow_control_state = CPG_FLOW_CONTROL_DISABLED; api->ipc_conn_send_response(conn, &res_lib_cpg_mcast, sizeof(res_lib_cpg_mcast)); -@@ -1225,7 +1225,7 @@ +@@ -1225,7 +1228,7 @@ res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast); res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST; @@ -13775,7 +17525,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c res_lib_cpg_mcast.flow_control_state = pi->flow_control_state; api->ipc_conn_send_response(conn, &res_lib_cpg_mcast, sizeof(res_lib_cpg_mcast)); -@@ -1240,7 +1240,7 @@ +@@ -1240,7 +1243,7 @@ mar_res_header_t res; res.size = sizeof(res); res.id = MESSAGE_RES_CPG_MEMBERSHIP; @@ -13784,7 +17534,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c api->ipc_conn_send_response(conn, &res, sizeof(res)); return; } -@@ -1256,13 +1256,13 @@ +@@ -1256,13 +1259,13 @@ struct group_info *gi; struct process_info *otherpi; void *otherconn; @@ -13800,7 +17550,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c goto tstart_ret; } -@@ -1274,7 +1274,7 @@ +@@ -1274,7 +1277,7 @@ tstart_ret: res_lib_cpg_trackstart.header.size = sizeof(res_lib_cpg_trackstart); res_lib_cpg_trackstart.header.id = MESSAGE_RES_CPG_TRACKSTART; @@ -13809,7 +17559,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c api->ipc_conn_send_response(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart)); } -@@ -1285,13 +1285,13 @@ +@@ -1285,13 +1288,13 @@ struct process_info *otherpi; void *otherconn; struct group_info *gi; @@ -13825,7 +17575,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c goto tstop_ret; } -@@ -1303,7 +1303,7 @@ +@@ -1303,7 +1306,7 @@ tstop_ret: res_lib_cpg_trackstop.header.size = sizeof(res_lib_cpg_trackstop); res_lib_cpg_trackstop.header.id = MESSAGE_RES_CPG_TRACKSTOP; @@ -13834,7 +17584,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c api->ipc_conn_send_response(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop)); } -@@ -1313,7 +1313,7 @@ +@@ -1313,7 +1316,7 @@ res_lib_cpg_local_get.header.size = sizeof(res_lib_cpg_local_get); res_lib_cpg_local_get.header.id = MESSAGE_RES_CPG_LOCAL_GET; @@ -13843,7 +17593,7 @@ diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c res_lib_cpg_local_get.local_nodeid = api->totem_nodeid_get (); api->ipc_conn_send_response(conn, &res_lib_cpg_local_get, -@@ -1326,7 +1326,7 @@ +@@ -1326,7 +1329,7 @@ res_lib_cpg_groups_get.header.size = sizeof(res_lib_cpg_groups_get); res_lib_cpg_groups_get.header.id = MESSAGE_RES_CPG_GROUPS_GET; @@ -14018,7 +17768,7 @@ diff -Naurd corosync-0.92/services/evs.c corosync-trunk/services/evs.c msg_addr = (char *)req_exec_evs_mcast + sizeof (struct req_exec_evs_mcast) + diff -Naurd corosync-0.92/services/Makefile corosync-trunk/services/Makefile --- corosync-0.92/services/Makefile 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/services/Makefile 2008-12-08 16:55:41.000000000 +0100 ++++ corosync-trunk/services/Makefile 2009-01-26 11:46:08.000000000 +0100 @@ -50,12 +50,12 @@ endif @@ -14031,27 +17781,36 @@ diff -Naurd corosync-0.92/services/Makefile corosync-trunk/services/Makefile override CFLAGS += -fPIC -all: service_evs.lcrso service_cfg.lcrso service_cpg.lcrso service_confdb.lcrso -+all: service_evs.lcrso service_cfg.lcrso service_cpg.lcrso service_confdb.lcrso service_pload.lcrso testquorum.lcrso ++all: service_evs.lcrso service_cfg.lcrso service_cpg.lcrso service_confdb.lcrso service_pload.lcrso testquorum.lcrso service_votequorum.lcrso ifeq (${COROSYNC_COMPAT}, DARWIN) -@@ -71,6 +71,9 @@ +@@ -71,6 +71,15 @@ service_cpg.lcrso: cpg.o $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load cpg.o -o $@ +service_pload.lcrso: pload.o + $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load pload.o -o $@ ++ ++service_votequorum.lcrso: votequorum.o ++ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load votequorum.o -o $@ ++ ++testquorum.lcrso: testquorum.o ++ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load testquorum.o -o $@ + else service_evs.lcrso: evs.o -@@ -85,11 +88,20 @@ +@@ -85,11 +94,23 @@ service_cpg.lcrso: cpg.o $(CC) -shared -Wl,-soname,service_cpg.lcrso cpg.o -o $@ +service_pload.lcrso: pload.o + $(CC) -shared -Wl,-soname,service_pload.lcrso pload.o -o $@ + ++service_votequorum.lcrso: votequorum.o ++ $(CC) -shared -Wl,-soname,service_votequorum.lcrso votequorum.o -o $@ ++ +testquorum.lcrso: testquorum.o + $(CC) -shared -Wl,-soname,testquorum.lcrso testquorum.o -o $@ + @@ -14066,7 +17825,7 @@ diff -Naurd corosync-0.92/services/Makefile corosync-trunk/services/Makefile depend: makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(EXEC_SRC) $(TOTEM_SRC) $(LOGSYS_SRC) $(LCR_SRC) > /dev/null 2>&1 -@@ -104,3 +116,6 @@ +@@ -104,3 +125,6 @@ cpg.o: cpg.c $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< @@ -14590,6 +18349,1629 @@ diff -Naurd corosync-0.92/services/testquorum.c corosync-trunk/services/testquor + /* Register for quorum changes too! */ + api->quorum_register_callback(quorum_callback, NULL); +} +diff -Naurd corosync-0.92/services/votequorum.c corosync-trunk/services/votequorum.c +--- corosync-0.92/services/votequorum.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/services/votequorum.c 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,1619 @@ ++/* ++ * Copyright (c) 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 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 CONTIBUTORS "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 ++#ifndef COROSYNC_BSD ++#include ++#endif ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define VOTEQUORUM_MAJOR_VERSION 6 ++#define VOTEQUORUM_MINOR_VERSION 3 ++#define VOTEQUORUM_PATCH_VERSION 0 ++ ++ /* Silly default to prevent accidents! */ ++#define DEFAULT_EXPECTED 1024 ++#define DEFAULT_QDEV_POLL 10000 ++ ++LOGSYS_DECLARE_SUBSYS ("VOTEQ", LOG_INFO); ++ ++enum quorum_message_req_types { ++ MESSAGE_REQ_EXEC_VOTEQUORUM_NODEINFO = 0, ++ MESSAGE_REQ_EXEC_VOTEQUORUM_RECONFIGURE = 1, ++ MESSAGE_REQ_EXEC_VOTEQUORUM_KILLNODE = 2, ++}; ++ ++#define NODE_FLAGS_BEENDOWN 1 ++#define NODE_FLAGS_SEESDISALLOWED 8 ++#define NODE_FLAGS_HASSTATE 16 ++#define NODE_FLAGS_QDISK 32 ++#define NODE_FLAGS_REMOVED 64 ++#define NODE_FLAGS_US 128 ++ ++ ++typedef enum { NODESTATE_JOINING=1, NODESTATE_MEMBER, ++ NODESTATE_DEAD, NODESTATE_LEAVING, NODESTATE_DISALLOWED } nodestate_t; ++ ++ ++/* This structure is tacked onto the start of a cluster message packet for our ++ * own nefarious purposes. */ ++struct q_protheader { ++ unsigned char tgtport; /* Target port number */ ++ unsigned char srcport; /* Source (originating) port number */ ++ unsigned short pad; ++ unsigned int flags; ++ int srcid; /* Node ID of the sender */ ++ int tgtid; /* Node ID of the target */ ++} __attribute__((packed)); ++ ++struct cluster_node { ++ int flags; ++ int node_id; ++ unsigned int expected_votes; ++ unsigned int votes; ++ time_t join_time; ++ ++ nodestate_t state; ++ ++ struct timeval last_hello; /* Only used for quorum devices */ ++ ++ struct list_head list; ++}; ++ ++static int quorum_flags; ++#define VOTEQUORUM_FLAG_FEATURE_DISALLOWED 1 ++#define VOTEQUORUM_FLAG_FEATURE_TWONODE 1 ++ ++static int quorum; ++static int cluster_is_quorate; ++static int first_trans = 1; ++static unsigned int quorumdev_poll = DEFAULT_QDEV_POLL; ++ ++static struct cluster_node *us; ++static struct cluster_node *quorum_device = NULL; ++static char quorum_device_name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; ++static corosync_timer_handle_t quorum_device_timer; ++static struct list_head cluster_members_list; ++static struct corosync_api_v1 *corosync_api; ++static struct list_head trackers_list; ++static unsigned int quorum_members[PROCESSOR_COUNT_MAX+1]; ++static int quorum_members_entries = 0; ++static struct memb_ring_id quorum_ringid; ++static cs_tpg_handle group_handle; ++ ++#define max(a,b) (((a) > (b)) ? (a) : (b)) ++static struct cluster_node *find_node_by_nodeid(int nodeid); ++static struct cluster_node *allocate_node(int nodeid); ++static char *kill_reason(int reason); ++ ++static struct corosync_tpg_group quorum_group[1] = { ++ { .group = "VOTEQ", .group_len = 5}, ++}; ++ ++#define list_iterate(v, head) \ ++ for (v = (head)->next; v != head; v = v->next) ++ ++struct quorum_pd { ++ unsigned char track_flags; ++ int tracking_enabled; ++ uint64_t tracking_context; ++ struct list_head list; ++ void *conn; ++}; ++ ++/* ++ * Service Interfaces required by service_message_handler struct ++ */ ++ ++static void votequorum_init(struct corosync_api_v1 *api, ++ quorum_set_quorate_fn_t report); ++ ++static void quorum_confchg_fn ( ++ enum totem_configuration_type configuration_type, ++ unsigned int *member_list, int member_list_entries, ++ unsigned int *left_list, int left_list_entries, ++ unsigned int *joined_list, int joined_list_entries, ++ struct memb_ring_id *ring_id); ++ ++static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len, ++ int endian_conversion_required); ++ ++static int votequorum_exec_init_fn (struct corosync_api_v1 *corosync_api); ++ ++static int quorum_lib_init_fn (void *conn); ++ ++static int quorum_lib_exit_fn (void *conn); ++ ++static void message_handler_req_exec_quorum_nodeinfo ( ++ void *message, ++ unsigned int nodeid); ++ ++static void message_handler_req_exec_quorum_reconfigure ( ++ void *message, ++ unsigned int nodeid); ++ ++static void message_handler_req_exec_quorum_killnode ( ++ void *message, ++ unsigned int nodeid); ++ ++ ++static void message_handler_req_lib_votequorum_getinfo (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_setexpected (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_setvotes (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_qdisk_register (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_qdisk_poll (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_setstate (void *conn, void *message); ++ ++static void message_handler_req_lib_votequorum_leaving (void *conn, void *message); ++static void message_handler_req_lib_votequorum_trackstart (void *conn, void *msg); ++static void message_handler_req_lib_votequorum_trackstop (void *conn, void *msg); ++ ++static int quorum_exec_send_nodeinfo(void); ++static int quorum_exec_send_reconfigure(int param, int nodeid, int value); ++static int quorum_exec_send_killnode(int nodeid, unsigned int reason); ++ ++static void add_votequorum_config_notification(unsigned int quorum_object_handle); ++ ++ ++/* ++ * Library Handler Definition ++ */ ++static struct corosync_lib_handler quorum_lib_service[] = ++{ ++ { /* 0 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_getinfo, ++ .response_size = sizeof (struct res_lib_votequorum_getinfo), ++ .response_id = MESSAGE_RES_VOTEQUORUM_GETINFO, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 1 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_setexpected, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 2 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_setvotes, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 3 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_register, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 4 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_unregister, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 5 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_poll, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 6 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_getinfo, ++ .response_size = sizeof (struct res_lib_votequorum_qdisk_getinfo), ++ .response_id = MESSAGE_RES_VOTEQUORUM_QDISK_GETINFO, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 7 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_setstate, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 8 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_leaving, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 9 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_trackstart, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ }, ++ { /* 10 */ ++ .lib_handler_fn = message_handler_req_lib_votequorum_trackstop, ++ .response_size = sizeof (struct res_lib_votequorum_status), ++ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED ++ } ++}; ++ ++static quorum_set_quorate_fn_t set_quorum; ++/* ++ * lcrso object definition ++ */ ++static struct quorum_services_api_ver1 votequorum_iface_ver0 = { ++ .init = votequorum_init ++}; ++ ++static struct corosync_service_engine quorum_service_handler = { ++ .name = "corosync votes quorum service v0.90", ++ .id = VOTEQUORUM_SERVICE, ++ .private_data_size = sizeof (struct quorum_pd), ++ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, ++ .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED, ++ .lib_init_fn = quorum_lib_init_fn, ++ .lib_exit_fn = quorum_lib_exit_fn, ++ .lib_engine = quorum_lib_service, ++ .lib_engine_count = sizeof (quorum_lib_service) / sizeof (struct corosync_lib_handler), ++ .exec_init_fn = votequorum_exec_init_fn, ++ .exec_engine = NULL, ++ .exec_engine_count = 0, ++ .confchg_fn = NULL, ++}; ++ ++/* ++ * Dynamic loader definition ++ */ ++static struct corosync_service_engine *quorum_get_service_handler_ver0 (void); ++ ++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 ++}; ++ ++ ++static struct corosync_service_engine *quorum_get_service_handler_ver0 (void) ++{ ++ return (&quorum_service_handler); ++} ++ ++__attribute__ ((constructor)) static void quorum_comp_register (void) { ++ 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); ++} ++ ++static void votequorum_init(struct corosync_api_v1 *api, ++ quorum_set_quorate_fn_t report) ++{ ++ ENTER(); ++ set_quorum = report; ++ ++ /* Load the library-servicing part of this module */ ++ api->service_link_and_init(api, "corosync_votequorum_iface", 0); ++ ++ LEAVE(); ++} ++ ++/* Message types */ ++#define VOTEQUORUM_MSG_NODEINFO 5 ++#define VOTEQUORUM_MSG_KILLNODE 6 ++#define VOTEQUORUM_MSG_RECONFIGURE 8 ++ ++struct req_exec_quorum_nodeinfo { ++ unsigned char cmd; ++ unsigned char first_trans; ++ unsigned int votes; ++ unsigned int expected_votes; ++ ++ unsigned int major_version; /* Not backwards compatible */ ++ unsigned int minor_version; /* Backwards compatible */ ++ unsigned int patch_version; /* Backwards/forwards compatible */ ++ unsigned int config_version; ++ unsigned int flags; ++ ++} __attribute__((packed)); ++ ++/* Parameters for RECONFIG command */ ++#define RECONFIG_PARAM_EXPECTED_VOTES 1 ++#define RECONFIG_PARAM_NODE_VOTES 2 ++#define RECONFIG_PARAM_LEAVING 3 ++ ++struct req_exec_quorum_reconfigure { ++ unsigned char cmd; ++ unsigned char param; ++ unsigned short pad; ++ int nodeid; ++ unsigned int value; ++}; ++ ++struct req_exec_quorum_killnode { ++ unsigned char cmd; ++ unsigned char pad1; ++ uint16_t reason; ++ int nodeid; ++}; ++ ++/* These just make the access a little neater */ ++static inline int objdb_get_string(struct corosync_api_v1 *corosync, unsigned int object_service_handle, ++ char *key, char **value) ++{ ++ int res; ++ ++ *value = NULL; ++ if ( !(res = corosync_api->object_key_get(object_service_handle, ++ key, ++ strlen(key), ++ (void *)value, ++ NULL))) { ++ if (*value) ++ return 0; ++ } ++ return -1; ++} ++ ++static inline void objdb_get_int(struct corosync_api_v1 *corosync, unsigned int object_service_handle, ++ char *key, unsigned int *intvalue, unsigned int default_value) ++{ ++ char *value = NULL; ++ ++ *intvalue = default_value; ++ ++ if (!corosync_api->object_key_get(object_service_handle, key, strlen(key), ++ (void *)&value, NULL)) { ++ if (value) { ++ *intvalue = atoi(value); ++ } ++ } ++} ++ ++static int votequorum_send_message(void *message, int len) ++{ ++ struct iovec iov[2]; ++ struct q_protheader header; ++ ++ header.tgtport = 0; ++ header.srcport = 0; ++ header.flags = 0; ++ header.srcid = us->node_id; ++ header.tgtid = 0; ++ ++ iov[0].iov_base = &header; ++ iov[0].iov_len = sizeof(header); ++ iov[1].iov_base = message; ++ iov[1].iov_len = len; ++ ++ return corosync_api->tpg_joined_mcast(group_handle, iov, 2, TOTEM_AGREED); ++} ++ ++static void read_quorum_config(unsigned int quorum_handle) ++{ ++ unsigned int value = 0; ++ int cluster_members = 0; ++ struct list_head *tmp; ++ struct cluster_node *node; ++ ++ log_printf(LOG_INFO, "Reading configuration\n"); ++ ++ objdb_get_int(corosync_api, quorum_handle, "expected_votes", &us->expected_votes, DEFAULT_EXPECTED); ++ objdb_get_int(corosync_api, quorum_handle, "votes", &us->votes, 1); ++ objdb_get_int(corosync_api, quorum_handle, "quorumdev_poll", &quorumdev_poll, DEFAULT_QDEV_POLL); ++ objdb_get_int(corosync_api, quorum_handle, "disallowed", &value, 0); ++ if (value) ++ quorum_flags |= VOTEQUORUM_FLAG_FEATURE_DISALLOWED; ++ else ++ quorum_flags &= ~VOTEQUORUM_FLAG_FEATURE_DISALLOWED; ++ ++ objdb_get_int(corosync_api, quorum_handle, "two_node", &value, 0); ++ if (value) ++ quorum_flags |= VOTEQUORUM_FLAG_FEATURE_TWONODE; ++ else ++ quorum_flags &= ~VOTEQUORUM_FLAG_FEATURE_TWONODE; ++ ++ /* ++ * two_node mode is invalid if there are more than 2 nodes in the cluster! ++ */ ++ list_iterate(tmp, &cluster_members_list) { ++ node = list_entry(tmp, struct cluster_node, list); ++ cluster_members++; ++ } ++ ++ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_TWONODE && cluster_members > 2) { ++ log_printf(LOG_WARNING, "quorum.two_node was set but there are more than 2 nodes in the cluster. It will be ignored."); ++ quorum_flags &= ~VOTEQUORUM_FLAG_FEATURE_TWONODE; ++ } ++} ++ ++static int votequorum_exec_init_fn (struct corosync_api_v1 *api) ++{ ++ unsigned int object_handle; ++ unsigned int find_handle; ++ ++ ENTER(); ++ ++ corosync_api = api; ++ ++ list_init(&cluster_members_list); ++ list_init(&trackers_list); ++ ++ /* Allocate a cluster_node for us */ ++ us = allocate_node(corosync_api->totem_nodeid_get()); ++ if (!us) ++ return (1); ++ ++ us->flags |= NODE_FLAGS_US; ++ us->state = NODESTATE_MEMBER; ++ us->expected_votes = DEFAULT_EXPECTED; ++ us->votes = 1; ++ time(&us->join_time); ++ ++ /* Get configuration variables */ ++ corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); ++ ++ if (corosync_api->object_find_next(find_handle, &object_handle) == 0) { ++ read_quorum_config(object_handle); ++ } ++ /* Listen for changes */ ++ add_votequorum_config_notification(object_handle); ++ corosync_api->object_find_destroy(find_handle); ++ ++ api->tpg_init(&group_handle, quorum_deliver_fn, quorum_confchg_fn); ++ api->tpg_join(group_handle, quorum_group, 1); ++ ++ LEAVE(); ++ return (0); ++} ++ ++static int quorum_lib_exit_fn (void *conn) ++{ ++ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ ++ ENTER(); ++ if (quorum_pd->tracking_enabled) { ++ list_del (&quorum_pd->list); ++ list_init (&quorum_pd->list); ++ } ++ LEAVE(); ++ return (0); ++} ++ ++ ++static int send_quorum_notification(void *conn, uint64_t context) ++{ ++ struct res_lib_votequorum_notification *res_lib_votequorum_notification; ++ struct list_head *tmp; ++ struct cluster_node *node; ++ int cluster_members = 0; ++ int i = 0; ++ int size; ++ char *buf; ++ ++ ENTER(); ++ list_iterate(tmp, &cluster_members_list) { ++ node = list_entry(tmp, struct cluster_node, list); ++ cluster_members++; ++ } ++ if (quorum_device) ++ cluster_members++; ++ ++ size = sizeof(struct res_lib_votequorum_notification) + sizeof(struct votequorum_node) * cluster_members; ++ buf = alloca(size); ++ if (!buf) { ++ LEAVE(); ++ return -1; ++ } ++ ++ res_lib_votequorum_notification = (struct res_lib_votequorum_notification *)buf; ++ res_lib_votequorum_notification->quorate = cluster_is_quorate; ++ res_lib_votequorum_notification->node_list_entries = cluster_members; ++ res_lib_votequorum_notification->context = context; ++ list_iterate(tmp, &cluster_members_list) { ++ node = list_entry(tmp, struct cluster_node, list); ++ res_lib_votequorum_notification->node_list[i].nodeid = node->node_id; ++ res_lib_votequorum_notification->node_list[i++].state = node->state; ++ } ++ if (quorum_device) { ++ res_lib_votequorum_notification->node_list[i].nodeid = 0; ++ res_lib_votequorum_notification->node_list[i++].state = quorum_device->state | 0x80; ++ } ++ res_lib_votequorum_notification->header.id = MESSAGE_RES_VOTEQUORUM_NOTIFICATION; ++ res_lib_votequorum_notification->header.size = size; ++ res_lib_votequorum_notification->header.error = CS_OK; ++ ++ /* Send it to all interested parties */ ++ if (conn) { ++ int ret = corosync_api->ipc_conn_send_response(conn, buf, size); ++ LEAVE(); ++ return ret; ++ } ++ else { ++ struct quorum_pd *qpd; ++ ++ list_iterate(tmp, &trackers_list) { ++ qpd = list_entry(tmp, struct quorum_pd, list); ++ res_lib_votequorum_notification->context = qpd->tracking_context; ++ corosync_api->ipc_conn_send_response(corosync_api->ipc_conn_partner_get(qpd->conn), buf, size); ++ } ++ } ++ LEAVE(); ++ return 0; ++} ++ ++static void set_quorate(int total_votes) ++{ ++ int quorate; ++ ++ ENTER(); ++ if (quorum > total_votes) { ++ quorate = 0; ++ } ++ else { ++ quorate = 1; ++ } ++ ++ if (cluster_is_quorate && !quorate) ++ log_printf(LOG_INFO, "quorum lost, blocking activity\n"); ++ if (!cluster_is_quorate && quorate) ++ log_printf(LOG_INFO, "quorum regained, resuming activity\n"); ++ ++ /* If we are newly quorate, then kill any DISALLOWED nodes */ ++ if (!cluster_is_quorate && quorate) { ++ struct cluster_node *node = NULL; ++ struct list_head *tmp; ++ ++ list_iterate(tmp, &cluster_members_list) { ++ node = list_entry(tmp, struct cluster_node, list); ++ if (node->state == NODESTATE_DISALLOWED) ++ quorum_exec_send_killnode(node->node_id, VOTEQUORUM_REASON_KILL_REJOIN); ++ } ++ } ++ ++ cluster_is_quorate = quorate; ++ set_quorum(quorum_members, quorum_members_entries, quorate, &quorum_ringid); ++ ENTER(); ++} ++ ++static int calculate_quorum(int allow_decrease, int max_expected, unsigned int *ret_total_votes) ++{ ++ struct list_head *nodelist; ++ struct cluster_node *node; ++ unsigned int total_votes = 0; ++ unsigned int highest_expected = 0; ++ unsigned int newquorum, q1, q2; ++ unsigned int total_nodes = 0; ++ unsigned int leaving = 0; ++ ++ ENTER(); ++ list_iterate(nodelist, &cluster_members_list) { ++ node = list_entry(nodelist, struct cluster_node, list); ++ ++ log_printf(LOG_DEBUG, "node %x state=%d, votes=%d, expected=%d\n", ++ node->node_id, node->state, node->votes, node->expected_votes); ++ ++ if (node->state == NODESTATE_MEMBER) { ++ if (max_expected) ++ node->expected_votes = max_expected; ++ else ++ highest_expected = max(highest_expected, node->expected_votes); ++ total_votes += node->votes; ++ total_nodes++; ++ } ++ if (node->state == NODESTATE_LEAVING) { ++ leaving = 1; ++ } ++ } ++ ++ if (quorum_device && quorum_device->state == NODESTATE_MEMBER) ++ total_votes += quorum_device->votes; ++ ++ if (max_expected > 0) ++ highest_expected = max_expected; ++ ++ /* This quorum calculation is taken from the OpenVMS Cluster Systems ++ * manual, but, then, you guessed that didn't you */ ++ q1 = (highest_expected + 2) / 2; ++ q2 = (total_votes + 2) / 2; ++ newquorum = max(q1, q2); ++ ++ /* Normally quorum never decreases but the system administrator can ++ * force it down by setting expected votes to a maximum value */ ++ if (!allow_decrease) ++ newquorum = max(quorum, newquorum); ++ ++ /* The special two_node mode allows each of the two nodes to retain ++ * quorum if the other fails. Only one of the two should live past ++ * fencing (as both nodes try to fence each other in split-brain.) ++ * Also: if there are more than two nodes, force us inquorate to avoid ++ * any damage or confusion. ++ */ ++ if ((quorum_flags & VOTEQUORUM_FLAG_FEATURE_TWONODE) && total_nodes <= 2) ++ newquorum = 1; ++ ++ if (ret_total_votes) ++ *ret_total_votes = total_votes; ++ ++ LEAVE(); ++ return newquorum; ++} ++ ++/* Recalculate cluster quorum, set quorate and notify changes */ ++static void recalculate_quorum(int allow_decrease) ++{ ++ unsigned int total_votes; ++ ++ ENTER(); ++ quorum = calculate_quorum(allow_decrease, 0, &total_votes); ++ set_quorate(total_votes); ++ send_quorum_notification(NULL, 0L); ++ LEAVE(); ++} ++ ++static int have_disallowed(void) ++{ ++ struct cluster_node *node; ++ struct list_head *tmp; ++ ++ list_iterate(tmp, &cluster_members_list) { ++ node = list_entry(tmp, struct cluster_node, list); ++ if (node->state == NODESTATE_DISALLOWED) ++ return 1; ++ } ++ ++ return 0; ++} ++ ++static void node_add_ordered(struct cluster_node *newnode) ++{ ++ struct cluster_node *node = NULL; ++ struct list_head *tmp; ++ struct list_head *newlist = &newnode->list; ++ ++ list_iterate(tmp, &cluster_members_list) { ++ node = list_entry(tmp, struct cluster_node, list); ++ ++ if (newnode->node_id < node->node_id) ++ break; ++ } ++ ++ if (!node) ++ list_add(&newnode->list, &cluster_members_list); ++ else { ++ newlist->prev = tmp->prev; ++ newlist->next = tmp; ++ tmp->prev->next = newlist; ++ tmp->prev = newlist; ++ } ++} ++ ++static struct cluster_node *allocate_node(int nodeid) ++{ ++ struct cluster_node *cl; ++ ++ cl = malloc(sizeof(struct cluster_node)); ++ if (cl) { ++ memset(cl, 0, sizeof(struct cluster_node)); ++ cl->node_id = nodeid; ++ if (nodeid) ++ node_add_ordered(cl); ++ } ++ return cl; ++} ++ ++static struct cluster_node *find_node_by_nodeid(int nodeid) ++{ ++ struct cluster_node *node; ++ struct list_head *tmp; ++ ++ list_iterate(tmp, &cluster_members_list) { ++ node = list_entry(tmp, struct cluster_node, list); ++ if (node->node_id == nodeid) ++ return node; ++ } ++ return NULL; ++} ++ ++ ++static int quorum_exec_send_nodeinfo() ++{ ++ struct req_exec_quorum_nodeinfo req_exec_quorum_nodeinfo; ++ int ret; ++ ++ ENTER(); ++ ++ req_exec_quorum_nodeinfo.cmd = VOTEQUORUM_MSG_NODEINFO; ++ req_exec_quorum_nodeinfo.expected_votes = us->expected_votes; ++ req_exec_quorum_nodeinfo.votes = us->votes; ++ req_exec_quorum_nodeinfo.major_version = VOTEQUORUM_MAJOR_VERSION; ++ req_exec_quorum_nodeinfo.minor_version = VOTEQUORUM_MINOR_VERSION; ++ req_exec_quorum_nodeinfo.patch_version = VOTEQUORUM_PATCH_VERSION; ++ req_exec_quorum_nodeinfo.flags = us->flags; ++ req_exec_quorum_nodeinfo.first_trans = first_trans; ++ if (have_disallowed()) ++ req_exec_quorum_nodeinfo.flags |= NODE_FLAGS_SEESDISALLOWED; ++ ++ ret = votequorum_send_message(&req_exec_quorum_nodeinfo, sizeof(req_exec_quorum_nodeinfo)); ++ LEAVE(); ++ return ret; ++} ++ ++ ++static int quorum_exec_send_reconfigure(int param, int nodeid, int value) ++{ ++ struct req_exec_quorum_reconfigure req_exec_quorum_reconfigure; ++ int ret; ++ ++ ENTER(); ++ ++ req_exec_quorum_reconfigure.cmd = VOTEQUORUM_MSG_RECONFIGURE; ++ req_exec_quorum_reconfigure.param = param; ++ req_exec_quorum_reconfigure.nodeid = nodeid; ++ req_exec_quorum_reconfigure.value = value; ++ ++ ret = votequorum_send_message(&req_exec_quorum_reconfigure, sizeof(req_exec_quorum_reconfigure)); ++ LEAVE(); ++ return ret; ++} ++ ++static int quorum_exec_send_killnode(int nodeid, unsigned int reason) ++{ ++ struct req_exec_quorum_killnode req_exec_quorum_killnode; ++ int ret; ++ ++ ENTER(); ++ ++ req_exec_quorum_killnode.cmd = VOTEQUORUM_MSG_KILLNODE; ++ req_exec_quorum_killnode.nodeid = nodeid; ++ req_exec_quorum_killnode.reason = reason; ++ ++ ret = votequorum_send_message(&req_exec_quorum_killnode, sizeof(req_exec_quorum_killnode)); ++ LEAVE(); ++ return ret; ++} ++ ++static void quorum_confchg_fn ( ++ enum totem_configuration_type configuration_type, ++ unsigned int *member_list, int member_list_entries, ++ unsigned int *left_list, int left_list_entries, ++ unsigned int *joined_list, int joined_list_entries, ++ struct memb_ring_id *ring_id) ++{ ++ int i; ++ int leaving = 0; ++ struct cluster_node *node; ++ ++ ENTER(); ++ if (member_list_entries > 1) ++ first_trans = 0; ++ ++ if (left_list_entries) { ++ for (i = 0; i< left_list_entries; i++) { ++ node = find_node_by_nodeid(left_list[i]); ++ if (node) { ++ if (node->state == NODESTATE_LEAVING) ++ leaving = 1; ++ node->state = NODESTATE_DEAD; ++ node->flags |= NODE_FLAGS_BEENDOWN; ++ } ++ } ++ recalculate_quorum(leaving); ++ } ++ ++ if (member_list_entries) { ++ memcpy(quorum_members, member_list, sizeof(unsigned int) * member_list_entries); ++ quorum_members_entries = member_list_entries; ++ if (quorum_device) { ++ quorum_members[quorum_members_entries++] = 0; ++ } ++ quorum_exec_send_nodeinfo(); ++ } ++ ++ memcpy(&quorum_ringid, ring_id, sizeof(*ring_id)); ++ LEAVE(); ++} ++ ++static void exec_quorum_nodeinfo_endian_convert (void *msg) ++{ ++ struct req_exec_quorum_nodeinfo *nodeinfo = (struct req_exec_quorum_nodeinfo *)msg; ++ ++ nodeinfo->votes = swab32(nodeinfo->votes); ++ nodeinfo->expected_votes = swab32(nodeinfo->expected_votes); ++ nodeinfo->major_version = swab32(nodeinfo->major_version); ++ nodeinfo->minor_version = swab32(nodeinfo->minor_version); ++ nodeinfo->patch_version = swab32(nodeinfo->patch_version); ++ nodeinfo->config_version = swab32(nodeinfo->config_version); ++ nodeinfo->flags = swab32(nodeinfo->flags); ++} ++ ++static void exec_quorum_reconfigure_endian_convert (void *msg) ++{ ++ struct req_exec_quorum_reconfigure *reconfigure = (struct req_exec_quorum_reconfigure *)msg; ++ reconfigure->nodeid = swab32(reconfigure->nodeid); ++ reconfigure->value = swab32(reconfigure->value); ++} ++ ++static void exec_quorum_killnode_endian_convert (void *msg) ++{ ++ struct req_exec_quorum_killnode *killnode = (struct req_exec_quorum_killnode *)msg; ++ killnode->reason = swab16(killnode->reason); ++ killnode->nodeid = swab32(killnode->nodeid); ++} ++ ++static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len, ++ int endian_conversion_required) ++{ ++ struct q_protheader *header = iovec->iov_base; ++ char *buf; ++ ++ ENTER(); ++ ++ if (endian_conversion_required) { ++ header->srcid = swab32(header->srcid); ++ header->tgtid = swab32(header->tgtid); ++ header->flags = swab32(header->flags); ++ } ++ ++ /* Only pass on messages for us or everyone */ ++ if (header->tgtport == 0 && ++ (header->tgtid == us->node_id || ++ header->tgtid == 0)) { ++ buf = iovec->iov_base + sizeof(struct q_protheader); ++ switch (*buf) { ++ ++ case VOTEQUORUM_MSG_NODEINFO: ++ if (endian_conversion_required) ++ exec_quorum_nodeinfo_endian_convert(buf); ++ message_handler_req_exec_quorum_nodeinfo (buf, header->srcid); ++ break; ++ case VOTEQUORUM_MSG_RECONFIGURE: ++ if (endian_conversion_required) ++ exec_quorum_reconfigure_endian_convert(buf); ++ message_handler_req_exec_quorum_reconfigure (buf, header->srcid); ++ break; ++ case VOTEQUORUM_MSG_KILLNODE: ++ if (endian_conversion_required) ++ exec_quorum_killnode_endian_convert(buf); ++ message_handler_req_exec_quorum_killnode (buf, header->srcid); ++ break; ++ ++ /* Just ignore other messages */ ++ } ++ } ++ LEAVE(); ++} ++ ++static void message_handler_req_exec_quorum_nodeinfo ( ++ void *message, ++ unsigned int nodeid) ++{ ++ struct req_exec_quorum_nodeinfo *req_exec_quorum_nodeinfo = (struct req_exec_quorum_nodeinfo *)message; ++ struct cluster_node *node; ++ int old_votes; ++ int old_expected; ++ nodestate_t old_state; ++ int new_node = 0; ++ ++ ENTER(); ++ log_printf(LOG_LEVEL_DEBUG, "got nodeinfo message from cluster node %d\n", nodeid); ++ ++ node = find_node_by_nodeid(nodeid); ++ if (!node) { ++ node = allocate_node(nodeid); ++ new_node = 1; ++ } ++ if (!node) { ++ corosync_api->error_memory_failure(); ++ return; ++ } ++ ++ /* ++ * If the node sending the message sees disallowed nodes and we don't, then ++ * we have to leave ++ */ ++ if (req_exec_quorum_nodeinfo->flags & NODE_FLAGS_SEESDISALLOWED && !have_disallowed()) { ++ /* Must use syslog directly here or the message will never arrive */ ++ syslog(LOG_CRIT, "[VOTEQ]: Joined a cluster with disallowed nodes. must die"); ++ corosync_api->fatal_error(2, __FILE__, __LINE__); ++ exit(2); ++ } ++ old_votes = node->votes; ++ old_expected = node->expected_votes; ++ old_state = node->state; ++ ++ /* Update node state */ ++ if (req_exec_quorum_nodeinfo->minor_version >= 2) ++ node->votes = req_exec_quorum_nodeinfo->votes; ++ node->expected_votes = req_exec_quorum_nodeinfo->expected_votes; ++ node->state = NODESTATE_MEMBER; ++ ++ /* Check flags for disallowed (if enabled) */ ++ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_DISALLOWED) { ++ if ((req_exec_quorum_nodeinfo->flags & NODE_FLAGS_HASSTATE && node->flags & NODE_FLAGS_BEENDOWN) || ++ (req_exec_quorum_nodeinfo->flags & NODE_FLAGS_HASSTATE && req_exec_quorum_nodeinfo->first_trans && !(node->flags & NODE_FLAGS_US))) { ++ if (node->state != NODESTATE_DISALLOWED) { ++ if (cluster_is_quorate) { ++ log_printf(LOG_CRIT, "Killing node %d because it has rejoined the cluster with existing state", node->node_id); ++ node->state = NODESTATE_DISALLOWED; ++ quorum_exec_send_killnode(nodeid, VOTEQUORUM_REASON_KILL_REJOIN); ++ } ++ else { ++ log_printf(LOG_CRIT, "Node %d not joined to quorum because it has existing state", node->node_id); ++ node->state = NODESTATE_DISALLOWED; ++ } ++ } ++ } ++ } ++ node->flags &= ~NODE_FLAGS_BEENDOWN; ++ ++ if (new_node || old_votes != node->votes || old_expected != node->expected_votes || old_state != node->state) ++ recalculate_quorum(0); ++ LEAVE(); ++} ++ ++static void message_handler_req_exec_quorum_killnode ( ++ void *message, ++ unsigned int nodeid) ++{ ++ struct req_exec_quorum_killnode *req_exec_quorum_killnode = (struct req_exec_quorum_killnode *)message; ++ ++ if (req_exec_quorum_killnode->nodeid == corosync_api->totem_nodeid_get()) { ++ log_printf(LOG_CRIT, "Killed by node %d: %s\n", nodeid, kill_reason(req_exec_quorum_killnode->reason)); ++ ++ corosync_api->fatal_error(1, __FILE__, __LINE__); ++ exit(1); ++ } ++} ++ ++static void message_handler_req_exec_quorum_reconfigure ( ++ void *message, ++ unsigned int nodeid) ++{ ++ struct req_exec_quorum_reconfigure *req_exec_quorum_reconfigure = (struct req_exec_quorum_reconfigure *)message; ++ struct cluster_node *node; ++ struct list_head *nodelist; ++ ++ log_printf(LOG_LEVEL_DEBUG, "got reconfigure message from cluster node %d\n", nodeid); ++ ++ node = find_node_by_nodeid(req_exec_quorum_reconfigure->nodeid); ++ if (!node) ++ return; ++ ++ switch(req_exec_quorum_reconfigure->param) ++ { ++ case RECONFIG_PARAM_EXPECTED_VOTES: ++ node->expected_votes = req_exec_quorum_reconfigure->value; ++ ++ list_iterate(nodelist, &cluster_members_list) { ++ node = list_entry(nodelist, struct cluster_node, list); ++ if (node->state == NODESTATE_MEMBER && ++ node->expected_votes > req_exec_quorum_reconfigure->value) { ++ node->expected_votes = req_exec_quorum_reconfigure->value; ++ } ++ } ++ recalculate_quorum(1); /* Allow decrease */ ++ break; ++ ++ case RECONFIG_PARAM_NODE_VOTES: ++ node->votes = req_exec_quorum_reconfigure->value; ++ recalculate_quorum(1); /* Allow decrease */ ++ break; ++ ++ case RECONFIG_PARAM_LEAVING: ++ node->state = NODESTATE_LEAVING; ++ break; ++ } ++} ++ ++static int quorum_lib_init_fn (void *conn) ++{ ++ struct quorum_pd *pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ ++ ENTER(); ++ ++ list_init (&pd->list); ++ pd->conn = conn; ++ ++ LEAVE(); ++ return (0); ++} ++ ++/* Message from the library */ ++static void message_handler_req_lib_votequorum_getinfo (void *conn, void *message) ++{ ++ struct req_lib_votequorum_getinfo *req_lib_votequorum_getinfo = (struct req_lib_votequorum_getinfo *)message; ++ struct res_lib_votequorum_getinfo res_lib_votequorum_getinfo; ++ struct cluster_node *node; ++ unsigned int highest_expected = 0; ++ unsigned int total_votes = 0; ++ cs_error_t error = CS_OK; ++ ++ log_printf(LOG_LEVEL_DEBUG, "got getinfo request on %p for node %d\n", conn, req_lib_votequorum_getinfo->nodeid); ++ ++ if (req_lib_votequorum_getinfo->nodeid) { ++ node = find_node_by_nodeid(req_lib_votequorum_getinfo->nodeid); ++ } ++ else { ++ node = us; ++ } ++ ++ if (node) { ++ struct cluster_node *iternode; ++ struct list_head *nodelist; ++ ++ list_iterate(nodelist, &cluster_members_list) { ++ iternode = list_entry(nodelist, struct cluster_node, list); ++ ++ if (node->state == NODESTATE_MEMBER) { ++ highest_expected = ++ max(highest_expected, node->expected_votes); ++ total_votes += node->votes; ++ } ++ } ++ ++ if (quorum_device && quorum_device->state == NODESTATE_MEMBER) { ++ total_votes += quorum_device->votes; ++ } ++ ++ res_lib_votequorum_getinfo.votes = us->votes; ++ res_lib_votequorum_getinfo.expected_votes = us->expected_votes; ++ res_lib_votequorum_getinfo.highest_expected = highest_expected; ++ ++ res_lib_votequorum_getinfo.quorum = quorum; ++ res_lib_votequorum_getinfo.total_votes = total_votes; ++ res_lib_votequorum_getinfo.flags = 0; ++ res_lib_votequorum_getinfo.nodeid = node->node_id; ++ ++ if (us->flags & NODE_FLAGS_HASSTATE) ++ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_HASSTATE; ++ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_TWONODE) ++ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_TWONODE; ++ if (cluster_is_quorate) ++ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_QUORATE; ++ if (us->flags & NODE_FLAGS_SEESDISALLOWED) ++ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_DISALLOWED; ++ } ++ else { ++ error = CS_ERR_NOT_EXIST; ++ } ++ ++ res_lib_votequorum_getinfo.header.size = sizeof(res_lib_votequorum_getinfo); ++ res_lib_votequorum_getinfo.header.id = MESSAGE_RES_VOTEQUORUM_GETINFO; ++ res_lib_votequorum_getinfo.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_getinfo, sizeof(res_lib_votequorum_getinfo)); ++ log_printf(LOG_LEVEL_DEBUG, "getinfo response error: %d\n", error); ++} ++ ++/* Message from the library */ ++static void message_handler_req_lib_votequorum_setexpected (void *conn, void *message) ++{ ++ struct req_lib_votequorum_setexpected *req_lib_votequorum_setexpected = (struct req_lib_votequorum_setexpected *)message; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ cs_error_t error = CS_OK; ++ unsigned int newquorum; ++ unsigned int total_votes; ++ ++ ENTER(); ++ ++ /* ++ * If there are disallowed nodes, then we can't allow the user ++ * to bypass them by fiddling with expected votes. ++ */ ++ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_DISALLOWED && have_disallowed()) { ++ error = CS_ERR_EXIST; ++ goto error_exit; ++ } ++ ++ /* Validate new expected votes */ ++ newquorum = calculate_quorum(1, req_lib_votequorum_setexpected->expected_votes, &total_votes); ++ if (newquorum < total_votes / 2 ++ || newquorum > total_votes) { ++ error = CS_ERR_INVALID_PARAM; ++ goto error_exit; ++ } ++ ++ quorum_exec_send_reconfigure(RECONFIG_PARAM_EXPECTED_VOTES, us->node_id, req_lib_votequorum_setexpected->expected_votes); ++ ++ /* send status */ ++error_exit: ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ LEAVE(); ++} ++ ++/* Message from the library */ ++static void message_handler_req_lib_votequorum_setvotes (void *conn, void *message) ++{ ++ struct req_lib_votequorum_setvotes *req_lib_votequorum_setvotes = (struct req_lib_votequorum_setvotes *)message; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ struct cluster_node *node; ++ unsigned int newquorum; ++ unsigned int total_votes; ++ unsigned int saved_votes; ++ cs_error_t error = CS_OK; ++ ++ ENTER(); ++ ++ node = find_node_by_nodeid(req_lib_votequorum_setvotes->nodeid); ++ if (!node) { ++ error = CS_ERR_NAME_NOT_FOUND; ++ goto error_exit; ++ } ++ ++ /* Check votes is valid */ ++ saved_votes = node->votes; ++ node->votes = req_lib_votequorum_setvotes->votes; ++ ++ newquorum = calculate_quorum(1, 0, &total_votes); ++ ++ if (newquorum < total_votes / 2 || newquorum > total_votes) { ++ node->votes = saved_votes; ++ error = CS_ERR_INVALID_PARAM; ++ goto error_exit; ++ } ++ ++ if (!req_lib_votequorum_setvotes->nodeid) ++ req_lib_votequorum_setvotes->nodeid = corosync_api->totem_nodeid_get(); ++ ++ quorum_exec_send_reconfigure(RECONFIG_PARAM_NODE_VOTES, req_lib_votequorum_setvotes->nodeid, req_lib_votequorum_setvotes->votes); ++ ++error_exit: ++ /* send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_votequorum_leaving (void *conn, void *message) ++{ ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ cs_error_t error = CS_OK; ++ ++ ENTER(); ++ ++ quorum_exec_send_reconfigure(RECONFIG_PARAM_LEAVING, us->node_id, 0); ++ ++ /* send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ LEAVE(); ++} ++ ++static void quorum_device_timer_fn(void *arg) ++{ ++ struct timeval now; ++ ++ ENTER(); ++ if (!quorum_device || quorum_device->state == NODESTATE_DEAD) ++ return; ++ gettimeofday(&now, NULL); ++ if (quorum_device->last_hello.tv_sec + quorumdev_poll/1000 < now.tv_sec) { ++ quorum_device->state = NODESTATE_DEAD; ++ log_printf(LOG_INFO, "lost contact with quorum device\n"); ++ recalculate_quorum(0); ++ } ++ else { ++ corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device, ++ quorum_device_timer_fn, &quorum_device_timer); ++ } ++ LEAVE(); ++} ++ ++ ++static void message_handler_req_lib_votequorum_qdisk_register (void *conn, void *message) ++{ ++ struct req_lib_votequorum_qdisk_register *req_lib_votequorum_qdisk_register = (struct req_lib_votequorum_qdisk_register *)message; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ cs_error_t error = CS_OK; ++ ++ ENTER(); ++ ++ if (quorum_device) { ++ error = CS_ERR_EXIST; ++ } ++ else { ++ quorum_device = allocate_node(0); ++ quorum_device->state = NODESTATE_DEAD; ++ quorum_device->votes = req_lib_votequorum_qdisk_register->votes; ++ strcpy(quorum_device_name, req_lib_votequorum_qdisk_register->name); ++ list_add(&quorum_device->list, &cluster_members_list); ++ } ++ ++ /* send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn, void *message) ++{ ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ cs_error_t error = CS_OK; ++ ++ ENTER(); ++ ++ if (quorum_device) { ++ struct cluster_node *node = quorum_device; ++ ++ quorum_device = NULL; ++ list_del(&node->list); ++ free(node); ++ recalculate_quorum(0); ++ } ++ else { ++ error = CS_ERR_NOT_EXIST; ++ } ++ ++ /* send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_votequorum_qdisk_poll (void *conn, void *message) ++{ ++ struct req_lib_votequorum_qdisk_poll *req_lib_votequorum_qdisk_poll = (struct req_lib_votequorum_qdisk_poll *)message; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ cs_error_t error = CS_OK; ++ ++ ENTER(); ++ ++ if (quorum_device) { ++ if (req_lib_votequorum_qdisk_poll->state) { ++ gettimeofday(&quorum_device->last_hello, NULL); ++ if (quorum_device->state == NODESTATE_DEAD) { ++ quorum_device->state = NODESTATE_MEMBER; ++ recalculate_quorum(0); ++ ++ corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device, ++ quorum_device_timer_fn, &quorum_device_timer); ++ } ++ } ++ else { ++ if (quorum_device->state == NODESTATE_MEMBER) { ++ quorum_device->state = NODESTATE_DEAD; ++ recalculate_quorum(0); ++ corosync_api->timer_delete(quorum_device_timer); ++ } ++ } ++ } ++ else { ++ error = CS_ERR_NOT_EXIST; ++ } ++ ++ /* send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, void *message) ++{ ++ struct res_lib_votequorum_qdisk_getinfo res_lib_votequorum_qdisk_getinfo; ++ cs_error_t error = CS_OK; ++ ++ ENTER(); ++ ++ if (quorum_device) { ++ log_printf(LOG_LEVEL_DEBUG, "got qdisk_getinfo state %d\n", quorum_device->state); ++ res_lib_votequorum_qdisk_getinfo.votes = quorum_device->votes; ++ if (quorum_device->state == NODESTATE_MEMBER) ++ res_lib_votequorum_qdisk_getinfo.state = 1; ++ else ++ res_lib_votequorum_qdisk_getinfo.state = 0; ++ strcpy(res_lib_votequorum_qdisk_getinfo.name, quorum_device_name); ++ } ++ else { ++ error = CS_ERR_NOT_EXIST; ++ } ++ ++ /* send status */ ++ res_lib_votequorum_qdisk_getinfo.header.size = sizeof(res_lib_votequorum_qdisk_getinfo); ++ res_lib_votequorum_qdisk_getinfo.header.id = MESSAGE_RES_VOTEQUORUM_GETINFO; ++ res_lib_votequorum_qdisk_getinfo.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_qdisk_getinfo, sizeof(res_lib_votequorum_qdisk_getinfo)); ++ ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_votequorum_setstate (void *conn, void *message) ++{ ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ cs_error_t error = CS_OK; ++ ++ ENTER(); ++ ++ us->flags |= NODE_FLAGS_HASSTATE; ++ ++ /* send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_votequorum_trackstart (void *conn, void *msg) ++{ ++ struct req_lib_votequorum_trackstart *req_lib_votequorum_trackstart = (struct req_lib_votequorum_trackstart *)msg; ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ ++ ENTER(); ++ /* ++ * If an immediate listing of the current cluster membership ++ * is requested, generate membership list ++ */ ++ if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CURRENT || ++ req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES) { ++ log_printf(LOG_LEVEL_DEBUG, "sending initial status to %p\n", conn); ++ send_quorum_notification(corosync_api->ipc_conn_partner_get (conn), req_lib_votequorum_trackstart->context); ++ } ++ ++ /* ++ * Record requests for tracking ++ */ ++ if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES || ++ req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES_ONLY) { ++ ++ quorum_pd->track_flags = req_lib_votequorum_trackstart->track_flags; ++ quorum_pd->tracking_enabled = 1; ++ quorum_pd->tracking_context = req_lib_votequorum_trackstart->context; ++ ++ list_add (&quorum_pd->list, &trackers_list); ++ } ++ ++ /* Send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = CS_OK; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ ++ LEAVE(); ++} ++ ++static void message_handler_req_lib_votequorum_trackstop (void *conn, void *msg) ++{ ++ struct res_lib_votequorum_status res_lib_votequorum_status; ++ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); ++ int error = CS_OK; ++ ++ ENTER(); ++ ++ if (quorum_pd->tracking_enabled) { ++ error = CS_OK; ++ quorum_pd->tracking_enabled = 0; ++ list_del (&quorum_pd->list); ++ list_init (&quorum_pd->list); ++ } else { ++ error = CS_ERR_NOT_EXIST; ++ } ++ ++ /* send status */ ++ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); ++ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; ++ res_lib_votequorum_status.header.error = error; ++ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); ++ ++ LEAVE(); ++} ++ ++ ++static char *kill_reason(int reason) ++{ ++ static char msg[1024]; ++ ++ switch (reason) ++ { ++ case VOTEQUORUM_REASON_KILL_REJECTED: ++ return "our membership application was rejected"; ++ ++ case VOTEQUORUM_REASON_KILL_APPLICATION: ++ return "we were killed by an application request"; ++ ++ case VOTEQUORUM_REASON_KILL_REJOIN: ++ return "we rejoined the cluster without a full restart"; ++ ++ default: ++ sprintf(msg, "we got kill message number %d", reason); ++ return msg; ++ } ++} ++ ++static void reread_config(unsigned int object_handle) ++{ ++ unsigned int old_votes; ++ unsigned int old_expected; ++ ++ old_votes = us->votes; ++ old_expected = us->expected_votes; ++ ++ /* ++ * Reload the configuration ++ */ ++ read_quorum_config(object_handle); ++ ++ /* ++ * Check for fundamental changes that we need to propogate ++ */ ++ if (old_votes != us->votes) { ++ quorum_exec_send_reconfigure(RECONFIG_PARAM_NODE_VOTES, us->node_id, us->votes); ++ } ++ if (old_expected != us->expected_votes) { ++ quorum_exec_send_reconfigure(RECONFIG_PARAM_EXPECTED_VOTES, us->node_id, us->expected_votes); ++ } ++} ++ ++static void quorum_key_change_notify(object_change_type_t change_type, ++ unsigned int parent_object_handle, ++ unsigned int object_handle, ++ void *object_name_pt, int object_name_len, ++ void *key_name_pt, int key_len, ++ void *key_value_pt, int key_value_len, ++ void *priv_data_pt) ++{ ++ if (memcmp(object_name_pt, "quorum", object_name_len) == 0) ++ reread_config(object_handle); ++} ++ ++ ++/* Called when the objdb is reloaded */ ++static void votequorum_objdb_reload_notify( ++ objdb_reload_notify_type_t type, int flush, ++ void *priv_data_pt) ++{ ++ /* ++ * A new quorum {} key might exist, cancel the ++ * existing notification at the start of reload, ++ * and start a new one on the new object when ++ * it's all settled. ++ */ ++ ++ if (type == OBJDB_RELOAD_NOTIFY_START) { ++ corosync_api->object_track_stop( ++ quorum_key_change_notify, ++ NULL, ++ NULL, ++ NULL, ++ NULL); ++ } ++ ++ if (type == OBJDB_RELOAD_NOTIFY_END || ++ type == OBJDB_RELOAD_NOTIFY_FAILED) { ++ unsigned int find_handle; ++ unsigned int object_handle; ++ ++ corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); ++ if (corosync_api->object_find_next(find_handle, &object_handle) == 0) { ++ add_votequorum_config_notification(object_handle); ++ ++ reread_config(object_handle); ++ } ++ else { ++ log_printf(LOG_LEVEL_ERROR, "votequorum objdb tracking stopped, cannot find quorum{} handle in objdb\n"); ++ } ++ } ++} ++ ++ ++static void add_votequorum_config_notification( ++ unsigned int quorum_object_handle) ++{ ++ ++ corosync_api->object_track_start(quorum_object_handle, ++ 1, ++ quorum_key_change_notify, ++ NULL, ++ NULL, ++ NULL, ++ NULL); ++ ++ /* ++ * Reload notify must be on the parent object ++ */ ++ corosync_api->object_track_start(OBJECT_PARENT_HANDLE, ++ 1, ++ NULL, ++ NULL, ++ NULL, ++ votequorum_objdb_reload_notify, ++ NULL); ++} diff -Naurd corosync-0.92/test/cpgbench.c corosync-trunk/test/cpgbench.c --- corosync-0.92/test/cpgbench.c 2008-08-15 08:15:26.000000000 +0200 +++ corosync-trunk/test/cpgbench.c 2008-11-06 22:49:07.000000000 +0100 @@ -15036,20 +20418,21 @@ diff -Naurd corosync-0.92/test/logsys_t2.c corosync-trunk/test/logsys_t2.c log_printf(LOG_DEBUG, "If you see this, the logger's busted\n"); diff -Naurd corosync-0.92/test/Makefile corosync-trunk/test/Makefile --- corosync-0.92/test/Makefile 2008-09-25 07:31:42.000000000 +0200 -+++ corosync-trunk/test/Makefile 2008-12-08 16:55:41.000000000 +0100 -@@ -42,9 +42,9 @@ ++++ corosync-trunk/test/Makefile 2009-01-26 11:46:08.000000000 +0100 +@@ -42,9 +42,10 @@ override LDFLAGS += -lnsl -lsocket -lrt endif -LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a -+LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a ../lib/libquorum.a ++LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a ../lib/libquorum.a ../lib/libvotequorum.a LIBS = $(LIBRARIES) -BINARIES= testevs evsbench evsverify testcpg testcpg2 cpgbench testconfdb -+BINARIES= testevs evsbench evsverify testcpg testcpg2 cpgbench testconfdb logsysbench logsysrec testquorum ++BINARIES= testevs evsbench evsverify testcpg testcpg2 cpgbench testconfdb logsysbench logsysrec testquorum \ ++ testvotequorum1 testvotequorum2 override CFLAGS += -I../include override LDFLAGS += -L../lib -@@ -75,12 +75,26 @@ +@@ -75,12 +76,33 @@ testcpg2: testcpg2.o $(LIBRARIES) $(CC) $(LDFLAGS) -o testcpg2 testcpg2.o $(LIBS) @@ -15070,8 +20453,15 @@ diff -Naurd corosync-0.92/test/Makefile corosync-trunk/test/Makefile + +testquorum1: testquorum1.o $(LIBRARIES) + $(CC) $(LDFLAGS) -o testquorum1 testquorum1.o $(LIBS) ++ +testquorum2: testquorum2.o $(LIBRARIES) + $(CC) $(LDFLAGS) -o testquorum2 testquorum2.o $(LIBS) ++ ++testvotequorum1: testvotequorum1.o $(LIBRARIES) ++ $(CC) $(LDFLAGS) -o testvotequorum1 testvotequorum1.o $(LIBS) ++ ++testvotequorum2: testvotequorum2.o $(LIBRARIES) ++ $(CC) $(LDFLAGS) -o testvotequorum2 testvotequorum2.o $(LIBS) + logsys_s: logsys_s.o logsys_s1.o logsys_s2.o ../exec/liblogsys.a $(CC) -o logsys_s logsys_s.o logsys_s1.o logsys_s2.o ../exec/liblogsys.a $(LDFLAGS) @@ -15552,9 +20942,279 @@ diff -Naurd corosync-0.92/test/testquorum.c corosync-trunk/test/testquorum.c + + return 0; +} +diff -Naurd corosync-0.92/test/testvotequorum1.c corosync-trunk/test/testvotequorum1.c +--- corosync-0.92/test/testvotequorum1.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/test/testvotequorum1.c 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,159 @@ ++/* ++ * Copyright (c) 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 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 CONTIBUTORS "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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static votequorum_handle_t handle; ++ ++static char *node_state(int state) ++{ ++ switch (state) { ++ case NODESTATE_JOINING: ++ return "Joining"; ++ break; ++ case NODESTATE_MEMBER: ++ return "Member"; ++ break; ++ case NODESTATE_DEAD: ++ return "Dead"; ++ break; ++ case NODESTATE_LEAVING: ++ return "Leaving"; ++ break; ++ case NODESTATE_DISALLOWED: ++ return "Disallowed"; ++ break; ++ default: ++ return "UNKNOWN"; ++ break; ++ } ++} ++ ++static void votequorum_notification_fn( ++ votequorum_handle_t handle, ++ uint64_t context, ++ uint32_t quorate, ++ uint32_t node_list_entries, ++ votequorum_node_t node_list[] ++ ) ++{ ++ int i; ++ ++ printf("votequorum notification called \n"); ++ printf(" quorate = %d\n", quorate); ++ printf(" number of nodes = %d\n", node_list_entries); ++ ++ for (i = 0; i< node_list_entries; i++) { ++ printf(" %d: %s\n", node_list[i].nodeid, node_state(node_list[i].state)); ++ } ++ printf("\n"); ++} ++ ++ ++int main(int argc, char *argv[]) ++{ ++ struct votequorum_info info; ++ votequorum_callbacks_t callbacks; ++ int err; ++ ++ if (argc > 1 && strcmp(argv[1], "-h")==0) { ++ fprintf(stderr, "usage: %s [new-expected] [new-votes]\n", argv[0]); ++ return 0; ++ } ++ ++ callbacks.votequorum_notify_fn = votequorum_notification_fn; ++ if ( (err=votequorum_initialize(&handle, &callbacks)) != CS_OK) ++ fprintf(stderr, "votequorum_initialize FAILED: %d\n", err); ++ ++ if ( (err = votequorum_trackstart(handle, handle, CS_TRACK_CHANGES)) != CS_OK) ++ fprintf(stderr, "votequorum_trackstart FAILED: %d\n", err); ++ ++ if ( (err=votequorum_getinfo(handle, 0, &info)) != CS_OK) ++ fprintf(stderr, "votequorum_getinfo FAILED: %d\n", err); ++ else { ++ printf("node votes %d\n", info.node_votes); ++ printf("expected votes %d\n", info.node_expected_votes); ++ printf("highest expected %d\n", info.highest_expected); ++ printf("total votes %d\n", info.total_votes); ++ printf("quorum %d\n", info.quorum); ++ printf("flags "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_HASSTATE) printf("HasState "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_DISALLOWED) printf("Disallowed "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_TWONODE) printf("2Node "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_QUORATE) printf("Quorate "); ++ printf("\n"); ++ } ++ ++ if (argc >= 2 && atoi(argv[1])) { ++ if ( (err=votequorum_setexpected(handle, atoi(argv[1]))) != CS_OK) ++ fprintf(stderr, "set expected votes FAILED: %d\n", err); ++ } ++ if (argc >= 3 && atoi(argv[2])) { ++ if ( (err=votequorum_setvotes(handle, 0, atoi(argv[2]))) != CS_OK) ++ fprintf(stderr, "set votes FAILED: %d\n", err); ++ } ++ ++ if (argc >= 2) { ++ if ( (err=votequorum_getinfo(handle, 0, &info)) != CS_OK) ++ fprintf(stderr, "votequorum_getinfo2 FAILED: %d\n", err); ++ else { ++ printf("-------------------\n"); ++ printf("node votes %d\n", info.node_votes); ++ printf("expected votes %d\n", info.node_expected_votes); ++ printf("highest expected %d\n", info.highest_expected); ++ printf("total votes %d\n", info.total_votes); ++ printf("votequorum %d\n", info.quorum); ++ printf("flags "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_HASSTATE) printf("HasState "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_DISALLOWED) printf("Disallowed "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_TWONODE) printf("2Node "); ++ if (info.flags & VOTEQUORUM_INFO_FLAG_QUORATE) printf("Quorate "); ++ printf("\n"); ++ } ++ } ++ ++ printf("Waiting for votequorum events, press ^C to finish\n"); ++ printf("-------------------\n"); ++ ++ while (1) ++ votequorum_dispatch(handle, CS_DISPATCH_ALL); ++ ++ return 0; ++} +diff -Naurd corosync-0.92/test/testvotequorum2.c corosync-trunk/test/testvotequorum2.c +--- corosync-0.92/test/testvotequorum2.c 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/test/testvotequorum2.c 2009-01-26 11:46:08.000000000 +0100 +@@ -0,0 +1,96 @@ ++/* ++ * Copyright (c) 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 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 CONTIBUTORS "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 ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static votequorum_handle_t handle; ++ ++ ++static void print_info(int ok_to_fail) ++{ ++ struct votequorum_qdisk_info qinfo; ++ int err; ++ ++ if ( (err=votequorum_qdisk_getinfo(handle, &qinfo)) != CS_OK) ++ fprintf(stderr, "votequorum_qdisk_getinfo error %d: %s\n", err, ok_to_fail?"OK":"FAILED"); ++ else { ++ printf("qdisk votes %d\n", qinfo.votes); ++ printf("state %d\n", qinfo.state); ++ printf("name %s\n", qinfo.name); ++ printf("\n"); ++ } ++} ++ ++int main(int argc, char *argv[]) ++{ ++ int pollcount=0, polltime=1; ++ int err; ++ ++ if ( (err=votequorum_initialize(&handle, NULL)) != CS_OK) { ++ fprintf(stderr, "votequorum_initialize FAILED: %d\n", err); ++ return -1; ++ } ++ ++ print_info(1); ++ ++ if (argc >= 2 && atoi(argv[1])) { ++ pollcount = atoi(argv[1]); ++ } ++ if (argc >= 3 && atoi(argv[2])) { ++ polltime = atoi(argv[2]); ++ } ++ ++ if (argc >= 2) { ++ if ( (err=votequorum_qdisk_register(handle, "QDISK", 4)) != CS_OK) ++ fprintf(stderr, "qdisk_register FAILED: %d\n", err); ++ ++ while (pollcount--) { ++ print_info(0); ++ if ((err=votequorum_qdisk_poll(handle, 1)) != CS_OK) ++ fprintf(stderr, "qdisk poll FAILED: %d\n", err); ++ print_info(0); ++ sleep(polltime); ++ } ++ if ((err= votequorum_qdisk_unregister(handle)) != CS_OK) ++ fprintf(stderr, "qdisk unregister FAILED: %d\n", err); ++ } ++ print_info(1); ++ ++ return 0; ++} diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync-cfgtool.c --- corosync-0.92/tools/corosync-cfgtool.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/tools/corosync-cfgtool.c 2008-11-11 18:25:22.000000000 +0100 ++++ corosync-trunk/tools/corosync-cfgtool.c 2009-01-19 09:31:21.000000000 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2006-2007 Red Hat, Inc. ++ * Copyright (c) 2006-2009 Red Hat, Inc. + * + * All rights reserved. + * @@ -38,6 +38,7 @@ #include #include @@ -15563,12 +21223,13 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync #include #include #include -@@ -45,12 +46,12 @@ +@@ -45,12 +46,13 @@ #include #include -#include +#include ++#include #include static void ringstatusget_do (void) @@ -15578,7 +21239,7 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync corosync_cfg_handle_t handle; unsigned int interface_count; char **interface_names; -@@ -59,84 +60,160 @@ +@@ -59,84 +61,199 @@ printf ("Printing ring status.\n"); result = corosync_cfg_initialize (&handle, NULL); @@ -15683,7 +21344,7 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync + (void)corosync_cfg_finalize (handle); +} + -+void shutdown_callback (corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownFlagsT flags) ++void shutdown_callback (corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags) +{ + printf("shutdown callback called, flags = %d\n",flags); + @@ -15707,12 +21368,12 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync +{ + cs_error_t result; + corosync_cfg_handle_t handle; -+ CorosyncCfgCallbacksT callbacks; -+ CorosyncCfgStateNotificationT notificationBuffer; ++ corosync_cfg_callbacks_t callbacks; ++ corosync_cfg_state_notification_t notification_buffer; + pthread_t dispatch_thread; + + printf ("Shutting down corosync\n"); -+ callbacks.corosyncCfgShutdownCallback = shutdown_callback; ++ callbacks.corosync_cfg_shutdown_callback = shutdown_callback; + + result = corosync_cfg_initialize (&handle, &callbacks); + if (result != CS_OK) { @@ -15724,7 +21385,7 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync + + result = corosync_cfg_state_track (handle, + 0, -+ ¬ificationBuffer); ++ ¬ification_buffer); + if (result != CS_OK) { + printf ("Could not start corosync cfg tracking error %d\n", result); + exit (1); @@ -15735,6 +21396,45 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync + printf ("Could not shutdown (error = %d)\n", result); + } + ++ (void)corosync_cfg_finalize (handle); + } + ++void showaddrs_do(int nodeid) ++{ ++ cs_error_t result; ++ corosync_cfg_handle_t handle; ++ corosync_cfg_callbacks_t callbacks; ++ int numaddrs; ++ int i; ++ corosync_cfg_node_address_t addrs[INTERFACE_MAX]; ++ ++ ++ result = corosync_cfg_initialize (&handle, &callbacks); ++ if (result != CS_OK) { ++ printf ("Could not initialize corosync configuration API error %d\n", result); ++ exit (1); ++ } ++ ++ if (!corosync_cfg_get_node_addrs(handle, nodeid, INTERFACE_MAX, &numaddrs, addrs) == CS_OK) { ++ for (i=0; iss_family == AF_INET6) ++ saddr = &sin6->sin6_addr; ++ else ++ saddr = &sin->sin_addr; ++ ++ inet_ntop(ss->ss_family, saddr, buf, sizeof(buf)); ++ printf("%s", buf); ++ } ++ printf("\n"); ++ } ++ ++ + (void)corosync_cfg_finalize (handle); +} + @@ -15754,27 +21454,28 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync + printf ("Could not kill node (error = %d)\n", result); + } + (void)corosync_cfg_finalize (handle); - } - ++} ++ + void usage_do (void) { - printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version]\n\n"); -+ printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version] [-k] [nodeid]\n\n"); ++ printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); printf ("A tool for displaying and configuring active parameters within corosync.\n"); printf ("options:\n"); printf ("\t-s\tDisplays the status of the current rings on this node.\n"); -@@ -144,15 +221,18 @@ +@@ -144,15 +261,19 @@ printf ("\t\tre-enable redundant ring operation.\n"); printf ("\t-l\tLoad a service identified by name.\n"); printf ("\t-u\tUnload a service identified by name.\n"); ++ printf ("\t-a\tDisplay the IP address(es) of a node\n"); + printf ("\t-k\tKill a node identified by node id.\n"); + printf ("\t-h\tShutdown corosync cleanly on this node.\n"); } int main (int argc, char *argv[]) { - const char *options = "srl:u:v:"; -+ const char *options = "srl:u:v:k:h"; ++ const char *options = "srl:u:v:k:a:h"; int opt; int service_load = 0; + unsigned int nodeid; @@ -15786,7 +21487,7 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync if (argc == 1) { usage_do (); -@@ -173,17 +253,25 @@ +@@ -173,17 +294,28 @@ service_unload = 1; service = strdup (optarg); break; @@ -15796,6 +21497,9 @@ diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync + break; + case 'h': + shutdown_do(); ++ break; ++ case 'a': ++ showaddrs_do( atoi(optarg) ); + break; case 'v': version = atoi (optarg); diff --git a/corosync.spec b/corosync.spec index 329deb3..bec5820 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,14 +1,14 @@ -%define alphatag svn1709 +%define alphatag svn1750 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.92 -Release: 5%{?alphatag:.%{alphatag}}%{?dist} +Release: 6%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: corosync-trunk-1709.diff +Patch0: corosync-trunk-1750.diff BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(pre): /usr/sbin/useradd @@ -94,6 +94,7 @@ fi %{_libexecdir}/lcrso/service_evs.lcrso %{_libexecdir}/lcrso/service_confdb.lcrso %{_libexecdir}/lcrso/service_pload.lcrso +%{_libexecdir}/lcrso/service_votequorum.lcrso %{_libexecdir}/lcrso/testquorum.lcrso %{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso @@ -105,6 +106,8 @@ fi %{_libdir}/corosync/libtotem_pg.so.* %{_libdir}/corosync/liblogsys.so.* %{_libdir}/corosync/libcoroutil.so.* +%{_libdir}/corosync/libquorum.so.* +%{_libdir}/corosync/libvotequorum.so.* %{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* @@ -125,6 +128,8 @@ fi %{_includedir}/corosync/list.h %{_includedir}/corosync/mar_gen.h %{_includedir}/corosync/swab.h +%{_includedir}/corosync/quorum.h +%{_includedir}/corosync/votequorum.h %dir %{_includedir}/corosync/totem/ %{_includedir}/corosync/totem/coropoll.h %{_includedir}/corosync/totem/totem.h @@ -147,15 +152,23 @@ fi %{_libdir}/corosync/libtotem_pg.so %{_libdir}/corosync/liblogsys.so %{_libdir}/corosync/libcoroutil.so +%{_libdir}/corosync/libquorum.so +%{_libdir}/corosync/libvotequorum.so %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* %{_mandir}/man3/confdb_*3* +%{_mandir}/man3/votequorum_*3* %{_mandir}/man8/cpg_overview.8* %{_mandir}/man8/evs_overview.8* %{_mandir}/man8/confdb_overview.8* %{_mandir}/man8/logsys_overview.8* +%{_mandir}/man8/votequorum_overview.8* %changelog +* Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 +- Update to svn trunk at revision 1750 from upstream. +- Include new quorum service in the packaging. + * Mon Dec 15 2008 Fabio M. Di Nitto - 0.92-5.svn1709 - Update to svn trunk at revision 1709 from upstream. - Update spec file to include new include files. From 262f485720f8be58bcea7eb3c507d3e775f0d5b8 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 2 Feb 2009 07:19:05 +0000 Subject: [PATCH 005/185] Update to latest trunk (1756) --- ...ync-trunk-1750.diff => corosync-trunk.diff | 257 +++++++++++++++--- corosync.spec | 12 +- 2 files changed, 228 insertions(+), 41 deletions(-) rename corosync-trunk-1750.diff => corosync-trunk.diff (98%) diff --git a/corosync-trunk-1750.diff b/corosync-trunk.diff similarity index 98% rename from corosync-trunk-1750.diff rename to corosync-trunk.diff index a37d6c4..8018dc6 100644 --- a/corosync-trunk-1750.diff +++ b/corosync-trunk.diff @@ -976,7 +976,7 @@ diff -Naurd corosync-0.92/exec/ipc.h corosync-trunk/exec/ipc.h #endif /* IPC_H_DEFINED */ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c --- corosync-0.92/exec/logsys.c 2008-09-17 20:22:58.000000000 +0200 -+++ corosync-trunk/exec/logsys.c 2009-01-26 14:15:57.000000000 +0100 ++++ corosync-trunk/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2004 MontaVista Software, Inc. @@ -1003,7 +1003,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c #if defined(COROSYNC_LINUX) #include #endif -@@ -54,14 +58,54 @@ +@@ -54,14 +58,53 @@ #include #include @@ -1044,7 +1044,6 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c + +struct logsys_logger { + char subsys[64]; -+ unsigned int facility; + unsigned int priority; + unsigned int tags; + unsigned int mode; @@ -1060,7 +1059,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c static char *logsys_file = NULL; -@@ -69,35 +113,44 @@ +@@ -69,35 +112,44 @@ static int logsys_facility = LOG_DAEMON; @@ -1095,9 +1094,11 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c -int logsys_single_id = 0; +static pthread_spinlock_t logsys_idx_spinlock; - ++ +static unsigned int log_rec_idx; ++static int logsys_buffer_full = 0; + -struct log_entry { - char *file; - int line; @@ -1105,14 +1106,12 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c - char str[128]; - struct log_entry *next; -}; -+static int logsys_buffer_full = 0; - --static struct log_entry *head; +static char *format_buffer="[%6s] %b"; --static struct log_entry *tail; +-static struct log_entry *head; +static int log_requests_pending = 0; -+ + +-static struct log_entry *tail; +static int log_requests_lost = 0; + +void *logsys_rec_end; @@ -1123,7 +1122,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c struct log_data { unsigned int syslog_pos; -@@ -105,324 +158,674 @@ +@@ -105,324 +157,674 @@ char *log_string; }; @@ -2022,7 +2021,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c pthread_mutex_unlock (&logsys_config_mutex); } -@@ -431,22 +834,28 @@ +@@ -431,22 +833,28 @@ return logsys_mode; } @@ -2055,7 +2054,7 @@ diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c logsys_file_fp = fopen (file, "a+"); if (logsys_file_fp == 0) { sprintf (error_string_response, -@@ -454,222 +863,243 @@ +@@ -454,222 +862,243 @@ file, strerror (errno)); *error_string = error_string_response; pthread_mutex_unlock (&logsys_config_mutex); @@ -5853,7 +5852,7 @@ diff -Naurd corosync-0.92/include/corosync/ais_util.h corosync-trunk/include/cor #endif /* AIS_UTIL_H_DEFINED */ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync/cfg.h --- corosync-0.92/include/corosync/cfg.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/cfg.h 2009-01-19 09:31:21.000000000 +0100 ++++ corosync-trunk/include/corosync/cfg.h 2009-01-29 10:17:43.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright (c) 2005 MontaVista Software, Inc. @@ -5982,7 +5981,7 @@ diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync + */ +typedef struct +{ -+ int addressLength; ++ int address_length; + char address[sizeof(struct sockaddr_in6)]; +} corosync_cfg_node_address_t; + @@ -8266,8 +8265,8 @@ diff -Naurd corosync-0.92/include/corosync/pload.h corosync-trunk/include/corosy +#endif /* COROSYNC_PLOAD_H_DEFINED */ diff -Naurd corosync-0.92/include/corosync/quorum.h corosync-trunk/include/corosync/quorum.h --- corosync-0.92/include/corosync/quorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/quorum.h 2008-12-08 16:55:41.000000000 +0100 -@@ -0,0 +1,97 @@ ++++ corosync-trunk/include/corosync/quorum.h 2009-01-30 14:31:40.000000000 +0100 +@@ -0,0 +1,105 @@ +/* + * Copyright (c) 2008 Red Hat, Inc. + * @@ -8341,6 +8340,14 @@ diff -Naurd corosync-0.92/include/corosync/quorum.h corosync-trunk/include/coros + + +/* ++ * Get a file descriptor on which to poll. quorum_handle_t is NOT a ++ * file descriptor and may not be used directly. ++ */ ++cs_error_t quorum_fd_get ( ++ quorum_handle_t handle, ++ int *fd); ++ ++/* + * Dispatch messages and configuration changes + */ +cs_error_t quorum_dispatch ( @@ -8608,8 +8615,8 @@ diff -Naurd corosync-0.92/include/corosync/totem/totempg.h corosync-trunk/includ diff -Naurd corosync-0.92/include/corosync/votequorum.h corosync-trunk/include/corosync/votequorum.h --- corosync-0.92/include/corosync/votequorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/votequorum.h 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,198 @@ ++++ corosync-trunk/include/corosync/votequorum.h 2009-01-30 14:31:40.000000000 +0100 +@@ -0,0 +1,205 @@ +/* + * Copyright (c) 2009 Red Hat, Inc. + * @@ -8722,6 +8729,13 @@ diff -Naurd corosync-0.92/include/corosync/votequorum.h corosync-trunk/include/c + votequorum_handle_t handle, + cs_dispatch_flags_t dispatch_types); + ++/* ++ * Get a file descriptor on which to poll. votequorum_handle_t is NOT a ++ * file descriptor and may not be used directly. ++ */ ++cs_error_t votequorum_fd_get ( ++ votequorum_handle_t handle, ++ int *fd); + +/* + * Get quorum information. @@ -8886,7 +8900,7 @@ diff -Naurd corosync-0.92/lcr/uis.c corosync-trunk/lcr/uis.c diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c --- corosync-0.92/lib/cfg.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lib/cfg.c 2009-01-19 09:31:21.000000000 +0100 ++++ corosync-trunk/lib/cfg.c 2009-01-29 10:17:43.000000000 +0100 @@ -1,13 +1,13 @@ /* * Copyright (c) 2002-2005 MontaVista Software, Inc. @@ -9723,7 +9737,7 @@ diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c + addrlen = sizeof(struct sockaddr_in6); + + for (i=0; inum_addrs; i++) { -+ addrs[i].addressLength = addrlen; ++ addrs[i].address_length = addrlen; + struct sockaddr_in *in; + struct sockaddr_in6 *in6; + @@ -13913,8 +13927,8 @@ diff -Naurd corosync-0.92/lib/util.h corosync-trunk/lib/util.h SaVersionT *version); diff -Naurd corosync-0.92/lib/votequorum.c corosync-trunk/lib/votequorum.c --- corosync-0.92/lib/votequorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/votequorum.c 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,821 @@ ++++ corosync-trunk/lib/votequorum.c 2009-01-30 14:31:40.000000000 +0100 +@@ -0,0 +1,841 @@ +/* + * Copyright (c) 2009 Red Hat, Inc. + * @@ -14587,6 +14601,26 @@ diff -Naurd corosync-0.92/lib/votequorum.c corosync-trunk/lib/votequorum.c +} + + ++cs_error_t votequorum_fd_get ( ++ votequorum_handle_t handle, ++ int *fd) ++{ ++ cs_error_t error; ++ struct votequorum_inst *votequorum_inst; ++ ++ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); ++ if (error != CS_OK) { ++ return (error); ++ } ++ ++ *fd = votequorum_inst->dispatch_fd; ++ ++ (void)saHandleInstancePut (&votequorum_handle_t_db, handle); ++ ++ return (CS_OK); ++} ++ ++ +struct res_overlay { + mar_res_header_t header __attribute__((aligned(8))); + char data[512000]; @@ -14738,9 +14772,47 @@ diff -Naurd corosync-0.92/lib/votequorum.c corosync-trunk/lib/votequorum.c +} diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile --- corosync-0.92/Makefile 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/Makefile 2009-01-26 11:46:08.000000000 +0100 -@@ -115,10 +115,17 @@ ++++ corosync-trunk/Makefile 2009-01-30 19:44:13.000000000 +0100 +@@ -46,24 +46,8 @@ + INCLUDEDIR_ENGINE=$(PREFIX)/include/corosync/engine + MANDIR=$(PREFIX)/share/man + ETCDIR=/etc +-ARCH=$(shell uname -p) + +-ifeq (,$(findstring 64,$(ARCH))) +-LIBDIR=$(PREFIX)/lib/corosync +-else +-LIBDIR=$(PREFIX)/lib64/corosync +-endif +-ifeq (s390,$(ARCH)) +-LIBDIR=$(PREFIX)/lib/corosync +-endif +-ifeq (s390x,$(ARCH)) +-LIBDIR=$(PREFIX)/lib64/corosync +-endif +-ifeq (ia64,$(ARCH)) +-LIBDIR=$(PREFIX)/lib/corosync +-endif +- +-SUBDIRS:=$(builddir)lcr $(builddir)lib $(builddir)tools $(builddir)exec $(builddir)test $(builddir)services ++SUBDIRS:=$(builddir)lcr $(builddir)lib $(builddir)tools $(builddir)exec $(builddir)test $(builddir)services $(builddir)pkgconfig + sub_make = srcdir=$(srcdir) builddir=$(builddir) subdir=$(1)/ $(MAKE) -I$(srcdir)$(1) -f $(srcdir)$(1)/Makefile $(2) + + all: $(SUBDIRS) +@@ -73,6 +57,7 @@ + @(cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,all)); + @(cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,all)); + @(cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,all)); ++ @(cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,all)); + + # subdirs are not phony + .PHONY: all clean install doxygen +@@ -113,12 +98,21 @@ + (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,clean)); + (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,clean)); (cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean)); ++ (cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,clean)); ++ rm -rf $(builddir)doc/api -COROSYNC_LIBS = evs cpg cfg coroutil confdb @@ -14759,7 +14831,15 @@ diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile EXEC_LIBS = totem_pg logsys -@@ -145,7 +152,7 @@ +@@ -134,6 +128,7 @@ + mkdir -p $(DESTDIR)$(MANDIR)/man5 + mkdir -p $(DESTDIR)$(MANDIR)/man8 + mkdir -p $(DESTDIR)$(ETCDIR)/ld.so.conf.d ++ mkdir -p $(DESTDIR)$(PKGCONFIGDIR) + + + for eLib in $(EXEC_LIBS); do \ +@@ -145,7 +140,7 @@ install -m 755 exec/lib$$eLib.so.2.* $(DESTDIR)$(LIBDIR); \ if [ "xYES" = "x$(STATICLIBS)" ]; then \ install -m 755 exec/lib$$eLib.a $(DESTDIR)$(LIBDIR); \ @@ -14768,7 +14848,7 @@ diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile ranlib $(DESTDIR)$(LIBDIR)/lib$$eLib.a; \ fi \ fi \ -@@ -161,7 +168,7 @@ +@@ -161,7 +156,7 @@ install -m 755 lib/lib$$aLib.so.2.* $(DESTDIR)$(LIBDIR); \ if [ "xYES" = "x$(STATICLIBS)" ]; then \ install -m 755 lib/lib$$aLib.a $(DESTDIR)$(LIBDIR); \ @@ -14777,7 +14857,7 @@ diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile ranlib $(DESTDIR)$(LIBDIR)/lib$$aLib.a; \ fi \ fi \ -@@ -177,7 +184,7 @@ +@@ -177,7 +172,7 @@ install -m 755 $(builddir)tools/corosync-cfgtool $(DESTDIR)$(SBINDIR) install -m 755 $(builddir)tools/corosync-keygen $(DESTDIR)$(SBINDIR) @@ -14786,7 +14866,7 @@ diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile install -m 644 $(srcdir)conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \ fi -@@ -196,6 +203,7 @@ +@@ -196,10 +191,13 @@ install -m 644 $(srcdir)include/corosync/engine/coroapi.h $(DESTDIR)$(INCLUDEDIR_ENGINE) install -m 644 $(srcdir)include/corosync/engine/objdb.h $(DESTDIR)$(INCLUDEDIR_ENGINE) install -m 644 $(srcdir)include/corosync/engine/logsys.h $(DESTDIR)$(INCLUDEDIR_ENGINE) @@ -14794,10 +14874,42 @@ diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile install -m 644 $(srcdir)include/corosync/engine/config.h $(DESTDIR)$(INCLUDEDIR_ENGINE) install -m 644 $(srcdir)man/*.3 $(DESTDIR)$(MANDIR)/man3 install -m 644 $(srcdir)man/*.5 $(DESTDIR)$(MANDIR)/man5 + install -m 644 $(srcdir)man/*.8 $(DESTDIR)$(MANDIR)/man8 + ++ install -m 644 $(builddir)/pkgconfig/*.pc $(DESTDIR)$(PKGCONFIGDIR) ++ + doxygen: + mkdir -p doc/api && doxygen diff -Naurd corosync-0.92/Makefile.inc corosync-trunk/Makefile.inc --- corosync-0.92/Makefile.inc 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/Makefile.inc 2008-12-09 14:48:47.000000000 +0100 -@@ -38,16 +38,15 @@ ++++ corosync-trunk/Makefile.inc 2009-01-30 19:25:04.000000000 +0100 +@@ -3,6 +3,25 @@ + DESTDIR= + LCRSODIR=$(PREFIX)/libexec/lcrso + ++ARCH=$(shell uname -p) ++ifeq (,$(findstring 64,$(ARCH))) ++PRELIBDIR=$(PREFIX)/lib ++else ++PRELIBDIR=$(PREFIX)/lib64 ++endif ++ifeq (s390,$(ARCH)) ++PRELIBDIR=$(PREFIX)/lib ++endif ++ifeq (s390x,$(ARCH)) ++PRELIBDIR=$(PREFIX)/lib64 ++endif ++ifeq (ia64,$(ARCH)) ++PRELIBDIR=$(PREFIX)/lib ++endif ++ ++LIBDIR=$(PRELIBDIR)/corosync ++PKGCONFIGDIR=$(PRELIBDIR)/pkgconfig ++ + # Do not modify below this line + + # Basic OS detection +@@ -38,16 +57,15 @@ # COROSYNC_BUILD can be defined as RELEASE or DEBUG # ifndef COROSYNC_BUILD @@ -14816,7 +14928,7 @@ diff -Naurd corosync-0.92/Makefile.inc corosync-trunk/Makefile.inc override CFLAGS += -DLCRSODIR='"$(LCRSODIR)"' -@@ -58,35 +57,26 @@ +@@ -58,35 +76,26 @@ # build CFLAGS, LDFLAGS # ifeq (${COROSYNC_BUILD}, RELEASE) @@ -15982,9 +16094,78 @@ diff -Naurd corosync-0.92/man/votequorum_setvotes.3 corosync-trunk/man/votequoru +.BR votequorum_dispatch (3), +.BR votequorum_fd_get (3), +.PP +diff -Naurd corosync-0.92/pkgconfig/libtemplate.pc.in corosync-trunk/pkgconfig/libtemplate.pc.in +--- corosync-0.92/pkgconfig/libtemplate.pc.in 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/pkgconfig/libtemplate.pc.in 2009-01-30 19:25:04.000000000 +0100 +@@ -0,0 +1,11 @@ ++prefix=@PREFIX@ ++exec_prefix=${prefix} ++libdir=@LIBDIR@ ++includedir=${prefix}/include ++ ++Name: @LIB@ ++Version: trunk ++Description: @LIB@ ++Requires: ++Libs: -L${libdir} -l@LIB@ ++Cflags: -I${includedir} +diff -Naurd corosync-0.92/pkgconfig/Makefile corosync-trunk/pkgconfig/Makefile +--- corosync-0.92/pkgconfig/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ corosync-trunk/pkgconfig/Makefile 2009-01-30 19:25:04.000000000 +0100 +@@ -0,0 +1,50 @@ ++# Copyright (c) 2009 Red Hat, Inc. ++# ++# All rights reserved. ++# ++# 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 ENGINES; 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 configuration ++# ++srcdir ?= $(CURDIR)/../ ++subdir ?= pkgconfig ++ ++include $(srcdir)/Makefile.inc ++ ++LIBS = evs cpg cfg coroutil confdb quorum votequorum totem_pg logsys ++ ++all: ++ for i in $(LIBS); do \ ++ cat ${srcdir}/pkgconfig/libtemplate.pc.in | sed \ ++ -e 's#@PREFIX@#$(PREFIX)#g' \ ++ -e 's#@LIBDIR@#$(LIBDIR)#g' \ ++ -e 's#@LIB@#'$${i}'#g' \ ++ > lib$${i}.pc; \ ++ done; ++ ++clean: ++ rm -f *.pc diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c --- corosync-0.92/services/cfg.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/services/cfg.c 2009-01-19 09:31:21.000000000 +0100 ++++ corosync-trunk/services/cfg.c 2009-01-30 12:56:34.000000000 +0100 @@ -1,13 +1,13 @@ /* * Copyright (c) 2005-2006 MontaVista Software, Inc. @@ -16838,7 +17019,7 @@ diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c + char buf[PIPE_BUF]; + char **status; + unsigned int num_interfaces = 0; -+ int ret = 0; ++ int ret = CS_OK; + int i; + struct req_lib_cfg_get_node_addrs *req_lib_cfg_get_node_addrs = (struct req_lib_cfg_get_node_addrs *)msg; + struct res_lib_cfg_get_node_addrs *res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf; @@ -18351,7 +18532,7 @@ diff -Naurd corosync-0.92/services/testquorum.c corosync-trunk/services/testquor +} diff -Naurd corosync-0.92/services/votequorum.c corosync-trunk/services/votequorum.c --- corosync-0.92/services/votequorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/services/votequorum.c 2009-01-26 11:46:08.000000000 +0100 ++++ corosync-trunk/services/votequorum.c 2009-01-29 15:21:05.000000000 +0100 @@ -0,0 +1,1619 @@ +/* + * Copyright (c) 2009 Red Hat, Inc. @@ -19483,10 +19664,10 @@ diff -Naurd corosync-0.92/services/votequorum.c corosync-trunk/services/votequor + list_iterate(nodelist, &cluster_members_list) { + iternode = list_entry(nodelist, struct cluster_node, list); + -+ if (node->state == NODESTATE_MEMBER) { ++ if (iternode->state == NODESTATE_MEMBER) { + highest_expected = -+ max(highest_expected, node->expected_votes); -+ total_votes += node->votes; ++ max(highest_expected, iternode->expected_votes); ++ total_votes += iternode->votes; + } + } + diff --git a/corosync.spec b/corosync.spec index bec5820..07f2eba 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,14 +1,14 @@ -%define alphatag svn1750 +%define alphatag svn1756 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.92 -Release: 6%{?alphatag:.%{alphatag}}%{?dist} +Release: 7%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: corosync-trunk-1750.diff +Patch0: corosync-trunk.diff BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(pre): /usr/sbin/useradd @@ -26,6 +26,7 @@ APIs and libraries, default configuration files, and an init script. Summary: The Corosync Cluster Engine Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} +Requires: pkgconfig %description devel This package contains include files and man pages used to develop using @@ -154,6 +155,7 @@ fi %{_libdir}/corosync/libcoroutil.so %{_libdir}/corosync/libquorum.so %{_libdir}/corosync/libvotequorum.so +%{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* %{_mandir}/man3/confdb_*3* @@ -165,6 +167,10 @@ fi %{_mandir}/man8/votequorum_overview.8* %changelog +* Mon Feb 2 2009 Fabio M. Di Nitto - 0.92-7.svn1756 +- Update to svn trunk at revision 1756 from upstream. +- Add support pkgconfig to devel package. + * Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 - Update to svn trunk at revision 1750 from upstream. - Include new quorum service in the packaging. From cb6bbdfb509375bf81f85fb8f83fa6a0c2b7fae2 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 2 Feb 2009 07:30:05 +0000 Subject: [PATCH 006/185] Tidy up spec file to be a bit more organized --- corosync.spec | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/corosync.spec b/corosync.spec index 07f2eba..e1fe0dc 100644 --- a/corosync.spec +++ b/corosync.spec @@ -10,27 +10,16 @@ URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz Patch0: corosync-trunk.diff -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Runtime bits Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Conflicts: openais <= 0.89, openais-devel <= 0.89 +# Setup/build bits %define ais_user_uid 39 -%description -This package contains the Corosync Cluster Engine Executive, several default -APIs and libraries, default configuration files, and an init script. - -%package devel -Summary: The Corosync Cluster Engine -Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} -Requires: pkgconfig - -%description devel -This package contains include files and man pages used to develop using -The Corosync Cluster Engine APIs. +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %prep %setup -q -n corosync-%{version} @@ -56,6 +45,10 @@ install -m 755 init/redhat $RPM_BUILD_ROOT%{_initddir}/corosync %clean rm -rf $RPM_BUILD_ROOT +%description +This package contains the Corosync Cluster Engine Executive, several default +APIs and libraries, default configuration files, and an init script. + %pre # Add the "ais" user /usr/sbin/useradd -c 'The Corosync Cluster Engine' \ @@ -113,6 +106,16 @@ fi %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* +%package devel +Summary: The Corosync Cluster Engine +Group: System Environment/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +This package contains include files and man pages used to develop using +The Corosync Cluster Engine APIs. + %files devel %defattr(-,root,root,-) %dir %{_docdir}/%{name}-%{version} @@ -170,6 +173,7 @@ fi * Mon Feb 2 2009 Fabio M. Di Nitto - 0.92-7.svn1756 - Update to svn trunk at revision 1756 from upstream. - Add support pkgconfig to devel package. +- Tidy up spec files by re-organazing sections according to packages. * Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 - Update to svn trunk at revision 1750 from upstream. From f4a7370a9dc95570d2ab4819c5f2b0dc8fc2ab72 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 2 Feb 2009 07:59:42 +0000 Subject: [PATCH 007/185] Create libcorosync-devel package to replace corosync-devel --- corosync.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/corosync.spec b/corosync.spec index e1fe0dc..7b12e83 100644 --- a/corosync.spec +++ b/corosync.spec @@ -106,17 +106,19 @@ fi %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* -%package devel -Summary: The Corosync Cluster Engine +%package -n libcorosync-devel +Summary: The Corosync Cluster Engine Development Kit Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} Requires: pkgconfig +Provides: corosync-devel = 0.92-7 +Obsoletes: corosync-devel < 0.92-7 -%description devel +%description -n libcorosync-devel This package contains include files and man pages used to develop using The Corosync Cluster Engine APIs. -%files devel +%files -n libcorosync-devel %defattr(-,root,root,-) %dir %{_docdir}/%{name}-%{version} %doc %{_docdir}/%{name}-%{version}/README.devmap @@ -174,6 +176,7 @@ The Corosync Cluster Engine APIs. - Update to svn trunk at revision 1756 from upstream. - Add support pkgconfig to devel package. - Tidy up spec files by re-organazing sections according to packages. +- Rename corosync-devel to libcorosync-devel. * Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 - Update to svn trunk at revision 1750 from upstream. From 6c071721edc385d17f9fbd3d3f4cecc9a50b75fc Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 2 Feb 2009 09:53:24 +0000 Subject: [PATCH 008/185] Fix libcorosync-devel group --- corosync.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 7b12e83..c4c3b7d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -108,7 +108,7 @@ fi %package -n libcorosync-devel Summary: The Corosync Cluster Engine Development Kit -Group: System Environment/Libraries +Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: pkgconfig Provides: corosync-devel = 0.92-7 From 6d557ac72759f8aa27cec8a8f9aea4762d4f6704 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 2 Feb 2009 10:19:41 +0000 Subject: [PATCH 009/185] Split libraries in libcorosync --- corosync.spec | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/corosync.spec b/corosync.spec index c4c3b7d..1aa3dc8 100644 --- a/corosync.spec +++ b/corosync.spec @@ -11,6 +11,7 @@ Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/cor Patch0: corosync-trunk.diff # Runtime bits +Requires: libcorosync = %{version}-%{release} Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig @@ -56,7 +57,6 @@ APIs and libraries, default configuration files, and an init script. %post /sbin/chkconfig --add corosync || : -/sbin/ldconfig > /dev/null %preun if [ $1 -eq 0 ]; then @@ -66,7 +66,6 @@ fi %postun [ "$1" -ge "1" ] && /sbin/service corosync condrestart &>/dev/null || : -/sbin/ldconfig > /dev/null %files %defattr(-,root,root,-) @@ -78,7 +77,6 @@ fi %{_sbindir}/corosync-objctl %{_sbindir}/corosync-cfgtool %config(noreplace) /etc/corosync.conf -%config(noreplace) /etc/ld.so.conf.d/corosync-*.conf %{_initddir}/corosync %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso @@ -92,7 +90,22 @@ fi %{_libexecdir}/lcrso/testquorum.lcrso %{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso +%{_mandir}/man8/corosync_overview.8* +%{_mandir}/man8/corosync-objctl.8* +%{_mandir}/man5/corosync.conf.5* + +%package -n libcorosync +Summary: The Corosync Cluster Engine Libraries +Group: System Environment/Libraries +Conflicts: corosync < 0.92-7 + +%description -n libcorosync +This package contains corosync libraries. + +%files -n libcorosync +%defattr(-,root,root,-) %dir %{_libdir}/corosync +%config(noreplace) /etc/ld.so.conf.d/corosync-*.conf %{_libdir}/corosync/libcfg.so.* %{_libdir}/corosync/libcpg.so.* %{_libdir}/corosync/libconfdb.so.* @@ -102,14 +115,15 @@ fi %{_libdir}/corosync/libcoroutil.so.* %{_libdir}/corosync/libquorum.so.* %{_libdir}/corosync/libvotequorum.so.* -%{_mandir}/man8/corosync_overview.8* -%{_mandir}/man8/corosync-objctl.8* -%{_mandir}/man5/corosync.conf.5* + +%post -n libcorosync -p /sbin/ldconfig + +%postun -n libcorosync -p /sbin/ldconfig %package -n libcorosync-devel Summary: The Corosync Cluster Engine Development Kit Group: Development/Libraries -Requires: %{name} = %{version}-%{release} +Requires: libcorosync = %{version}-%{release} Requires: pkgconfig Provides: corosync-devel = 0.92-7 Obsoletes: corosync-devel < 0.92-7 @@ -176,6 +190,7 @@ The Corosync Cluster Engine APIs. - Update to svn trunk at revision 1756 from upstream. - Add support pkgconfig to devel package. - Tidy up spec files by re-organazing sections according to packages. +- Split libraries from corosync to libcorosync. - Rename corosync-devel to libcorosync-devel. * Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 From 9204530604145574071f9069e30e156ea0238dc0 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 2 Feb 2009 10:23:29 +0000 Subject: [PATCH 010/185] whoops ... libcorosync* -> corosynclib* --- corosync.spec | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/corosync.spec b/corosync.spec index 1aa3dc8..1a17544 100644 --- a/corosync.spec +++ b/corosync.spec @@ -11,7 +11,7 @@ Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/cor Patch0: corosync-trunk.diff # Runtime bits -Requires: libcorosync = %{version}-%{release} +Requires: corosynclib = %{version}-%{release} Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig @@ -94,15 +94,15 @@ fi %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* -%package -n libcorosync +%package -n corosynclib Summary: The Corosync Cluster Engine Libraries Group: System Environment/Libraries Conflicts: corosync < 0.92-7 -%description -n libcorosync +%description -n corosynclib This package contains corosync libraries. -%files -n libcorosync +%files -n corosynclib %defattr(-,root,root,-) %dir %{_libdir}/corosync %config(noreplace) /etc/ld.so.conf.d/corosync-*.conf @@ -116,23 +116,23 @@ This package contains corosync libraries. %{_libdir}/corosync/libquorum.so.* %{_libdir}/corosync/libvotequorum.so.* -%post -n libcorosync -p /sbin/ldconfig +%post -n corosynclib -p /sbin/ldconfig -%postun -n libcorosync -p /sbin/ldconfig +%postun -n corosynclib -p /sbin/ldconfig -%package -n libcorosync-devel +%package -n corosynclib-devel Summary: The Corosync Cluster Engine Development Kit Group: Development/Libraries -Requires: libcorosync = %{version}-%{release} +Requires: corosynclib = %{version}-%{release} Requires: pkgconfig Provides: corosync-devel = 0.92-7 Obsoletes: corosync-devel < 0.92-7 -%description -n libcorosync-devel +%description -n corosynclib-devel This package contains include files and man pages used to develop using The Corosync Cluster Engine APIs. -%files -n libcorosync-devel +%files -n corosynclib-devel %defattr(-,root,root,-) %dir %{_docdir}/%{name}-%{version} %doc %{_docdir}/%{name}-%{version}/README.devmap @@ -190,8 +190,8 @@ The Corosync Cluster Engine APIs. - Update to svn trunk at revision 1756 from upstream. - Add support pkgconfig to devel package. - Tidy up spec files by re-organazing sections according to packages. -- Split libraries from corosync to libcorosync. -- Rename corosync-devel to libcorosync-devel. +- Split libraries from corosync to corosynclib. +- Rename corosync-devel to corosynclib-devel. * Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 - Update to svn trunk at revision 1750 from upstream. From e1cb4834de89a609e0d9ae96e73eb80576b47fae Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 2 Feb 2009 11:15:07 +0000 Subject: [PATCH 011/185] Update changelog --- corosync.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/corosync.spec b/corosync.spec index 1a17544..b6ce1ec 100644 --- a/corosync.spec +++ b/corosync.spec @@ -192,6 +192,7 @@ The Corosync Cluster Engine APIs. - Tidy up spec files by re-organazing sections according to packages. - Split libraries from corosync to corosynclib. - Rename corosync-devel to corosynclib-devel. +- Comply with multiarch requirements (libraries). * Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 - Update to svn trunk at revision 1750 from upstream. From 3a05a3cceced54bb974ce4dbc4be19e29f90ab15 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Thu, 19 Feb 2009 08:56:09 +0000 Subject: [PATCH 012/185] New upstream release --- .cvsignore | 2 +- corosync-trunk.diff | 22706 ------------------------------------------ corosync.spec | 19 +- gcc-44-fix.diff | 15 + sources | 2 +- 5 files changed, 30 insertions(+), 22714 deletions(-) delete mode 100644 corosync-trunk.diff create mode 100644 gcc-44-fix.diff diff --git a/.cvsignore b/.cvsignore index 6877867..ef58238 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-0.92.tar.gz +corosync-0.93.tar.gz diff --git a/corosync-trunk.diff b/corosync-trunk.diff deleted file mode 100644 index 8018dc6..0000000 --- a/corosync-trunk.diff +++ /dev/null @@ -1,22706 +0,0 @@ -diff -Naurd corosync-0.92/exec/apidef.c corosync-trunk/exec/apidef.c ---- corosync-0.92/exec/apidef.c 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/exec/apidef.c 2008-12-08 16:55:41.000000000 +0100 -@@ -46,6 +46,7 @@ - #include "main.h" - #include "ipc.h" - #include "sync.h" -+#include "quorum.h" - #include - #include "service.h" - #include -@@ -55,11 +56,16 @@ - /* - * Remove compile warnings about type name changes - */ --typedef int (*typedef_tpg_join) (corosync_tpg_handle, struct corosync_tpg_group *, int); --typedef int (*typedef_tpg_leave) (corosync_tpg_handle, struct corosync_tpg_group *, int); --typedef int (*typedef_tpg_groups_mcast) (corosync_tpg_handle, int, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); --typedef int (*typedef_tpg_groups_send_ok) (corosync_tpg_handle, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); -+typedef int (*typedef_tpg_join) (cs_tpg_handle, struct corosync_tpg_group *, int); -+typedef int (*typedef_tpg_leave) (cs_tpg_handle, struct corosync_tpg_group *, int); -+typedef int (*typedef_tpg_groups_mcast) (cs_tpg_handle, int, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); -+typedef int (*typedef_tpg_groups_send_ok) (cs_tpg_handle, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); - -+static inline void _corosync_public_exit_error ( -+ cs_fatal_error_t err, const char *file, unsigned int line) -+{ -+ _corosync_exit_error (err, file, line); -+} - - static struct corosync_api_v1 apidef_corosync_api_v1 = { - .timer_add_duration = corosync_timer_add_duration, -@@ -68,16 +74,16 @@ - .timer_time_get = NULL, - .ipc_source_set = message_source_set, - .ipc_source_is_local = message_source_is_local, -- .ipc_private_data_get = corosync_conn_private_data_get, -+ .ipc_private_data_get = cs_conn_private_data_get, - .ipc_response_send = NULL, -- .ipc_response_no_fcc = corosync_conn_send_response_no_fcc, -+ .ipc_response_no_fcc = cs_conn_send_response_no_fcc, - .ipc_dispatch_send = NULL, -- .ipc_conn_send_response = corosync_conn_send_response, -- .ipc_conn_partner_get = corosync_conn_partner_get, -- .ipc_refcnt_inc = corosync_ipc_flow_control_local_increment, -- .ipc_refcnt_dec = corosync_ipc_flow_control_local_decrement, -- .ipc_fc_create = corosync_ipc_flow_control_create, -- .ipc_fc_destroy = corosync_ipc_flow_control_destroy, -+ .ipc_conn_send_response = cs_conn_send_response, -+ .ipc_conn_partner_get = cs_conn_partner_get, -+ .ipc_refcnt_inc = cs_ipc_flow_control_local_increment, -+ .ipc_refcnt_dec = cs_ipc_flow_control_local_decrement, -+ .ipc_fc_create = cs_ipc_flow_control_create, -+ .ipc_fc_destroy = cs_ipc_flow_control_destroy, - .totem_nodeid_get = totempg_my_nodeid_get, - .totem_family_get = totempg_my_family_get, - .totem_ring_reenable = totempg_ring_reenable, -@@ -86,6 +92,7 @@ - .totem_ifaces_get = totempg_ifaces_get, - .totem_ifaces_print = totempg_ifaces_print, - .totem_ip_print = totemip_print, -+ .totem_callback_token_create = totempg_callback_token_create, - .tpg_init = totempg_groups_initialize, - .tpg_exit = NULL, /* missing from totempg api */ - .tpg_join = (typedef_tpg_join)totempg_groups_join, -@@ -95,12 +102,16 @@ - .tpg_groups_mcast = (typedef_tpg_groups_mcast)totempg_groups_mcast_groups, - .tpg_groups_send_ok = (typedef_tpg_groups_send_ok)totempg_groups_send_ok_groups, - .sync_request = sync_request, -+ .quorum_is_quorate = corosync_quorum_is_quorate, -+ .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_exit_error -+ .fatal_error = _corosync_public_exit_error - }; - - void apidef_init (struct objdb_iface_ver0 *objdb) { -diff -Naurd corosync-0.92/exec/coropoll.c corosync-trunk/exec/coropoll.c ---- corosync-0.92/exec/coropoll.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/coropoll.c 2009-01-20 18:59:10.000000000 +0100 -@@ -59,6 +59,7 @@ - struct timerlist timerlist; - void (*serialize_lock_fn) (void); - void (*serialize_unlock_fn) (void); -+ int stop_requested; - }; - - /* -@@ -92,6 +93,7 @@ - poll_instance->poll_entries = 0; - poll_instance->ufds = 0; - poll_instance->poll_entry_count = 0; -+ poll_instance->stop_requested = 0; - poll_instance->serialize_lock_fn = serialize_lock_fn; - poll_instance->serialize_unlock_fn = serialize_unlock_fn; - timerlist_init (&poll_instance->timerlist); -@@ -291,18 +293,18 @@ - struct poll_instance *poll_instance; - int res = 0; - -+ if (timer_handle_out == NULL) { -+ res -ENOENT; -+ goto error_exit; -+ } -+ - res = hdb_handle_get (&poll_instance_database, handle, - (void *)&poll_instance); - if (res != 0) { - res = -ENOENT; -- - goto error_exit; - } - -- if (timer_handle_out == 0) { -- res = -ENOENT; -- } -- - timerlist_add_duration (&poll_instance->timerlist, - timer_fn, data, ((unsigned long long)msec_duration) * 1000000ULL, timer_handle_out); - -@@ -336,6 +338,27 @@ - return (res); - } - -+int poll_stop ( -+ poll_handle handle) -+{ -+ struct poll_instance *poll_instance; -+ unsigned int res; -+ -+ res = hdb_handle_get (&poll_instance_database, handle, -+ (void *)&poll_instance); -+ if (res != 0) { -+ res = -ENOENT; -+ goto error_exit; -+ } -+ -+ poll_instance->stop_requested = 1; -+ -+ hdb_handle_put (&poll_instance_database, handle); -+error_exit: -+ return (res); -+} -+ -+ - int poll_run ( - poll_handle handle) - { -@@ -366,6 +389,10 @@ - retry_poll: - res = poll (poll_instance->ufds, - poll_instance->poll_entry_count, expire_timeout_msec); -+ if (poll_instance->stop_requested) { -+ printf ("poll should stop\n"); -+ return (0); -+ } - if (errno == EINTR && res == -1) { - goto retry_poll; - } else -@@ -403,9 +430,6 @@ - return (-1); - } - --int poll_stop ( -- poll_handle handle); -- - #ifdef COMPILE_OUT - void poll_print_state ( - poll_handle handle, -diff -Naurd corosync-0.92/exec/crypto.c corosync-trunk/exec/crypto.c ---- corosync-0.92/exec/crypto.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/exec/crypto.c 2009-01-26 21:22:28.000000000 +0100 -@@ -20,13 +20,14 @@ - #endif - #include - #include -+#include - - #include "crypto.h" - - #define CONST64(n) n ## ULL - --typedef unsigned long ulong32; --typedef unsigned long long ulong64; -+typedef uint32_t ulong32; -+typedef uint64_t ulong64; - - #if __BYTE_ORDER == __LITTLE_ENDIAN - #define ENDIAN_LITTLE -@@ -41,10 +42,10 @@ - #endif - - #if defined(COROSYNC_LINUX) --#if __WORDIZE == 64 -+#if __WORDSIZE == 64 - #define ENDIAN_64BITWORD - #endif --#if __WORDIZE == 32 -+#if __WORDSIZE == 32 - #define ENDIAN_32BITWORD - #endif - #else -@@ -844,7 +845,7 @@ - assert ((len & 3) == 0); - - for (i = 0; i < len; i += 4) { -- k = BYTE2WORD((unsigned char *)&buf[i]); -+ k = BYTE2WORD((unsigned char*)&buf[i]); - ADDKEY(k); - cycle(c->R); - XORNL(nltap(c)); -@@ -1250,11 +1251,11 @@ - void (*callback)(void)) - { - int fd; -- int rb; -+ unsigned long rb; - - fd = open ("/dev/urandom", O_RDONLY); - -- rb = read (fd, buf, len); -+ rb = (unsigned long)read (fd, buf, len); - - close (fd); - -diff -Naurd corosync-0.92/exec/crypto.h corosync-trunk/exec/crypto.h ---- corosync-0.92/exec/crypto.h 2004-09-15 22:20:07.000000000 +0200 -+++ corosync-trunk/exec/crypto.h 2009-01-26 21:22:28.000000000 +0100 -@@ -1,6 +1,8 @@ - #ifndef CRYPTO_H_DEFINED - #define CRYPTO_H_DEFINED - -+#include -+ - #define DIGEST_SHA1 0 - #define PRNG_SOBER 0 - -@@ -88,7 +90,7 @@ - unsigned char *dst, unsigned long *dstlen); - - struct sober128_prng { -- unsigned long R[17], /* Working storage for the shift register */ -+ uint32_t R[17], /* Working storage for the shift register */ - initR[17], /* saved register contents */ - konst, /* key dependent constant */ - sbuf; /* partial word encryption buffer */ -diff -Naurd corosync-0.92/exec/flow.c corosync-trunk/exec/flow.c ---- corosync-0.92/exec/flow.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/flow.c 2008-11-06 22:49:07.000000000 +0100 -@@ -34,9 +34,9 @@ - - /* - * New messages are allowed from the library ONLY when the processor has not -- * received a COROSYNC_FLOW_CONTROL_STATE_ENABLED from any processor. If a -- * COROSYNC_FLOW_CONTROL_STATE_ENABLED message is sent, it must later be -- * cancelled by a COROSYNC_FLOW_CONTROL_STATE_DISABLED message. A configuration -+ * received a CS_FLOW_CONTROL_STATE_ENABLED from any processor. If a -+ * CS_FLOW_CONTROL_STATE_ENABLED message is sent, it must later be -+ * cancelled by a CS_FLOW_CONTROL_STATE_DISABLED message. A configuration - * change with the flow controlled processor leaving the configuration will - * also cancel flow control. - */ -@@ -68,12 +68,12 @@ - unsigned int service __attribute__((aligned(8))); - char id[1024] __attribute__((aligned(8))); - unsigned int id_len __attribute__((aligned(8))); -- enum corosync_flow_control_state flow_control_state __attribute__((aligned(8))); -+ enum cs_flow_control_state flow_control_state __attribute__((aligned(8))); - }; - - struct flow_control_node_state { - unsigned int nodeid; -- enum corosync_flow_control_state flow_control_state; -+ enum cs_flow_control_state flow_control_state; - }; - - struct flow_control_service { -@@ -81,10 +81,10 @@ - unsigned int service; - char id[1024]; - unsigned int id_len; -- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state); -+ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state); - void *context; - unsigned int processor_count; -- enum corosync_flow_control_state flow_control_state; -+ enum cs_flow_control_state flow_control_state; - struct list_head list; - struct list_head list_all; - }; -@@ -108,7 +108,7 @@ - - static inline int flow_control_xmit ( - struct flow_control_service *flow_control_service, -- enum corosync_flow_control_state flow_control_state) -+ enum cs_flow_control_state flow_control_state) - { - struct flow_control_message flow_control_message; - struct iovec iovec; -@@ -165,11 +165,11 @@ - * Determine if any flow control is enabled on any nodes and set - * the internal variable appropriately - */ -- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; -+ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; - flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state); - for (i = 0; i < flow_control_service->processor_count; i++) { -- if (flow_control_service->flow_control_node_state[i].flow_control_state == COROSYNC_FLOW_CONTROL_STATE_ENABLED) { -- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED; -+ if (flow_control_service->flow_control_node_state[i].flow_control_state == CS_FLOW_CONTROL_STATE_ENABLED) { -+ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_ENABLED; - flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state); - } - } -@@ -204,7 +204,7 @@ - */ - for (i = 0; i < member_list_entries; i++) { - flow_control_node_state_temp[i].nodeid = member_list[i]; -- flow_control_node_state_temp[i].flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; -+ flow_control_node_state_temp[i].flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; - - /* - * Determine if previous state was set for this processor -@@ -231,10 +231,10 @@ - * Turn on all flow control after a configuration change - */ - flow_control_service->processor_count = flow_control_member_list_entries; -- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; -+ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; - for (i = 0; i < member_list_entries; i++) { -- if (flow_control_service->flow_control_node_state[i].flow_control_state == COROSYNC_FLOW_CONTROL_STATE_ENABLED) { -- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED; -+ if (flow_control_service->flow_control_node_state[i].flow_control_state == CS_FLOW_CONTROL_STATE_ENABLED) { -+ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_ENABLED; - flow_control_service->flow_control_state_set_fn (flow_control_service->context, flow_control_service->flow_control_state); - } - } -@@ -244,7 +244,7 @@ - /* - * External API - */ --unsigned int corosync_flow_control_initialize (void) -+unsigned int cs_flow_control_initialize (void) - { - unsigned int res; - -@@ -271,7 +271,7 @@ - return (0); - } - --unsigned int corosync_flow_control_ipc_init ( -+unsigned int cs_flow_control_ipc_init ( - unsigned int *flow_control_handle, - unsigned int service) - { -@@ -301,19 +301,19 @@ - - } - --unsigned int corosync_flow_control_ipc_exit ( -+unsigned int cs_flow_control_ipc_exit ( - unsigned int flow_control_handle) - { - hdb_handle_destroy (&flow_control_hdb, flow_control_handle); - return (0); - } - --unsigned int corosync_flow_control_create ( -+unsigned int cs_flow_control_create ( - unsigned int flow_control_handle, - unsigned int service, - void *id, - unsigned int id_len, -- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state), -+ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state), - void *context) - { - struct flow_control_service *flow_control_service; -@@ -337,7 +337,7 @@ - */ - memset (flow_control_service, 0, sizeof (struct flow_control_service)); - -- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; -+ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; - flow_control_service->service = service; - memcpy (flow_control_service->id, id, id_len); - flow_control_service->id_len = id_len; -@@ -363,7 +363,7 @@ - return (res); - } - --unsigned int corosync_flow_control_destroy ( -+unsigned int cs_flow_control_destroy ( - unsigned int flow_control_identifier, - unsigned int service, - unsigned char *id, -@@ -389,7 +389,7 @@ - if ((flow_control_service->id_len == id_len) && - (memcmp (flow_control_service->id, id, id_len) == 0)) { - flow_control_xmit (flow_control_service, -- COROSYNC_FLOW_CONTROL_STATE_DISABLED); -+ CS_FLOW_CONTROL_STATE_DISABLED); - list_del (&flow_control_service->list); - list_del (&flow_control_service->list_all); - free (flow_control_service); -@@ -406,7 +406,7 @@ - * Disable the ability for new messages to be sent for this service - * with the handle id of length id_len - */ --unsigned int corosync_flow_control_disable ( -+unsigned int cs_flow_control_disable ( - unsigned int flow_control_handle) - { - struct flow_control_instance *instance; -@@ -425,8 +425,8 @@ - list = list->next) { - - flow_control_service = list_entry (list, struct flow_control_service, list); -- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_DISABLED; -- flow_control_xmit (flow_control_service, COROSYNC_FLOW_CONTROL_STATE_DISABLED); -+ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_DISABLED; -+ flow_control_xmit (flow_control_service, CS_FLOW_CONTROL_STATE_DISABLED); - } - hdb_handle_put (&flow_control_hdb, flow_control_handle); - -@@ -438,7 +438,7 @@ - * Enable the ability for new messagess to be sent for this service - * with the handle id of length id_len - */ --unsigned int corosync_flow_control_enable ( -+unsigned int cs_flow_control_enable ( - unsigned int flow_control_handle) - { - struct flow_control_instance *instance; -@@ -458,8 +458,8 @@ - - - flow_control_service = list_entry (list, struct flow_control_service, list); -- flow_control_service->flow_control_state = COROSYNC_FLOW_CONTROL_STATE_ENABLED; -- flow_control_xmit (flow_control_service, COROSYNC_FLOW_CONTROL_STATE_ENABLED); -+ flow_control_service->flow_control_state = CS_FLOW_CONTROL_STATE_ENABLED; -+ flow_control_xmit (flow_control_service, CS_FLOW_CONTROL_STATE_ENABLED); - } - hdb_handle_put (&flow_control_hdb, flow_control_handle); - -diff -Naurd corosync-0.92/exec/flow.h corosync-trunk/exec/flow.h ---- corosync-0.92/exec/flow.h 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/flow.h 2008-11-06 22:49:07.000000000 +0100 -@@ -37,38 +37,38 @@ - #define FLOW_H_DEFINED - - #define COROSYNC_FLOW_CONTROL_STATE --enum corosync_flow_control_state { -- COROSYNC_FLOW_CONTROL_STATE_DISABLED, -- COROSYNC_FLOW_CONTROL_STATE_ENABLED -+enum cs_flow_control_state { -+ CS_FLOW_CONTROL_STATE_DISABLED, -+ CS_FLOW_CONTROL_STATE_ENABLED - }; - --unsigned int corosync_flow_control_initialize (void); -+unsigned int cs_flow_control_initialize (void); - --unsigned int corosync_flow_control_ipc_init ( -+unsigned int cs_flow_control_ipc_init ( - unsigned int *flow_control_identifier, - unsigned int service); - --unsigned int corosync_flow_control_ipc_exit ( -+unsigned int cs_flow_control_ipc_exit ( - unsigned int flow_control_identifier); - --unsigned int corosync_flow_control_create ( -+unsigned int cs_flow_control_create ( - unsigned int flow_control_handle, - unsigned int service, - void *id, - unsigned int id_len, -- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state), -+ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state), - void *context); - --unsigned int corosync_flow_control_destroy ( -+unsigned int cs_flow_control_destroy ( - unsigned int flow_control_identifier, - unsigned int service, - unsigned char *id, - unsigned int id_len); - --unsigned int corosync_flow_control_disable ( -+unsigned int cs_flow_control_disable ( - unsigned int flow_control_identifier); - --unsigned int corosync_flow_control_enable ( -+unsigned int cs_flow_control_enable ( - unsigned int flow_control_identifier); - - #endif /* FLOW_H_DEFINED */ -diff -Naurd corosync-0.92/exec/ipc.c corosync-trunk/exec/ipc.c ---- corosync-0.92/exec/ipc.c 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/exec/ipc.c 2008-12-28 10:25:17.000000000 +0100 -@@ -62,7 +62,7 @@ - #endif - - #include --#include -+#include - #include - #include - #include -@@ -72,6 +72,7 @@ - #include - #include - -+#include "quorum.h" - #include "poll.h" - #include "totemsrp.h" - #include "mempool.h" -@@ -153,7 +154,7 @@ - unsigned int flow_control_handle; /* flow control identifier */ - unsigned int flow_control_enabled; /* flow control enabled bit */ - unsigned int flow_control_local_count; /* flow control local count */ -- enum corosync_lib_flow_control flow_control; /* Does this service use IPC flow control */ -+ enum cs_lib_flow_control flow_control; /* Does this service use IPC flow control */ - pthread_mutex_t flow_control_mutex; - int (*lib_exit_fn) (void *conn); - struct timerlist timerlist; -@@ -193,26 +194,26 @@ - struct conn_info *conn_info, - void *message) - { -- SaAisErrorT error = SA_AIS_ERR_ACCESS; -+ cs_error_t error = CS_ERR_ACCESS; - uintptr_t cinfo = (uintptr_t)conn_info; - mar_req_lib_response_init_t *req_lib_response_init = (mar_req_lib_response_init_t *)message; - mar_res_lib_response_init_t res_lib_response_init; - - if (conn_info->authenticated) { - conn_info->service = req_lib_response_init->resdis_header.service; -- error = SA_AIS_OK; -+ error = CS_OK; - } - res_lib_response_init.header.size = sizeof (mar_res_lib_response_init_t); - res_lib_response_init.header.id = MESSAGE_RES_INIT; - res_lib_response_init.header.error = error; - res_lib_response_init.conn_info = (mar_uint64_t)cinfo; - -- corosync_conn_send_response ( -+ cs_conn_send_response ( - conn_info, - &res_lib_response_init, - sizeof (res_lib_response_init)); - -- if (error == SA_AIS_ERR_ACCESS) { -+ if (error == CS_ERR_ACCESS) { - libais_disconnect_security (conn_info); - return (-1); - } -@@ -223,7 +224,7 @@ - struct conn_info *conn_info, - void *message) - { -- SaAisErrorT error = SA_AIS_ERR_ACCESS; -+ cs_error_t error = CS_ERR_ACCESS; - uintptr_t cinfo; - mar_req_lib_dispatch_init_t *req_lib_dispatch_init = (mar_req_lib_dispatch_init_t *)message; - mar_res_lib_dispatch_init_t res_lib_dispatch_init; -@@ -232,9 +233,9 @@ - if (conn_info->authenticated) { - conn_info->service = req_lib_dispatch_init->resdis_header.service; - if (!ais_service[req_lib_dispatch_init->resdis_header.service]) -- error = SA_AIS_ERR_NOT_SUPPORTED; -+ error = CS_ERR_NOT_SUPPORTED; - else -- error = SA_AIS_OK; -+ error = CS_OK; - - cinfo = (uintptr_t)req_lib_dispatch_init->conn_info; - conn_info->conn_info_partner = (struct conn_info *)cinfo; -@@ -252,7 +253,7 @@ - msg_conn_info = (struct conn_info *)cinfo; - msg_conn_info->conn_info_partner = conn_info; - -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - int private_data_size; - - private_data_size = ais_service[req_lib_dispatch_init->resdis_header.service]->private_data_size; -@@ -261,7 +262,7 @@ - - conn_info->conn_info_partner->private_data = conn_info->private_data; - if (conn_info->private_data == NULL) { -- error = SA_AIS_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - } else { - memset (conn_info->private_data, 0, private_data_size); - } -@@ -276,16 +277,16 @@ - res_lib_dispatch_init.header.id = MESSAGE_RES_INIT; - res_lib_dispatch_init.header.error = error; - -- corosync_conn_send_response ( -+ cs_conn_send_response ( - conn_info, - &res_lib_dispatch_init, - sizeof (res_lib_dispatch_init)); - -- if (error == SA_AIS_ERR_ACCESS) { -+ if (error == CS_ERR_ACCESS) { - libais_disconnect_security (conn_info); - return (-1); - } -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (-1); - } - -@@ -296,8 +297,8 @@ - - conn_info->flow_control = ais_service[conn_info->service]->flow_control; - conn_info->conn_info_partner->flow_control = ais_service[conn_info->service]->flow_control; -- if (ais_service[conn_info->service]->flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) { -- corosync_flow_control_ipc_init ( -+ if (ais_service[conn_info->service]->flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) { -+ cs_flow_control_ipc_init ( - &conn_info->flow_control_handle, - conn_info->service); - -@@ -448,7 +449,7 @@ - conn_info->state = CONN_STATE_DISCONNECTED; - conn_info->conn_info_partner->state = CONN_STATE_DISCONNECTED; - if (conn_info->flow_control_enabled == 1) { -- corosync_flow_control_disable (conn_info->flow_control_handle); -+ cs_flow_control_disable (conn_info->flow_control_handle); - } - return (0); - } -@@ -486,6 +487,7 @@ - struct sched_param sched_param; - int res; - pthread_mutex_t *rel_mutex; -+ pthread_mutex_t *rel2_mutex; - unsigned int service; - struct conn_info *cinfo_partner; - void *private_data; -@@ -523,11 +525,12 @@ - - case CONN_STATE_DISCONNECTED: - rel_mutex = conn_info->shared_mutex; -+ rel2_mutex = &conn_info->mutex; - private_data = conn_info->private_data; - cinfo_partner = conn_info->conn_info_partner; - conn_info_destroy (conn); - if (service == SOCKET_SERVICE_INIT) { -- pthread_mutex_unlock (&conn_info->mutex); -+ pthread_mutex_unlock (rel2_mutex); - } else { - pthread_mutex_unlock (rel_mutex); - } -@@ -633,34 +636,37 @@ - /* - * IPC group-wide flow control - */ -- if (conn_info->flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) { -+ if (conn_info->flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) { - if (conn_info->flow_control_enabled == 0 && - ((fcc + FLOW_CONTROL_ENTRIES_ENABLE) > SIZEQUEUE)) { - - log_printf (LOG_LEVEL_NOTICE, "Enabling flow control [%d/%d] - [%d].\n", - entries_usedhw, SIZEQUEUE, - flow_control_local_count); -- corosync_flow_control_enable (conn_info->flow_control_handle); -+ cs_flow_control_enable (conn_info->flow_control_handle); - conn_info->flow_control_enabled = 1; -- conn_info->conn_info_partner->flow_control_enabled = 1; -+ if (conn_info->conn_info_partner) { -+ conn_info->conn_info_partner->flow_control_enabled = 1; -+ } - } - if (conn_info->flow_control_enabled == 1 && -- - fcc <= FLOW_CONTROL_ENTRIES_DISABLE) { - - log_printf (LOG_LEVEL_NOTICE, "Disabling flow control [%d/%d] - [%d].\n", - entries_usedhw, SIZEQUEUE, - flow_control_local_count); -- corosync_flow_control_disable (conn_info->flow_control_handle); -+ cs_flow_control_disable (conn_info->flow_control_handle); - conn_info->flow_control_enabled = 0; -- conn_info->conn_info_partner->flow_control_enabled = 0; -+ if (conn_info->conn_info_partner) { -+ conn_info->conn_info_partner->flow_control_enabled = 0; -+ } - } - } - } - - static int conn_info_outq_flush (struct conn_info *conn_info) { - struct queue *outq; -- int res = 0; -+ ssize_t res = 0; - struct outq_item *queue_item; - struct msghdr msg_send; - struct iovec iov_send; -@@ -731,14 +737,15 @@ - - - --struct res_overlay { -+struct ipc_res_overlay { - mar_res_header_t header __attribute((aligned(8))); - char buf[4096]; - }; - - static void libais_deliver (struct conn_info *conn_info) - { -- int res; -+ ssize_t res; -+ int dispatch_res; - mar_req_header_t *header; - int service; - struct msghdr msg_recv; -@@ -752,7 +759,7 @@ - int send_ok = 0; - int send_ok_joined = 0; - struct iovec send_ok_joined_iovec; -- struct res_overlay res_overlay; -+ struct ipc_res_overlay res_overlay; - - msg_recv.msg_iov = &iov_recv; - msg_recv.msg_iovlen = 1; -@@ -841,7 +848,7 @@ - #ifdef COROSYNC_LINUX - if (conn_info->authenticated == 0) { - cmsg = CMSG_FIRSTHDR (&msg_recv); -- assert (cmsg); -+ assert (cmsg != NULL); - cred = (struct ucred *)CMSG_DATA (cmsg); - if (cred) { - if (cred->uid == 0 || cred->gid == g_gid_valid) { -@@ -861,7 +868,8 @@ - conn_info->inb_inuse += res; - conn_info->inb_start += res; - -- while (conn_info->inb_inuse >= sizeof (mar_req_header_t) && res != -1) { -+ dispatch_res = 0; -+ while (conn_info->inb_inuse >= sizeof (mar_req_header_t) && dispatch_res != -1) { - header = (mar_req_header_t *)&conn_info->inb[conn_info->inb_start - conn_info->inb_inuse]; - - if (header->size > conn_info->inb_inuse) { -@@ -874,7 +882,7 @@ - * else handle message using service service - */ - if (service == SOCKET_SERVICE_INIT) { -- res = ais_init_service[header->id] (conn_info, header); -+ dispatch_res = ais_init_service[header->id] (conn_info, header); - } else { - /* - * Not an init service, but a standard service -@@ -897,11 +905,11 @@ - &send_ok_joined_iovec, 1); - - send_ok = -- (sync_primary_designated() == 1) && ( -- (ais_service[service]->lib_engine[header->id].flow_control == COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED) || -- ((ais_service[service]->lib_engine[header->id].flow_control == COROSYNC_LIB_FLOW_CONTROL_REQUIRED) && -+ (corosync_quorum_is_quorate() == 1 || ais_service[service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) && ( -+ (ais_service[service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) || -+ ((ais_service[service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) && - (send_ok_joined) && -- (sync_in_process() == 0))); -+ (sync_in_process() == 0))); - - if (send_ok) { - ais_service[service]->lib_engine[header->id].lib_handler_fn(conn_info, header); -@@ -914,8 +922,8 @@ - ais_service[service]->lib_engine[header->id].response_size; - res_overlay.header.id = - ais_service[service]->lib_engine[header->id].response_id; -- res_overlay.header.error = SA_AIS_ERR_TRY_AGAIN; -- corosync_conn_send_response ( -+ res_overlay.header.error = CS_ERR_TRY_AGAIN; -+ cs_conn_send_response ( - conn_info, - &res_overlay, - res_overlay.header.size); -@@ -1030,7 +1038,7 @@ - { - } - --void corosync_ipc_init ( -+void cs_ipc_init ( - void (*serialize_lock_fn) (void), - void (*serialize_unlock_fn) (void), - unsigned int gid_valid) -@@ -1102,7 +1110,7 @@ - /* - * Get the conn info private data - */ --void *corosync_conn_private_data_get (void *conn) -+void *cs_conn_private_data_get (void *conn) - { - struct conn_info *conn_info = (struct conn_info *)conn; - -@@ -1116,7 +1124,7 @@ - /* - * Get the conn info partner connection - */ --void *corosync_conn_partner_get (void *conn) -+void *cs_conn_partner_get (void *conn) - { - struct conn_info *conn_info = (struct conn_info *)conn; - -@@ -1127,25 +1135,27 @@ - } - } - --int corosync_conn_send_response_no_fcc ( -+int cs_conn_send_response_no_fcc ( - void *conn, - void *msg, - int mlen) - { -+ int ret; - dont_call_flow_control = 1; -- corosync_conn_send_response ( -+ ret = cs_conn_send_response ( - conn, msg, mlen); - dont_call_flow_control = 0; -+ return ret; - } - --int corosync_conn_send_response ( -+int cs_conn_send_response ( - void *conn, - void *msg, - int mlen) - { - struct queue *outq; - char *cmsg; -- int res = 0; -+ ssize_t res = 0; - int queue_empty; - struct outq_item *queue_item; - struct outq_item queue_item_out; -@@ -1282,17 +1292,17 @@ - return (0); - } - --void corosync_ipc_flow_control_create ( -+void cs_ipc_flow_control_create ( - void *conn, - unsigned int service, - char *id, - int id_len, -- void (*flow_control_state_set_fn) (void *conn, enum corosync_flow_control_state), -+ void (*flow_control_state_set_fn) (void *conn, enum cs_flow_control_state), - void *context) - { - struct conn_info *conn_info = (struct conn_info *)conn; - -- corosync_flow_control_create ( -+ cs_flow_control_create ( - conn_info->flow_control_handle, - service, - id, -@@ -1302,7 +1312,7 @@ - conn_info->conn_info_partner->flow_control_handle = conn_info->flow_control_handle; - } - --void corosync_ipc_flow_control_destroy ( -+void cs_ipc_flow_control_destroy ( - void *conn, - unsigned int service, - unsigned char *id, -@@ -1310,14 +1320,14 @@ - { - struct conn_info *conn_info = (struct conn_info *)conn; - -- corosync_flow_control_destroy ( -+ cs_flow_control_destroy ( - conn_info->flow_control_handle, - service, - id, - id_len); - } - --void corosync_ipc_flow_control_local_increment ( -+void cs_ipc_flow_control_local_increment ( - void *conn) - { - struct conn_info *conn_info = (struct conn_info *)conn; -@@ -1329,7 +1339,7 @@ - pthread_mutex_unlock (&conn_info->flow_control_mutex); - } - --void corosync_ipc_flow_control_local_decrement ( -+void cs_ipc_flow_control_local_decrement ( - void *conn) - { - struct conn_info *conn_info = (struct conn_info *)conn; -diff -Naurd corosync-0.92/exec/ipc.h corosync-trunk/exec/ipc.h ---- corosync-0.92/exec/ipc.h 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/exec/ipc.h 2008-11-06 22:49:07.000000000 +0100 -@@ -46,52 +46,52 @@ - - extern int message_source_is_local (mar_message_source_t *source); - --extern void *corosync_conn_partner_get (void *conn); -+extern void *cs_conn_partner_get (void *conn); - --extern void *corosync_conn_private_data_get (void *conn); -+extern void *cs_conn_private_data_get (void *conn); - --extern int corosync_conn_send_response (void *conn, void *msg, int mlen); -+extern int cs_conn_send_response (void *conn, void *msg, int mlen); - --extern int corosync_conn_send_response_no_fcc (void *conn, void *msg,int mlen); -+extern int cs_conn_send_response_no_fcc (void *conn, void *msg,int mlen); - --extern void corosync_ipc_init ( -+extern void cs_ipc_init ( - void (*serialize_lock_fn) (void), - void (*serialize_unlock_fn) (void), - unsigned int gid_valid); - --extern int corosync_ipc_timer_add ( -+extern int cs_ipc_timer_add ( - void *conn, - void (*timer_fn) (void *data), - void *data, - unsigned int msec_in_future, - timer_handle *handle); - --extern void corosync_ipc_timer_del ( -+extern void cs_ipc_timer_del ( - void *conn, - timer_handle timer_handle); - --extern void corosync_ipc_timer_del_data ( -+extern void cs_ipc_timer_del_data ( - void *conn, - timer_handle timer_handle); - --extern void corosync_ipc_flow_control_create ( -+extern void cs_ipc_flow_control_create ( - void *conn, - unsigned int service, - char *id, - int id_len, -- void (*flow_control_state_set_fn) (void *context, enum corosync_flow_control_state flow_control_state_set), -+ void (*flow_control_state_set_fn) (void *context, enum cs_flow_control_state flow_control_state_set), - void *context); - --extern void corosync_ipc_flow_control_destroy ( -+extern void cs_ipc_flow_control_destroy ( - void *conn, - unsigned int service, - unsigned char *id, - int id_len); - --extern void corosync_ipc_flow_control_local_increment ( -+extern void cs_ipc_flow_control_local_increment ( - void *conn); - --extern void corosync_ipc_flow_control_local_decrement ( -+extern void cs_ipc_flow_control_local_decrement ( - void *conn); - - #endif /* IPC_H_DEFINED */ -diff -Naurd corosync-0.92/exec/logsys.c corosync-trunk/exec/logsys.c ---- corosync-0.92/exec/logsys.c 2008-09-17 20:22:58.000000000 +0200 -+++ corosync-trunk/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 -@@ -1,6 +1,6 @@ - /* - * Copyright (c) 2002-2004 MontaVista Software, Inc. -- * Copyright (c) 2006-2007 Red Hat, Inc. -+ * Copyright (c) 2006-2009 Red Hat, Inc. - * - * Author: Steven Dake (sdake@redhat.com) - * Author: Lon Hohberger (lhh@redhat.com) -@@ -35,13 +35,17 @@ - */ - #include - #include -+#include - #include - #include - #include -+#include -+#include - #include - #include - #include - #include -+#include - #if defined(COROSYNC_LINUX) - #include - #endif -@@ -54,14 +58,53 @@ - #include - - #include --#include "wthread.h" -+ -+/* similar to syslog facilities/priorities tables, -+ * make a tag table for internal use -+ */ -+ -+#ifdef SYSLOG_NAMES -+CODE tagnames[] = -+ { -+ { "log", LOGSYS_TAG_LOG }, -+ { "enter", LOGSYS_TAG_ENTER }, -+ { "leave", LOGSYS_TAG_LEAVE }, -+ { "trace1", LOGSYS_TAG_TRACE1 }, -+ { "trace2", LOGSYS_TAG_TRACE2 }, -+ { "trace3", LOGSYS_TAG_TRACE3 }, -+ { "trace4", LOGSYS_TAG_TRACE4 }, -+ { "trace5", LOGSYS_TAG_TRACE5 }, -+ { "trace6", LOGSYS_TAG_TRACE6 }, -+ { "trace7", LOGSYS_TAG_TRACE7 }, -+ { "trace8", LOGSYS_TAG_TRACE8 }, -+ { NULL, -1 } -+ }; -+#endif -+ -+/* -+ * These are not static so they can be read from the core file -+ */ -+int *flt_data; -+ -+int flt_data_size; -+ -+#define SUBSYS_MAX 32 -+ -+#define COMBINE_BUFFER_SIZE 2048 -+ -+struct logsys_logger { -+ char subsys[64]; -+ unsigned int priority; -+ unsigned int tags; -+ unsigned int mode; -+}; - - /* - * Configuration parameters for logging system - */ - static char *logsys_name = NULL; - --static unsigned int logsys_mode = 0; -+static unsigned int logsys_mode = LOG_MODE_NOSUBSYS; - - static char *logsys_file = NULL; - -@@ -69,35 +112,44 @@ - - static int logsys_facility = LOG_DAEMON; - --static int logsys_wthread_active = 0; -+static char *logsys_format = NULL; -+ -+/* -+ * operating global variables -+ */ -+static struct logsys_logger logsys_loggers[SUBSYS_MAX]; -+ -+static int wthread_active = 0; -+ -+static int wthread_should_exit = 0; - - static pthread_mutex_t logsys_config_mutex = PTHREAD_MUTEX_INITIALIZER; - --static pthread_mutex_t logsys_new_log_mutex = PTHREAD_MUTEX_INITIALIZER; -+static unsigned int records_written = 1; - --static struct worker_thread_group log_thread_group; -+static pthread_t logsys_thread_id; - --static unsigned int dropped_log_entries = 0; -+static pthread_cond_t logsys_cond; - --#ifndef MAX_LOGGERS --#define MAX_LOGGERS 32 --#endif --struct logsys_logger logsys_loggers[MAX_LOGGERS]; -+static pthread_mutex_t logsys_cond_mutex; - --int logsys_single_id = 0; -+static pthread_spinlock_t logsys_idx_spinlock; -+ -+static unsigned int log_rec_idx; - -+static int logsys_buffer_full = 0; - --struct log_entry { -- char *file; -- int line; -- int priority; -- char str[128]; -- struct log_entry *next; --}; -+static char *format_buffer="[%6s] %b"; - --static struct log_entry *head; -+static int log_requests_pending = 0; - --static struct log_entry *tail; -+static int log_requests_lost = 0; -+ -+void *logsys_rec_end; -+ -+#define FDHEAD_INDEX (flt_data_size) -+ -+#define FDTAIL_INDEX (flt_data_size + 1) - - struct log_data { - unsigned int syslog_pos; -@@ -105,324 +157,674 @@ - char *log_string; - }; - --enum logsys_config_mutex_state { -- LOGSYS_CONFIG_MUTEX_LOCKED, -- LOGSYS_CONFIG_MUTEX_UNLOCKED --}; -- - static void logsys_atexit (void); - --#define LEVELMASK 0x07 /* 3 bits */ --#define LOG_LEVEL(p) ((p) & LEVELMASK) --#define LOGSYS_IDMASK (0x3f << 3) /* 6 bits */ --#define LOG_ID(p) (((p) & LOGSYS_IDMASK) >> 3) -- --static void logsys_buffer_flush (void); -+/* -+ * Helpers for _logsys_log_rec functionality -+ */ -+static inline void my_memcpy_32bit (int *dest, int *src, unsigned int words) -+{ -+ unsigned int word_idx; -+ for (word_idx = 0; word_idx < words; word_idx++) { -+ dest[word_idx] = src[word_idx]; -+ } -+} - --void _logsys_nosubsys_set (void) -+static inline void my_memcpy_8bit (char *dest, char *src, unsigned int bytes) - { -- logsys_mode |= LOG_MODE_NOSUBSYS; -+ unsigned int byte_idx; -+ -+ for (byte_idx = 0; byte_idx < bytes; byte_idx++) { -+ dest[byte_idx] = src[byte_idx]; -+ } - } - --int logsys_facility_id_get (const char *name) -+/* -+ * Before any write operation, a reclaim on the buffer area must be executed -+ */ -+static inline void records_reclaim (unsigned int idx, unsigned int words) - { -- unsigned int i; -+ unsigned int should_reclaim; - -- for (i = 0; facilitynames[i].c_name != NULL; i++) { -- if (strcasecmp(name, facilitynames[i].c_name) == 0) { -- return (facilitynames[i].c_val); -+ should_reclaim = 0; -+ -+ if ((idx + words) >= flt_data_size) { -+ logsys_buffer_full = 1; -+ } -+ if (logsys_buffer_full == 0) { -+ return; -+ } -+ -+ pthread_spin_lock (&logsys_idx_spinlock); -+ if (flt_data[FDTAIL_INDEX] > flt_data[FDHEAD_INDEX]) { -+ if (idx + words >= flt_data[FDTAIL_INDEX]) { -+ should_reclaim = 1; -+ } -+ } else { -+ if ((idx + words) >= (flt_data[FDTAIL_INDEX] + flt_data_size)) { -+ should_reclaim = 1; - } - } -- return (-1); -+ -+ if (should_reclaim) { -+ int words_needed = 0; -+ -+ words_needed = words + 1; -+ do { -+ unsigned int old_tail; -+ -+ words_needed -= flt_data[flt_data[FDTAIL_INDEX]]; -+ old_tail = flt_data[FDTAIL_INDEX]; -+ flt_data[FDTAIL_INDEX] = -+ (flt_data[FDTAIL_INDEX] + -+ flt_data[flt_data[FDTAIL_INDEX]]) % (flt_data_size); -+ if (log_rec_idx == old_tail) { -+ log_requests_lost += 1; -+ log_rec_idx = flt_data[FDTAIL_INDEX]; -+ } -+ } while (words_needed > 0); -+ } -+ pthread_spin_unlock (&logsys_idx_spinlock); - } - --const char *logsys_facility_name_get (unsigned int facility) -+#define idx_word_step(idx) \ -+do { \ -+ if (idx > (flt_data_size - 1)) { \ -+ idx = 0; \ -+ } \ -+} while (0); -+ -+#define idx_buffer_step(idx) \ -+do { \ -+ if (idx > (flt_data_size - 1)) { \ -+ idx = ((idx) % (flt_data_size)); \ -+ } \ -+} while (0); -+ -+/* -+ * Internal threaded logging implementation -+ */ -+static inline int strcpy_cutoff (char *dest, char *src, int cutoff) - { -- unsigned int i; -+ unsigned int len; - -- for (i = 0; facilitynames[i].c_name != NULL; i++) { -- if (facility == facilitynames[i].c_val) { -- return (facilitynames[i].c_name); -+ if (cutoff == -1) { -+ strcpy (dest, src); -+ return (strlen (dest)); -+ } else { -+ assert (cutoff > 0); -+ strncpy (dest, src, cutoff); -+ dest[cutoff] = '\0'; -+ len = strlen (dest); -+ if (len != cutoff) { -+ memset (&dest[len], ' ', cutoff - len); - } - } -- return (NULL); -+ return (cutoff); - } - --int logsys_priority_id_get (const char *name) -+/* -+ * %s SUBSYSTEM -+ * %n FUNCTION NAME -+ * %f FILENAME -+ * %l FILELINE -+ * %p PRIORITY -+ * %t TIMESTAMP -+ * %b BUFFER -+ * -+ * any number between % and character specify field length to pad or chop -+*/ -+static void log_printf_to_logs ( -+ char *subsys, -+ char *function_name, -+ char *file_name, -+ int file_line, -+ unsigned int level, -+ char *buffer) - { -- unsigned int i; -+ char output_buffer[COMBINE_BUFFER_SIZE]; -+ char char_time[128]; -+ char line_no[30]; -+ unsigned int format_buffer_idx = 0; -+ unsigned int output_buffer_idx = 0; -+ struct timeval tv; -+ int cutoff; -+ unsigned int len; -+ -+ while (format_buffer[format_buffer_idx]) { -+ cutoff = -1; -+ if (format_buffer[format_buffer_idx] == '%') { -+ format_buffer_idx += 1; -+ if (isdigit (format_buffer[format_buffer_idx])) { -+ cutoff = atoi (&format_buffer[format_buffer_idx]); -+ } -+ while (isdigit (format_buffer[format_buffer_idx])) { -+ format_buffer_idx += 1; -+ } -+ -+ switch (format_buffer[format_buffer_idx]) { -+ case 's': -+ len = strcpy_cutoff (&output_buffer[output_buffer_idx], subsys, cutoff); -+ output_buffer_idx += len; -+ break; - -- for (i = 0; prioritynames[i].c_name != NULL; i++) { -- if (strcasecmp(name, prioritynames[i].c_name) == 0) { -- return (prioritynames[i].c_val); -+ case 'n': -+ len = strcpy_cutoff (&output_buffer[output_buffer_idx], function_name, cutoff); -+ output_buffer_idx += len; -+ break; -+ -+ case 'l': -+ sprintf (line_no, "%d", file_line); -+ len = strcpy_cutoff (&output_buffer[output_buffer_idx], line_no, cutoff); -+ output_buffer_idx += len; -+ break; -+ -+ case 'p': -+ break; -+ -+ case 't': -+ gettimeofday (&tv, NULL); -+ (void)strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S", localtime ((time_t *)&tv.tv_sec)); -+ len = strcpy_cutoff (&output_buffer[output_buffer_idx], char_time, cutoff); -+ output_buffer_idx += len; -+ break; -+ -+ case 'b': -+ len = strcpy_cutoff (&output_buffer[output_buffer_idx], buffer, cutoff); -+ output_buffer_idx += len; -+ break; -+ } -+ format_buffer_idx += 1; -+ } else { -+ output_buffer[output_buffer_idx++] = format_buffer[format_buffer_idx++]; - } - } -- return (-1); -+ -+ output_buffer[output_buffer_idx] = '\0'; -+ -+ /* -+ * Output to syslog -+ */ -+ if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG) { -+ syslog (level, "%s", output_buffer); -+ } -+ -+ /* -+ * Terminate string with \n \0 -+ */ -+ if (logsys_mode & (LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_STDERR)) { -+ output_buffer[output_buffer_idx++] = '\n'; -+ output_buffer[output_buffer_idx] = '\0'; -+ } -+ -+ /* -+ * Output to configured file -+ */ -+ if ((logsys_mode & LOG_MODE_OUTPUT_FILE) && logsys_file_fp) { -+ /* -+ * Output to a file -+ */ -+ (void)fwrite (output_buffer, strlen (output_buffer), 1, logsys_file_fp); -+ fflush (logsys_file_fp); -+ } -+ -+ /* -+ * Output to stderr -+ */ -+ if (logsys_mode & LOG_MODE_OUTPUT_STDERR) { -+ (void)write (STDERR_FILENO, output_buffer, strlen (output_buffer)); -+ } - } - --const char *logsys_priority_name_get (unsigned int priority) -+static void record_print (char *buf) - { -+ int *buf_uint32t = (int *)buf; -+ unsigned int rec_size = buf_uint32t[0]; -+ unsigned int rec_ident = buf_uint32t[1]; -+ unsigned int file_line = buf_uint32t[2]; -+ unsigned int level = rec_ident >> 28; - unsigned int i; -+ unsigned int words_processed; -+ unsigned int arg_size_idx; -+ void *arguments[64]; -+ unsigned int arg_count; - -- for (i = 0; prioritynames[i].c_name != NULL; i++) { -- if (priority == prioritynames[i].c_val) { -- return (prioritynames[i].c_name); -- } -+ arg_size_idx = 4; -+ words_processed = 4; -+ arg_count = 0; -+ -+ for (i = 0; words_processed < rec_size; i++) { -+ arguments[arg_count++] = &buf_uint32t[arg_size_idx + 1]; -+ arg_size_idx += buf_uint32t[arg_size_idx] + 1; -+ words_processed += buf_uint32t[arg_size_idx] + 1; - } -- return (NULL); -+ log_printf_to_logs ( -+ (char *)arguments[0], -+ (char *)arguments[1], -+ (char *)arguments[2], -+ file_line, -+ level, -+ (char *)arguments[3]); - } -+ -+static int record_read (char *buf, int rec_idx, int *log_msg) { -+ unsigned int rec_size; -+ unsigned int rec_ident; -+ int firstcopy, secondcopy; - --unsigned int logsys_config_subsys_set ( -- const char *subsys, -- unsigned int tags, -- unsigned int priority) --{ -- int i; -+ rec_size = flt_data[rec_idx]; -+ rec_ident = flt_data[(rec_idx + 1) % flt_data_size]; - -- pthread_mutex_lock (&logsys_config_mutex); -- for (i = 0; i < MAX_LOGGERS; i++) { -- if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { -- logsys_loggers[i].tags = tags; -- logsys_loggers[i].priority = priority; -+ /* -+ * Not a log record -+ */ -+ if ((rec_ident & LOGSYS_TAG_LOG) == 0) { -+ *log_msg = 0; -+ return ((rec_idx + rec_size) % flt_data_size); -+ } - -- break; -- } -+ /* -+ * A log record -+ */ -+ *log_msg = 1; -+ -+ firstcopy = rec_size; -+ secondcopy = 0; -+ if (firstcopy + rec_idx > flt_data_size) { -+ firstcopy = flt_data_size - rec_idx; -+ secondcopy -= firstcopy - rec_size; -+ } -+ memcpy (&buf[0], &flt_data[rec_idx], firstcopy << 2); -+ if (secondcopy) { -+ memcpy (&buf[(firstcopy << 2)], &flt_data[0], secondcopy << 2); -+ } -+ return ((rec_idx + rec_size) % flt_data_size); -+} -+ -+static inline void wthread_signal (void) -+{ -+ if (wthread_active == 0) { -+ return; - } -+ pthread_mutex_lock (&logsys_cond_mutex); -+ pthread_cond_signal (&logsys_cond); -+ pthread_mutex_unlock (&logsys_cond_mutex); -+} - -- if (i == MAX_LOGGERS) { -- for (i = 0; i < MAX_LOGGERS; i++) { -- if (strcmp (logsys_loggers[i].subsys, "") == 0) { -- strncpy (logsys_loggers[i].subsys, subsys, -- sizeof(logsys_loggers[i].subsys)); -- logsys_loggers[i].tags = tags; -- logsys_loggers[i].priority = priority; -+static inline void wthread_wait (void) -+{ -+ pthread_mutex_lock (&logsys_cond_mutex); -+ pthread_cond_wait (&logsys_cond, &logsys_cond_mutex); -+ pthread_mutex_unlock (&logsys_cond_mutex); -+} -+ -+static inline void wthread_wait_locked (void) -+{ -+ pthread_cond_wait (&logsys_cond, &logsys_cond_mutex); -+ pthread_mutex_unlock (&logsys_cond_mutex); -+} -+ -+static void *logsys_worker_thread (void *data) -+{ -+ int log_msg; -+ char buf[COMBINE_BUFFER_SIZE]; -+ -+ /* -+ * Signal wthread_create that the initialization process may continue -+ */ -+ wthread_signal (); -+ pthread_spin_lock (&logsys_idx_spinlock); -+ log_rec_idx = flt_data[FDTAIL_INDEX]; -+ pthread_spin_unlock (&logsys_idx_spinlock); -+ -+ for (;;) { -+ wthread_wait (); -+ /* -+ * Read and copy the logging record index position -+ * It may have been updated by records_reclaim if -+ * messages were lost or or log_rec on the first new -+ * logging record available -+ */ -+ /* -+ * Process any pending log messages here -+ */ -+ for (;;) { -+ pthread_spin_lock (&logsys_idx_spinlock); -+ if (log_requests_lost > 0) { -+ printf ("lost %d log requests\n", log_requests_lost); -+ log_requests_pending -= log_requests_lost; -+ log_requests_lost = 0; -+ } -+ if (log_requests_pending == 0) { -+ pthread_spin_unlock (&logsys_idx_spinlock); - break; - } -+ log_rec_idx = record_read (buf, log_rec_idx, &log_msg); -+ if (log_msg) { -+ log_requests_pending -= 1; -+ } -+ pthread_spin_unlock (&logsys_idx_spinlock); -+ -+ /* -+ * print the stored buffer -+ */ -+ if (log_msg) { -+ record_print (buf); -+ } -+ } -+ -+ if (wthread_should_exit) { -+ pthread_exit (NULL); - } - } -- assert(i < MAX_LOGGERS); -+} - -- pthread_mutex_unlock (&logsys_config_mutex); -- return i; -+static void wthread_create (void) -+{ -+ int res; -+ -+ if (wthread_active) { -+ return; -+ } -+ -+ wthread_active = 1; -+ -+ pthread_mutex_init (&logsys_cond_mutex, NULL); -+ pthread_cond_init (&logsys_cond, NULL); -+ pthread_mutex_lock (&logsys_cond_mutex); -+ res = pthread_create (&logsys_thread_id, NULL, -+ logsys_worker_thread, NULL); -+ -+ -+ /* -+ * Wait for thread to be started -+ */ -+ wthread_wait_locked (); - } - --inline int logsys_mkpri (int priority, int id) -+/* -+ * Internal API - exported -+ */ -+void _logsys_nosubsys_set (void) - { -- return (((id) << 3) | (priority)); -+ logsys_mode |= LOG_MODE_NOSUBSYS; - } - --int logsys_config_subsys_get ( -+unsigned int _logsys_subsys_create ( - const char *subsys, -- unsigned int *tags, -- unsigned int *priority) -+ unsigned int priority) - { -- unsigned int i; -+ assert (subsys != NULL); - -- pthread_mutex_lock (&logsys_config_mutex); -+ return logsys_config_subsys_set ( -+ subsys, -+ LOGSYS_TAG_LOG, -+ priority); -+} - -- for (i = 0; i < MAX_LOGGERS; i++) { -- if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { -- *tags = logsys_loggers[i].tags; -- *priority = logsys_loggers[i].priority; -- pthread_mutex_unlock (&logsys_config_mutex); -- return i; -+int _logsys_wthread_create (void) -+{ -+ if ((logsys_mode & LOG_MODE_FORK) == 0) { -+ if (logsys_name != NULL) { -+ openlog (logsys_name, LOG_CONS|LOG_PID, logsys_facility); - } -+ wthread_create(); -+ atexit (logsys_atexit); - } -- -- pthread_mutex_unlock (&logsys_config_mutex); -- -- return (-1); -+ return (0); - } - --static void buffered_log_printf ( -- char *file, -- int line, -- int priority, -- char *format, -- va_list ap) -+int _logsys_rec_init (unsigned int size) - { -- struct log_entry *entry = malloc(sizeof(struct log_entry)); -+ /* -+ * First record starts at zero -+ * Last record ends at zero -+ */ -+ flt_data = malloc ((size + 2) * sizeof (unsigned int)); -+ assert (flt_data != NULL); -+ flt_data_size = size; -+ assert (flt_data != NULL); -+ flt_data[FDHEAD_INDEX] = 0; -+ flt_data[FDTAIL_INDEX] = 0; -+ pthread_spin_init (&logsys_idx_spinlock, 0); - -- entry->file = file; -- entry->line = line; -- entry->priority = priority; -- entry->next = NULL; -- if (head == NULL) { -- head = tail = entry; -- } else { -- tail->next = entry; -- tail = entry; -- } -- vsnprintf(entry->str, sizeof(entry->str), format, ap); -+ return (0); - } - --static void log_printf_worker_fn (void *thread_data, void *work_item) -+ -+/* -+ * u32 RECORD SIZE -+ * u32 record ident -+ * u32 arg count -+ * u32 file line -+ * u32 subsys length -+ * buffer null terminated subsys -+ * u32 filename length -+ * buffer null terminated filename -+ * u32 filename length -+ * buffer null terminated function -+ * u32 arg1 length -+ * buffer arg1 -+ * ... repeats length & arg -+ */ -+void _logsys_log_rec ( -+ int subsys, -+ char *function_name, -+ char *file_name, -+ int file_line, -+ unsigned int rec_ident, -+ ...) - { -- struct log_data *log_data = (struct log_data *)work_item; -+ va_list ap; -+ void *buf_args[64]; -+ unsigned int buf_len[64]; -+ unsigned int i; -+ unsigned int idx; -+ unsigned int arguments = 0; -+ unsigned int record_reclaim_size; -+ unsigned int index_start; -+ int words_written; - -- if (logsys_wthread_active) -- pthread_mutex_lock (&logsys_config_mutex); -+ record_reclaim_size = 0; -+ - /* -- * Output the log data -+ * Decode VA Args - */ -- if (logsys_mode & LOG_MODE_OUTPUT_FILE && logsys_file_fp != 0) { -- fprintf (logsys_file_fp, "%s", log_data->log_string); -- fflush (logsys_file_fp); -+ va_start (ap, rec_ident); -+ arguments = 3; -+ for (;;) { -+ assert (arguments < 64); -+ buf_args[arguments] = va_arg (ap, void *); -+ if (buf_args[arguments] == LOG_REC_END) { -+ break; -+ } -+ buf_len[arguments] = va_arg (ap, int); -+ record_reclaim_size += ((buf_len[arguments] + 3) >> 2) + 1; -+ arguments++; - } -- if (logsys_mode & LOG_MODE_OUTPUT_STDERR) { -- fprintf (stderr, "%s", log_data->log_string); -- fflush (stdout); -+ va_end (ap); -+ -+ /* -+ * Encode logsys subsystem identity, filename, and function -+ */ -+ buf_args[0] = logsys_loggers[subsys].subsys; -+ buf_len[0] = strlen (logsys_loggers[subsys].subsys) + 1; -+ buf_args[1] = file_name; -+ buf_len[1] = strlen (file_name) + 1; -+ buf_args[2] = function_name; -+ buf_len[2] = strlen (function_name) + 1; -+ for (i = 0; i < 3; i++) { -+ record_reclaim_size += ((buf_len[i] + 3) >> 2) + 1; - } - -- /* release mutex here in case syslog blocks */ -- if (logsys_wthread_active) -- pthread_mutex_unlock (&logsys_config_mutex); -+ idx = flt_data[FDHEAD_INDEX]; -+ index_start = idx; - -- if ((logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) && -- (!((logsys_mode & LOG_MODE_FILTER_DEBUG_FROM_SYSLOG) && -- (log_data->priority == LOG_LEVEL_DEBUG)))) { -- syslog (log_data->priority, -- &log_data->log_string[log_data->syslog_pos]); -- } -- free (log_data->log_string); --} -+ /* -+ * Reclaim data needed for record including 4 words for the header -+ */ -+ records_reclaim (idx, record_reclaim_size + 4); - --static void _log_printf ( -- enum logsys_config_mutex_state config_mutex_state, -- char *file, -- int line, -- int priority, -- int id, -- char *format, -- va_list ap) --{ -- char newstring[4096]; -- char log_string[4096]; -- char char_time[512]; -- char *p = NULL; -- struct timeval tv; -- int i = 0; -- int len; -- struct log_data log_data; -- unsigned int res = 0; -+ /* -+ * Write record size of zero and rest of header information -+ */ -+ flt_data[idx++] = 0; -+ idx_word_step(idx); - -- assert (id < MAX_LOGGERS); -+ flt_data[idx++] = rec_ident; -+ idx_word_step(idx); - -- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { -- pthread_mutex_lock (&logsys_config_mutex); -- } -- pthread_mutex_lock (&logsys_new_log_mutex); -+ flt_data[idx++] = file_line; -+ idx_word_step(idx); -+ -+ flt_data[idx++] = records_written; -+ idx_word_step(idx); - /* -- ** Buffer before log has been configured has been called. -- */ -- if (logsys_mode & LOG_MODE_BUFFER_BEFORE_CONFIG) { -- buffered_log_printf(file, line, logsys_mkpri(priority, id), format, ap); -- pthread_mutex_unlock (&logsys_new_log_mutex); -- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { -- pthread_mutex_unlock (&logsys_config_mutex); -- } -- return; -- } -+ * Encode all of the arguments into the log message -+ */ -+ for (i = 0; i < arguments; i++) { -+ unsigned int bytes; -+ unsigned int full_words; -+ unsigned int total_words; - -- if (((logsys_mode & LOG_MODE_OUTPUT_FILE) || (logsys_mode & LOG_MODE_OUTPUT_STDERR)) && -- (logsys_mode & LOG_MODE_DISPLAY_TIMESTAMP)) { -- gettimeofday (&tv, NULL); -- strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S", -- localtime ((time_t *)&tv.tv_sec)); -- i = sprintf (newstring, "%s.%06ld ", char_time, (long)tv.tv_usec); -- } -+ bytes = buf_len[i]; -+ full_words = bytes >> 2; -+ total_words = (bytes + 3) >> 2; -+ -+ flt_data[idx++] = total_words; -+ idx_word_step(idx); - -- if ((priority == LOG_LEVEL_DEBUG) || (logsys_mode & LOG_MODE_DISPLAY_FILELINE)) { -- if (logsys_mode & LOG_MODE_SHORT_FILELINE) { -- p = strrchr(file, '/'); -- if (p) -- file = ++p; -- } -- sprintf (&newstring[i], "[%s:%04u] %s", file, line, format); -- } else { -- if (logsys_mode & LOG_MODE_NOSUBSYS) { -- sprintf (&newstring[i], "%s", format); -- } else { -- sprintf (&newstring[i], "[%-5s] %s", logsys_loggers[id].subsys, format); -- } -- } -- if (dropped_log_entries) { - /* -- * Get rid of \n if there is one -+ * determine if this is a wrapped write or normal write - */ -- if (newstring[strlen (newstring) - 1] == '\n') { -- newstring[strlen (newstring) - 1] = '\0'; -+ if (idx + total_words < flt_data_size) { -+ /* -+ * dont need to wrap buffer -+ */ -+ my_memcpy_32bit (&flt_data[idx], buf_args[i], full_words); -+ if (bytes % 4) { -+ my_memcpy_8bit ((char *)&flt_data[idx + full_words], -+ ((char *)buf_args[i]) + (full_words << 2), bytes % 4); -+ } -+ } else { -+ /* -+ * need to wrap buffer -+ */ -+ unsigned int first; -+ unsigned int second; -+ -+ first = flt_data_size - idx; -+ if (first > full_words) { -+ first = full_words; -+ } -+ second = full_words - first; -+ my_memcpy_32bit (&flt_data[idx], (int *)buf_args[i], first); -+ my_memcpy_32bit (&flt_data[0], -+ (int *)(((unsigned char *)buf_args[i]) + (first << 2)), -+ second); -+ if (bytes % 4) { -+ my_memcpy_8bit ((char *)&flt_data[0 + second], -+ ((char *)buf_args[i]) + (full_words << 2), bytes % 4); -+ } - } -- len = sprintf (log_string, -- "%s - prior to this log entry, corosync logger dropped '%d' messages because of overflow.", newstring, dropped_log_entries + 1); -- } else { -- len = vsprintf (log_string, newstring, ap); -+ idx += total_words; -+ idx_buffer_step (idx); -+ } -+ words_written = idx - index_start; -+ if (words_written < 0) { -+ words_written += flt_data_size; - } - - /* -- ** add line feed if not done yet -- */ -- if (log_string[len - 1] != '\n') { -- log_string[len] = '\n'; -- log_string[len + 1] = '\0'; -- } -+ * Commit the write of the record size now that the full record -+ * is in the memory buffer -+ */ -+ flt_data[index_start] = words_written; - - /* -- * Create work thread data -+ * If the index of the current head equals the current log_rec_idx, -+ * and this is not a log_printf operation, set the log_rec_idx to -+ * the new head position and commit the new head. - */ -- log_data.syslog_pos = i; -- log_data.priority = priority; -- log_data.log_string = strdup (log_string); -- if (log_data.log_string == NULL) { -- goto drop_log_msg; -+ pthread_spin_lock (&logsys_idx_spinlock); -+ if (rec_ident & LOGSYS_TAG_LOG) { -+ log_requests_pending += 1; - } -- -- if (logsys_wthread_active) { -- res = worker_thread_group_work_add (&log_thread_group, &log_data); -- if (res == 0) { -- dropped_log_entries = 0; -- } else { -- dropped_log_entries += 1; -- } -- } else { -- log_printf_worker_fn (NULL, &log_data); -+ if (log_requests_pending == 0) { -+ log_rec_idx = idx; - } -+ flt_data[FDHEAD_INDEX] = idx; -+ pthread_spin_unlock (&logsys_idx_spinlock); -+ records_written++; -+} - -- pthread_mutex_unlock (&logsys_new_log_mutex); -- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { -- pthread_mutex_unlock (&logsys_config_mutex); -+void _logsys_log_printf ( -+ int subsys, -+ char *function_name, -+ char *file_name, -+ int file_line, -+ unsigned int level, -+ char *format, -+ ...) -+{ -+ char logsys_print_buffer[COMBINE_BUFFER_SIZE]; -+ unsigned int len; -+ va_list ap; -+ -+ if (logsys_mode & LOG_MODE_NOSUBSYS) { -+ subsys = 0; -+ } -+ if (level > logsys_loggers[subsys].priority) { -+ return; -+ } -+ va_start (ap, format); -+ len = vsprintf (logsys_print_buffer, format, ap); -+ va_end (ap); -+ if (logsys_print_buffer[len - 1] == '\n') { -+ logsys_print_buffer[len - 1] = '\0'; -+ len -= 1; - } -- return; - --drop_log_msg: -- dropped_log_entries++; -- pthread_mutex_unlock (&logsys_new_log_mutex); -- if (config_mutex_state == LOGSYS_CONFIG_MUTEX_UNLOCKED) { -- pthread_mutex_unlock (&logsys_config_mutex); -+ /* -+ * Create a log record -+ */ -+ _logsys_log_rec (subsys, -+ function_name, -+ file_name, -+ file_line, -+ (level+1) << 28, -+ logsys_print_buffer, len + 1, -+ LOG_REC_END); -+ -+ if ((logsys_mode & LOG_MODE_THREADED) == 0) { -+ /* -+ * Output (and block) if the log mode is not threaded otherwise -+ * expect the worker thread to output the log data once signaled -+ */ -+ log_printf_to_logs (logsys_loggers[subsys].subsys, -+ function_name, file_name, file_line, level, -+ logsys_print_buffer); -+ } else { -+ /* -+ * Signal worker thread to display logging output -+ */ -+ wthread_signal (); - } - } - --unsigned int _logsys_subsys_create ( -- const char *subsys, -- unsigned int priority) -+/* -+ * External Configuration and Initialization API -+ */ -+void logsys_fork_completed (void) - { -- assert (subsys != NULL); -- -- return logsys_config_subsys_set ( -- subsys, -- LOGSYS_TAG_LOG, -- priority); -+ logsys_mode &= ~LOG_MODE_FORK; -+ _logsys_wthread_create (); - } - -- - void logsys_config_mode_set (unsigned int mode) - { - pthread_mutex_lock (&logsys_config_mutex); - logsys_mode = mode; -- if (mode & LOG_MODE_FLUSH_AFTER_CONFIG) { -- _logsys_wthread_create (); -- logsys_buffer_flush (); -- } - pthread_mutex_unlock (&logsys_config_mutex); - } - -@@ -431,22 +833,28 @@ - return logsys_mode; - } - -+static void logsys_close_logfile() -+{ -+ if (logsys_file_fp != NULL) { -+ fclose (logsys_file_fp); -+ logsys_file_fp = NULL; -+ } -+} -+ - int logsys_config_file_set (char **error_string, char *file) - { - static char error_string_response[512]; - - if (file == NULL) { -+ logsys_close_logfile(); - return (0); - } - -- pthread_mutex_lock (&logsys_new_log_mutex); - pthread_mutex_lock (&logsys_config_mutex); - - if (logsys_mode & LOG_MODE_OUTPUT_FILE) { - logsys_file = file; -- if (logsys_file_fp != NULL) { -- fclose (logsys_file_fp); -- } -+ logsys_close_logfile(); - logsys_file_fp = fopen (file, "a+"); - if (logsys_file_fp == 0) { - sprintf (error_string_response, -@@ -454,222 +862,243 @@ - file, strerror (errno)); - *error_string = error_string_response; - pthread_mutex_unlock (&logsys_config_mutex); -- pthread_mutex_unlock (&logsys_new_log_mutex); - return (-1); - } -- } -+ } else -+ logsys_close_logfile(); - - pthread_mutex_unlock (&logsys_config_mutex); -- pthread_mutex_unlock (&logsys_new_log_mutex); - return (0); - } - --void logsys_config_facility_set (char *name, unsigned int facility) -+void logsys_format_set (char *format) - { -- pthread_mutex_lock (&logsys_new_log_mutex); - pthread_mutex_lock (&logsys_config_mutex); - -- logsys_name = name; -- logsys_facility = facility; -+ logsys_format = format; - - pthread_mutex_unlock (&logsys_config_mutex); -- pthread_mutex_unlock (&logsys_new_log_mutex); - } - --void _logsys_config_priority_set (unsigned int id, unsigned int priority) -+void logsys_config_facility_set (char *name, unsigned int facility) - { -- pthread_mutex_lock (&logsys_new_log_mutex); -+ pthread_mutex_lock (&logsys_config_mutex); - -- logsys_loggers[id].priority = priority; -+ logsys_name = name; -+ logsys_facility = facility; - -- pthread_mutex_unlock (&logsys_new_log_mutex); -+ pthread_mutex_unlock (&logsys_config_mutex); - } - --static void child_cleanup (void) -+int logsys_facility_id_get (const char *name) - { -- memset(&log_thread_group, 0, sizeof(log_thread_group)); -- logsys_wthread_active = 0; -- pthread_mutex_init(&logsys_config_mutex, NULL); -- pthread_mutex_init(&logsys_new_log_mutex, NULL); -+ unsigned int i; -+ -+ for (i = 0; facilitynames[i].c_name != NULL; i++) { -+ if (strcasecmp(name, facilitynames[i].c_name) == 0) { -+ return (facilitynames[i].c_val); -+ } -+ } -+ return (-1); - } - --int _logsys_wthread_create (void) -+const char *logsys_facility_name_get (unsigned int facility) - { -- worker_thread_group_init ( -- &log_thread_group, -- 1, -- 1024, -- sizeof (struct log_data), -- 0, -- NULL, -- log_printf_worker_fn); -- -- logsys_flush(); -- -- atexit (logsys_atexit); -- pthread_atfork(NULL, NULL, child_cleanup); -+ unsigned int i; - -- if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED && logsys_name != NULL) { -- openlog (logsys_name, LOG_CONS|LOG_PID, logsys_facility); -+ for (i = 0; facilitynames[i].c_name != NULL; i++) { -+ if (facility == facilitynames[i].c_val) { -+ return (facilitynames[i].c_name); -+ } - } -+ return (NULL); -+} - -- logsys_wthread_active = 1; -+int logsys_priority_id_get (const char *name) -+{ -+ unsigned int i; - -- return (0); -+ for (i = 0; prioritynames[i].c_name != NULL; i++) { -+ if (strcasecmp(name, prioritynames[i].c_name) == 0) { -+ return (prioritynames[i].c_val); -+ } -+ } -+ return (-1); - } - --void logsys_log_printf ( -- char *file, -- int line, -- int priority, -- char *format, -- ...) -+const char *logsys_priority_name_get (unsigned int priority) - { -- int id = LOG_ID(priority); -- int level = LOG_LEVEL(priority); -- va_list ap; -- -- assert (id < MAX_LOGGERS); -+ unsigned int i; - -- if (LOG_LEVEL(priority) > logsys_loggers[id].priority) { -- return; -+ for (i = 0; prioritynames[i].c_name != NULL; i++) { -+ if (priority == prioritynames[i].c_val) { -+ return (prioritynames[i].c_name); -+ } - } -- -- va_start (ap, format); -- _log_printf (LOGSYS_CONFIG_MUTEX_UNLOCKED, file, line, level, id, -- format, ap); -- va_end(ap); -+ return (NULL); - } - --static void logsys_log_printf_locked ( -- char *file, -- int line, -- int priority, -- char *format, -- ...) -+int logsys_tag_id_get (const char *name) - { -- int id = LOG_ID(priority); -- int level = LOG_LEVEL(priority); -- va_list ap; -- -- assert (id < MAX_LOGGERS); -+ unsigned int i; - -- if (LOG_LEVEL(priority) > logsys_loggers[id].priority) { -- return; -+ for (i = 0; tagnames[i].c_name != NULL; i++) { -+ if (strcasecmp(name, tagnames[i].c_name) == 0) { -+ return (tagnames[i].c_val); -+ } - } -- -- va_start (ap, format); -- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, level, id, -- format, ap); -- va_end(ap); -+ return (-1); - } - --void _logsys_log_printf2 ( -- char *file, -- int line, -- int priority, -- int id, -- char *format, ...) -+const char *logsys_tag_name_get (unsigned int tag) - { -- va_list ap; -- -- assert (id < MAX_LOGGERS); -+ unsigned int i; - -- va_start (ap, format); -- _log_printf (LOGSYS_CONFIG_MUTEX_UNLOCKED, file, line, priority, id, -- format, ap); -- va_end(ap); -+ for (i = 0; tagnames[i].c_name != NULL; i++) { -+ if (tag == tagnames[i].c_val) { -+ return (tagnames[i].c_name); -+ } -+ } -+ return (NULL); - } - --void _logsys_trace (char *file, int line, int tag, int id, char *format, ...) -+unsigned int logsys_config_subsys_set ( -+ const char *subsys, -+ unsigned int tags, -+ unsigned int priority) - { -- assert (id < MAX_LOGGERS); -+ int i; - - pthread_mutex_lock (&logsys_config_mutex); -+ for (i = 0; i < SUBSYS_MAX; i++) { -+ if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { -+ logsys_loggers[i].tags = tags; -+ logsys_loggers[i].priority = priority; - -- if (tag & logsys_loggers[id].tags) { -- va_list ap; -+ break; -+ } -+ } - -- va_start (ap, format); -- _log_printf (LOGSYS_CONFIG_MUTEX_LOCKED, file, line, -- LOG_LEVEL_DEBUG, id, format, ap); -- va_end(ap); -+ if (i == SUBSYS_MAX) { -+ for (i = 0; i < SUBSYS_MAX; i++) { -+ if (strcmp (logsys_loggers[i].subsys, "") == 0) { -+ strncpy (logsys_loggers[i].subsys, subsys, -+ sizeof(logsys_loggers[i].subsys)); -+ logsys_loggers[i].tags = tags; -+ logsys_loggers[i].priority = priority; -+ break; -+ } -+ } - } -+ assert(i < SUBSYS_MAX); -+ - pthread_mutex_unlock (&logsys_config_mutex); -+ return i; - } - --static void logsys_atexit (void) -+int logsys_config_subsys_get ( -+ const char *subsys, -+ unsigned int *tags, -+ unsigned int *priority) - { -- if (logsys_wthread_active) { -- worker_thread_group_wait (&log_thread_group); -- } -- if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) { -- closelog (); -+ unsigned int i; -+ -+ pthread_mutex_lock (&logsys_config_mutex); -+ -+ for (i = 0; i < SUBSYS_MAX; i++) { -+ if (strcmp (logsys_loggers[i].subsys, subsys) == 0) { -+ *tags = logsys_loggers[i].tags; -+ *priority = logsys_loggers[i].priority; -+ pthread_mutex_unlock (&logsys_config_mutex); -+ return i; -+ } - } -+ -+ pthread_mutex_unlock (&logsys_config_mutex); -+ -+ return (-1); - } - --static void logsys_buffer_flush (void) -+int logsys_log_rec_store (char *filename) - { -- struct log_entry *entry = head; -- struct log_entry *tmp; -+ int fd; -+ ssize_t written_size; -+ size_t size_to_write = (flt_data_size + 2) * sizeof (unsigned int); - -- if (logsys_mode & LOG_MODE_FLUSH_AFTER_CONFIG) { -- logsys_mode &= ~LOG_MODE_FLUSH_AFTER_CONFIG; -+ fd = open (filename, O_CREAT|O_RDWR, 0700); -+ if (fd == -1) { -+ return (-1); -+ } - -- while (entry) { -- logsys_log_printf_locked ( -- entry->file, -- entry->line, -- entry->priority, -- entry->str); -- tmp = entry; -- entry = entry->next; -- free (tmp); -- } -+ written_size = write (fd, flt_data, size_to_write); -+ if (written_size < 0) { -+ return (-1); -+ } else if ((size_t)written_size != size_to_write) { -+ return (-1); - } -+ return (0); -+} - -- head = tail = NULL; -+static void logsys_atexit (void) -+{ -+ if (wthread_active) { -+ wthread_should_exit = 1; -+ wthread_signal (); -+ pthread_join (logsys_thread_id, NULL); -+ } - } - --void logsys_flush (void) -+void logsys_atsegv (void) - { -- worker_thread_group_wait (&log_thread_group); -+ if (wthread_active) { -+ wthread_should_exit = 1; -+ wthread_signal (); -+ pthread_join (logsys_thread_id, NULL); -+ } - } - --int logsys_init (char *name, int mode, int facility, int priority, char *file) -+int logsys_init ( -+ char *name, -+ int mode, -+ int facility, -+ int priority, -+ char *file, -+ char *format, -+ int rec_size) - { - char *errstr; - -- /* logsys_subsys_id will be 0 */ -- logsys_single_id = 1; -- -+ _logsys_nosubsys_set (); -+ _logsys_subsys_create (name, priority); - strncpy (logsys_loggers[0].subsys, name, - sizeof (logsys_loggers[0].subsys)); - logsys_config_mode_set (mode); - logsys_config_facility_set (name, facility); - logsys_config_file_set (&errstr, file); -- _logsys_config_priority_set (0, priority); -- if ((mode & LOG_MODE_BUFFER_BEFORE_CONFIG) == 0) { -- _logsys_wthread_create (); -- } -+ logsys_format_set (format); -+ _logsys_rec_init (rec_size); -+ _logsys_wthread_create (); - return (0); - } - --int logsys_conf (char *name, int mode, int facility, int priority, char *file) -+int logsys_conf ( -+ char *name, -+ int mode, -+ int facility, -+ int priority, -+ char *file) - { - char *errstr; - -+ _logsys_rec_init (100000); - strncpy (logsys_loggers[0].subsys, name, - sizeof (logsys_loggers[0].subsys)); - logsys_config_mode_set (mode); - logsys_config_facility_set (name, facility); - logsys_config_file_set (&errstr, file); -- _logsys_config_priority_set (0, priority); - return (0); - } - - void logsys_exit (void) - { -- logsys_flush (); - } -- -diff -Naurd corosync-0.92/exec/main.c corosync-trunk/exec/main.c ---- corosync-0.92/exec/main.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/exec/main.c 2009-01-23 17:12:13.000000000 +0100 -@@ -34,8 +34,6 @@ - */ - #include - #include --#include --#include - #include - #include - #include -@@ -56,7 +54,7 @@ - #include - - #include --#include -+#include - #include - #include - #include -@@ -66,6 +64,7 @@ - #include - #include - -+#include "quorum.h" - #include "totemsrp.h" - #include "mempool.h" - #include "mainconfig.h" -@@ -83,18 +82,16 @@ - #include "version.h" - - LOGSYS_DECLARE_SYSTEM ("corosync", -- LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_BUFFER_BEFORE_CONFIG, -+ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED | LOG_MODE_FORK, - NULL, -- LOG_DAEMON); -+ LOG_DAEMON, -+ "[%6s] %b", -+ 1000000); - - LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO); - - #define SERVER_BACKLOG 5 - --static int ais_uid = 0; -- --static int gid_valid = 0; -- - static unsigned int service_count = 32; - - static pthread_mutex_t serialize_mutex = PTHREAD_MUTEX_INITIALIZER; -@@ -145,7 +142,6 @@ - #endif - - totempg_finalize (); -- logsys_flush (); - - corosync_exit_error (AIS_DONE_EXIT); - -@@ -170,15 +166,17 @@ - - static void sigsegv_handler (int num) - { -- signal (SIGSEGV, SIG_DFL); -- logsys_flush (); -+ (void)signal (SIGSEGV, SIG_DFL); -+ logsys_atsegv(); -+ logsys_log_rec_store ("/var/lib/corosync/fdata"); - raise (SIGSEGV); - } - - static void sigabrt_handler (int num) - { -- signal (SIGABRT, SIG_DFL); -- logsys_flush (); -+ (void)signal (SIGABRT, SIG_DFL); -+ logsys_atsegv(); -+ logsys_log_rec_store ("/var/lib/corosync/fdata"); - raise (SIGABRT); - } - -@@ -271,36 +269,11 @@ - } - } - --static void aisexec_uid_determine (struct main_config *main_config) --{ -- struct passwd *passwd; -- -- passwd = getpwnam(main_config->user); -- if (passwd == 0) { -- log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' user is not found in /etc/passwd, please read the documentation.\n", main_config->user); -- corosync_exit_error (AIS_DONE_UID_DETERMINE); -- } -- ais_uid = passwd->pw_uid; -- endpwent (); --} -- --static void aisexec_gid_determine (struct main_config *main_config) --{ -- struct group *group; -- group = getgrnam (main_config->group); -- if (group == 0) { -- log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' group is not found in /etc/group, please read the documentation.\n", group->gr_name); -- corosync_exit_error (AIS_DONE_GID_DETERMINE); -- } -- gid_valid = group->gr_gid; -- endgrent (); --} -- --static void aisexec_priv_drop (void) -+static void priv_drop (struct main_config *main_config) - { --return; -- setuid (ais_uid); -- setegid (ais_uid); -+return; /* TODO: we are still not dropping privs */ -+ setuid (main_config->uid); -+ setegid (main_config->gid); - } - - static void aisexec_mempool_init (void) -@@ -341,7 +314,7 @@ - } - - /* Create new session */ -- setsid(); -+ (void)setsid(); - - /* - * Map stdin/out/err to /dev/null. -@@ -408,7 +381,6 @@ - #endif - } - -- - static void deliver_fn ( - unsigned int nodeid, - struct iovec *iovec, -@@ -448,6 +420,8 @@ - */ - service = header->id >> 16; - fn_id = header->id & 0xffff; -+ if (!ais_service[service]) -+ return; - if (endian_conversion_required) { - assert(ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn != NULL); - ais_service[service]->exec_engine[fn_id].exec_endian_convert_fn -@@ -494,7 +468,6 @@ - char *iface; - int res, ch; - int background, setprio; -- int totem_log_service; - - /* default configuration - */ -@@ -506,7 +479,7 @@ - switch (ch) { - case 'f': - background = 0; -- logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR|LOG_MODE_FLUSH_AFTER_CONFIG); -+ logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR|LOG_MODE_THREADED|LOG_MODE_FORK); - break; - case 'p': - setprio = 0; -@@ -527,11 +500,11 @@ - log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2002-2006 MontaVista Software, Inc and contributors.\n"); - log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2006-2008 Red Hat, Inc.\n"); - -- signal (SIGINT, sigintr_handler); -- signal (SIGUSR2, sigusr2_handler); -- signal (SIGSEGV, sigsegv_handler); -- signal (SIGABRT, sigabrt_handler); -- signal (SIGQUIT, sigquit_handler); -+ (void)signal (SIGINT, sigintr_handler); -+ (void)signal (SIGUSR2, sigusr2_handler); -+ (void)signal (SIGSEGV, sigsegv_handler); -+ (void)signal (SIGABRT, sigabrt_handler); -+ (void)signal (SIGQUIT, sigquit_handler); - - corosync_timer_init ( - serialize_mutex_lock, -@@ -635,14 +608,6 @@ - corosync_exit_error (AIS_DONE_MAINCONFIGREAD); - } - -- logsys_config_facility_set ("corosync", main_config.syslog_facility); -- logsys_config_mode_set (main_config.logmode); -- logsys_config_file_set (&error_string, main_config.logfile); -- -- aisexec_uid_determine (&main_config); -- -- aisexec_gid_determine (&main_config); -- - /* - * Set round robin realtime scheduling with priority 99 - * Lock all memory to avoid page faults which may interrupt -@@ -654,13 +619,14 @@ - aisexec_mlockall (); - - totem_config.totem_logging_configuration = totem_logging_configuration; -- totem_log_service = _logsys_subsys_create ("TOTEM", LOG_INFO); -- totem_config.totem_logging_configuration.log_level_security = logsys_mkpri (LOG_LEVEL_SECURITY, totem_log_service); -- totem_config.totem_logging_configuration.log_level_error = logsys_mkpri (LOG_LEVEL_ERROR, totem_log_service); -- totem_config.totem_logging_configuration.log_level_warning = logsys_mkpri (LOG_LEVEL_WARNING, totem_log_service); -- totem_config.totem_logging_configuration.log_level_notice = logsys_mkpri (LOG_LEVEL_NOTICE, totem_log_service); -- totem_config.totem_logging_configuration.log_level_debug = logsys_mkpri (LOG_LEVEL_DEBUG, totem_log_service); -- totem_config.totem_logging_configuration.log_printf = logsys_log_printf; -+ totem_config.totem_logging_configuration.log_subsys_id = -+ _logsys_subsys_create ("TOTEM", LOG_INFO); -+ totem_config.totem_logging_configuration.log_level_security = LOG_LEVEL_SECURITY; -+ totem_config.totem_logging_configuration.log_level_error = LOG_LEVEL_ERROR; -+ totem_config.totem_logging_configuration.log_level_warning = LOG_LEVEL_WARNING; -+ totem_config.totem_logging_configuration.log_level_notice = LOG_LEVEL_NOTICE; -+ totem_config.totem_logging_configuration.log_level_debug = LOG_LEVEL_DEBUG; -+ totem_config.totem_logging_configuration.log_printf = _logsys_log_printf; - - /* - * Sleep for a while to let other nodes in the cluster -@@ -704,11 +670,9 @@ - } - - -- sync_register (corosync_sync_callbacks_retrieve, corosync_sync_completed, -- totem_config.vsf_type); -- -+ sync_register (corosync_sync_callbacks_retrieve, corosync_sync_completed); - -- res = corosync_flow_control_initialize (); -+ res = cs_flow_control_initialize (); - - /* - * Drop root privleges to user 'ais' -@@ -718,14 +682,14 @@ - * CAP_SYS_NICE (setscheduler) - * CAP_IPC_LOCK (mlockall) - */ -- aisexec_priv_drop (); -+ priv_drop (&main_config); - - aisexec_mempool_init (); - -- corosync_ipc_init ( -+ cs_ipc_init ( - serialize_mutex_lock, - serialize_mutex_unlock, -- gid_valid); -+ main_config.gid); - - /* - * Start main processing loop -diff -Naurd corosync-0.92/exec/mainconfig.c corosync-trunk/exec/mainconfig.c ---- corosync-0.92/exec/mainconfig.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/mainconfig.c 2009-01-23 17:12:13.000000000 +0100 -@@ -40,8 +40,10 @@ - #include - #include - #include -+#include -+#include - --#include -+#include - #include - #include - #include -@@ -51,6 +53,12 @@ - #include "mempool.h" - - static char error_string_response[512]; -+static struct objdb_iface_ver0 *global_objdb; -+ -+static void add_logsys_config_notification( -+ struct objdb_iface_ver0 *objdb, -+ struct main_config *main_config); -+ - - /* This just makes the code below a little neater */ - static inline int objdb_get_string ( -@@ -98,7 +106,10 @@ - unsigned int tags; - } logsys_logger; - --int corosync_main_config_read ( -+ -+ -+ -+int corosync_main_config_read_logging ( - struct objdb_iface_ver0 *objdb, - char **error_string, - struct main_config *main_config) -@@ -109,10 +120,6 @@ - char *error_reason = error_string_response; - unsigned int object_find_handle; - unsigned int object_find_logsys_handle; -- int global_debug = 0; -- -- -- memset (main_config, 0, sizeof (struct main_config)); - - objdb->object_find_create ( - OBJECT_PARENT_HANDLE, -@@ -120,7 +127,7 @@ - strlen ("logging"), - &object_find_handle); - -- main_config->logmode = LOG_MODE_FLUSH_AFTER_CONFIG; -+ main_config->logmode = LOG_MODE_THREADED | LOG_MODE_FORK; - if (objdb->object_find_next ( - object_find_handle, - &object_service_handle) == 0) { -@@ -135,10 +142,10 @@ - } - if (!objdb_get_string (objdb,object_service_handle, "to_syslog", &value)) { - if (strcmp (value, "yes") == 0) { -- main_config->logmode |= LOG_MODE_OUTPUT_SYSLOG_THREADED; -+ main_config->logmode |= LOG_MODE_OUTPUT_SYSLOG; - } else - if (strcmp (value, "no") == 0) { -- main_config->logmode &= ~LOG_MODE_OUTPUT_SYSLOG_THREADED; -+ main_config->logmode &= ~LOG_MODE_OUTPUT_SYSLOG; - } - } - if (!objdb_get_string (objdb,object_service_handle, "to_stderr", &value)) { -@@ -149,18 +156,8 @@ - main_config->logmode &= ~LOG_MODE_OUTPUT_STDERR; - } - } -- -- if (!objdb_get_string (objdb,object_service_handle, "debug", &value)) { -- if (strcmp (value, "on") == 0) { -- global_debug = 1; -- } else -- if (strcmp (value, "off") == 0) { -- global_debug = 0; -- } else { -- goto parse_error; -- } -- } - if (!objdb_get_string (objdb,object_service_handle, "timestamp", &value)) { -+/* todo change format string - if (strcmp (value, "on") == 0) { - main_config->logmode |= LOG_MODE_DISPLAY_TIMESTAMP; - } else -@@ -169,12 +166,20 @@ - } else { - goto parse_error; - } -+*/ -+ } -+ -+ /* free old string on reload */ -+ if (main_config->logfile) { -+ free(main_config->logfile); -+ main_config->logfile = NULL; - } - if (!objdb_get_string (objdb,object_service_handle, "logfile", &value)) { - main_config->logfile = strdup (value); - } - - if (!objdb_get_string (objdb,object_service_handle, "fileline", &value)) { -+/* TODO - if (strcmp (value, "on") == 0) { - main_config->logmode |= LOG_MODE_DISPLAY_FILELINE; - } else -@@ -183,41 +188,21 @@ - } else { - goto parse_error; - } -+*/ - } - - if (!objdb_get_string (objdb,object_service_handle, "syslog_facility", &value)) { -- if (strcmp (value, "daemon") == 0) { -- main_config->syslog_facility = LOG_DAEMON; -- } else -- if (strcmp (value, "local0") == 0) { -- main_config->syslog_facility = LOG_LOCAL0; -- } else -- if (strcmp (value, "local1") == 0) { -- main_config->syslog_facility = LOG_LOCAL1; -- } else -- if (strcmp (value, "local2") == 0) { -- main_config->syslog_facility = LOG_LOCAL2; -- } else -- if (strcmp (value, "local3") == 0) { -- main_config->syslog_facility = LOG_LOCAL3; -- } else -- if (strcmp (value, "local4") == 0) { -- main_config->syslog_facility = LOG_LOCAL4; -- } else -- if (strcmp (value, "local5") == 0) { -- main_config->syslog_facility = LOG_LOCAL5; -- } else -- if (strcmp (value, "local6") == 0) { -- main_config->syslog_facility = LOG_LOCAL6; -- } else -- if (strcmp (value, "local7") == 0) { -- main_config->syslog_facility = LOG_LOCAL7; -- } else { -+ main_config->syslog_facility = logsys_facility_id_get(value); -+ if (main_config->syslog_facility < 0) { - error_reason = "unknown syslog facility specified"; - goto parse_error; - } - } - -+ logsys_config_facility_set ("corosync", main_config->syslog_facility); -+ logsys_config_mode_set (main_config->logmode); -+ logsys_config_file_set (error_string, main_config->logfile); -+ - objdb->object_find_create ( - object_service_handle, - "logger_subsys", -@@ -239,6 +224,13 @@ - error_reason = "subsys required for logger directive"; - goto parse_error; - } -+ if (!objdb_get_string (objdb, object_logger_subsys_handle, "syslog_level", &value)) { -+ logsys_logger.priority = logsys_priority_id_get(value); -+ if (logsys_logger.priority < 0) { -+ error_reason = "unknown syslog priority specified"; -+ goto parse_error; -+ } -+ } - if (!objdb_get_string (objdb, object_logger_subsys_handle, "debug", &value)) { - if (strcmp (value, "on") == 0) { - logsys_logger.priority = LOG_LEVEL_DEBUG; -@@ -253,31 +245,14 @@ - char *token = strtok (value, "|"); - - while (token != NULL) { -- if (strcmp (token, "enter") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_ENTER; -- } else if (strcmp (token, "leave") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_LEAVE; -- } else if (strcmp (token, "trace1") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE1; -- } else if (strcmp (token, "trace2") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE2; -- } else if (strcmp (token, "trace3") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE3; -- } else if (strcmp (token, "trace4") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE4; -- } else if (strcmp (token, "trace5") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE5; -- } else if (strcmp (token, "trace6") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE6; -- } else if (strcmp (token, "trace7") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE7; -- } else if (strcmp (token, "trace8") == 0) { -- logsys_logger.tags |= LOGSYS_TAG_TRACE8; -- } else { -+ int val; -+ -+ val = logsys_tag_id_get(token); -+ if (val < 0) { - error_reason = "bad tags value"; - goto parse_error; - } -- -+ logsys_logger.tags |= val; - token = strtok(NULL, "|"); - } - } -@@ -295,6 +270,61 @@ - - objdb->object_find_destroy (object_find_handle); - -+ return 0; -+ -+parse_error: -+ sprintf (error_string_response, -+ "parse error in config: %s.\n", -+ error_reason); -+ -+ *error_string = error_string_response; -+ return (-1); -+} -+ -+static int uid_determine (char *req_user) -+{ -+ struct passwd *passwd; -+ int ais_uid = 0; -+ -+ passwd = getpwnam(req_user); -+ if (passwd == 0) { -+ log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' user is not found in /etc/passwd, please read the documentation.\n", req_user); -+ corosync_exit_error (AIS_DONE_UID_DETERMINE); -+ } -+ ais_uid = passwd->pw_uid; -+ endpwent (); -+ return ais_uid; -+} -+ -+static int gid_determine (char *req_group) -+{ -+ struct group *group; -+ int ais_gid = 0; -+ -+ group = getgrnam (req_group); -+ if (group == 0) { -+ log_printf (LOG_LEVEL_ERROR, "ERROR: The '%s' group is not found in /etc/group, please read the documentation.\n", req_group); -+ corosync_exit_error (AIS_DONE_GID_DETERMINE); -+ } -+ ais_gid = group->gr_gid; -+ endgrent (); -+ return ais_gid; -+} -+ -+int corosync_main_config_read ( -+ struct objdb_iface_ver0 *objdb, -+ char **error_string, -+ struct main_config *main_config) -+{ -+ unsigned int object_service_handle; -+ char *value; -+ char *error_reason = error_string_response; -+ unsigned int object_find_handle; -+ -+ memset (main_config, 0, sizeof (struct main_config)); -+ -+ corosync_main_config_read_logging(objdb, error_string, main_config); -+ - objdb->object_find_create ( - OBJECT_PARENT_HANDLE, - "aisexec", -@@ -306,22 +336,18 @@ - &object_service_handle) == 0) { - - if (!objdb_get_string (objdb,object_service_handle, "user", &value)) { -- main_config->user = strdup(value); -- } -+ main_config->uid = uid_determine(value); -+ } else -+ main_config->uid = uid_determine("ais"); -+ - if (!objdb_get_string (objdb,object_service_handle, "group", &value)) { -- main_config->group = strdup(value); -- } -+ main_config->gid = gid_determine(value); -+ } else -+ main_config->gid = gid_determine("ais"); - } - - objdb->object_find_destroy (object_find_handle); - -- /* Default user/group */ -- if (!main_config->user) -- main_config->user = "ais"; -- -- if (!main_config->group) -- main_config->group = "ais"; -- - if ((main_config->logmode & LOG_MODE_OUTPUT_FILE) && - (main_config->logfile == NULL)) { - error_reason = "logmode set to 'file' but no logfile specified"; -@@ -331,6 +357,10 @@ - if (main_config->syslog_facility == 0) - main_config->syslog_facility = LOG_DAEMON; - -+ add_logsys_config_notification(objdb, main_config); -+ -+ logsys_fork_completed (); -+ - return 0; - - parse_error: -@@ -341,3 +371,38 @@ - *error_string = error_string_response; - return (-1); - } -+ -+ -+static void main_objdb_reload_notify(objdb_reload_notify_type_t type, int flush, -+ void *priv_data_pt) -+{ -+ struct main_config *main_config = priv_data_pt; -+ char *error_string; -+ -+ if (type == OBJDB_RELOAD_NOTIFY_END) { -+ -+ /* -+ * Reload the logsys configuration -+ */ -+ corosync_main_config_read_logging(global_objdb, -+ &error_string, -+ main_config); -+ } -+} -+ -+static void add_logsys_config_notification( -+ struct objdb_iface_ver0 *objdb, -+ struct main_config *main_config) -+{ -+ -+ global_objdb = objdb; -+ -+ objdb->object_track_start(OBJECT_PARENT_HANDLE, -+ 1, -+ NULL, -+ NULL, -+ NULL, -+ main_objdb_reload_notify, -+ main_config); -+ -+} -diff -Naurd corosync-0.92/exec/mainconfig.h corosync-trunk/exec/mainconfig.h ---- corosync-0.92/exec/mainconfig.h 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/mainconfig.h 2009-01-23 17:12:13.000000000 +0100 -@@ -61,13 +61,13 @@ - /* - * user/group to run as - */ -- char *user; -- char *group; -+ int uid; -+ int gid; - }; - - extern int corosync_main_config_read ( - struct objdb_iface_ver0 *objdb, - char **error_string, - struct main_config *main_config); -- -+ - #endif /* MAINCONFIG_H_DEFINED */ -diff -Naurd corosync-0.92/exec/main.h corosync-trunk/exec/main.h ---- corosync-0.92/exec/main.h 2008-08-20 02:57:40.000000000 +0200 -+++ corosync-trunk/exec/main.h 2008-11-06 22:49:07.000000000 +0100 -@@ -37,7 +37,7 @@ - - #define TRUE 1 - #define FALSE 0 --#include -+#include - #include - #include - #include -diff -Naurd corosync-0.92/exec/Makefile corosync-trunk/exec/Makefile ---- corosync-0.92/exec/Makefile 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/exec/Makefile 2008-12-08 16:55:41.000000000 +0100 -@@ -59,14 +59,14 @@ - EXEC_LIBS = libtotem_pg.a liblogsys.a - - # LCR objects --LCR_SRC = vsf_ykd.c objdb.c coroparse.c --LCR_OBJS = vsf_ykd.o objdb.o coroparse.o -+LCR_SRC = vsf_ykd.c objdb.c coroparse.c vsf_quorum.c -+LCR_OBJS = vsf_ykd.o objdb.o coroparse.o vsf_quorum.o - - # main executive objects - MAIN_SRC = main.c mempool.c util.c sync.c apidef.c service.c ipc.c flow.c \ -- timer.c totemconfig.c mainconfig.c -+ quorum.c timer.c totemconfig.c mainconfig.c - MAIN_OBJS = main.o mempool.o util.o sync.o apidef.o service.o ipc.o flow.o \ -- timer.o totemconfig.o mainconfig.o ../lcr/lcr_ifact.o -+ quorum.o timer.o totemconfig.o mainconfig.o ../lcr/lcr_ifact.o - - ifeq (${BUILD_DYNAMIC}, 1) - #EXEC_OBJS = $(TOTEM_OBJS) $(LOGSYS_OBJS) $(MAIN_OBJS) -@@ -75,7 +75,7 @@ - - all:libtotem_pg.a libtotem_pg.so.2.0.0 liblogsys.a liblogsys.so.2.0.0 \ - ../lcr/lcr_ifact.o corosync_ \ -- objdb.lcrso vsf_ykd.lcrso coroparse.lcrso -+ objdb.lcrso vsf_ykd.lcrso coroparse.lcrso vsf_quorum.lcrso - else - EXEC_OBJS = $(MAIN_OBJS) $(LCR_OBJS) - all: libtotem_pg.a liblogsys.a corosync -@@ -90,6 +90,9 @@ - vsf_ykd.lcrso: vsf_ykd.o - $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./corosync -bind_at_load vsf_ykd.o -o $@ - -+vsf_quorum.lcrso: vsf_quorum.o -+ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./corosync -bind_at_load vsf_quorum.o -o $@ -+ - coroparse.lcrso: coroparse.o - $(CC) -bundle -bundle_loader ./corosync -bind_at_load coroparse.o -o $@ - -@@ -98,9 +101,15 @@ - vsf_ykd.lcrso: vsf_ykd.o - $(CC) -shared -Wl,-soname,vsf_ykd.lcrso vsf_ykd.o -o $@ - -+vsf_quorum.lcrso: vsf_quorum.o -+ $(CC) -shared -Wl,-soname,vsf_quorum.lcrso vsf_quorum.o -o $@ -+ - objdb.lcrso: objdb.o - $(CC) -shared -Wl,-soname,objdb.lcrso objdb.o -o $@ - -+testquorum.lcrso: testquorum.o -+ $(CC) -shared -Wl,-soname,testquorum.lcrso objdb.o -o $@ -+ - coroparse.lcrso: coroparse.o - $(CC) -shared -Wl,-soname,coroparse.lcrso coroparse.o -o $@ - endif -@@ -131,6 +140,9 @@ - - endif - -+lint: -+ -splint $(LINT_FLAGS) $(CFLAGS) *.c -+ - clean: - rm -f corosync $(OBJS) *.o *.lcrso libtotem_pg.so* libtotem_pg.a gmon.out - rm -f *.da *.bb *.bbg liblogsys.so* liblogsys.a -@@ -145,9 +157,15 @@ - vsf_ykd.o: vsf_ykd.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -+vsf_quorum.o: vsf_quorum.c -+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< -+ - objdb.o: objdb.c - $(CC) $(CFLAGS) -c -o $@ $< - -+testquorum.o: testquorum.c -+ $(CC) $(CFLAGS) -c -o $@ $< -+ - coroparse.o: coroparse.c - $(CC) $(CFLAGS) -c -o $@ $< - -diff -Naurd corosync-0.92/exec/objdb.c corosync-trunk/exec/objdb.c ---- corosync-0.92/exec/objdb.c 2008-09-03 12:01:31.000000000 +0200 -+++ corosync-trunk/exec/objdb.c 2009-01-23 16:41:06.000000000 +0100 -@@ -1,6 +1,6 @@ - /* - * Copyright (c) 2006 MontaVista Software, Inc. -- * Copyright (c) 2007-2008 Red Hat, Inc. -+ * Copyright (c) 2007-2009 Red Hat, Inc. - * - * All rights reserved. - * -@@ -59,6 +59,7 @@ - object_key_change_notify_fn_t key_change_notify_fn; - object_create_notify_fn_t object_create_notify_fn; - object_destroy_notify_fn_t object_destroy_notify_fn; -+ object_reload_notify_fn_t object_reload_notify_fn; - struct list_head tracker_list; - struct list_head object_list; - }; -@@ -91,6 +92,9 @@ - - struct objdb_iface_ver0 objdb_iface; - struct list_head objdb_trackers_head; -+static pthread_rwlock_t reload_lock; -+static pthread_t lock_thread; -+static pthread_mutex_t meta_lock; - - static struct hdb_handle_database object_instance_database = { - .handle_count = 0, -@@ -107,6 +111,38 @@ - }; - - -+static void objdb_wrlock() -+{ -+ pthread_mutex_lock(&meta_lock); -+ pthread_rwlock_wrlock(&reload_lock); -+ lock_thread = pthread_self(); -+ pthread_mutex_unlock(&meta_lock); -+} -+ -+static void objdb_rdlock() -+{ -+ pthread_mutex_lock(&meta_lock); -+ if (lock_thread != pthread_self()) -+ pthread_rwlock_rdlock(&reload_lock); -+ pthread_mutex_unlock(&meta_lock); -+} -+ -+static void objdb_rdunlock() -+{ -+ pthread_mutex_lock(&meta_lock); -+ if (lock_thread != pthread_self()) -+ pthread_rwlock_unlock(&reload_lock); -+ pthread_mutex_unlock(&meta_lock); -+} -+ -+static void objdb_wrunlock() -+{ -+ pthread_mutex_lock(&meta_lock); -+ pthread_rwlock_unlock(&reload_lock); -+ lock_thread = 0; -+ pthread_mutex_unlock(&meta_lock); -+} -+ - static int objdb_init (void) - { - unsigned int handle; -@@ -135,6 +171,8 @@ - list_init (&instance->child_list); - list_init (&instance->track_head); - list_init (&objdb_trackers_head); -+ pthread_rwlock_init(&reload_lock, NULL); -+ pthread_mutex_init(&meta_lock, NULL); - - hdb_handle_put (&object_instance_database, handle); - return (0); -@@ -293,6 +331,30 @@ - } while (obj_pt->object_handle != OBJECT_PARENT_HANDLE); - } - -+static void object_reload_notification(int startstop, int flush) -+{ -+ struct list_head * list; -+ struct object_instance * obj_pt; -+ struct object_tracker * tracker_pt; -+ unsigned int res; -+ -+ res = hdb_handle_get (&object_instance_database, -+ OBJECT_PARENT_HANDLE, (void *)&obj_pt); -+ -+ for (list = obj_pt->track_head.next; -+ list != &obj_pt->track_head; list = list->next) { -+ -+ tracker_pt = list_entry (list, struct object_tracker, object_list); -+ -+ if (tracker_pt->object_reload_notify_fn != NULL) { -+ tracker_pt->object_reload_notify_fn(startstop, flush, -+ tracker_pt->data_pt); -+ } -+ } -+ hdb_handle_put (&object_instance_database, OBJECT_PARENT_HANDLE); -+} -+ -+ - /* - * object db create/destroy/set - */ -@@ -308,6 +370,7 @@ - int found = 0; - int i; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - parent_object_handle, (void *)&parent_instance); - if (res != 0) { -@@ -380,7 +443,7 @@ - object_instance->parent_handle, - object_instance->object_name, - object_instance->object_name_len); -- -+ objdb_rdunlock(); - return (0); - - error_put_destroy: -@@ -393,6 +456,7 @@ - hdb_handle_put (&object_instance_database, parent_object_handle); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -403,6 +467,8 @@ - int res; - struct object_instance *object_instance; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&object_instance); - if (res != 0) { -@@ -412,9 +478,11 @@ - object_instance->priv = priv; - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - return (0); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -432,6 +500,8 @@ - int i; - unsigned int val; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -493,7 +563,7 @@ - list_add_tail (&object_key->list, &instance->key_head); - object_key_changed_notification(object_handle, key_name, key_len, - value, value_len, OBJECT_KEY_CREATED); -- -+ objdb_rdunlock(); - return (0); - - error_put_key: -@@ -506,6 +576,7 @@ - hdb_handle_put (&object_instance_database, object_handle); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -554,9 +625,12 @@ - struct object_instance *instance; - unsigned int res; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -+ objdb_rdunlock(); - return (res); - } - -@@ -572,6 +646,7 @@ - free(instance->object_name); - free(instance); - -+ objdb_rdunlock(); - return (res); - } - -@@ -583,6 +658,7 @@ - struct object_instance *instance; - unsigned int res; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -594,9 +670,11 @@ - - hdb_handle_put (&object_instance_database, object_handle); - -+ objdb_rdunlock(); - return (0); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -608,6 +686,7 @@ - struct object_instance *instance; - unsigned int res; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -619,9 +698,11 @@ - - hdb_handle_put (&object_instance_database, object_handle); - -+ objdb_rdunlock(); - return (0); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -638,6 +719,7 @@ - struct object_instance *object_instance; - struct object_find_instance *object_find_instance; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&object_instance); - if (res != 0) { -@@ -662,6 +744,8 @@ - - hdb_handle_put (&object_instance_database, object_handle); - hdb_handle_put (&object_find_instance_database, *object_find_handle); -+ -+ objdb_rdunlock(); - return (0); - - error_destroy: -@@ -671,6 +755,7 @@ - hdb_handle_put (&object_instance_database, object_handle); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -684,6 +769,7 @@ - struct list_head *list; - unsigned int found = 0; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_find_instance_database, - object_find_handle, (void *)&object_find_instance); - if (res != 0) { -@@ -714,16 +800,35 @@ - *object_handle = object_instance->object_handle; - res = 0; - } -+ objdb_rdunlock(); - return (res); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - - static int object_find_destroy ( - unsigned int object_find_handle) - { -+ struct object_find_instance *object_find_instance; -+ unsigned int res; -+ -+ objdb_rdlock(); -+ res = hdb_handle_get (&object_find_instance_database, -+ object_find_handle, (void *)&object_find_instance); -+ if (res != 0) { -+ goto error_exit; -+ } -+ hdb_handle_put(&object_find_instance_database, object_find_handle); -+ hdb_handle_destroy(&object_find_instance_database, object_find_handle); -+ -+ objdb_rdunlock(); - return (0); -+ -+error_exit: -+ objdb_rdunlock(); -+ return (-1); - } - - static int object_key_get ( -@@ -739,6 +844,7 @@ - struct list_head *list; - int found = 0; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -766,9 +872,11 @@ - } - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - return (res); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -784,6 +892,7 @@ - struct list_head *list; - int found = 0; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -809,9 +918,11 @@ - } - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - return (res); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -827,6 +938,7 @@ - struct list_head *list; - int found = 0; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -852,9 +964,11 @@ - } - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - return (res); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -872,6 +986,7 @@ - struct list_head *list; - int found = 0; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -906,9 +1021,11 @@ - if (ret == 0) - object_key_changed_notification(object_handle, key_name, key_len, - value, value_len, OBJECT_KEY_DELETED); -+ objdb_rdunlock(); - return (ret); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -928,6 +1045,8 @@ - struct list_head *list; - int found = 0; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -950,6 +1069,7 @@ - - if (found) { - int i; -+ int found_validator = 0; - - /* - * Do validation check if validation is configured for the parent object -@@ -962,7 +1082,7 @@ - instance->object_key_valid_list[i].key_name, - key_len) == 0)) { - -- found = 1; -+ found_validator = 1; - break; - } - } -@@ -970,7 +1090,7 @@ - /* - * Item not found in validation list - */ -- if (found == 0) { -+ if (found_validator == 0) { - goto error_put; - } else { - if (instance->object_key_valid_list[i].validate_callback) { -@@ -983,7 +1103,7 @@ - } - } - -- if (new_value_len <= object_key->value_len) { -+ if (new_value_len != object_key->value_len) { - void *replacement_value; - replacement_value = malloc(new_value_len); - if (!replacement_value) -@@ -1003,11 +1123,13 @@ - if (ret == 0) - object_key_changed_notification(object_handle, key_name, key_len, - new_value, new_value_len, OBJECT_KEY_REPLACED); -+ objdb_rdunlock(); - return (ret); - - error_put: - hdb_handle_put (&object_instance_database, object_handle); - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -1018,6 +1140,7 @@ - int res; - struct object_instance *object_instance; - -+ objdb_rdunlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&object_instance); - if (res != 0) { -@@ -1027,9 +1150,11 @@ - *priv = object_instance->priv; - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - return (0); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -1092,6 +1217,8 @@ - unsigned int res; - struct object_instance *instance; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -@@ -1100,9 +1227,11 @@ - instance->iter_key_list = &instance->key_head; - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - return (0); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -1119,6 +1248,8 @@ - struct list_head *list; - unsigned int found = 0; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - parent_object_handle, (void *)&instance); - if (res != 0) { -@@ -1145,9 +1276,11 @@ - } - - hdb_handle_put (&object_instance_database, parent_object_handle); -+ objdb_rdunlock(); - return (res); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -1165,6 +1298,8 @@ - struct list_head *list; - unsigned int found = 0; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - parent_object_handle, (void *)&instance); - if (res != 0) { -@@ -1197,9 +1332,11 @@ - } - - hdb_handle_put (&object_instance_database, parent_object_handle); -+ objdb_rdunlock(); - return (res); - - error_exit: -+ objdb_rdunlock(); - return (-1); - } - -@@ -1210,9 +1347,12 @@ - struct object_instance *instance; - unsigned int res; - -+ objdb_rdlock(); -+ - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -+ objdb_rdunlock(); - return (res); - } - -@@ -1222,6 +1362,7 @@ - *parent_handle = instance->parent_handle; - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - - return (0); - } -@@ -1233,9 +1374,11 @@ - struct object_instance *instance; - unsigned int res; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -+ objdb_rdunlock(); - return (res); - } - -@@ -1243,6 +1386,7 @@ - *object_name_len = instance->object_name_len; - - hdb_handle_put (&object_instance_database, object_handle); -+ objdb_rdunlock(); - - return (0); - } -@@ -1253,6 +1397,7 @@ - object_key_change_notify_fn_t key_change_notify_fn, - object_create_notify_fn_t object_create_notify_fn, - object_destroy_notify_fn_t object_destroy_notify_fn, -+ object_reload_notify_fn_t object_reload_notify_fn, - void * priv_data_pt) - { - struct object_instance *instance; -@@ -1271,6 +1416,7 @@ - tracker_pt->key_change_notify_fn = key_change_notify_fn; - tracker_pt->object_create_notify_fn = object_create_notify_fn; - tracker_pt->object_destroy_notify_fn = object_destroy_notify_fn; -+ tracker_pt->object_reload_notify_fn = object_reload_notify_fn; - tracker_pt->data_pt = priv_data_pt; - - list_init(&tracker_pt->object_list); -@@ -1287,6 +1433,7 @@ - static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn, - object_create_notify_fn_t object_create_notify_fn, - object_destroy_notify_fn_t object_destroy_notify_fn, -+ object_reload_notify_fn_t object_reload_notify_fn, - void * priv_data_pt) - { - struct object_instance *instance; -@@ -1305,6 +1452,7 @@ - if (tracker_pt && (tracker_pt->data_pt == priv_data_pt) && - (tracker_pt->object_create_notify_fn == object_create_notify_fn) && - (tracker_pt->object_destroy_notify_fn == object_destroy_notify_fn) && -+ (tracker_pt->object_reload_notify_fn == object_reload_notify_fn) && - (tracker_pt->key_change_notify_fn == key_change_notify_fn)) { - - /* get the object & take this tracker off of it's list. */ -@@ -1337,9 +1485,11 @@ - struct object_instance *instance; - unsigned int res; - -+ objdb_rdlock(); - res = hdb_handle_get (&object_instance_database, - object_handle, (void *)&instance); - if (res != 0) { -+ objdb_rdunlock(); - return (res); - } - -@@ -1347,6 +1497,7 @@ - - hdb_handle_put (&object_instance_database, object_handle); - -+ objdb_rdunlock(); - return (res); - } - -@@ -1358,13 +1509,19 @@ - int res; - - main_get_config_modules(&modules, &num_modules); -+ -+ objdb_wrlock(); -+ - for (i=0; iconfig_writeconfig) { - res = modules[i]->config_writeconfig(&objdb_iface, error_string); -- if (res) -+ if (res) { -+ objdb_wrunlock(); - return res; -+ } - } - } -+ objdb_wrunlock(); - return 0; - } - -@@ -1376,14 +1533,22 @@ - int res; - - main_get_config_modules(&modules, &num_modules); -+ object_reload_notification(OBJDB_RELOAD_NOTIFY_START, flush); -+ -+ objdb_wrlock(); - - for (i=0; iconfig_reloadconfig) { - res = modules[i]->config_reloadconfig(&objdb_iface, flush, error_string); -- if (res) -+ if (res) { -+ object_reload_notification(OBJDB_RELOAD_NOTIFY_FAILED, flush); -+ objdb_wrunlock(); - return res; -+ } - } - } -+ objdb_wrunlock(); -+ object_reload_notification(OBJDB_RELOAD_NOTIFY_END, flush); - return 0; - } - -diff -Naurd corosync-0.92/exec/quorum.c corosync-trunk/exec/quorum.c ---- corosync-0.92/exec/quorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/exec/quorum.c 2008-12-09 14:48:47.000000000 +0100 -@@ -0,0 +1,115 @@ -+/* -+ * Copyright (c) 2008 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 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "quorum.h" -+#include "main.h" -+#include "sync.h" -+#include "vsf.h" -+ -+LOGSYS_DECLARE_SUBSYS ("QUORUM", LOG_INFO); -+ -+ -+static struct quorum_callin_functions *corosync_quorum_fns = NULL; -+ -+int corosync_quorum_is_quorate (void) -+{ -+ if (corosync_quorum_fns) { -+ return corosync_quorum_fns->quorate(); -+ } -+ else { -+ return 1; -+ } -+} -+ -+int corosync_quorum_register_callback (quorum_callback_fn_t fn, void *context) -+{ -+ if (corosync_quorum_fns) { -+ return corosync_quorum_fns->register_callback(fn, context); -+ } -+ else { -+ return 0; -+ } -+} -+ -+int corosync_quorum_unregister_callback (quorum_callback_fn_t fn, void *context) -+{ -+ if (corosync_quorum_fns) { -+ return corosync_quorum_fns->unregister_callback(fn, context); -+ } -+ else { -+ return 0; -+ } -+} -+ -+int corosync_quorum_initialize (struct quorum_callin_functions *fns, -+ sync_callback_fn_t *sync_callback_fn) -+{ -+ if (corosync_quorum_fns) -+ return -1; -+ -+ corosync_quorum_fns = fns; -+ *sync_callback_fn = sync_primary_callback_fn; -+ return 0; -+} -+ -+int quorum_none(void) -+{ -+ if (corosync_quorum_fns) -+ return 0; -+ else -+ return 1; -+} -diff -Naurd corosync-0.92/exec/quorum.h corosync-trunk/exec/quorum.h ---- corosync-0.92/exec/quorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/exec/quorum.h 2008-12-08 16:55:41.000000000 +0100 -@@ -0,0 +1,68 @@ -+/* -+ * Copyright (c) 2008 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 the 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. -+ */ -+ -+#ifndef QUORUM_H_DEFINED -+#define QUORUM_H_DEFINED -+ -+struct memb_ring_id; -+ -+typedef void (*quorum_callback_fn_t) (int quorate, void *context); -+ -+typedef void (*sync_callback_fn_t) ( -+ unsigned int *view_list, -+ int view_list_entries, -+ int primary_designated, -+ struct memb_ring_id *ring_id); -+ -+struct quorum_callin_functions -+{ -+ int (*quorate) (void); -+ int (*register_callback) (quorum_callback_fn_t, void*); -+ int (*unregister_callback) (quorum_callback_fn_t, void*); -+}; -+ -+extern int corosync_quorum_is_quorate (void); -+ -+extern int corosync_quorum_register_callback (quorum_callback_fn_t fn, void *context); -+ -+extern int corosync_quorum_unregister_callback (quorum_callback_fn_t fn, void *context); -+ -+extern int corosync_quorum_initialize (struct quorum_callin_functions *fns, -+ sync_callback_fn_t *sync_callback_fn); -+ -+ -+extern int quorum_none(void); -+ -+ -+#endif /* QUORUM_H_DEFINED */ -diff -Naurd corosync-0.92/exec/service.c corosync-trunk/exec/service.c ---- corosync-0.92/exec/service.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/service.c 2009-01-27 09:59:14.000000000 +0100 -@@ -78,6 +78,10 @@ - .name = "corosync_confdb", - .ver = 0, - }, -+ { -+ .name = "corosync_pload", -+ .ver = 0, -+ } - }; - - struct corosync_service_engine *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT]; -diff -Naurd corosync-0.92/exec/sync.c corosync-trunk/exec/sync.c ---- corosync-0.92/exec/sync.c 2008-09-17 21:04:19.000000000 +0200 -+++ corosync-trunk/exec/sync.c 2008-12-08 16:55:41.000000000 +0100 -@@ -49,16 +49,17 @@ - #include - #include - --#include -+#include - #include - #include - #include - #include - #include -+#include "quorum.h" - - #include "main.h" - #include "sync.h" --#include "vsf.h" -+ - - LOGSYS_DECLARE_SUBSYS ("SYNC", LOG_INFO); - -@@ -72,8 +73,6 @@ - - static struct memb_ring_id *sync_ring_id; - --static int vsf_none = 0; -- - static int (*sync_callbacks_retrieve) (int sync_id, struct sync_callbacks *callack); - - static struct sync_callbacks sync_callbacks; -@@ -93,8 +92,6 @@ - - static struct barrier_data barrier_data_process[PROCESSOR_COUNT_MAX]; - --static struct corosync_vsf_iface_ver0 *vsf_iface; -- - static int sync_barrier_send (struct memb_ring_id *ring_id); - - static int sync_start_process (enum totem_callback_token_type type, void *data); -@@ -116,12 +113,6 @@ - unsigned int *joined_list, int joined_list_entries, - struct memb_ring_id *ring_id); - --static void sync_primary_callback_fn ( -- unsigned int *view_list, -- int view_list_entries, -- int primary_designated, -- struct memb_ring_id *ring_id); -- - static struct totempg_group sync_group = { - .group = "sync", - .group_len = 4 -@@ -266,13 +257,10 @@ - - int sync_register ( - int (*callbacks_retrieve) (int sync_id, struct sync_callbacks *callack), -- void (*synchronization_completed) (void), -- char *vsf_type) -+ void (*synchronization_completed) (void)) -+ - { - unsigned int res; -- unsigned int vsf_handle; -- void *vsf_iface_p; -- char corosync_vsf_type[1024]; - - res = totempg_groups_initialize ( - &sync_group_handle, -@@ -292,42 +280,13 @@ - log_printf (LOG_LEVEL_ERROR, "Couldn't join group.\n"); - return (-1); - } -- -- if (strcmp (vsf_type, "none") == 0) { -- log_printf (LOG_LEVEL_NOTICE, -- "Not using a virtual synchrony filter.\n"); -- vsf_none = 1; -- } else { -- vsf_none = 0; -- -- sprintf (corosync_vsf_type, "corosync_vsf_%s", vsf_type); -- res = lcr_ifact_reference ( -- &vsf_handle, -- corosync_vsf_type, -- 0, -- &vsf_iface_p, -- 0); -- -- if (res == -1) { -- log_printf (LOG_LEVEL_NOTICE, -- "Couldn't load virtual synchrony filter %s\n", -- vsf_type); -- return (-1); -- } -- -- log_printf (LOG_LEVEL_NOTICE, -- "Using virtual synchrony filter %s\n", corosync_vsf_type); -- -- vsf_iface = (struct corosync_vsf_iface_ver0 *)vsf_iface_p; -- vsf_iface->init (sync_primary_callback_fn); -- } - - sync_callbacks_retrieve = callbacks_retrieve; - sync_synchronization_completed = synchronization_completed; - return (0); - } - --static void sync_primary_callback_fn ( -+void sync_primary_callback_fn ( - unsigned int *view_list, - int view_list_entries, - int primary_designated, -@@ -335,13 +294,6 @@ - { - int i; - -- if (primary_designated) { -- log_printf (LOG_LEVEL_NOTICE, "This node is within the primary component and will provide service.\n"); -- } else { -- log_printf (LOG_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services.\n"); -- return; -- } -- - /* - * Execute configuration change for synchronization service - */ -@@ -521,7 +473,7 @@ - * If no virtual synchrony filter configured, then start - * synchronization process - */ -- if (vsf_none == 1) { -+ if (quorum_none() == 1) { - sync_primary_callback_fn ( - member_list, - member_list_entries, -@@ -546,7 +498,7 @@ - struct iovec iovec[2]; - int name_len; - -- ENTER("'%s'", name); -+ ENTER(); - - name_len = strlen (name) + 1; - msg.header.size = sizeof (msg) + name_len; -@@ -589,15 +541,6 @@ - return (sync_processing); - } - --int sync_primary_designated (void) --{ -- if (vsf_none == 1) { -- return (1); -- } else { -- return (vsf_iface->primary()); -- } --} -- - /** - * Execute synchronization upon request for the named service - * @param name -@@ -608,7 +551,7 @@ - { - assert (name != NULL); - -- ENTER("'%s'", name); -+ ENTER(); - - if (sync_processing) { - return -1; -@@ -618,7 +561,7 @@ - TOTEM_CALLBACK_TOKEN_SENT, 0, /* don't delete after callback */ - sync_request_send, name); - -- LEAVE(""); -+ LEAVE(); - - return 0; - } -diff -Naurd corosync-0.92/exec/sync.h corosync-trunk/exec/sync.h ---- corosync-0.92/exec/sync.h 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/sync.h 2008-12-08 16:55:41.000000000 +0100 -@@ -47,10 +47,10 @@ - char *name; - }; - -+struct corosync_api_v1; - int sync_register ( - int (*sync_callbacks_retrieve) (int sync_id, struct sync_callbacks *callbacks), -- void (*synchronization_completed) (void), -- char *vsf_type); -+ void (*synchronization_completed) (void)); - - int sync_in_process (void); - -@@ -64,4 +64,11 @@ - */ - extern int sync_request (char *name); - -+extern void sync_primary_callback_fn ( -+ unsigned int *view_list, -+ int view_list_entries, -+ int primary_designated, -+ struct memb_ring_id *ring_id); -+ -+ - #endif /* SYNC_H_DEFINED */ -diff -Naurd corosync-0.92/exec/timer.c corosync-trunk/exec/timer.c ---- corosync-0.92/exec/timer.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/exec/timer.c 2008-11-06 22:49:07.000000000 +0100 -@@ -56,7 +56,7 @@ - #include - - #include --#include -+#include - #include - #include - #include -diff -Naurd corosync-0.92/exec/totemconfig.c corosync-trunk/exec/totemconfig.c ---- corosync-0.92/exec/totemconfig.c 2008-08-20 02:57:40.000000000 +0200 -+++ corosync-trunk/exec/totemconfig.c 2008-12-12 12:27:27.000000000 +0100 -@@ -76,6 +76,13 @@ - #define RRP_PROBLEM_COUNT_THRESHOLD_MIN 5 - - static char error_string_response[512]; -+static struct objdb_iface_ver0 *global_objdb; -+ -+static void add_totem_config_notification( -+ struct objdb_iface_ver0 *objdb, -+ struct totem_config *totem_config, -+ unsigned int totem_object_handle); -+ - - /* These just makes the code below a little neater */ - static inline int objdb_get_string ( -@@ -163,6 +170,50 @@ - return (0); - } - -+static void totem_volatile_config_read ( -+ struct objdb_iface_ver0 *objdb, -+ struct totem_config *totem_config, -+ unsigned int object_totem_handle) -+{ -+ objdb_get_int (objdb,object_totem_handle, "token", &totem_config->token_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "token_retransmit", &totem_config->token_retransmit_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "hold", &totem_config->token_hold_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "token_retransmits_before_loss_const", &totem_config->token_retransmits_before_loss_const); -+ -+ objdb_get_int (objdb,object_totem_handle, "join", &totem_config->join_timeout); -+ objdb_get_int (objdb,object_totem_handle, "send_join", &totem_config->send_join_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "consensus", &totem_config->consensus_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "merge", &totem_config->merge_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "downcheck", &totem_config->downcheck_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "fail_recv_const", &totem_config->fail_to_recv_const); -+ -+ objdb_get_int (objdb,object_totem_handle, "seqno_unchanged_const", &totem_config->seqno_unchanged_const); -+ -+ objdb_get_int (objdb,object_totem_handle, "rrp_token_expired_timeout", &totem_config->rrp_token_expired_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_timeout", &totem_config->rrp_problem_count_timeout); -+ -+ objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_threshold", &totem_config->rrp_problem_count_threshold); -+ -+ objdb_get_int (objdb,object_totem_handle, "heartbeat_failures_allowed", &totem_config->heartbeat_failures_allowed); -+ -+ objdb_get_int (objdb,object_totem_handle, "max_network_delay", &totem_config->max_network_delay); -+ -+ objdb_get_int (objdb,object_totem_handle, "window_size", &totem_config->window_size); -+ objdb_get_string (objdb, object_totem_handle, "vsftype", &totem_config->vsf_type); -+ -+ objdb_get_int (objdb,object_totem_handle, "max_messages", &totem_config->max_messages); -+ -+} -+ -+ - extern int totem_config_read ( - struct objdb_iface_ver0 *objdb, - struct totem_config *totem_config, -@@ -222,41 +273,10 @@ - - objdb_get_int (objdb,object_totem_handle, "netmtu", &totem_config->net_mtu); - -- objdb_get_int (objdb,object_totem_handle, "token", &totem_config->token_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "token_retransmit", &totem_config->token_retransmit_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "hold", &totem_config->token_hold_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "token_retransmits_before_loss_const", &totem_config->token_retransmits_before_loss_const); -- -- objdb_get_int (objdb,object_totem_handle, "join", &totem_config->join_timeout); -- objdb_get_int (objdb,object_totem_handle, "send_join", &totem_config->send_join_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "consensus", &totem_config->consensus_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "merge", &totem_config->merge_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "downcheck", &totem_config->downcheck_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "fail_recv_const", &totem_config->fail_to_recv_const); -- -- objdb_get_int (objdb,object_totem_handle, "seqno_unchanged_const", &totem_config->seqno_unchanged_const); -- -- objdb_get_int (objdb,object_totem_handle, "rrp_token_expired_timeout", &totem_config->rrp_token_expired_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_timeout", &totem_config->rrp_problem_count_timeout); -- -- objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_threshold", &totem_config->rrp_problem_count_threshold); -- -- objdb_get_int (objdb,object_totem_handle, "heartbeat_failures_allowed", &totem_config->heartbeat_failures_allowed); -- -- objdb_get_int (objdb,object_totem_handle, "max_network_delay", &totem_config->max_network_delay); -- -- objdb_get_int (objdb,object_totem_handle, "window_size", &totem_config->window_size); -- objdb_get_string (objdb, object_totem_handle, "vsftype", &totem_config->vsf_type); -- -- objdb_get_int (objdb,object_totem_handle, "max_messages", &totem_config->max_messages); -+ /* -+ * Get things that might change in the future -+ */ -+ totem_volatile_config_read (objdb, totem_config, object_totem_handle); - - objdb->object_find_create ( - object_totem_handle, -@@ -297,6 +317,8 @@ - - objdb->object_find_destroy (object_find_interface_handle); - -+ add_totem_config_notification(objdb, totem_config, object_totem_handle); -+ - return 0; - } - -@@ -323,7 +345,7 @@ - error_reason = "No multicast address specified"; - goto parse_error; - } -- -+ - if (totem_config->interfaces[i].ip_port == 0) { - error_reason = "No multicast port specified"; - goto parse_error; -@@ -331,7 +353,7 @@ - - if (totem_config->interfaces[i].mcast_addr.family == AF_INET6 && - totem_config->node_id == 0) { -- -+ - error_reason = "An IPV6 network requires that a node ID be specified."; - goto parse_error; - } -@@ -498,7 +520,7 @@ - totem_config->rrp_token_expired_timeout = - totem_config->token_retransmit_timeout; - } -- -+ - if (totem_config->rrp_token_expired_timeout < MINIMUM_TIMEOUT) { - sprintf (local_error_reason, "The RRP token expired timeout parameter (%d ms) may not be less then (%d ms).", - totem_config->rrp_token_expired_timeout, MINIMUM_TIMEOUT); -@@ -658,3 +680,92 @@ - return (-1); - - } -+ -+static void totem_key_change_notify(object_change_type_t change_type, -+ unsigned int parent_object_handle, -+ unsigned int object_handle, -+ void *object_name_pt, int object_name_len, -+ void *key_name_pt, int key_len, -+ void *key_value_pt, int key_value_len, -+ void *priv_data_pt) -+{ -+ struct totem_config *totem_config = priv_data_pt; -+ -+ if (memcmp(object_name_pt, "totem", object_name_len) == 0) -+ totem_volatile_config_read(global_objdb, -+ totem_config, -+ object_handle); // CHECK -+} -+ -+static void totem_objdb_reload_notify(objdb_reload_notify_type_t type, int flush, -+ void *priv_data_pt) -+{ -+ struct totem_config *totem_config = priv_data_pt; -+ unsigned int totem_object_handle; -+ -+ /* -+ * A new totem {} key might exist, cancel the -+ * existing notification at the start of reload, -+ * and start a new one on the new object when -+ * it's all settled. -+ */ -+ -+ if (type == OBJDB_RELOAD_NOTIFY_START) { -+ global_objdb->object_track_stop( -+ totem_key_change_notify, -+ NULL, -+ NULL, -+ NULL, -+ NULL); -+ } -+ -+ if (type == OBJDB_RELOAD_NOTIFY_END || -+ type == OBJDB_RELOAD_NOTIFY_FAILED) { -+ -+ -+ if (!totem_handle_find(global_objdb, -+ &totem_object_handle)) { -+ add_totem_config_notification(global_objdb, totem_config, totem_object_handle); -+ -+ /* -+ * Reload the configuration -+ */ -+ totem_volatile_config_read(global_objdb, -+ totem_config, -+ totem_object_handle); -+ -+ } -+ else { -+ log_printf(LOG_LEVEL_ERROR, "totem objdb tracking stopped, cannot find totem{} handle on objdb\n"); -+ } -+ } -+} -+ -+ -+static void add_totem_config_notification( -+ struct objdb_iface_ver0 *objdb, -+ struct totem_config *totem_config, -+ unsigned int totem_object_handle) -+{ -+ -+ global_objdb = objdb; -+ objdb->object_track_start(totem_object_handle, -+ 1, -+ totem_key_change_notify, -+ NULL, // object_create_notify, -+ NULL, // object_destroy_notify, -+ NULL, // object_reload_notify -+ totem_config); // priv_data -+ -+ /* -+ * Reload notify must be on the parent object -+ */ -+ objdb->object_track_start(OBJECT_PARENT_HANDLE, -+ 1, -+ NULL, // key_change_notify, -+ NULL, // object_create_notify, -+ NULL, // object_destroy_notify, -+ totem_objdb_reload_notify, // object_reload_notify -+ totem_config); // priv_data -+ -+} -diff -Naurd corosync-0.92/exec/totemconfig.h corosync-trunk/exec/totemconfig.h ---- corosync-0.92/exec/totemconfig.h 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totemconfig.h 2008-11-06 22:49:07.000000000 +0100 -@@ -36,7 +36,7 @@ - #define TOTEMCONFIG_H_DEFINED - - #include --#include -+#include - #include - #include - #include -diff -Naurd corosync-0.92/exec/totemip.c corosync-trunk/exec/totemip.c ---- corosync-0.92/exec/totemip.c 2008-09-16 17:35:09.000000000 +0200 -+++ corosync-trunk/exec/totemip.c 2009-01-26 21:46:45.000000000 +0100 -@@ -226,7 +226,7 @@ - sin->sin_len = sizeof(struct sockaddr_in); - #endif - sin->sin_family = ip_addr->family; -- sin->sin_port = port; -+ sin->sin_port = ntohs(port); - memcpy(&sin->sin_addr, ip_addr->addr, sizeof(struct in_addr)); - *addrlen = sizeof(struct sockaddr_in); - ret = 0; -@@ -240,7 +240,7 @@ - sin->sin6_len = sizeof(struct sockaddr_in6); - #endif - sin->sin6_family = ip_addr->family; -- sin->sin6_port = port; -+ sin->sin6_port = ntohs(port); - sin->sin6_scope_id = 2; - memcpy(&sin->sin6_addr, ip_addr->addr, sizeof(struct in6_addr)); - -@@ -376,7 +376,8 @@ - int totemip_iface_check(struct totem_ip_address *bindnet, - struct totem_ip_address *boundto, - int *interface_up, -- int *interface_num) -+ int *interface_num, -+ int mask_high_bit) - { - int fd; - struct { -@@ -472,7 +473,7 @@ - memcpy(&network, RTA_DATA(tb[IFA_BROADCAST]), sizeof(uint32_t)); - memcpy(&addr, bindnet->addr, sizeof(uint32_t)); - -- if (addr == (network & netmask)) { -+ if ((addr & netmask) == (network & netmask)) { - memcpy(ipaddr.addr, RTA_DATA(tb[IFA_ADDRESS]), TOTEMIP_ADDRLEN); - found_if = 1; - } -@@ -514,6 +515,18 @@ - } - } - finished: -+ /* -+ * Mask 32nd bit off to workaround bugs in other poeples code -+ * if configuration requests it. -+ */ -+ if (ipaddr.family == AF_INET && ipaddr.nodeid == 0) { -+ unsigned int nodeid = 0; -+ memcpy (&nodeid, ipaddr.addr, sizeof (int)); -+ if (mask_high_bit) { -+ nodeid &= 0x7FFFFFFF; -+ } -+ ipaddr.nodeid = nodeid; -+ } - totemip_copy (boundto, &ipaddr); - close(fd); - return 0; -diff -Naurd corosync-0.92/exec/totemmrp.c corosync-trunk/exec/totemmrp.c ---- corosync-0.92/exec/totemmrp.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totemmrp.c 2008-12-01 19:44:55.000000000 +0100 -@@ -192,7 +192,7 @@ - return (res); - } - --int totemmrp_my_nodeid_get (void) -+unsigned int totemmrp_my_nodeid_get (void) - { - return (totemsrp_my_nodeid_get (totemsrp_handle_in)); - } -diff -Naurd corosync-0.92/exec/totemnet.c corosync-trunk/exec/totemnet.c ---- corosync-0.92/exec/totemnet.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totemnet.c 2009-01-25 22:15:25.000000000 +0100 -@@ -137,7 +137,11 @@ - - int totemnet_log_level_debug; - -- void (*totemnet_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))); -+ int totemnet_subsys_id; -+ -+ void (*totemnet_log_printf) (int subsys, char *function, char *file, -+ int line, unsigned int level, char *format, -+ ...)__attribute__((format(printf, 6, 7))); - - totemnet_handle handle; - -@@ -226,8 +230,12 @@ - instance->my_memb_entries = 1; - } - --#define log_printf(level, format, args...) \ -- instance->totemnet_log_printf (__FILE__, __LINE__, level, format, ##args) -+#define log_printf(level, format, args...) \ -+do { \ -+ instance->totemnet_log_printf (instance->totemnet_subsys_id, \ -+ (char *)__FUNCTION__, __FILE__, __LINE__, level, \ -+ format, ##args); \ -+} while (0); - - static int authenticate_and_decrypt ( - struct totemnet_instance *instance, -@@ -691,18 +699,9 @@ - int res; - - res = totemip_iface_check (bindnet, bound_to, -- interface_up, interface_num); -+ interface_up, interface_num, -++ 0); // TODO andrew can address this instance->totem_config->clear_node_high_bit); - -- /* -- * If the desired binding is to an IPV4 network and nodeid isn't -- * specified, retrieve the node id from this_ip network address -- * -- * IPV6 networks must have a node ID specified since the node id -- * field is only 32 bits. -- */ -- if (bound_to->family == AF_INET && bound_to->nodeid == 0) { -- memcpy (&bound_to->nodeid, bound_to->addr, sizeof (int)); -- } - - return (res); - } -@@ -1192,6 +1191,7 @@ - instance->totemnet_log_level_warning = totem_config->totem_logging_configuration.log_level_warning; - instance->totemnet_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; - instance->totemnet_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; -+ instance->totemnet_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; - instance->totemnet_log_printf = totem_config->totem_logging_configuration.log_printf; - - /* -diff -Naurd corosync-0.92/exec/totempg.c corosync-trunk/exec/totempg.c ---- corosync-0.92/exec/totempg.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totempg.c 2009-01-25 22:25:25.000000000 +0100 -@@ -153,7 +153,10 @@ - static int totempg_log_level_warning; - static int totempg_log_level_notice; - static int totempg_log_level_debug; --static void (*totempg_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))) = NULL; -+static int totempg_subsys_id; -+static void (*totempg_log_printf) (int subsys_id, char *function, char *file, -+ int line, unsigned int level, char *format, -+ ...) __attribute__((format(printf, 6, 7))); - - struct totem_config *totempg_totem_config; - -@@ -165,6 +168,13 @@ - struct list_head list; - }; - -+enum throw_away_mode_t { -+ THROW_AWAY_INACTIVE, -+ THROW_AWAY_ACTIVE -+}; -+ -+static enum throw_away_mode_t throw_away_mode = THROW_AWAY_INACTIVE; -+ - DECLARE_LIST_INIT(assembly_list_inuse); - - DECLARE_LIST_INIT(assembly_list_free); -@@ -225,8 +235,11 @@ - - static pthread_mutex_t mcast_msg_mutex = PTHREAD_MUTEX_INITIALIZER; - --#define log_printf(level, format, args...) \ -- totempg_log_printf (__FILE__, __LINE__, level, format, ##args) -+#define log_printf(level, format, args...) \ -+do { \ -+ totempg_log_printf (totempg_subsys_id, (char *)__FUNCTION__, \ -+ __FILE__, __LINE__, level, format, ##args); \ -+} while (0); - - static struct assembly *assembly_ref (unsigned int nodeid) - { -@@ -558,43 +571,32 @@ - * the continued message. - */ - start = 0; -- if (continuation) { - -- if (continuation != assembly->last_frag_num) { -- log_printf (totempg_log_level_error, -- "Message continuation doesn't match previous frag e: %u - a: %u\n", -- assembly->last_frag_num, continuation); -- continuation = 0; -- } -+ if (throw_away_mode == THROW_AWAY_ACTIVE) { -+ /* Throw away the first msg block */ -+ if (mcast->fragmented == 0 || mcast->fragmented == 1) { -+ throw_away_mode = THROW_AWAY_INACTIVE; - -- if ((assembly->index == 0) || -- (!continuation && assembly->index)) { -- log_printf (totempg_log_level_error, -- "Throwing away broken message: continuation %u, index %u\n", -- continuation, assembly->index); -- continuation = 0; -- } -- -- /* -- * we decided to throw away the first continued message -- * in this buffer, if continuation was set to zero. -- */ -- if (!continuation) { - assembly->index += msg_lens[0]; - iov_delv.iov_base = &assembly->data[assembly->index]; - iov_delv.iov_len = msg_lens[1]; - start = 1; - } -- -- } -- -- for (i = start; i < msg_count; i++) { -- app_deliver_fn(nodeid, &iov_delv, 1, -- endian_conversion_required); -- assembly->index += msg_lens[i]; -- iov_delv.iov_base = &assembly->data[assembly->index]; -- if (i < (msg_count - 1)) { -- iov_delv.iov_len = msg_lens[i + 1]; -+ } else -+ if (throw_away_mode == THROW_AWAY_INACTIVE) { -+ if (continuation == assembly->last_frag_num) { -+ assembly->last_frag_num = mcast->fragmented; -+ for (i = start; i < msg_count; i++) { -+ app_deliver_fn(nodeid, &iov_delv, 1, -+ endian_conversion_required); -+ assembly->index += msg_lens[i]; -+ iov_delv.iov_base = &assembly->data[assembly->index]; -+ if (i < (msg_count - 1)) { -+ iov_delv.iov_len = msg_lens[i + 1]; -+ } -+ } -+ } else { -+ throw_away_mode = THROW_AWAY_ACTIVE; - } - } - -@@ -609,7 +611,6 @@ - /* - * Message is fragmented, keep around assembly list - */ -- assembly->last_frag_num = mcast->fragmented; - if (mcast->msg_count > 1) { - memmove (&assembly->data[0], - &assembly->data[assembly->index], -@@ -686,6 +687,7 @@ - totempg_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; - totempg_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; - totempg_log_printf = totem_config->totem_logging_configuration.log_printf; -+ totempg_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; - - fragmentation_data = malloc (TOTEMPG_PACKET_SIZE); - if (fragmentation_data == 0) { -@@ -721,14 +723,16 @@ - * Multicast a message - */ - static int mcast_msg ( -- struct iovec *iovec, -+ struct iovec *iovec_in, - int iov_len, - int guarantee) - { - int res = 0; - struct totempg_mcast mcast; - struct iovec iovecs[3]; -+ struct iovec iovec[64]; - int i; -+ int dest, src; - int max_packet_size = 0; - int copy_len = 0; - int copy_base = 0; -@@ -737,6 +741,18 @@ - pthread_mutex_lock (&mcast_msg_mutex); - totemmrp_new_msg_signal (); - -+ /* -+ * Remove zero length iovectors from the list -+ */ -+ assert (iov_len < 64); -+ for (dest = 0, src = 0; src < iov_len; src++) { -+ if (iovec_in[src].iov_len) { -+ memcpy (&iovec[dest++], &iovec_in[src], -+ sizeof (struct iovec)); -+ } -+ } -+ iov_len = dest; -+ - max_packet_size = TOTEMPG_PACKET_SIZE - - (sizeof (unsigned short) * (mcast_packed_msg_count + 1)); - -@@ -774,6 +790,7 @@ - iovec[i].iov_base + copy_base, copy_len); - fragment_size += copy_len; - mcast_packed_msg_lens[mcast_packed_msg_count] += copy_len; -+ next_fragment = 1; - copy_len = 0; - copy_base = 0; - i++; -@@ -1243,7 +1260,7 @@ - return (iface_string); - } - --int totempg_my_nodeid_get (void) -+unsigned int totempg_my_nodeid_get (void) - { - return (totemmrp_my_nodeid_get()); - } -diff -Naurd corosync-0.92/exec/totemrrp.c corosync-trunk/exec/totemrrp.c ---- corosync-0.92/exec/totemrrp.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totemrrp.c 2008-10-30 23:25:56.000000000 +0100 -@@ -194,7 +194,11 @@ - - int totemrrp_log_level_debug; - -- void (*totemrrp_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))); -+ int totemrrp_subsys_id; -+ -+ void (*totemrrp_log_printf) (int subsys, char *function, char *file, -+ int line, unsigned int level, char *format, -+ ...)__attribute__((format(printf, 6, 7))); - - totemrrp_handle handle; - -@@ -459,8 +463,14 @@ - .mutex = PTHREAD_MUTEX_INITIALIZER - }; - --#define log_printf(level, format, args...) \ -- rrp_instance->totemrrp_log_printf (__FILE__, __LINE__, level, format, ##args) -+ -+#define log_printf(level, format, args...) \ -+do { \ -+ rrp_instance->totemrrp_log_printf ( \ -+ rrp_instance->totemrrp_subsys_id, \ -+ (char *)__FUNCTION__, __FILE__, __LINE__, level, \ -+ format, ##args); \ -+} while (0); - - /* - * None Replication Implementation -@@ -1426,6 +1436,7 @@ - instance->totemrrp_log_level_warning = totem_config->totem_logging_configuration.log_level_warning; - instance->totemrrp_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; - instance->totemrrp_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; -+ instance->totemrrp_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; - instance->totemrrp_log_printf = totem_config->totem_logging_configuration.log_printf; - - instance->interfaces = totem_config->interfaces; -diff -Naurd corosync-0.92/exec/totemsrp.c corosync-trunk/exec/totemsrp.c ---- corosync-0.92/exec/totemsrp.c 2008-08-20 03:07:29.000000000 +0200 -+++ corosync-trunk/exec/totemsrp.c 2009-01-20 18:41:45.000000000 +0100 -@@ -429,7 +429,11 @@ - - int totemsrp_log_level_debug; - -- void (*totemsrp_log_printf) (char *file, int line, int level, char *format, ...) __attribute__((format(printf, 4, 5))); -+ int totemsrp_subsys_id; -+ -+ void (*totemsrp_log_printf) (int subsys, char *function, char *file, -+ int line, unsigned int level, char *format, -+ ...)__attribute__((format(printf, 6, 7)));; - - enum memb_state memb_state; - -@@ -607,8 +611,12 @@ - - static char *rundir = NULL; - --#define log_printf(level, format, args...) \ -- instance->totemsrp_log_printf (__FILE__, __LINE__, level, format, ##args) -+#define log_printf(level, format, args...) \ -+do { \ -+ instance->totemsrp_log_printf (instance->totemsrp_subsys_id, \ -+ (char *)__FUNCTION__, __FILE__, __LINE__, level, \ -+ format, ##args); \ -+} while (0); - - void totemsrp_instance_initialize (struct totemsrp_instance *instance) - { -@@ -618,7 +626,7 @@ - - list_init (&instance->token_callback_sent_listhead); - -- instance->my_received_flg = 0; -+ instance->my_received_flg = 1; - - instance->my_token_seq = SEQNO_START_TOKEN - 1; - -@@ -709,6 +717,7 @@ - instance->totemsrp_log_level_warning = totem_config->totem_logging_configuration.log_level_warning; - instance->totemsrp_log_level_notice = totem_config->totem_logging_configuration.log_level_notice; - instance->totemsrp_log_level_debug = totem_config->totem_logging_configuration.log_level_debug; -+ instance->totemsrp_subsys_id = totem_config->totem_logging_configuration.log_subsys_id; - instance->totemsrp_log_printf = totem_config->totem_logging_configuration.log_printf; - - /* -@@ -904,11 +913,11 @@ - return (res); - } - --int totemsrp_my_nodeid_get ( -+unsigned int totemsrp_my_nodeid_get ( - totemsrp_handle handle) - { - struct totemsrp_instance *instance; -- int res; -+ unsigned int res; - - res = hdb_handle_get (&totemsrp_instance_database, handle, - (void *)&instance); -@@ -1686,7 +1695,7 @@ - "entering OPERATIONAL state.\n"); - instance->memb_state = MEMB_STATE_OPERATIONAL; - -- instance->my_received_flg = 0; -+ instance->my_received_flg = 1; - - return; - } -@@ -2634,6 +2643,8 @@ - { - struct srp_addr *addr; - struct memb_commit_token_memb_entry *memb_list; -+ unsigned int high_aru; -+ unsigned int i; - - addr = (struct srp_addr *)commit_token->end_of_commit_token; - memb_list = (struct memb_commit_token_memb_entry *)(addr + commit_token->addr_entries); -@@ -2655,9 +2666,40 @@ - instance->my_received_flg = - (instance->my_aru == instance->my_high_seq_received); - -- memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered; - memb_list[commit_token->memb_index].received_flg = instance->my_received_flg; - -+ memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered; -+ /* -+ * find high aru up to current memb_index for all matching ring ids -+ * if any ring id matching memb_index has aru less then high aru set -+ * received flag for that entry to false -+ */ -+ high_aru = memb_list[commit_token->memb_index].aru; -+ for (i = 0; i <= commit_token->memb_index; i++) { -+ if (memcmp (&memb_list[commit_token->memb_index].ring_id, -+ &memb_list[i].ring_id, -+ sizeof (struct memb_ring_id)) == 0) { -+ -+ if (sq_lt_compare (high_aru, memb_list[i].aru)) { -+ high_aru = memb_list[i].aru; -+ } -+ } -+ } -+ -+ for (i = 0; i <= commit_token->memb_index; i++) { -+ if (memcmp (&memb_list[commit_token->memb_index].ring_id, -+ &memb_list[i].ring_id, -+ sizeof (struct memb_ring_id)) == 0) { -+ -+ if (sq_lt_compare (memb_list[i].aru, high_aru)) { -+ memb_list[i].received_flg = 0; -+ if (i == commit_token->memb_index) { -+ instance->my_received_flg = 0; -+ } -+ } -+ } -+ } -+ - commit_token->header.nodeid = instance->my_id.addr[0].nodeid; - commit_token->memb_index += 1; - assert (commit_token->memb_index <= commit_token->addr_entries); -@@ -2944,6 +2986,8 @@ - goto error_exit; - } - -+ token_hold_cancel_send (instance); -+ - callback_handle = (struct token_callback_instance *)malloc (sizeof (struct token_callback_instance)); - if (callback_handle == 0) { - return (-1); -diff -Naurd corosync-0.92/exec/totemsrp.h corosync-trunk/exec/totemsrp.h ---- corosync-0.92/exec/totemsrp.h 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/exec/totemsrp.h 2008-12-01 19:44:55.000000000 +0100 -@@ -104,7 +104,7 @@ - char ***status, - unsigned int *iface_count); - --extern int totemsrp_my_nodeid_get ( -+extern unsigned int totemsrp_my_nodeid_get ( - totemsrp_handle handle); - - extern int totemsrp_my_family_get ( -diff -Naurd corosync-0.92/exec/util.c corosync-trunk/exec/util.c ---- corosync-0.92/exec/util.c 2008-09-17 21:04:19.000000000 +0200 -+++ corosync-trunk/exec/util.c 2008-12-18 09:28:46.000000000 +0100 -@@ -39,7 +39,7 @@ - #include - #include - --#include -+#include - #include - #include - #include "util.h" -@@ -49,7 +49,7 @@ - /* - * Compare two names. returns non-zero on match. - */ --int name_match(SaNameT *name1, SaNameT *name2) -+int name_match(cs_name_t *name1, cs_name_t *name2) - { - if (name1->length == name2->length) { - return ((strncmp ((char *)name1->value, (char *)name2->value, -@@ -61,17 +61,17 @@ - /* - * Get the time of day and convert to nanoseconds - */ --SaTimeT clust_time_now(void) -+cs_time_t clust_time_now(void) - { - struct timeval tv; -- SaTimeT time_now; -+ cs_time_t time_now; - - if (gettimeofday(&tv, 0)) { - return 0ULL; - } - -- time_now = (SaTimeT)(tv.tv_sec) * 1000000000ULL; -- time_now += (SaTimeT)(tv.tv_usec) * 1000ULL; -+ time_now = (cs_time_t)(tv.tv_sec) * 1000000000ULL; -+ time_now += (cs_time_t)(tv.tv_usec) * 1000ULL; - - return time_now; - } -@@ -87,20 +87,19 @@ - { - log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting " - "with status %d at %s:%u.\n", err, file, line); -- logsys_flush(); -- exit (EXIT_FAILURE); -+ exit (err); - } - - #define min(a,b) ((a) < (b) ? (a) : (b)) - --char *getSaNameT (SaNameT *name) -+char *getcs_name_t (cs_name_t *name) - { -- static char ret_name[SA_MAX_NAME_LENGTH]; -+ static char ret_name[CS_MAX_NAME_LENGTH]; - - /* if string is corrupt (non-terminated), ensure it's displayed safely */ -- if (name->length >= SA_MAX_NAME_LENGTH || name->value[name->length] != '\0') { -+ if (name->length >= CS_MAX_NAME_LENGTH || name->value[name->length] != '\0') { - memset (ret_name, 0, sizeof (ret_name)); -- memcpy (ret_name, name->value, min(name->length, SA_MAX_NAME_LENGTH -1)); -+ memcpy (ret_name, name->value, min(name->length, CS_MAX_NAME_LENGTH -1)); - return (ret_name); - } - return ((char *)name->value); -@@ -134,16 +133,16 @@ - return (end_address); - } - --void setSaNameT (SaNameT *name, char *str) { -- strncpy ((char *)name->value, str, SA_MAX_NAME_LENGTH); -- if (strlen ((char *)name->value) > SA_MAX_NAME_LENGTH) { -- name->length = SA_MAX_NAME_LENGTH; -+void setcs_name_t (cs_name_t *name, char *str) { -+ strncpy ((char *)name->value, str, CS_MAX_NAME_LENGTH); -+ if (strlen ((char *)name->value) > CS_MAX_NAME_LENGTH) { -+ name->length = CS_MAX_NAME_LENGTH; - } else { - name->length = strlen (str); - } - } - --int SaNameTisEqual (SaNameT *str1, char *str2) { -+int cs_name_tisEqual (cs_name_t *str1, char *str2) { - if (str1->length == strlen (str2)) { - return ((strncmp ((char *)str1->value, (char *)str2, - str1->length)) == 0); -diff -Naurd corosync-0.92/exec/util.h corosync-trunk/exec/util.h ---- corosync-0.92/exec/util.h 2008-09-17 21:04:19.000000000 +0200 -+++ corosync-trunk/exec/util.h 2008-11-06 22:49:07.000000000 +0100 -@@ -37,12 +37,12 @@ - - #include - #include --#include -+#include - - /* - * Get the time of day and convert to nanoseconds - */ --extern SaTimeT clust_time_now(void); -+extern cs_time_t clust_time_now(void); - - enum e_ais_done { - AIS_DONE_EXIT = -1, -@@ -66,15 +66,15 @@ - /* - * Compare two names. returns non-zero on match. - */ --extern int name_match(SaNameT *name1, SaNameT *name2); -+extern int name_match(cs_name_t *name1, cs_name_t *name2); - extern int mar_name_match(mar_name_t *name1, mar_name_t *name2); - #define corosync_exit_error(err) _corosync_exit_error ((err), __FILE__, __LINE__) - extern void _corosync_exit_error ( - enum e_ais_done err, const char *file, unsigned int line); - void _corosync_out_of_memory_error (void); --extern char *getSaNameT (SaNameT *name); -+extern char *getcs_name_t (cs_name_t *name); - extern char *strstr_rs (const char *haystack, const char *needle); --extern void setSaNameT (SaNameT *name, char *str); -+extern void setcs_name_t (cs_name_t *name, char *str); - char *get_mar_name_t (mar_name_t *name); --extern int SaNameTisEqual (SaNameT *str1, char *str2); -+extern int cs_name_tisEqual (cs_name_t *str1, char *str2); - #endif /* UTIL_H_DEFINED */ -diff -Naurd corosync-0.92/exec/vsf.h corosync-trunk/exec/vsf.h ---- corosync-0.92/exec/vsf.h 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/vsf.h 2008-12-08 16:55:41.000000000 +0100 -@@ -34,12 +34,14 @@ - #ifndef VSF_H_DEFINED - #define VSF_H_DEFINED - -+struct corosync_api_v1; - struct corosync_vsf_iface_ver0 { - - /* - * Executes a callback whenever component changes - */ - int (*init) ( -+ struct corosync_api_v1 *api, - void (*primary_callback_fn) ( - unsigned int *view_list, - int view_list_entries, -diff -Naurd corosync-0.92/exec/vsf_quorum.c corosync-trunk/exec/vsf_quorum.c ---- corosync-0.92/exec/vsf_quorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/exec/vsf_quorum.c 2009-01-08 12:12:10.000000000 +0100 -@@ -0,0 +1,468 @@ -+/* -+ * Copyright (c) 2008 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+LOGSYS_DECLARE_SUBSYS ("QUORUM", LOG_INFO); -+ -+struct quorum_pd { -+ unsigned char track_flags; -+ int tracking_enabled; -+ struct list_head list; -+ void *conn; -+}; -+ -+struct internal_callback_pd { -+ struct list_head list; -+ quorum_callback_fn_t callback; -+ void *context; -+}; -+ -+static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg); -+static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg); -+static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg); -+static void send_library_notification(void *conn); -+static void send_internal_notification(void); -+static int quorum_exec_init_fn (struct corosync_api_v1 *api); -+static int quorum_lib_init_fn (void *conn); -+static int quorum_lib_exit_fn (void *conn); -+ -+static int primary_designated = 0; -+static struct corosync_api_v1 *corosync_api; -+static struct list_head lib_trackers_list; -+static struct list_head internal_trackers_list; -+static struct memb_ring_id quorum_ring_id; -+static int quorum_view_list_entries = 0; -+static int quorum_view_list[PROCESSOR_COUNT_MAX]; -+struct quorum_services_api_ver1 *quorum_iface = NULL; -+ -+static void (*sync_primary_callback_fn) ( -+ unsigned int *view_list, -+ int view_list_entries, -+ int primary_designated, -+ struct memb_ring_id *ring_id); -+ -+/* Internal quorum API function */ -+static void quorum_api_set_quorum(unsigned int *view_list, -+ int view_list_entries, -+ int quorum, struct memb_ring_id *ring_id) -+{ -+ primary_designated = quorum; -+ -+ if (primary_designated) { -+ log_printf (LOG_LEVEL_NOTICE, "This node is within the primary component and will provide service.\n"); -+ } else { -+ log_printf (LOG_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services.\n"); -+ } -+ -+ memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); -+ -+ quorum_view_list_entries = view_list_entries; -+ memcpy(quorum_view_list, view_list, sizeof(unsigned int)*view_list_entries); -+ -+ /* Tell sync() */ -+ sync_primary_callback_fn(view_list, view_list_entries, -+ primary_designated, &quorum_ring_id); -+ -+ /* Tell internal listeners */ -+ send_internal_notification(); -+ -+ /* Tell IPC listeners */ -+ send_library_notification(NULL); -+} -+ -+static struct corosync_lib_handler quorum_lib_service[] = -+{ -+ { /* 0 */ -+ .lib_handler_fn = message_handler_req_lib_quorum_getquorate, -+ .response_size = sizeof (struct res_lib_quorum_getquorate), -+ .response_id = MESSAGE_RES_QUORUM_GETQUORATE, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 1 */ -+ .lib_handler_fn = message_handler_req_lib_quorum_trackstart, -+ .response_size = sizeof (mar_res_header_t), -+ .response_id = MESSAGE_RES_QUORUM_NOTIFICATION, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 2 */ -+ .lib_handler_fn = message_handler_req_lib_quorum_trackstop, -+ .response_size = sizeof (mar_res_header_t), -+ .response_id = MESSAGE_RES_QUORUM_TRACKSTOP, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ } -+}; -+ -+static struct corosync_service_engine quorum_service_handler = { -+ .name = "corosync cluster quorum service v0.1", -+ .id = QUORUM_SERVICE, -+ .private_data_size = sizeof (struct quorum_pd), -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED, -+ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, -+ .lib_init_fn = quorum_lib_init_fn, -+ .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), -+}; -+ -+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) -+{ -+ 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 -+}; -+ -+__attribute__ ((constructor)) static void quorum_comp_register (void) { -+ lcr_component_register (&quorum_comp_ver0); -+ lcr_interfaces_set (&corosync_quorum_ver0[0], &quorum_service_handler_iface); -+} -+ -+/* -------------------------------------------------- */ -+ -+ -+/* -+ * Internal API functions for corosync -+ */ -+ -+static int quorum_quorate(void) -+{ -+ return primary_designated; -+} -+ -+ -+static int quorum_register_callback(quorum_callback_fn_t function, void *context) -+{ -+ struct internal_callback_pd *pd = malloc(sizeof(struct internal_callback_pd)); -+ if (!pd) -+ return -1; -+ -+ pd->context = context; -+ pd->callback = function; -+ list_add (&pd->list, &internal_trackers_list); -+ -+ return 0; -+} -+ -+static int quorum_unregister_callback(quorum_callback_fn_t function, void *context) -+{ -+ struct internal_callback_pd *pd; -+ struct list_head *tmp; -+ -+ for (tmp = internal_trackers_list.next; tmp != &internal_trackers_list; tmp = tmp->next) { -+ -+ pd = list_entry(tmp, struct internal_callback_pd, list); -+ if (pd->callback == function && pd->context == context) { -+ list_del(&pd->list); -+ return 0; -+ } -+ } -+ return -1; -+} -+ -+static struct quorum_callin_functions callins = { -+ .quorate = quorum_quorate, -+ .register_callback = quorum_register_callback, -+ .unregister_callback = quorum_unregister_callback -+}; -+ -+/* --------------------------------------------------------------------- */ -+ -+static int quorum_exec_init_fn (struct corosync_api_v1 *api) -+{ -+ unsigned int find_handle; -+ unsigned int quorum_handle = 0; -+ unsigned int q_handle; -+ char *quorum_module; -+ int res; -+ void *quorum_iface_p; -+ -+ corosync_api = api; -+ list_init (&lib_trackers_list); -+ list_init (&internal_trackers_list); -+ -+ /* -+ * Tell corosync we have a quorum engine. -+ */ -+ api->quorum_initialize(&callins, &sync_primary_callback_fn); -+ -+ /* -+ * Look for a quorum provider -+ */ -+ api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); -+ api->object_find_next(find_handle, &quorum_handle); -+ api->object_find_destroy(find_handle); -+ -+ if (quorum_handle) { -+ if ( !(res = api->object_key_get(quorum_handle, -+ "provider", -+ strlen("provider"), -+ (void *)&quorum_module, -+ NULL))) { -+ -+ res = lcr_ifact_reference ( -+ &q_handle, -+ quorum_module, -+ 0, -+ &quorum_iface_p, -+ 0); -+ -+ if (res == -1) { -+ log_printf (LOG_LEVEL_NOTICE, -+ "Couldn't load quorum provider %s\n", -+ quorum_module); -+ return (-1); -+ } -+ -+ log_printf (LOG_LEVEL_NOTICE, -+ "Using quorum provider %s\n", quorum_module); -+ -+ quorum_iface = (struct quorum_services_api_ver1 *)quorum_iface_p; -+ quorum_iface->init (api, quorum_api_set_quorum); -+ } -+ } -+ if (!quorum_iface) { -+ /* -+ * With no quorum provider, we are always quorate -+ */ -+ primary_designated = 1; -+ } -+ -+ return (0); -+} -+ -+static int quorum_lib_init_fn (void *conn) -+{ -+ struct quorum_pd *pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ -+ log_printf(LOG_LEVEL_DEBUG, "lib_init_fn: conn=%p\n", conn); -+ -+ list_init (&pd->list); -+ pd->conn = conn; -+ -+ return (0); -+} -+ -+static int quorum_lib_exit_fn (void *conn) -+{ -+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ -+ log_printf(LOG_LEVEL_DEBUG, "lib_exit_fn: conn=%p\n", conn); -+ -+ if (quorum_pd->tracking_enabled) { -+ list_del (&quorum_pd->list); -+ list_init (&quorum_pd->list); -+ } -+ return (0); -+} -+ -+ -+static void send_internal_notification(void) -+{ -+ struct list_head *tmp; -+ struct internal_callback_pd *pd; -+ -+ for (tmp = internal_trackers_list.next; tmp != &internal_trackers_list; tmp = tmp->next) { -+ -+ pd = list_entry(tmp, struct internal_callback_pd, list); -+ -+ pd->callback(primary_designated, pd->context); -+ } -+} -+ -+static void send_library_notification(void *conn) -+{ -+ int size = sizeof(struct res_lib_quorum_notification) + sizeof(unsigned int)*quorum_view_list_entries; -+ char buf[size]; -+ struct res_lib_quorum_notification *res_lib_quorum_notification = (struct res_lib_quorum_notification *)buf; -+ struct list_head *tmp; -+ int i; -+ -+ log_printf(LOG_LEVEL_DEBUG, "sending quorum notification to %p, length = %d\n", conn, size); -+ -+ res_lib_quorum_notification->quorate = primary_designated; -+ res_lib_quorum_notification->ring_seq = quorum_ring_id.seq; -+ res_lib_quorum_notification->view_list_entries = quorum_view_list_entries; -+ for (i=0; iview_list[i] = quorum_view_list[i]; -+ } -+ -+ res_lib_quorum_notification->header.id = MESSAGE_RES_QUORUM_NOTIFICATION; -+ res_lib_quorum_notification->header.size = size; -+ res_lib_quorum_notification->header.error = CS_OK; -+ -+ /* Send it to all interested parties */ -+ if (conn) { -+ corosync_api->ipc_conn_send_response(conn, res_lib_quorum_notification, size); -+ } -+ else { -+ struct quorum_pd *qpd; -+ -+ for (tmp = lib_trackers_list.next; tmp != &lib_trackers_list; tmp = tmp->next) { -+ -+ qpd = list_entry(tmp, struct quorum_pd, list); -+ -+ corosync_api->ipc_conn_send_response(corosync_api->ipc_conn_partner_get(qpd->conn), -+ res_lib_quorum_notification, size); -+ } -+ } -+ return; -+} -+ -+static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg) -+{ -+ struct res_lib_quorum_getquorate res_lib_quorum_getquorate; -+ -+ log_printf(LOG_LEVEL_DEBUG, "got quorate request on %p\n", conn); -+ -+ /* send status */ -+ res_lib_quorum_getquorate.quorate = primary_designated; -+ res_lib_quorum_getquorate.header.size = sizeof(res_lib_quorum_getquorate); -+ res_lib_quorum_getquorate.header.id = MESSAGE_RES_QUORUM_GETQUORATE; -+ res_lib_quorum_getquorate.header.error = CS_OK; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_quorum_getquorate, sizeof(res_lib_quorum_getquorate)); -+} -+ -+ -+static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg) -+{ -+ struct req_lib_quorum_trackstart *req_lib_quorum_trackstart = (struct req_lib_quorum_trackstart *)msg; -+ mar_res_header_t res; -+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ -+ log_printf(LOG_LEVEL_DEBUG, "got trackstart request on %p\n", conn); -+ -+ /* -+ * If an immediate listing of the current cluster membership -+ * is requested, generate membership list -+ */ -+ if (req_lib_quorum_trackstart->track_flags & CS_TRACK_CURRENT || -+ req_lib_quorum_trackstart->track_flags & CS_TRACK_CHANGES) { -+ log_printf(LOG_LEVEL_DEBUG, "sending initial status to %p\n", conn); -+ send_library_notification(corosync_api->ipc_conn_partner_get (conn)); -+ } -+ -+ /* -+ * Record requests for tracking -+ */ -+ if (req_lib_quorum_trackstart->track_flags & CS_TRACK_CHANGES || -+ req_lib_quorum_trackstart->track_flags & CS_TRACK_CHANGES_ONLY) { -+ -+ quorum_pd->track_flags = req_lib_quorum_trackstart->track_flags; -+ quorum_pd->tracking_enabled = 1; -+ -+ list_add (&quorum_pd->list, &lib_trackers_list); -+ } -+ -+ /* send status */ -+ res.size = sizeof(res); -+ res.id = MESSAGE_RES_QUORUM_TRACKSTART; -+ res.error = CS_OK; -+ corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t)); -+} -+ -+static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg) -+{ -+ mar_res_header_t res; -+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ -+ log_printf(LOG_LEVEL_DEBUG, "got trackstop request on %p\n", conn); -+ -+ if (quorum_pd->tracking_enabled) { -+ res.error = CS_OK; -+ quorum_pd->tracking_enabled = 0; -+ list_del (&quorum_pd->list); -+ list_init (&quorum_pd->list); -+ } else { -+ res.error = CS_ERR_NOT_EXIST; -+ } -+ -+ /* send status */ -+ res.size = sizeof(res); -+ res.id = MESSAGE_RES_QUORUM_TRACKSTOP; -+ res.error = CS_OK; -+ corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t)); -+} -+ -diff -Naurd corosync-0.92/exec/vsf_ykd.c corosync-trunk/exec/vsf_ykd.c ---- corosync-0.92/exec/vsf_ykd.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/exec/vsf_ykd.c 2008-12-08 16:55:41.000000000 +0100 -@@ -56,12 +56,12 @@ - #include - - #include -+#include -+#include -+#include - #include - #include - --#include "main.h" --#include "vsf.h" -- - LOGSYS_DECLARE_SUBSYS ("YKD", LOG_INFO); - - #define YKD_PROCESSOR_COUNT_MAX 32 -@@ -108,7 +108,7 @@ - - struct ykd_state ykd_state; - --static totempg_groups_handle ykd_group_handle; -+static cs_tpg_handle ykd_group_handle; - - static struct state_received state_received_confchg[YKD_PROCESSOR_COUNT_MAX]; - -@@ -140,6 +140,8 @@ - - static void *ykd_state_send_callback_token_handle = 0; - -+static struct corosync_api_v1 *api; -+ - static void (*ykd_primary_callback_fn) ( - unsigned int *view_list, - int view_list_entries, -@@ -168,15 +170,15 @@ - iovec[1].iov_base = (char *)&ykd_state; - iovec[1].iov_len = sizeof (struct ykd_state); - -- res = totempg_groups_mcast_joined (ykd_group_handle, iovec, 2, -- TOTEMPG_AGREED); -+ res = api->tpg_joined_mcast (ykd_group_handle, iovec, 2, -+ TOTEM_AGREED); - - return (res); - } - - static void ykd_state_send (void) - { -- totempg_callback_token_create ( -+ api->totem_callback_token_create ( - &ykd_state_send_callback_token_handle, - TOTEM_CALLBACK_TOKEN_SENT, - 1, /* delete after callback */ -@@ -195,15 +197,15 @@ - iovec.iov_base = (char *)&header; - iovec.iov_len = sizeof (struct ykd_header); - -- res = totempg_groups_mcast_joined (ykd_group_handle, &iovec, 1, -- TOTEMPG_AGREED); -+ res = api->tpg_joined_mcast (ykd_group_handle, &iovec, 1, -+ TOTEM_AGREED); - - return (res); - } - - static void ykd_attempt_send (void) - { -- totempg_callback_token_create ( -+ api->totem_callback_token_create ( - &ykd_attempt_send_callback_token_handle, - TOTEM_CALLBACK_TOKEN_SENT, - 1, /* delete after callback */ -@@ -460,7 +462,7 @@ - memcpy (&ykd_ring_id, ring_id, sizeof (struct memb_ring_id)); - - if (first_run) { -- ykd_state.last_primary.member_list[0] = totempg_my_nodeid_get(); -+ ykd_state.last_primary.member_list[0] = api->totem_nodeid_get(); - ykd_state.last_primary.member_list_entries = 1; - ykd_state.last_primary.session_id = 0; - first_run = 0; -@@ -493,53 +495,41 @@ - ykd_state_send (); - } - --struct totempg_group ykd_group = { -+struct corosync_tpg_group ykd_group = { - .group = "ykd", - .group_len = 3 - }; - --static int ykd_init ( -- void (*primary_callback_fn) ( -- unsigned int *view_list, -- int view_list_entries, -- int primary_designated, -- struct memb_ring_id *ring_id)) -+static void ykd_init ( -+ struct corosync_api_v1 *corosync_api, -+ quorum_set_quorate_fn_t set_primary) - { -- ykd_primary_callback_fn = primary_callback_fn; -+ ykd_primary_callback_fn = set_primary; -+ api = corosync_api; - -- totempg_groups_initialize ( -+ api->tpg_init ( - &ykd_group_handle, - ykd_deliver_fn, - ykd_confchg_fn); - -- totempg_groups_join ( -+ api->tpg_join ( - ykd_group_handle, - &ykd_group, - 1); - - ykd_state_init (); -- -- return (0); --} -- --/* -- * Returns 1 if this processor is in the primary -- */ --static int ykd_primary (void) { -- return (primary_designated); - } - - /* - * lcrso object definition - */ --static struct corosync_vsf_iface_ver0 vsf_ykd_iface_ver0 = { -+static struct quorum_services_api_ver1 vsf_ykd_iface_ver0 = { - .init = ykd_init, -- .primary = ykd_primary - }; - - static struct lcr_iface corosync_vsf_ykd_ver0[1] = { - { -- .name = "corosync_vsf_ykd", -+ .name = "corosync_quorum_ykd", - .version = 0, - .versions_replace = 0, - .versions_replace_count = 0, -diff -Naurd corosync-0.92/include/corosync/ais_util.h corosync-trunk/include/corosync/ais_util.h ---- corosync-0.92/include/corosync/ais_util.h 2008-08-14 16:59:50.000000000 +0200 -+++ corosync-trunk/include/corosync/ais_util.h 2008-11-06 22:49:07.000000000 +0100 -@@ -67,71 +67,71 @@ - - struct saVersionDatabase { - int versionCount; -- SaVersionT *versionsSupported; -+ cs_version_t *versionsSupported; - }; - --SaAisErrorT saSendMsgRetry ( -+cs_error_t saSendMsgRetry ( - int s, - struct iovec *iov, - int iov_len); - --SaAisErrorT saSendMsgReceiveReply ( -+cs_error_t saSendMsgReceiveReply ( - int s, - struct iovec *iov, - int iov_len, - void *responseMessage, - int responseLen); - --SaAisErrorT saSendReceiveReply ( -+cs_error_t saSendReceiveReply ( - int s, - void *requestMessage, - int requestLen, - void *responseMessage, - int responseLen); - --SaAisErrorT -+cs_error_t - saPollRetry ( - struct pollfd *ufds, - unsigned int nfds, - int timeout); - --SaAisErrorT -+cs_error_t - saHandleCreate ( - struct saHandleDatabase *handleDatabase, - int instanceSize, -- SaUint64T *handleOut); -+ uint64_t *handleOut); - --SaAisErrorT -+cs_error_t - saHandleDestroy ( - struct saHandleDatabase *handleDatabase, -- SaUint64T handle); -+ uint64_t handle); - --SaAisErrorT -+cs_error_t - saHandleInstanceGet ( - struct saHandleDatabase *handleDatabase, -- SaUint64T handle, -+ uint64_t handle, - void **instance); - --SaAisErrorT -+cs_error_t - saHandleInstancePut ( - struct saHandleDatabase *handleDatabase, -- SaUint64T handle); -+ uint64_t handle); - --SaAisErrorT -+cs_error_t - saVersionVerify ( - struct saVersionDatabase *versionDatabase, -- SaVersionT *version); -+ cs_version_t *version); - - #define offset_of(type,member) (int)(&(((type *)0)->member)) - --SaTimeT -+cs_time_t - clustTimeNow(void); - --extern SaAisErrorT saServiceConnect ( -+extern cs_error_t saServiceConnect ( - int *responseOut, int *callbackOut, enum service_types service); - --extern SaAisErrorT saRecvRetry (int s, void *msg, size_t len); -+extern cs_error_t saRecvRetry (int s, void *msg, size_t len); - --extern SaAisErrorT saSendRetry (int s, const void *msg, size_t len); -+extern cs_error_t saSendRetry (int s, const void *msg, size_t len); - - #endif /* AIS_UTIL_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/cfg.h corosync-trunk/include/corosync/cfg.h ---- corosync-0.92/include/corosync/cfg.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/cfg.h 2009-01-29 10:17:43.000000000 +0100 -@@ -1,6 +1,6 @@ - /* - * Copyright (c) 2005 MontaVista Software, Inc. -- * Copyright (c) 2006 Red Hat, Inc. -+ * Copyright (c) 2006-2009 Red Hat, Inc. - * - * All rights reserved. - * -@@ -36,33 +36,33 @@ - #define AIS_COROSYNCCFG_H_DEFINED - - #include --#include "saAis.h" -+#include - --typedef SaUint64T corosync_cfg_handle_t; -+typedef uint64_t corosync_cfg_handle_t; - - typedef enum { - COROSYNC_CFG_ADMINISTRATIVETARGET_SERVICEUNIT = 0, - COROSYNC_CFG_ADMINISTRATIVETARGET_SERVICEGROUP = 1, - COROSYNC_CFG_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2, - COROSYNC_CFG_ADMINISTRATIVETARGET_NODE = 3 --} CorosyncCfgAdministrativeTargetT; -+} corosync_cfg_administrative_target_t; - - typedef enum { - COROSYNC_CFG_ADMINISTRATIVESTATE_UNLOCKED = 0, - COROSYNC_CFG_ADMINISTRATIVESTATE_LOCKED = 1, - COROSYNC_CFG_ADMINISTRATIVESTATE_STOPPING = 2 --} CorosyncCfgAdministrativeStateT; -+} corosync_cfg_administrative_state_t; - - typedef enum { - COROSYNC_CFG_OPERATIONALSTATE_ENABLED = 1, - COROSYNC_CFG_OPERATIONALSTATE_DISABLED = 2 --} CorosyncCfgOperationalStateT; -+} corosync_cfg_operational_state_t; - - typedef enum { - COROSYNC_CFG_READINESSSTATE_OUTOFSERVICE = 1, - COROSYNC_CFG_READINESSSTATE_INSERVICE = 2, - COROSYNC_CFG_READINESSSTATE_STOPPING = 3 --} CorosyncCfgReadinessStateT; -+} corosync_cfg_readiness_state_t; - - typedef enum { - COROSYNC_CFG_PRESENCESTATE_UNINSTANTIATED = 1, -@@ -72,7 +72,7 @@ - COROSYNC_CFG_PRESENCESTATE_RESTARTING = 5, - COROSYNC_CFG_PRESENCESTATE_INSTANTIATION_FAILED = 6, - COROSYNC_CFG_PRESENCESTATE_TERMINATION_FAILED = 7 --} CorosyncCfgPresenceStateT; -+} corosync_cfg_presence_state_t; - - typedef enum { - COROSYNC_CFG_STATETYPE_OPERATIONAL = 0, -@@ -80,27 +80,63 @@ - COROSYNC_CFG_STATETYPE_READINESS = 2, - COROSYNC_CFG_STATETYPE_HA = 3, - COROSYNC_CFG_STATETYPE_PRESENCE = 4 --} CorosyncCfgStateTypeT; -+} corosync_cfg_state_type_t; -+ -+/* Shutdown types. -+ REQUEST is the normal shutdown. other daemons will be consulted -+ REGARDLESS will tell other daemons but ignore their opinions -+ IMMEDIATE will shut down straight away (but still tell other nodes) -+*/ -+typedef enum { -+ COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST = 0, -+ COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS = 1, -+ COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE = 2, -+} corosync_cfg_shutdown_flags_t; -+ -+typedef enum { -+ COROSYNC_CFG_SHUTDOWN_FLAG_NO = 0, -+ COROSYNC_CFG_SHUTDOWN_FLAG_YES = 1, -+} corosync_cfg_shutdown_reply_flags_t; - - typedef struct { -- SaNameT name; -- CorosyncCfgStateTypeT stateType; -- CorosyncCfgAdministrativeStateT administrativeState; --} CorosyncCfgStateNotificationT; -+ cs_name_t name; -+ corosync_cfg_state_type_t state_type; -+ corosync_cfg_administrative_state_t administrative_state; -+} corosync_cfg_state_notification_t; - - typedef struct { -- SaUint32T numberOfItems; -- CorosyncCfgStateNotificationT *notification; --} CorosyncCfgStateNotificationBufferT; -+ uint32_t number_of_items; -+ corosync_cfg_state_notification_t *notification; -+} corosync_cfg_state_notification_buffer_t; - --typedef void (*CorosyncCfgStateTrackCallbackT) ( -- CorosyncCfgStateNotificationBufferT *notificationBuffer, -- SaAisErrorT error); -+typedef void (*corosync_cfg_state_track_callback_t) ( -+ corosync_cfg_state_notification_buffer_t *notification_buffer, -+ cs_error_t error); -+ -+typedef void (*corosync_cfg_shutdown_callback_t) ( -+ corosync_cfg_handle_t cfg_handle, -+ corosync_cfg_shutdown_flags_t flags); - - typedef struct { -- CorosyncCfgStateTrackCallbackT -- corosyncCfgStateTrackCallback; --} CorosyncCfgCallbacksT; -+ corosync_cfg_state_track_callback_t corosync_cfg_state_track_callback; -+ corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback; -+} corosync_cfg_callbacks_t; -+ -+/* -+ * A node address. This is a complete sockaddr_in[6] -+ * To explain: -+ * If you cast cna_address to a 'struct sockaddr', the sa_family field -+ * will be AF_INET or AF_INET6. Armed with that knowledge you can then -+ * cast it to a sockaddr_in or sockaddr_in6 and pull out the address. -+ * No other sockaddr fields are valid. -+ * Also, you must ignore any part of the sockaddr beyond the length supplied -+ */ -+typedef struct -+{ -+ int address_length; -+ char address[sizeof(struct sockaddr_in6)]; -+} corosync_cfg_node_address_t; -+ - - /* - * Interfaces -@@ -109,70 +145,97 @@ - extern "C" { - #endif - --SaAisErrorT -+cs_error_t - corosync_cfg_initialize ( - corosync_cfg_handle_t *cfg_handle, -- const CorosyncCfgCallbacksT *cfgCallbacks); -+ const corosync_cfg_callbacks_t *cfg_callbacks); - --SaAisErrorT -+cs_error_t - corosync_cfg_fd_get ( - corosync_cfg_handle_t cfg_handle, -- SaSelectionObjectT *selectionObject); -+ int32_t *selection_fd); - --SaAisErrorT -+cs_error_t - corosync_cfg_dispatch ( - corosync_cfg_handle_t cfg_handle, -- SaDispatchFlagsT dispatchFlags); -+ cs_dispatch_flags_t dispatch_flags); - --SaAisErrorT -+cs_error_t - corosync_cfg_finalize ( - corosync_cfg_handle_t cfg_handle); - --SaAisErrorT -+cs_error_t - corosync_cfg_ring_status_get ( - corosync_cfg_handle_t cfg_handle, - char ***interface_names, - char ***status, - unsigned int *interface_count); - --SaAisErrorT -+cs_error_t - corosync_cfg_ring_reenable ( - corosync_cfg_handle_t cfg_handle); - --SaAisErrorT -+cs_error_t - corosync_cfg_service_load ( - corosync_cfg_handle_t cfg_handle, - char *service_name, - unsigned int service_ver); - --SaAisErrorT -+cs_error_t - corosync_cfg_service_unload ( - corosync_cfg_handle_t cfg_handle, - char *service_name, - unsigned int service_ver); - --SaAisErrorT -+cs_error_t - corosync_cfg_administrative_state_get ( - corosync_cfg_handle_t cfg_handle, -- CorosyncCfgAdministrativeTargetT administrativeTarget, -- CorosyncCfgAdministrativeStateT *administrativeState); -+ corosync_cfg_administrative_target_t administrative_target, -+ corosync_cfg_administrative_state_t *administrative_state); - --SaAisErrorT -+cs_error_t - corosync_cfg_administrative_state_set ( - corosync_cfg_handle_t cfg_handle, -- CorosyncCfgAdministrativeTargetT administrativeTarget, -- CorosyncCfgAdministrativeStateT administrativeState); -+ corosync_cfg_administrative_target_t administrative_target, -+ corosync_cfg_administrative_state_t administrative_state); - --SaAisErrorT -+cs_error_t -+corosync_cfg_kill_node ( -+ corosync_cfg_handle_t cfg_handle, -+ unsigned int nodeid, -+ char *reason); -+ -+cs_error_t -+corosync_cfg_try_shutdown ( -+ corosync_cfg_handle_t cfg_handle, -+ corosync_cfg_shutdown_flags_t flags); -+ -+ -+cs_error_t -+corosync_cfg_replyto_shutdown ( -+ corosync_cfg_handle_t cfg_handle, -+ corosync_cfg_shutdown_reply_flags_t flags); -+ -+cs_error_t - corosync_cfg_state_track ( - corosync_cfg_handle_t cfg_handle, -- SaUint8T trackFlags, -- const CorosyncCfgStateNotificationT *notificationBuffer); -+ uint8_t track_flags, -+ const corosync_cfg_state_notification_t *notification_buffer); - --SaAisErrorT -+cs_error_t - corosync_cfg_state_track_stop ( - corosync_cfg_handle_t cfg_handle); - -+ -+cs_error_t -+corosync_cfg_get_node_addrs ( -+ corosync_cfg_handle_t cfg_handle, -+ int nodeid, -+ int max_addrs, -+ int *num_addrs, -+ corosync_cfg_node_address_t *addrs); -+ -+ - #ifdef __cplusplus - } - #endif -diff -Naurd corosync-0.92/include/corosync/confdb.h corosync-trunk/include/corosync/confdb.h ---- corosync-0.92/include/corosync/confdb.h 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/include/corosync/confdb.h 2008-11-06 22:49:07.000000000 +0100 -@@ -34,6 +34,7 @@ - #ifndef COROSYNC_CONFDB_H_DEFINED - #define COROSYNC_CONFDB_H_DEFINED - -+#include - /** - * @addtogroup confdb_corosync - * -@@ -44,33 +45,11 @@ - #define OBJECT_PARENT_HANDLE 0 - - typedef enum { -- CONFDB_DISPATCH_ONE, -- CONFDB_DISPATCH_ALL, -- CONFDB_DISPATCH_BLOCKING --} confdb_dispatch_t; -- --typedef enum { - CONFDB_TRACK_DEPTH_ONE, - CONFDB_TRACK_DEPTH_RECURSIVE - } confdb_track_depth_t; - - typedef enum { -- CONFDB_OK = 1, -- CONFDB_ERR_LIBRARY = 2, -- CONFDB_ERR_TIMEOUT = 5, -- CONFDB_ERR_TRY_AGAIN = 6, -- CONFDB_ERR_INVALID_PARAM = 7, -- CONFDB_ERR_NO_MEMORY = 8, -- CONFDB_ERR_BAD_HANDLE = 9, -- CONFDB_ERR_ACCESS = 11, -- CONFDB_ERR_NOT_EXIST = 12, -- CONFDB_ERR_EXIST = 14, -- CONFDB_ERR_CONTEXT_NOT_FOUND = 17, -- CONFDB_ERR_NOT_SUPPORTED = 20, -- CONFDB_ERR_SECURITY = 29, --} confdb_error_t; -- --typedef enum { - OBJECT_KEY_CREATED, - OBJECT_KEY_REPLACED, - OBJECT_KEY_DELETED -@@ -112,28 +91,28 @@ - /* - * Create a new confdb connection - */ --confdb_error_t confdb_initialize ( -+cs_error_t confdb_initialize ( - confdb_handle_t *handle, - confdb_callbacks_t *callbacks); - - /* - * Close the confdb handle - */ --confdb_error_t confdb_finalize ( -+cs_error_t confdb_finalize ( - confdb_handle_t handle); - - - /* - * Write back the configuration - */ --confdb_error_t confdb_write ( -+cs_error_t confdb_write ( - confdb_handle_t handle, - char *error_text); - - /* - * Reload the configuration - */ --confdb_error_t confdb_reload ( -+cs_error_t confdb_reload ( - confdb_handle_t handle, - int flush, - char *error_text); -@@ -142,43 +121,43 @@ - * Get a file descriptor on which to poll. confdb_handle_t is NOT a - * file descriptor and may not be used directly. - */ --confdb_error_t confdb_fd_get ( -+cs_error_t confdb_fd_get ( - confdb_handle_t handle, - int *fd); - - /* - * Dispatch configuration changes - */ --confdb_error_t confdb_dispatch ( -+cs_error_t confdb_dispatch ( - confdb_handle_t handle, -- confdb_dispatch_t dispatch_types); -+ cs_dispatch_flags_t dispatch_types); - - /* - * Change notification - */ --confdb_error_t confdb_track_changes ( -+cs_error_t confdb_track_changes ( - confdb_handle_t handle, - unsigned int object_handle, - unsigned int flags); - --confdb_error_t confdb_stop_track_changes ( -+cs_error_t confdb_stop_track_changes ( - confdb_handle_t handle); - - /* - * Manipulate objects - */ --confdb_error_t confdb_object_create ( -+cs_error_t confdb_object_create ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *object_name, - int object_name_len, - unsigned int *object_handle); - --confdb_error_t confdb_object_destroy ( -+cs_error_t confdb_object_destroy ( - confdb_handle_t handle, - unsigned int object_handle); - --confdb_error_t confdb_object_parent_get ( -+cs_error_t confdb_object_parent_get ( - confdb_handle_t handle, - unsigned int object_handle, - unsigned int *parent_object_handle); -@@ -186,7 +165,7 @@ - /* - * Manipulate keys - */ --confdb_error_t confdb_key_create ( -+cs_error_t confdb_key_create ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -194,7 +173,7 @@ - void *value, - int value_len); - --confdb_error_t confdb_key_delete ( -+cs_error_t confdb_key_delete ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -205,7 +184,7 @@ - /* - * Key queries - */ --confdb_error_t confdb_key_get ( -+cs_error_t confdb_key_get ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -213,7 +192,7 @@ - void *value, - int *value_len); - --confdb_error_t confdb_key_replace ( -+cs_error_t confdb_key_replace ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -223,14 +202,14 @@ - void *new_value, - int new_value_len); - --confdb_error_t confdb_key_increment ( -+cs_error_t confdb_key_increment ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, - int key_name_len, - unsigned int *value); - --confdb_error_t confdb_key_decrement ( -+cs_error_t confdb_key_decrement ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -243,44 +222,44 @@ - * a quick way of finding a specific object, - * "iter" returns each object in sequence. - */ --confdb_error_t confdb_object_find_start ( -+cs_error_t confdb_object_find_start ( - confdb_handle_t handle, - unsigned int parent_object_handle); - --confdb_error_t confdb_object_find ( -+cs_error_t confdb_object_find ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *object_name, - int object_name_len, - unsigned int *object_handle); - --confdb_error_t confdb_object_find_destroy( -+cs_error_t confdb_object_find_destroy( - confdb_handle_t handle, - unsigned int parent_object_handle); - --confdb_error_t confdb_object_iter_start ( -+cs_error_t confdb_object_iter_start ( - confdb_handle_t handle, - unsigned int parent_object_handle); - --confdb_error_t confdb_object_iter ( -+cs_error_t confdb_object_iter ( - confdb_handle_t handle, - unsigned int parent_object_handle, - unsigned int *object_handle, - void *object_name, - int *object_name_len); - --confdb_error_t confdb_object_iter_destroy( -+cs_error_t confdb_object_iter_destroy( - confdb_handle_t handle, - unsigned int parent_object_handle); - - /* - * Key iterator - */ --confdb_error_t confdb_key_iter_start ( -+cs_error_t confdb_key_iter_start ( - confdb_handle_t handle, - unsigned int object_handle); - --confdb_error_t confdb_key_iter ( -+cs_error_t confdb_key_iter ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -diff -Naurd corosync-0.92/include/corosync/corotypes.h corosync-trunk/include/corosync/corotypes.h ---- corosync-0.92/include/corosync/corotypes.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/corotypes.h 2008-11-07 02:34:43.000000000 +0100 -@@ -0,0 +1,178 @@ -+/* -+ * Copyright (c) 2008 Allied Telesis Labs. -+ * -+ * All rights reserved. -+ * -+ * Author: Angus Salkeld (ahsalkeld@gmail.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. -+ */ -+ -+#ifndef COROTYPES_H_DEFINED -+#define COROTYPES_H_DEFINED -+ -+#ifndef COROSYNC_SOLARIS -+#include -+#else -+#include -+#endif -+ -+typedef int64_t cs_time_t; -+ -+#define CS_FALSE 0 -+#define CS_TRUE !CS_FALSE -+#define CS_MAX_NAME_LENGTH 256 -+#define CS_TIME_END ((cs_time_t)0x7FFFFFFFFFFFFFFFULL) -+ -+typedef struct { -+ uint16_t length; -+ uint8_t value[CS_MAX_NAME_LENGTH]; -+} cs_name_t; -+ -+typedef struct { -+ char releaseCode; -+ unsigned char majorVersion; -+ unsigned char minorVersion; -+} cs_version_t; -+ -+typedef enum { -+ CS_DISPATCH_ONE = 1, -+ CS_DISPATCH_ALL = 2, -+ CS_DISPATCH_BLOCKING = 3 -+} cs_dispatch_flags_t; -+ -+#define CS_TRACK_CURRENT 0x01 -+#define CS_TRACK_CHANGES 0x02 -+#define CS_TRACK_CHANGES_ONLY 0x04 -+ -+typedef enum { -+ CS_OK = 1, -+ CS_ERR_LIBRARY = 2, -+ CS_ERR_VERSION = 3, -+ CS_ERR_INIT = 4, -+ CS_ERR_TIMEOUT = 5, -+ CS_ERR_TRY_AGAIN = 6, -+ CS_ERR_INVALID_PARAM = 7, -+ CS_ERR_NO_MEMORY = 8, -+ CS_ERR_BAD_HANDLE = 9, -+ CS_ERR_BUSY = 10, -+ CS_ERR_ACCESS = 11, -+ CS_ERR_NOT_EXIST = 12, -+ CS_ERR_NAME_TOO_LONG = 13, -+ CS_ERR_EXIST = 14, -+ CS_ERR_NO_SPACE = 15, -+ CS_ERR_INTERRUPT = 16, -+ CS_ERR_NAME_NOT_FOUND = 17, -+ CS_ERR_NO_RESOURCES = 18, -+ CS_ERR_NOT_SUPPORTED = 19, -+ CS_ERR_BAD_OPERATION = 20, -+ CS_ERR_FAILED_OPERATION = 21, -+ CS_ERR_MESSAGE_ERROR = 22, -+ CS_ERR_QUEUE_FULL = 23, -+ CS_ERR_QUEUE_NOT_AVAILABLE = 24, -+ CS_ERR_BAD_FLAGS = 25, -+ CS_ERR_TOO_BIG = 26, -+ CS_ERR_NO_SECTIONS = 27, -+ CS_ERR_CONTEXT_NOT_FOUND = 28, -+ CS_ERR_TOO_MANY_GROUPS = 30 -+} cs_error_t; -+ -+ -+/* -+ * DEPRECATED -+ */ -+#define EVS_DISPATCH_ONE CS_DISPATCH_ONE -+#define EVS_DISPATCH_ALL CS_DISPATCH_ALL -+#define EVS_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING -+#define EVS_OK CS_OK -+#define EVS_ERR_LIBRARY CS_ERR_ERR_LIBRARY -+#define EVS_ERR_TIMEOUT CS_ERR_TIMEOUT -+#define EVS_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN -+#define EVS_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM -+#define EVS_ERR_NO_MEMORY CS_ERR_NO_MEMORY -+#define EVS_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE -+#define EVS_ERR_ACCESS CS_ERR_ACCESS -+#define EVS_ERR_NOT_EXIST CS_ERR_NOT_EXIST -+#define EVS_ERR_EXIST CS_ERR_EXIST -+#define EVS_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED -+#define EVS_ERR_SECURITY CS_ERR_SECURITY -+#define EVS_ERR_TOO_MANY_GROUPS CS_ERR_TOO_MANY_GROUPS -+#define evs_error_t cs_error_t -+ -+#define CPG_DISPATCH_ONE CS_DISPATCH_ONE -+#define CPG_DISPATCH_ALL CS_DISPATCH_ALL -+#define CPG_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING -+#define CPG_OK CS_OK -+#define CPG_ERR_LIBRARY CS_ERR_ERR_LIBRARY -+#define CPG_ERR_TIMEOUT CS_ERR_TIMEOUT -+#define CPG_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN -+#define CPG_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM -+#define CPG_ERR_NO_MEMORY CS_ERR_NO_MEMORY -+#define CPG_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE -+#define CPG_ERR_ACCESS CS_ERR_ACCESS -+#define CPG_ERR_NOT_EXIST CS_ERR_NOT_EXIST -+#define CPG_ERR_EXIST CS_ERR_EXIST -+#define CPG_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED -+#define CPG_ERR_SECURITY CS_ERR_SECURITY -+#define cpg_error_t cs_error_t -+ -+#define CONFDB_DISPATCH_ONE CS_DISPATCH_ONE -+#define CONFDB_DISPATCH_ALL CS_DISPATCH_ALL -+#define CONFDB_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING -+#define CONFDB_OK CS_OK -+#define CONFDB_ERR_LIBRARY CS_ERR_ERR_LIBRARY -+#define CONFDB_ERR_TIMEOUT CS_ERR_TIMEOUT -+#define CONFDB_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN -+#define CONFDB_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM -+#define CONFDB_ERR_NO_MEMORY CS_ERR_NO_MEMORY -+#define CONFDB_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE -+#define CONFDB_ERR_ACCESS CS_ERR_ACCESS -+#define CONFDB_ERR_NOT_EXIST CS_ERR_NOT_EXIST -+#define CONFDB_ERR_EXIST CS_ERR_EXIST -+#define CONFDB_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED -+#define CONFDB_ERR_SECURITY CS_ERR_SECURITY -+#define confdb_error_t cs_error_t -+ -+#define QUORUM_DISPATCH_ONE CS_DISPATCH_ONE -+#define QUORUM_DISPATCH_ALL CS_DISPATCH_ALL -+#define QUORUM_DISPATCH_BLOCKING CS_DISPATCH_BLOCKING -+#define QUORUM_OK CS_OK -+#define QUORUM_ERR_LIBRARY CS_ERR_ERR_LIBRARY -+#define QUORUM_ERR_TIMEOUT CS_ERR_TIMEOUT -+#define QUORUM_ERR_TRY_AGAIN CS_ERR_TRY_AGAIN -+#define QUORUM_ERR_INVALID_PARAM CS_ERR_INVALID_PARAM -+#define QUORUM_ERR_NO_MEMORY CS_ERR_NO_MEMORY -+#define QUORUM_ERR_BAD_HANDLE CS_ERR_BAD_HANDLE -+#define QUORUM_ERR_ACCESS CS_ERR_ACCESS -+#define QUORUM_ERR_NOT_EXIST CS_ERR_NOT_EXIST -+#define QUORUM_ERR_EXIST CS_ERR_EXIST -+#define QUORUM_ERR_NOT_SUPPORTED CS_ERR_NOT_SUPPORTED -+#define QUORUM_ERR_SECURITY CS_ERR_SECURITY -+#define quorum_error_t cs_error_t -+ -+#endif -+ -diff -Naurd corosync-0.92/include/corosync/cpg.h corosync-trunk/include/corosync/cpg.h ---- corosync-0.92/include/corosync/cpg.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/cpg.h 2008-11-06 22:49:07.000000000 +0100 -@@ -35,6 +35,7 @@ - #define COROSYNC_CPG_H_DEFINED - - #include -+#include - - /** - * @addtogroup cpg_corosync -@@ -44,12 +45,6 @@ - typedef uint64_t cpg_handle_t; - - typedef enum { -- CPG_DISPATCH_ONE, -- CPG_DISPATCH_ALL, -- CPG_DISPATCH_BLOCKING --} cpg_dispatch_t; -- --typedef enum { - CPG_TYPE_UNORDERED, /* not implemented */ - CPG_TYPE_FIFO, /* same as agreed */ - CPG_TYPE_AGREED, -@@ -61,21 +56,6 @@ - CPG_FLOW_CONTROL_ENABLED /* flow control is enabled - new messages should not be sent */ - } cpg_flow_control_state_t; - --typedef enum { -- CPG_OK = 1, -- CPG_ERR_LIBRARY = 2, -- CPG_ERR_TIMEOUT = 5, -- CPG_ERR_TRY_AGAIN = 6, -- CPG_ERR_INVALID_PARAM = 7, -- CPG_ERR_NO_MEMORY = 8, -- CPG_ERR_BAD_HANDLE = 9, -- CPG_ERR_ACCESS = 11, -- CPG_ERR_NOT_EXIST = 12, -- CPG_ERR_EXIST = 14, -- CPG_ERR_NOT_SUPPORTED = 20, -- CPG_ERR_SECURITY = 29, -- CPG_ERR_TOO_MANY_GROUPS=30 --} cpg_error_t; - - typedef enum { - CPG_REASON_JOIN = 1, -@@ -132,32 +112,32 @@ - /* - * Create a new cpg connection - */ --cpg_error_t cpg_initialize ( -+cs_error_t cpg_initialize ( - cpg_handle_t *handle, - cpg_callbacks_t *callbacks); - - /* - * Close the cpg handle - */ --cpg_error_t cpg_finalize ( -+cs_error_t cpg_finalize ( - cpg_handle_t handle); - - /* - * Get a file descriptor on which to poll. cpg_handle_t is NOT a - * file descriptor and may not be used directly. - */ --cpg_error_t cpg_fd_get ( -+cs_error_t cpg_fd_get ( - cpg_handle_t handle, - int *fd); - - /* - * Get and set contexts for a CPG handle - */ --cpg_error_t cpg_context_get ( -+cs_error_t cpg_context_get ( - cpg_handle_t handle, - void **context); - --cpg_error_t cpg_context_set ( -+cs_error_t cpg_context_set ( - cpg_handle_t handle, - void *context); - -@@ -165,9 +145,9 @@ - /* - * Dispatch messages and configuration changes - */ --cpg_error_t cpg_dispatch ( -+cs_error_t cpg_dispatch ( - cpg_handle_t handle, -- cpg_dispatch_t dispatch_types); -+ cs_dispatch_flags_t dispatch_types); - - /* - * Join one or more groups. -@@ -175,14 +155,14 @@ - * group that has been joined on handle handle. Any message multicasted - * to a group that has been previously joined will be delivered in cpg_dispatch - */ --cpg_error_t cpg_join ( -+cs_error_t cpg_join ( - cpg_handle_t handle, - struct cpg_name *group); - - /* - * Leave one or more groups - */ --cpg_error_t cpg_leave ( -+cs_error_t cpg_leave ( - cpg_handle_t handle, - struct cpg_name *group); - -@@ -191,7 +171,7 @@ - * The iovec described by iovec will be multicasted to all groups joined with - * the cpg_join interface for handle. - */ --cpg_error_t cpg_mcast_joined ( -+cs_error_t cpg_mcast_joined ( - cpg_handle_t handle, - cpg_guarantee_t guarantee, - struct iovec *iovec, -@@ -200,21 +180,21 @@ - /* - * Get membership information from cpg - */ --cpg_error_t cpg_membership_get ( -+cs_error_t cpg_membership_get ( - cpg_handle_t handle, - struct cpg_name *groupName, - struct cpg_address *member_list, - int *member_list_entries); - --cpg_error_t cpg_local_get ( -+cs_error_t cpg_local_get ( - cpg_handle_t handle, - unsigned int *local_nodeid); - --cpg_error_t cpg_groups_get ( -+cs_error_t cpg_groups_get ( - cpg_handle_t handle, - unsigned int *num_groups); - --cpg_error_t cpg_flow_control_state_get ( -+cs_error_t cpg_flow_control_state_get ( - cpg_handle_t handle, - cpg_flow_control_state_t *flow_control_enabled); - -diff -Naurd corosync-0.92/include/corosync/engine/coroapi.h corosync-trunk/include/corosync/engine/coroapi.h ---- corosync-0.92/include/corosync/engine/coroapi.h 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/include/corosync/engine/coroapi.h 2009-01-20 14:19:05.000000000 +0100 -@@ -41,7 +41,7 @@ - - typedef void * corosync_timer_handle_t; - --typedef unsigned int corosync_tpg_handle; -+typedef unsigned int cs_tpg_handle; - - struct corosync_tpg_group { - void *group; -@@ -88,17 +88,36 @@ - }; - #endif - --enum corosync_lib_flow_control { -- COROSYNC_LIB_FLOW_CONTROL_REQUIRED = 1, -- COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED = 2 -+#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 corosync_flow_control_state { -- COROSYNC_FLOW_CONTROL_STATE_DISABLED, -- COROSYNC_FLOW_CONTROL_STATE_ENABLED -+enum cs_flow_control_state { -+ CS_FLOW_CONTROL_STATE_DISABLED, -+ CS_FLOW_CONTROL_STATE_ENABLED - }; --#endif -+#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 */ - - typedef enum { - COROSYNC_FATAL_ERROR_EXIT = -1, -@@ -109,7 +128,8 @@ - COROSYNC_DYNAMICLOAD = -12, - COROSYNC_OUT_OF_MEMORY = -15, - COROSYNC_FATAL_ERR = -16 --} corosync_fatal_error_t; -+} cs_fatal_error_t; -+#define corosync_fatal_error_t cs_fatal_error_t; - - #ifndef OBJECT_PARENT_HANDLE - -@@ -125,6 +145,7 @@ - int key_len; - int (*validate_callback) (void *key, int key_len, void *value, int value_len); - }; -+/* deprecated */ - - typedef enum { - OBJECT_TRACK_DEPTH_ONE, -@@ -137,6 +158,12 @@ - OBJECT_KEY_DELETED - } object_change_type_t; - -+typedef enum { -+ OBJDB_RELOAD_NOTIFY_START, -+ OBJDB_RELOAD_NOTIFY_END, -+ OBJDB_RELOAD_NOTIFY_FAILED -+} objdb_reload_notify_type_t; -+ - typedef void (*object_key_change_notify_fn_t)(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, -@@ -159,8 +186,30 @@ - object_change_type_t type, - void * priv_data_pt); - -+typedef void (*object_reload_notify_fn_t) (objdb_reload_notify_type_t, int flush, -+ void *priv_data_pt); -+ - #endif /* OBJECT_PARENT_HANDLE_DEFINED */ - -+#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) ( -+ unsigned int *view_list, -+ int view_list_entries, -+ int primary_designated, -+ struct memb_ring_id *ring_id); -+ -+#endif /* QUORUM_H_DEFINED */ -+ -+ - struct corosync_api_v1 { - /* - * Object and configuration APIs -@@ -280,12 +329,14 @@ - object_key_change_notify_fn_t key_change_notify_fn, - object_create_notify_fn_t object_create_notify_fn, - object_destroy_notify_fn_t object_destroy_notify_fn, -+ object_reload_notify_fn_t object_reload_notify_fn, - void * priv_data_pt); - - void (*object_track_stop) ( - object_key_change_notify_fn_t key_change_notify_fn, - object_create_notify_fn_t object_create_notify_fn, - object_destroy_notify_fn_t object_destroy_notify_fn, -+ object_reload_notify_fn_t object_reload_notify_fn, - void * priv_data_pt); - - int (*object_write_config) (char **error_string); -@@ -357,7 +408,7 @@ - int id_len, - void (*flow_control_state_set_fn) - (void *context, -- enum corosync_flow_control_state flow_control_state_set), -+ enum cs_flow_control_state flow_control_state_set), - void *context); - - void (*ipc_fc_destroy) ( -@@ -373,7 +424,7 @@ - /* - * Totem APIs - */ -- int (*totem_nodeid_get) (void); -+ unsigned int (*totem_nodeid_get) (void); - - int (*totem_family_get) (void); - -@@ -393,12 +444,20 @@ - - char *(*totem_ip_print) (struct totem_ip_address *addr); - -+ -+ 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, void *), -+ void *data); -+ - /* - * Totem open process groups API for those service engines - * wanting their own groups - */ - int (*tpg_init) ( -- corosync_tpg_handle *handle, -+ cs_tpg_handle *handle, - - void (*deliver_fn) ( - unsigned int nodeid, -@@ -414,31 +473,31 @@ - struct memb_ring_id *ring_id)); - - int (*tpg_exit) ( -- corosync_tpg_handle handle); -+ cs_tpg_handle handle); - - int (*tpg_join) ( -- corosync_tpg_handle handle, -+ cs_tpg_handle handle, - struct corosync_tpg_group *groups, - int gruop_cnt); - - int (*tpg_leave) ( -- corosync_tpg_handle handle, -+ cs_tpg_handle handle, - struct corosync_tpg_group *groups, - int gruop_cnt); - - int (*tpg_joined_mcast) ( -- corosync_tpg_handle handle, -+ cs_tpg_handle handle, - struct iovec *iovec, - int iov_len, - int guarantee); - - int (*tpg_joined_send_ok) ( -- corosync_tpg_handle handle, -+ cs_tpg_handle handle, - struct iovec *iovec, - int iov_len); - - int (*tpg_groups_mcast) ( -- corosync_tpg_handle handle, -+ cs_tpg_handle handle, - int guarantee, - struct corosync_tpg_group *groups, - int groups_cnt, -@@ -446,7 +505,7 @@ - int iov_len); - - int (*tpg_groups_send_ok) ( -- corosync_tpg_handle handle, -+ cs_tpg_handle handle, - struct corosync_tpg_group *groups, - int groups_cnt, - struct iovec *iovec, -@@ -456,6 +515,19 @@ - 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, -+ sync_callback_fn_t *sync_callback_fn); -+ -+ /* - * Plugin loading and unloading - */ - int (*plugin_interface_reference) ( -@@ -485,7 +557,7 @@ - */ - void (*error_memory_failure) (void); - #define corosync_fatal_error(err) api->fatal_error ((err), __FILE__, __LINE__) -- void (*fatal_error) (corosync_fatal_error_t err, const char *file, unsigned int line); -+ void (*fatal_error) (cs_fatal_error_t err, const char *file, unsigned int line); - }; - - #define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) ) -@@ -496,7 +568,7 @@ - void (*lib_handler_fn) (void *conn, void *msg); - int response_size; - int response_id; -- enum corosync_lib_flow_control flow_control; -+ enum cs_lib_flow_control flow_control; - }; - - struct corosync_exec_handler { -@@ -512,7 +584,8 @@ - char *name; - unsigned short id; - unsigned int private_data_size; -- enum corosync_lib_flow_control flow_control; -+ 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); -diff -Naurd corosync-0.92/include/corosync/engine/logsys.h corosync-trunk/include/corosync/engine/logsys.h ---- corosync-0.92/include/corosync/engine/logsys.h 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/include/corosync/engine/logsys.h 2009-01-16 09:59:09.000000000 +0100 -@@ -1,6 +1,6 @@ - /* - * Copyright (c) 2002-2004 MontaVista Software, Inc. -- * Copyright (c) 2006-2007 Red Hat, Inc. -+ * Copyright (c) 2006-2008 Red Hat, Inc. - * - * Author: Steven Dake (sdake@redhat.com) - * Author: Lon Hohberger (lhh@redhat.com) -@@ -41,21 +41,14 @@ - #include - - /* -- * MODE_OUTPUT_SYSLOG_* modes are mutually exclusive -+ * All of the LOG_MODE's can be ORed together for combined behavior - */ - #define LOG_MODE_OUTPUT_FILE (1<<0) - #define LOG_MODE_OUTPUT_STDERR (1<<1) --#define LOG_MODE_OUTPUT_SYSLOG_THREADED (1<<2) --#define LOG_MODE_OUTPUT_SYSLOG_LOSSY (1<<3) --#define LOG_MODE_OUTPUT_SYSLOG_BLOCKING (1<<4) --#define LOG_MODE_DISPLAY_PRIORITY (1<<5) --#define LOG_MODE_DISPLAY_FILELINE (1<<6) --#define LOG_MODE_DISPLAY_TIMESTAMP (1<<7) --#define LOG_MODE_BUFFER_BEFORE_CONFIG (1<<8) --#define LOG_MODE_FLUSH_AFTER_CONFIG (1<<9) --#define LOG_MODE_SHORT_FILELINE (1<<10) --#define LOG_MODE_NOSUBSYS (1<<11) --#define LOG_MODE_FILTER_DEBUG_FROM_SYSLOG (1<<12) -+#define LOG_MODE_OUTPUT_SYSLOG (1<<3) -+#define LOG_MODE_NOSUBSYS (1<<4) -+#define LOG_MODE_FORK (1<<5) -+#define LOG_MODE_THREADED (1<<6) - - /* - * Log priorities, compliant with syslog and SA Forum Log spec. -@@ -71,37 +64,23 @@ - #define LOG_LEVEL_DEBUG LOG_DEBUG - - /* --** Log tags, used by _logsys_trace macros, uses 32 bits => 32 different tags --*/ --#define LOGSYS_TAG_LOG (1<<0) --#define LOGSYS_TAG_ENTER (1<<1) --#define LOGSYS_TAG_LEAVE (1<<2) --#define LOGSYS_TAG_TRACE1 (1<<3) --#define LOGSYS_TAG_TRACE2 (1<<4) --#define LOGSYS_TAG_TRACE3 (1<<5) --#define LOGSYS_TAG_TRACE4 (1<<6) --#define LOGSYS_TAG_TRACE5 (1<<7) --#define LOGSYS_TAG_TRACE6 (1<<8) --#define LOGSYS_TAG_TRACE7 (1<<9) --#define LOGSYS_TAG_TRACE8 (1<<10) -+ * The tag masks are all mutually exclusive -+ */ -+#define LOGSYS_TAG_LOG (0xff<<28) -+#define LOGSYS_TAG_ENTER (1<<27) -+#define LOGSYS_TAG_LEAVE (1<<26) -+#define LOGSYS_TAG_TRACE1 (1<<25) -+#define LOGSYS_TAG_TRACE2 (1<<24) -+#define LOGSYS_TAG_TRACE3 (1<<23) -+#define LOGSYS_TAG_TRACE4 (1<<22) -+#define LOGSYS_TAG_TRACE5 (1<<21) -+#define LOGSYS_TAG_TRACE6 (1<<20) -+#define LOGSYS_TAG_TRACE7 (1<<19) -+#define LOGSYS_TAG_TRACE8 (1<<18) - - /* - * External API - */ -- --struct logsys_logger { -- char subsys[6]; -- unsigned int priority; -- unsigned int tags; -- unsigned int mode; --}; -- --extern struct logsys_logger logsys_loggers[]; -- --extern int logsys_single_id; -- --extern inline int logsys_mkpri (int priority, int id); -- - extern void logsys_config_mode_set ( - unsigned int mode); - -@@ -115,6 +94,9 @@ - char *name, - unsigned int facility); - -+extern void logsys_format_set ( -+ char *format); -+ - extern unsigned int logsys_config_subsys_set ( - const char *subsys, - unsigned int tags, -@@ -137,33 +119,60 @@ - extern const char *logsys_priority_name_get ( - unsigned int priority); - -+extern int logsys_tag_id_get ( -+ const char *name); -+ -+extern const char *logsys_tag_name_get ( -+ unsigned int tag); -+ -+extern void logsys_fork_completed (void); -+ - extern void logsys_flush (void); - - extern void logsys_atsegv (void); - -+extern int logsys_log_rec_store (char *filename); -+ - /* - * Internal APIs that must be globally exported - */ --extern unsigned int _logsys_subsys_create (const char *ident, -+extern unsigned int _logsys_subsys_create ( -+ const char *ident, - unsigned int priority); - - extern void _logsys_nosubsys_set (void); - --extern int _logsys_wthread_create (void); -+extern int _logsys_rec_init (unsigned int size); - --extern void logsys_log_printf (char *file, int line, int priority, -- char *format, ...) __attribute__((format(printf, 4, 5))); -+extern void _logsys_log_printf ( -+ int subsys, -+ char *function_name, -+ char *file_name, -+ int file_line, -+ unsigned int level, -+ char *format, -+ ...) __attribute__((format(printf, 6, 7))); - --extern void _logsys_log_printf2 (char *file, int line, int priority, -- int id, char *format, ...) __attribute__((format(printf, 5, 6))); -+extern void _logsys_log_rec ( -+ int subsys, -+ char *function_name, -+ char *file_name, -+ int file_line, -+ unsigned int rec_ident, -+ ...); - --extern void _logsys_trace (char *file, int line, int tag, int id, -- char *format, ...) __attribute__((format(printf, 5, 6))); -+extern int _logsys_wthread_create (void); - -+static unsigned int logsys_subsys_id __attribute__((unused)) = -1; -+ - /* - * External definitions - */ --#define LOGSYS_DECLARE_SYSTEM(name,mode,file,facility) \ -+extern void *logsys_rec_end; -+ -+#define LOG_REC_END (&logsys_rec_end) -+ -+#define LOGSYS_DECLARE_SYSTEM(name,mode,file,facility,format,rec_size) \ - __attribute__ ((constructor)) static void logsys_system_init (void) \ - { \ - char *error_string; \ -@@ -171,13 +180,11 @@ - logsys_config_mode_set (mode); \ - logsys_config_file_set (&error_string, (file)); \ - logsys_config_facility_set (name, (facility)); \ -- if (((mode) & LOG_MODE_BUFFER_BEFORE_CONFIG) == 0) { \ -- _logsys_wthread_create (); \ -- } \ -+ logsys_format_set (format); \ -+ _logsys_rec_init (rec_size); \ -+ _logsys_wthread_create(); \ - } - --static unsigned int logsys_subsys_id __attribute__((unused)) = -1; \ -- - #define LOGSYS_DECLARE_NOSUBSYS(priority) \ - __attribute__ ((constructor)) static void logsys_nosubsys_init (void) \ - { \ -@@ -206,161 +213,88 @@ - _logsys_subsys_create ((subsys), (priority)); \ - } - --#define log_printf(lvl, format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if ((lvl) <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_log_printf2 (__FILE__, __LINE__, lvl, \ -- logsys_subsys_id, (format), ##args); \ -- } \ --} while(0) -- --#define dprintf(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_log_printf2 (__FILE__, __LINE__, LOG_DEBUG, \ -- logsys_subsys_id, (format), ##args); \ -- } \ --} while(0) -- --#define ENTER_VOID() do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_ENTER, \ -- logsys_subsys_id, ">%s\n", __FUNCTION__); \ -- } \ -+#define log_rec(rec_ident, args...) \ -+do { \ -+ _logsys_log_rec (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, rec_ident, ##args); \ - } while(0) - --#define ENTER(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_ENTER, \ -- logsys_subsys_id, ">%s: " format, __FUNCTION__, \ -- ##args); \ -- } \ -+#define log_printf(lvl, format, args...) \ -+ do { \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, lvl, format, ##args); \ - } while(0) - --#define LEAVE_VOID() do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_LEAVE, \ -- logsys_subsys_id, "<%s\n", __FUNCTION__); \ -- } \ -+#define ENTER() do { \ -+ _logsys_log_rec (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_ENTER, LOG_REC_END); \ - } while(0) - --#define LEAVE(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_LEAVE, \ -- logsys_subsys_id, "<%s: " format, \ -- __FUNCTION__, ##args); \ -- } \ -+#define LEAVE() do { \ -+ _logsys_log_rec (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_LEAVE, LOG_REC_END); \ - } while(0) - - #define TRACE1(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE1, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE1, format, ##args);\ - } while(0) - - #define TRACE2(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE2, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE2, format, ##args);\ - } while(0) - --#define TRACE3(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE3, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+#define TRACE3(format, args...) do { \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE3, format, ##args);\ - } while(0) - --#define TRACE4(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE4, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+#define TRACE4(format, args...) do { \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE4, format, ##args);\ - } while(0) - - #define TRACE5(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE5, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE5, format, ##args);\ - } while(0) - - #define TRACE6(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE6, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE6, format, ##args);\ - } while(0) - - #define TRACE7(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE7, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE7, format, ##args);\ - } while(0) - - #define TRACE8(format, args...) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- if (LOG_LEVEL_DEBUG <= logsys_loggers[logsys_subsys_id].priority) { \ -- _logsys_trace (__FILE__, __LINE__, LOGSYS_TAG_TRACE8, \ -- logsys_subsys_id, (format), ##args); \ -- } \ -+ _logsys_log_printf (logsys_subsys_id, (char *) __FUNCTION__, \ -+ __FILE__, __LINE__, LOGSYS_TAG_TRACE8, format, ##args);\ - } while(0) - --extern void _logsys_config_priority_set (unsigned int id, unsigned int priority); -- --#define logsys_config_priority_set(priority) do { \ -- if (logsys_single_id) \ -- logsys_subsys_id = 0; \ -- assert (logsys_subsys_id != -1); \ -- _logsys_config_priority_set (logsys_subsys_id, priority); \ --} while(0) -+/* -+ * For one-time programmatic initialization and configuration of logsys -+ * instead of using the DECLARE macros. These APIs do not allow subsystems -+ */ -+int logsys_init ( -+ char *name, -+ int mode, -+ int facility, -+ int priority, -+ char *file, -+ char *format, -+ int rec_size); - --/* simple, function-based api */ -+int logsys_conf ( -+ char *name, -+ int mode, -+ int facility, -+ int priority, -+ char *file); - --int logsys_init (char *name, int mode, int facility, int priority, char *file); --int logsys_conf (char *name, int mode, int facility, int priority, char *file); - void logsys_exit (void); - - #endif /* LOGSYS_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/engine/objdb.h corosync-trunk/include/corosync/engine/objdb.h ---- corosync-0.92/include/corosync/engine/objdb.h 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/include/corosync/engine/objdb.h 2008-10-27 09:25:53.000000000 +0100 -@@ -51,6 +51,13 @@ - OBJECT_KEY_DELETED - } object_change_type_t; - -+typedef enum { -+ OBJDB_RELOAD_NOTIFY_START, -+ OBJDB_RELOAD_NOTIFY_END, -+ OBJDB_RELOAD_NOTIFY_FAILED -+} objdb_reload_notify_type_t; -+ -+ - typedef void (*object_key_change_notify_fn_t)(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, -@@ -68,6 +75,9 @@ - void *name_pt, int name_len, - void *priv_data_pt); - -+typedef void (*object_reload_notify_fn_t) (objdb_reload_notify_type_t, int flush, -+ void *priv_data_pt); -+ - struct object_valid { - char *object_name; - int object_len; -@@ -198,12 +208,14 @@ - object_key_change_notify_fn_t key_change_notify_fn, - object_create_notify_fn_t object_create_notify_fn, - object_destroy_notify_fn_t object_destroy_notify_fn, -+ object_reload_notify_fn_t object_reload_notify_fn, - void * priv_data_pt); - - void (*object_track_stop) ( - object_key_change_notify_fn_t key_change_notify_fn, - object_create_notify_fn_t object_create_notify_fn, - object_destroy_notify_fn_t object_destroy_notify_fn, -+ object_reload_notify_fn_t object_reload_notify_fn, - void * priv_data_pt); - - int (*object_write_config) (char **error_string); -diff -Naurd corosync-0.92/include/corosync/engine/quorum.h corosync-trunk/include/corosync/engine/quorum.h ---- corosync-0.92/include/corosync/engine/quorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/engine/quorum.h 2008-12-09 14:51:23.000000000 +0100 -@@ -0,0 +1,44 @@ -+/* -+ * Copyright (c) 2008 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 the 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. -+ */ -+ -+#ifndef QUORUM_H_DEFINED -+#define QUORUM_H_DEFINED -+ -+typedef void (*quorum_set_quorate_fn_t) (unsigned int *view_list, int view_list_entries, -+ int quorate, struct memb_ring_id *); -+ -+struct quorum_services_api_ver1 { -+ void (*init) (struct corosync_api_v1 *api, quorum_set_quorate_fn_t); -+}; -+#endif /* QUORUM_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/evs.h corosync-trunk/include/corosync/evs.h ---- corosync-0.92/include/corosync/evs.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/evs.h 2008-11-06 22:49:07.000000000 +0100 -@@ -36,6 +36,7 @@ - - #include - #include -+#include - - /** - * @defgroup corosync Other API services provided by corosync -@@ -49,34 +50,12 @@ - typedef uint64_t evs_handle_t; - - typedef enum { -- EVS_DISPATCH_ONE, -- EVS_DISPATCH_ALL, -- EVS_DISPATCH_BLOCKING --} evs_dispatch_t; -- --typedef enum { - EVS_TYPE_UNORDERED, /* not implemented */ - EVS_TYPE_FIFO, /* same as agreed */ - EVS_TYPE_AGREED, - EVS_TYPE_SAFE /* not implemented */ - } evs_guarantee_t; - --typedef enum { -- EVS_OK = 1, -- EVS_ERR_LIBRARY = 2, -- EVS_ERR_TIMEOUT = 5, -- EVS_ERR_TRY_AGAIN = 6, -- EVS_ERR_INVALID_PARAM = 7, -- EVS_ERR_NO_MEMORY = 8, -- EVS_ERR_BAD_HANDLE = 9, -- EVS_ERR_ACCESS = 11, -- EVS_ERR_NOT_EXIST = 12, -- EVS_ERR_EXIST = 14, -- EVS_ERR_NOT_SUPPORTED = 20, -- EVS_ERR_SECURITY = 29, -- EVS_ERR_TOO_MANY_GROUPS=30 --} evs_error_t; -- - #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr)) - - /** These are the things that get passed around */ -@@ -110,30 +89,30 @@ - /* - * Create a new evs connection - */ --evs_error_t evs_initialize ( -+cs_error_t evs_initialize ( - evs_handle_t *handle, - evs_callbacks_t *callbacks); - - /* - * Close the evs handle - */ --evs_error_t evs_finalize ( -+cs_error_t evs_finalize ( - evs_handle_t handle); - - /* - * Get a file descriptor on which to poll. evs_handle_t is NOT a - * file descriptor and may not be used directly. - */ --evs_error_t evs_fd_get ( -+cs_error_t evs_fd_get ( - evs_handle_t handle, - int *fd); - - /* - * Dispatch messages and configuration changes - */ --evs_error_t evs_dispatch ( -+cs_error_t evs_dispatch ( - evs_handle_t handle, -- evs_dispatch_t dispatch_types); -+ cs_dispatch_flags_t dispatch_types); - - /* - * Join one or more groups. -@@ -141,7 +120,7 @@ - * group that has been joined on handle handle. Any message multicasted - * to a group that has been previously joined will be delivered in evs_dispatch - */ --evs_error_t evs_join ( -+cs_error_t evs_join ( - evs_handle_t handle, - struct evs_group *groups, - int group_cnt); -@@ -149,7 +128,7 @@ - /* - * Leave one or more groups - */ --evs_error_t evs_leave ( -+cs_error_t evs_leave ( - evs_handle_t handle, - struct evs_group *groups, - int group_cnt); -@@ -159,7 +138,7 @@ - * The iovec described by iovec will be multicasted to all groups joined with - * the evs_join interface for handle. - */ --evs_error_t evs_mcast_joined ( -+cs_error_t evs_mcast_joined ( - evs_handle_t handle, - evs_guarantee_t guarantee, - struct iovec *iovec, -@@ -170,7 +149,7 @@ - * Messages will be multicast to groups specified in the api call and not those - * that have been joined (unless they are in the groups parameter). - */ --evs_error_t evs_mcast_groups ( -+cs_error_t evs_mcast_groups ( - evs_handle_t handle, - evs_guarantee_t guarantee, - struct evs_group *groups, -@@ -181,7 +160,7 @@ - /* - * Get membership information from evs - */ --evs_error_t evs_membership_get ( -+cs_error_t evs_membership_get ( - evs_handle_t handle, - unsigned int *local_nodeid, - unsigned int *member_list, -diff -Naurd corosync-0.92/include/corosync/ipc_cfg.h corosync-trunk/include/corosync/ipc_cfg.h ---- corosync-0.92/include/corosync/ipc_cfg.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/ipc_cfg.h 2009-01-19 09:31:21.000000000 +0100 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 2005 MontaVista Software, Inc. -+ * Copyright (c) 2009 Red Hat, Inc. - * - * All rights reserved. - * -@@ -35,8 +36,8 @@ - #define AIS_IPC_CFG_H_DEFINED - - #include -+#include - #include "ipc_gen.h" --#include "saAis.h" - #include "cfg.h" - - enum req_lib_cfg_types { -@@ -47,7 +48,11 @@ - MESSAGE_REQ_CFG_ADMINISTRATIVESTATESET = 4, - MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET = 5, - MESSAGE_REQ_CFG_SERVICELOAD = 6, -- MESSAGE_REQ_CFG_SERVICEUNLOAD = 7 -+ MESSAGE_REQ_CFG_SERVICEUNLOAD = 7, -+ MESSAGE_REQ_CFG_KILLNODE = 8, -+ MESSAGE_REQ_CFG_TRYSHUTDOWN = 9, -+ MESSAGE_REQ_CFG_REPLYTOSHUTDOWN = 10, -+ MESSAGE_REQ_CFG_GET_NODE_ADDRS = 11 - }; - - enum res_lib_cfg_types { -@@ -58,13 +63,17 @@ - MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 4, - MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 5, - MESSAGE_RES_CFG_SERVICELOAD = 6, -- MESSAGE_RES_CFG_SERVICEUNLOAD = 7 -+ MESSAGE_RES_CFG_SERVICEUNLOAD = 7, -+ MESSAGE_RES_CFG_KILLNODE = 8, -+ MESSAGE_RES_CFG_TRYSHUTDOWN = 9, -+ MESSAGE_RES_CFG_TESTSHUTDOWN = 10, -+ MESSAGE_RES_CFG_GET_NODE_ADDRS = 11 - }; - - struct req_lib_cfg_statetrack { - mar_req_header_t header; -- SaUint8T trackFlags; -- CorosyncCfgStateNotificationT *notificationBufferAddress; -+ uint8_t track_flags; -+ corosync_cfg_state_notification_t *notification_buffer_address; - }; - - struct res_lib_cfg_statetrack { -@@ -81,9 +90,9 @@ - - struct req_lib_cfg_administrativestateset { - mar_req_header_t header; -- SaNameT compName; -- CorosyncCfgAdministrativeTargetT administrativeTarget; -- CorosyncCfgAdministrativeStateT administrativeState; -+ cs_name_t comp_name; -+ corosync_cfg_administrative_target_t administrative_target; -+ corosync_cfg_administrative_state_t administrative_state; - }; - - struct res_lib_cfg_administrativestateset { -@@ -92,9 +101,9 @@ - - struct req_lib_cfg_administrativestateget { - mar_req_header_t header; -- SaNameT compName; -- CorosyncCfgAdministrativeTargetT administrativeTarget; -- CorosyncCfgAdministrativeStateT administrativeState; -+ cs_name_t comp_name; -+ corosync_cfg_administrative_target_t administrative_target; -+ corosync_cfg_administrative_state_t administrative_state; - }; - - struct res_lib_cfg_administrativestateget { -@@ -122,7 +131,7 @@ - - struct req_lib_cfg_serviceload { - mar_res_header_t header __attribute__((aligned(8))); -- char *service_name[256] __attribute__((aligned(8))); -+ char service_name[256] __attribute__((aligned(8))); - unsigned int service_ver; - }; - -@@ -132,7 +141,7 @@ - - struct req_lib_cfg_serviceunload { - mar_res_header_t header __attribute__((aligned(8))); -- char *service_name[256] __attribute__((aligned(8))); -+ char service_name[256] __attribute__((aligned(8))); - unsigned int service_ver; - }; - -@@ -140,17 +149,65 @@ - mar_res_header_t header __attribute__((aligned(8))); - }; - -+struct req_lib_cfg_killnode { -+ mar_req_header_t header __attribute__((aligned(8))); -+ unsigned int nodeid __attribute__((aligned(8))); -+ cs_name_t reason __attribute__((aligned(8))); -+}; -+ -+struct res_lib_cfg_killnode { -+ mar_res_header_t header __attribute__((aligned(8))); -+}; -+ -+struct req_lib_cfg_tryshutdown { -+ mar_req_header_t header __attribute__((aligned(8))); -+ unsigned int flags; -+}; -+ -+struct res_lib_cfg_tryshutdown { -+ mar_res_header_t header __attribute__((aligned(8))); -+}; -+ -+struct req_lib_cfg_replytoshutdown { -+ mar_res_header_t header __attribute__((aligned(8))); -+ unsigned int response; -+}; -+ -+struct res_lib_cfg_testshutdown { -+ mar_res_header_t header __attribute__((aligned(8))); -+ unsigned int flags; -+}; -+ -+struct req_lib_cfg_get_node_addrs { -+ mar_req_header_t header __attribute__((aligned(8))); -+ unsigned int nodeid; -+}; -+ -+struct res_lib_cfg_get_node_addrs { -+ mar_res_header_t header __attribute__((aligned(8))); -+ unsigned int family; -+ unsigned int num_addrs; -+ char addrs[TOTEMIP_ADDRLEN][0]; -+}; -+ - typedef enum { - AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0, - AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1, - AIS_AMF_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2, - AIS_AMF_ADMINISTRATIVETARGET_NODE = 3 --} corosyncAdministrativeTarget; -+} corosync_administrative_target_t; - - typedef enum { - AIS_AMF_ADMINISTRATIVESTATE_UNLOCKED = 0, - AIS_AMF_ADMINISTRATIVESTATE_LOCKED = 1, - AIS_AMF_ADMINISTRATIVESTATE_STOPPING = 2 --} corosyncAdministrativeState; -+} corosync_administrative_state_t; -+ -+typedef enum { -+ CFG_SHUTDOWN_FLAG_REQUEST = 0, -+ CFG_SHUTDOWN_FLAG_REGARDLESS = 1, -+ CFG_SHUTDOWN_FLAG_IMMEDIATE = 2, -+} corosync_shutdown_flags_t; -+ - - #endif /* AIS_IPC_CFG_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/ipc_confdb.h corosync-trunk/include/corosync/ipc_confdb.h ---- corosync-0.92/include/corosync/ipc_confdb.h 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/include/corosync/ipc_confdb.h 2008-11-06 22:49:07.000000000 +0100 -@@ -35,7 +35,7 @@ - #define IPC_CONFDB_H_DEFINED - - #include --#include "saAis.h" -+#include - #include "ipc_gen.h" - - enum req_confdb_types { -diff -Naurd corosync-0.92/include/corosync/ipc_cpg.h corosync-trunk/include/corosync/ipc_cpg.h ---- corosync-0.92/include/corosync/ipc_cpg.h 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/include/corosync/ipc_cpg.h 2009-01-08 07:29:16.000000000 +0100 -@@ -35,7 +35,7 @@ - #define IPC_CPG_H_DEFINED - - #include --#include "saAis.h" -+#include - #include "ipc_gen.h" - #include "mar_cpg.h" - -@@ -143,7 +143,7 @@ - - struct req_lib_cpg_membership { - mar_req_header_t header __attribute__((aligned(8))); -- mar_cpg_name_t group_name __attribute__((aligned(8))); -+// mar_cpg_name_t group_name __attribute__((aligned(8))); - }; - - struct res_lib_cpg_confchg_callback { -diff -Naurd corosync-0.92/include/corosync/ipc_evs.h corosync-trunk/include/corosync/ipc_evs.h ---- corosync-0.92/include/corosync/ipc_evs.h 2008-08-14 16:59:50.000000000 +0200 -+++ corosync-trunk/include/corosync/ipc_evs.h 2008-11-06 22:49:07.000000000 +0100 -@@ -34,8 +34,7 @@ - #ifndef IPC_EVS_H_DEFINED - #define IPC_EVS_H_DEFINED - --//#include --#include "saAis.h" -+#include - #include "evs.h" - #include "ipc_gen.h" - -diff -Naurd corosync-0.92/include/corosync/ipc_gen.h corosync-trunk/include/corosync/ipc_gen.h ---- corosync-0.92/include/corosync/ipc_gen.h 2008-08-14 16:59:50.000000000 +0200 -+++ corosync-trunk/include/corosync/ipc_gen.h 2008-11-06 22:49:07.000000000 +0100 -@@ -46,7 +46,9 @@ - MSG_SERVICE = 6, - CFG_SERVICE = 7, - CPG_SERVICE = 8, -- CONFDB_SERVICE = 10 -+ CONFDB_SERVICE = 10, -+ QUORUM_SERVICE = 11, -+ PLOAD_SERVICE = 12 - }; - - enum req_init_types { -@@ -72,7 +74,7 @@ - typedef struct { - int size; __attribute__((aligned(8))) - int id __attribute__((aligned(8))); -- SaAisErrorT error __attribute__((aligned(8))); -+ cs_error_t error __attribute__((aligned(8))); - } mar_res_header_t __attribute__((aligned(8))); - - typedef struct { -diff -Naurd corosync-0.92/include/corosync/ipc_pload.h corosync-trunk/include/corosync/ipc_pload.h ---- corosync-0.92/include/corosync/ipc_pload.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/ipc_pload.h 2008-11-06 22:49:07.000000000 +0100 -@@ -0,0 +1,71 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: 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. -+ */ -+#ifndef IPC_PLOAD_H_DEFINED -+#define IPC_PLOAD_H_DEFINED -+ -+#include -+#include "pload.h" -+#include "ipc_gen.h" -+ -+enum req_lib_evs_types { -+ MESSAGE_REQ_PLOAD_START = 0, -+}; -+ -+enum res_lib_evs_types { -+ MESSAGE_RES_PLOAD_START = 0, -+}; -+ -+struct res_lib_pload_start { -+ mar_res_header_t header; -+ unsigned int dataset[1024]; -+}; -+ -+struct res_lib_pload_mcast { -+ mar_res_header_t header; -+}; -+ -+struct req_lib_pload_start { -+ mar_req_header_t header; -+ unsigned int msg_code; -+ unsigned int msg_size; -+ unsigned int msg_count; -+ unsigned int time_interval; -+}; -+ -+struct req_lib_pload_mcast { -+ mar_req_header_t header; -+ unsigned int code; -+}; -+ -+#endif /* IPC_PLOAD_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/ipc_quorum.h corosync-trunk/include/corosync/ipc_quorum.h ---- corosync-0.92/include/corosync/ipc_quorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/ipc_quorum.h 2008-11-06 22:49:07.000000000 +0100 -@@ -0,0 +1,73 @@ -+/* -+ * Copyright (c) 2008 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 the MontaVista Software, Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived from this -+ * software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -+ * THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+#ifndef IPC_QUORUM_H_DEFINED -+#define IPC_QUORUM_H_DEFINED -+ -+#include -+#include -+#include "corosync/ipc_gen.h" -+ -+enum req_quorum_types { -+ MESSAGE_REQ_QUORUM_GETQUORATE = 0, -+ MESSAGE_REQ_QUORUM_TRACKSTART, -+ MESSAGE_REQ_QUORUM_TRACKSTOP -+}; -+ -+enum res_quorum_types { -+ MESSAGE_RES_QUORUM_GETQUORATE = 0, -+ MESSAGE_RES_QUORUM_TRACKSTART, -+ MESSAGE_RES_QUORUM_TRACKSTOP, -+ MESSAGE_RES_QUORUM_NOTIFICATION -+}; -+ -+struct req_lib_quorum_trackstart { -+ mar_req_header_t header __attribute__((aligned(8))); -+ unsigned int track_flags; -+}; -+ -+ -+struct res_lib_quorum_getquorate { -+ mar_res_header_t header __attribute__((aligned(8))); -+ mar_uint32_t quorate; -+}; -+ -+struct res_lib_quorum_notification { -+ mar_res_header_t header __attribute__((aligned(8))); -+ mar_int32_t quorate __attribute__((aligned(8))); -+ mar_uint64_t ring_seq __attribute__((aligned(8))); -+ mar_uint32_t view_list_entries __attribute__((aligned(8))); -+ mar_uint32_t view_list[]; -+}; -+ -+#endif -diff -Naurd corosync-0.92/include/corosync/ipc_votequorum.h corosync-trunk/include/corosync/ipc_votequorum.h ---- corosync-0.92/include/corosync/ipc_votequorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/ipc_votequorum.h 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,149 @@ -+/* -+ * Copyright (c) 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 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 CONTIBUTORS "AS IS" -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -+ * THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+#ifndef IPC_VOTEQUORUM_H_DEFINED -+#define IPC_VOTEQUORUM_H_DEFINED -+ -+#include "corosync/corotypes.h" -+#include "corosync/ipc_gen.h" -+ -+// ILLEGAL value!! -+#define VOTEQUORUM_SERVICE 15 -+ -+#define VOTEQUORUM_MAX_QDISK_NAME_LEN 255 -+ -+ -+enum req_votequorum_types { -+ MESSAGE_REQ_VOTEQUORUM_GETINFO = 0, -+ MESSAGE_REQ_VOTEQUORUM_SETEXPECTED, -+ MESSAGE_REQ_VOTEQUORUM_SETVOTES, -+ MESSAGE_REQ_VOTEQUORUM_QDISK_REGISTER, -+ MESSAGE_REQ_VOTEQUORUM_QDISK_UNREGISTER, -+ MESSAGE_REQ_VOTEQUORUM_QDISK_POLL, -+ MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO, -+ MESSAGE_REQ_VOTEQUORUM_SETSTATE, -+ MESSAGE_REQ_VOTEQUORUM_LEAVING, -+ MESSAGE_REQ_VOTEQUORUM_TRACKSTART, -+ MESSAGE_REQ_VOTEQUORUM_TRACKSTOP -+}; -+ -+enum res_votequorum_types { -+ MESSAGE_RES_VOTEQUORUM_STATUS = 0, -+ MESSAGE_RES_VOTEQUORUM_GETINFO, -+ MESSAGE_RES_VOTEQUORUM_QDISK_GETINFO, -+ MESSAGE_RES_VOTEQUORUM_TRACKSTART, -+ MESSAGE_RES_VOTEQUORUM_NOTIFICATION -+}; -+ -+struct req_lib_votequorum_setvotes { -+ mar_req_header_t header __attribute__((aligned(8))); -+ unsigned int votes; -+ int nodeid; -+}; -+ -+struct req_lib_votequorum_qdisk_register { -+ mar_req_header_t header __attribute__((aligned(8))); -+ unsigned int votes; -+ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; -+}; -+ -+struct req_lib_votequorum_qdisk_poll { -+ mar_req_header_t header __attribute__((aligned(8))); -+ int state; -+}; -+ -+struct req_lib_votequorum_setexpected { -+ mar_req_header_t header __attribute__((aligned(8))); -+ unsigned int expected_votes; -+}; -+ -+struct req_lib_votequorum_trackstart { -+ mar_req_header_t header __attribute__((aligned(8))); -+ uint64_t context; -+ unsigned int track_flags; -+}; -+ -+struct req_lib_votequorum_general { -+ mar_req_header_t header __attribute__((aligned(8))); -+}; -+ -+#define VOTEQUORUM_REASON_KILL_REJECTED 1 -+#define VOTEQUORUM_REASON_KILL_APPLICATION 2 -+#define VOTEQUORUM_REASON_KILL_REJOIN 3 -+ -+struct req_lib_votequorum_getinfo { -+ mar_req_header_t header __attribute__((aligned(8))); -+ int nodeid; -+}; -+ -+struct res_lib_votequorum_status { -+ mar_res_header_t header __attribute__((aligned(8))); -+}; -+ -+#define VOTEQUORUM_INFO_FLAG_HASSTATE 1 -+#define VOTEQUORUM_INFO_FLAG_DISALLOWED 2 -+#define VOTEQUORUM_INFO_FLAG_TWONODE 4 -+#define VOTEQUORUM_INFO_FLAG_QUORATE 8 -+ -+struct res_lib_votequorum_getinfo { -+ mar_res_header_t header __attribute__((aligned(8))); -+ int nodeid; -+ unsigned int votes; -+ unsigned int expected_votes; -+ unsigned int highest_expected; -+ unsigned int total_votes; -+ unsigned int quorum; -+ unsigned int flags; -+}; -+ -+struct res_lib_votequorum_qdisk_getinfo { -+ mar_res_header_t header __attribute__((aligned(8))); -+ unsigned int votes; -+ unsigned int state; -+ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; -+}; -+ -+struct votequorum_node { -+ mar_uint32_t nodeid; -+ mar_uint32_t state; -+}; -+ -+struct res_lib_votequorum_notification { -+ mar_res_header_t header __attribute__((aligned(8))); -+ mar_uint32_t quorate __attribute__((aligned(8))); -+ mar_uint64_t context __attribute__((aligned(8))); -+ mar_uint32_t node_list_entries __attribute__((aligned(8))); -+ struct votequorum_node node_list[] __attribute__((aligned(8))); -+}; -+ -+#endif -diff -Naurd corosync-0.92/include/corosync/mar_gen.h corosync-trunk/include/corosync/mar_gen.h ---- corosync-0.92/include/corosync/mar_gen.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/mar_gen.h 2008-11-06 22:49:07.000000000 +0100 -@@ -43,7 +43,7 @@ - #endif - #include - --#include -+#include - #include - - typedef int8_t mar_int8_t; -@@ -98,7 +98,7 @@ - - typedef struct { - mar_uint16_t length __attribute__((aligned(8))); -- mar_uint8_t value[SA_MAX_NAME_LENGTH] __attribute__((aligned(8))); -+ mar_uint8_t value[CS_MAX_NAME_LENGTH] __attribute__((aligned(8))); - } mar_name_t; - - static inline char *get_mar_name_t (mar_name_t *name) { -@@ -121,19 +121,19 @@ - } - - static inline void marshall_from_mar_name_t ( -- SaNameT *dest, -+ cs_name_t *dest, - mar_name_t *src) - { - dest->length = src->length; -- memcpy (dest->value, src->value, SA_MAX_NAME_LENGTH); -+ memcpy (dest->value, src->value, CS_MAX_NAME_LENGTH); - } - - static inline void marshall_to_mar_name_t ( - mar_name_t *dest, -- SaNameT *src) -+ cs_name_t *src) - { - dest->length = src->length; -- memcpy (dest->value, src->value, SA_MAX_NAME_LENGTH); -+ memcpy (dest->value, src->value, CS_MAX_NAME_LENGTH); - } - - typedef enum { -@@ -148,7 +148,7 @@ - swab_mar_uint64_t (to_swab); - } - --#define MAR_TIME_END ((SaTimeT)0x7fffffffffffffffull) -+#define MAR_TIME_END ((int64_t)0x7fffffffffffffffull) - #define MAR_TIME_BEGIN 0x0ULL - #define MAR_TIME_UNKNOWN 0x8000000000000000ULL - -@@ -158,7 +158,7 @@ - #define MAR_TIME_ONE_MINUTE 60000000000ULL - #define MAR_TIME_ONE_HOUR 3600000000000ULL - #define MAR_TIME_ONE_DAY 86400000000000ULL --#define MAR_TIME_MAX SA_TIME_END -+#define MAR_TIME_MAX CS_TIME_END - - #define MAR_TRACK_CURRENT 0x01 - #define MAR_TRACK_CHANGES 0x02 -diff -Naurd corosync-0.92/include/corosync/pload.h corosync-trunk/include/corosync/pload.h ---- corosync-0.92/include/corosync/pload.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/pload.h 2008-10-30 23:41:34.000000000 +0100 -@@ -0,0 +1,100 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: 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. -+ */ -+#ifndef COROSYNC_PLOAD_H_DEFINED -+#define COROSYNC_PLOAD_H_DEFINED -+ -+#include -+#include -+ -+/** -+ * @defgroup corosync Other API services provided by corosync -+ */ -+/** -+ * @addtogroup pload_corosync -+ * -+ * @{ -+ */ -+ -+typedef uint64_t pload_handle_t; -+ -+typedef enum { -+ PLOAD_OK = 1, -+ PLOAD_ERR_LIBRARY = 2, -+ PLOAD_ERR_TIMEOUT = 5, -+ PLOAD_ERR_TRY_AGAIN = 6, -+ PLOAD_ERR_INVALID_PARAM = 7, -+ PLOAD_ERR_NO_MEMORY = 8, -+ PLOAD_ERR_BAD_HANDLE = 9, -+ PLOAD_ERR_ACCESS = 11, -+ PLOAD_ERR_NOT_EXIST = 12, -+ PLOAD_ERR_EXIST = 14, -+ PLOAD_ERR_NOT_SUPPORTED = 20, -+ PLOAD_ERR_SECURITY = 29, -+ PLOAD_ERR_TOO_MANY_GROUPS=30 -+} pload_error_t; -+ -+typedef struct { -+ int callback; -+} pload_callbacks_t; -+ -+/** @} */ -+ -+/* -+ * Create a new pload connection -+ */ -+pload_error_t pload_initialize ( -+ pload_handle_t *handle, -+ pload_callbacks_t *callbacks); -+ -+/* -+ * Close the pload handle -+ */ -+pload_error_t pload_finalize ( -+ pload_handle_t handle); -+ -+/* -+ * Get a file descriptor on which to poll. pload_handle_t is NOT a -+ * file descriptor and may not be used directly. -+ */ -+pload_error_t pload_fd_get ( -+ pload_handle_t handle, -+ int *fd); -+ -+unsigned int pload_start ( -+ pload_handle_t handle, -+ unsigned int code, -+ unsigned int msg_count, -+ unsigned int msg_size); -+ -+#endif /* COROSYNC_PLOAD_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/quorum.h corosync-trunk/include/corosync/quorum.h ---- corosync-0.92/include/corosync/quorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/quorum.h 2009-01-30 14:31:40.000000000 +0100 -@@ -0,0 +1,105 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: Christine Caulfield (ccaulfi@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 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. -+ */ -+#ifndef COROSYNC_QUORUM_H_DEFINED -+#define COROSYNC_QUORUM_H_DEFINED -+ -+#include -+ -+typedef uint64_t quorum_handle_t; -+ -+typedef struct { -+ uint32_t nodeid; -+ uint32_t state; -+} quorum_node_t; -+ -+typedef void (*quorum_notification_fn_t) ( -+ quorum_handle_t handle, -+ uint32_t quorate, -+ uint64_t ring_seq, -+ uint32_t view_list_entries, -+ uint32_t *view_list -+ ); -+ -+typedef struct { -+ quorum_notification_fn_t quorum_notify_fn; -+} quorum_callbacks_t; -+ -+ -+/* -+ * Create a new quorum connection -+ */ -+cs_error_t quorum_initialize ( -+ quorum_handle_t *handle, -+ quorum_callbacks_t *callbacks); -+ -+/* -+ * Close the quorum handle -+ */ -+cs_error_t quorum_finalize ( -+ quorum_handle_t handle); -+ -+ -+/* -+ * Get a file descriptor on which to poll. quorum_handle_t is NOT a -+ * file descriptor and may not be used directly. -+ */ -+cs_error_t quorum_fd_get ( -+ quorum_handle_t handle, -+ int *fd); -+ -+/* -+ * Dispatch messages and configuration changes -+ */ -+cs_error_t quorum_dispatch ( -+ quorum_handle_t handle, -+ cs_dispatch_flags_t dispatch_types); -+ -+ -+/* -+ * Get quorum information. -+ */ -+cs_error_t quorum_getquorate ( -+ quorum_handle_t handle, -+ int *quorate); -+ -+/* Track node and quorum changes */ -+cs_error_t quorum_trackstart ( -+ quorum_handle_t handle, -+ unsigned int flags ); -+ -+cs_error_t quorum_trackstop ( -+ quorum_handle_t handle); -+ -+ -+#endif /* COROSYNC_QUORUM_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/saAis.h corosync-trunk/include/corosync/saAis.h ---- corosync-0.92/include/corosync/saAis.h 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/include/corosync/saAis.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,152 +0,0 @@ --/* -- * Copyright (c) 2002-2003 MontaVista Software, Inc. -- * Copyright (c) 2006-2008 Red Hat, Inc. -- * -- * All rights reserved. -- * -- * Author: 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. -- */ -- --#ifndef AIS_TYPES_H_DEFINED --#define AIS_TYPES_H_DEFINED -- --/** -- * @defgroup saf Service Availability Forum Application Interface Specification -- */ -- --typedef enum { -- SA_FALSE = 0, -- SA_TRUE = 1 --} SaBoolT; -- --#ifndef COROSYNC_SOLARIS --#include --#else --#include --#endif -- --typedef int8_t SaInt8T; --typedef int16_t SaInt16T; --typedef int32_t SaInt32T; --typedef int64_t SaInt64T; -- --typedef uint8_t SaUint8T; --typedef uint16_t SaUint16T; --typedef uint32_t SaUint32T; --typedef uint64_t SaUint64T; -- --typedef float SaFloatT; --typedef double SaDoubleT; --typedef char * SaStringT; --typedef SaInt64T SaTimeT; -- --#define SA_TIME_END ((SaTimeT)0x7FFFFFFFFFFFFFFFULL) --#define SA_TIME_BEGIN 0x0ULL --#define SA_TIME_UNKNOWN 0x8000000000000000ULL -- --#define SA_TIME_ONE_MICROSECOND 1000ULL --#define SA_TIME_ONE_MILLISECOND 1000000ULL --#define SA_TIME_ONE_SECOND 1000000000ULL --#define SA_TIME_ONE_MINUTE 60000000000ULL --#define SA_TIME_ONE_HOUR 3600000000000ULL --#define SA_TIME_ONE_DAY 86400000000000ULL --#define SA_TIME_MAX SA_TIME_END -- --#define SA_MAX_NAME_LENGTH 256 -- --typedef struct { -- SaUint16T length; -- SaUint8T value[SA_MAX_NAME_LENGTH]; --} SaNameT; -- --typedef struct { -- char releaseCode; -- unsigned char majorVersion; -- unsigned char minorVersion; --} SaVersionT; -- --typedef SaUint64T SaNtfIdentifierT; -- --#define SA_TRACK_CURRENT 0x01 --#define SA_TRACK_CHANGES 0x02 --#define SA_TRACK_CHANGES_ONLY 0x04 -- --typedef enum { -- SA_DISPATCH_ONE = 1, -- SA_DISPATCH_ALL = 2, -- SA_DISPATCH_BLOCKING = 3 --} SaDispatchFlagsT; -- --typedef enum { -- SA_AIS_OK = 1, -- SA_AIS_ERR_LIBRARY = 2, -- SA_AIS_ERR_VERSION = 3, -- SA_AIS_ERR_INIT = 4, -- SA_AIS_ERR_TIMEOUT = 5, -- SA_AIS_ERR_TRY_AGAIN = 6, -- SA_AIS_ERR_INVALID_PARAM = 7, -- SA_AIS_ERR_NO_MEMORY = 8, -- SA_AIS_ERR_BAD_HANDLE = 9, -- SA_AIS_ERR_BUSY = 10, -- SA_AIS_ERR_ACCESS = 11, -- SA_AIS_ERR_NOT_EXIST = 12, -- SA_AIS_ERR_NAME_TOO_LONG = 13, -- SA_AIS_ERR_EXIST = 14, -- SA_AIS_ERR_NO_SPACE = 15, -- SA_AIS_ERR_INTERRUPT = 16, -- SA_AIS_ERR_NAME_NOT_FOUND = 17, -- SA_AIS_ERR_NO_RESOURCES = 18, -- SA_AIS_ERR_NOT_SUPPORTED = 19, -- SA_AIS_ERR_BAD_OPERATION = 20, -- SA_AIS_ERR_FAILED_OPERATION = 21, -- SA_AIS_ERR_MESSAGE_ERROR = 22, -- SA_AIS_ERR_QUEUE_FULL = 23, -- SA_AIS_ERR_QUEUE_NOT_AVAILABLE = 24, -- SA_AIS_ERR_BAD_FLAGS = 25, -- SA_AIS_ERR_TOO_BIG = 26, -- SA_AIS_ERR_NO_SECTIONS = 27 --} SaAisErrorT; -- --typedef union { -- SaInt64T int64Value; -- SaUint64T uint64Value; -- SaTimeT timeValue; -- SaFloatT floatValue; -- SaDoubleT doubleValue; --} SaLimitValueT; -- --typedef SaUint64T SaSelectionObjectT; -- --typedef SaUint64T SaInvocationT; -- --typedef SaUint64T SaSizeT; -- --#define SA_HANDLE_INVALID 0x0ULL -- --#endif /* AIS_TYPES_H_DEFINED */ -diff -Naurd corosync-0.92/include/corosync/totem/totem.h corosync-trunk/include/corosync/totem/totem.h ---- corosync-0.92/include/corosync/totem/totem.h 2008-08-20 02:57:40.000000000 +0200 -+++ corosync-trunk/include/corosync/totem/totem.h 2008-10-30 23:41:34.000000000 +0100 -@@ -50,26 +50,6 @@ - #define SEND_THREADS_MAX 16 - #define INTERFACE_MAX 2 - --/* -- * Array location of various timeouts as -- * specified in corosync.conf. The last enum -- * specifies the size of the timeouts array and -- * needs to remain the last item in the list. -- */ --enum { -- TOTEM_RETRANSMITS_BEFORE_LOSS, -- TOTEM_TOKEN, -- TOTEM_RETRANSMIT_TOKEN, -- TOTEM_HOLD_TOKEN, -- TOTEM_JOIN, -- TOTEM_CONSENSUS, -- TOTEM_MERGE, -- TOTEM_DOWNCHECK, -- TOTEM_FAIL_RECV_CONST, -- -- MAX_TOTEM_TIMEOUTS /* Last item */ --} totem_timeout_types; -- - struct totem_interface { - struct totem_ip_address bindnet; - struct totem_ip_address boundto; -@@ -78,12 +58,21 @@ - }; - - struct totem_logging_configuration { -- void (*log_printf) (char *, int, int, char *, ...) __attribute__((format(printf, 4, 5))); -+ void (*log_printf) ( -+ int subsys, -+ char *function_name, -+ char *file_name, -+ int file_line, -+ unsigned int level, -+ char *format, -+ ...) __attribute__((format(printf, 6, 7))); -+ - int log_level_security; - int log_level_error; - int log_level_warning; - int log_level_notice; - int log_level_debug; -+ int log_subsys_id; - }; - - struct totem_config { -@@ -161,6 +150,7 @@ - TOTEM_CONFIGURATION_TRANSITIONAL - }; - -+#define TOTEM_CALLBACK_TOKEN_TYPE - enum totem_callback_token_type { - TOTEM_CALLBACK_TOKEN_RECEIVED = 1, - TOTEM_CALLBACK_TOKEN_SENT = 2 -diff -Naurd corosync-0.92/include/corosync/totem/totemip.h corosync-trunk/include/corosync/totem/totemip.h ---- corosync-0.92/include/corosync/totem/totemip.h 2008-08-14 16:59:50.000000000 +0200 -+++ corosync-trunk/include/corosync/totem/totemip.h 2009-01-25 22:15:25.000000000 +0100 -@@ -72,7 +72,7 @@ - extern int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr, - uint16_t port, struct sockaddr_storage *saddr, int *addrlen); - extern int totemip_parse(struct totem_ip_address *totemip, char *addr, int family); --extern int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num); -+extern int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num, int mask_high_bit); - - /* These two simulate a zero in_addr by clearing the family field */ - static inline void totemip_zero_set(struct totem_ip_address *addr) -diff -Naurd corosync-0.92/include/corosync/totem/totempg.h corosync-trunk/include/corosync/totem/totempg.h ---- corosync-0.92/include/corosync/totem/totempg.h 2008-08-14 16:59:50.000000000 +0200 -+++ corosync-trunk/include/corosync/totem/totempg.h 2008-12-01 19:44:55.000000000 +0100 -@@ -139,7 +139,7 @@ - - extern char *totempg_ifaces_print (unsigned int nodeid); - --extern int totempg_my_nodeid_get (void); -+extern unsigned int totempg_my_nodeid_get (void); - - extern int totempg_my_family_get (void); - -diff -Naurd corosync-0.92/include/corosync/votequorum.h corosync-trunk/include/corosync/votequorum.h ---- corosync-0.92/include/corosync/votequorum.h 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/include/corosync/votequorum.h 2009-01-30 14:31:40.000000000 +0100 -@@ -0,0 +1,205 @@ -+/* -+ * Copyright (c) 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 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 CONTIBUTORS "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 COROSYNC_VOTEQUORUM_H_DEFINED -+#define COROSYNC_VOTEQUORUM_H_DEFINED -+ -+typedef uint64_t votequorum_handle_t; -+ -+ -+#define VOTEQUORUM_MAX_QDISK_NAME_LEN 255 -+ -+#define VOTEQUORUM_INFO_FLAG_HASSTATE 1 -+#define VOTEQUORUM_INFO_FLAG_DISALLOWED 2 -+#define VOTEQUORUM_INFO_FLAG_TWONODE 4 -+#define VOTEQUORUM_INFO_FLAG_QUORATE 8 -+ -+#define NODESTATE_JOINING 1 -+#define NODESTATE_MEMBER 2 -+#define NODESTATE_DEAD 3 -+#define NODESTATE_LEAVING 4 -+#define NODESTATE_DISALLOWED 5 -+ -+ -+/** @} */ -+ -+struct votequorum_info { -+ unsigned int node_id; -+ unsigned int node_votes; -+ unsigned int node_expected_votes; -+ unsigned int highest_expected; -+ unsigned int total_votes; -+ unsigned int quorum; -+ unsigned int flags; -+}; -+ -+struct votequorum_qdisk_info { -+ unsigned int votes; -+ unsigned int state; -+ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; -+}; -+ -+typedef struct { -+ uint32_t nodeid; -+ uint32_t state; -+} votequorum_node_t; -+ -+ -+typedef void (*votequorum_notification_fn_t) ( -+ votequorum_handle_t handle, -+ uint64_t context, -+ uint32_t quorate, -+ uint32_t node_list_entries, -+ votequorum_node_t node_list[] -+ ); -+ -+typedef struct { -+ votequorum_notification_fn_t votequorum_notify_fn; -+} votequorum_callbacks_t; -+ -+ -+/* -+ * Create a new quorum connection -+ */ -+cs_error_t votequorum_initialize ( -+ votequorum_handle_t *handle, -+ votequorum_callbacks_t *callbacks); -+ -+/* -+ * Close the quorum handle -+ */ -+cs_error_t votequorum_finalize ( -+ votequorum_handle_t handle); -+ -+ -+/* -+ * Dispatch messages and configuration changes -+ */ -+cs_error_t votequorum_dispatch ( -+ votequorum_handle_t handle, -+ cs_dispatch_flags_t dispatch_types); -+ -+/* -+ * Get a file descriptor on which to poll. votequorum_handle_t is NOT a -+ * file descriptor and may not be used directly. -+ */ -+cs_error_t votequorum_fd_get ( -+ votequorum_handle_t handle, -+ int *fd); -+ -+/* -+ * Get quorum information. -+ */ -+cs_error_t votequorum_getinfo ( -+ votequorum_handle_t handle, -+ unsigned int nodeid, -+ struct votequorum_info *info); -+ -+/* -+ * set expected_votes -+ */ -+cs_error_t votequorum_setexpected ( -+ votequorum_handle_t handle, -+ unsigned int expected_votes); -+ -+/* -+ * set votes for a node -+ */ -+cs_error_t votequorum_setvotes ( -+ votequorum_handle_t handle, -+ unsigned int nodeid, -+ unsigned int votes); -+ -+/* -+ * Register a quorum device -+ * it will be DEAD until polled -+ */ -+cs_error_t votequorum_qdisk_register ( -+ votequorum_handle_t handle, -+ char *name, -+ unsigned int votes); -+ -+/* -+ * Unregister a quorum device -+ */ -+cs_error_t votequorum_qdisk_unregister ( -+ votequorum_handle_t handle); -+ -+/* -+ * Poll a quorum device -+ */ -+cs_error_t votequorum_qdisk_poll ( -+ votequorum_handle_t handle, -+ unsigned int state); -+ -+/* -+ * Get quorum device information -+ */ -+cs_error_t votequorum_qdisk_getinfo ( -+ votequorum_handle_t handle, -+ struct votequorum_qdisk_info *info); -+ -+/* -+ * Set the "hasstate" bit for this node -+ */ -+cs_error_t votequorum_setstate ( -+ votequorum_handle_t handle); -+ -+/* Track node and quorum changes */ -+cs_error_t votequorum_trackstart ( -+ votequorum_handle_t handle, -+ uint64_t context, -+ unsigned int flags ); -+ -+cs_error_t votequorum_trackstop ( -+ votequorum_handle_t handle); -+ -+/* -+ * Set our LEAVING flag. we should exit soon after this -+ */ -+cs_error_t votequorum_leaving ( -+ votequorum_handle_t handle); -+ -+/* -+ * Save and retrieve private data/context -+ */ -+cs_error_t votequorum_context_get ( -+ votequorum_handle_t handle, -+ void **context); -+ -+cs_error_t votequorum_context_set ( -+ votequorum_handle_t handle, -+ void *context); -+ -+#endif /* COROSYNC_VOTEQUORUM_H_DEFINED */ -diff -Naurd corosync-0.92/lcr/Makefile corosync-trunk/lcr/Makefile ---- corosync-0.92/lcr/Makefile 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lcr/Makefile 2008-11-11 18:26:58.000000000 +0100 -@@ -84,3 +84,6 @@ - rm -f test libtest.so* *.o uic liblcr.so* liblcr.a *.lcrso *.da *.ba *.bb *.bbg \ - test_static - -+lint: -+ -splint $(LINT_FLAGS) $(CFLAGS) lcr_ifact.c uic.c uis.c -+ -diff -Naurd corosync-0.92/lcr/uic.c corosync-trunk/lcr/uic.c ---- corosync-0.92/lcr/uic.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lcr/uic.c 2008-11-11 19:13:47.000000000 +0100 -@@ -88,7 +88,7 @@ - return 0; - } - --struct req_msg { -+struct uic_req_msg { - int len; - char msg[0]; - }; -@@ -97,12 +97,13 @@ - { - struct msghdr msg_send; - struct iovec iov_send[2]; -- struct req_msg req_msg; -+ struct uic_req_msg req_msg; -+ ssize_t send_res; - int res; - - req_msg.len = strlen (msg) + 1; - iov_send[0].iov_base = (void *)&req_msg; -- iov_send[0].iov_len = sizeof (struct req_msg); -+ iov_send[0].iov_len = sizeof (struct uic_req_msg); - iov_send[1].iov_base = (void *)msg; - iov_send[1].iov_len = req_msg.len; - -@@ -120,12 +121,14 @@ - #endif - - retry_send: -- res = sendmsg (fd, &msg_send, 0); -- if (res == -1 && errno == EINTR) { -+ send_res = sendmsg (fd, &msg_send, 0); -+ if (send_res == -1 && errno == EINTR) { - goto retry_send; - } -- if (res == -1) { -+ if (send_res == -1) { - res = -errno; -+ } else { -+ res = (int)send_res; - } - return (res); - -diff -Naurd corosync-0.92/lcr/uis.c corosync-trunk/lcr/uis.c ---- corosync-0.92/lcr/uis.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lcr/uis.c 2008-11-11 18:26:58.000000000 +0100 -@@ -115,14 +115,14 @@ - } - }; - --struct req_msg { -+struct uis_req_msg { - int len; - char msg[0]; - }; - - static void lcr_uis_dispatch (int fd) - { -- struct req_msg header; -+ struct uis_req_msg header; - char msg_contents[512]; - ssize_t readsize; - -diff -Naurd corosync-0.92/lib/cfg.c corosync-trunk/lib/cfg.c ---- corosync-0.92/lib/cfg.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lib/cfg.c 2009-01-29 10:17:43.000000000 +0100 -@@ -1,13 +1,13 @@ - /* - * Copyright (c) 2002-2005 MontaVista Software, Inc. -- * Copyright (c) 2006-2007 Red Hat, Inc. -+ * Copyright (c) 2006-2009 Red Hat, Inc. - * - * All rights reserved. - * - * Author: 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: - * -@@ -40,19 +40,21 @@ - #include - #include - #include -+#include - #include - #include - #include - #include - --#include -+#include - #include -+#include - #include - #include - #include - #include - --struct res_overlay { -+struct cfg_res_overlay { - mar_res_header_t header; - char data[4096]; - }; -@@ -63,15 +65,15 @@ - struct cfg_instance { - int response_fd; - int dispatch_fd; -- CorosyncCfgCallbacksT callbacks; -- SaNameT compName; -- int compRegistered; -+ corosync_cfg_callbacks_t callbacks; -+ cs_name_t comp_name; -+ int comp_registered; - int finalize; - pthread_mutex_t response_mutex; - pthread_mutex_t dispatch_mutex; - }; - --static void cfg_handleInstanceDestructor (void *); -+static void cfg_handle_instance_destructor (void *); - - /* - * All instances in one database -@@ -80,13 +82,13 @@ - .handleCount = 0, - .handles = 0, - .mutex = PTHREAD_MUTEX_INITIALIZER, -- .handleInstanceDestructor = cfg_handleInstanceDestructor -+ .handleInstanceDestructor = cfg_handle_instance_destructor - }; - - /* - * Implementation - */ --void cfg_handleInstanceDestructor (void *instance) -+void cfg_handle_instance_destructor (void *instance) - { - struct cfg_instance *cfg_instance = instance; - -@@ -94,84 +96,85 @@ - pthread_mutex_destroy (&cfg_instance->dispatch_mutex); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_initialize ( - corosync_cfg_handle_t *cfg_handle, -- const CorosyncCfgCallbacksT *cfgCallbacks) -+ const corosync_cfg_callbacks_t *cfg_callbacks) - { - struct cfg_instance *cfg_instance; -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - - error = saHandleCreate (&cfg_hdb, sizeof (struct cfg_instance), cfg_handle); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_no_destroy; - } - - error = saHandleInstanceGet (&cfg_hdb, *cfg_handle, (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_destroy; - } - - cfg_instance->response_fd = -1; - - cfg_instance->dispatch_fd = -1; -- -+ - error = saServiceConnect (&cfg_instance->response_fd, - &cfg_instance->dispatch_fd, CFG_SERVICE); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_put_destroy; - } - -- if (cfgCallbacks) { -- memcpy (&cfg_instance->callbacks, cfgCallbacks, sizeof (CorosyncCfgCallbacksT)); -+ if (cfg_callbacks) { -+ memcpy (&cfg_instance->callbacks, cfg_callbacks, sizeof (corosync_cfg_callbacks_t)); - } - - pthread_mutex_init (&cfg_instance->response_mutex, NULL); - - pthread_mutex_init (&cfg_instance->dispatch_mutex, NULL); - -- saHandleInstancePut (&cfg_hdb, *cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, *cfg_handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - - error_put_destroy: -- saHandleInstancePut (&cfg_hdb, *cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, *cfg_handle); - error_destroy: -- saHandleDestroy (&cfg_hdb, *cfg_handle); -+ (void)saHandleDestroy (&cfg_hdb, *cfg_handle); - error_no_destroy: - return (error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_fd_get ( - corosync_cfg_handle_t cfg_handle, -- SaSelectionObjectT *selectionObject) -+ int32_t *selection_fd) - { - struct cfg_instance *cfg_instance; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -- *selectionObject = cfg_instance->dispatch_fd; -+ *selection_fd = cfg_instance->dispatch_fd; - -- saHandleInstancePut (&cfg_hdb, cfg_handle); -- return (SA_AIS_OK); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); -+ return (CS_OK); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_dispatch ( - corosync_cfg_handle_t cfg_handle, -- SaDispatchFlagsT dispatchFlags) -+ cs_dispatch_flags_t dispatch_flags) - { - struct pollfd ufds; - int timeout = -1; -- SaAisErrorT error; -+ cs_error_t error; - int cont = 1; /* always continue do loop except when set to 0 */ - int dispatch_avail; - struct cfg_instance *cfg_instance; -+ struct res_lib_cfg_testshutdown *res_lib_cfg_testshutdown; - #ifdef COMPILE_OUT - struct res_lib_corosync_healthcheckcallback *res_lib_corosync_healthcheckcallback; - struct res_lib_corosync_readinessstatesetcallback *res_lib_corosync_readinessstatesetcallback; -@@ -179,19 +182,19 @@ - struct res_lib_corosync_csiremovecallback *res_lib_corosync_csiremovecallback; - struct res_lib_cfg_statetrackcallback *res_lib_cfg_statetrackcallback; - #endif -- CorosyncCfgCallbacksT callbacks; -- struct res_overlay dispatch_data; -+ corosync_cfg_callbacks_t callbacks; -+ struct cfg_res_overlay dispatch_data; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, - (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - /* -- * Timeout instantly for SA_DISPATCH_ALL -+ * Timeout instantly for CS_DISPATCH_ALL - */ -- if (dispatchFlags == SA_DISPATCH_ALL) { -+ if (dispatch_flags == CS_DISPATCH_ALL) { - timeout = 0; - } - -@@ -204,14 +207,14 @@ - ufds.revents = 0; - - error = saPollRetry (&ufds, 1, timeout); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - - pthread_mutex_lock (&cfg_instance->dispatch_mutex); - - error = saPollRetry (&ufds, 1, 0); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - -@@ -219,13 +222,13 @@ - * Handle has been finalized in another thread - */ - if (cfg_instance->finalize == 1) { -- error = SA_AIS_OK; -+ error = CS_OK; - pthread_mutex_unlock (&cfg_instance->dispatch_mutex); - goto error_unlock; - } - - dispatch_avail = ufds.revents & POLLIN; -- if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) { -+ if (dispatch_avail == 0 && dispatch_flags == CS_DISPATCH_ALL) { - pthread_mutex_unlock (&cfg_instance->dispatch_mutex); - break; /* exit do while cont is 1 loop */ - } else -@@ -240,13 +243,13 @@ - */ - error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.header, - sizeof (mar_res_header_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - if (dispatch_data.header.size > sizeof (mar_res_header_t)) { - error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.data, - dispatch_data.header.size - sizeof (mar_res_header_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - } -@@ -260,16 +263,21 @@ - * A risk of this dispatch method is that the callback routines may - * operate at the same time that cfgFinalize has been called in another thread. - */ -- memcpy (&callbacks, &cfg_instance->callbacks, sizeof (CorosyncCfgCallbacksT)); -+ memcpy (&callbacks, &cfg_instance->callbacks, sizeof (corosync_cfg_callbacks_t)); - pthread_mutex_unlock (&cfg_instance->dispatch_mutex); - - /* - * Dispatch incoming response - */ - switch (dispatch_data.header.id) { -- -+ case MESSAGE_RES_CFG_TESTSHUTDOWN: -+ if (callbacks.corosync_cfg_shutdown_callback) { -+ res_lib_cfg_testshutdown = (struct res_lib_cfg_testshutdown *)&dispatch_data; -+ callbacks.corosync_cfg_shutdown_callback(cfg_handle, res_lib_cfg_testshutdown->flags); -+ } -+ break; - default: -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_nounlock; - break; - } -@@ -277,32 +285,32 @@ - /* - * Determine if more messages should be processed - */ -- switch (dispatchFlags) { -- case SA_DISPATCH_ONE: -+ switch (dispatch_flags) { -+ case CS_DISPATCH_ONE: - cont = 0; - break; -- case SA_DISPATCH_ALL: -+ case CS_DISPATCH_ALL: - break; -- case SA_DISPATCH_BLOCKING: -+ case CS_DISPATCH_BLOCKING: - break; - } - } while (cont); - - error_unlock: -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - error_nounlock: - return (error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_finalize ( - corosync_cfg_handle_t cfg_handle) - { - struct cfg_instance *cfg_instance; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -316,8 +324,8 @@ - if (cfg_instance->finalize) { - pthread_mutex_unlock (&cfg_instance->response_mutex); - pthread_mutex_unlock (&cfg_instance->dispatch_mutex); -- saHandleInstancePut (&cfg_hdb, cfg_handle); -- return (SA_AIS_ERR_BAD_HANDLE); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); -+ return (CS_ERR_BAD_HANDLE); - } - - cfg_instance->finalize = 1; -@@ -330,7 +338,7 @@ - - pthread_mutex_destroy (&cfg_instance->dispatch_mutex); - -- saHandleDestroy (&cfg_hdb, cfg_handle); -+ (void)saHandleDestroy (&cfg_hdb, cfg_handle); - - if (cfg_instance->response_fd != -1) { - shutdown (cfg_instance->response_fd, 0); -@@ -341,12 +349,12 @@ - close (cfg_instance->dispatch_fd); - } - -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - - return (error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_ring_status_get ( - corosync_cfg_handle_t cfg_handle, - char ***interface_names, -@@ -357,10 +365,10 @@ - struct req_lib_cfg_ringstatusget req_lib_cfg_ringstatusget; - struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget; - unsigned int i; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -380,13 +388,13 @@ - *interface_count = res_lib_cfg_ringstatusget.interface_count; - *interface_names = malloc (sizeof (char *) * *interface_count); - if (*interface_names == NULL) { -- return (SA_AIS_ERR_NO_MEMORY); -+ return (CS_ERR_NO_MEMORY); - } - memset (*interface_names, 0, sizeof (char *) * *interface_count); - - *status = malloc (sizeof (char *) * *interface_count); - if (*status == NULL) { -- error = SA_AIS_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - goto error_free_interface_names; - } - memset (*status, 0, sizeof (char *) * *interface_count); -@@ -394,12 +402,12 @@ - for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) { - (*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]); - if ((*(interface_names))[i] == NULL) { -- error = SA_AIS_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - goto error_free_contents; - } - (*(status))[i] = strdup (res_lib_cfg_ringstatusget.interface_status[i]); - if ((*(status))[i] == NULL) { -- error = SA_AIS_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - goto error_free_contents; - } - } -@@ -416,27 +424,27 @@ - } - - free (*status); -- -+ - error_free_interface_names: - free (*interface_names); -- -+ - no_error: -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - - return (error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_ring_reenable ( - corosync_cfg_handle_t cfg_handle) - { - struct cfg_instance *cfg_instance; - struct req_lib_cfg_ringreenable req_lib_cfg_ringreenable; - struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -452,12 +460,12 @@ - sizeof (struct res_lib_cfg_ringreenable)); - - pthread_mutex_unlock (&cfg_instance->response_mutex); -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - - return (error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_service_load ( - corosync_cfg_handle_t cfg_handle, - char *service_name, -@@ -466,10 +474,10 @@ - struct cfg_instance *cfg_instance; - struct req_lib_cfg_serviceload req_lib_cfg_serviceload; - struct res_lib_cfg_serviceload res_lib_cfg_serviceload; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -477,7 +485,7 @@ - req_lib_cfg_serviceload.header.id = MESSAGE_REQ_CFG_SERVICELOAD; - memset (&req_lib_cfg_serviceload.service_name, 0, - sizeof (req_lib_cfg_serviceload.service_name)); -- strncpy ((char *)req_lib_cfg_serviceload.service_name, service_name, -+ strncpy (req_lib_cfg_serviceload.service_name, service_name, - sizeof (req_lib_cfg_serviceload.service_name) - 1); - req_lib_cfg_serviceload.service_ver = service_ver; - -@@ -490,12 +498,12 @@ - sizeof (struct res_lib_cfg_serviceload)); - - pthread_mutex_unlock (&cfg_instance->response_mutex); -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - - return (error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_service_unload ( - corosync_cfg_handle_t cfg_handle, - char *service_name, -@@ -504,10 +512,10 @@ - struct cfg_instance *cfg_instance; - struct req_lib_cfg_serviceunload req_lib_cfg_serviceunload; - struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -515,7 +523,7 @@ - req_lib_cfg_serviceunload.header.id = MESSAGE_REQ_CFG_SERVICEUNLOAD; - memset (&req_lib_cfg_serviceunload.service_name, 0, - sizeof (req_lib_cfg_serviceunload.service_name)); -- strncpy ((char *)req_lib_cfg_serviceunload.service_name, service_name, -+ strncpy (req_lib_cfg_serviceunload.service_name, service_name, - sizeof (req_lib_cfg_serviceunload.service_name) - 1); - req_lib_cfg_serviceunload.service_ver = service_ver; - -@@ -528,29 +536,29 @@ - sizeof (struct res_lib_cfg_serviceunload)); - - pthread_mutex_unlock (&cfg_instance->response_mutex); -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - - return (error); - } --SaAisErrorT -+cs_error_t - corosync_cfg_state_track ( - corosync_cfg_handle_t cfg_handle, -- SaUint8T trackFlags, -- const CorosyncCfgStateNotificationT *notificationBuffer) -+ uint8_t track_flags, -+ const corosync_cfg_state_notification_t *notification_buffer) - { - struct cfg_instance *cfg_instance; - struct req_lib_cfg_statetrack req_lib_cfg_statetrack; - struct res_lib_cfg_statetrack res_lib_cfg_statetrack; -- SaAisErrorT error; -+ cs_error_t error; - - req_lib_cfg_statetrack.header.size = sizeof (struct req_lib_cfg_statetrack); - req_lib_cfg_statetrack.header.id = MESSAGE_REQ_CFG_STATETRACKSTART; -- req_lib_cfg_statetrack.trackFlags = trackFlags; -- req_lib_cfg_statetrack.notificationBufferAddress = (CorosyncCfgStateNotificationT *)notificationBuffer; -+ req_lib_cfg_statetrack.track_flags = track_flags; -+ req_lib_cfg_statetrack.notification_buffer_address = (corosync_cfg_state_notification_t *)notification_buffer; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, - (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -564,23 +572,23 @@ - - pthread_mutex_unlock (&cfg_instance->response_mutex); - -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - -- return (error == SA_AIS_OK ? res_lib_cfg_statetrack.header.error : error); -+ return (error == CS_OK ? res_lib_cfg_statetrack.header.error : error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_state_track_stop ( - corosync_cfg_handle_t cfg_handle) - { - struct cfg_instance *cfg_instance; - struct req_lib_cfg_statetrackstop req_lib_cfg_statetrackstop; - struct res_lib_cfg_statetrackstop res_lib_cfg_statetrackstop; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, - (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -597,31 +605,33 @@ - - pthread_mutex_unlock (&cfg_instance->response_mutex); - -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - -- return (error == SA_AIS_OK ? res_lib_cfg_statetrackstop.header.error : error); -+ return (error == CS_OK ? res_lib_cfg_statetrackstop.header.error : error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_admin_state_get ( - corosync_cfg_handle_t cfg_handle, -- CorosyncCfgAdministrativeTargetT administrativeTarget, -- CorosyncCfgAdministrativeStateT *administrativeState) -+ corosync_cfg_administrative_target_t administrative_target, -+ corosync_cfg_administrative_state_t *administrative_state) - { - struct cfg_instance *cfg_instance; - struct req_lib_cfg_administrativestateget req_lib_cfg_administrativestateget; - struct res_lib_cfg_administrativestateget res_lib_cfg_administrativestateget; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, - (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - req_lib_cfg_administrativestateget.header.id = MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET; - req_lib_cfg_administrativestateget.header.size = sizeof (struct req_lib_cfg_administrativestateget); -- req_lib_cfg_administrativestateget.administrativeTarget = administrativeTarget; -+ req_lib_cfg_administrativestateget.administrative_target = administrative_target; -+ -+ pthread_mutex_lock (&cfg_instance->response_mutex); - - error = saSendReceiveReply (cfg_instance->response_fd, - &req_lib_cfg_administrativestateget, -@@ -633,32 +643,34 @@ - - pthread_mutex_unlock (&cfg_instance->response_mutex); - -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - -- return (error == SA_AIS_OK ? res_lib_cfg_administrativestateget.header.error : error); -+ return (error == CS_OK ? res_lib_cfg_administrativestateget.header.error : error); - } - --SaAisErrorT -+cs_error_t - corosync_cfg_admin_state_set ( - corosync_cfg_handle_t cfg_handle, -- CorosyncCfgAdministrativeTargetT administrativeTarget, -- CorosyncCfgAdministrativeStateT administrativeState) -+ corosync_cfg_administrative_target_t administrative_target, -+ corosync_cfg_administrative_state_t administrative_state) - { - struct cfg_instance *cfg_instance; - struct req_lib_cfg_administrativestateset req_lib_cfg_administrativestateset; - struct res_lib_cfg_administrativestateset res_lib_cfg_administrativestateset; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cfg_hdb, cfg_handle, - (void *)&cfg_instance); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - req_lib_cfg_administrativestateset.header.id = MESSAGE_REQ_CFG_ADMINISTRATIVESTATEGET; - req_lib_cfg_administrativestateset.header.size = sizeof (struct req_lib_cfg_administrativestateset); -- req_lib_cfg_administrativestateset.administrativeTarget = administrativeTarget; -- req_lib_cfg_administrativestateset.administrativeState = administrativeState; -+ req_lib_cfg_administrativestateset.administrative_target = administrative_target; -+ req_lib_cfg_administrativestateset.administrative_state = administrative_state; -+ -+ pthread_mutex_lock (&cfg_instance->response_mutex); - - error = saSendReceiveReply (cfg_instance->response_fd, - &req_lib_cfg_administrativestateset, -@@ -670,7 +682,191 @@ - - pthread_mutex_unlock (&cfg_instance->response_mutex); - -- saHandleInstancePut (&cfg_hdb, cfg_handle); -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); - -- return (error == SA_AIS_OK ? res_lib_cfg_administrativestateset.header.error : error); -+ return (error == CS_OK ? res_lib_cfg_administrativestateset.header.error : error); -+} -+ -+cs_error_t -+corosync_cfg_kill_node ( -+ corosync_cfg_handle_t cfg_handle, -+ unsigned int nodeid, -+ char *reason) -+{ -+ struct cfg_instance *cfg_instance; -+ struct req_lib_cfg_killnode req_lib_cfg_killnode; -+ struct res_lib_cfg_killnode res_lib_cfg_killnode; -+ cs_error_t error; -+ -+ if (strlen(reason) >= CS_MAX_NAME_LENGTH) -+ return CS_ERR_NAME_TOO_LONG; -+ -+ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, -+ (void *)&cfg_instance); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ req_lib_cfg_killnode.header.id = MESSAGE_REQ_CFG_KILLNODE; -+ req_lib_cfg_killnode.header.size = sizeof (struct req_lib_cfg_killnode); -+ req_lib_cfg_killnode.nodeid = nodeid; -+ strcpy((char *)req_lib_cfg_killnode.reason.value, reason); -+ req_lib_cfg_killnode.reason.length = strlen(reason)+1; -+ -+ pthread_mutex_lock (&cfg_instance->response_mutex); -+ -+ error = saSendReceiveReply (cfg_instance->response_fd, -+ &req_lib_cfg_killnode, -+ sizeof (struct req_lib_cfg_killnode), -+ &res_lib_cfg_killnode, -+ sizeof (struct res_lib_cfg_killnode)); -+ -+ error = res_lib_cfg_killnode.header.error; -+ -+ pthread_mutex_unlock (&cfg_instance->response_mutex); -+ -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); -+ -+ return (error == CS_OK ? res_lib_cfg_killnode.header.error : error); -+} -+ -+cs_error_t -+corosync_cfg_try_shutdown ( -+ corosync_cfg_handle_t cfg_handle, -+ corosync_cfg_shutdown_flags_t flags) -+{ -+ struct cfg_instance *cfg_instance; -+ struct req_lib_cfg_tryshutdown req_lib_cfg_tryshutdown; -+ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; -+ cs_error_t error; -+ -+ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, -+ (void *)&cfg_instance); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ req_lib_cfg_tryshutdown.header.id = MESSAGE_REQ_CFG_TRYSHUTDOWN; -+ req_lib_cfg_tryshutdown.header.size = sizeof (struct req_lib_cfg_tryshutdown); -+ req_lib_cfg_tryshutdown.flags = flags; -+ -+ pthread_mutex_lock (&cfg_instance->response_mutex); -+ -+ error = saSendReceiveReply (cfg_instance->response_fd, -+ &req_lib_cfg_tryshutdown, -+ sizeof (struct req_lib_cfg_tryshutdown), -+ &res_lib_cfg_tryshutdown, -+ sizeof (struct res_lib_cfg_tryshutdown)); -+ -+ pthread_mutex_unlock (&cfg_instance->response_mutex); -+ -+ (void)saHandleInstancePut (&cfg_hdb, cfg_handle); -+ -+ return (error == CS_OK ? res_lib_cfg_tryshutdown.header.error : error); -+} -+ -+cs_error_t -+corosync_cfg_replyto_shutdown ( -+ corosync_cfg_handle_t cfg_handle, -+ corosync_cfg_shutdown_reply_flags_t response) -+{ -+ struct cfg_instance *cfg_instance; -+ struct req_lib_cfg_replytoshutdown req_lib_cfg_replytoshutdown; -+ struct iovec iov; -+ cs_error_t error; -+ -+ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, -+ (void *)&cfg_instance); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ req_lib_cfg_replytoshutdown.header.id = MESSAGE_REQ_CFG_REPLYTOSHUTDOWN; -+ req_lib_cfg_replytoshutdown.header.size = sizeof (struct req_lib_cfg_replytoshutdown); -+ req_lib_cfg_replytoshutdown.response = response; -+ -+ iov.iov_base = &req_lib_cfg_replytoshutdown; -+ iov.iov_len = sizeof (struct req_lib_cfg_replytoshutdown); -+ -+ pthread_mutex_lock (&cfg_instance->response_mutex); -+ error = saSendMsgRetry (cfg_instance->response_fd, -+ &iov, 1); -+ -+ pthread_mutex_unlock (&cfg_instance->response_mutex); -+ -+ return (error); -+} -+ -+cs_error_t corosync_cfg_get_node_addrs ( -+ corosync_cfg_handle_t cfg_handle, -+ int nodeid, -+ int max_addrs, -+ int *num_addrs, -+ corosync_cfg_node_address_t *addrs) -+{ -+ cs_error_t error; -+ char buf[PIPE_BUF]; -+ struct req_lib_cfg_get_node_addrs req_lib_cfg_get_node_addrs; -+ struct res_lib_cfg_get_node_addrs * res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf; -+ struct cfg_instance *cfg_instance; -+ int addrlen; -+ int i; -+ struct iovec iov[2]; -+ -+ error = saHandleInstanceGet (&cfg_hdb, cfg_handle, -+ (void *)&cfg_instance); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&cfg_instance->response_mutex); -+ -+ req_lib_cfg_get_node_addrs.header.size = sizeof (req_lib_cfg_get_node_addrs); -+ req_lib_cfg_get_node_addrs.header.id = MESSAGE_REQ_CFG_GET_NODE_ADDRS; -+ req_lib_cfg_get_node_addrs.nodeid = nodeid; -+ -+ iov[0].iov_base = (char *)&req_lib_cfg_get_node_addrs; -+ iov[0].iov_len = sizeof (req_lib_cfg_get_node_addrs); -+ -+ error = saSendMsgReceiveReply (cfg_instance->response_fd, iov, 1, -+ res_lib_cfg_get_node_addrs, sizeof (mar_res_header_t)); -+ -+ if (error == CS_OK && res_lib_cfg_get_node_addrs->header.size > sizeof(mar_res_header_t)) { -+ error = saRecvRetry (cfg_instance->response_fd, (char *)res_lib_cfg_get_node_addrs + sizeof (mar_res_header_t), -+ res_lib_cfg_get_node_addrs->header.size - sizeof (mar_res_header_t)); -+ } -+ pthread_mutex_unlock (&cfg_instance->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ if (res_lib_cfg_get_node_addrs->family == AF_INET) -+ addrlen = sizeof(struct sockaddr_in); -+ if (res_lib_cfg_get_node_addrs->family == AF_INET6) -+ addrlen = sizeof(struct sockaddr_in6); -+ -+ for (i=0; inum_addrs; i++) { -+ addrs[i].address_length = addrlen; -+ struct sockaddr_in *in; -+ struct sockaddr_in6 *in6; -+ -+ if (res_lib_cfg_get_node_addrs->family == AF_INET) { -+ in = (struct sockaddr_in *)addrs[i].address; -+ in->sin_family = AF_INET; -+ memcpy(&in->sin_addr, &res_lib_cfg_get_node_addrs->addrs[i][0], sizeof(struct in_addr)); -+ } -+ if (res_lib_cfg_get_node_addrs->family == AF_INET6) { -+ in6 = (struct sockaddr_in6 *)addrs[i].address; -+ in6->sin6_family = AF_INET6; -+ memcpy(&in6->sin6_addr, &res_lib_cfg_get_node_addrs->addrs[i][0], sizeof(struct in6_addr)); -+ } -+ } -+ *num_addrs = res_lib_cfg_get_node_addrs->num_addrs; -+ errno = error = res_lib_cfg_get_node_addrs->header.error; -+ -+error_exit: -+ -+ pthread_mutex_unlock (&cfg_instance->response_mutex); -+ return (error); - } -diff -Naurd corosync-0.92/lib/confdb.c corosync-trunk/lib/confdb.c ---- corosync-0.92/lib/confdb.c 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/lib/confdb.c 2009-01-23 16:41:06.000000000 +0100 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2008 Red Hat, Inc. -+ * Copyright (c) 2008-2009 Red Hat, Inc. - * - * All rights reserved. - * -@@ -42,7 +42,7 @@ - #include - #include - --#include -+#include - #include - #include - #include -@@ -86,7 +86,7 @@ - }; - - --static confdb_error_t do_find_destroy(struct confdb_inst *confdb_inst, unsigned int find_handle); -+static cs_error_t do_find_destroy(struct confdb_inst *confdb_inst, unsigned int find_handle); - - - /* Safely tidy one iterator context list */ -@@ -99,7 +99,7 @@ - iter != list; iter = tmp, tmp = iter->next) { - - context = list_entry (iter, struct iter_context, list); -- do_find_destroy(confdb_inst, context->find_handle); -+ (void)do_find_destroy(confdb_inst, context->find_handle); - free(context); - } - } -@@ -137,20 +137,20 @@ - * @{ - */ - --confdb_error_t confdb_initialize ( -+cs_error_t confdb_initialize ( - confdb_handle_t *handle, - confdb_callbacks_t *callbacks) - { -- SaAisErrorT error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - - error = saHandleCreate (&confdb_handle_t_db, sizeof (struct confdb_inst), handle); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_no_destroy; - } - - error = saHandleInstanceGet (&confdb_handle_t_db, *handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_destroy; - } - -@@ -163,7 +163,7 @@ - &confdb_inst->response_fd, - CONFDB_SERVICE); - } -- if (error != SA_AIS_OK) -+ if (error != CS_OK) - goto error_put_destroy; - - memcpy (&confdb_inst->callbacks, callbacks, sizeof (confdb_callbacks_t)); -@@ -175,26 +175,26 @@ - list_init (&confdb_inst->object_iter_head); - list_init (&confdb_inst->key_iter_head); - -- saHandleInstancePut (&confdb_handle_t_db, *handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, *handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - - error_put_destroy: -- saHandleInstancePut (&confdb_handle_t_db, *handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, *handle); - error_destroy: -- saHandleDestroy (&confdb_handle_t_db, *handle); -+ (void)saHandleDestroy (&confdb_handle_t_db, *handle); - error_no_destroy: - return (error); - } - --confdb_error_t confdb_finalize ( -+cs_error_t confdb_finalize ( - confdb_handle_t handle) - { - struct confdb_inst *confdb_inst; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -205,15 +205,15 @@ - */ - if (confdb_inst->finalize) { - pthread_mutex_unlock (&confdb_inst->response_mutex); -- saHandleInstancePut (&confdb_handle_t_db, handle); -- return (CONFDB_ERR_BAD_HANDLE); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); -+ return (CS_ERR_BAD_HANDLE); - } - - confdb_inst->finalize = 1; - - pthread_mutex_unlock (&confdb_inst->response_mutex); - -- saHandleDestroy (&confdb_handle_t_db, handle); -+ (void)saHandleDestroy (&confdb_handle_t_db, handle); - - /* Free saved context handles */ - free_context_list(confdb_inst, &confdb_inst->object_find_head); -@@ -233,80 +233,80 @@ - close(confdb_inst->dispatch_fd); - } - } -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - -- return (CONFDB_OK); -+ return (CS_OK); - } - --confdb_error_t confdb_fd_get ( -+cs_error_t confdb_fd_get ( - confdb_handle_t handle, - int *fd) - { -- SaAisErrorT error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - *fd = confdb_inst->dispatch_fd; - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - --confdb_error_t confdb_context_get ( -+cs_error_t confdb_context_get ( - confdb_handle_t handle, - void **context) - { -- SaAisErrorT error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - *context = confdb_inst->context; - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - --confdb_error_t confdb_context_set ( -+cs_error_t confdb_context_set ( - confdb_handle_t handle, - void *context) - { -- SaAisErrorT error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - confdb_inst->context = context; - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - --struct res_overlay { -+struct confdb_res_overlay { - mar_res_header_t header __attribute__((aligned(8))); - char data[512000]; - }; - --confdb_error_t confdb_dispatch ( -+cs_error_t confdb_dispatch ( - confdb_handle_t handle, -- confdb_dispatch_t dispatch_types) -+ cs_dispatch_flags_t dispatch_types) - { - struct pollfd ufds; - int timeout = -1; -- SaAisErrorT error; -+ cs_error_t error; - int cont = 1; /* always continue do loop except when set to 0 */ - int dispatch_avail; - struct confdb_inst *confdb_inst; -@@ -314,16 +314,15 @@ - struct res_lib_confdb_key_change_callback *res_key_changed_pt; - struct res_lib_confdb_object_create_callback *res_object_created_pt; - struct res_lib_confdb_object_destroy_callback *res_object_destroyed_pt; -- struct res_overlay dispatch_data; -- int ignore_dispatch = 0; -+ struct confdb_res_overlay dispatch_data; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = CONFDB_ERR_NOT_SUPPORTED; -+ error = CS_ERR_NOT_SUPPORTED; - goto error_unlock; - } - -@@ -341,7 +340,7 @@ - ufds.revents = 0; - - error = saPollRetry (&ufds, 1, timeout); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - -@@ -351,7 +350,7 @@ - * Regather poll data in case ufds has changed since taking lock - */ - error = saPollRetry (&ufds, 1, timeout); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - -@@ -359,7 +358,7 @@ - * Handle has been finalized in another thread - */ - if (confdb_inst->finalize == 1) { -- error = CONFDB_OK; -+ error = CS_OK; - pthread_mutex_unlock (&confdb_inst->dispatch_mutex); - goto error_unlock; - } -@@ -380,14 +379,14 @@ - */ - error = saRecvRetry (confdb_inst->dispatch_fd, &dispatch_data.header, - sizeof (mar_res_header_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - if (dispatch_data.header.size > sizeof (mar_res_header_t)) { - error = saRecvRetry (confdb_inst->dispatch_fd, &dispatch_data.data, - dispatch_data.header.size - sizeof (mar_res_header_t)); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - } -@@ -443,7 +442,7 @@ - break; - - default: -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_nounlock; - break; - } -@@ -453,16 +452,9 @@ - * */ - switch (dispatch_types) { - case CONFDB_DISPATCH_ONE: -- if (ignore_dispatch) { -- ignore_dispatch = 0; -- } else { -- cont = 0; -- } -+ cont = 0; - break; - case CONFDB_DISPATCH_ALL: -- if (ignore_dispatch) { -- ignore_dispatch = 0; -- } - break; - case CONFDB_DISPATCH_BLOCKING: - break; -@@ -470,36 +462,36 @@ - } while (cont); - - error_unlock: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - error_nounlock: - return (error); - } - --confdb_error_t confdb_object_create ( -+cs_error_t confdb_object_create ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *object_name, - int object_name_len, - unsigned int *object_handle) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_object_create req_lib_confdb_object_create; - struct res_lib_confdb_object_create res_lib_confdb_object_create; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_object_create(parent_object_handle, - object_name, object_name_len, - object_handle)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -518,7 +510,7 @@ - &res_lib_confdb_object_create, sizeof (struct res_lib_confdb_object_create)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -526,31 +518,31 @@ - *object_handle = res_lib_confdb_object_create.object_handle; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_object_destroy ( -+cs_error_t confdb_object_destroy ( - confdb_handle_t handle, - unsigned int object_handle) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_object_destroy req_lib_confdb_object_destroy; - mar_res_header_t res; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_object_destroy(object_handle)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -567,39 +559,39 @@ - &res, sizeof ( mar_res_header_t)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res.error; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_object_parent_get ( -+cs_error_t confdb_object_parent_get ( - confdb_handle_t handle, - unsigned int object_handle, - unsigned int *parent_object_handle) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_object_parent_get req_lib_confdb_object_parent_get; - struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_object_parent_get(object_handle, parent_object_handle)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -616,7 +608,7 @@ - &res_lib_confdb_object_parent_get, sizeof (struct res_lib_confdb_object_parent_get)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -624,28 +616,28 @@ - *parent_object_handle = res_lib_confdb_object_parent_get.parent_object_handle; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --static confdb_error_t do_find_destroy( -+static cs_error_t do_find_destroy( - struct confdb_inst *confdb_inst, - unsigned int find_handle) - { -- confdb_error_t error; -+ cs_error_t error; - struct iovec iov[2]; - struct req_lib_confdb_object_find_destroy req_lib_confdb_object_find_destroy; - mar_res_header_t res; - - if (!find_handle) -- return SA_AIS_OK; -+ return CS_OK; - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_find_destroy(find_handle)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -662,7 +654,7 @@ - &res, sizeof (mar_res_header_t)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -673,56 +665,56 @@ - return (error); - } - --confdb_error_t confdb_object_find_destroy( -+cs_error_t confdb_object_find_destroy( - confdb_handle_t handle, - unsigned int parent_object_handle) - { - struct iter_context *context; -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - context = find_iter_context(&confdb_inst->object_find_head, parent_object_handle); - error = do_find_destroy(confdb_inst, context->find_handle); -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - list_del(&context->list); - free(context); - } - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - return error; - } - --confdb_error_t confdb_object_iter_destroy( -+cs_error_t confdb_object_iter_destroy( - confdb_handle_t handle, - unsigned int parent_object_handle) - { - struct iter_context *context; -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - context = find_iter_context(&confdb_inst->object_iter_head, parent_object_handle); - error = do_find_destroy(confdb_inst, context->find_handle); -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - list_del(&context->list); - free(context); - } - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - return error; - } - - --confdb_error_t confdb_key_create ( -+cs_error_t confdb_key_create ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -730,24 +722,24 @@ - void *value, - int value_len) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_key_create req_lib_confdb_key_create; - mar_res_header_t res; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_key_create(parent_object_handle, - key_name, key_name_len, - value, value_len)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -768,19 +760,19 @@ - &res, sizeof (res)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res.error; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_key_delete ( -+cs_error_t confdb_key_delete ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -788,24 +780,24 @@ - void *value, - int value_len) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_key_delete req_lib_confdb_key_delete; - mar_res_header_t res; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_key_delete(parent_object_handle, - key_name, key_name_len, - value, value_len)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -826,19 +818,19 @@ - &res, sizeof (res)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res.error; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_key_get ( -+cs_error_t confdb_key_get ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -846,24 +838,24 @@ - void *value, - int *value_len) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_key_get req_lib_confdb_key_get; - struct res_lib_confdb_key_get res_lib_confdb_key_get; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_key_get(parent_object_handle, - key_name, key_name_len, - value, value_len)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -882,47 +874,47 @@ - &res_lib_confdb_key_get, sizeof (struct res_lib_confdb_key_get)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_confdb_key_get.header.error; -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - *value_len = res_lib_confdb_key_get.value.length; - memcpy(value, res_lib_confdb_key_get.value.value, *value_len); - } - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_key_increment ( -+cs_error_t confdb_key_increment ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, - int key_name_len, - unsigned int *value) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_key_get req_lib_confdb_key_get; - struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_key_increment(parent_object_handle, - key_name, key_name_len, - value)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -941,46 +933,46 @@ - &res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_confdb_key_incdec.header.error; -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - *value = res_lib_confdb_key_incdec.value; - } - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_key_decrement ( -+cs_error_t confdb_key_decrement ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, - int key_name_len, - unsigned int *value) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_key_get req_lib_confdb_key_get; - struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_key_decrement(parent_object_handle, - key_name, key_name_len, - value)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -999,22 +991,22 @@ - &res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_confdb_key_incdec.header.error; -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - *value = res_lib_confdb_key_incdec.value; - } - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_key_replace ( -+cs_error_t confdb_key_replace ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -1024,25 +1016,25 @@ - void *new_value, - int new_value_len) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_key_replace req_lib_confdb_key_replace; - mar_res_header_t res; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_key_replace(parent_object_handle, - key_name, key_name_len, - old_value, old_value_len, - new_value, new_value_len)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - req_lib_confdb_key_replace.header.size = sizeof (struct req_lib_confdb_key_replace); -@@ -1064,28 +1056,28 @@ - &res, sizeof (res)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res.error; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_object_iter_start ( -+cs_error_t confdb_object_iter_start ( - confdb_handle_t handle, - unsigned int object_handle) - { - struct confdb_inst *confdb_inst; -- confdb_error_t error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - struct iter_context *context; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -1093,7 +1085,7 @@ - if (!context) { - context = malloc(sizeof(struct iter_context)); - if (!context) { -- error = CONFDB_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - goto ret; - } - context->parent_object_handle = object_handle; -@@ -1103,26 +1095,26 @@ - - /* Start a new find context */ - if (context->find_handle) { -- do_find_destroy(confdb_inst, context->find_handle); -+ (void)do_find_destroy(confdb_inst, context->find_handle); - context->find_handle = 0; - } - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - ret: - return error; - } - --confdb_error_t confdb_key_iter_start ( -+cs_error_t confdb_key_iter_start ( - confdb_handle_t handle, - unsigned int object_handle) - { - struct confdb_inst *confdb_inst; -- confdb_error_t error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - struct iter_context *context; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -1130,7 +1122,7 @@ - if (!context) { - context = malloc(sizeof(struct iter_context)); - if (!context) { -- error = CONFDB_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - goto ret; - } - context->parent_object_handle = object_handle; -@@ -1140,22 +1132,22 @@ - context->find_handle = 0; - context->next_entry = 0; - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - ret: - return error; - } - --confdb_error_t confdb_object_find_start ( -+cs_error_t confdb_object_find_start ( - confdb_handle_t handle, - unsigned int parent_object_handle) - { - struct confdb_inst *confdb_inst; -- confdb_error_t error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - struct iter_context *context; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -1163,7 +1155,7 @@ - if (!context) { - context = malloc(sizeof(struct iter_context)); - if (!context) { -- error = CONFDB_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - goto ret; - } - context->find_handle = 0; -@@ -1172,24 +1164,24 @@ - } - /* Start a new find context */ - if (context->find_handle) { -- do_find_destroy(confdb_inst, context->find_handle); -+ (void)do_find_destroy(confdb_inst, context->find_handle); - context->find_handle = 0; - } - -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - ret: - return error; - } - --confdb_error_t confdb_object_find ( -+cs_error_t confdb_object_find ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *object_name, - int object_name_len, - unsigned int *object_handle) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct iter_context *context; -@@ -1197,26 +1189,26 @@ - struct res_lib_confdb_object_find res_lib_confdb_object_find; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - /* You MUST call confdb_object_find_start first */ - context = find_iter_context(&confdb_inst->object_find_head, parent_object_handle); - if (!context) { -- error = CONFDB_ERR_CONTEXT_NOT_FOUND; -+ error = CS_ERR_CONTEXT_NOT_FOUND; - goto error_exit; - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_object_find(parent_object_handle, - &context->find_handle, - object_handle, - object_name, &object_name_len, - 0)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -1236,7 +1228,7 @@ - &res_lib_confdb_object_find, sizeof (struct res_lib_confdb_object_find)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -1245,20 +1237,20 @@ - context->find_handle = res_lib_confdb_object_find.find_handle; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - - --confdb_error_t confdb_object_iter ( -+cs_error_t confdb_object_iter ( - confdb_handle_t handle, - unsigned int parent_object_handle, - unsigned int *object_handle, - void *object_name, - int *object_name_len) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct iter_context *context; -@@ -1266,19 +1258,19 @@ - struct res_lib_confdb_object_iter res_lib_confdb_object_iter; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - /* You MUST call confdb_object_iter_start first */ - context = find_iter_context(&confdb_inst->object_iter_head, parent_object_handle); - if (!context) { -- error = CONFDB_ERR_CONTEXT_NOT_FOUND; -+ error = CS_ERR_CONTEXT_NOT_FOUND; - goto error_exit; - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - *object_name_len = 0; - if (confdb_sa_object_find(parent_object_handle, -@@ -1286,7 +1278,7 @@ - object_handle, - object_name, object_name_len, - 1)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto sa_exit; - } - -@@ -1304,12 +1296,12 @@ - &res_lib_confdb_object_iter, sizeof (struct res_lib_confdb_object_iter)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_confdb_object_iter.header.error; -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - *object_name_len = res_lib_confdb_object_iter.object_name.length; - memcpy(object_name, res_lib_confdb_object_iter.object_name.value, *object_name_len); - *object_handle = res_lib_confdb_object_iter.object_handle; -@@ -1318,12 +1310,12 @@ - sa_exit: - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_key_iter ( -+cs_error_t confdb_key_iter ( - confdb_handle_t handle, - unsigned int parent_object_handle, - void *key_name, -@@ -1331,7 +1323,7 @@ - void *value, - int *value_len) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct iter_context *context; -@@ -1339,25 +1331,25 @@ - struct res_lib_confdb_key_iter res_lib_confdb_key_iter; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - /* You MUST call confdb_key_iter_start first */ - context = find_iter_context(&confdb_inst->key_iter_head, parent_object_handle); - if (!context) { -- error = CONFDB_ERR_CONTEXT_NOT_FOUND; -+ error = CS_ERR_CONTEXT_NOT_FOUND; - goto error_exit; - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_key_iter(parent_object_handle, - context->next_entry, - key_name, key_name_len, - value, value_len)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto sa_exit; - } - -@@ -1375,12 +1367,12 @@ - &res_lib_confdb_key_iter, sizeof (struct res_lib_confdb_key_iter)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_confdb_key_iter.header.error; -- if (error == SA_AIS_OK) { -+ if (error == CS_OK) { - *key_name_len = res_lib_confdb_key_iter.key_name.length; - memcpy(key_name, res_lib_confdb_key_iter.key_name.value, *key_name_len); - *value_len = res_lib_confdb_key_iter.value.length; -@@ -1391,31 +1383,31 @@ - context->next_entry++; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_write ( -+cs_error_t confdb_write ( - confdb_handle_t handle, - char *error_text) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - mar_req_header_t req; - struct res_lib_confdb_write res_lib_confdb_write; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_write(error_text)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -1431,7 +1423,7 @@ - &res_lib_confdb_write, sizeof ( struct res_lib_confdb_write)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -1440,32 +1432,32 @@ - memcpy(error_text, res_lib_confdb_write.error.value, res_lib_confdb_write.error.length); - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_reload ( -+cs_error_t confdb_reload ( - confdb_handle_t handle, - int flush, - char *error_text) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct res_lib_confdb_reload res_lib_confdb_reload; - struct req_lib_confdb_reload req_lib_confdb_reload; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = SA_AIS_OK; -+ error = CS_OK; - - if (confdb_sa_reload(flush, error_text)) -- error = SA_AIS_ERR_ACCESS; -+ error = CS_ERR_ACCESS; - goto error_exit; - } - -@@ -1483,7 +1475,7 @@ - - pthread_mutex_unlock (&confdb_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -1492,29 +1484,29 @@ - memcpy(error_text, res_lib_confdb_reload.error.value, res_lib_confdb_reload.error.length); - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_track_changes ( -+cs_error_t confdb_track_changes ( - confdb_handle_t handle, - unsigned int object_handle, - unsigned int flags) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - struct req_lib_confdb_object_track_start req; - mar_res_header_t res; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = CONFDB_ERR_NOT_SUPPORTED; -+ error = CS_ERR_NOT_SUPPORTED; - goto error_exit; - } - -@@ -1532,33 +1524,33 @@ - &res, sizeof ( mar_res_header_t)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res.error; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } - --confdb_error_t confdb_stop_track_changes (confdb_handle_t handle) -+cs_error_t confdb_stop_track_changes (confdb_handle_t handle) - { -- confdb_error_t error; -+ cs_error_t error; - struct confdb_inst *confdb_inst; - struct iovec iov[2]; - mar_req_header_t req; - mar_res_header_t res; - - error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - if (confdb_inst->standalone) { -- error = CONFDB_ERR_NOT_SUPPORTED; -+ error = CS_ERR_NOT_SUPPORTED; - goto error_exit; - } - -@@ -1574,14 +1566,14 @@ - &res, sizeof ( mar_res_header_t)); - - pthread_mutex_unlock (&confdb_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res.error; - - error_exit: -- saHandleInstancePut (&confdb_handle_t_db, handle); -+ (void)saHandleInstancePut (&confdb_handle_t_db, handle); - - return (error); - } -diff -Naurd corosync-0.92/lib/cpg.c corosync-trunk/lib/cpg.c ---- corosync-0.92/lib/cpg.c 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/lib/cpg.c 2009-01-08 07:29:16.000000000 +0100 -@@ -45,7 +45,7 @@ - #include - #include - --#include -+#include - #include - #include - #include -@@ -90,27 +90,27 @@ - * @{ - */ - --cpg_error_t cpg_initialize ( -+cs_error_t cpg_initialize ( - cpg_handle_t *handle, - cpg_callbacks_t *callbacks) - { -- SaAisErrorT error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - - error = saHandleCreate (&cpg_handle_t_db, sizeof (struct cpg_inst), handle); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_no_destroy; - } - - error = saHandleInstanceGet (&cpg_handle_t_db, *handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_destroy; - } - - error = saServiceConnect (&cpg_inst->dispatch_fd, - &cpg_inst->response_fd, - CPG_SERVICE); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_put_destroy; - } - -@@ -120,26 +120,26 @@ - - pthread_mutex_init (&cpg_inst->dispatch_mutex, NULL); - -- saHandleInstancePut (&cpg_handle_t_db, *handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, *handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - - error_put_destroy: -- saHandleInstancePut (&cpg_handle_t_db, *handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, *handle); - error_destroy: -- saHandleDestroy (&cpg_handle_t_db, *handle); -+ (void)saHandleDestroy (&cpg_handle_t_db, *handle); - error_no_destroy: - return (error); - } - --cpg_error_t cpg_finalize ( -+cs_error_t cpg_finalize ( - cpg_handle_t handle) - { - struct cpg_inst *cpg_inst; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -150,15 +150,15 @@ - */ - if (cpg_inst->finalize) { - pthread_mutex_unlock (&cpg_inst->response_mutex); -- saHandleInstancePut (&cpg_handle_t_db, handle); -- return (CPG_ERR_BAD_HANDLE); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); -+ return (CS_ERR_BAD_HANDLE); - } - - cpg_inst->finalize = 1; - - pthread_mutex_unlock (&cpg_inst->response_mutex); - -- saHandleDestroy (&cpg_handle_t_db, handle); -+ (void)saHandleDestroy (&cpg_handle_t_db, handle); - - /* - * Disconnect from the server -@@ -171,80 +171,80 @@ - shutdown(cpg_inst->dispatch_fd, 0); - close(cpg_inst->dispatch_fd); - } -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - -- return (CPG_OK); -+ return (CS_OK); - } - --cpg_error_t cpg_fd_get ( -+cs_error_t cpg_fd_get ( - cpg_handle_t handle, - int *fd) - { -- SaAisErrorT error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - *fd = cpg_inst->dispatch_fd; - -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - --cpg_error_t cpg_context_get ( -+cs_error_t cpg_context_get ( - cpg_handle_t handle, - void **context) - { -- SaAisErrorT error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - *context = cpg_inst->context; - -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - --cpg_error_t cpg_context_set ( -+cs_error_t cpg_context_set ( - cpg_handle_t handle, - void *context) - { -- SaAisErrorT error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - cpg_inst->context = context; - -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - --struct res_overlay { -+struct cpg_res_overlay { - mar_res_header_t header __attribute__((aligned(8))); - char data[512000]; - }; - --cpg_error_t cpg_dispatch ( -+cs_error_t cpg_dispatch ( - cpg_handle_t handle, -- cpg_dispatch_t dispatch_types) -+ cs_dispatch_flags_t dispatch_types) - { - struct pollfd ufds; - int timeout = -1; -- SaAisErrorT error; -+ cs_error_t error; - int cont = 1; /* always continue do loop except when set to 0 */ - int dispatch_avail; - struct cpg_inst *cpg_inst; -@@ -253,8 +253,7 @@ - struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback; - struct res_lib_cpg_groups_get_callback *res_lib_cpg_groups_get_callback; - cpg_callbacks_t callbacks; -- struct res_overlay dispatch_data; -- int ignore_dispatch = 0; -+ struct cpg_res_overlay dispatch_data; - struct cpg_address member_list[CPG_MEMBERS_MAX]; - struct cpg_address left_list[CPG_MEMBERS_MAX]; - struct cpg_address joined_list[CPG_MEMBERS_MAX]; -@@ -264,7 +263,7 @@ - unsigned int i; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -272,7 +271,7 @@ - * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and - * wait indefinately for SA_DISPATCH_BLOCKING - */ -- if (dispatch_types == CPG_DISPATCH_ALL) { -+ if (dispatch_types == CS_DISPATCH_ALL) { - timeout = 0; - } - -@@ -282,7 +281,7 @@ - ufds.revents = 0; - - error = saPollRetry (&ufds, 1, timeout); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - -@@ -292,7 +291,7 @@ - * Regather poll data in case ufds has changed since taking lock - */ - error = saPollRetry (&ufds, 1, timeout); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - -@@ -300,13 +299,13 @@ - * Handle has been finalized in another thread - */ - if (cpg_inst->finalize == 1) { -- error = CPG_OK; -+ error = CS_OK; - pthread_mutex_unlock (&cpg_inst->dispatch_mutex); - goto error_unlock; - } - - dispatch_avail = ufds.revents & POLLIN; -- if (dispatch_avail == 0 && dispatch_types == CPG_DISPATCH_ALL) { -+ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { - pthread_mutex_unlock (&cpg_inst->dispatch_mutex); - break; /* exit do while cont is 1 loop */ - } else -@@ -321,14 +320,14 @@ - */ - error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.header, - sizeof (mar_res_header_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - if (dispatch_data.header.size > sizeof (mar_res_header_t)) { - error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.data, - dispatch_data.header.size - sizeof (mar_res_header_t)); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - } -@@ -424,7 +423,7 @@ - break; - - default: -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_nounlock; - break; - } -@@ -433,34 +432,27 @@ - * Determine if more messages should be processed - * */ - switch (dispatch_types) { -- case CPG_DISPATCH_ONE: -- if (ignore_dispatch) { -- ignore_dispatch = 0; -- } else { -- cont = 0; -- } -+ case CS_DISPATCH_ONE: -+ cont = 0; - break; -- case CPG_DISPATCH_ALL: -- if (ignore_dispatch) { -- ignore_dispatch = 0; -- } -+ case CS_DISPATCH_ALL: - break; -- case CPG_DISPATCH_BLOCKING: -+ case CS_DISPATCH_BLOCKING: - break; - } - } while (cont); - - error_unlock: -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - error_nounlock: - return (error); - } - --cpg_error_t cpg_join ( -+cs_error_t cpg_join ( - cpg_handle_t handle, - struct cpg_name *group) - { -- cpg_error_t error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - struct iovec iov[2]; - struct req_lib_cpg_join req_lib_cpg_join; -@@ -469,7 +461,7 @@ - struct res_lib_cpg_trackstart res_lib_cpg_trackstart; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -487,7 +479,7 @@ - error = saSendMsgReceiveReply (cpg_inst->dispatch_fd, iov, 1, - &res_lib_cpg_trackstart, sizeof (struct res_lib_cpg_trackstart)); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - pthread_mutex_unlock (&cpg_inst->response_mutex); - goto error_exit; - } -@@ -507,30 +499,30 @@ - - pthread_mutex_unlock (&cpg_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_cpg_join.header.error; - - error_exit: -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - - return (error); - } - --cpg_error_t cpg_leave ( -+cs_error_t cpg_leave ( - cpg_handle_t handle, - struct cpg_name *group) - { -- cpg_error_t error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - struct iovec iov[2]; - struct req_lib_cpg_leave req_lib_cpg_leave; - struct res_lib_cpg_leave res_lib_cpg_leave; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -549,26 +541,26 @@ - &res_lib_cpg_leave, sizeof (struct res_lib_cpg_leave)); - - pthread_mutex_unlock (&cpg_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_cpg_leave.header.error; - - error_exit: -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - - return (error); - } - --cpg_error_t cpg_mcast_joined ( -+cs_error_t cpg_mcast_joined ( - cpg_handle_t handle, - cpg_guarantee_t guarantee, - struct iovec *iovec, - int iov_len) - { - int i; -- cpg_error_t error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - struct iovec iov[64]; - struct req_lib_cpg_mcast req_lib_cpg_mcast; -@@ -576,7 +568,7 @@ - int msg_len = 0; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -602,7 +594,7 @@ - - pthread_mutex_unlock (&cpg_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -612,85 +604,108 @@ - * Also, don't set to ENABLED if the return value is TRY_AGAIN as this can lead - * to Flow Control State sync issues between AIS LIB and EXEC. - */ -- if (res_lib_cpg_mcast.header.error == CPG_OK) { -+ if (res_lib_cpg_mcast.header.error == CS_OK) { - cpg_inst->flow_control_state = res_lib_cpg_mcast.flow_control_state; - } - error = res_lib_cpg_mcast.header.error; - - error_exit: -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - - return (error); - } - --cpg_error_t cpg_membership_get ( -+cs_error_t cpg_membership_get ( - cpg_handle_t handle, - struct cpg_name *group_name, - struct cpg_address *member_list, - int *member_list_entries) - { -- cpg_error_t error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - struct iovec iov; - struct req_lib_cpg_membership req_lib_cpg_membership_get; -- struct res_lib_cpg_confchg_callback res_lib_cpg_membership_get; -- unsigned int i; -+ struct res_lib_cpg_confchg_callback *res_lib_cpg_membership_get; -+ mar_res_header_t header; -+ unsigned int i, bytesleft; -+ char *buffer = NULL; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -- req_lib_cpg_membership_get.header.size = sizeof (mar_req_header_t); -+ req_lib_cpg_membership_get.header.size = sizeof (req_lib_cpg_membership_get); - req_lib_cpg_membership_get.header.id = MESSAGE_REQ_CPG_MEMBERSHIP; -- marshall_to_mar_cpg_name_t (&req_lib_cpg_membership_get.group_name, -- group_name); - - iov.iov_base = (char *)&req_lib_cpg_membership_get; -- iov.iov_len = sizeof (mar_req_header_t); -+ iov.iov_len = sizeof (req_lib_cpg_membership_get); - - pthread_mutex_lock (&cpg_inst->response_mutex); - - error = saSendMsgReceiveReply (cpg_inst->response_fd, &iov, 1, -- &res_lib_cpg_membership_get, sizeof (mar_res_header_t)); -+ &header, sizeof (header)); -+ if (error != CS_OK) { -+ goto error_exit; -+ } - -- pthread_mutex_unlock (&cpg_inst->response_mutex); -+ buffer = malloc(header.size); -+ if (buffer == NULL) { -+ error = CS_ERR_NO_MEMORY; -+ goto error_exit; -+ } - -- if (error != SA_AIS_OK) { -+ memcpy (buffer, &header, sizeof (header)); -+ bytesleft = header.size - sizeof (header); -+ -+ error = saRecvRetry (cpg_inst->response_fd, -+ buffer + sizeof (header), bytesleft); -+ if (error != CS_OK) { - goto error_exit; - } - -- error = res_lib_cpg_membership_get.header.error; -+ error = header.error; -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ res_lib_cpg_membership_get = (struct res_lib_cpg_confchg_callback *) buffer; - - /* - * Copy results to caller - */ -- *member_list_entries = res_lib_cpg_membership_get.member_list_entries; -+ *member_list_entries = res_lib_cpg_membership_get->member_list_entries; - if (member_list) { -- for (i = 0; i < res_lib_cpg_membership_get.member_list_entries; i++) { -+ for (i = 0; i < res_lib_cpg_membership_get->member_list_entries; i++) { - marshall_from_mar_cpg_address_t (&member_list[i], -- &res_lib_cpg_membership_get.member_list[i]); -+ &res_lib_cpg_membership_get->member_list[i]); - } - } - - error_exit: -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ -+ if (buffer != NULL) -+ free(buffer); -+ -+ pthread_mutex_unlock (&cpg_inst->response_mutex); -+ -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - - return (error); - } - --cpg_error_t cpg_local_get ( -+cs_error_t cpg_local_get ( - cpg_handle_t handle, - unsigned int *local_nodeid) - { -- cpg_error_t error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - struct iovec iov; - struct req_lib_cpg_local_get req_lib_cpg_local_get; - struct res_lib_cpg_local_get res_lib_cpg_local_get; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -707,7 +722,7 @@ - - pthread_mutex_unlock (&cpg_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -716,23 +731,23 @@ - *local_nodeid = res_lib_cpg_local_get.local_nodeid; - - error_exit: -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - - return (error); - } - --cpg_error_t cpg_groups_get ( -+cs_error_t cpg_groups_get ( - cpg_handle_t handle, - unsigned int *num_groups) - { -- cpg_error_t error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - struct iovec iov; - struct req_lib_cpg_groups_get req_lib_cpg_groups_get; - struct res_lib_cpg_groups_get res_lib_cpg_groups_get; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -749,7 +764,7 @@ - - pthread_mutex_unlock (&cpg_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -758,26 +773,26 @@ - - /* Real output is delivered via a callback */ - error_exit: -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - - return (error); - } - --cpg_error_t cpg_flow_control_state_get ( -+cs_error_t cpg_flow_control_state_get ( - cpg_handle_t handle, - cpg_flow_control_state_t *flow_control_state) - { -- cpg_error_t error; -+ cs_error_t error; - struct cpg_inst *cpg_inst; - - error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - *flow_control_state = cpg_inst->flow_control_state; - -- saHandleInstancePut (&cpg_handle_t_db, handle); -+ (void)saHandleInstancePut (&cpg_handle_t_db, handle); - - return (error); - } -diff -Naurd corosync-0.92/lib/evs.c corosync-trunk/lib/evs.c ---- corosync-0.92/lib/evs.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/lib/evs.c 2008-12-28 10:25:17.000000000 +0100 -@@ -48,7 +48,7 @@ - - #include - #include --#include -+#include - #include - #include - #include -@@ -62,7 +62,7 @@ - pthread_mutex_t dispatch_mutex; - }; - --struct res_overlay { -+struct evs_res_overlay { - mar_res_header_t header __attribute__((aligned(8))); - char data[512000]; - }; -@@ -98,29 +98,29 @@ - * test - * @param handle The handle of evs initialize - * @param callbacks The callbacks for evs_initialize -- * @returns EVS_OK -+ * @returns CS_OK - */ --evs_error_t evs_initialize ( -+cs_error_t evs_initialize ( - evs_handle_t *handle, - evs_callbacks_t *callbacks) - { -- SaAisErrorT error; -+ cs_error_t error; - struct evs_inst *evs_inst; - - error = saHandleCreate (&evs_handle_t_db, sizeof (struct evs_inst), handle); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_no_destroy; - } - - error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_destroy; - } - - error = saServiceConnect (&evs_inst->response_fd, - &evs_inst->dispatch_fd, - EVS_SERVICE); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_put_destroy; - } - -@@ -130,26 +130,26 @@ - - pthread_mutex_init (&evs_inst->dispatch_mutex, NULL); - -- saHandleInstancePut (&evs_handle_t_db, *handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, *handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - - error_put_destroy: -- saHandleInstancePut (&evs_handle_t_db, *handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, *handle); - error_destroy: -- saHandleDestroy (&evs_handle_t_db, *handle); -+ (void)saHandleDestroy (&evs_handle_t_db, *handle); - error_no_destroy: - return (error); - } - --evs_error_t evs_finalize ( -+cs_error_t evs_finalize ( - evs_handle_t handle) - { - struct evs_inst *evs_inst; -- SaAisErrorT error; -+ cs_error_t error; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - // TODO is the locking right here -@@ -160,15 +160,15 @@ - */ - if (evs_inst->finalize) { - pthread_mutex_unlock (&evs_inst->response_mutex); -- saHandleInstancePut (&evs_handle_t_db, handle); -- return (EVS_ERR_BAD_HANDLE); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); -+ return (CS_ERR_BAD_HANDLE); - } - - evs_inst->finalize = 1; - - pthread_mutex_unlock (&evs_inst->response_mutex); - -- saHandleDestroy (&evs_handle_t_db, handle); -+ (void)saHandleDestroy (&evs_handle_t_db, handle); - /* - * Disconnect from the server - */ -@@ -180,49 +180,48 @@ - shutdown(evs_inst->dispatch_fd, 0); - close(evs_inst->dispatch_fd); - } -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - - -- return (EVS_OK); -+ return (CS_OK); - } - --evs_error_t evs_fd_get ( -+cs_error_t evs_fd_get ( - evs_handle_t handle, - int *fd) - { -- SaAisErrorT error; -+ cs_error_t error; - struct evs_inst *evs_inst; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - - *fd = evs_inst->dispatch_fd; - -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - --evs_error_t evs_dispatch ( -+cs_error_t evs_dispatch ( - evs_handle_t handle, -- evs_dispatch_t dispatch_types) -+ cs_dispatch_flags_t dispatch_types) - { - struct pollfd ufds; - int timeout = -1; -- SaAisErrorT error; -+ cs_error_t error; - int cont = 1; /* always continue do loop except when set to 0 */ - int dispatch_avail; - struct evs_inst *evs_inst; - struct res_evs_confchg_callback *res_evs_confchg_callback; - struct res_evs_deliver_callback *res_evs_deliver_callback; - evs_callbacks_t callbacks; -- struct res_overlay dispatch_data; -- int ignore_dispatch = 0; -+ struct evs_res_overlay dispatch_data; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -230,7 +229,7 @@ - * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and - * wait indefinately for SA_DISPATCH_BLOCKING - */ -- if (dispatch_types == EVS_DISPATCH_ALL) { -+ if (dispatch_types == CS_DISPATCH_ALL) { - timeout = 0; - } - -@@ -240,7 +239,7 @@ - ufds.revents = 0; - - error = saPollRetry (&ufds, 1, timeout); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - -@@ -250,7 +249,7 @@ - * Regather poll data in case ufds has changed since taking lock - */ - error = saPollRetry (&ufds, 1, 0); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_nounlock; - } - -@@ -258,13 +257,13 @@ - * Handle has been finalized in another thread - */ - if (evs_inst->finalize == 1) { -- error = EVS_OK; -+ error = CS_OK; - pthread_mutex_unlock (&evs_inst->dispatch_mutex); - goto error_unlock; - } - - dispatch_avail = ufds.revents & POLLIN; -- if (dispatch_avail == 0 && dispatch_types == EVS_DISPATCH_ALL) { -+ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { - pthread_mutex_unlock (&evs_inst->dispatch_mutex); - break; /* exit do while cont is 1 loop */ - } else -@@ -279,14 +278,14 @@ - */ - error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.header, - sizeof (mar_res_header_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - if (dispatch_data.header.size > sizeof (mar_res_header_t)) { - error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.data, - dispatch_data.header.size - sizeof (mar_res_header_t)); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_unlock; - } - } -@@ -327,7 +326,7 @@ - break; - - default: -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_nounlock; - break; - } -@@ -336,42 +335,35 @@ - * Determine if more messages should be processed - * */ - switch (dispatch_types) { -- case EVS_DISPATCH_ONE: -- if (ignore_dispatch) { -- ignore_dispatch = 0; -- } else { -- cont = 0; -- } -+ case CS_DISPATCH_ONE: -+ cont = 0; - break; -- case EVS_DISPATCH_ALL: -- if (ignore_dispatch) { -- ignore_dispatch = 0; -- } -+ case CS_DISPATCH_ALL: - break; -- case EVS_DISPATCH_BLOCKING: -+ case CS_DISPATCH_BLOCKING: - break; - } - } while (cont); - - error_unlock: -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - error_nounlock: - return (error); - } - --evs_error_t evs_join ( -+cs_error_t evs_join ( - evs_handle_t handle, - struct evs_group *groups, - int group_entries) - { -- evs_error_t error; -+ cs_error_t error; - struct evs_inst *evs_inst; - struct iovec iov[2]; - struct req_lib_evs_join req_lib_evs_join; - struct res_lib_evs_join res_lib_evs_join; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -392,31 +384,31 @@ - - pthread_mutex_unlock (&evs_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_evs_join.header.error; - - error_exit: -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - - return (error); - } - --evs_error_t evs_leave ( -+cs_error_t evs_leave ( - evs_handle_t handle, - struct evs_group *groups, - int group_entries) - { -- evs_error_t error; -+ cs_error_t error; - struct evs_inst *evs_inst; - struct iovec iov[2]; - struct req_lib_evs_leave req_lib_evs_leave; - struct res_lib_evs_leave res_lib_evs_leave; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -437,26 +429,26 @@ - - pthread_mutex_unlock (&evs_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_evs_leave.header.error; - - error_exit: -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - - return (error); - } - --evs_error_t evs_mcast_joined ( -+cs_error_t evs_mcast_joined ( - evs_handle_t handle, - evs_guarantee_t guarantee, - struct iovec *iovec, - int iov_len) - { - int i; -- evs_error_t error; -+ cs_error_t error; - struct evs_inst *evs_inst; - struct iovec iov[64]; - struct req_lib_evs_mcast_joined req_lib_evs_mcast_joined; -@@ -464,7 +456,7 @@ - int msg_len = 0; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -490,19 +482,19 @@ - - pthread_mutex_unlock (&evs_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_evs_mcast_joined.header.error; - - error_exit: -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - - return (error); - } - --evs_error_t evs_mcast_groups ( -+cs_error_t evs_mcast_groups ( - evs_handle_t handle, - evs_guarantee_t guarantee, - struct evs_group *groups, -@@ -511,7 +503,7 @@ - int iov_len) - { - int i; -- evs_error_t error; -+ cs_error_t error; - struct evs_inst *evs_inst; - struct iovec iov[64]; - struct req_lib_evs_mcast_groups req_lib_evs_mcast_groups; -@@ -519,7 +511,7 @@ - int msg_len = 0; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - for (i = 0; i < iov_len; i++) { -@@ -544,32 +536,32 @@ - &res_lib_evs_mcast_groups, sizeof (struct res_lib_evs_mcast_groups)); - - pthread_mutex_unlock (&evs_inst->response_mutex); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = res_lib_evs_mcast_groups.header.error; - - error_exit: -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - - return (error); - } - --evs_error_t evs_membership_get ( -+cs_error_t evs_membership_get ( - evs_handle_t handle, - unsigned int *local_nodeid, - unsigned int *member_list, - unsigned int *member_list_entries) - { -- evs_error_t error; -+ cs_error_t error; - struct evs_inst *evs_inst; - struct iovec iov; - struct req_lib_evs_membership_get req_lib_evs_membership_get; - struct res_lib_evs_membership_get res_lib_evs_membership_get; - - error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - return (error); - } - -@@ -586,7 +578,7 @@ - - pthread_mutex_unlock (&evs_inst->response_mutex); - -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -606,7 +598,7 @@ - } - - error_exit: -- saHandleInstancePut (&evs_handle_t_db, handle); -+ (void)saHandleInstancePut (&evs_handle_t_db, handle); - - return (error); - } -diff -Naurd corosync-0.92/lib/libpload.versions corosync-trunk/lib/libpload.versions ---- corosync-0.92/lib/libpload.versions 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/libpload.versions 2008-10-30 23:41:34.000000000 +0100 -@@ -0,0 +1,21 @@ -+# Version and symbol export for libSaClm.so -+ -+COROSYNC_PLOAD_1.0 { -+ global: -+ pload_start; -+ -+ local: -+ saHandleCreate; -+ saHandleDestroy; -+ saHandleInstanceGet; -+ saHandleInstancePut; -+ saRecvRetry; -+ saSelectRetry; -+ saSendMsgReceiveReply; -+ saSendMsgRetry; -+ saSendReceiveReply; -+ saSendRetry; -+ saServiceConnect; -+ saVersionVerify; -+ clustTimeNow; -+}; -diff -Naurd corosync-0.92/lib/libquorum.versions corosync-trunk/lib/libquorum.versions ---- corosync-0.92/lib/libquorum.versions 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/libquorum.versions 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,50 @@ -+# Version and symbol export for libquorum.so -+ -+OPENAIS_QUORUM_1.0 { -+ global: -+ quorum_initialize; -+ quorum_finalize; -+ quorum_getquorate; -+ quorum_initialize; -+ quorum_finalize; -+ quorum_dispatch; -+ -+ local: -+ saHandleCreate; -+ saHandleDestroy; -+ saHandleInstanceGet; -+ saHandleInstancePut; -+ saRecvRetry; -+ saSelectRetry; -+ saSendMsgReceiveReply; -+ saSendMsgRetry; -+ saSendReceiveReply; -+ saSendRetry; -+ saServiceConnect; -+ saVersionVerify; -+ clustTimeNow; -+}; -+# Version and symbol export for libquorum.so -+ -+COROSYNC_QUORUM_1.0 { -+ global: -+ quorum_initialize; -+ quorum_finalize; -+ quorum_getquorate; -+ quorum_dispatch; -+ -+ local: -+ saHandleCreate; -+ saHandleDestroy; -+ saHandleInstanceGet; -+ saHandleInstancePut; -+ saRecvRetry; -+ saSelectRetry; -+ saSendMsgReceiveReply; -+ saSendMsgRetry; -+ saSendReceiveReply; -+ saSendRetry; -+ saServiceConnect; -+ saVersionVerify; -+ clustTimeNow; -+}; -diff -Naurd corosync-0.92/lib/libvotequorum.versions corosync-trunk/lib/libvotequorum.versions ---- corosync-0.92/lib/libvotequorum.versions 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/libvotequorum.versions 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,71 @@ -+# Version and symbol export for libvotequorum.so -+ -+OPENAIS_VOTEQUORUM_1.0 { -+ global: -+ votequorum_initialize; -+ votequorum_finalize; -+ votequorum_getinfo; -+ votequorum_setexpected; -+ votequorum_setvotes; -+ votequorum_qdisk_register; -+ votequorum_qdisk_unregister; -+ votequorum_qdisk_poll; -+ votequorum_qdisk_getinfo; -+ votequorum_setstate; -+ votequorum_leaving; -+ votequorum_trackstart; -+ votequorum_trackstop; -+ votequorum_context_get; -+ votequorum_context_set; -+ -+ local: -+ saHandleCreate; -+ saHandleDestroy; -+ saHandleInstanceGet; -+ saHandleInstancePut; -+ saRecvRetry; -+ saSelectRetry; -+ saSendMsgReceiveReply; -+ saSendMsgRetry; -+ saSendReceiveReply; -+ saSendRetry; -+ saServiceConnect; -+ saVersionVerify; -+ clustTimeNow; -+}; -+# Version and symbol export for libvotequorum.so -+ -+COROSYNC_VOTEQUORUM_1.0 { -+ global: -+ votequorum_initialize; -+ votequorum_finalize; -+ votequorum_getinfo; -+ votequorum_setexpected; -+ votequorum_setvotes; -+ votequorum_qdisk_register; -+ votequorum_qdisk_unregister; -+ votequorum_qdisk_poll; -+ votequorum_qdisk_getinfo; -+ votequorum_setdirty; -+ votequorum_killnode; -+ votequorum_leaving; -+ votequorum_trackstart; -+ votequorum_trackstop; -+ votequorum_context_get; -+ votequorum_context_set; -+ -+ local: -+ saHandleCreate; -+ saHandleDestroy; -+ saHandleInstanceGet; -+ saHandleInstancePut; -+ saRecvRetry; -+ saSelectRetry; -+ saSendMsgReceiveReply; -+ saSendMsgRetry; -+ saSendReceiveReply; -+ saSendRetry; -+ saServiceConnect; -+ saVersionVerify; -+ clustTimeNow; -+}; -diff -Naurd corosync-0.92/lib/Makefile corosync-trunk/lib/Makefile ---- corosync-0.92/lib/Makefile 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lib/Makefile 2009-01-26 11:46:08.000000000 +0100 -@@ -41,7 +41,10 @@ - libconfdb.a libconfdb.so.2.0.0 \ - libevs.a libevs.so.2.0.0 \ - libcfg.a libcfg.so.2.0.0 \ -- libcoroutil.a libcoroutil.so.2.0.0 -+ libquorum.a libquorum.so.2.0.0 \ -+ libpload.a libpload.so.2.0.0 \ -+ libcoroutil.a libcoroutil.so.2.0.0 \ -+ libvotequorum.a libvotequorum.so.2.0.0 - - libcoroutil.a: util.o - $(AR) -rc libcoroutil.a util.o -@@ -58,14 +61,20 @@ - libcpg.so.2.0.0: util.o cpg.o - $(CC) $(DARWIN_OPTS) util.o cpg.o -o $@ - -+libquorum.so.2.0.0: util.o quorum.o -+ $(CC) $(DARWIN_OPTS) util.o quorum.o -o $@ -+ -+libvotequorum.so.2.0.0: util.o votequorum.o -+ $(CC) $(DARWIN_OPTS) util.o votequorum.o -o $@ -+ - libconfdb.so.2.0.0: util.o confdb.o sa-confdb.o - $(CC) $(LDFLAGS) $(DARWIN_OPTS) util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ - - libcfg.so.2.0.0: util.o cfg.o - $(CC) $(DARWIN_OPTS) util.o cfg.o -o $@ - --libcpg.so.2.0.0: util.o cpg.o -- $(CC) $(DARWIN_OPTS) util.o cpg.o -o $@ -+libpload.so.2.0.0: util.o pload.o -+ $(CC) $(DARWIN_OPTS) util.o pload.o -o $@ - - else - -@@ -78,12 +87,21 @@ - libcpg.so.2.0.0: util.o cpg.o - $(CC) -shared -Wl,-soname,libcpg.so.2,-version-script=$(srcdir)$(subdir)libcpg.versions util.o cpg.o -o $@ - -+libquorum.so.2.0.0: util.o quorum.o -+ $(CC) -shared -Wl,-soname,libquorum.so.2,-version-script=$(srcdir)$(subdir)libquorum.versions util.o quorum.o -o $@ -+ -+libvotequorum.so.2.0.0: util.o votequorum.o -+ $(CC) -shared -Wl,-soname,libvotequorum.so.2,-version-script=$(srcdir)$(subdir)libvotequorum.versions util.o votequorum.o -o $@ -+ - libconfdb.so.2.0.0: util.o confdb.o sa-confdb.o - $(CC) $(LDFLAGS) -shared -Wl,-soname,libconfdb.so.2,-version-script=$(srcdir)$(subdir)libconfdb.versions util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ - - libcfg.so.2.0.0: util.o cfg.o - $(CC) -shared -Wl,-soname,libcfg.so.2,-version-script=$(srcdir)$(subdir)libcfg.versions util.o cfg.o -o $@ - -+libpload.so.2.0.0: util.o pload.o -+ $(CC) -shared -Wl,-soname,libpload.so.2,-version-script=$(srcdir)$(subdir)libpload.versions util.o cfg.o -o $@ -+ - endif - - libevs.a: util.o evs.o -@@ -92,17 +110,27 @@ - libcpg.a: util.o cpg.o - $(AR) -rc libcpg.a util.o cpg.o - -+libquorum.a: util.o quorum.o -+ $(AR) -rc libquorum.a util.o quorum.o -+ -+libvotequorum.a: util.o votequorum.o -+ $(AR) -rc libvotequorum.a util.o votequorum.o -+ - libconfdb.a: util.o confdb.o sa-confdb.o - $(AR) -rc libconfdb.a util.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o - - libcfg.a: util.o cfg.o - $(AR) -rc libcfg.a util.o cfg.o - -+libpload.a: util.o pload.o -+ $(AR) -rc libpload.a util.o pload.o -+ - clean: -- rm -f *.o libcfg.so* libcoroutil.so* libcoroutil.a \ -- libevs.so* libevs.a libcpg.so* libcpg.a libcfg.a libconfdb.so* \ -- libconfdb.a libconfdb.a \ *.da *.bb *.bbg -+ rm -f *.o *.a *.so* *.da *.bb *.bbg - -+lint: -+ -splint $(LINT_FLAGS) $(CFLAGS) *.c -+ - # -fPIC rules required for all libraries - %.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $< -diff -Naurd corosync-0.92/lib/pload.c corosync-trunk/lib/pload.c ---- corosync-0.92/lib/pload.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/pload.c 2008-11-11 18:25:22.000000000 +0100 -@@ -0,0 +1,238 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: 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. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static void pload_instance_destructor (void *instance); -+ -+struct pload_inst { -+ int dispatch_fd; -+ int response_fd; -+ pthread_mutex_t response_mutex; -+ pthread_mutex_t dispatch_mutex; -+ unsigned int finalize; -+}; -+ -+static struct saHandleDatabase pload_handle_t_db = { -+ .handleCount = 0, -+ .handles = 0, -+ .mutex = PTHREAD_MUTEX_INITIALIZER, -+ .handleInstanceDestructor = pload_instance_destructor -+}; -+ -+/* -+ * Clean up function for an evt instance (saEvtInitialize) handle -+ */ -+static void pload_instance_destructor (void *instance) -+{ -+ struct pload_inst *pload_inst = instance; -+ -+ pthread_mutex_destroy (&pload_inst->response_mutex); -+ pthread_mutex_destroy (&pload_inst->dispatch_mutex); -+} -+ -+ -+/** -+ * @defgroup pload_corosync The extended virtual synchrony passthrough API -+ * @ingroup corosync -+ * -+ * @{ -+ */ -+/** -+ * test -+ * @param handle The handle of pload initialize -+ * @param callbacks The callbacks for pload_initialize -+ * @returns PLOAD_OK -+ */ -+unsigned int pload_initialize ( -+ pload_handle_t *handle, -+ pload_callbacks_t *callbacks) -+{ -+ cs_error_t error; -+ struct pload_inst *pload_inst; -+ -+ error = saHandleCreate (&pload_handle_t_db, sizeof (struct pload_inst), handle); -+ if (error != CS_OK) { -+ goto error_no_destroy; -+ } -+ -+ error = saHandleInstanceGet (&pload_handle_t_db, *handle, (void *)&pload_inst); -+ if (error != CS_OK) { -+ goto error_destroy; -+ } -+ -+ error = saServiceConnect (&pload_inst->response_fd, -+ &pload_inst->dispatch_fd, -+ PLOAD_SERVICE); -+ if (error != CS_OK) { -+ goto error_put_destroy; -+ } -+ -+ pthread_mutex_init (&pload_inst->response_mutex, NULL); -+ -+ pthread_mutex_init (&pload_inst->dispatch_mutex, NULL); -+ -+ (void)saHandleInstancePut (&pload_handle_t_db, *handle); -+ -+ return (CS_OK); -+ -+error_put_destroy: -+ (void)saHandleInstancePut (&pload_handle_t_db, *handle); -+error_destroy: -+ (void)saHandleDestroy (&pload_handle_t_db, *handle); -+error_no_destroy: -+ return (error); -+} -+ -+unsigned int pload_finalize ( -+ pload_handle_t handle) -+{ -+ struct pload_inst *pload_inst; -+ cs_error_t error; -+ -+ error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+// TODO is the locking right here -+ pthread_mutex_lock (&pload_inst->response_mutex); -+ -+ /* -+ * Another thread has already started finalizing -+ */ -+ if (pload_inst->finalize) { -+ pthread_mutex_unlock (&pload_inst->response_mutex); -+ (void)saHandleInstancePut (&pload_handle_t_db, handle); -+ return (PLOAD_ERR_BAD_HANDLE); -+ } -+ -+ pload_inst->finalize = 1; -+ -+ pthread_mutex_unlock (&pload_inst->response_mutex); -+ -+ (void)saHandleDestroy (&pload_handle_t_db, handle); -+ /* -+ * Disconnect from the server -+ */ -+ if (pload_inst->response_fd != -1) { -+ shutdown(pload_inst->response_fd, 0); -+ close(pload_inst->response_fd); -+ } -+ if (pload_inst->dispatch_fd != -1) { -+ shutdown(pload_inst->dispatch_fd, 0); -+ close(pload_inst->dispatch_fd); -+ } -+ (void)saHandleInstancePut (&pload_handle_t_db, handle); -+ -+ -+ return (PLOAD_OK); -+} -+ -+unsigned int pload_fd_get ( -+ pload_handle_t handle, -+ int *fd) -+{ -+ cs_error_t error; -+ struct pload_inst *pload_inst; -+ -+ error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ *fd = pload_inst->dispatch_fd; -+ -+ (void)saHandleInstancePut (&pload_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+unsigned int pload_start ( -+ pload_handle_t handle, -+ unsigned int code, -+ unsigned int msg_count, -+ unsigned int msg_size) -+{ -+ unsigned int error; -+ struct pload_inst *pload_inst; -+ struct iovec iov; -+ struct req_lib_pload_start req_lib_pload_start; -+ struct res_lib_pload_start res_lib_pload_start; -+ -+ error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ req_lib_pload_start.header.size = sizeof (struct req_lib_pload_start); -+ req_lib_pload_start.header.id = MESSAGE_REQ_PLOAD_START; -+ req_lib_pload_start.msg_code = code; -+ req_lib_pload_start.msg_count = msg_count; -+ req_lib_pload_start.msg_size = msg_size; -+ -+ iov.iov_base = (char *)&req_lib_pload_start; -+ iov.iov_len = sizeof (struct req_lib_pload_start); -+ -+ pthread_mutex_lock (&pload_inst->response_mutex); -+ -+ error = saSendMsgReceiveReply (pload_inst->response_fd, &iov, 1, -+ &res_lib_pload_start, sizeof (struct res_lib_pload_start)); -+ -+ pthread_mutex_unlock (&pload_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_pload_start.header.error; -+ -+error_exit: -+ (void)saHandleInstancePut (&pload_handle_t_db, handle); -+ -+ return (error); -+} -+ -+/** @} */ -diff -Naurd corosync-0.92/lib/quorum.c corosync-trunk/lib/quorum.c ---- corosync-0.92/lib/quorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/quorum.c 2008-11-11 18:26:58.000000000 +0100 -@@ -0,0 +1,493 @@ -+/* -+ * Copyright (c) 2008 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 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. -+ */ -+/* -+ * Provides a quorum API using the corosync executive -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include "corosync/quorum.h" -+#include "corosync/ipc_quorum.h" -+ -+struct quorum_inst { -+ int response_fd; -+ int dispatch_fd; -+ int finalize; -+ void *context; -+ quorum_callbacks_t callbacks; -+ pthread_mutex_t response_mutex; -+ pthread_mutex_t dispatch_mutex; -+}; -+ -+static void quorum_instance_destructor (void *instance); -+ -+static struct saHandleDatabase quorum_handle_t_db = { -+ .handleCount = 0, -+ .handles = 0, -+ .mutex = PTHREAD_MUTEX_INITIALIZER, -+ .handleInstanceDestructor = quorum_instance_destructor -+}; -+ -+/* -+ * Clean up function for a quorum instance (quorum_initialize) handle -+ */ -+static void quorum_instance_destructor (void *instance) -+{ -+ struct quorum_inst *quorum_inst = instance; -+ -+ pthread_mutex_destroy (&quorum_inst->response_mutex); -+} -+ -+cs_error_t quorum_initialize ( -+ quorum_handle_t *handle, -+ quorum_callbacks_t *callbacks) -+{ -+ cs_error_t error; -+ struct quorum_inst *quorum_inst; -+ -+ error = saHandleCreate (&quorum_handle_t_db, sizeof (struct quorum_inst), handle); -+ if (error != CS_OK) { -+ goto error_no_destroy; -+ } -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, *handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ goto error_destroy; -+ } -+ -+ error = saServiceConnect (&quorum_inst->dispatch_fd, -+ &quorum_inst->response_fd, -+ QUORUM_SERVICE); -+ if (error != CS_OK) { -+ goto error_put_destroy; -+ } -+ -+ pthread_mutex_init (&quorum_inst->response_mutex, NULL); -+ pthread_mutex_init (&quorum_inst->dispatch_mutex, NULL); -+ if (callbacks) -+ memcpy(&quorum_inst->callbacks, callbacks, sizeof (callbacks)); -+ else -+ memset(&quorum_inst->callbacks, 0, sizeof (callbacks)); -+ -+ (void)saHandleInstancePut (&quorum_handle_t_db, *handle); -+ -+ return (CS_OK); -+ -+error_put_destroy: -+ (void)saHandleInstancePut (&quorum_handle_t_db, *handle); -+error_destroy: -+ (void)saHandleDestroy (&quorum_handle_t_db, *handle); -+error_no_destroy: -+ return (error); -+} -+ -+cs_error_t quorum_finalize ( -+ quorum_handle_t handle) -+{ -+ struct quorum_inst *quorum_inst; -+ cs_error_t error; -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&quorum_inst->response_mutex); -+ -+ /* -+ * Another thread has already started finalizing -+ */ -+ if (quorum_inst->finalize) { -+ pthread_mutex_unlock (&quorum_inst->response_mutex); -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ return (CS_ERR_BAD_HANDLE); -+ } -+ -+ quorum_inst->finalize = 1; -+ -+ pthread_mutex_unlock (&quorum_inst->response_mutex); -+ -+ (void)saHandleDestroy (&quorum_handle_t_db, handle); -+ -+ /* -+ * Disconnect from the server -+ */ -+ if (quorum_inst->response_fd != -1) { -+ shutdown(quorum_inst->response_fd, 0); -+ close(quorum_inst->response_fd); -+ } -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+cs_error_t quorum_getquorate ( -+ quorum_handle_t handle, -+ int *quorate) -+{ -+ cs_error_t error; -+ struct quorum_inst *quorum_inst; -+ struct iovec iov[2]; -+ mar_req_header_t req; -+ struct res_lib_quorum_getquorate res_lib_quorum_getquorate; -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&quorum_inst->response_mutex); -+ -+ req.size = sizeof (req); -+ req.id = MESSAGE_REQ_QUORUM_GETQUORATE; -+ -+ iov[0].iov_base = (char *)&req; -+ iov[0].iov_len = sizeof (req); -+ -+ error = saSendMsgReceiveReply (quorum_inst->response_fd, iov, 1, -+ &res_lib_quorum_getquorate, sizeof (struct res_lib_quorum_getquorate)); -+ -+ pthread_mutex_unlock (&quorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_quorum_getquorate.header.error; -+ -+ *quorate = res_lib_quorum_getquorate.quorate; -+ -+error_exit: -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t quorum_fd_get ( -+ quorum_handle_t handle, -+ int *fd) -+{ -+ cs_error_t error; -+ struct quorum_inst *quorum_inst; -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ *fd = quorum_inst->dispatch_fd; -+ -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+ -+cs_error_t quorum_context_get ( -+ quorum_handle_t handle, -+ void **context) -+{ -+ cs_error_t error; -+ struct quorum_inst *quorum_inst; -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ *context = quorum_inst->context; -+ -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+cs_error_t quorum_context_set ( -+ quorum_handle_t handle, -+ void *context) -+{ -+ cs_error_t error; -+ struct quorum_inst *quorum_inst; -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ quorum_inst->context = context; -+ -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+ -+cs_error_t quorum_trackstart ( -+ quorum_handle_t handle, -+ unsigned int flags ) -+{ -+ cs_error_t error; -+ struct quorum_inst *quorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_quorum_trackstart req_lib_quorum_trackstart; -+ mar_res_header_t res; -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&quorum_inst->response_mutex); -+ -+ req_lib_quorum_trackstart.header.size = sizeof (struct req_lib_quorum_trackstart); -+ req_lib_quorum_trackstart.header.id = MESSAGE_REQ_QUORUM_TRACKSTART; -+ req_lib_quorum_trackstart.track_flags = flags; -+ -+ iov[0].iov_base = (char *)&req_lib_quorum_trackstart; -+ iov[0].iov_len = sizeof (struct req_lib_quorum_trackstart); -+ -+ error = saSendMsgReceiveReply (quorum_inst->response_fd, iov, 1, -+ &res, sizeof (res)); -+ -+ pthread_mutex_unlock (&quorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res.error; -+ -+error_exit: -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t quorum_trackstop ( -+ quorum_handle_t handle) -+{ -+ cs_error_t error; -+ struct quorum_inst *quorum_inst; -+ struct iovec iov[2]; -+ mar_req_header_t req; -+ mar_res_header_t res; -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&quorum_inst->response_mutex); -+ -+ req.size = sizeof (req); -+ req.id = MESSAGE_REQ_QUORUM_TRACKSTOP; -+ -+ iov[0].iov_base = (char *)&req; -+ iov[0].iov_len = sizeof (req); -+ -+ error = saSendMsgReceiveReply (quorum_inst->response_fd, iov, 1, -+ &res, sizeof (res)); -+ -+ pthread_mutex_unlock (&quorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res.error; -+ -+error_exit: -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+struct quorum_res_overlay { -+ mar_res_header_t header __attribute__((aligned(8))); -+ char data[512000]; -+}; -+ -+cs_error_t quorum_dispatch ( -+ quorum_handle_t handle, -+ cs_dispatch_flags_t dispatch_types) -+{ -+ struct pollfd ufds; -+ int timeout = -1; -+ cs_error_t error; -+ int cont = 1; /* always continue do loop except when set to 0 */ -+ int dispatch_avail; -+ struct quorum_inst *quorum_inst; -+ quorum_callbacks_t callbacks; -+ struct quorum_res_overlay dispatch_data; -+ struct res_lib_quorum_notification *res_lib_quorum_notification; -+ -+ if (dispatch_types != CS_DISPATCH_ONE && -+ dispatch_types != CS_DISPATCH_ALL && -+ dispatch_types != CS_DISPATCH_BLOCKING) { -+ -+ return (CS_ERR_INVALID_PARAM); -+ } -+ -+ error = saHandleInstanceGet (&quorum_handle_t_db, handle, -+ (void *)&quorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ /* -+ * Timeout instantly for CS_DISPATCH_ONE or SA_DISPATCH_ALL and -+ * wait indefinately for CS_DISPATCH_BLOCKING -+ */ -+ if (dispatch_types == CS_DISPATCH_ALL) { -+ timeout = 0; -+ } -+ -+ do { -+ ufds.fd = quorum_inst->dispatch_fd; -+ ufds.events = POLLIN; -+ ufds.revents = 0; -+ -+ pthread_mutex_lock (&quorum_inst->dispatch_mutex); -+ -+ error = saPollRetry (&ufds, 1, timeout); -+ if (error != CS_OK) { -+ goto error_unlock; -+ } -+ -+ /* -+ * Handle has been finalized in another thread -+ */ -+ if (quorum_inst->finalize == 1) { -+ error = CS_OK; -+ goto error_unlock; -+ } -+ -+ if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) { -+ error = CS_ERR_BAD_HANDLE; -+ goto error_unlock; -+ } -+ -+ dispatch_avail = ufds.revents & POLLIN; -+ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { -+ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); -+ break; /* exit do while cont is 1 loop */ -+ } else -+ if (dispatch_avail == 0) { -+ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); -+ continue; /* next poll */ -+ } -+ -+ if (ufds.revents & POLLIN) { -+ error = saRecvRetry (quorum_inst->dispatch_fd, &dispatch_data.header, -+ sizeof (mar_res_header_t)); -+ if (error != CS_OK) { -+ goto error_unlock; -+ } -+ if (dispatch_data.header.size > sizeof (mar_res_header_t)) { -+ error = saRecvRetry (quorum_inst->dispatch_fd, &dispatch_data.data, -+ dispatch_data.header.size - sizeof (mar_res_header_t)); -+ if (error != CS_OK) { -+ goto error_unlock; -+ } -+ } -+ } else { -+ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); -+ continue; -+ } -+ -+ /* -+ * Make copy of callbacks, message data, unlock instance, and call callback -+ * A risk of this dispatch method is that the callback routines may -+ * operate at the same time that quorum_finalize has been called in another thread. -+ */ -+ memcpy (&callbacks, &quorum_inst->callbacks, sizeof (quorum_callbacks_t)); -+ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); -+ -+ /* -+ * Dispatch incoming message -+ */ -+ switch (dispatch_data.header.id) { -+ -+ case MESSAGE_RES_QUORUM_NOTIFICATION: -+ if (callbacks.quorum_notify_fn == NULL) { -+ continue; -+ } -+ res_lib_quorum_notification = (struct res_lib_quorum_notification *)&dispatch_data; -+ -+ callbacks.quorum_notify_fn ( handle, -+ res_lib_quorum_notification->quorate, -+ res_lib_quorum_notification->ring_seq, -+ res_lib_quorum_notification->view_list_entries, -+ res_lib_quorum_notification->view_list); -+ break; -+ -+ default: -+ error = CS_ERR_LIBRARY; -+ goto error_put; -+ break; -+ } -+ -+ /* -+ * Determine if more messages should be processed -+ * */ -+ switch (dispatch_types) { -+ case CS_DISPATCH_ONE: -+ cont = 0; -+ break; -+ case CS_DISPATCH_ALL: -+ break; -+ case CS_DISPATCH_BLOCKING: -+ break; -+ } -+ } while (cont); -+ -+ goto error_put; -+ -+error_unlock: -+ pthread_mutex_unlock (&quorum_inst->dispatch_mutex); -+ -+error_put: -+ (void)saHandleInstancePut (&quorum_handle_t_db, handle); -+ return (error); -+} -diff -Naurd corosync-0.92/lib/sa-confdb.c corosync-trunk/lib/sa-confdb.c ---- corosync-0.92/lib/sa-confdb.c 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/lib/sa-confdb.c 2008-11-12 18:39:37.000000000 +0100 -@@ -43,7 +43,7 @@ - #include - #include - --#include -+#include - #include - #include - #include -@@ -80,7 +80,7 @@ - objdb = (struct objdb_iface_ver0 *)objdb_p; - - objdb->objdb_init (); -- return SA_AIS_OK; -+ return CS_OK; - } - - static int load_config() -@@ -130,7 +130,7 @@ - if (config_iface) - free(config_iface); - -- return SA_AIS_OK; -+ return CS_OK; - } - - /* Needed by objdb when it writes back the configuration */ -@@ -174,7 +174,7 @@ - int res; - - res = load_objdb(); -- if (res != SA_AIS_OK) -+ if (res != CS_OK) - return res; - - res = load_config(); -@@ -295,7 +295,6 @@ - } - - int confdb_sa_write ( -- unsigned int parent_object_handle, - char *error_text) - { - char *errtext; -@@ -309,7 +308,6 @@ - } - - int confdb_sa_reload ( -- unsigned int parent_object_handle, - int flush, - char *error_text) - { -diff -Naurd corosync-0.92/lib/sa-confdb.h corosync-trunk/lib/sa-confdb.h ---- corosync-0.92/lib/sa-confdb.h 2008-08-26 09:34:22.000000000 +0200 -+++ corosync-trunk/lib/sa-confdb.h 2008-10-06 09:46:04.000000000 +0200 -@@ -42,6 +42,8 @@ - extern int confdb_sa_key_replace(unsigned int parent_object_handle, void *key_name, int key_name_len, void *old_value, int old_value_len, void *new_value, int new_value_len); - extern int confdb_sa_object_find(unsigned int parent_object_handle, unsigned int *find_handle, unsigned int *object_handle, void *object_name, int *object_name_len, int copy_name); - extern int confdb_sa_key_iter(unsigned int parent_object_handle, unsigned int start_pos, void *key_name, int *key_name_len, void *value, int *value_len); -+extern int confdb_sa_key_increment(unsigned int parent_object_handle, void *key_name, int key_name_len, unsigned int *value); -+extern int confdb_sa_key_decrement(unsigned int parent_object_handle, void *key_name, int key_name_len, unsigned int *value); - extern int confdb_sa_find_destroy(unsigned int find_handle); - extern int confdb_sa_write(char *error_text); - extern int confdb_sa_reload(int flush, char *error_text); -diff -Naurd corosync-0.92/lib/util.c corosync-trunk/lib/util.c ---- corosync-0.92/lib/util.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/lib/util.c 2008-11-11 19:13:47.000000000 +0100 -@@ -53,7 +53,7 @@ - #include - #include - --#include -+#include - #include - #include - -@@ -96,7 +96,7 @@ - } - #endif - --SaAisErrorT -+cs_error_t - saServiceConnect ( - int *responseOut, - int *callbackOut, -@@ -110,7 +110,7 @@ - mar_res_lib_response_init_t res_lib_response_init; - mar_req_lib_dispatch_init_t req_lib_dispatch_init; - mar_res_lib_dispatch_init_t res_lib_dispatch_init; -- SaAisErrorT error; -+ cs_error_t error; - gid_t egid; - - /* -@@ -131,7 +131,7 @@ - #endif - responseFD = socket (PF_UNIX, SOCK_STREAM, 0); - if (responseFD == -1) { -- return (SA_AIS_ERR_NO_RESOURCES); -+ return (CS_ERR_NO_RESOURCES); - } - - socket_nosigpipe (responseFD); -@@ -139,7 +139,7 @@ - result = connect (responseFD, (struct sockaddr *)&address, AIS_SUN_LEN(&address)); - if (result == -1) { - close (responseFD); -- return (SA_AIS_ERR_TRY_AGAIN); -+ return (CS_ERR_TRY_AGAIN); - } - - req_lib_response_init.resdis_header.size = sizeof (req_lib_response_init); -@@ -148,19 +148,19 @@ - - error = saSendRetry (responseFD, &req_lib_response_init, - sizeof (mar_req_lib_response_init_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - error = saRecvRetry (responseFD, &res_lib_response_init, - sizeof (mar_res_lib_response_init_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - /* - * Check for security errors - */ -- if (res_lib_response_init.header.error != SA_AIS_OK) { -+ if (res_lib_response_init.header.error != CS_OK) { - error = res_lib_response_init.header.error; - goto error_exit; - } -@@ -171,7 +171,7 @@ - callbackFD = socket (PF_UNIX, SOCK_STREAM, 0); - if (callbackFD == -1) { - close (responseFD); -- return (SA_AIS_ERR_NO_RESOURCES); -+ return (CS_ERR_NO_RESOURCES); - } - - socket_nosigpipe (callbackFD); -@@ -180,7 +180,7 @@ - if (result == -1) { - close (callbackFD); - close (responseFD); -- return (SA_AIS_ERR_TRY_AGAIN); -+ return (CS_ERR_TRY_AGAIN); - } - - req_lib_dispatch_init.resdis_header.size = sizeof (req_lib_dispatch_init); -@@ -191,25 +191,25 @@ - - error = saSendRetry (callbackFD, &req_lib_dispatch_init, - sizeof (mar_req_lib_dispatch_init_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit_two; - } - error = saRecvRetry (callbackFD, &res_lib_dispatch_init, - sizeof (mar_res_lib_dispatch_init_t)); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit_two; - } - - /* - * Check for security errors - */ -- if (res_lib_dispatch_init.header.error != SA_AIS_OK) { -+ if (res_lib_dispatch_init.header.error != CS_OK) { - error = res_lib_dispatch_init.header.error; - goto error_exit; - } - - *callbackOut = callbackFD; -- return (SA_AIS_OK); -+ return (CS_OK); - - error_exit_two: - close (callbackFD); -@@ -218,14 +218,14 @@ - return (error); - } - --SaAisErrorT -+cs_error_t - saRecvRetry ( - int s, - void *msg, - size_t len) - { -- SaAisErrorT error = SA_AIS_OK; -- int result; -+ cs_error_t error = CS_OK; -+ ssize_t result; - struct msghdr msg_recv; - struct iovec iov_recv; - char *rbuf = (char *)msg; -@@ -260,12 +260,12 @@ - * EOF is detected when recvmsg return 0. - */ - if (result == 0) { -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_exit; - } - #endif - if (result == -1 || result == 0) { -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_exit; - } - processed += result; -@@ -277,14 +277,14 @@ - return (error); - } - --SaAisErrorT -+cs_error_t - saSendRetry ( - int s, - const void *msg, - size_t len) - { -- SaAisErrorT error = SA_AIS_OK; -- int result; -+ cs_error_t error = CS_OK; -+ ssize_t result; - struct msghdr msg_send; - struct iovec iov_send; - char *rbuf = (char *)msg; -@@ -315,15 +315,15 @@ - */ - if (result == -1 && processed == 0) { - if (errno == EINTR) { -- error = SA_AIS_ERR_TRY_AGAIN; -+ error = CS_ERR_TRY_AGAIN; - goto error_exit; - } - if (errno == EAGAIN) { -- error = SA_AIS_ERR_TRY_AGAIN; -+ error = CS_ERR_TRY_AGAIN; - goto error_exit; - } - if (errno == EFAULT) { -- error = SA_AIS_ERR_INVALID_PARAM; -+ error = CS_ERR_INVALID_PARAM; - goto error_exit; - } - } -@@ -340,7 +340,7 @@ - goto retry_send; - } - if (errno == EFAULT) { -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_exit; - } - } -@@ -349,7 +349,7 @@ - * return ERR_LIBRARY on any other syscall error - */ - if (result == -1) { -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_exit; - } - -@@ -362,13 +362,13 @@ - return (error); - } - --SaAisErrorT saSendMsgRetry ( -+cs_error_t saSendMsgRetry ( - int s, - struct iovec *iov, - int iov_len) - { -- SaAisErrorT error = SA_AIS_OK; -- int result; -+ cs_error_t error = CS_OK; -+ ssize_t result; - int total_size = 0; - int i; - int csize; -@@ -404,15 +404,15 @@ - */ - if (result == -1 && iovec_saved_position == -1) { - if (errno == EINTR) { -- error = SA_AIS_ERR_TRY_AGAIN; -+ error = CS_ERR_TRY_AGAIN; - goto error_exit; - } - if (errno == EAGAIN) { -- error = SA_AIS_ERR_TRY_AGAIN; -+ error = CS_ERR_TRY_AGAIN; - goto error_exit; - } - if (errno == EFAULT) { -- error = SA_AIS_ERR_INVALID_PARAM; -+ error = CS_ERR_INVALID_PARAM; - goto error_exit; - } - } -@@ -428,7 +428,7 @@ - goto retry_sendmsg; - } - if (errno == EFAULT) { -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_exit; - } - } -@@ -437,7 +437,7 @@ - * ERR_LIBRARY for any other syscall error - */ - if (result == -1) { -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - goto error_exit; - } - -@@ -470,22 +470,22 @@ - return (error); - } - --SaAisErrorT saSendMsgReceiveReply ( -+cs_error_t saSendMsgReceiveReply ( - int s, - struct iovec *iov, - int iov_len, - void *responseMessage, - int responseLen) - { -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - - error = saSendMsgRetry (s, iov, iov_len); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = saRecvRetry (s, responseMessage, responseLen); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -493,22 +493,22 @@ - return (error); - } - --SaAisErrorT saSendReceiveReply ( -+cs_error_t saSendReceiveReply ( - int s, - void *requestMessage, - int requestLen, - void *responseMessage, - int responseLen) - { -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - - error = saSendRetry (s, requestMessage, requestLen); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - - error = saRecvRetry (s, responseMessage, responseLen); -- if (error != SA_AIS_OK) { -+ if (error != CS_OK) { - goto error_exit; - } - -@@ -516,13 +516,13 @@ - return (error); - } - --SaAisErrorT -+cs_error_t - saPollRetry ( - struct pollfd *ufds, - unsigned int nfds, - int timeout) - { -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - int result; - - retry_poll: -@@ -531,18 +531,18 @@ - goto retry_poll; - } - if (result == -1) { -- error = SA_AIS_ERR_LIBRARY; -+ error = CS_ERR_LIBRARY; - } - - return (error); - } - - --SaAisErrorT -+cs_error_t - saHandleCreate ( - struct saHandleDatabase *handleDatabase, - int instanceSize, -- SaUint64T *handleOut) -+ uint64_t *handleOut) - { - uint32_t handle; - uint32_t check; -@@ -566,7 +566,7 @@ - sizeof (struct saHandle) * handleDatabase->handleCount); - if (newHandles == NULL) { - pthread_mutex_unlock (&handleDatabase->mutex); -- return (SA_AIS_ERR_NO_MEMORY); -+ return (CS_ERR_NO_MEMORY); - } - handleDatabase->handles = newHandles; - } -@@ -575,7 +575,7 @@ - if (instance == 0) { - free (newHandles); - pthread_mutex_unlock (&handleDatabase->mutex); -- return (SA_AIS_ERR_NO_MEMORY); -+ return (CS_ERR_NO_MEMORY); - } - - -@@ -601,20 +601,20 @@ - - handleDatabase->handles[handle].check = check; - -- *handleOut = (SaUint64T)((uint64_t)check << 32 | handle); -+ *handleOut = (uint64_t)((uint64_t)check << 32 | handle); - - pthread_mutex_unlock (&handleDatabase->mutex); - -- return (SA_AIS_OK); -+ return (CS_OK); - } - - --SaAisErrorT -+cs_error_t - saHandleDestroy ( - struct saHandleDatabase *handleDatabase, -- SaUint64T inHandle) -+ uint64_t inHandle) - { -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - uint32_t check = inHandle >> 32; - uint32_t handle = inHandle & 0xffffffff; - -@@ -622,7 +622,7 @@ - - if (check != handleDatabase->handles[handle].check) { - pthread_mutex_unlock (&handleDatabase->mutex); -- error = SA_AIS_ERR_BAD_HANDLE; -+ error = CS_ERR_BAD_HANDLE; - return (error); - } - -@@ -630,34 +630,34 @@ - - pthread_mutex_unlock (&handleDatabase->mutex); - -- saHandleInstancePut (handleDatabase, inHandle); -+ (void)saHandleInstancePut (handleDatabase, inHandle); - - return (error); - } - - --SaAisErrorT -+cs_error_t - saHandleInstanceGet ( - struct saHandleDatabase *handleDatabase, -- SaUint64T inHandle, -+ uint64_t inHandle, - void **instance) - { - uint32_t check = inHandle >> 32; - uint32_t handle = inHandle & 0xffffffff; - -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - pthread_mutex_lock (&handleDatabase->mutex); - -- if (handle >= (SaUint64T)handleDatabase->handleCount) { -- error = SA_AIS_ERR_BAD_HANDLE; -+ if (handle >= (uint64_t)handleDatabase->handleCount) { -+ error = CS_ERR_BAD_HANDLE; - goto error_exit; - } - if (handleDatabase->handles[handle].state != SA_HANDLE_STATE_ACTIVE) { -- error = SA_AIS_ERR_BAD_HANDLE; -+ error = CS_ERR_BAD_HANDLE; - goto error_exit; - } - if (check != handleDatabase->handles[handle].check) { -- error = SA_AIS_ERR_BAD_HANDLE; -+ error = CS_ERR_BAD_HANDLE; - goto error_exit; - } - -@@ -673,20 +673,20 @@ - } - - --SaAisErrorT -+cs_error_t - saHandleInstancePut ( - struct saHandleDatabase *handleDatabase, -- SaUint64T inHandle) -+ uint64_t inHandle) - { - void *instance; -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - uint32_t check = inHandle >> 32; - uint32_t handle = inHandle & 0xffffffff; - - pthread_mutex_lock (&handleDatabase->mutex); - - if (check != handleDatabase->handles[handle].check) { -- error = SA_AIS_ERR_BAD_HANDLE; -+ error = CS_ERR_BAD_HANDLE; - goto error_exit; - } - -@@ -707,16 +707,16 @@ - } - - --SaAisErrorT -+cs_error_t - saVersionVerify ( - struct saVersionDatabase *versionDatabase, -- SaVersionT *version) -+ cs_version_t *version) - { - int i; -- SaAisErrorT error = SA_AIS_ERR_VERSION; -+ cs_error_t error = CS_ERR_VERSION; - - if (version == 0) { -- return (SA_AIS_ERR_INVALID_PARAM); -+ return (CS_ERR_INVALID_PARAM); - } - - /* -@@ -742,7 +742,7 @@ - * Check if we can support the major version requested. - */ - if (versionDatabase->versionsSupported[i].majorVersion >= version->majorVersion) { -- error = SA_AIS_OK; -+ error = CS_OK; - break; - } - -@@ -771,17 +771,17 @@ - /* - * Get the time of day and convert to nanoseconds - */ --SaTimeT clustTimeNow(void) -+cs_time_t clustTimeNow(void) - { - struct timeval tv; -- SaTimeT time_now; -+ cs_time_t time_now; - - if (gettimeofday(&tv, 0)) { - return 0ULL; - } - -- time_now = (SaTimeT)(tv.tv_sec) * 1000000000ULL; -- time_now += (SaTimeT)(tv.tv_usec) * 1000ULL; -+ time_now = (cs_time_t)(tv.tv_sec) * 1000000000ULL; -+ time_now += (cs_time_t)(tv.tv_usec) * 1000ULL; - - return time_now; - } -diff -Naurd corosync-0.92/lib/util.h corosync-trunk/lib/util.h ---- corosync-0.92/lib/util.h 2008-05-12 15:48:06.000000000 +0200 -+++ corosync-trunk/lib/util.h 2008-11-06 22:49:07.000000000 +0100 -@@ -72,72 +72,72 @@ - SaVersionT *versionsSupported; - }; - --SaAisErrorT -+cs_error_t - saServiceConnect ( - int *responseOut, - int *callbackOut, - enum service_types service); - --SaAisErrorT -+cs_error_t - saRecvRetry ( - int s, - void *msg, - size_t len); - --SaAisErrorT -+cs_error_t - saSendRetry ( - int s, - const void *msg, - size_t len); - --SaAisErrorT saSendMsgRetry ( -+cs_error_t saSendMsgRetry ( - int s, - struct iovec *iov, - int iov_len); - --SaAisErrorT saSendMsgReceiveReply ( -+cs_error_t saSendMsgReceiveReply ( - int s, - struct iovec *iov, - int iov_len, - void *responseMessage, - int responseLen); - --SaAisErrorT saSendReceiveReply ( -+cs_error_t saSendReceiveReply ( - int s, - void *requestMessage, - int requestLen, - void *responseMessage, - int responseLen); - --SaAisErrorT -+cs_error_t - saPollRetry ( - struct pollfd *ufds, - unsigned int nfds, - int timeout); - --SaAisErrorT -+cs_error_t - saHandleCreate ( - struct saHandleDatabase *handleDatabase, - int instanceSize, - SaUint64T *handleOut); - --SaAisErrorT -+cs_error_t - saHandleDestroy ( - struct saHandleDatabase *handleDatabase, - SaUint64T handle); - --SaAisErrorT -+cs_error_t - saHandleInstanceGet ( - struct saHandleDatabase *handleDatabase, - SaUint64T handle, - void **instance); - --SaAisErrorT -+cs_error_t - saHandleInstancePut ( - struct saHandleDatabase *handleDatabase, - SaUint64T handle); - --SaAisErrorT -+cs_error_t - saVersionVerify ( - struct saVersionDatabase *versionDatabase, - SaVersionT *version); -diff -Naurd corosync-0.92/lib/votequorum.c corosync-trunk/lib/votequorum.c ---- corosync-0.92/lib/votequorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/lib/votequorum.c 2009-01-30 14:31:40.000000000 +0100 -@@ -0,0 +1,841 @@ -+/* -+ * Copyright (c) 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 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 CONTIBUTORS "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. -+ */ -+ -+/* -+ * Provides a quorum API using the corosync executive -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include "corosync/votequorum.h" -+#include "corosync/ipc_votequorum.h" -+ -+struct votequorum_inst { -+ int response_fd; -+ int dispatch_fd; -+ int finalize; -+ void *context; -+ votequorum_callbacks_t callbacks; -+ pthread_mutex_t response_mutex; -+ pthread_mutex_t dispatch_mutex; -+}; -+ -+static void votequorum_instance_destructor (void *instance); -+ -+static struct saHandleDatabase votequorum_handle_t_db = { -+ .handleCount = 0, -+ .handles = 0, -+ .mutex = PTHREAD_MUTEX_INITIALIZER, -+ .handleInstanceDestructor = votequorum_instance_destructor -+}; -+ -+/* -+ * Clean up function for a quorum instance (votequorum_initialize) handle -+ */ -+static void votequorum_instance_destructor (void *instance) -+{ -+ struct votequorum_inst *votequorum_inst = instance; -+ -+ pthread_mutex_destroy (&votequorum_inst->response_mutex); -+} -+ -+cs_error_t votequorum_initialize ( -+ votequorum_handle_t *handle, -+ votequorum_callbacks_t *callbacks) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ -+ error = saHandleCreate (&votequorum_handle_t_db, sizeof (struct votequorum_inst), handle); -+ if (error != CS_OK) { -+ goto error_no_destroy; -+ } -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, *handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ goto error_destroy; -+ } -+ -+ error = saServiceConnect (&votequorum_inst->dispatch_fd, -+ &votequorum_inst->response_fd, -+ VOTEQUORUM_SERVICE); -+ if (error != CS_OK) { -+ goto error_put_destroy; -+ } -+ -+ pthread_mutex_init (&votequorum_inst->response_mutex, NULL); -+ pthread_mutex_init (&votequorum_inst->dispatch_mutex, NULL); -+ if (callbacks) -+ memcpy(&votequorum_inst->callbacks, callbacks, sizeof (callbacks)); -+ else -+ memset(&votequorum_inst->callbacks, 0, sizeof (callbacks)); -+ -+ saHandleInstancePut (&votequorum_handle_t_db, *handle); -+ -+ return (CS_OK); -+ -+error_put_destroy: -+ saHandleInstancePut (&votequorum_handle_t_db, *handle); -+error_destroy: -+ saHandleDestroy (&votequorum_handle_t_db, *handle); -+error_no_destroy: -+ return (error); -+} -+ -+cs_error_t votequorum_finalize ( -+ votequorum_handle_t handle) -+{ -+ struct votequorum_inst *votequorum_inst; -+ cs_error_t error; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ /* -+ * Another thread has already started finalizing -+ */ -+ if (votequorum_inst->finalize) { -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ return (CS_ERR_BAD_HANDLE); -+ } -+ -+ votequorum_inst->finalize = 1; -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ saHandleDestroy (&votequorum_handle_t_db, handle); -+ -+ /* -+ * Disconnect from the server -+ */ -+ if (votequorum_inst->response_fd != -1) { -+ shutdown(votequorum_inst->response_fd, 0); -+ close(votequorum_inst->response_fd); -+ } -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+ -+cs_error_t votequorum_getinfo ( -+ votequorum_handle_t handle, -+ unsigned int nodeid, -+ struct votequorum_info *info) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_getinfo req_lib_votequorum_getinfo; -+ struct res_lib_votequorum_getinfo res_lib_votequorum_getinfo; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_getinfo.header.size = sizeof (struct req_lib_votequorum_getinfo); -+ req_lib_votequorum_getinfo.header.id = MESSAGE_REQ_VOTEQUORUM_GETINFO; -+ req_lib_votequorum_getinfo.nodeid = nodeid; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_getinfo; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_getinfo); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_getinfo, sizeof (struct res_lib_votequorum_getinfo)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_getinfo.header.error; -+ -+ info->node_id = res_lib_votequorum_getinfo.nodeid; -+ info->node_votes = res_lib_votequorum_getinfo.votes; -+ info->node_expected_votes = res_lib_votequorum_getinfo.expected_votes; -+ info->highest_expected = res_lib_votequorum_getinfo.highest_expected; -+ info->total_votes = res_lib_votequorum_getinfo.total_votes; -+ info->quorum = res_lib_votequorum_getinfo.quorum; -+ info->flags = res_lib_votequorum_getinfo.flags; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_setexpected ( -+ votequorum_handle_t handle, -+ unsigned int expected_votes) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_setexpected req_lib_votequorum_setexpected; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_setexpected.header.size = sizeof (struct req_lib_votequorum_setexpected); -+ req_lib_votequorum_setexpected.header.id = MESSAGE_REQ_VOTEQUORUM_SETEXPECTED; -+ req_lib_votequorum_setexpected.expected_votes = expected_votes; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_setexpected; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_setexpected); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_setvotes ( -+ votequorum_handle_t handle, -+ unsigned int nodeid, -+ unsigned int votes) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_setvotes req_lib_votequorum_setvotes; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_setvotes.header.size = sizeof (struct req_lib_votequorum_setvotes); -+ req_lib_votequorum_setvotes.header.id = MESSAGE_REQ_VOTEQUORUM_SETVOTES; -+ req_lib_votequorum_setvotes.nodeid = nodeid; -+ req_lib_votequorum_setvotes.votes = votes; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_setvotes; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_setvotes); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_qdisk_register ( -+ votequorum_handle_t handle, -+ char *name, -+ unsigned int votes) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_qdisk_register req_lib_votequorum_qdisk_register; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ if (strlen(name) > VOTEQUORUM_MAX_QDISK_NAME_LEN) -+ return CS_ERR_INVALID_PARAM; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_qdisk_register.header.size = sizeof (struct req_lib_votequorum_qdisk_register); -+ req_lib_votequorum_qdisk_register.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_REGISTER; -+ strcpy(req_lib_votequorum_qdisk_register.name, name); -+ req_lib_votequorum_qdisk_register.votes = votes; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_qdisk_register; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_qdisk_register); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_qdisk_poll ( -+ votequorum_handle_t handle, -+ unsigned int state) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_qdisk_poll req_lib_votequorum_qdisk_poll; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_qdisk_poll.header.size = sizeof (struct req_lib_votequorum_qdisk_poll); -+ req_lib_votequorum_qdisk_poll.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_POLL; -+ req_lib_votequorum_qdisk_poll.state = state; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_qdisk_poll; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_qdisk_poll); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_qdisk_unregister ( -+ votequorum_handle_t handle) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_general req_lib_votequorum_general; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); -+ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_UNREGISTER; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_general; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+ -+ -+cs_error_t votequorum_qdisk_getinfo ( -+ votequorum_handle_t handle, -+ struct votequorum_qdisk_info *qinfo) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_general req_lib_votequorum_general; -+ struct res_lib_votequorum_qdisk_getinfo res_lib_votequorum_qdisk_getinfo; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); -+ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_QDISK_GETINFO; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_general; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_qdisk_getinfo, sizeof (struct res_lib_votequorum_qdisk_getinfo)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_qdisk_getinfo.header.error; -+ -+ qinfo->votes = res_lib_votequorum_qdisk_getinfo.votes; -+ qinfo->state = res_lib_votequorum_qdisk_getinfo.state; -+ strcpy(qinfo->name, res_lib_votequorum_qdisk_getinfo.name); -+ -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_setstate ( -+ votequorum_handle_t handle) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_general req_lib_votequorum_general; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); -+ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_SETSTATE; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_general; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_leaving ( -+ votequorum_handle_t handle) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_general req_lib_votequorum_general; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); -+ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_LEAVING; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_general; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_trackstart ( -+ votequorum_handle_t handle, -+ uint64_t context, -+ unsigned int flags ) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_trackstart req_lib_votequorum_trackstart; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_trackstart.header.size = sizeof (struct req_lib_votequorum_trackstart); -+ req_lib_votequorum_trackstart.header.id = MESSAGE_REQ_VOTEQUORUM_TRACKSTART; -+ req_lib_votequorum_trackstart.track_flags = flags; -+ req_lib_votequorum_trackstart.context = context; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_trackstart; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_trackstart); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+cs_error_t votequorum_trackstop ( -+ votequorum_handle_t handle) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ struct iovec iov[2]; -+ struct req_lib_votequorum_general req_lib_votequorum_general; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ pthread_mutex_lock (&votequorum_inst->response_mutex); -+ -+ req_lib_votequorum_general.header.size = sizeof (struct req_lib_votequorum_general); -+ req_lib_votequorum_general.header.id = MESSAGE_REQ_VOTEQUORUM_TRACKSTOP; -+ -+ iov[0].iov_base = (char *)&req_lib_votequorum_general; -+ iov[0].iov_len = sizeof (struct req_lib_votequorum_general); -+ -+ error = saSendMsgReceiveReply (votequorum_inst->response_fd, iov, 1, -+ &res_lib_votequorum_status, sizeof (struct res_lib_votequorum_status)); -+ -+ pthread_mutex_unlock (&votequorum_inst->response_mutex); -+ -+ if (error != CS_OK) { -+ goto error_exit; -+ } -+ -+ error = res_lib_votequorum_status.header.error; -+ -+error_exit: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (error); -+} -+ -+ -+cs_error_t votequorum_context_get ( -+ votequorum_handle_t handle, -+ void **context) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ *context = votequorum_inst->context; -+ -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+cs_error_t votequorum_context_set ( -+ votequorum_handle_t handle, -+ void *context) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ votequorum_inst->context = context; -+ -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+ -+cs_error_t votequorum_fd_get ( -+ votequorum_handle_t handle, -+ int *fd) -+{ -+ cs_error_t error; -+ struct votequorum_inst *votequorum_inst; -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ *fd = votequorum_inst->dispatch_fd; -+ -+ (void)saHandleInstancePut (&votequorum_handle_t_db, handle); -+ -+ return (CS_OK); -+} -+ -+ -+struct res_overlay { -+ mar_res_header_t header __attribute__((aligned(8))); -+ char data[512000]; -+}; -+ -+cs_error_t votequorum_dispatch ( -+ votequorum_handle_t handle, -+ cs_dispatch_flags_t dispatch_types) -+{ -+ struct pollfd ufds; -+ int timeout = -1; -+ cs_error_t error; -+ int cont = 1; /* always continue do loop except when set to 0 */ -+ int dispatch_avail; -+ struct votequorum_inst *votequorum_inst; -+ votequorum_callbacks_t callbacks; -+ struct res_overlay dispatch_data; -+ struct res_lib_votequorum_notification *res_lib_votequorum_notification; -+ -+ if (dispatch_types != CS_DISPATCH_ONE && -+ dispatch_types != CS_DISPATCH_ALL && -+ dispatch_types != CS_DISPATCH_BLOCKING) { -+ -+ return (CS_ERR_INVALID_PARAM); -+ } -+ -+ error = saHandleInstanceGet (&votequorum_handle_t_db, handle, -+ (void *)&votequorum_inst); -+ if (error != CS_OK) { -+ return (error); -+ } -+ -+ /* -+ * Timeout instantly for CS_DISPATCH_ONE or CS_DISPATCH_ALL and -+ * wait indefinately for CS_DISPATCH_BLOCKING -+ */ -+ if (dispatch_types == CS_DISPATCH_ALL) { -+ timeout = 0; -+ } -+ -+ do { -+ ufds.fd = votequorum_inst->dispatch_fd; -+ ufds.events = POLLIN; -+ ufds.revents = 0; -+ -+ pthread_mutex_lock (&votequorum_inst->dispatch_mutex); -+ -+ error = saPollRetry (&ufds, 1, timeout); -+ if (error != CS_OK) { -+ goto error_unlock; -+ } -+ -+ /* -+ * Handle has been finalized in another thread -+ */ -+ if (votequorum_inst->finalize == 1) { -+ error = CS_OK; -+ goto error_unlock; -+ } -+ -+ if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) { -+ error = CS_ERR_BAD_HANDLE; -+ goto error_unlock; -+ } -+ -+ dispatch_avail = ufds.revents & POLLIN; -+ if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) { -+ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); -+ break; /* exit do while cont is 1 loop */ -+ } else -+ if (dispatch_avail == 0) { -+ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); -+ continue; /* next poll */ -+ } -+ -+ if (ufds.revents & POLLIN) { -+ error = saRecvRetry (votequorum_inst->dispatch_fd, &dispatch_data.header, -+ sizeof (mar_res_header_t)); -+ if (error != CS_OK) { -+ goto error_unlock; -+ } -+ if (dispatch_data.header.size > sizeof (mar_res_header_t)) { -+ error = saRecvRetry (votequorum_inst->dispatch_fd, &dispatch_data.data, -+ dispatch_data.header.size - sizeof (mar_res_header_t)); -+ if (error != CS_OK) { -+ goto error_unlock; -+ } -+ } -+ } else { -+ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); -+ continue; -+ } -+ -+ /* -+ * Make copy of callbacks, message data, unlock instance, and call callback -+ * A risk of this dispatch method is that the callback routines may -+ * operate at the same time that votequorum_finalize has been called in another thread. -+ */ -+ memcpy (&callbacks, &votequorum_inst->callbacks, sizeof (votequorum_callbacks_t)); -+ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); -+ -+ /* -+ * Dispatch incoming message -+ */ -+ switch (dispatch_data.header.id) { -+ -+ case MESSAGE_RES_VOTEQUORUM_NOTIFICATION: -+ if (callbacks.votequorum_notify_fn == NULL) { -+ continue; -+ } -+ res_lib_votequorum_notification = (struct res_lib_votequorum_notification *)&dispatch_data; -+ -+ callbacks.votequorum_notify_fn ( handle, -+ res_lib_votequorum_notification->context, -+ res_lib_votequorum_notification->quorate, -+ res_lib_votequorum_notification->node_list_entries, -+ (votequorum_node_t *)res_lib_votequorum_notification->node_list ); -+ ; -+ break; -+ -+ default: -+ error = CS_ERR_LIBRARY; -+ goto error_put; -+ break; -+ } -+ -+ /* -+ * Determine if more messages should be processed -+ * */ -+ switch (dispatch_types) { -+ case CS_DISPATCH_ONE: -+ cont = 0; -+ break; -+ case CS_DISPATCH_ALL: -+ break; -+ case CS_DISPATCH_BLOCKING: -+ break; -+ } -+ } while (cont); -+ -+ goto error_put; -+ -+error_unlock: -+ pthread_mutex_unlock (&votequorum_inst->dispatch_mutex); -+ -+error_put: -+ saHandleInstancePut (&votequorum_handle_t_db, handle); -+ return (error); -+} -diff -Naurd corosync-0.92/Makefile corosync-trunk/Makefile ---- corosync-0.92/Makefile 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/Makefile 2009-01-30 19:44:13.000000000 +0100 -@@ -46,24 +46,8 @@ - INCLUDEDIR_ENGINE=$(PREFIX)/include/corosync/engine - MANDIR=$(PREFIX)/share/man - ETCDIR=/etc --ARCH=$(shell uname -p) - --ifeq (,$(findstring 64,$(ARCH))) --LIBDIR=$(PREFIX)/lib/corosync --else --LIBDIR=$(PREFIX)/lib64/corosync --endif --ifeq (s390,$(ARCH)) --LIBDIR=$(PREFIX)/lib/corosync --endif --ifeq (s390x,$(ARCH)) --LIBDIR=$(PREFIX)/lib64/corosync --endif --ifeq (ia64,$(ARCH)) --LIBDIR=$(PREFIX)/lib/corosync --endif -- --SUBDIRS:=$(builddir)lcr $(builddir)lib $(builddir)tools $(builddir)exec $(builddir)test $(builddir)services -+SUBDIRS:=$(builddir)lcr $(builddir)lib $(builddir)tools $(builddir)exec $(builddir)test $(builddir)services $(builddir)pkgconfig - sub_make = srcdir=$(srcdir) builddir=$(builddir) subdir=$(1)/ $(MAKE) -I$(srcdir)$(1) -f $(srcdir)$(1)/Makefile $(2) - - all: $(SUBDIRS) -@@ -73,6 +57,7 @@ - @(cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,all)); - @(cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,all)); - @(cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,all)); -+ @(cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,all)); - - # subdirs are not phony - .PHONY: all clean install doxygen -@@ -113,12 +98,21 @@ - (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,clean)); - (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,clean)); - (cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean)); -+ (cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,clean)); -+ - rm -rf $(builddir)doc/api - --COROSYNC_LIBS = evs cpg cfg coroutil confdb -+lint: -+ (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,lint)); -+ (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,lint)); -+ (cd $(builddir)lcr; echo ==== `pwd` ===; $(call sub_make,lcr,lint)); -+ (cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,lint)); -+ (cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,lint)); -+ -+COROSYNC_LIBS = evs cpg cfg coroutil confdb quorum votequorum - - COROSYNC_HEADERS = cpg.h cfg.h evs.h ipc_gen.h mar_gen.h swab.h \ -- ais_util.h confdb.h list.h saAis.h -+ ais_util.h confdb.h quorum.h list.h corotypes.h votequorum.h - - EXEC_LIBS = totem_pg logsys - -@@ -134,6 +128,7 @@ - mkdir -p $(DESTDIR)$(MANDIR)/man5 - mkdir -p $(DESTDIR)$(MANDIR)/man8 - mkdir -p $(DESTDIR)$(ETCDIR)/ld.so.conf.d -+ mkdir -p $(DESTDIR)$(PKGCONFIGDIR) - - - for eLib in $(EXEC_LIBS); do \ -@@ -145,7 +140,7 @@ - install -m 755 exec/lib$$eLib.so.2.* $(DESTDIR)$(LIBDIR); \ - if [ "xYES" = "x$(STATICLIBS)" ]; then \ - install -m 755 exec/lib$$eLib.a $(DESTDIR)$(LIBDIR); \ -- if [ ${OPENCOROSYNC_COMPAT} = "DARWIN" ]; then \ -+ if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ - ranlib $(DESTDIR)$(LIBDIR)/lib$$eLib.a; \ - fi \ - fi \ -@@ -161,7 +156,7 @@ - install -m 755 lib/lib$$aLib.so.2.* $(DESTDIR)$(LIBDIR); \ - if [ "xYES" = "x$(STATICLIBS)" ]; then \ - install -m 755 lib/lib$$aLib.a $(DESTDIR)$(LIBDIR); \ -- if [ ${OPENCOROSYNC_COMPAT} = "DARWIN" ]; then \ -+ if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ - ranlib $(DESTDIR)$(LIBDIR)/lib$$aLib.a; \ - fi \ - fi \ -@@ -177,7 +172,7 @@ - install -m 755 $(builddir)tools/corosync-cfgtool $(DESTDIR)$(SBINDIR) - install -m 755 $(builddir)tools/corosync-keygen $(DESTDIR)$(SBINDIR) - -- if [ ! -f $(DESTDIR)$(ETCDIR)/penais.conf ] ; then \ -+ if [ ! -f $(DESTDIR)$(ETCDIR)/corosync.conf ] ; then \ - install -m 644 $(srcdir)conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \ - fi - -@@ -196,10 +191,13 @@ - install -m 644 $(srcdir)include/corosync/engine/coroapi.h $(DESTDIR)$(INCLUDEDIR_ENGINE) - install -m 644 $(srcdir)include/corosync/engine/objdb.h $(DESTDIR)$(INCLUDEDIR_ENGINE) - install -m 644 $(srcdir)include/corosync/engine/logsys.h $(DESTDIR)$(INCLUDEDIR_ENGINE) -+ install -m 644 $(srcdir)include/corosync/engine/quorum.h $(DESTDIR)$(INCLUDEDIR_ENGINE) - install -m 644 $(srcdir)include/corosync/engine/config.h $(DESTDIR)$(INCLUDEDIR_ENGINE) - install -m 644 $(srcdir)man/*.3 $(DESTDIR)$(MANDIR)/man3 - install -m 644 $(srcdir)man/*.5 $(DESTDIR)$(MANDIR)/man5 - install -m 644 $(srcdir)man/*.8 $(DESTDIR)$(MANDIR)/man8 - -+ install -m 644 $(builddir)/pkgconfig/*.pc $(DESTDIR)$(PKGCONFIGDIR) -+ - doxygen: - mkdir -p doc/api && doxygen -diff -Naurd corosync-0.92/Makefile.inc corosync-trunk/Makefile.inc ---- corosync-0.92/Makefile.inc 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/Makefile.inc 2009-01-30 19:25:04.000000000 +0100 -@@ -3,6 +3,25 @@ - DESTDIR= - LCRSODIR=$(PREFIX)/libexec/lcrso - -+ARCH=$(shell uname -p) -+ifeq (,$(findstring 64,$(ARCH))) -+PRELIBDIR=$(PREFIX)/lib -+else -+PRELIBDIR=$(PREFIX)/lib64 -+endif -+ifeq (s390,$(ARCH)) -+PRELIBDIR=$(PREFIX)/lib -+endif -+ifeq (s390x,$(ARCH)) -+PRELIBDIR=$(PREFIX)/lib64 -+endif -+ifeq (ia64,$(ARCH)) -+PRELIBDIR=$(PREFIX)/lib -+endif -+ -+LIBDIR=$(PRELIBDIR)/corosync -+PKGCONFIGDIR=$(PRELIBDIR)/pkgconfig -+ - # Do not modify below this line - - # Basic OS detection -@@ -38,16 +57,15 @@ - # COROSYNC_BUILD can be defined as RELEASE or DEBUG - # - ifndef COROSYNC_BUILD -- COROSYNC_BUILD=DEBUG -+ COROSYNC_BUILD=RELEASE - endif - --# COROSYNC_PROFILE -- - # default CFLAGS, LDFLAGS - # - CFLAGS = - LDFLAGS = - DYFLAGS = -+LINT_FLAGS = -weak -unrecog +posixlib +ignoresigns -fcnuse -badflag -D__gnuc_va_list=va_list -D__attribute\(x\)= - - override CFLAGS += -DLCRSODIR='"$(LCRSODIR)"' - -@@ -58,35 +76,26 @@ - # build CFLAGS, LDFLAGS - # - ifeq (${COROSYNC_BUILD}, RELEASE) -- CFLAGS += -O3 -Wall --# -Wstrict-aliasing=2 TODO sameday fix all of these --ifndef COROSYNC_PROFILE -- CFLAGS += -fomit-frame-pointer --endif -- LDFLAGS += -+ override CFLAGS += -O3 -Wall -+ override LDFLAGS += - endif - ifeq (${COROSYNC_BUILD}, DEBUG) -- CFLAGS += -O0 -g -Wall -DDEBUG --time -- LDFLAGS += -g -+ override CFLAGS += -O0 -g -Wall -+ override LDFLAGS += -g - ifeq (${COROSYNC_COMPAT}, SOLARIS) - CFLAGS += -Werror -DTS_CLASS - endif - endif - ifeq (${COROSYNC_BUILD}, COVERAGE) -- CFLAGS += -O0 -g -ftest-coverage -fprofile-arcs -- LDFLAGS += -g -ftest-coverage -fprofile-arcs -+ override CFLAGS += -O0 -g -ftest-coverage -fprofile-arcs -+ override LDFLAGS += -g -ftest-coverage -fprofile-arcs - BUILD_DYNAMIC=0 - endif - --ifdef COROSYNC_PROFILE -- CFLAGS += -pg -- LDFLAGS += -pg --endif -- - # platform specific CFLAGS, LDFLAGS - # - ifeq (${COROSYNC_COMPAT}, LINUX) -- override CFLAGS += -DCOROSYNC_LINUX -+ override CFLAGS += -DCOROSYNC_LINUX -D_XOPEN_SOURCE=600 -D_GNU_SOURCE - override LDFLAGS += -ldl -lpthread - override DYFLAGS += -rdynamic - endif -diff -Naurd corosync-0.92/man/confdb_overview.8 corosync-trunk/man/confdb_overview.8 ---- corosync-0.92/man/confdb_overview.8 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/man/confdb_overview.8 2009-01-26 11:46:08.000000000 +0100 -@@ -34,16 +34,24 @@ - .TH CONFDB_OVERVIEW 8 2006-03-06 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" - .SH OVERVIEW - The CONFDB library is delivered with the corosync project. This library is used --to examine manipulate the configuratin databser used by corosync. -+to examine manipulate the configuration database used by corosync. - .PP - The library provides a mechanism to: -+.PP - * Create new objects -+.PP - * Create new key/value pairs within those objects -+.PP - * Remove existing keys -+.PP - * Remove an existing object and all it sub-objects and keys -+.PP - * Read keys and values -+.PP - * Iterate keys within an object -+.PP - * Iterate subobjects within a parent object -+.PP - * Find a named object - .PP - .SH BUGS -diff -Naurd corosync-0.92/man/corosync.conf.5 corosync-trunk/man/corosync.conf.5 ---- corosync-0.92/man/corosync.conf.5 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/man/corosync.conf.5 2008-10-21 00:05:51.000000000 +0200 -@@ -435,20 +435,6 @@ - No default. - - .TP --debug --This specifies whether debug output is logged for all services. This is --generally a bad idea, unless there is some specific bug or problem that must be --found in the executive. Set the value to --.B on --to debug, --.B off --to turn off debugging. If enabled, individual loggers can be disabled using a --.B logger_subsys --directive. -- --The default is off. -- --.TP - timestamp - This specifies that a timestamp is placed on all log messages. - -diff -Naurd corosync-0.92/man/index.html corosync-trunk/man/index.html ---- corosync-0.92/man/index.html 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/man/index.html 2009-01-26 11:46:08.000000000 +0100 -@@ -85,5 +85,30 @@ -
- confdb_object_parent_get(3): Description of the confdb_object_parent_get interface. - -+
-+votequorum_overview(8): An overview of the vote-based quorum service -+
-+votequorum_initialize(3): Description of the votequorum interface. -+
-+votequorum_finalize(3): Description of the votequorum interface. -+
-+votequorum_fd_get(3): Description of the votequorum interface. -+
-+votequorum_getinfo(3): Description of the votequorum interface. -+
-+votequorum_leaving(3): Description of the votequorum interface. -+
-+votequorum_setexpected(3): Description of the votequorum interface. -+
-+votequorum_setvotes(3): Description of the votequorum interface. -+
-+votequorum_qdisk_register(3): Description of the votequorum interface. -+
-+votequorum_qdisk_unregister(3): Description of the votequorum interface. -+
-+votequorum_qdisk_poll(3): Description of the votequorum interface. -+
-+votequorum_qdisk_getinfo(3): Description of the votequorum interface. -+
- - -diff -Naurd corosync-0.92/man/Makefile corosync-trunk/man/Makefile ---- corosync-0.92/man/Makefile 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/man/Makefile 2009-01-26 11:46:08.000000000 +0100 -@@ -74,6 +74,19 @@ - groff -mandoc -Thtml confdb_object_parent_get.3 > html/confdb_object_parent_get.html - groff -mandoc -Thtml confdb_overview.8 > html/confdb_overview.html - -+ groff -mandoc -Thtml votequorum_overview.8 > html/votequorum_overview.html -+ groff -mandoc -Thtml votequorum_initialize.3 > html/votequorum_initialize.html -+ groff -mandoc -Thtml votequorum_finalize.3 > html/votequorum_finalize.html -+ groff -mandoc -Thtml votequorum_fd_get.3 > html/votequorum_fd_get.html -+ groff -mandoc -Thtml votequorum_dispatch.3 > html/votequorum_dispatch.html -+ groff -mandoc -Thtml votequorum_getinfo.3 > html/votequorum_getinfo.html -+ groff -mandoc -Thtml votequorum_leaving.3 > html/votequorum_leaving.html -+ groff -mandoc -Thtml votequorum_setexpected.3 > html/votequorum_setexpected.html -+ groff -mandoc -Thtml votequorum_setvotes.3 > html/votequorum_setvotes.html -+ groff -mandoc -Thtml votequorum_qdisk_register.3 > html/votequorum_qdisk_register.html -+ groff -mandoc -Thtml votequorum_qdisk_unregister.3 > html/votequorum_qdisk_unregister.html -+ groff -mandoc -Thtml votequorum_qdisk_poll.3 > html/votequorum_poll.html -+ groff -mandoc -Thtml votequorum_qdisk_getinfo.3 > html/votequorum_qdisk_getinfo.html - cp index.html html - - clean: -diff -Naurd corosync-0.92/man/votequorum_dispatch.3 corosync-trunk/man/votequorum_dispatch.3 ---- corosync-0.92/man/votequorum_dispatch.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_dispatch.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,96 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_DISPATCH 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_dispatch \- Dispatches callbacks from the votequorum service -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_dispatch(votequorum_handle_t " handle ", votequorum_dispatch_t *" dispatch_types ");" -+.SH DESCRIPTION -+The -+.B votequorum_dispatch -+function is used to dispatch configuration changes. -+.PP -+Each application may have several connections to the votequorum API. Each application -+uses the -+.I handle -+argument to uniquely identify the connection. -+.PP -+The -+.I dispatch_types -+argument is used to identify the type of dispatch to execute. The possible types are -+defined by the structure: -+ -+.IP -+.RS -+.ne 18 -+.nf -+.ta 4n 30n 33n -+typedef enum { -+ CS_DISPATCH_ONE, -+ CS_DISPATCH_ALL, -+ CS_DISPATCH_BLOCKING -+} votequorum_dispatch_t; -+.ta -+.fi -+.RE -+.IP -+.PP -+.PP -+The dispatch values have the following meanings: -+.TP -+.B CS_DISPATCH_ONE -+Dispatch at least one callback, blocking until the callback is dispatched. -+.TP -+.B CS_DISPATCH_ALL -+Dispatch all waiting callbacks without blocking to wait for any callbacks. -+.TP -+.B CS_DISPATCH_BLOCKING -+Dispatch all callbacks blocking indefinitely. This is used in a threaded -+program where a thread is created, and then votequorum_dispatch() is called immediately -+from the created thread to execute callbacks. -+ -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_fd_get (3), -+ -+.PP -diff -Naurd corosync-0.92/man/votequorum_fd_get.3 corosync-trunk/man/votequorum_fd_get.3 ---- corosync-0.92/man/votequorum_fd_get.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_fd_get.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,64 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_FD_GET 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_fd_get \- Dispatches callbacks from the votequorum service -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_fd_get(votequorum_handle_t " handle ", int *" fd ");" -+.SH DESCRIPTION -+The -+.B votequorum_fd_get -+function is used to retrieve the file descriptor that may be used with the poll -+system call to determine when -+.B votequorum_dispatch(3) -+won't block. The -+.I handle -+argument may not be used directly with -+.B poll -+because it is not the file descriptor, but instead an internal identifier used -+by the votequorum library. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_finalize.3 corosync-trunk/man/votequorum_finalize.3 ---- corosync-0.92/man/votequorum_finalize.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_finalize.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,61 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_FINALIZE 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_finalize \- Terminate a connection to the votequorum service -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_finalize(votequorum_handle_t " handle ");" -+.SH DESCRIPTION -+The -+.B votequorum_finalize -+function is used to close a connection to the configuration dabatase API. -+Once the connection is finalized, the handle may not be used again by applications. -+No more callbacks will be dispatched from the -+.B votequorum_dispatch function. -+.PP -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+ -+.PP -diff -Naurd corosync-0.92/man/votequorum_getinfo.3 corosync-trunk/man/votequorum_getinfo.3 ---- corosync-0.92/man/votequorum_getinfo.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_getinfo.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,91 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_GETINFO 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_getinfo \- Get information about the VoteQuorum service -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_getinfo(votequorum_handle_t *" handle ", unsigned int " nodeid ", struct votequorum_info *" info "); -+.SH DESCRIPTION -+The -+.B votequorum_getinfo -+function is used to get information about the voteing system and its nodes. -+ -+The votequorum_info structure is defined as follows: -+.PP -+.PP -+.IP -+.RS -+.ne 18 -+.nf -+.ta 4n 20n 32n -+ -+struct votequorum_info { -+ unsigned int node_id; -+ unsigned int node_votes; -+ unsigned int node_expected_votes; -+ unsigned int highest_expected; -+ unsigned int total_votes; -+ unsigned int quorum; -+ unsigned int flags; -+}; -+ -+#define VOTEQUORUM_INFO_FLAG_DIRTY 1 -+#define VOTEQUORUM_INFO_FLAG_DISALLOWED 2 -+#define VOTEQUORUM_INFO_FLAG_TWONODE 4 -+#define VOTEQUORUM_INFO_FLAG_QUORATE 8 -+ -+.ta -+.fi -+.RE -+.IP -+.PP -+.PP -+The members starting node_ hold information specific to the requested nodeid, the other are -+general to the voting system. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH BUGS -+Callbacks are not support at the moment. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_finalize (3), -+.BR votequorum_fd_get (3), -+.BR votequorum_dispatch (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_initialize.3 corosync-trunk/man/votequorum_initialize.3 ---- corosync-0.92/man/votequorum_initialize.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_initialize.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,106 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_INITIALIZE 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_initialize \- Create a new connection to the VoteQuorum service -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_initialize(votequorum_handle_t *" handle ", votequorum_callbacks_t *" callbacks "); -+.SH DESCRIPTION -+The -+.B votequorum_initialize -+function is used to initialize a connection to the vote-based quorum database API. -+.PP -+Each application may have several connections to the votequorum API. Each application -+uses the -+.I handle -+argument to uniquely identify the connection. The -+.I handle -+argument is then used in other function calls to identify the connection to be used -+for communication with the votequorum service. -+.PP -+Every time the voting configuraton changes (eg a node joins or leave the cluster), the callback is called. -+The callback function is described by the following type definitions: -+ -+typedef void (*votequorum_notification_fn_t) ( -+ votequorum_handle_t handle, -+ uint64_t context, -+ uint32_t quorate, -+ uint32_t node_list_entries, -+ votequorum_node_t node_list[] -+ ); -+ -+.ta -+.fi -+.RE -+.IP -+.PP -+.PP -+The -+.I callbacks -+argument is of the type: -+.IP -+.RS -+.ne 18 -+.nf -+.PP -+typedef struct { -+ votequorum_notification_fn_t votequorum_notify_fn; -+} votequorum_callbacks_t; -+ -+.ta -+.fi -+.RE -+.IP -+.PP -+When a configuration change occurs, the callback -+is called from the -+.B votequorum_dispatch() -+function. -+.PP -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH BUGS -+Callbacks are not support at the moment. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_finalize (3), -+.BR votequorum_fd_get (3), -+.BR votequorum_dispatch (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_leaving.3 corosync-trunk/man/votequorum_leaving.3 ---- corosync-0.92/man/votequorum_leaving.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_leaving.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,67 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_LEAVING 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_leaving \- Tell other nodes that we are leaving the cluster -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_leaving(votequorum_handle_t " handle ");" -+.SH DESCRIPTION -+The -+.B votequorum_leaving -+function is used to tell the other nodes in the cluster that this node is leaving. They -+will (when the node actually leaves) reduce quorum to keep the cluster running without -+this node. -+.PP -+This function should only be called if it is known that the node is being shut down for -+a known reason and could be out of the cluster for an extended period of time. -+.PP -+Normal behaviour is for the cluster to reduce the total number of votes, but NOT expected_votes -+when a node leave the cluster, so the cluster could become inquorate. This is correct behaviour -+and is ther eto prevent split-brain. -+.PP -+Do NOT call this function unless you know what you are doing. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_overview.8 corosync-trunk/man/votequorum_overview.8 ---- corosync-0.92/man/votequorum_overview.8 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_overview.8 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,82 @@ -+.\"/* -+.\" * Copyright (c) 2008 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_OVERVIEW 8 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH OVERVIEW -+The votequuorum library is delivered with the corosync project. It is the external interface to -+the vote-based quorum service. This service is optionally loaded into all ndes in a corosync cluster -+to avoid split-brain situations. It does this by having a number of votes assigned to each system -+in the cluster and ensuring that only when a majority of the votes are present, cluster operations are -+allowed to proceed. -+.PP -+The library provides a mechanism to: -+* Query the quorum status -+.PP -+* Get a list of nodes known to the quorum service -+.PP -+* Receive notifications of quorum state changes -+.PP -+* Change the number of votes assigned to a node -+.PP -+* Change the number of expected votes for a cluster to be quorate -+.PP -+* Connect an additional quorum device to allow small clusters to remain quorate during node outages. -+.PP -+.B votequorum -+reads its configuration from the objdb. The following keys are read when it starts up: -+.PP -+* quorum.expected_votes -+.br -+* quorum.votes -+.br -+* quorum.quorumdev_poll -+.br -+* quorum.disallowed -+.br -+* quorum.two_node -+.PP -+Most of those values can be changed while corosync is running with the following exceptions: -+.B quorum.disallowed -+cannot be changed, and -+.B two_node -+cannot be set on-the-fly, though it can be cleared. ie you can start with two nodes in the cluster -+and add a third without rebooting all the nodes. -+.PP -+.SH BUGS -+This software is not yet production, so there may still be some bugs. -+.SH "SEE ALSO" -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_fd_get (3), -+.BR votequorum_dispatch (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_qdisk_getinfo.3 corosync-trunk/man/votequorum_qdisk_getinfo.3 ---- corosync-0.92/man/votequorum_qdisk_getinfo.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_qdisk_getinfo.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,80 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_QDISK_GETINFO 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_qdisk_getinfo \- Get details of the quorum device -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_qdisk_getinfo(votequorum_handle_t " handle ", struct votequorum_qdisk_info " *info ");" -+.SH DESCRIPTION -+The -+.B votequorum_qdisk_getinfo -+Returns information about the quorum device in the following structure: -+.PP -+.PP -+.IP -+.RS -+.ne 18 -+.nf -+.ta 4n 20n 32n -+ -+struct votequorum_qdisk_info { -+ unsigned int votes; -+ unsigned int state; -+ char name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; -+}; -+ -+.ta -+.fi -+.RE -+.IP -+.PP -+.PP -+ -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.BR votequorum_qdisk_poll (3), -+.BR votequorum_qdisk_unregister (3), -+.BR votequorum_qdisk_getinfo (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_qdisk_poll.3 corosync-trunk/man/votequorum_qdisk_poll.3 ---- corosync-0.92/man/votequorum_qdisk_poll.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_qdisk_poll.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,69 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_QDISK_POLL 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_qdisk_poll \- Tells votequorum the result of the quorum device poll -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_qdisk_poll(votequorum_handle_t " handle ", unsigned int " state ");" -+.SH DESCRIPTION -+The -+.B votequorum_qdisk_poll -+is called by the quorum device subsyetem (not provided as part of votequorum) to tell -+the voting system if the qurum device is present/active or not. If -+.B state -+is 1 then the votes for the device are included in the quorum calculation, otherwise not. -+This routine should be called at regular intervals to ensure that the device status -+is always known to votequorum. If -+.B votequorum_qdisk_poll -+is not called after (default) 10 seconds then the device will be deeded to be dead and -+its votes removed from the cluster. This does not unregister the device. -+The default poll time can be changed by setting the object database variable -+quorum.quorumdev_poll. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.BR votequorum_qdisk_poll (3), -+.BR votequorum_qdisk_unregister (3), -+.BR votequorum_qdisk_getinfo (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_qdisk_register.3 corosync-trunk/man/votequorum_qdisk_register.3 ---- corosync-0.92/man/votequorum_qdisk_register.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_qdisk_register.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,68 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_QDISK_REGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_qdisk_register \- Registers a new quorum device -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_qdisk_register(votequorum_handle_t " handle ", char * " name ", unsigned int " votes ");" -+.SH DESCRIPTION -+The -+.B votequorum_qdisk_register -+is used to register a new quorum device. A quorum device is an external way of adding votes to a small -+cluster. The quorum device is, in effect, a pseudo node in the cluster that provide votes based on some -+external device, usually a shared disk partition or perhaps a network router. -+.br -+This call creates the device but does not mark it active. -+.B votequorum_qdisk_poll -+must be called for the votes to be included in the quorum calculation. -+.br -+Note that it is the responsibility of the quorum device subsystem (not provided as part of votequorum) -+to keep all nodes informed of the quorum device status. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.BR votequorum_qdisk_poll (3), -+.BR votequorum_qdisk_unregister (3), -+.BR votequorum_qdisk_getinfo (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_qdisk_unregister.3 corosync-trunk/man/votequorum_qdisk_unregister.3 ---- corosync-0.92/man/votequorum_qdisk_unregister.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_qdisk_unregister.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,60 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_QDISK_UNREGISTER 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_qdisk_unregister \- Unregisters a new quorum device -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_qdisk_unregister(votequorum_handle_t " handle ");" -+.SH DESCRIPTION -+The -+.B votequorum_qdisk_unregister -+unregisters a quorum device. Any votes it had will be removed from the cluster. Not that this could -+make the cluster inquorate. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.BR votequorum_qdisk_poll (3), -+.BR votequorum_qdisk_unregister (3), -+.BR votequorum_qdisk_getinfo (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_setexpected.3 corosync-trunk/man/votequorum_setexpected.3 ---- corosync-0.92/man/votequorum_setexpected.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_setexpected.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,60 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_SETEXPECTED 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_setexpected \- Sets the expected votes for the cluster -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_setexpected(votequorum_handle_t " handle ", int " expected_votes ");" -+.SH DESCRIPTION -+The -+.B votequorum_setexpected -+function is used to change the expected votes in the cluster. Expected votes is used to calculate -+quorum and should normally be the total number of votes that will exist when all the expected nodes -+are joined. Quorum will usually be half of this (rounded up). -+.br -+It is not possible to set expected votes up so that it makes the cluster inquorate using this command. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.PP -diff -Naurd corosync-0.92/man/votequorum_setvotes.3 corosync-trunk/man/votequorum_setvotes.3 ---- corosync-0.92/man/votequorum_setvotes.3 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/man/votequorum_setvotes.3 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,57 @@ -+.\"/* -+.\" * Copyright (c) 2009 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH VOTEQUORUM_VOTES 3 2009-01-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+votequorum_setvotes \- Sets the number of votes for a node -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "int votequorum_setexpected(votequorum_handle_t " handle ", unsigned int " nodeid ", int " votes ");" -+.SH DESCRIPTION -+The -+.B votequorum_setvotes -+is used to change the number of votes that a node has. Note that it is not possible, using this function, -+to change the number of node votes such that the cluster goes inquorate. -+.SH RETURN VALUE -+This call returns the CS_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR votequorum_overview (8), -+.BR votequorum_initialize (3), -+.BR votequorum_finalize (3), -+.BR votequorum_dispatch (3), -+.BR votequorum_fd_get (3), -+.PP -diff -Naurd corosync-0.92/pkgconfig/libtemplate.pc.in corosync-trunk/pkgconfig/libtemplate.pc.in ---- corosync-0.92/pkgconfig/libtemplate.pc.in 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/pkgconfig/libtemplate.pc.in 2009-01-30 19:25:04.000000000 +0100 -@@ -0,0 +1,11 @@ -+prefix=@PREFIX@ -+exec_prefix=${prefix} -+libdir=@LIBDIR@ -+includedir=${prefix}/include -+ -+Name: @LIB@ -+Version: trunk -+Description: @LIB@ -+Requires: -+Libs: -L${libdir} -l@LIB@ -+Cflags: -I${includedir} -diff -Naurd corosync-0.92/pkgconfig/Makefile corosync-trunk/pkgconfig/Makefile ---- corosync-0.92/pkgconfig/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/pkgconfig/Makefile 2009-01-30 19:25:04.000000000 +0100 -@@ -0,0 +1,50 @@ -+# Copyright (c) 2009 Red Hat, Inc. -+# -+# All rights reserved. -+# -+# 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 ENGINES; 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 configuration -+# -+srcdir ?= $(CURDIR)/../ -+subdir ?= pkgconfig -+ -+include $(srcdir)/Makefile.inc -+ -+LIBS = evs cpg cfg coroutil confdb quorum votequorum totem_pg logsys -+ -+all: -+ for i in $(LIBS); do \ -+ cat ${srcdir}/pkgconfig/libtemplate.pc.in | sed \ -+ -e 's#@PREFIX@#$(PREFIX)#g' \ -+ -e 's#@LIBDIR@#$(LIBDIR)#g' \ -+ -e 's#@LIB@#'$${i}'#g' \ -+ > lib$${i}.pc; \ -+ done; -+ -+clean: -+ rm -f *.pc -diff -Naurd corosync-0.92/services/cfg.c corosync-trunk/services/cfg.c ---- corosync-0.92/services/cfg.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/services/cfg.c 2009-01-30 12:56:34.000000000 +0100 -@@ -1,13 +1,13 @@ - /* - * Copyright (c) 2005-2006 MontaVista Software, Inc. -- * Copyright (c) 2006-2008 Red Hat, Inc. -+ * Copyright (c) 2006-2009 Red Hat, Inc. - * - * All rights reserved. - * - * Author: 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: - * -@@ -42,16 +42,18 @@ - #include - #include - #include -+#include - #include - #include - #include - --#include -+#include - #include - #include - #include - #include - #include -+#include - #include - #include - #include -@@ -60,7 +62,31 @@ - LOGSYS_DECLARE_SUBSYS ("CFG", LOG_INFO); - - enum cfg_message_req_types { -- MESSAGE_REQ_EXEC_CFG_RINGREENABLE = 0 -+ MESSAGE_REQ_EXEC_CFG_RINGREENABLE = 0, -+ MESSAGE_REQ_EXEC_CFG_KILLNODE = 1, -+ MESSAGE_REQ_EXEC_CFG_SHUTDOWN = 2 -+}; -+ -+#define DEFAULT_SHUTDOWN_TIMEOUT 5 -+ -+static struct list_head trackers_list; -+ -+/* -+ * Variables controlling a requested shutdown -+ */ -+static corosync_timer_handle_t shutdown_timer; -+static struct cfg_info *shutdown_con; -+static uint32_t shutdown_flags; -+static int shutdown_yes; -+static int shutdown_no; -+static int shutdown_expected; -+ -+struct cfg_info -+{ -+ struct list_head list; -+ void *conn; -+ void *tracker_conn; -+ enum {SHUTDOWN_REPLY_UNKNOWN, SHUTDOWN_REPLY_YES, SHUTDOWN_REPLY_NO} shutdown_reply; - }; - - static void cfg_confchg_fn ( -@@ -82,6 +108,16 @@ - void *message, - unsigned int nodeid); - -+static void message_handler_req_exec_cfg_killnode ( -+ void *message, -+ unsigned int nodeid); -+ -+static void message_handler_req_exec_cfg_shutdown ( -+ void *message, -+ unsigned int nodeid); -+ -+static void exec_cfg_killnode_endian_convert (void *msg); -+ - static void message_handler_req_lib_cfg_ringstatusget ( - void *conn, - void *msg); -@@ -114,6 +150,22 @@ - void *conn, - void *msg); - -+static void message_handler_req_lib_cfg_killnode ( -+ void *conn, -+ void *msg); -+ -+static void message_handler_req_lib_cfg_tryshutdown ( -+ void *conn, -+ void *msg); -+ -+static void message_handler_req_lib_cfg_replytoshutdown ( -+ void *conn, -+ void *msg); -+ -+static void message_handler_req_lib_cfg_get_node_addrs ( -+ void *conn, -+ void *msg); -+ - /* - * Service Handler Definition - */ -@@ -123,56 +175,87 @@ - .lib_handler_fn = message_handler_req_lib_cfg_ringstatusget, - .response_size = sizeof (struct res_lib_cfg_ringstatusget), - .response_id = MESSAGE_RES_CFG_RINGSTATUSGET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 1 */ - .lib_handler_fn = message_handler_req_lib_cfg_ringreenable, - .response_size = sizeof (struct res_lib_cfg_ringreenable), - .response_id = MESSAGE_RES_CFG_RINGREENABLE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 2 */ - .lib_handler_fn = message_handler_req_lib_cfg_statetrack, - .response_size = sizeof (struct res_lib_cfg_statetrack), - .response_id = MESSAGE_RES_CFG_STATETRACKSTART, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 3 */ - .lib_handler_fn = message_handler_req_lib_cfg_statetrackstop, - .response_size = sizeof (struct res_lib_cfg_statetrackstop), - .response_id = MESSAGE_RES_CFG_STATETRACKSTOP, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 4 */ - .lib_handler_fn = message_handler_req_lib_cfg_administrativestateset, - .response_size = sizeof (struct res_lib_cfg_administrativestateset), - .response_id = MESSAGE_RES_CFG_ADMINISTRATIVESTATESET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 5 */ - .lib_handler_fn = message_handler_req_lib_cfg_administrativestateget, - .response_size = sizeof (struct res_lib_cfg_administrativestateget), - .response_id = MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 6 */ - .lib_handler_fn = message_handler_req_lib_cfg_serviceload, - .response_size = sizeof (struct res_lib_cfg_serviceload), - .response_id = MESSAGE_RES_CFG_SERVICELOAD, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 7 */ - .lib_handler_fn = message_handler_req_lib_cfg_serviceunload, - .response_size = sizeof (struct res_lib_cfg_serviceunload), - .response_id = MESSAGE_RES_CFG_SERVICEUNLOAD, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 8 */ -+ .lib_handler_fn = message_handler_req_lib_cfg_killnode, -+ .response_size = sizeof (struct res_lib_cfg_killnode), -+ .response_id = MESSAGE_RES_CFG_KILLNODE, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 9 */ -+ .lib_handler_fn = message_handler_req_lib_cfg_tryshutdown, -+ .response_size = sizeof (struct res_lib_cfg_tryshutdown), -+ .response_id = MESSAGE_RES_CFG_TRYSHUTDOWN, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 10 */ -+ .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown, -+ .response_size = 0, -+ .response_id = 0, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 11 */ -+ .lib_handler_fn = message_handler_req_lib_cfg_get_node_addrs, -+ .response_size = sizeof (struct res_lib_cfg_get_node_addrs), -+ .response_id = MESSAGE_RES_CFG_GET_NODE_ADDRS, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - } - }; - - static struct corosync_exec_handler cfg_exec_engine[] = - { -- { -- message_handler_req_exec_cfg_ringreenable -+ { /* 0 */ -+ .exec_handler_fn = message_handler_req_exec_cfg_ringreenable, -+ }, -+ { /* 1 */ -+ .exec_handler_fn = message_handler_req_exec_cfg_killnode, -+ .exec_endian_convert_fn = exec_cfg_killnode_endian_convert -+ }, -+ { /* 2 */ -+ .exec_handler_fn = message_handler_req_exec_cfg_shutdown, - } - }; - -@@ -182,8 +265,9 @@ - struct corosync_service_engine cfg_service_engine = { - .name = "corosync configuration service", - .id = CFG_SERVICE, -- .private_data_size = 0, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED, -+ .private_data_size = sizeof(struct cfg_info), -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED, -+ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, - .lib_init_fn = cfg_lib_init_fn, - .lib_exit_fn = cfg_lib_exit_fn, - .lib_engine = cfg_lib_engine, -@@ -238,12 +322,24 @@ - mar_message_source_t source __attribute__((aligned(8))); - }; - -+struct req_exec_cfg_killnode { -+ mar_req_header_t header __attribute__((aligned(8))); -+ mar_uint32_t nodeid __attribute__((aligned(8))); -+ mar_name_t reason __attribute__((aligned(8))); -+}; -+ -+struct req_exec_cfg_shutdown { -+ mar_req_header_t header __attribute__((aligned(8))); -+}; -+ - /* IMPL */ - - static int cfg_exec_init_fn ( - struct corosync_api_v1 *corosync_api_v1) - { - api = corosync_api_v1; -+ -+ list_init(&trackers_list); - return (0); - } - -@@ -256,16 +352,193 @@ - { - } - -+/* -+ * Tell other nodes we are shutting down -+ */ -+static int send_shutdown() -+{ -+ struct req_exec_cfg_shutdown req_exec_cfg_shutdown; -+ struct iovec iovec; -+ -+ ENTER(); -+ req_exec_cfg_shutdown.header.size = -+ sizeof (struct req_exec_cfg_shutdown); -+ req_exec_cfg_shutdown.header.id = SERVICE_ID_MAKE (CFG_SERVICE, -+ MESSAGE_REQ_EXEC_CFG_SHUTDOWN); -+ -+ iovec.iov_base = (char *)&req_exec_cfg_shutdown; -+ iovec.iov_len = sizeof (struct req_exec_cfg_shutdown); -+ -+ assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0); -+ -+ LEAVE(); -+ return 0; -+} -+ -+static void send_test_shutdown(void * conn, int status) -+{ -+ struct res_lib_cfg_testshutdown res_lib_cfg_testshutdown; -+ struct list_head *iter; -+ -+ ENTER(); -+ res_lib_cfg_testshutdown.header.size = sizeof(struct res_lib_cfg_testshutdown); -+ res_lib_cfg_testshutdown.header.id = MESSAGE_RES_CFG_TESTSHUTDOWN; -+ res_lib_cfg_testshutdown.header.error = status; -+ res_lib_cfg_testshutdown.flags = shutdown_flags; -+ -+ if (conn) { -+ TRACE1("sending testshutdown to %p", conn); -+ api->ipc_conn_send_response(conn, &res_lib_cfg_testshutdown, -+ sizeof(res_lib_cfg_testshutdown)); -+ } else { -+ for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { -+ struct cfg_info *ci = list_entry(iter, struct cfg_info, list); -+ -+ TRACE1("sending testshutdown to %p", ci->tracker_conn); -+ api->ipc_conn_send_response(ci->tracker_conn, &res_lib_cfg_testshutdown, -+ sizeof(res_lib_cfg_testshutdown)); -+ } -+ } -+ LEAVE(); -+} -+ -+static void check_shutdown_status() -+{ -+ ENTER(); -+ -+ /* -+ * Shutdown client might have gone away -+ */ -+ if (!shutdown_con) { -+ LEAVE(); -+ return; -+ } -+ -+ /* -+ * All replies safely gathered in ? -+ */ -+ if (shutdown_yes + shutdown_no >= shutdown_expected) { -+ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; -+ -+ api->timer_delete(shutdown_timer); -+ -+ if (shutdown_yes >= shutdown_expected || -+ shutdown_flags == CFG_SHUTDOWN_FLAG_REGARDLESS) { -+ TRACE1("shutdown confirmed"); -+ -+ /* -+ * Tell other nodes we are going down -+ */ -+ send_shutdown(); -+ -+ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); -+ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; -+ res_lib_cfg_tryshutdown.header.error = CS_OK; -+ -+ /* -+ * Tell originator that shutdown was confirmed -+ */ -+ api->ipc_conn_send_response(shutdown_con->conn, &res_lib_cfg_tryshutdown, -+ sizeof(res_lib_cfg_tryshutdown)); -+ shutdown_con = NULL; -+ } -+ else { -+ -+ TRACE1("shutdown cancelled"); -+ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); -+ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; -+ res_lib_cfg_tryshutdown.header.error = CS_ERR_BUSY; -+ -+ /* -+ * Tell originator that shutdown was cancelled -+ */ -+ api->ipc_conn_send_response(shutdown_con->conn, &res_lib_cfg_tryshutdown, -+ sizeof(res_lib_cfg_tryshutdown)); -+ shutdown_con = NULL; -+ } -+ -+ log_printf(LOG_DEBUG, "shutdown decision is: (yes count: %d, no count: %d) flags=%x\n", shutdown_yes, shutdown_no, shutdown_flags); -+ } -+ LEAVE(); -+} -+ -+ -+/* -+ * Not all nodes responded to the shutdown (in time) -+ */ -+static void shutdown_timer_fn(void *arg) -+{ -+ ENTER(); -+ -+ /* -+ * Mark undecideds as "NO" -+ */ -+ shutdown_no = shutdown_expected; -+ check_shutdown_status(); -+ -+ send_test_shutdown(NULL, CS_ERR_TIMEOUT); -+ LEAVE(); -+} -+ -+static void remove_ci_from_shutdown(struct cfg_info *ci) -+{ -+ ENTER(); -+ -+ /* -+ * If the controlling shutdown process has quit, then cancel the -+ * shutdown session -+ */ -+ if (ci == shutdown_con) { -+ shutdown_con = NULL; -+ api->timer_delete(shutdown_timer); -+ } -+ -+ if (!list_empty(&ci->list)) { -+ list_del(&ci->list); -+ list_init(&ci->list); -+ -+ /* -+ * Remove our option -+ */ -+ if (shutdown_con) { -+ if (ci->shutdown_reply == SHUTDOWN_REPLY_YES) -+ shutdown_yes--; -+ if (ci->shutdown_reply == SHUTDOWN_REPLY_NO) -+ shutdown_no--; -+ } -+ -+ /* -+ * If we are leaving, then that's an implicit YES to shutdown -+ */ -+ ci->shutdown_reply = SHUTDOWN_REPLY_YES; -+ shutdown_yes++; -+ -+ check_shutdown_status(); -+ } -+ LEAVE(); -+} -+ -+ - int cfg_lib_exit_fn (void *conn) - { -+ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); -+ -+ ENTER(); -+ if (!list_empty(&ci->list)) { -+ list_del(&ci->list); -+ remove_ci_from_shutdown(ci); -+ } -+ LEAVE(); - return (0); - } - - static int cfg_lib_init_fn (void *conn) - { -- -- ENTER(""); -- LEAVE(""); -+ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); -+ -+ ENTER(); -+ list_init(&ci->list); -+ LEAVE(); - - return (0); - } -@@ -281,18 +554,64 @@ - (struct req_exec_cfg_ringreenable *)message; - struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable; - -- ENTER(""); -+ ENTER(); - api->totem_ring_reenable (); - if (api->ipc_source_is_local(&req_exec_cfg_ringreenable->source)) { - res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE; - res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable); -- res_lib_cfg_ringreenable.header.error = SA_AIS_OK; -+ res_lib_cfg_ringreenable.header.error = CS_OK; - api->ipc_conn_send_response ( - req_exec_cfg_ringreenable->source.conn, - &res_lib_cfg_ringreenable, - sizeof (struct res_lib_cfg_ringreenable)); - } -- LEAVE(""); -+ LEAVE(); -+} -+ -+static void exec_cfg_killnode_endian_convert (void *msg) -+{ -+ struct req_exec_cfg_killnode *req_exec_cfg_killnode = -+ (struct req_exec_cfg_killnode *)msg; -+ ENTER(); -+ -+ swab_mar_name_t(&req_exec_cfg_killnode->reason); -+ LEAVE(); -+} -+ -+ -+static void message_handler_req_exec_cfg_killnode ( -+ void *message, -+ unsigned int nodeid) -+{ -+ struct req_exec_cfg_killnode *req_exec_cfg_killnode = -+ (struct req_exec_cfg_killnode *)message; -+ cs_name_t reason; -+ -+ ENTER(); -+ log_printf(LOG_DEBUG, "request to kill node %d(us=%d): %s\n", req_exec_cfg_killnode->nodeid, api->totem_nodeid_get(), reason.value); -+ if (req_exec_cfg_killnode->nodeid == api->totem_nodeid_get()) { -+ marshall_from_mar_name_t(&reason, &req_exec_cfg_killnode->reason); -+ log_printf(LOG_NOTICE, "Killed by node %d: %s\n", -+ nodeid, reason.value); -+ corosync_fatal_error(COROSYNC_FATAL_ERROR_EXIT); -+ } -+ LEAVE(); -+} -+ -+/* -+ * Self shutdown -+ */ -+static void message_handler_req_exec_cfg_shutdown ( -+ void *message, -+ unsigned int nodeid) -+{ -+ ENTER(); -+ -+ log_printf(LOG_NOTICE, "Node %d was shut down by sysadmin\n", nodeid); -+ if (nodeid == api->totem_nodeid_get()) { -+ corosync_fatal_error(COROSYNC_FATAL_ERROR_EXIT); -+ } -+ LEAVE(); - } - - -@@ -310,11 +629,11 @@ - char *totem_ip_string; - unsigned int i; - -- ENTER(""); -+ ENTER(); - - res_lib_cfg_ringstatusget.header.id = MESSAGE_RES_CFG_RINGSTATUSGET; - res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget); -- res_lib_cfg_ringstatusget.header.error = SA_AIS_OK; -+ res_lib_cfg_ringstatusget.header.error = CS_OK; - - api->totem_ifaces_get ( - api->totem_nodeid_get(), -@@ -336,7 +655,7 @@ - &res_lib_cfg_ringstatusget, - sizeof (struct res_lib_cfg_ringstatusget)); - -- LEAVE(""); -+ LEAVE(); - } - - static void message_handler_req_lib_cfg_ringreenable ( -@@ -346,7 +665,7 @@ - struct req_exec_cfg_ringreenable req_exec_cfg_ringreenable; - struct iovec iovec; - -- ENTER(""); -+ ENTER(); - req_exec_cfg_ringreenable.header.size = - sizeof (struct req_exec_cfg_ringreenable); - req_exec_cfg_ringreenable.header.id = SERVICE_ID_MAKE (CFG_SERVICE, -@@ -358,27 +677,56 @@ - - assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0); - -- LEAVE(""); -+ LEAVE(); - } - - static void message_handler_req_lib_cfg_statetrack ( - void *conn, - void *msg) - { -+ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); - // struct req_lib_cfg_statetrack *req_lib_cfg_statetrack = (struct req_lib_cfg_statetrack *)message; -+ struct res_lib_cfg_statetrack res_lib_cfg_statetrack; - -- ENTER(""); -- LEAVE(""); -+ ENTER(); -+ -+ /* -+ * We only do shutdown tracking at the moment -+ */ -+ if (list_empty(&ci->list)) { -+ list_add(&ci->list, &trackers_list); -+ ci->tracker_conn = api->ipc_conn_partner_get (conn); -+ -+ if (shutdown_con) { -+ /* -+ * Shutdown already in progress, ask the newcomer's opinion -+ */ -+ ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; -+ shutdown_expected++; -+ send_test_shutdown(ci->tracker_conn, CS_OK); -+ } -+ } -+ -+ res_lib_cfg_statetrack.header.size = sizeof(struct res_lib_cfg_statetrack); -+ res_lib_cfg_statetrack.header.id = MESSAGE_RES_CFG_STATETRACKSTART; -+ res_lib_cfg_statetrack.header.error = CS_OK; -+ -+ api->ipc_conn_send_response(conn, &res_lib_cfg_statetrack, -+ sizeof(res_lib_cfg_statetrack)); -+ -+ LEAVE(); - } - - static void message_handler_req_lib_cfg_statetrackstop ( - void *conn, - void *msg) - { -+ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); - // struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message; - -- ENTER(""); -- LEAVE(""); -+ ENTER(); -+ remove_ci_from_shutdown(ci); -+ LEAVE(); - } - - static void message_handler_req_lib_cfg_administrativestateset ( -@@ -386,16 +734,17 @@ - void *msg) - { - // struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message; -- ENTER(""); -- LEAVE(""); -+ -+ ENTER(); -+ LEAVE(); - } - static void message_handler_req_lib_cfg_administrativestateget ( - void *conn, - void *msg) - { - // struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message; -- ENTER(""); -- LEAVE(""); -+ ENTER(); -+ LEAVE(); - } - - static void message_handler_req_lib_cfg_serviceload ( -@@ -406,7 +755,7 @@ - (struct req_lib_cfg_serviceload *)msg; - struct res_lib_cfg_serviceload res_lib_cfg_serviceload; - -- ENTER(""); -+ ENTER(); - api->service_link_and_init ( - api, - (char *)req_lib_cfg_serviceload->service_name, -@@ -414,12 +763,12 @@ - - res_lib_cfg_serviceload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD; - res_lib_cfg_serviceload.header.size = sizeof (struct res_lib_cfg_serviceload); -- res_lib_cfg_serviceload.header.error = SA_AIS_OK; -+ res_lib_cfg_serviceload.header.error = CS_OK; - api->ipc_conn_send_response ( - conn, - &res_lib_cfg_serviceload, - sizeof (struct res_lib_cfg_serviceload)); -- LEAVE(""); -+ LEAVE(); - } - - static void message_handler_req_lib_cfg_serviceunload ( -@@ -430,17 +779,225 @@ - (struct req_lib_cfg_serviceunload *)msg; - struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload; - -- ENTER(""); -+ ENTER(); - api->service_unlink_and_exit ( - api, - (char *)req_lib_cfg_serviceunload->service_name, - req_lib_cfg_serviceunload->service_ver); - res_lib_cfg_serviceunload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD; - res_lib_cfg_serviceunload.header.size = sizeof (struct res_lib_cfg_serviceunload); -- res_lib_cfg_serviceunload.header.error = SA_AIS_OK; -+ res_lib_cfg_serviceunload.header.error = CS_OK; - api->ipc_conn_send_response ( - conn, - &res_lib_cfg_serviceunload, - sizeof (struct res_lib_cfg_serviceunload)); -- LEAVE(""); -+ LEAVE(); -+} -+ -+ -+static void message_handler_req_lib_cfg_killnode ( -+ void *conn, -+ void *msg) -+{ -+ struct req_lib_cfg_killnode *req_lib_cfg_killnode = (struct req_lib_cfg_killnode *)msg; -+ struct res_lib_cfg_killnode res_lib_cfg_killnode; -+ struct req_exec_cfg_killnode req_exec_cfg_killnode; -+ struct iovec iovec; -+ int res; -+ -+ ENTER(); -+ req_exec_cfg_killnode.header.size = -+ sizeof (struct req_exec_cfg_killnode); -+ req_exec_cfg_killnode.header.id = SERVICE_ID_MAKE (CFG_SERVICE, -+ MESSAGE_REQ_EXEC_CFG_KILLNODE); -+ req_exec_cfg_killnode.nodeid = req_lib_cfg_killnode->nodeid; -+ marshall_to_mar_name_t(&req_exec_cfg_killnode.reason, &req_lib_cfg_killnode->reason); -+ -+ iovec.iov_base = (char *)&req_exec_cfg_killnode; -+ iovec.iov_len = sizeof (struct req_exec_cfg_killnode); -+ -+ res = api->totem_mcast (&iovec, 1, TOTEM_SAFE); -+ -+ res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode); -+ res_lib_cfg_killnode.header.id = MESSAGE_RES_CFG_KILLNODE; -+ res_lib_cfg_killnode.header.error = CS_OK; -+ -+ api->ipc_conn_send_response(conn, &res_lib_cfg_killnode, -+ sizeof(res_lib_cfg_killnode)); -+ -+ LEAVE(); -+} -+ -+ -+static void message_handler_req_lib_cfg_tryshutdown ( -+ void *conn, -+ void *msg) -+{ -+ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); -+ struct req_lib_cfg_tryshutdown *req_lib_cfg_tryshutdown = (struct req_lib_cfg_tryshutdown *)msg; -+ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; -+ struct list_head *iter; -+ -+ ENTER(); -+ -+ if (req_lib_cfg_tryshutdown->flags == CFG_SHUTDOWN_FLAG_IMMEDIATE) { -+ -+ /* -+ * Tell other nodes -+ */ -+ send_shutdown(); -+ -+ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); -+ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; -+ res_lib_cfg_tryshutdown.header.error = CS_OK; -+ api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown, -+ sizeof(res_lib_cfg_tryshutdown)); -+ -+ LEAVE(); -+ return; -+ } -+ -+ /* -+ * Shutdown in progress, return an error -+ */ -+ if (shutdown_con) { -+ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; -+ -+ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); -+ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; -+ res_lib_cfg_tryshutdown.header.error = CS_ERR_EXIST; -+ -+ api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown, -+ sizeof(res_lib_cfg_tryshutdown)); -+ -+ -+ LEAVE(); -+ -+ return; -+ } -+ -+ ci->conn = conn; -+ shutdown_con = (struct cfg_info *)api->ipc_private_data_get (conn); -+ shutdown_flags = req_lib_cfg_tryshutdown->flags; -+ shutdown_yes = 0; -+ shutdown_no = 0; -+ -+ /* -+ * Count the number of listeners -+ */ -+ shutdown_expected = 0; -+ -+ for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { -+ struct cfg_info *ci = list_entry(iter, struct cfg_info, list); -+ ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; -+ shutdown_expected++; -+ } -+ -+ /* -+ * If no-one is listening for events then we can just go down now -+ */ -+ if (shutdown_expected == 0) { -+ send_shutdown(); -+ LEAVE(); -+ return; -+ } -+ else { -+ unsigned int cfg_handle; -+ unsigned int find_handle; -+ char *timeout_str; -+ unsigned int shutdown_timeout = DEFAULT_SHUTDOWN_TIMEOUT; -+ -+ /* -+ * Look for a shutdown timeout in objdb -+ */ -+ api->object_find_create(OBJECT_PARENT_HANDLE, "cfg", strlen("cfg"), &find_handle); -+ api->object_find_next(find_handle, &cfg_handle); -+ api->object_find_destroy(find_handle); -+ -+ if (cfg_handle) { -+ if ( !api->object_key_get(cfg_handle, -+ "shutdown_timeout", -+ strlen("shutdown_timeout"), -+ (void *)&timeout_str, -+ NULL)) { -+ shutdown_timeout = atoi(timeout_str); -+ } -+ } -+ -+ /* -+ * Start the timer. If we don't get a full set of replies before this goes -+ * off we'll cancel the shutdown -+ */ -+ api->timer_add_duration((unsigned long long)shutdown_timeout*1000000000, NULL, -+ shutdown_timer_fn, &shutdown_timer); -+ -+ /* -+ * Tell the users we would like to shut down -+ */ -+ send_test_shutdown(NULL, CS_OK); -+ } -+ -+ /* -+ * We don't sent a reply to the caller here. -+ * We send it when we know if we can shut down or not -+ */ -+ -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_cfg_replytoshutdown ( -+ void *conn, -+ void *msg) -+{ -+ struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); -+ struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = (struct req_lib_cfg_replytoshutdown *)msg; -+ -+ ENTER(); -+ if (!shutdown_con) { -+ LEAVE(); -+ return; -+ } -+ -+ if (req_lib_cfg_replytoshutdown->response) { -+ shutdown_yes++; -+ ci->shutdown_reply = SHUTDOWN_REPLY_YES; -+ } -+ else { -+ shutdown_no++; -+ ci->shutdown_reply = SHUTDOWN_REPLY_NO; -+ } -+ check_shutdown_status(); -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_cfg_get_node_addrs (void *conn, void *msg) -+{ -+ struct totem_ip_address node_ifs[INTERFACE_MAX]; -+ char buf[PIPE_BUF]; -+ char **status; -+ unsigned int num_interfaces = 0; -+ int ret = CS_OK; -+ int i; -+ struct req_lib_cfg_get_node_addrs *req_lib_cfg_get_node_addrs = (struct req_lib_cfg_get_node_addrs *)msg; -+ struct res_lib_cfg_get_node_addrs *res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf; -+ -+ if (req_lib_cfg_get_node_addrs->nodeid == 0) -+ req_lib_cfg_get_node_addrs->nodeid = api->totem_nodeid_get(); -+ -+ api->totem_ifaces_get(req_lib_cfg_get_node_addrs->nodeid, node_ifs, &status, &num_interfaces); -+ -+ res_lib_cfg_get_node_addrs->header.size = sizeof(struct res_lib_cfg_get_node_addrs) + (num_interfaces * TOTEMIP_ADDRLEN); -+ res_lib_cfg_get_node_addrs->header.id = MESSAGE_RES_CFG_GET_NODE_ADDRS; -+ res_lib_cfg_get_node_addrs->header.error = ret; -+ res_lib_cfg_get_node_addrs->num_addrs = num_interfaces; -+ if (num_interfaces) { -+ res_lib_cfg_get_node_addrs->family = node_ifs[0].family; -+ for (i = 0; iaddrs[i][0], node_ifs[i].addr, TOTEMIP_ADDRLEN); -+ } -+ } -+ else { -+ res_lib_cfg_get_node_addrs->header.error = CS_ERR_NOT_EXIST; -+ } -+ api->ipc_conn_send_response(conn, res_lib_cfg_get_node_addrs, res_lib_cfg_get_node_addrs->header.size); - } -diff -Naurd corosync-0.92/services/confdb.c corosync-trunk/services/confdb.c ---- corosync-0.92/services/confdb.c 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/services/confdb.c 2009-01-23 16:41:06.000000000 +0100 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2008 Red Hat, Inc. -+ * Copyright (c) 2008-2009 Red Hat, Inc. - * - * All rights reserved. - * -@@ -38,7 +38,7 @@ - #include - #include - --#include -+#include - #include - #include - #include -@@ -106,103 +106,103 @@ - .lib_handler_fn = message_handler_req_lib_confdb_object_create, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_OBJECT_CREATE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 1 */ - .lib_handler_fn = message_handler_req_lib_confdb_object_destroy, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_OBJECT_DESTROY, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 2 */ - .lib_handler_fn = message_handler_req_lib_confdb_object_find, - .response_size = sizeof (struct res_lib_confdb_object_find), - .response_id = MESSAGE_RES_CONFDB_OBJECT_FIND, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 3 */ - .lib_handler_fn = message_handler_req_lib_confdb_key_create, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_KEY_CREATE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 4 */ - .lib_handler_fn = message_handler_req_lib_confdb_key_get, - .response_size = sizeof (struct res_lib_confdb_key_get), - .response_id = MESSAGE_RES_CONFDB_KEY_GET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 5 */ - .lib_handler_fn = message_handler_req_lib_confdb_key_replace, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_KEY_REPLACE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 6 */ - .lib_handler_fn = message_handler_req_lib_confdb_key_delete, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_KEY_DELETE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 7 */ - .lib_handler_fn = message_handler_req_lib_confdb_object_iter, - .response_size = sizeof (struct res_lib_confdb_object_iter), - .response_id = MESSAGE_RES_CONFDB_OBJECT_ITER, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 8 */ - .lib_handler_fn = message_handler_req_lib_confdb_object_parent_get, - .response_size = sizeof (struct res_lib_confdb_object_parent_get), - .response_id = MESSAGE_RES_CONFDB_OBJECT_PARENT_GET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 9 */ - .lib_handler_fn = message_handler_req_lib_confdb_key_iter, - .response_size = sizeof (struct res_lib_confdb_key_iter), - .response_id = MESSAGE_RES_CONFDB_KEY_ITER, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 10 */ - .lib_handler_fn = message_handler_req_lib_confdb_track_start, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_TRACK_START, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 11 */ - .lib_handler_fn = message_handler_req_lib_confdb_track_stop, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_TRACK_STOP, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 12 */ - .lib_handler_fn = message_handler_req_lib_confdb_write, - .response_size = sizeof (struct res_lib_confdb_write), - .response_id = MESSAGE_RES_CONFDB_WRITE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 13 */ - .lib_handler_fn = message_handler_req_lib_confdb_reload, - .response_size = sizeof (struct res_lib_confdb_reload), - .response_id = MESSAGE_RES_CONFDB_RELOAD, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 14 */ - .lib_handler_fn = message_handler_req_lib_confdb_object_find_destroy, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CONFDB_OBJECT_FIND_DESTROY, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 15 */ - .lib_handler_fn = message_handler_req_lib_confdb_key_increment, - .response_size = sizeof (struct res_lib_confdb_key_incdec), - .response_id = MESSAGE_RES_CONFDB_KEY_INCREMENT, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 16 */ - .lib_handler_fn = message_handler_req_lib_confdb_key_decrement, - .response_size = sizeof (struct res_lib_confdb_key_incdec), - .response_id = MESSAGE_RES_CONFDB_KEY_DECREMENT, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - }; - -@@ -211,7 +211,8 @@ - .name = "corosync cluster config database access v1.01", - .id = CONFDB_SERVICE, - .private_data_size = 0, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED, -+ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, - .lib_init_fn = confdb_lib_init_fn, - .lib_exit_fn = confdb_lib_exit_fn, - .lib_engine = confdb_lib_engine, -@@ -279,6 +280,7 @@ - api->object_track_stop(confdb_notify_lib_of_key_change, - confdb_notify_lib_of_new_object, - confdb_notify_lib_of_destroyed_object, -+ NULL, - api->ipc_conn_partner_get (conn)); - return (0); - } -@@ -288,13 +290,13 @@ - struct req_lib_confdb_object_create *req_lib_confdb_object_create = (struct req_lib_confdb_object_create *)message; - struct res_lib_confdb_object_create res_lib_confdb_object_create; - unsigned int object_handle; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_create(req_lib_confdb_object_create->parent_object_handle, - &object_handle, - req_lib_confdb_object_create->object_name.value, - req_lib_confdb_object_create->object_name.length)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res_lib_confdb_object_create.object_handle = object_handle; - res_lib_confdb_object_create.header.size = sizeof(res_lib_confdb_object_create); -@@ -307,10 +309,10 @@ - { - struct req_lib_confdb_object_destroy *req_lib_confdb_object_destroy = (struct req_lib_confdb_object_destroy *)message; - mar_res_header_t res; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_destroy(req_lib_confdb_object_destroy->object_handle)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res.size = sizeof(res); - res.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY; -@@ -322,12 +324,10 @@ - { - struct req_lib_confdb_object_find_destroy *req_lib_confdb_object_find_destroy = (struct req_lib_confdb_object_find_destroy *)message; - mar_res_header_t res; -- int ret = SA_AIS_OK; -- -- log_printf(LOG_LEVEL_DEBUG, "object_find_destroy for conn=%p, %d\n", conn, req_lib_confdb_object_find_destroy->find_handle); -+ int ret = CS_OK; - - if (api->object_find_destroy(req_lib_confdb_object_find_destroy->find_handle)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res.size = sizeof(res); - res.id = MESSAGE_RES_CONFDB_OBJECT_FIND_DESTROY; -@@ -340,14 +340,14 @@ - { - struct req_lib_confdb_key_create *req_lib_confdb_key_create = (struct req_lib_confdb_key_create *)message; - mar_res_header_t res; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_key_create(req_lib_confdb_key_create->object_handle, - req_lib_confdb_key_create->key_name.value, - req_lib_confdb_key_create->key_name.length, - req_lib_confdb_key_create->value.value, - req_lib_confdb_key_create->value.length)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res.size = sizeof(res); - res.id = MESSAGE_RES_CONFDB_KEY_CREATE; -@@ -361,14 +361,14 @@ - struct res_lib_confdb_key_get res_lib_confdb_key_get; - int value_len; - void *value; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_key_get(req_lib_confdb_key_get->parent_object_handle, - req_lib_confdb_key_get->key_name.value, - req_lib_confdb_key_get->key_name.length, - &value, - &value_len)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - else { - memcpy(res_lib_confdb_key_get.value.value, value, value_len); - res_lib_confdb_key_get.value.length = value_len; -@@ -384,15 +384,13 @@ - { - struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message; - struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; -- int value_len; -- void *value; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_key_increment(req_lib_confdb_key_get->parent_object_handle, - req_lib_confdb_key_get->key_name.value, - req_lib_confdb_key_get->key_name.length, - &res_lib_confdb_key_incdec.value)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec); - res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_INCREMENT; -@@ -404,15 +402,13 @@ - { - struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message; - struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec; -- int value_len; -- void *value; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_key_decrement(req_lib_confdb_key_get->parent_object_handle, - req_lib_confdb_key_get->key_name.value, - req_lib_confdb_key_get->key_name.length, - &res_lib_confdb_key_incdec.value)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec); - res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_DECREMENT; -@@ -424,7 +420,7 @@ - { - struct req_lib_confdb_key_replace *req_lib_confdb_key_replace = (struct req_lib_confdb_key_replace *)message; - mar_res_header_t res; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_key_replace(req_lib_confdb_key_replace->object_handle, - req_lib_confdb_key_replace->key_name.value, -@@ -433,7 +429,7 @@ - req_lib_confdb_key_replace->old_value.length, - req_lib_confdb_key_replace->new_value.value, - req_lib_confdb_key_replace->new_value.length)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res.size = sizeof(res); - res.id = MESSAGE_RES_CONFDB_KEY_REPLACE; -@@ -445,14 +441,14 @@ - { - struct req_lib_confdb_key_delete *req_lib_confdb_key_delete = (struct req_lib_confdb_key_delete *)message; - mar_res_header_t res; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_key_delete(req_lib_confdb_key_delete->object_handle, - req_lib_confdb_key_delete->key_name.value, - req_lib_confdb_key_delete->key_name.length, - req_lib_confdb_key_delete->value.value, - req_lib_confdb_key_delete->value.length)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res.size = sizeof(res); - res.id = MESSAGE_RES_CONFDB_KEY_DELETE; -@@ -465,11 +461,11 @@ - struct req_lib_confdb_object_parent_get *req_lib_confdb_object_parent_get = (struct req_lib_confdb_object_parent_get *)message; - struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get; - unsigned int object_handle; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_parent_get(req_lib_confdb_object_parent_get->object_handle, - &object_handle)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res_lib_confdb_object_parent_get.parent_object_handle = object_handle; - res_lib_confdb_object_parent_get.header.size = sizeof(res_lib_confdb_object_parent_get); -@@ -487,7 +483,7 @@ - int key_name_len; - void *value; - int value_len; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (api->object_key_iter_from(req_lib_confdb_key_iter->parent_object_handle, - req_lib_confdb_key_iter->next_entry, -@@ -495,7 +491,7 @@ - &key_name_len, - &value, - &value_len)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - else { - memcpy(res_lib_confdb_key_iter.key_name.value, key_name, key_name_len); - memcpy(res_lib_confdb_key_iter.value.value, value, value_len); -@@ -514,7 +510,7 @@ - struct req_lib_confdb_object_iter *req_lib_confdb_object_iter = (struct req_lib_confdb_object_iter *)message; - struct res_lib_confdb_object_iter res_lib_confdb_object_iter; - int object_name_len; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (!req_lib_confdb_object_iter->find_handle) { - api->object_find_create(req_lib_confdb_object_iter->parent_object_handle, -@@ -525,8 +521,10 @@ - res_lib_confdb_object_iter.find_handle = req_lib_confdb_object_iter->find_handle; - - if (api->object_find_next(res_lib_confdb_object_iter.find_handle, -- &res_lib_confdb_object_iter.object_handle)) -- ret = SA_AIS_ERR_ACCESS; -+ &res_lib_confdb_object_iter.object_handle)) { -+ ret = CS_ERR_ACCESS; -+ api->object_find_destroy(res_lib_confdb_object_iter.find_handle); -+ } - else { - api->object_name_get(res_lib_confdb_object_iter.object_handle, - (char *)res_lib_confdb_object_iter.object_name.value, -@@ -545,7 +543,7 @@ - { - struct req_lib_confdb_object_find *req_lib_confdb_object_find = (struct req_lib_confdb_object_find *)message; - struct res_lib_confdb_object_find res_lib_confdb_object_find; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - - if (!req_lib_confdb_object_find->find_handle) { - api->object_find_create(req_lib_confdb_object_find->parent_object_handle, -@@ -557,8 +555,10 @@ - res_lib_confdb_object_find.find_handle = req_lib_confdb_object_find->find_handle; - - if (api->object_find_next(res_lib_confdb_object_find.find_handle, -- &res_lib_confdb_object_find.object_handle)) -- ret = SA_AIS_ERR_ACCESS; -+ &res_lib_confdb_object_find.object_handle)) { -+ ret = CS_ERR_ACCESS; -+ api->object_find_destroy(res_lib_confdb_object_find.find_handle); -+ } - - res_lib_confdb_object_find.header.size = sizeof(res_lib_confdb_object_find); - res_lib_confdb_object_find.header.id = MESSAGE_RES_CONFDB_OBJECT_FIND; -@@ -571,11 +571,11 @@ - static void message_handler_req_lib_confdb_write (void *conn, void *message) - { - struct res_lib_confdb_write res_lib_confdb_write; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - char *error_string = NULL; - - if (api->object_write_config(&error_string)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res_lib_confdb_write.header.size = sizeof(res_lib_confdb_write); - res_lib_confdb_write.header.id = MESSAGE_RES_CONFDB_WRITE; -@@ -593,11 +593,11 @@ - { - struct req_lib_confdb_reload *req_lib_confdb_reload = (struct req_lib_confdb_reload *)message; - struct res_lib_confdb_reload res_lib_confdb_reload; -- int ret = SA_AIS_OK; -+ int ret = CS_OK; - char *error_string = NULL; - - if (api->object_reload_config(req_lib_confdb_reload->flush, &error_string)) -- ret = SA_AIS_ERR_ACCESS; -+ ret = CS_ERR_ACCESS; - - res_lib_confdb_reload.header.size = sizeof(res_lib_confdb_reload); - res_lib_confdb_reload.header.id = MESSAGE_RES_CONFDB_RELOAD; -@@ -624,7 +624,7 @@ - - res.header.size = sizeof(res); - res.header.id = MESSAGE_RES_CONFDB_KEY_CHANGE_CALLBACK; -- res.header.error = SA_AIS_OK; -+ res.header.error = CS_OK; - // handle & type - res.change_type = change_type; - res.parent_object_handle = parent_object_handle; -@@ -651,7 +651,7 @@ - - res.header.size = sizeof(res); - res.header.id = MESSAGE_RES_CONFDB_OBJECT_CREATE_CALLBACK; -- res.header.error = SA_AIS_OK; -+ res.header.error = CS_OK; - res.parent_object_handle = parent_object_handle; - res.object_handle = object_handle; - memcpy(res.name.value, name_pt, name_len); -@@ -668,7 +668,7 @@ - - res.header.size = sizeof(res); - res.header.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY_CALLBACK; -- res.header.error = SA_AIS_OK; -+ res.header.error = CS_OK; - res.parent_object_handle = parent_object_handle; - memcpy(res.name.value, name_pt, name_len); - res.name.length = name_len; -@@ -686,10 +686,11 @@ - confdb_notify_lib_of_key_change, - confdb_notify_lib_of_new_object, - confdb_notify_lib_of_destroyed_object, -+ NULL, - api->ipc_conn_partner_get (conn)); - res.size = sizeof(res); - res.id = MESSAGE_RES_CONFDB_TRACK_START; -- res.error = SA_AIS_OK; -+ res.error = CS_OK; - api->ipc_conn_send_response(conn, &res, sizeof(res)); - } - -@@ -700,11 +701,12 @@ - api->object_track_stop(confdb_notify_lib_of_key_change, - confdb_notify_lib_of_new_object, - confdb_notify_lib_of_destroyed_object, -+ NULL, - api->ipc_conn_partner_get (conn)); - - res.size = sizeof(res); - res.id = MESSAGE_RES_CONFDB_TRACK_STOP; -- res.error = SA_AIS_OK; -+ res.error = CS_OK; - api->ipc_conn_send_response(conn, &res, sizeof(res)); - } - -diff -Naurd corosync-0.92/services/cpg.c corosync-trunk/services/cpg.c ---- corosync-0.92/services/cpg.c 2008-09-17 21:15:00.000000000 +0200 -+++ corosync-trunk/services/cpg.c 2009-01-08 07:29:16.000000000 +0100 -@@ -51,7 +51,7 @@ - #include - #include - --#include -+#include - #include - #include - #include -@@ -99,7 +99,7 @@ - void *conn; - void *trackerconn; - struct group_info *group; -- enum corosync_flow_control_state flow_control_state; -+ enum cs_flow_control_state flow_control_state; - struct list_head list; /* on the group_info members list */ - }; - -@@ -189,49 +189,49 @@ - .lib_handler_fn = message_handler_req_lib_cpg_join, - .response_size = sizeof (struct res_lib_cpg_join), - .response_id = MESSAGE_RES_CPG_JOIN, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 1 */ - .lib_handler_fn = message_handler_req_lib_cpg_leave, - .response_size = sizeof (struct res_lib_cpg_leave), - .response_id = MESSAGE_RES_CPG_LEAVE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 2 */ - .lib_handler_fn = message_handler_req_lib_cpg_mcast, - .response_size = sizeof (struct res_lib_cpg_mcast), - .response_id = MESSAGE_RES_CPG_MCAST, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 3 */ - .lib_handler_fn = message_handler_req_lib_cpg_membership, - .response_size = sizeof (mar_res_header_t), - .response_id = MESSAGE_RES_CPG_MEMBERSHIP, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 4 */ - .lib_handler_fn = message_handler_req_lib_cpg_trackstart, - .response_size = sizeof (struct res_lib_cpg_trackstart), - .response_id = MESSAGE_RES_CPG_TRACKSTART, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 5 */ - .lib_handler_fn = message_handler_req_lib_cpg_trackstop, - .response_size = sizeof (struct res_lib_cpg_trackstart), - .response_id = MESSAGE_RES_CPG_TRACKSTOP, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 6 */ - .lib_handler_fn = message_handler_req_lib_cpg_local_get, - .response_size = sizeof (struct res_lib_cpg_local_get), - .response_id = MESSAGE_RES_CPG_LOCAL_GET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 7 */ - .lib_handler_fn = message_handler_req_lib_cpg_groups_get, - .response_size = sizeof (struct res_lib_cpg_groups_get), - .response_id = MESSAGE_RES_CPG_GROUPS_GET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - } - }; - -@@ -263,7 +263,7 @@ - .name = "corosync cluster closed process group service v1.01", - .id = CPG_SERVICE, - .private_data_size = sizeof (struct process_info), -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED, -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED, - .lib_init_fn = cpg_lib_init_fn, - .lib_exit_fn = cpg_lib_exit_fn, - .lib_engine = cpg_lib_engine, -@@ -395,7 +395,7 @@ - sizeof(mar_cpg_address_t) * (count + left_list_entries + joined_list_entries); - buf = alloca(size); - if (!buf) -- return SA_AIS_ERR_NO_SPACE; -+ return CS_ERR_NO_SPACE; - - res = (struct res_lib_cpg_confchg_callback *)buf; - res->joined_list_entries = joined_list_entries; -@@ -404,6 +404,7 @@ - - res->header.size = size; - res->header.id = id; -+ res->header.error = CS_OK; - memcpy(&res->group_name, &gi->group_name, sizeof(mar_cpg_name_t)); - - /* Build up the message */ -@@ -453,7 +454,7 @@ - } - } - -- return SA_AIS_OK; -+ return CS_OK; - } - - static void remove_group(struct group_info *gi) -@@ -571,6 +572,8 @@ - return; - } - } -+ if (!buf) -+ continue; - - res = (struct res_lib_cpg_groups_get_callback *)buf; - retgi = res->member_list; -@@ -694,7 +697,7 @@ - struct memb_ring_id *ring_id) - { - int i; -- uint32_t lowest_nodeid = 0xffffff; -+ uint32_t lowest_nodeid = 0xffffffff; - struct iovec req_exec_cpg_iovec; - - /* We don't send the library joinlist in here because it can end up -@@ -736,7 +739,7 @@ - - static void cpg_flow_control_state_set_fn ( - void *context, -- enum corosync_flow_control_state flow_control_state) -+ enum cs_flow_control_state flow_control_state) - { - struct res_lib_cpg_flowcontrol_callback res_lib_cpg_flowcontrol_callback; - struct process_info *process_info = (struct process_info *)context; -@@ -1105,19 +1108,19 @@ - struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn); - struct res_lib_cpg_join res_lib_cpg_join; - struct group_info *gi; -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - - log_printf(LOG_LEVEL_DEBUG, "got join request on %p, pi=%p, pi->pid=%d\n", conn, pi, pi->pid); - - /* Already joined on this conn */ - if (pi->pid) { -- error = SA_AIS_ERR_INVALID_PARAM; -+ error = CS_ERR_INVALID_PARAM; - goto join_err; - } - - gi = get_group(&req_lib_cpg_join->group_name); - if (!gi) { -- error = SA_AIS_ERR_NO_SPACE; -+ error = CS_ERR_NO_SPACE; - goto join_err; - } - -@@ -1151,12 +1154,12 @@ - struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn); - struct res_lib_cpg_leave res_lib_cpg_leave; - struct group_info *gi; -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - - log_printf(LOG_LEVEL_DEBUG, "got leave request on %p\n", conn); - - if (!pi || !pi->pid || !pi->group) { -- error = SA_AIS_ERR_INVALID_PARAM; -+ error = CS_ERR_INVALID_PARAM; - goto leave_ret; - } - gi = pi->group; -@@ -1198,7 +1201,7 @@ - if (!gi) { - res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast); - res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST; -- res_lib_cpg_mcast.header.error = SA_AIS_ERR_ACCESS; /* TODO Better error code ?? */ -+ res_lib_cpg_mcast.header.error = CS_ERR_ACCESS; /* TODO Better error code ?? */ - res_lib_cpg_mcast.flow_control_state = CPG_FLOW_CONTROL_DISABLED; - api->ipc_conn_send_response(conn, &res_lib_cpg_mcast, - sizeof(res_lib_cpg_mcast)); -@@ -1225,7 +1228,7 @@ - - res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast); - res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST; -- res_lib_cpg_mcast.header.error = SA_AIS_OK; -+ res_lib_cpg_mcast.header.error = CS_OK; - res_lib_cpg_mcast.flow_control_state = pi->flow_control_state; - api->ipc_conn_send_response(conn, &res_lib_cpg_mcast, - sizeof(res_lib_cpg_mcast)); -@@ -1240,7 +1243,7 @@ - mar_res_header_t res; - res.size = sizeof(res); - res.id = MESSAGE_RES_CPG_MEMBERSHIP; -- res.error = SA_AIS_ERR_ACCESS; /* TODO Better error code */ -+ res.error = CS_ERR_ACCESS; /* TODO Better error code */ - api->ipc_conn_send_response(conn, &res, sizeof(res)); - return; - } -@@ -1256,13 +1259,13 @@ - struct group_info *gi; - struct process_info *otherpi; - void *otherconn; -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - - log_printf(LOG_LEVEL_DEBUG, "got trackstart request on %p\n", conn); - - gi = get_group(&req_lib_cpg_trackstart->group_name); - if (!gi) { -- error = SA_AIS_ERR_NO_SPACE; -+ error = CS_ERR_NO_SPACE; - goto tstart_ret; - } - -@@ -1274,7 +1277,7 @@ - tstart_ret: - res_lib_cpg_trackstart.header.size = sizeof(res_lib_cpg_trackstart); - res_lib_cpg_trackstart.header.id = MESSAGE_RES_CPG_TRACKSTART; -- res_lib_cpg_trackstart.header.error = SA_AIS_OK; -+ res_lib_cpg_trackstart.header.error = CS_OK; - api->ipc_conn_send_response(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart)); - } - -@@ -1285,13 +1288,13 @@ - struct process_info *otherpi; - void *otherconn; - struct group_info *gi; -- SaAisErrorT error = SA_AIS_OK; -+ cs_error_t error = CS_OK; - - log_printf(LOG_LEVEL_DEBUG, "got trackstop request on %p\n", conn); - - gi = get_group(&req_lib_cpg_trackstop->group_name); - if (!gi) { -- error = SA_AIS_ERR_NO_SPACE; -+ error = CS_ERR_NO_SPACE; - goto tstop_ret; - } - -@@ -1303,7 +1306,7 @@ - tstop_ret: - res_lib_cpg_trackstop.header.size = sizeof(res_lib_cpg_trackstop); - res_lib_cpg_trackstop.header.id = MESSAGE_RES_CPG_TRACKSTOP; -- res_lib_cpg_trackstop.header.error = SA_AIS_OK; -+ res_lib_cpg_trackstop.header.error = CS_OK; - api->ipc_conn_send_response(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop)); - } - -@@ -1313,7 +1316,7 @@ - - res_lib_cpg_local_get.header.size = sizeof(res_lib_cpg_local_get); - res_lib_cpg_local_get.header.id = MESSAGE_RES_CPG_LOCAL_GET; -- res_lib_cpg_local_get.header.error = SA_AIS_OK; -+ res_lib_cpg_local_get.header.error = CS_OK; - res_lib_cpg_local_get.local_nodeid = api->totem_nodeid_get (); - - api->ipc_conn_send_response(conn, &res_lib_cpg_local_get, -@@ -1326,7 +1329,7 @@ - - res_lib_cpg_groups_get.header.size = sizeof(res_lib_cpg_groups_get); - res_lib_cpg_groups_get.header.id = MESSAGE_RES_CPG_GROUPS_GET; -- res_lib_cpg_groups_get.header.error = SA_AIS_OK; -+ res_lib_cpg_groups_get.header.error = CS_OK; - res_lib_cpg_groups_get.num_groups = count_groups(); - - api->ipc_conn_send_response(conn, &res_lib_cpg_groups_get, -diff -Naurd corosync-0.92/services/evs.c corosync-trunk/services/evs.c ---- corosync-0.92/services/evs.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/services/evs.c 2008-11-06 22:49:07.000000000 +0100 -@@ -49,7 +49,7 @@ - #include - - #include --#include -+#include - #include - #include - #include -@@ -104,31 +104,31 @@ - .lib_handler_fn = message_handler_req_evs_join, - .response_size = sizeof (struct res_lib_evs_join), - .response_id = MESSAGE_RES_EVS_JOIN, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 1 */ - .lib_handler_fn = message_handler_req_evs_leave, - .response_size = sizeof (struct res_lib_evs_leave), - .response_id = MESSAGE_RES_EVS_LEAVE, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 2 */ - .lib_handler_fn = message_handler_req_evs_mcast_joined, - .response_size = sizeof (struct res_lib_evs_mcast_joined), - .response_id = MESSAGE_RES_EVS_MCAST_JOINED, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 3 */ - .lib_handler_fn = message_handler_req_evs_mcast_groups, - .response_size = sizeof (struct res_lib_evs_mcast_groups), - .response_id = MESSAGE_RES_EVS_MCAST_GROUPS, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED - }, - { /* 4 */ - .lib_handler_fn = message_handler_req_evs_membership_get, - .response_size = sizeof (struct res_lib_evs_membership_get), - .response_id = MESSAGE_RES_EVS_MEMBERSHIP_GET, -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - } - }; - -@@ -144,7 +144,7 @@ - .name = "corosync extended virtual synchrony service", - .id = EVS_SERVICE, - .private_data_size = sizeof (struct evs_pd), -- .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED, -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED, - .lib_init_fn = evs_lib_init_fn, - .lib_exit_fn = evs_lib_exit_fn, - .lib_engine = evs_lib_engine, -@@ -223,7 +223,7 @@ - */ - res_evs_confchg_callback.header.size = sizeof (struct res_evs_confchg_callback); - res_evs_confchg_callback.header.id = MESSAGE_RES_EVS_CONFCHG_CALLBACK; -- res_evs_confchg_callback.header.error = SA_AIS_OK; -+ res_evs_confchg_callback.header.error = CS_OK; - - memcpy (res_evs_confchg_callback.member_list, - member_list, member_list_entries * sizeof(*member_list)); -@@ -276,21 +276,21 @@ - - static void message_handler_req_evs_join (void *conn, void *msg) - { -- evs_error_t error = EVS_OK; -+ cs_error_t error = CS_OK; - struct req_lib_evs_join *req_lib_evs_join = (struct req_lib_evs_join *)msg; - struct res_lib_evs_join res_lib_evs_join; - void *addr; - struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn); - - if (req_lib_evs_join->group_entries > 50) { -- error = EVS_ERR_TOO_MANY_GROUPS; -+ error = CS_ERR_TOO_MANY_GROUPS; - goto exit_error; - } - - addr = realloc (evs_pd->groups, sizeof (struct evs_group) * - (evs_pd->group_entries + req_lib_evs_join->group_entries)); - if (addr == NULL) { -- error = SA_AIS_ERR_NO_MEMORY; -+ error = CS_ERR_NO_MEMORY; - goto exit_error; - } - evs_pd->groups = addr; -@@ -314,7 +314,7 @@ - { - struct req_lib_evs_leave *req_lib_evs_leave = (struct req_lib_evs_leave *)msg; - struct res_lib_evs_leave res_lib_evs_leave; -- evs_error_t error = EVS_OK; -+ cs_error_t error = CS_OK; - int error_index; - int i, j; - int found; -@@ -342,7 +342,7 @@ - } - } - if (found == 0) { -- error = EVS_ERR_NOT_EXIST; -+ error = CS_ERR_NOT_EXIST; - error_index = i; - break; - } -@@ -358,7 +358,7 @@ - - static void message_handler_req_evs_mcast_joined (void *conn, void *msg) - { -- evs_error_t error = EVS_ERR_TRY_AGAIN; -+ cs_error_t error = CS_ERR_TRY_AGAIN; - struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)msg; - struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined; - struct iovec req_exec_evs_mcast_iovec[3]; -@@ -388,7 +388,7 @@ - res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); - // TODO - if (res == 0) { -- error = EVS_OK; -+ error = CS_OK; - } - - res_lib_evs_mcast_joined.header.size = sizeof (struct res_lib_evs_mcast_joined); -@@ -401,7 +401,7 @@ - - static void message_handler_req_evs_mcast_groups (void *conn, void *msg) - { -- evs_error_t error = EVS_ERR_TRY_AGAIN; -+ cs_error_t error = CS_ERR_TRY_AGAIN; - struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)msg; - struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups; - struct iovec req_exec_evs_mcast_iovec[3]; -@@ -434,7 +434,7 @@ - send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); - res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); - if (res == 0) { -- error = EVS_OK; -+ error = CS_OK; - } - - res_lib_evs_mcast_groups.header.size = sizeof (struct res_lib_evs_mcast_groups); -@@ -451,7 +451,7 @@ - - res_lib_evs_membership_get.header.size = sizeof (struct res_lib_evs_membership_get); - res_lib_evs_membership_get.header.id = MESSAGE_RES_EVS_MEMBERSHIP_GET; -- res_lib_evs_membership_get.header.error = EVS_OK; -+ res_lib_evs_membership_get.header.error = CS_OK; - res_lib_evs_membership_get.local_nodeid = api->totem_nodeid_get (); - memcpy (&res_lib_evs_membership_get.member_list, - &res_evs_confchg_callback.member_list, -@@ -488,7 +488,7 @@ - res_evs_deliver_callback.header.size = sizeof (struct res_evs_deliver_callback) + - req_exec_evs_mcast->msg_len; - res_evs_deliver_callback.header.id = MESSAGE_RES_EVS_DELIVER_CALLBACK; -- res_evs_deliver_callback.header.error = SA_AIS_OK; -+ res_evs_deliver_callback.header.error = CS_OK; - res_evs_deliver_callback.msglen = req_exec_evs_mcast->msg_len; - - msg_addr = (char *)req_exec_evs_mcast + sizeof (struct req_exec_evs_mcast) + -diff -Naurd corosync-0.92/services/Makefile corosync-trunk/services/Makefile ---- corosync-0.92/services/Makefile 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/services/Makefile 2009-01-26 11:46:08.000000000 +0100 -@@ -50,12 +50,12 @@ - endif - - # LCR objects --LCR_SRC = evs.c cfg.c cpg.c confdb.c --LCR_OBJS = evs.o cfg.o cpg.o confdb.o $(AMF_OBJS) -+LCR_SRC = evs.c cfg.c cpg.c confdb.c pload.c -+LCR_OBJS = evs.o cfg.o cpg.o confdb.o $(AMF_OBJS) pload.o - - override CFLAGS += -fPIC - --all: service_evs.lcrso service_cfg.lcrso service_cpg.lcrso service_confdb.lcrso -+all: service_evs.lcrso service_cfg.lcrso service_cpg.lcrso service_confdb.lcrso service_pload.lcrso testquorum.lcrso service_votequorum.lcrso - - ifeq (${COROSYNC_COMPAT}, DARWIN) - -@@ -71,6 +71,15 @@ - service_cpg.lcrso: cpg.o - $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load cpg.o -o $@ - -+service_pload.lcrso: pload.o -+ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load pload.o -o $@ -+ -+service_votequorum.lcrso: votequorum.o -+ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load votequorum.o -o $@ -+ -+testquorum.lcrso: testquorum.o -+ $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ../exec/corosync -bind_at_load testquorum.o -o $@ -+ - else - - service_evs.lcrso: evs.o -@@ -85,11 +94,23 @@ - service_cpg.lcrso: cpg.o - $(CC) -shared -Wl,-soname,service_cpg.lcrso cpg.o -o $@ - -+service_pload.lcrso: pload.o -+ $(CC) -shared -Wl,-soname,service_pload.lcrso pload.o -o $@ -+ -+service_votequorum.lcrso: votequorum.o -+ $(CC) -shared -Wl,-soname,service_votequorum.lcrso votequorum.o -o $@ -+ -+testquorum.lcrso: testquorum.o -+ $(CC) -shared -Wl,-soname,testquorum.lcrso testquorum.o -o $@ -+ - endif - - clean: - rm -f *.o *.lcrso - -+lint: -+ -splint $(LINT_FLAGS) $(CFLAGS) *.c -+ - depend: - makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(EXEC_SRC) $(TOTEM_SRC) $(LOGSYS_SRC) $(LCR_SRC) > /dev/null 2>&1 - -@@ -104,3 +125,6 @@ - - cpg.o: cpg.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< -+ -+testquorum.o: testquorum.c -+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< -diff -Naurd corosync-0.92/services/pload.c corosync-trunk/services/pload.c ---- corosync-0.92/services/pload.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/services/pload.c 2008-11-06 22:49:07.000000000 +0100 -@@ -0,0 +1,356 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: 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. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+LOGSYS_DECLARE_SUBSYS ("PLOAD", LOG_INFO); -+ -+enum pload_exec_message_req_types { -+ MESSAGE_REQ_EXEC_PLOAD_START = 0, -+ MESSAGE_REQ_EXEC_PLOAD_MCAST = 1 -+}; -+ -+/* -+ * Service Interfaces required by service_message_handler struct -+ */ -+static int pload_exec_init_fn ( -+ struct corosync_api_v1 *corosync_api); -+ -+static void pload_confchg_fn ( -+ enum totem_configuration_type configuration_type, -+ unsigned int *member_list, int member_list_entries, -+ unsigned int *left_list, int left_list_entries, -+ unsigned int *joined_list, int joined_list_entries, -+ struct memb_ring_id *ring_id); -+ -+static void message_handler_req_exec_pload_start (void *msg, unsigned int nodeid); -+ -+static void message_handler_req_exec_pload_mcast (void *msg, unsigned int nodeid); -+ -+static void req_exec_pload_start_endian_convert (void *msg); -+ -+static void req_exec_pload_mcast_endian_convert (void *msg); -+ -+static void message_handler_req_pload_start (void *conn, void *msg); -+ -+static int pload_lib_init_fn (void *conn); -+ -+static int pload_lib_exit_fn (void *conn); -+ -+static char buffer[1000000]; -+ -+static unsigned int msgs_delivered = 0; -+ -+static unsigned int msgs_wanted = 0; -+ -+static unsigned int msg_size = 0; -+ -+static unsigned int msg_code = 1; -+ -+static unsigned int msgs_sent = 0; -+ -+ -+static struct corosync_api_v1 *api; -+ -+struct req_exec_pload_start { -+ mar_req_header_t header; -+ unsigned int msg_code; -+ unsigned int msg_count; -+ unsigned int msg_size; -+ unsigned int time_interval; -+}; -+ -+struct req_exec_pload_mcast { -+ mar_req_header_t header; -+ unsigned int msg_code; -+}; -+ -+static struct corosync_lib_handler pload_lib_engine[] = -+{ -+ { /* 0 */ -+ .lib_handler_fn = message_handler_req_pload_start, -+ .response_size = sizeof (struct res_lib_pload_start), -+ .response_id = MESSAGE_RES_PLOAD_START, -+ .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED -+ } -+}; -+ -+static struct corosync_exec_handler pload_exec_engine[] = -+{ -+ { -+ .exec_handler_fn = message_handler_req_exec_pload_start, -+ .exec_endian_convert_fn = req_exec_pload_start_endian_convert -+ }, -+ { -+ .exec_handler_fn = message_handler_req_exec_pload_mcast, -+ .exec_endian_convert_fn = req_exec_pload_mcast_endian_convert -+ } -+}; -+ -+struct corosync_service_engine pload_service_engine = { -+ .name = "corosync profile loading service", -+ .id = PLOAD_SERVICE, -+ .private_data_size = 0, -+ .flow_control = CS_LIB_FLOW_CONTROL_REQUIRED, -+ .lib_init_fn = pload_lib_init_fn, -+ .lib_exit_fn = pload_lib_exit_fn, -+ .lib_engine = pload_lib_engine, -+ .lib_engine_count = sizeof (pload_lib_engine) / sizeof (struct corosync_lib_handler), -+ .exec_engine = pload_exec_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 -+}; -+ -+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) -+{ -+ return (&pload_service_engine); -+} -+ -+__attribute__ ((constructor)) static void pload_comp_register (void) { -+ 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) -+{ -+ api = corosync_api; -+ -+ return 0; -+} -+ -+static void pload_confchg_fn ( -+ enum totem_configuration_type configuration_type, -+ unsigned int *member_list, int member_list_entries, -+ unsigned int *left_list, int left_list_entries, -+ unsigned int *joined_list, int joined_list_entries, -+ struct memb_ring_id *ring_id) -+{ -+} -+ -+static int pload_lib_init_fn (void *conn) -+{ -+ return (0); -+} -+ -+static int pload_lib_exit_fn (void *conn) -+{ -+ return (0); -+} -+ -+static void message_handler_req_pload_start (void *conn, void *msg) -+{ -+ struct req_lib_pload_start *req_lib_pload_start = (struct req_lib_pload_start *)msg; -+ struct req_exec_pload_start req_exec_pload_start; -+ struct iovec iov; -+ -+ req_exec_pload_start.header.id = -+ SERVICE_ID_MAKE (PLOAD_SERVICE, MESSAGE_REQ_EXEC_PLOAD_START); -+ req_exec_pload_start.msg_code = req_lib_pload_start->msg_code; -+ req_exec_pload_start.msg_size = req_lib_pload_start->msg_size; -+ req_exec_pload_start.msg_count = req_lib_pload_start->msg_count; -+ req_exec_pload_start.time_interval = req_lib_pload_start->time_interval; -+ iov.iov_base = &req_exec_pload_start; -+ iov.iov_len = sizeof (struct req_exec_pload_start); -+ -+ api->totem_mcast (&iov, 1, TOTEM_AGREED); -+} -+ -+static void req_exec_pload_start_endian_convert (void *msg) -+{ -+} -+ -+static void req_exec_pload_mcast_endian_convert (void *msg) -+{ -+} -+ -+static int msg_no = 0; -+ -+int send_message (enum totem_callback_token_type type, void *arg) -+{ -+ struct req_exec_pload_mcast req_exec_pload_mcast; -+ struct iovec iov[2]; -+ unsigned int res; -+ int iov_len = 2; -+ -+ req_exec_pload_mcast.header.id = -+ SERVICE_ID_MAKE (PLOAD_SERVICE, MESSAGE_REQ_EXEC_PLOAD_MCAST); -+ req_exec_pload_mcast.header.size = sizeof (struct req_exec_pload_mcast) + msg_size; -+ -+ iov[0].iov_base = &req_exec_pload_mcast; -+ iov[0].iov_len = sizeof (struct req_exec_pload_mcast); -+ iov[1].iov_base = buffer; -+ iov[1].iov_len = msg_size - sizeof (struct req_exec_pload_mcast); -+ if (iov[1].iov_len < 0) { -+ iov_len = 1; -+ } -+ -+ do { -+ res = api->totem_mcast (iov, iov_len, TOTEM_AGREED); -+ if (res == -1) { -+ break; -+ } else { -+ msgs_sent++; -+ msg_code++; -+ } -+ } while (msgs_sent <= msgs_wanted); -+ if (msgs_sent == msgs_wanted) { -+ return (0); -+ } else { -+ return (-1); -+ } -+} -+ -+void *token_callback; -+void start_mcasting (void) -+{ -+ api->totem_callback_token_create ( -+ &token_callback, -+ TOTEM_CALLBACK_TOKEN_RECEIVED, -+ 1, -+ send_message, -+ &token_callback); -+} -+ -+static void message_handler_req_exec_pload_start ( -+ void *msg, -+ unsigned int nodeid) -+{ -+ struct req_exec_pload_start *req_exec_pload_start = (struct req_exec_pload_start *)msg; -+ -+ msgs_wanted = req_exec_pload_start->msg_count; -+ msg_size = req_exec_pload_start->msg_size; -+ msg_code = req_exec_pload_start->msg_code; -+ -+ start_mcasting (); -+} -+ -+# define timersub(a, b, result) \ -+ do { \ -+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ -+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ -+ if ((result)->tv_usec < 0) { \ -+ --(result)->tv_sec; \ -+ (result)->tv_usec += 1000000; \ -+ } \ -+ } while (0) -+ -+struct timeval tv1; -+struct timeval tv2; -+struct timeval tv_elapsed; -+int last_msg_no = 0; -+ -+static void message_handler_req_exec_pload_mcast ( -+ void *msg, -+ unsigned int nodeid) -+{ -+ struct req_exec_pload_mcast *pload_mcast = (struct req_exec_pload_mcast *)msg; -+ -+ assert (pload_mcast->msg_code - 1 == last_msg_no); -+ last_msg_no = pload_mcast->msg_code; -+ if (msgs_delivered == 0) { -+ gettimeofday (&tv1, NULL); -+ } -+ msgs_delivered += 1; -+ if (msgs_delivered == msgs_wanted) { -+ gettimeofday (&tv2, NULL); -+ timersub (&tv2, &tv1, &tv_elapsed); -+ printf ("%5d Writes ", msgs_delivered); -+ printf ("%5d bytes per write ", msg_size); -+ printf ("%7.3f Seconds runtime ", -+ (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); -+ printf ("%9.3f TP/s ", -+ ((float)msgs_delivered) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); -+ printf ("%7.3f MB/s.\n", -+ ((float)msgs_delivered) * ((float)msg_size) / ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0)); -+ } -+} -diff -Naurd corosync-0.92/services/testquorum.c corosync-trunk/services/testquorum.c ---- corosync-0.92/services/testquorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/services/testquorum.c 2008-12-09 14:48:47.000000000 +0100 -@@ -0,0 +1,153 @@ -+/* -+ * Copyright (c) 2008 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 -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+LOGSYS_DECLARE_SUBSYS ("TEST", LOG_INFO); -+ -+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 -+}; -+ -+__attribute__ ((constructor)) static void test_quorum_comp_register (void) { -+ 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(object_change_type_t change_type, -+ unsigned int parent_object_handle, -+ unsigned int object_handle, -+ void *object_name_pt, int object_name_len, -+ void *key_name_pt, int key_len, -+ void *key_value_pt, int key_value_len, -+ void *priv_data_pt) -+{ -+ unsigned int members[1]; -+ struct memb_ring_id ring_id; -+ -+ memset(&ring_id, 0, sizeof(ring_id)); -+ -+ /* If the 'quorum.quorate' key changes, then that changes quorum */ -+ if (strncmp(key_name_pt, "quorate", key_len) == 0) { -+ set_quorum(members, 0, atoi(key_value_pt), &ring_id); -+ } -+} -+ -+static void quorum_callback(int quorate, void *context) -+{ -+ log_printf(LOG_LEVEL_DEBUG, "quorum callback: quorate = %d\n", quorate); -+} -+ -+static void test_init(struct corosync_api_v1 *api, -+ quorum_set_quorate_fn_t report) -+{ -+ -+ unsigned int find_handle; -+ unsigned int quorum_handle = 0; -+ -+ set_quorum = report; -+ -+ /* -+ * Register for objdb changes on quorum { } -+ */ -+ api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); -+ api->object_find_next(find_handle, &quorum_handle); -+ api->object_find_destroy(find_handle); -+ -+ api->object_track_start(quorum_handle, -+ 1, -+ key_change_notify, -+ NULL, // object_create_notify -+ NULL, // object_destroy_notify -+ NULL, // object_reload_notify -+ NULL); // priv_data -+ -+ /* Register for quorum changes too! */ -+ api->quorum_register_callback(quorum_callback, NULL); -+} -diff -Naurd corosync-0.92/services/votequorum.c corosync-trunk/services/votequorum.c ---- corosync-0.92/services/votequorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/services/votequorum.c 2009-01-29 15:21:05.000000000 +0100 -@@ -0,0 +1,1619 @@ -+/* -+ * Copyright (c) 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 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 CONTIBUTORS "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 -+#ifndef COROSYNC_BSD -+#include -+#endif -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define VOTEQUORUM_MAJOR_VERSION 6 -+#define VOTEQUORUM_MINOR_VERSION 3 -+#define VOTEQUORUM_PATCH_VERSION 0 -+ -+ /* Silly default to prevent accidents! */ -+#define DEFAULT_EXPECTED 1024 -+#define DEFAULT_QDEV_POLL 10000 -+ -+LOGSYS_DECLARE_SUBSYS ("VOTEQ", LOG_INFO); -+ -+enum quorum_message_req_types { -+ MESSAGE_REQ_EXEC_VOTEQUORUM_NODEINFO = 0, -+ MESSAGE_REQ_EXEC_VOTEQUORUM_RECONFIGURE = 1, -+ MESSAGE_REQ_EXEC_VOTEQUORUM_KILLNODE = 2, -+}; -+ -+#define NODE_FLAGS_BEENDOWN 1 -+#define NODE_FLAGS_SEESDISALLOWED 8 -+#define NODE_FLAGS_HASSTATE 16 -+#define NODE_FLAGS_QDISK 32 -+#define NODE_FLAGS_REMOVED 64 -+#define NODE_FLAGS_US 128 -+ -+ -+typedef enum { NODESTATE_JOINING=1, NODESTATE_MEMBER, -+ NODESTATE_DEAD, NODESTATE_LEAVING, NODESTATE_DISALLOWED } nodestate_t; -+ -+ -+/* This structure is tacked onto the start of a cluster message packet for our -+ * own nefarious purposes. */ -+struct q_protheader { -+ unsigned char tgtport; /* Target port number */ -+ unsigned char srcport; /* Source (originating) port number */ -+ unsigned short pad; -+ unsigned int flags; -+ int srcid; /* Node ID of the sender */ -+ int tgtid; /* Node ID of the target */ -+} __attribute__((packed)); -+ -+struct cluster_node { -+ int flags; -+ int node_id; -+ unsigned int expected_votes; -+ unsigned int votes; -+ time_t join_time; -+ -+ nodestate_t state; -+ -+ struct timeval last_hello; /* Only used for quorum devices */ -+ -+ struct list_head list; -+}; -+ -+static int quorum_flags; -+#define VOTEQUORUM_FLAG_FEATURE_DISALLOWED 1 -+#define VOTEQUORUM_FLAG_FEATURE_TWONODE 1 -+ -+static int quorum; -+static int cluster_is_quorate; -+static int first_trans = 1; -+static unsigned int quorumdev_poll = DEFAULT_QDEV_POLL; -+ -+static struct cluster_node *us; -+static struct cluster_node *quorum_device = NULL; -+static char quorum_device_name[VOTEQUORUM_MAX_QDISK_NAME_LEN]; -+static corosync_timer_handle_t quorum_device_timer; -+static struct list_head cluster_members_list; -+static struct corosync_api_v1 *corosync_api; -+static struct list_head trackers_list; -+static unsigned int quorum_members[PROCESSOR_COUNT_MAX+1]; -+static int quorum_members_entries = 0; -+static struct memb_ring_id quorum_ringid; -+static cs_tpg_handle group_handle; -+ -+#define max(a,b) (((a) > (b)) ? (a) : (b)) -+static struct cluster_node *find_node_by_nodeid(int nodeid); -+static struct cluster_node *allocate_node(int nodeid); -+static char *kill_reason(int reason); -+ -+static struct corosync_tpg_group quorum_group[1] = { -+ { .group = "VOTEQ", .group_len = 5}, -+}; -+ -+#define list_iterate(v, head) \ -+ for (v = (head)->next; v != head; v = v->next) -+ -+struct quorum_pd { -+ unsigned char track_flags; -+ int tracking_enabled; -+ uint64_t tracking_context; -+ struct list_head list; -+ void *conn; -+}; -+ -+/* -+ * Service Interfaces required by service_message_handler struct -+ */ -+ -+static void votequorum_init(struct corosync_api_v1 *api, -+ quorum_set_quorate_fn_t report); -+ -+static void quorum_confchg_fn ( -+ enum totem_configuration_type configuration_type, -+ unsigned int *member_list, int member_list_entries, -+ unsigned int *left_list, int left_list_entries, -+ unsigned int *joined_list, int joined_list_entries, -+ struct memb_ring_id *ring_id); -+ -+static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len, -+ int endian_conversion_required); -+ -+static int votequorum_exec_init_fn (struct corosync_api_v1 *corosync_api); -+ -+static int quorum_lib_init_fn (void *conn); -+ -+static int quorum_lib_exit_fn (void *conn); -+ -+static void message_handler_req_exec_quorum_nodeinfo ( -+ void *message, -+ unsigned int nodeid); -+ -+static void message_handler_req_exec_quorum_reconfigure ( -+ void *message, -+ unsigned int nodeid); -+ -+static void message_handler_req_exec_quorum_killnode ( -+ void *message, -+ unsigned int nodeid); -+ -+ -+static void message_handler_req_lib_votequorum_getinfo (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_setexpected (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_setvotes (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_qdisk_register (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_qdisk_poll (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_setstate (void *conn, void *message); -+ -+static void message_handler_req_lib_votequorum_leaving (void *conn, void *message); -+static void message_handler_req_lib_votequorum_trackstart (void *conn, void *msg); -+static void message_handler_req_lib_votequorum_trackstop (void *conn, void *msg); -+ -+static int quorum_exec_send_nodeinfo(void); -+static int quorum_exec_send_reconfigure(int param, int nodeid, int value); -+static int quorum_exec_send_killnode(int nodeid, unsigned int reason); -+ -+static void add_votequorum_config_notification(unsigned int quorum_object_handle); -+ -+ -+/* -+ * Library Handler Definition -+ */ -+static struct corosync_lib_handler quorum_lib_service[] = -+{ -+ { /* 0 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_getinfo, -+ .response_size = sizeof (struct res_lib_votequorum_getinfo), -+ .response_id = MESSAGE_RES_VOTEQUORUM_GETINFO, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 1 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_setexpected, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 2 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_setvotes, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 3 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_register, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 4 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_unregister, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 5 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_poll, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 6 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_qdisk_getinfo, -+ .response_size = sizeof (struct res_lib_votequorum_qdisk_getinfo), -+ .response_id = MESSAGE_RES_VOTEQUORUM_QDISK_GETINFO, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 7 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_setstate, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 8 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_leaving, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 9 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_trackstart, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ }, -+ { /* 10 */ -+ .lib_handler_fn = message_handler_req_lib_votequorum_trackstop, -+ .response_size = sizeof (struct res_lib_votequorum_status), -+ .response_id = MESSAGE_RES_VOTEQUORUM_STATUS, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED -+ } -+}; -+ -+static quorum_set_quorate_fn_t set_quorum; -+/* -+ * lcrso object definition -+ */ -+static struct quorum_services_api_ver1 votequorum_iface_ver0 = { -+ .init = votequorum_init -+}; -+ -+static struct corosync_service_engine quorum_service_handler = { -+ .name = "corosync votes quorum service v0.90", -+ .id = VOTEQUORUM_SERVICE, -+ .private_data_size = sizeof (struct quorum_pd), -+ .allow_inquorate = CS_LIB_ALLOW_INQUORATE, -+ .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED, -+ .lib_init_fn = quorum_lib_init_fn, -+ .lib_exit_fn = quorum_lib_exit_fn, -+ .lib_engine = quorum_lib_service, -+ .lib_engine_count = sizeof (quorum_lib_service) / sizeof (struct corosync_lib_handler), -+ .exec_init_fn = votequorum_exec_init_fn, -+ .exec_engine = NULL, -+ .exec_engine_count = 0, -+ .confchg_fn = NULL, -+}; -+ -+/* -+ * Dynamic loader definition -+ */ -+static struct corosync_service_engine *quorum_get_service_handler_ver0 (void); -+ -+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 -+}; -+ -+ -+static struct corosync_service_engine *quorum_get_service_handler_ver0 (void) -+{ -+ return (&quorum_service_handler); -+} -+ -+__attribute__ ((constructor)) static void quorum_comp_register (void) { -+ 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); -+} -+ -+static void votequorum_init(struct corosync_api_v1 *api, -+ quorum_set_quorate_fn_t report) -+{ -+ ENTER(); -+ set_quorum = report; -+ -+ /* Load the library-servicing part of this module */ -+ api->service_link_and_init(api, "corosync_votequorum_iface", 0); -+ -+ LEAVE(); -+} -+ -+/* Message types */ -+#define VOTEQUORUM_MSG_NODEINFO 5 -+#define VOTEQUORUM_MSG_KILLNODE 6 -+#define VOTEQUORUM_MSG_RECONFIGURE 8 -+ -+struct req_exec_quorum_nodeinfo { -+ unsigned char cmd; -+ unsigned char first_trans; -+ unsigned int votes; -+ unsigned int expected_votes; -+ -+ unsigned int major_version; /* Not backwards compatible */ -+ unsigned int minor_version; /* Backwards compatible */ -+ unsigned int patch_version; /* Backwards/forwards compatible */ -+ unsigned int config_version; -+ unsigned int flags; -+ -+} __attribute__((packed)); -+ -+/* Parameters for RECONFIG command */ -+#define RECONFIG_PARAM_EXPECTED_VOTES 1 -+#define RECONFIG_PARAM_NODE_VOTES 2 -+#define RECONFIG_PARAM_LEAVING 3 -+ -+struct req_exec_quorum_reconfigure { -+ unsigned char cmd; -+ unsigned char param; -+ unsigned short pad; -+ int nodeid; -+ unsigned int value; -+}; -+ -+struct req_exec_quorum_killnode { -+ unsigned char cmd; -+ unsigned char pad1; -+ uint16_t reason; -+ int nodeid; -+}; -+ -+/* These just make the access a little neater */ -+static inline int objdb_get_string(struct corosync_api_v1 *corosync, unsigned int object_service_handle, -+ char *key, char **value) -+{ -+ int res; -+ -+ *value = NULL; -+ if ( !(res = corosync_api->object_key_get(object_service_handle, -+ key, -+ strlen(key), -+ (void *)value, -+ NULL))) { -+ if (*value) -+ return 0; -+ } -+ return -1; -+} -+ -+static inline void objdb_get_int(struct corosync_api_v1 *corosync, unsigned int object_service_handle, -+ char *key, unsigned int *intvalue, unsigned int default_value) -+{ -+ char *value = NULL; -+ -+ *intvalue = default_value; -+ -+ if (!corosync_api->object_key_get(object_service_handle, key, strlen(key), -+ (void *)&value, NULL)) { -+ if (value) { -+ *intvalue = atoi(value); -+ } -+ } -+} -+ -+static int votequorum_send_message(void *message, int len) -+{ -+ struct iovec iov[2]; -+ struct q_protheader header; -+ -+ header.tgtport = 0; -+ header.srcport = 0; -+ header.flags = 0; -+ header.srcid = us->node_id; -+ header.tgtid = 0; -+ -+ iov[0].iov_base = &header; -+ iov[0].iov_len = sizeof(header); -+ iov[1].iov_base = message; -+ iov[1].iov_len = len; -+ -+ return corosync_api->tpg_joined_mcast(group_handle, iov, 2, TOTEM_AGREED); -+} -+ -+static void read_quorum_config(unsigned int quorum_handle) -+{ -+ unsigned int value = 0; -+ int cluster_members = 0; -+ struct list_head *tmp; -+ struct cluster_node *node; -+ -+ log_printf(LOG_INFO, "Reading configuration\n"); -+ -+ objdb_get_int(corosync_api, quorum_handle, "expected_votes", &us->expected_votes, DEFAULT_EXPECTED); -+ objdb_get_int(corosync_api, quorum_handle, "votes", &us->votes, 1); -+ objdb_get_int(corosync_api, quorum_handle, "quorumdev_poll", &quorumdev_poll, DEFAULT_QDEV_POLL); -+ objdb_get_int(corosync_api, quorum_handle, "disallowed", &value, 0); -+ if (value) -+ quorum_flags |= VOTEQUORUM_FLAG_FEATURE_DISALLOWED; -+ else -+ quorum_flags &= ~VOTEQUORUM_FLAG_FEATURE_DISALLOWED; -+ -+ objdb_get_int(corosync_api, quorum_handle, "two_node", &value, 0); -+ if (value) -+ quorum_flags |= VOTEQUORUM_FLAG_FEATURE_TWONODE; -+ else -+ quorum_flags &= ~VOTEQUORUM_FLAG_FEATURE_TWONODE; -+ -+ /* -+ * two_node mode is invalid if there are more than 2 nodes in the cluster! -+ */ -+ list_iterate(tmp, &cluster_members_list) { -+ node = list_entry(tmp, struct cluster_node, list); -+ cluster_members++; -+ } -+ -+ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_TWONODE && cluster_members > 2) { -+ log_printf(LOG_WARNING, "quorum.two_node was set but there are more than 2 nodes in the cluster. It will be ignored."); -+ quorum_flags &= ~VOTEQUORUM_FLAG_FEATURE_TWONODE; -+ } -+} -+ -+static int votequorum_exec_init_fn (struct corosync_api_v1 *api) -+{ -+ unsigned int object_handle; -+ unsigned int find_handle; -+ -+ ENTER(); -+ -+ corosync_api = api; -+ -+ list_init(&cluster_members_list); -+ list_init(&trackers_list); -+ -+ /* Allocate a cluster_node for us */ -+ us = allocate_node(corosync_api->totem_nodeid_get()); -+ if (!us) -+ return (1); -+ -+ us->flags |= NODE_FLAGS_US; -+ us->state = NODESTATE_MEMBER; -+ us->expected_votes = DEFAULT_EXPECTED; -+ us->votes = 1; -+ time(&us->join_time); -+ -+ /* Get configuration variables */ -+ corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); -+ -+ if (corosync_api->object_find_next(find_handle, &object_handle) == 0) { -+ read_quorum_config(object_handle); -+ } -+ /* Listen for changes */ -+ add_votequorum_config_notification(object_handle); -+ corosync_api->object_find_destroy(find_handle); -+ -+ api->tpg_init(&group_handle, quorum_deliver_fn, quorum_confchg_fn); -+ api->tpg_join(group_handle, quorum_group, 1); -+ -+ LEAVE(); -+ return (0); -+} -+ -+static int quorum_lib_exit_fn (void *conn) -+{ -+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ -+ ENTER(); -+ if (quorum_pd->tracking_enabled) { -+ list_del (&quorum_pd->list); -+ list_init (&quorum_pd->list); -+ } -+ LEAVE(); -+ return (0); -+} -+ -+ -+static int send_quorum_notification(void *conn, uint64_t context) -+{ -+ struct res_lib_votequorum_notification *res_lib_votequorum_notification; -+ struct list_head *tmp; -+ struct cluster_node *node; -+ int cluster_members = 0; -+ int i = 0; -+ int size; -+ char *buf; -+ -+ ENTER(); -+ list_iterate(tmp, &cluster_members_list) { -+ node = list_entry(tmp, struct cluster_node, list); -+ cluster_members++; -+ } -+ if (quorum_device) -+ cluster_members++; -+ -+ size = sizeof(struct res_lib_votequorum_notification) + sizeof(struct votequorum_node) * cluster_members; -+ buf = alloca(size); -+ if (!buf) { -+ LEAVE(); -+ return -1; -+ } -+ -+ res_lib_votequorum_notification = (struct res_lib_votequorum_notification *)buf; -+ res_lib_votequorum_notification->quorate = cluster_is_quorate; -+ res_lib_votequorum_notification->node_list_entries = cluster_members; -+ res_lib_votequorum_notification->context = context; -+ list_iterate(tmp, &cluster_members_list) { -+ node = list_entry(tmp, struct cluster_node, list); -+ res_lib_votequorum_notification->node_list[i].nodeid = node->node_id; -+ res_lib_votequorum_notification->node_list[i++].state = node->state; -+ } -+ if (quorum_device) { -+ res_lib_votequorum_notification->node_list[i].nodeid = 0; -+ res_lib_votequorum_notification->node_list[i++].state = quorum_device->state | 0x80; -+ } -+ res_lib_votequorum_notification->header.id = MESSAGE_RES_VOTEQUORUM_NOTIFICATION; -+ res_lib_votequorum_notification->header.size = size; -+ res_lib_votequorum_notification->header.error = CS_OK; -+ -+ /* Send it to all interested parties */ -+ if (conn) { -+ int ret = corosync_api->ipc_conn_send_response(conn, buf, size); -+ LEAVE(); -+ return ret; -+ } -+ else { -+ struct quorum_pd *qpd; -+ -+ list_iterate(tmp, &trackers_list) { -+ qpd = list_entry(tmp, struct quorum_pd, list); -+ res_lib_votequorum_notification->context = qpd->tracking_context; -+ corosync_api->ipc_conn_send_response(corosync_api->ipc_conn_partner_get(qpd->conn), buf, size); -+ } -+ } -+ LEAVE(); -+ return 0; -+} -+ -+static void set_quorate(int total_votes) -+{ -+ int quorate; -+ -+ ENTER(); -+ if (quorum > total_votes) { -+ quorate = 0; -+ } -+ else { -+ quorate = 1; -+ } -+ -+ if (cluster_is_quorate && !quorate) -+ log_printf(LOG_INFO, "quorum lost, blocking activity\n"); -+ if (!cluster_is_quorate && quorate) -+ log_printf(LOG_INFO, "quorum regained, resuming activity\n"); -+ -+ /* If we are newly quorate, then kill any DISALLOWED nodes */ -+ if (!cluster_is_quorate && quorate) { -+ struct cluster_node *node = NULL; -+ struct list_head *tmp; -+ -+ list_iterate(tmp, &cluster_members_list) { -+ node = list_entry(tmp, struct cluster_node, list); -+ if (node->state == NODESTATE_DISALLOWED) -+ quorum_exec_send_killnode(node->node_id, VOTEQUORUM_REASON_KILL_REJOIN); -+ } -+ } -+ -+ cluster_is_quorate = quorate; -+ set_quorum(quorum_members, quorum_members_entries, quorate, &quorum_ringid); -+ ENTER(); -+} -+ -+static int calculate_quorum(int allow_decrease, int max_expected, unsigned int *ret_total_votes) -+{ -+ struct list_head *nodelist; -+ struct cluster_node *node; -+ unsigned int total_votes = 0; -+ unsigned int highest_expected = 0; -+ unsigned int newquorum, q1, q2; -+ unsigned int total_nodes = 0; -+ unsigned int leaving = 0; -+ -+ ENTER(); -+ list_iterate(nodelist, &cluster_members_list) { -+ node = list_entry(nodelist, struct cluster_node, list); -+ -+ log_printf(LOG_DEBUG, "node %x state=%d, votes=%d, expected=%d\n", -+ node->node_id, node->state, node->votes, node->expected_votes); -+ -+ if (node->state == NODESTATE_MEMBER) { -+ if (max_expected) -+ node->expected_votes = max_expected; -+ else -+ highest_expected = max(highest_expected, node->expected_votes); -+ total_votes += node->votes; -+ total_nodes++; -+ } -+ if (node->state == NODESTATE_LEAVING) { -+ leaving = 1; -+ } -+ } -+ -+ if (quorum_device && quorum_device->state == NODESTATE_MEMBER) -+ total_votes += quorum_device->votes; -+ -+ if (max_expected > 0) -+ highest_expected = max_expected; -+ -+ /* This quorum calculation is taken from the OpenVMS Cluster Systems -+ * manual, but, then, you guessed that didn't you */ -+ q1 = (highest_expected + 2) / 2; -+ q2 = (total_votes + 2) / 2; -+ newquorum = max(q1, q2); -+ -+ /* Normally quorum never decreases but the system administrator can -+ * force it down by setting expected votes to a maximum value */ -+ if (!allow_decrease) -+ newquorum = max(quorum, newquorum); -+ -+ /* The special two_node mode allows each of the two nodes to retain -+ * quorum if the other fails. Only one of the two should live past -+ * fencing (as both nodes try to fence each other in split-brain.) -+ * Also: if there are more than two nodes, force us inquorate to avoid -+ * any damage or confusion. -+ */ -+ if ((quorum_flags & VOTEQUORUM_FLAG_FEATURE_TWONODE) && total_nodes <= 2) -+ newquorum = 1; -+ -+ if (ret_total_votes) -+ *ret_total_votes = total_votes; -+ -+ LEAVE(); -+ return newquorum; -+} -+ -+/* Recalculate cluster quorum, set quorate and notify changes */ -+static void recalculate_quorum(int allow_decrease) -+{ -+ unsigned int total_votes; -+ -+ ENTER(); -+ quorum = calculate_quorum(allow_decrease, 0, &total_votes); -+ set_quorate(total_votes); -+ send_quorum_notification(NULL, 0L); -+ LEAVE(); -+} -+ -+static int have_disallowed(void) -+{ -+ struct cluster_node *node; -+ struct list_head *tmp; -+ -+ list_iterate(tmp, &cluster_members_list) { -+ node = list_entry(tmp, struct cluster_node, list); -+ if (node->state == NODESTATE_DISALLOWED) -+ return 1; -+ } -+ -+ return 0; -+} -+ -+static void node_add_ordered(struct cluster_node *newnode) -+{ -+ struct cluster_node *node = NULL; -+ struct list_head *tmp; -+ struct list_head *newlist = &newnode->list; -+ -+ list_iterate(tmp, &cluster_members_list) { -+ node = list_entry(tmp, struct cluster_node, list); -+ -+ if (newnode->node_id < node->node_id) -+ break; -+ } -+ -+ if (!node) -+ list_add(&newnode->list, &cluster_members_list); -+ else { -+ newlist->prev = tmp->prev; -+ newlist->next = tmp; -+ tmp->prev->next = newlist; -+ tmp->prev = newlist; -+ } -+} -+ -+static struct cluster_node *allocate_node(int nodeid) -+{ -+ struct cluster_node *cl; -+ -+ cl = malloc(sizeof(struct cluster_node)); -+ if (cl) { -+ memset(cl, 0, sizeof(struct cluster_node)); -+ cl->node_id = nodeid; -+ if (nodeid) -+ node_add_ordered(cl); -+ } -+ return cl; -+} -+ -+static struct cluster_node *find_node_by_nodeid(int nodeid) -+{ -+ struct cluster_node *node; -+ struct list_head *tmp; -+ -+ list_iterate(tmp, &cluster_members_list) { -+ node = list_entry(tmp, struct cluster_node, list); -+ if (node->node_id == nodeid) -+ return node; -+ } -+ return NULL; -+} -+ -+ -+static int quorum_exec_send_nodeinfo() -+{ -+ struct req_exec_quorum_nodeinfo req_exec_quorum_nodeinfo; -+ int ret; -+ -+ ENTER(); -+ -+ req_exec_quorum_nodeinfo.cmd = VOTEQUORUM_MSG_NODEINFO; -+ req_exec_quorum_nodeinfo.expected_votes = us->expected_votes; -+ req_exec_quorum_nodeinfo.votes = us->votes; -+ req_exec_quorum_nodeinfo.major_version = VOTEQUORUM_MAJOR_VERSION; -+ req_exec_quorum_nodeinfo.minor_version = VOTEQUORUM_MINOR_VERSION; -+ req_exec_quorum_nodeinfo.patch_version = VOTEQUORUM_PATCH_VERSION; -+ req_exec_quorum_nodeinfo.flags = us->flags; -+ req_exec_quorum_nodeinfo.first_trans = first_trans; -+ if (have_disallowed()) -+ req_exec_quorum_nodeinfo.flags |= NODE_FLAGS_SEESDISALLOWED; -+ -+ ret = votequorum_send_message(&req_exec_quorum_nodeinfo, sizeof(req_exec_quorum_nodeinfo)); -+ LEAVE(); -+ return ret; -+} -+ -+ -+static int quorum_exec_send_reconfigure(int param, int nodeid, int value) -+{ -+ struct req_exec_quorum_reconfigure req_exec_quorum_reconfigure; -+ int ret; -+ -+ ENTER(); -+ -+ req_exec_quorum_reconfigure.cmd = VOTEQUORUM_MSG_RECONFIGURE; -+ req_exec_quorum_reconfigure.param = param; -+ req_exec_quorum_reconfigure.nodeid = nodeid; -+ req_exec_quorum_reconfigure.value = value; -+ -+ ret = votequorum_send_message(&req_exec_quorum_reconfigure, sizeof(req_exec_quorum_reconfigure)); -+ LEAVE(); -+ return ret; -+} -+ -+static int quorum_exec_send_killnode(int nodeid, unsigned int reason) -+{ -+ struct req_exec_quorum_killnode req_exec_quorum_killnode; -+ int ret; -+ -+ ENTER(); -+ -+ req_exec_quorum_killnode.cmd = VOTEQUORUM_MSG_KILLNODE; -+ req_exec_quorum_killnode.nodeid = nodeid; -+ req_exec_quorum_killnode.reason = reason; -+ -+ ret = votequorum_send_message(&req_exec_quorum_killnode, sizeof(req_exec_quorum_killnode)); -+ LEAVE(); -+ return ret; -+} -+ -+static void quorum_confchg_fn ( -+ enum totem_configuration_type configuration_type, -+ unsigned int *member_list, int member_list_entries, -+ unsigned int *left_list, int left_list_entries, -+ unsigned int *joined_list, int joined_list_entries, -+ struct memb_ring_id *ring_id) -+{ -+ int i; -+ int leaving = 0; -+ struct cluster_node *node; -+ -+ ENTER(); -+ if (member_list_entries > 1) -+ first_trans = 0; -+ -+ if (left_list_entries) { -+ for (i = 0; i< left_list_entries; i++) { -+ node = find_node_by_nodeid(left_list[i]); -+ if (node) { -+ if (node->state == NODESTATE_LEAVING) -+ leaving = 1; -+ node->state = NODESTATE_DEAD; -+ node->flags |= NODE_FLAGS_BEENDOWN; -+ } -+ } -+ recalculate_quorum(leaving); -+ } -+ -+ if (member_list_entries) { -+ memcpy(quorum_members, member_list, sizeof(unsigned int) * member_list_entries); -+ quorum_members_entries = member_list_entries; -+ if (quorum_device) { -+ quorum_members[quorum_members_entries++] = 0; -+ } -+ quorum_exec_send_nodeinfo(); -+ } -+ -+ memcpy(&quorum_ringid, ring_id, sizeof(*ring_id)); -+ LEAVE(); -+} -+ -+static void exec_quorum_nodeinfo_endian_convert (void *msg) -+{ -+ struct req_exec_quorum_nodeinfo *nodeinfo = (struct req_exec_quorum_nodeinfo *)msg; -+ -+ nodeinfo->votes = swab32(nodeinfo->votes); -+ nodeinfo->expected_votes = swab32(nodeinfo->expected_votes); -+ nodeinfo->major_version = swab32(nodeinfo->major_version); -+ nodeinfo->minor_version = swab32(nodeinfo->minor_version); -+ nodeinfo->patch_version = swab32(nodeinfo->patch_version); -+ nodeinfo->config_version = swab32(nodeinfo->config_version); -+ nodeinfo->flags = swab32(nodeinfo->flags); -+} -+ -+static void exec_quorum_reconfigure_endian_convert (void *msg) -+{ -+ struct req_exec_quorum_reconfigure *reconfigure = (struct req_exec_quorum_reconfigure *)msg; -+ reconfigure->nodeid = swab32(reconfigure->nodeid); -+ reconfigure->value = swab32(reconfigure->value); -+} -+ -+static void exec_quorum_killnode_endian_convert (void *msg) -+{ -+ struct req_exec_quorum_killnode *killnode = (struct req_exec_quorum_killnode *)msg; -+ killnode->reason = swab16(killnode->reason); -+ killnode->nodeid = swab32(killnode->nodeid); -+} -+ -+static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len, -+ int endian_conversion_required) -+{ -+ struct q_protheader *header = iovec->iov_base; -+ char *buf; -+ -+ ENTER(); -+ -+ if (endian_conversion_required) { -+ header->srcid = swab32(header->srcid); -+ header->tgtid = swab32(header->tgtid); -+ header->flags = swab32(header->flags); -+ } -+ -+ /* Only pass on messages for us or everyone */ -+ if (header->tgtport == 0 && -+ (header->tgtid == us->node_id || -+ header->tgtid == 0)) { -+ buf = iovec->iov_base + sizeof(struct q_protheader); -+ switch (*buf) { -+ -+ case VOTEQUORUM_MSG_NODEINFO: -+ if (endian_conversion_required) -+ exec_quorum_nodeinfo_endian_convert(buf); -+ message_handler_req_exec_quorum_nodeinfo (buf, header->srcid); -+ break; -+ case VOTEQUORUM_MSG_RECONFIGURE: -+ if (endian_conversion_required) -+ exec_quorum_reconfigure_endian_convert(buf); -+ message_handler_req_exec_quorum_reconfigure (buf, header->srcid); -+ break; -+ case VOTEQUORUM_MSG_KILLNODE: -+ if (endian_conversion_required) -+ exec_quorum_killnode_endian_convert(buf); -+ message_handler_req_exec_quorum_killnode (buf, header->srcid); -+ break; -+ -+ /* Just ignore other messages */ -+ } -+ } -+ LEAVE(); -+} -+ -+static void message_handler_req_exec_quorum_nodeinfo ( -+ void *message, -+ unsigned int nodeid) -+{ -+ struct req_exec_quorum_nodeinfo *req_exec_quorum_nodeinfo = (struct req_exec_quorum_nodeinfo *)message; -+ struct cluster_node *node; -+ int old_votes; -+ int old_expected; -+ nodestate_t old_state; -+ int new_node = 0; -+ -+ ENTER(); -+ log_printf(LOG_LEVEL_DEBUG, "got nodeinfo message from cluster node %d\n", nodeid); -+ -+ node = find_node_by_nodeid(nodeid); -+ if (!node) { -+ node = allocate_node(nodeid); -+ new_node = 1; -+ } -+ if (!node) { -+ corosync_api->error_memory_failure(); -+ return; -+ } -+ -+ /* -+ * If the node sending the message sees disallowed nodes and we don't, then -+ * we have to leave -+ */ -+ if (req_exec_quorum_nodeinfo->flags & NODE_FLAGS_SEESDISALLOWED && !have_disallowed()) { -+ /* Must use syslog directly here or the message will never arrive */ -+ syslog(LOG_CRIT, "[VOTEQ]: Joined a cluster with disallowed nodes. must die"); -+ corosync_api->fatal_error(2, __FILE__, __LINE__); -+ exit(2); -+ } -+ old_votes = node->votes; -+ old_expected = node->expected_votes; -+ old_state = node->state; -+ -+ /* Update node state */ -+ if (req_exec_quorum_nodeinfo->minor_version >= 2) -+ node->votes = req_exec_quorum_nodeinfo->votes; -+ node->expected_votes = req_exec_quorum_nodeinfo->expected_votes; -+ node->state = NODESTATE_MEMBER; -+ -+ /* Check flags for disallowed (if enabled) */ -+ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_DISALLOWED) { -+ if ((req_exec_quorum_nodeinfo->flags & NODE_FLAGS_HASSTATE && node->flags & NODE_FLAGS_BEENDOWN) || -+ (req_exec_quorum_nodeinfo->flags & NODE_FLAGS_HASSTATE && req_exec_quorum_nodeinfo->first_trans && !(node->flags & NODE_FLAGS_US))) { -+ if (node->state != NODESTATE_DISALLOWED) { -+ if (cluster_is_quorate) { -+ log_printf(LOG_CRIT, "Killing node %d because it has rejoined the cluster with existing state", node->node_id); -+ node->state = NODESTATE_DISALLOWED; -+ quorum_exec_send_killnode(nodeid, VOTEQUORUM_REASON_KILL_REJOIN); -+ } -+ else { -+ log_printf(LOG_CRIT, "Node %d not joined to quorum because it has existing state", node->node_id); -+ node->state = NODESTATE_DISALLOWED; -+ } -+ } -+ } -+ } -+ node->flags &= ~NODE_FLAGS_BEENDOWN; -+ -+ if (new_node || old_votes != node->votes || old_expected != node->expected_votes || old_state != node->state) -+ recalculate_quorum(0); -+ LEAVE(); -+} -+ -+static void message_handler_req_exec_quorum_killnode ( -+ void *message, -+ unsigned int nodeid) -+{ -+ struct req_exec_quorum_killnode *req_exec_quorum_killnode = (struct req_exec_quorum_killnode *)message; -+ -+ if (req_exec_quorum_killnode->nodeid == corosync_api->totem_nodeid_get()) { -+ log_printf(LOG_CRIT, "Killed by node %d: %s\n", nodeid, kill_reason(req_exec_quorum_killnode->reason)); -+ -+ corosync_api->fatal_error(1, __FILE__, __LINE__); -+ exit(1); -+ } -+} -+ -+static void message_handler_req_exec_quorum_reconfigure ( -+ void *message, -+ unsigned int nodeid) -+{ -+ struct req_exec_quorum_reconfigure *req_exec_quorum_reconfigure = (struct req_exec_quorum_reconfigure *)message; -+ struct cluster_node *node; -+ struct list_head *nodelist; -+ -+ log_printf(LOG_LEVEL_DEBUG, "got reconfigure message from cluster node %d\n", nodeid); -+ -+ node = find_node_by_nodeid(req_exec_quorum_reconfigure->nodeid); -+ if (!node) -+ return; -+ -+ switch(req_exec_quorum_reconfigure->param) -+ { -+ case RECONFIG_PARAM_EXPECTED_VOTES: -+ node->expected_votes = req_exec_quorum_reconfigure->value; -+ -+ list_iterate(nodelist, &cluster_members_list) { -+ node = list_entry(nodelist, struct cluster_node, list); -+ if (node->state == NODESTATE_MEMBER && -+ node->expected_votes > req_exec_quorum_reconfigure->value) { -+ node->expected_votes = req_exec_quorum_reconfigure->value; -+ } -+ } -+ recalculate_quorum(1); /* Allow decrease */ -+ break; -+ -+ case RECONFIG_PARAM_NODE_VOTES: -+ node->votes = req_exec_quorum_reconfigure->value; -+ recalculate_quorum(1); /* Allow decrease */ -+ break; -+ -+ case RECONFIG_PARAM_LEAVING: -+ node->state = NODESTATE_LEAVING; -+ break; -+ } -+} -+ -+static int quorum_lib_init_fn (void *conn) -+{ -+ struct quorum_pd *pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ -+ ENTER(); -+ -+ list_init (&pd->list); -+ pd->conn = conn; -+ -+ LEAVE(); -+ return (0); -+} -+ -+/* Message from the library */ -+static void message_handler_req_lib_votequorum_getinfo (void *conn, void *message) -+{ -+ struct req_lib_votequorum_getinfo *req_lib_votequorum_getinfo = (struct req_lib_votequorum_getinfo *)message; -+ struct res_lib_votequorum_getinfo res_lib_votequorum_getinfo; -+ struct cluster_node *node; -+ unsigned int highest_expected = 0; -+ unsigned int total_votes = 0; -+ cs_error_t error = CS_OK; -+ -+ log_printf(LOG_LEVEL_DEBUG, "got getinfo request on %p for node %d\n", conn, req_lib_votequorum_getinfo->nodeid); -+ -+ if (req_lib_votequorum_getinfo->nodeid) { -+ node = find_node_by_nodeid(req_lib_votequorum_getinfo->nodeid); -+ } -+ else { -+ node = us; -+ } -+ -+ if (node) { -+ struct cluster_node *iternode; -+ struct list_head *nodelist; -+ -+ list_iterate(nodelist, &cluster_members_list) { -+ iternode = list_entry(nodelist, struct cluster_node, list); -+ -+ if (iternode->state == NODESTATE_MEMBER) { -+ highest_expected = -+ max(highest_expected, iternode->expected_votes); -+ total_votes += iternode->votes; -+ } -+ } -+ -+ if (quorum_device && quorum_device->state == NODESTATE_MEMBER) { -+ total_votes += quorum_device->votes; -+ } -+ -+ res_lib_votequorum_getinfo.votes = us->votes; -+ res_lib_votequorum_getinfo.expected_votes = us->expected_votes; -+ res_lib_votequorum_getinfo.highest_expected = highest_expected; -+ -+ res_lib_votequorum_getinfo.quorum = quorum; -+ res_lib_votequorum_getinfo.total_votes = total_votes; -+ res_lib_votequorum_getinfo.flags = 0; -+ res_lib_votequorum_getinfo.nodeid = node->node_id; -+ -+ if (us->flags & NODE_FLAGS_HASSTATE) -+ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_HASSTATE; -+ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_TWONODE) -+ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_TWONODE; -+ if (cluster_is_quorate) -+ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_QUORATE; -+ if (us->flags & NODE_FLAGS_SEESDISALLOWED) -+ res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_FLAG_DISALLOWED; -+ } -+ else { -+ error = CS_ERR_NOT_EXIST; -+ } -+ -+ res_lib_votequorum_getinfo.header.size = sizeof(res_lib_votequorum_getinfo); -+ res_lib_votequorum_getinfo.header.id = MESSAGE_RES_VOTEQUORUM_GETINFO; -+ res_lib_votequorum_getinfo.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_getinfo, sizeof(res_lib_votequorum_getinfo)); -+ log_printf(LOG_LEVEL_DEBUG, "getinfo response error: %d\n", error); -+} -+ -+/* Message from the library */ -+static void message_handler_req_lib_votequorum_setexpected (void *conn, void *message) -+{ -+ struct req_lib_votequorum_setexpected *req_lib_votequorum_setexpected = (struct req_lib_votequorum_setexpected *)message; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ cs_error_t error = CS_OK; -+ unsigned int newquorum; -+ unsigned int total_votes; -+ -+ ENTER(); -+ -+ /* -+ * If there are disallowed nodes, then we can't allow the user -+ * to bypass them by fiddling with expected votes. -+ */ -+ if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_DISALLOWED && have_disallowed()) { -+ error = CS_ERR_EXIST; -+ goto error_exit; -+ } -+ -+ /* Validate new expected votes */ -+ newquorum = calculate_quorum(1, req_lib_votequorum_setexpected->expected_votes, &total_votes); -+ if (newquorum < total_votes / 2 -+ || newquorum > total_votes) { -+ error = CS_ERR_INVALID_PARAM; -+ goto error_exit; -+ } -+ -+ quorum_exec_send_reconfigure(RECONFIG_PARAM_EXPECTED_VOTES, us->node_id, req_lib_votequorum_setexpected->expected_votes); -+ -+ /* send status */ -+error_exit: -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ LEAVE(); -+} -+ -+/* Message from the library */ -+static void message_handler_req_lib_votequorum_setvotes (void *conn, void *message) -+{ -+ struct req_lib_votequorum_setvotes *req_lib_votequorum_setvotes = (struct req_lib_votequorum_setvotes *)message; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ struct cluster_node *node; -+ unsigned int newquorum; -+ unsigned int total_votes; -+ unsigned int saved_votes; -+ cs_error_t error = CS_OK; -+ -+ ENTER(); -+ -+ node = find_node_by_nodeid(req_lib_votequorum_setvotes->nodeid); -+ if (!node) { -+ error = CS_ERR_NAME_NOT_FOUND; -+ goto error_exit; -+ } -+ -+ /* Check votes is valid */ -+ saved_votes = node->votes; -+ node->votes = req_lib_votequorum_setvotes->votes; -+ -+ newquorum = calculate_quorum(1, 0, &total_votes); -+ -+ if (newquorum < total_votes / 2 || newquorum > total_votes) { -+ node->votes = saved_votes; -+ error = CS_ERR_INVALID_PARAM; -+ goto error_exit; -+ } -+ -+ if (!req_lib_votequorum_setvotes->nodeid) -+ req_lib_votequorum_setvotes->nodeid = corosync_api->totem_nodeid_get(); -+ -+ quorum_exec_send_reconfigure(RECONFIG_PARAM_NODE_VOTES, req_lib_votequorum_setvotes->nodeid, req_lib_votequorum_setvotes->votes); -+ -+error_exit: -+ /* send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_votequorum_leaving (void *conn, void *message) -+{ -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ cs_error_t error = CS_OK; -+ -+ ENTER(); -+ -+ quorum_exec_send_reconfigure(RECONFIG_PARAM_LEAVING, us->node_id, 0); -+ -+ /* send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ LEAVE(); -+} -+ -+static void quorum_device_timer_fn(void *arg) -+{ -+ struct timeval now; -+ -+ ENTER(); -+ if (!quorum_device || quorum_device->state == NODESTATE_DEAD) -+ return; -+ gettimeofday(&now, NULL); -+ if (quorum_device->last_hello.tv_sec + quorumdev_poll/1000 < now.tv_sec) { -+ quorum_device->state = NODESTATE_DEAD; -+ log_printf(LOG_INFO, "lost contact with quorum device\n"); -+ recalculate_quorum(0); -+ } -+ else { -+ corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device, -+ quorum_device_timer_fn, &quorum_device_timer); -+ } -+ LEAVE(); -+} -+ -+ -+static void message_handler_req_lib_votequorum_qdisk_register (void *conn, void *message) -+{ -+ struct req_lib_votequorum_qdisk_register *req_lib_votequorum_qdisk_register = (struct req_lib_votequorum_qdisk_register *)message; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ cs_error_t error = CS_OK; -+ -+ ENTER(); -+ -+ if (quorum_device) { -+ error = CS_ERR_EXIST; -+ } -+ else { -+ quorum_device = allocate_node(0); -+ quorum_device->state = NODESTATE_DEAD; -+ quorum_device->votes = req_lib_votequorum_qdisk_register->votes; -+ strcpy(quorum_device_name, req_lib_votequorum_qdisk_register->name); -+ list_add(&quorum_device->list, &cluster_members_list); -+ } -+ -+ /* send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn, void *message) -+{ -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ cs_error_t error = CS_OK; -+ -+ ENTER(); -+ -+ if (quorum_device) { -+ struct cluster_node *node = quorum_device; -+ -+ quorum_device = NULL; -+ list_del(&node->list); -+ free(node); -+ recalculate_quorum(0); -+ } -+ else { -+ error = CS_ERR_NOT_EXIST; -+ } -+ -+ /* send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_votequorum_qdisk_poll (void *conn, void *message) -+{ -+ struct req_lib_votequorum_qdisk_poll *req_lib_votequorum_qdisk_poll = (struct req_lib_votequorum_qdisk_poll *)message; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ cs_error_t error = CS_OK; -+ -+ ENTER(); -+ -+ if (quorum_device) { -+ if (req_lib_votequorum_qdisk_poll->state) { -+ gettimeofday(&quorum_device->last_hello, NULL); -+ if (quorum_device->state == NODESTATE_DEAD) { -+ quorum_device->state = NODESTATE_MEMBER; -+ recalculate_quorum(0); -+ -+ corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device, -+ quorum_device_timer_fn, &quorum_device_timer); -+ } -+ } -+ else { -+ if (quorum_device->state == NODESTATE_MEMBER) { -+ quorum_device->state = NODESTATE_DEAD; -+ recalculate_quorum(0); -+ corosync_api->timer_delete(quorum_device_timer); -+ } -+ } -+ } -+ else { -+ error = CS_ERR_NOT_EXIST; -+ } -+ -+ /* send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, void *message) -+{ -+ struct res_lib_votequorum_qdisk_getinfo res_lib_votequorum_qdisk_getinfo; -+ cs_error_t error = CS_OK; -+ -+ ENTER(); -+ -+ if (quorum_device) { -+ log_printf(LOG_LEVEL_DEBUG, "got qdisk_getinfo state %d\n", quorum_device->state); -+ res_lib_votequorum_qdisk_getinfo.votes = quorum_device->votes; -+ if (quorum_device->state == NODESTATE_MEMBER) -+ res_lib_votequorum_qdisk_getinfo.state = 1; -+ else -+ res_lib_votequorum_qdisk_getinfo.state = 0; -+ strcpy(res_lib_votequorum_qdisk_getinfo.name, quorum_device_name); -+ } -+ else { -+ error = CS_ERR_NOT_EXIST; -+ } -+ -+ /* send status */ -+ res_lib_votequorum_qdisk_getinfo.header.size = sizeof(res_lib_votequorum_qdisk_getinfo); -+ res_lib_votequorum_qdisk_getinfo.header.id = MESSAGE_RES_VOTEQUORUM_GETINFO; -+ res_lib_votequorum_qdisk_getinfo.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_qdisk_getinfo, sizeof(res_lib_votequorum_qdisk_getinfo)); -+ -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_votequorum_setstate (void *conn, void *message) -+{ -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ cs_error_t error = CS_OK; -+ -+ ENTER(); -+ -+ us->flags |= NODE_FLAGS_HASSTATE; -+ -+ /* send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_votequorum_trackstart (void *conn, void *msg) -+{ -+ struct req_lib_votequorum_trackstart *req_lib_votequorum_trackstart = (struct req_lib_votequorum_trackstart *)msg; -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ -+ ENTER(); -+ /* -+ * If an immediate listing of the current cluster membership -+ * is requested, generate membership list -+ */ -+ if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CURRENT || -+ req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES) { -+ log_printf(LOG_LEVEL_DEBUG, "sending initial status to %p\n", conn); -+ send_quorum_notification(corosync_api->ipc_conn_partner_get (conn), req_lib_votequorum_trackstart->context); -+ } -+ -+ /* -+ * Record requests for tracking -+ */ -+ if (req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES || -+ req_lib_votequorum_trackstart->track_flags & CS_TRACK_CHANGES_ONLY) { -+ -+ quorum_pd->track_flags = req_lib_votequorum_trackstart->track_flags; -+ quorum_pd->tracking_enabled = 1; -+ quorum_pd->tracking_context = req_lib_votequorum_trackstart->context; -+ -+ list_add (&quorum_pd->list, &trackers_list); -+ } -+ -+ /* Send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = CS_OK; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ -+ LEAVE(); -+} -+ -+static void message_handler_req_lib_votequorum_trackstop (void *conn, void *msg) -+{ -+ struct res_lib_votequorum_status res_lib_votequorum_status; -+ struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn); -+ int error = CS_OK; -+ -+ ENTER(); -+ -+ if (quorum_pd->tracking_enabled) { -+ error = CS_OK; -+ quorum_pd->tracking_enabled = 0; -+ list_del (&quorum_pd->list); -+ list_init (&quorum_pd->list); -+ } else { -+ error = CS_ERR_NOT_EXIST; -+ } -+ -+ /* send status */ -+ res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status); -+ res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS; -+ res_lib_votequorum_status.header.error = error; -+ corosync_api->ipc_conn_send_response(conn, &res_lib_votequorum_status, sizeof(res_lib_votequorum_status)); -+ -+ LEAVE(); -+} -+ -+ -+static char *kill_reason(int reason) -+{ -+ static char msg[1024]; -+ -+ switch (reason) -+ { -+ case VOTEQUORUM_REASON_KILL_REJECTED: -+ return "our membership application was rejected"; -+ -+ case VOTEQUORUM_REASON_KILL_APPLICATION: -+ return "we were killed by an application request"; -+ -+ case VOTEQUORUM_REASON_KILL_REJOIN: -+ return "we rejoined the cluster without a full restart"; -+ -+ default: -+ sprintf(msg, "we got kill message number %d", reason); -+ return msg; -+ } -+} -+ -+static void reread_config(unsigned int object_handle) -+{ -+ unsigned int old_votes; -+ unsigned int old_expected; -+ -+ old_votes = us->votes; -+ old_expected = us->expected_votes; -+ -+ /* -+ * Reload the configuration -+ */ -+ read_quorum_config(object_handle); -+ -+ /* -+ * Check for fundamental changes that we need to propogate -+ */ -+ if (old_votes != us->votes) { -+ quorum_exec_send_reconfigure(RECONFIG_PARAM_NODE_VOTES, us->node_id, us->votes); -+ } -+ if (old_expected != us->expected_votes) { -+ quorum_exec_send_reconfigure(RECONFIG_PARAM_EXPECTED_VOTES, us->node_id, us->expected_votes); -+ } -+} -+ -+static void quorum_key_change_notify(object_change_type_t change_type, -+ unsigned int parent_object_handle, -+ unsigned int object_handle, -+ void *object_name_pt, int object_name_len, -+ void *key_name_pt, int key_len, -+ void *key_value_pt, int key_value_len, -+ void *priv_data_pt) -+{ -+ if (memcmp(object_name_pt, "quorum", object_name_len) == 0) -+ reread_config(object_handle); -+} -+ -+ -+/* Called when the objdb is reloaded */ -+static void votequorum_objdb_reload_notify( -+ objdb_reload_notify_type_t type, int flush, -+ void *priv_data_pt) -+{ -+ /* -+ * A new quorum {} key might exist, cancel the -+ * existing notification at the start of reload, -+ * and start a new one on the new object when -+ * it's all settled. -+ */ -+ -+ if (type == OBJDB_RELOAD_NOTIFY_START) { -+ corosync_api->object_track_stop( -+ quorum_key_change_notify, -+ NULL, -+ NULL, -+ NULL, -+ NULL); -+ } -+ -+ if (type == OBJDB_RELOAD_NOTIFY_END || -+ type == OBJDB_RELOAD_NOTIFY_FAILED) { -+ unsigned int find_handle; -+ unsigned int object_handle; -+ -+ corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); -+ if (corosync_api->object_find_next(find_handle, &object_handle) == 0) { -+ add_votequorum_config_notification(object_handle); -+ -+ reread_config(object_handle); -+ } -+ else { -+ log_printf(LOG_LEVEL_ERROR, "votequorum objdb tracking stopped, cannot find quorum{} handle in objdb\n"); -+ } -+ } -+} -+ -+ -+static void add_votequorum_config_notification( -+ unsigned int quorum_object_handle) -+{ -+ -+ corosync_api->object_track_start(quorum_object_handle, -+ 1, -+ quorum_key_change_notify, -+ NULL, -+ NULL, -+ NULL, -+ NULL); -+ -+ /* -+ * Reload notify must be on the parent object -+ */ -+ corosync_api->object_track_start(OBJECT_PARENT_HANDLE, -+ 1, -+ NULL, -+ NULL, -+ NULL, -+ votequorum_objdb_reload_notify, -+ NULL); -+} -diff -Naurd corosync-0.92/test/cpgbench.c corosync-trunk/test/cpgbench.c ---- corosync-0.92/test/cpgbench.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/test/cpgbench.c 2008-11-06 22:49:07.000000000 +0100 -@@ -50,7 +50,7 @@ - #include - #include - --#include -+#include - #include - - #ifdef COROSYNC_SOLARIS -@@ -121,12 +121,12 @@ - if (flow_control_state == CPG_FLOW_CONTROL_DISABLED) { - retry: - res = cpg_mcast_joined (handle, CPG_TYPE_AGREED, &iov, 1); -- if (res == CPG_ERR_TRY_AGAIN) { -+ if (res == CS_ERR_TRY_AGAIN) { - goto retry; - } - } -- res = cpg_dispatch (handle, CPG_DISPATCH_ALL); -- if (res != CPG_OK) { -+ res = cpg_dispatch (handle, CS_DISPATCH_ALL); -+ if (res != CS_OK) { - printf ("cpg dispatch returned error %d\n", res); - exit (1); - } -@@ -162,13 +162,13 @@ - - signal (SIGALRM, sigalrm_handler); - res = cpg_initialize (&handle, &callbacks); -- if (res != CPG_OK) { -+ if (res != CS_OK) { - printf ("cpg_initialize failed with result %d\n", res); - exit (1); - } - - res = cpg_join (handle, &group_name); -- if (res != CPG_OK) { -+ if (res != CS_OK) { - printf ("cpg_join failed with result %d\n", res); - exit (1); - } -@@ -179,7 +179,7 @@ - } - - res = cpg_finalize (handle); -- if (res != CPG_OK) { -+ if (res != CS_OK) { - printf ("cpg_join failed with result %d\n", res); - exit (1); - } -diff -Naurd corosync-0.92/test/evsbench.c corosync-trunk/test/evsbench.c ---- corosync-0.92/test/evsbench.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/test/evsbench.c 2008-11-06 22:49:07.000000000 +0100 -@@ -49,7 +49,7 @@ - #include - #include - --#include -+#include - #include - - #ifdef COROSYNC_SOLARIS -@@ -124,7 +124,7 @@ - int write_size) - { - struct timeval tv1, tv2, tv_elapsed; -- evs_error_t result; -+ cs_error_t result; - int write_count = 0; - - /* -@@ -139,12 +139,12 @@ - if (outstanding < 10) { - result = evs_mcast_joined (handle, EVS_TYPE_AGREED, &iov, 1); - -- if (result != EVS_ERR_TRY_AGAIN) { -+ if (result != CS_ERR_TRY_AGAIN) { - write_count += 1; - outstanding++; - } - } -- result = evs_dispatch (handle, EVS_DISPATCH_ALL); -+ result = evs_dispatch (handle, CS_DISPATCH_ALL); - } while (alarm_notice == 0); - gettimeofday (&tv2, NULL); - timersub (&tv2, &tv1, &tv_elapsed); -@@ -174,7 +174,7 @@ - int main (void) { - int size; - int i; -- evs_error_t result; -+ cs_error_t result; - evs_handle_t handle; - - signal (SIGALRM, sigalrm_handler); -diff -Naurd corosync-0.92/test/evsverify.c corosync-trunk/test/evsverify.c ---- corosync-0.92/test/evsverify.c 2008-09-25 07:31:42.000000000 +0200 -+++ corosync-trunk/test/evsverify.c 2008-11-06 22:49:07.000000000 +0100 -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #include - #include "../exec/crypto.h" - -@@ -112,22 +113,22 @@ - - struct msg msg; - --char buffer[200000]; -+unsigned char buffer[200000]; - int main (void) - { - evs_handle_t handle; -- evs_error_t result; -+ cs_error_t result; - unsigned int i = 0, j; - int fd; - unsigned int member_list[32]; - unsigned int local_nodeid; -- int member_list_entries = 32; -+ unsigned int member_list_entries = 32; - struct msg msg; - hash_state sha1_hash; - struct iovec iov[2]; - - result = evs_initialize (&handle, &callbacks); -- if (result != EVS_OK) { -+ if (result != CS_OK) { - printf ("Couldn't initialize EVS service %d\n", result); - exit (0); - } -@@ -169,10 +170,10 @@ - try_again_one: - result = evs_mcast_joined (handle, EVS_TYPE_AGREED, - iov, 2); -- if (result == EVS_ERR_TRY_AGAIN) { -+ if (result == CS_ERR_TRY_AGAIN) { - goto try_again_one; - } -- result = evs_dispatch (handle, EVS_DISPATCH_ALL); -+ result = evs_dispatch (handle, CS_DISPATCH_ALL); - } - - evs_fd_get (handle, &fd); -diff -Naurd corosync-0.92/test/logsysbench.c corosync-trunk/test/logsysbench.c ---- corosync-0.92/test/logsysbench.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/test/logsysbench.c 2008-10-30 23:25:56.000000000 +0100 -@@ -0,0 +1,171 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: 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. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+LOGSYS_DECLARE_SYSTEM ("logtest_rec", -+ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, -+ NULL, -+ LOG_DAEMON, -+ "[%6s] %b", -+ 100000); -+ -+LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); -+ -+#define LOGREC_ID_CHECKPOINT_CREATE 2 -+#define LOGREC_ARGS_CHECKPOINT_CREATE 2 -+#define ITERATIONS 1000000 -+ -+struct timeval tv1, tv2, tv_elapsed; -+ -+#define timersub(a, b, result) \ -+do { \ -+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ -+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ -+ if ((result)->tv_usec < 0) { \ -+ --(result)->tv_sec; \ -+ (result)->tv_usec += 1000000; \ -+ } \ -+} while (0) -+ -+void bm_start (void) -+{ -+ gettimeofday (&tv1, NULL); -+} -+void bm_finish (char *operation) -+{ -+ gettimeofday (&tv2, NULL); -+ timersub (&tv2, &tv1, &tv_elapsed); -+ -+ if (strlen (operation) > 22) { -+ printf ("%s\t\t", operation); -+ } else { -+ printf ("%s\t\t\t", operation); -+ } -+ printf ("%9.3f operations/sec\n", -+ ((float)ITERATIONS) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0))); -+} -+ -+char buffer[256]; -+int main (void) -+{ -+ int i; -+ char buf[1024]; -+ -+ -+ printf ("heating up cache with logrec functionality\n"); -+ for (i = 0; i < ITERATIONS; i++) { -+ log_rec (LOGREC_ID_CHECKPOINT_CREATE, -+ "recordA", 8, "recordB", 8, LOG_REC_END); -+ } -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ log_rec (LOGREC_ID_CHECKPOINT_CREATE, -+ buffer, 7, LOG_REC_END); -+ } -+ bm_finish ("log_rec 1 arguments:"); -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ log_rec (LOGREC_ID_CHECKPOINT_CREATE, -+ "recordA", 8, LOG_REC_END); -+ } -+ bm_finish ("log_rec 2 arguments:"); -+ bm_start(); -+ for (i = 0; i < 10; i++) { -+ log_rec (LOGREC_ID_CHECKPOINT_CREATE, -+ "recordA", 8, "recordB", 8, LOG_REC_END); -+ } -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ log_rec (LOGREC_ID_CHECKPOINT_CREATE, -+ "recordA", 8, "recordB", 8, "recordC", 8, LOG_REC_END); -+ } -+ bm_finish ("log_rec 3 arguments:"); -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ log_rec (LOGREC_ID_CHECKPOINT_CREATE, -+ "recordA", 8, "recordB", 8, "recordC", 8, "recordD", 8, LOG_REC_END); -+ } -+ bm_finish ("log_rec 4 arguments:"); -+ -+ /* -+ * sprintf testing -+ */ -+ printf ("heating up cache with sprintf functionality\n"); -+ for (i = 0; i < ITERATIONS; i++) { -+ sprintf (buf, "Some logging information %s", "recordA"); -+ } -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ sprintf (buf, "Some logging information %s", "recordA"); -+ } -+ bm_finish ("sprintf 1 argument:"); -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ sprintf (buf, "Some logging information %s %s", "recordA", "recordB"); -+ } -+ bm_finish ("sprintf 2 arguments:"); -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ sprintf (buf, "Some logging information %s %s %s", "recordA", "recordB", "recordC"); -+ } -+ bm_finish ("sprintf 3 arguments:"); -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ sprintf (buf, "Some logging information %s %s %s %s", "recordA", "recordB", "recordC", "recordD"); -+ } -+ bm_finish ("sprintf 4 arguments:"); -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ sprintf (buf, "Some logging information %s %s %s %d", "recordA", "recordB", "recordC", i); -+ } -+ bm_finish ("sprintf 4 arguments (1 int):"); -+ -+ logsys_log_rec_store ("fdata"); -+/* TODO -+ currently fails under some circumstances -+ -+ bm_start(); -+ for (i = 0; i < ITERATIONS; i++) { -+ log_printf (LOG_LEVEL_NOTICE, "test %d", i); -+ } -+ bm_finish("log_printf"); -+*/ -+ -+ return (0); -+} -diff -Naurd corosync-0.92/test/logsysrec.c corosync-trunk/test/logsysrec.c ---- corosync-0.92/test/logsysrec.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/test/logsysrec.c 2008-10-30 23:25:56.000000000 +0100 -@@ -0,0 +1,62 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: 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. -+ */ -+#include -+#include -+#include -+ -+LOGSYS_DECLARE_SYSTEM ("logtest_rec", -+ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, -+ NULL, -+ LOG_DAEMON, -+ "[%6s] %b", -+ 100000); -+ -+LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); -+ -+#define LOGREC_ID_CHECKPOINT_CREATE 2 -+#define LOGREC_ARGS_CHECKPOINT_CREATE 2 -+ -+int main(int argc, char **argv) -+{ -+ int i; -+ -+ for (i = 0; i < 10; i++) { -+ log_printf (LOG_LEVEL_NOTICE, "This is a test of %s\n", "stringparse"); -+ -+ log_rec (LOGREC_ID_CHECKPOINT_CREATE, "record1", 8, "record22", 9, "record333", 10, "record444", 11, LOG_REC_END); -+ } -+ logsys_log_rec_store ("fdata"); -+ -+ return 0; -+} -diff -Naurd corosync-0.92/test/logsys_s.c corosync-trunk/test/logsys_s.c ---- corosync-0.92/test/logsys_s.c 2008-05-12 15:48:06.000000000 +0200 -+++ corosync-trunk/test/logsys_s.c 2008-10-30 23:25:56.000000000 +0100 -@@ -38,7 +38,9 @@ - LOGSYS_DECLARE_SYSTEM ("logsystestsubsystems", - LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED, - NULL, -- LOG_DAEMON); -+ LOG_DAEMON, -+ "[%8s] %b", -+ 100000); - - extern void logsys_s1_print (void); - extern void logsys_s2_print (void); -diff -Naurd corosync-0.92/test/logsys_t1.c corosync-trunk/test/logsys_t1.c ---- corosync-0.92/test/logsys_t1.c 2008-06-20 08:04:03.000000000 +0200 -+++ corosync-trunk/test/logsys_t1.c 2008-10-30 23:25:56.000000000 +0100 -@@ -38,7 +38,9 @@ - LOGSYS_DECLARE_SYSTEM ("logsystestNOsubsystems", - LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED, - NULL, -- LOG_DAEMON); -+ LOG_DAEMON, -+ "%6s %b", -+ 100000); - - LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_DEBUG); - -diff -Naurd corosync-0.92/test/logsys_t2.c corosync-trunk/test/logsys_t2.c ---- corosync-0.92/test/logsys_t2.c 2008-06-20 08:04:03.000000000 +0200 -+++ corosync-trunk/test/logsys_t2.c 2008-10-30 23:25:56.000000000 +0100 -@@ -36,9 +36,11 @@ - #include "../exec/logsys.h" - - LOGSYS_DECLARE_SYSTEM ("logtest_t2", -- LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_BUFFER_BEFORE_CONFIG, -+ LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, - NULL, -- LOG_DAEMON); -+ LOG_DAEMON, -+ "[%6s] %b" -+ 100000); - - LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); - -@@ -48,7 +50,7 @@ - /* - * fork could occur here and the file to output to could be set - */ -- logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_FLUSH_AFTER_CONFIG); -+ logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED); - - log_printf(LOG_NOTICE, "Hello, world!\n"); - log_printf(LOG_DEBUG, "If you see this, the logger's busted\n"); -diff -Naurd corosync-0.92/test/Makefile corosync-trunk/test/Makefile ---- corosync-0.92/test/Makefile 2008-09-25 07:31:42.000000000 +0200 -+++ corosync-trunk/test/Makefile 2009-01-26 11:46:08.000000000 +0100 -@@ -42,9 +42,10 @@ - override LDFLAGS += -lnsl -lsocket -lrt - endif - --LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a -+LIBRARIES= ../lib/libevs.a ../lib/libcpg.a ../lib/libcfg.a ../lib/libconfdb.a ../lib/libquorum.a ../lib/libvotequorum.a - LIBS = $(LIBRARIES) --BINARIES= testevs evsbench evsverify testcpg testcpg2 cpgbench testconfdb -+BINARIES= testevs evsbench evsverify testcpg testcpg2 cpgbench testconfdb logsysbench logsysrec testquorum \ -+ testvotequorum1 testvotequorum2 - - override CFLAGS += -I../include - override LDFLAGS += -L../lib -@@ -75,12 +76,33 @@ - testcpg2: testcpg2.o $(LIBRARIES) - $(CC) $(LDFLAGS) -o testcpg2 testcpg2.o $(LIBS) - -+testquorum: testquorum.o $(LIBRARIES) -+ $(CC) $(LDFLAGS) -o testquorum testquorum.o $(LIBS) -+ - cpgbench: cpgbench.o $(LIBRARIES) - $(CC) $(LDFLAGS) -o cpgbench cpgbench.o $(LIBS) - - testconfdb: testconfdb.o $(LIBRARIES) - $(CC) $(LDFLAGS) -o testconfdb testconfdb.o $(LIBS) -rdynamic - -+logsysbench: logsysbench.o ../exec/liblogsys.a -+ $(CC) -o logsysbench logsysbench.o ../exec/liblogsys.a $(LDFLAGS) -+ -+logsysrec: logsysrec.o ../exec/liblogsys.a -+ $(CC) -o logsysrec logsysrec.o ../exec/liblogsys.a $(LDFLAGS) -+ -+testquorum1: testquorum1.o $(LIBRARIES) -+ $(CC) $(LDFLAGS) -o testquorum1 testquorum1.o $(LIBS) -+ -+testquorum2: testquorum2.o $(LIBRARIES) -+ $(CC) $(LDFLAGS) -o testquorum2 testquorum2.o $(LIBS) -+ -+testvotequorum1: testvotequorum1.o $(LIBRARIES) -+ $(CC) $(LDFLAGS) -o testvotequorum1 testvotequorum1.o $(LIBS) -+ -+testvotequorum2: testvotequorum2.o $(LIBRARIES) -+ $(CC) $(LDFLAGS) -o testvotequorum2 testvotequorum2.o $(LIBS) -+ - logsys_s: logsys_s.o logsys_s1.o logsys_s2.o ../exec/liblogsys.a - $(CC) -o logsys_s logsys_s.o logsys_s1.o logsys_s2.o ../exec/liblogsys.a $(LDFLAGS) - -diff -Naurd corosync-0.92/test/sa_error.c corosync-trunk/test/sa_error.c ---- corosync-0.92/test/sa_error.c 2006-01-24 08:19:11.000000000 +0100 -+++ corosync-trunk/test/sa_error.c 2008-11-06 22:49:07.000000000 +0100 -@@ -6,39 +6,39 @@ - - const char *sa_error_list[] = { - "OUT_OF_RANGE", -- "SA_AIS_OK", -- "SA_AIS_ERR_LIBRARY", -- "SA_AIS_ERR_VERSION", -- "SA_AIS_ERR_INIT", -- "SA_AIS_ERR_TIMEOUT", -- "SA_AIS_ERR_TRY_AGAIN", -- "SA_AIS_ERR_INVALID_PARAM", -- "SA_AIS_ERR_NO_MEMORY", -- "SA_AIS_ERR_BAD_HANDLE", -- "SA_AIS_ERR_BUSY", -- "SA_AIS_ERR_ACCESS", -- "SA_AIS_ERR_NOT_EXIST", -- "SA_AIS_ERR_NAME_TOO_LONG", -- "SA_AIS_ERR_EXIST", -- "SA_AIS_ERR_NO_SPACE", -- "SA_AIS_ERR_INTERRUPT", -- "SA_AIS_ERR_NAME_NOT_FOUND", -- "SA_AIS_ERR_NO_RESOURCES", -- "SA_AIS_ERR_NOT_SUPPORTED", -- "SA_AIS_ERR_BAD_OPERATION", -- "SA_AIS_ERR_FAILED_OPERATION", -- "SA_AIS_ERR_MESSAGE_ERROR", -- "SA_AIS_ERR_QUEUE_FULL", -- "SA_AIS_ERR_QUEUE_NOT_AVAILABLE", -- "SA_AIS_ERR_BAD_CHECKPOINT", -- "SA_AIS_ERR_BAD_FLAGS", -- "SA_AIS_ERR_NO_SECTIONS", -+ "CS_OK", -+ "CS_ERR_LIBRARY", -+ "CS_ERR_VERSION", -+ "CS_ERR_INIT", -+ "CS_ERR_TIMEOUT", -+ "CS_ERR_TRY_AGAIN", -+ "CS_ERR_INVALID_PARAM", -+ "CS_ERR_NO_MEMORY", -+ "CS_ERR_BAD_HANDLE", -+ "CS_ERR_BUSY", -+ "CS_ERR_ACCESS", -+ "CS_ERR_NOT_EXIST", -+ "CS_ERR_NAME_TOO_LONG", -+ "CS_ERR_EXIST", -+ "CS_ERR_NO_SPACE", -+ "CS_ERR_INTERRUPT", -+ "CS_ERR_NAME_NOT_FOUND", -+ "CS_ERR_NO_RESOURCES", -+ "CS_ERR_NOT_SUPPORTED", -+ "CS_ERR_BAD_OPERATION", -+ "CS_ERR_FAILED_OPERATION", -+ "CS_ERR_MESSAGE_ERROR", -+ "CS_ERR_QUEUE_FULL", -+ "CS_ERR_QUEUE_NOT_AVAILABLE", -+ "CS_ERR_BAD_CHECKPOINT", -+ "CS_ERR_BAD_FLAGS", -+ "CS_ERR_NO_SECTIONS", - }; - --int get_sa_error(SaAisErrorT error, char *str, int len) -+int get_sa_error(cs_error_t error, char *str, int len) - { -- if (error < SA_AIS_OK || -- error > SA_AIS_ERR_NO_SECTIONS || -+ if (error < CS_OK || -+ error > CS_ERR_NO_SECTIONS || - len < strlen(sa_error_list[error])) { - errno = EINVAL; - return -1; -@@ -47,11 +47,11 @@ - return 0; - } - --char *get_sa_error_b (SaAisErrorT error) { -+char *get_sa_error_b (cs_error_t error) { - return ((char *)sa_error_list[error]); - } - --char *get_test_output (SaAisErrorT result, SaAisErrorT expected) { -+char *get_test_output (cs_error_t result, cs_error_t expected) { - static char test_result[256]; - - if (result == expected) { -diff -Naurd corosync-0.92/test/sa_error.h corosync-trunk/test/sa_error.h ---- corosync-0.92/test/sa_error.h 2006-01-24 08:19:11.000000000 +0100 -+++ corosync-trunk/test/sa_error.h 2008-11-06 22:49:07.000000000 +0100 -@@ -1,5 +1,5 @@ --extern int get_sa_error(SaAisErrorT error, char *str, int len); -+extern int get_sa_error(cs_error_t error, char *str, int len); - --extern char *get_sa_error_b (SaAisErrorT error); -+extern char *get_sa_error_b (cs_error_t error); - --extern char *get_test_output (SaAisErrorT result, SaAisErrorT expected); -+extern char *get_test_output (cs_error_t result, cs_error_t expected); -diff -Naurd corosync-0.92/test/testconfdb.c corosync-trunk/test/testconfdb.c ---- corosync-0.92/test/testconfdb.c 2008-09-03 09:58:08.000000000 +0200 -+++ corosync-trunk/test/testconfdb.c 2008-11-06 22:49:07.000000000 +0100 -@@ -41,7 +41,7 @@ - #include - #include - --#include -+#include - #include - - #define INCDEC_VALUE 45 -@@ -68,13 +68,13 @@ - - /* Show the keys */ - res = confdb_key_iter_start(handle, parent_object_handle); -- if (res != SA_AIS_OK) { -+ if (res != CS_OK) { - printf( "error resetting key iterator for object %d: %d\n", parent_object_handle, res); - return; - } - - while ( (res = confdb_key_iter(handle, parent_object_handle, key_name, &key_name_len, -- key_value, &key_value_len)) == SA_AIS_OK) { -+ key_value, &key_value_len)) == CS_OK) { - key_name[key_name_len] = '\0'; - key_value[key_value_len] = '\0'; - for (i=0; i - #include - -+#include - #include - - void deliver( -@@ -70,17 +71,17 @@ - int fd; - - printf ("All of the nodeids should match on a single node configuration\n for the test to pass."); -- assert(CPG_OK==cpg_initialize(&handle, &cb)); -- assert(CPG_OK==cpg_local_get(handle,&nodeid)); -+ assert(CS_OK==cpg_initialize(&handle, &cb)); -+ assert(CS_OK==cpg_local_get(handle,&nodeid)); - printf("local_get: %x\n", nodeid); -- assert(CPG_OK==cpg_join(handle, &group)); -+ assert(CS_OK==cpg_join(handle, &group)); - struct iovec msg={"hello", 5}; -- assert(CPG_OK==cpg_mcast_joined(handle,CPG_TYPE_AGREED,&msg,1)); -+ assert(CS_OK==cpg_mcast_joined(handle,CPG_TYPE_AGREED,&msg,1)); - cpg_fd_get (handle, &fd); - pfd.fd = fd; - pfd.events = POLLIN; - - poll (&pfd, 1, 1000); -- cpg_dispatch(handle, CPG_DISPATCH_ALL); -+ cpg_dispatch(handle, CS_DISPATCH_ALL); - return (0); - } -diff -Naurd corosync-0.92/test/testcpg.c corosync-trunk/test/testcpg.c ---- corosync-0.92/test/testcpg.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/test/testcpg.c 2008-11-06 22:49:07.000000000 +0100 -@@ -45,7 +45,7 @@ - #include - #include - --#include -+#include - #include - - static int quit = 0; -@@ -206,25 +206,25 @@ - } - - result = cpg_initialize (&handle, &callbacks); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not initialize Cluster Process Group API instance error %d\n", result); - exit (1); - } - result = cpg_local_get (handle, &nodeid); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not get local node id\n"); - exit (1); - } - - printf ("Local node id is %x\n", nodeid); - result = cpg_join(handle, &group_name); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not join process group, error %d\n", result); - exit (1); - } - - cpg_groups_get(handle, &num_groups); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not get list of groups, error %d\n", result); - exit (1); - } -@@ -255,7 +255,7 @@ - } - } - if (FD_ISSET (select_fd, &read_fds)) { -- if (cpg_dispatch (handle, CPG_DISPATCH_ALL) != SA_AIS_OK) -+ if (cpg_dispatch (handle, CS_DISPATCH_ALL) != CS_OK) - exit(1); - } - } while (result && !quit); -diff -Naurd corosync-0.92/test/testevs.c corosync-trunk/test/testevs.c ---- corosync-0.92/test/testevs.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/test/testevs.c 2008-11-06 22:49:07.000000000 +0100 -@@ -38,6 +38,7 @@ - #include - #include - #include -+#include - #include - - char *delivery_string; -@@ -99,7 +100,7 @@ - int main (void) - { - evs_handle_t handle; -- evs_error_t result; -+ cs_error_t result; - int i = 0; - int fd; - unsigned int member_list[32]; -@@ -107,7 +108,7 @@ - unsigned int member_list_entries = 32; - - result = evs_initialize (&handle, &callbacks); -- if (result != EVS_OK) { -+ if (result != CS_OK) { - printf ("Couldn't initialize EVS service %d\n", result); - exit (0); - } -@@ -142,15 +143,15 @@ - try_again_one: - result = evs_mcast_joined (handle, EVS_TYPE_AGREED, - &iov, 1); -- if (result == EVS_ERR_TRY_AGAIN) { -+ if (result == CS_ERR_TRY_AGAIN) { - //printf ("try again\n"); - goto try_again_one; - } -- result = evs_dispatch (handle, EVS_DISPATCH_ALL); -+ result = evs_dispatch (handle, CS_DISPATCH_ALL); - } - - do { -- result = evs_dispatch (handle, EVS_DISPATCH_ALL); -+ result = evs_dispatch (handle, CS_DISPATCH_ALL); - } while (deliveries < 20); - /* - * Demonstrate evs_mcast_joined -@@ -161,17 +162,17 @@ - try_again_two: - result = evs_mcast_groups (handle, EVS_TYPE_AGREED, - &groups[1], 1, &iov, 1); -- if (result == EVS_ERR_TRY_AGAIN) { -+ if (result == CS_ERR_TRY_AGAIN) { - goto try_again_two; - } - -- result = evs_dispatch (handle, EVS_DISPATCH_ALL); -+ result = evs_dispatch (handle, CS_DISPATCH_ALL); - } - /* - * Flush any pending callbacks - */ - do { -- result = evs_dispatch (handle, EVS_DISPATCH_ALL); -+ result = evs_dispatch (handle, CS_DISPATCH_ALL); - } while (deliveries < 500); - - evs_fd_get (handle, &fd); -diff -Naurd corosync-0.92/test/testquorum.c corosync-trunk/test/testquorum.c ---- corosync-0.92/test/testquorum.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/test/testquorum.c 2008-11-06 22:49:07.000000000 +0100 -@@ -0,0 +1,58 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static quorum_handle_t handle; -+ -+static void quorum_notification_fn( -+ quorum_handle_t handle, -+ uint32_t quorate, -+ uint64_t ring_id, -+ uint32_t view_list_entries, -+ uint32_t *view_list) -+{ -+ int i; -+ -+ printf("quorum notification called \n"); -+ printf(" quorate = %d\n", quorate); -+ printf(" ring id = %lld\n", ring_id); -+ printf(" num nodes = %d ", view_list_entries); -+ -+ for (i=0; i -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static votequorum_handle_t handle; -+ -+static char *node_state(int state) -+{ -+ switch (state) { -+ case NODESTATE_JOINING: -+ return "Joining"; -+ break; -+ case NODESTATE_MEMBER: -+ return "Member"; -+ break; -+ case NODESTATE_DEAD: -+ return "Dead"; -+ break; -+ case NODESTATE_LEAVING: -+ return "Leaving"; -+ break; -+ case NODESTATE_DISALLOWED: -+ return "Disallowed"; -+ break; -+ default: -+ return "UNKNOWN"; -+ break; -+ } -+} -+ -+static void votequorum_notification_fn( -+ votequorum_handle_t handle, -+ uint64_t context, -+ uint32_t quorate, -+ uint32_t node_list_entries, -+ votequorum_node_t node_list[] -+ ) -+{ -+ int i; -+ -+ printf("votequorum notification called \n"); -+ printf(" quorate = %d\n", quorate); -+ printf(" number of nodes = %d\n", node_list_entries); -+ -+ for (i = 0; i< node_list_entries; i++) { -+ printf(" %d: %s\n", node_list[i].nodeid, node_state(node_list[i].state)); -+ } -+ printf("\n"); -+} -+ -+ -+int main(int argc, char *argv[]) -+{ -+ struct votequorum_info info; -+ votequorum_callbacks_t callbacks; -+ int err; -+ -+ if (argc > 1 && strcmp(argv[1], "-h")==0) { -+ fprintf(stderr, "usage: %s [new-expected] [new-votes]\n", argv[0]); -+ return 0; -+ } -+ -+ callbacks.votequorum_notify_fn = votequorum_notification_fn; -+ if ( (err=votequorum_initialize(&handle, &callbacks)) != CS_OK) -+ fprintf(stderr, "votequorum_initialize FAILED: %d\n", err); -+ -+ if ( (err = votequorum_trackstart(handle, handle, CS_TRACK_CHANGES)) != CS_OK) -+ fprintf(stderr, "votequorum_trackstart FAILED: %d\n", err); -+ -+ if ( (err=votequorum_getinfo(handle, 0, &info)) != CS_OK) -+ fprintf(stderr, "votequorum_getinfo FAILED: %d\n", err); -+ else { -+ printf("node votes %d\n", info.node_votes); -+ printf("expected votes %d\n", info.node_expected_votes); -+ printf("highest expected %d\n", info.highest_expected); -+ printf("total votes %d\n", info.total_votes); -+ printf("quorum %d\n", info.quorum); -+ printf("flags "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_HASSTATE) printf("HasState "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_DISALLOWED) printf("Disallowed "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_TWONODE) printf("2Node "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_QUORATE) printf("Quorate "); -+ printf("\n"); -+ } -+ -+ if (argc >= 2 && atoi(argv[1])) { -+ if ( (err=votequorum_setexpected(handle, atoi(argv[1]))) != CS_OK) -+ fprintf(stderr, "set expected votes FAILED: %d\n", err); -+ } -+ if (argc >= 3 && atoi(argv[2])) { -+ if ( (err=votequorum_setvotes(handle, 0, atoi(argv[2]))) != CS_OK) -+ fprintf(stderr, "set votes FAILED: %d\n", err); -+ } -+ -+ if (argc >= 2) { -+ if ( (err=votequorum_getinfo(handle, 0, &info)) != CS_OK) -+ fprintf(stderr, "votequorum_getinfo2 FAILED: %d\n", err); -+ else { -+ printf("-------------------\n"); -+ printf("node votes %d\n", info.node_votes); -+ printf("expected votes %d\n", info.node_expected_votes); -+ printf("highest expected %d\n", info.highest_expected); -+ printf("total votes %d\n", info.total_votes); -+ printf("votequorum %d\n", info.quorum); -+ printf("flags "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_HASSTATE) printf("HasState "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_DISALLOWED) printf("Disallowed "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_TWONODE) printf("2Node "); -+ if (info.flags & VOTEQUORUM_INFO_FLAG_QUORATE) printf("Quorate "); -+ printf("\n"); -+ } -+ } -+ -+ printf("Waiting for votequorum events, press ^C to finish\n"); -+ printf("-------------------\n"); -+ -+ while (1) -+ votequorum_dispatch(handle, CS_DISPATCH_ALL); -+ -+ return 0; -+} -diff -Naurd corosync-0.92/test/testvotequorum2.c corosync-trunk/test/testvotequorum2.c ---- corosync-0.92/test/testvotequorum2.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/test/testvotequorum2.c 2009-01-26 11:46:08.000000000 +0100 -@@ -0,0 +1,96 @@ -+/* -+ * Copyright (c) 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 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 CONTIBUTORS "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 -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static votequorum_handle_t handle; -+ -+ -+static void print_info(int ok_to_fail) -+{ -+ struct votequorum_qdisk_info qinfo; -+ int err; -+ -+ if ( (err=votequorum_qdisk_getinfo(handle, &qinfo)) != CS_OK) -+ fprintf(stderr, "votequorum_qdisk_getinfo error %d: %s\n", err, ok_to_fail?"OK":"FAILED"); -+ else { -+ printf("qdisk votes %d\n", qinfo.votes); -+ printf("state %d\n", qinfo.state); -+ printf("name %s\n", qinfo.name); -+ printf("\n"); -+ } -+} -+ -+int main(int argc, char *argv[]) -+{ -+ int pollcount=0, polltime=1; -+ int err; -+ -+ if ( (err=votequorum_initialize(&handle, NULL)) != CS_OK) { -+ fprintf(stderr, "votequorum_initialize FAILED: %d\n", err); -+ return -1; -+ } -+ -+ print_info(1); -+ -+ if (argc >= 2 && atoi(argv[1])) { -+ pollcount = atoi(argv[1]); -+ } -+ if (argc >= 3 && atoi(argv[2])) { -+ polltime = atoi(argv[2]); -+ } -+ -+ if (argc >= 2) { -+ if ( (err=votequorum_qdisk_register(handle, "QDISK", 4)) != CS_OK) -+ fprintf(stderr, "qdisk_register FAILED: %d\n", err); -+ -+ while (pollcount--) { -+ print_info(0); -+ if ((err=votequorum_qdisk_poll(handle, 1)) != CS_OK) -+ fprintf(stderr, "qdisk poll FAILED: %d\n", err); -+ print_info(0); -+ sleep(polltime); -+ } -+ if ((err= votequorum_qdisk_unregister(handle)) != CS_OK) -+ fprintf(stderr, "qdisk unregister FAILED: %d\n", err); -+ } -+ print_info(1); -+ -+ return 0; -+} -diff -Naurd corosync-0.92/tools/corosync-cfgtool.c corosync-trunk/tools/corosync-cfgtool.c ---- corosync-0.92/tools/corosync-cfgtool.c 2008-08-14 18:54:46.000000000 +0200 -+++ corosync-trunk/tools/corosync-cfgtool.c 2009-01-19 09:31:21.000000000 +0100 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2006-2007 Red Hat, Inc. -+ * Copyright (c) 2006-2009 Red Hat, Inc. - * - * All rights reserved. - * -@@ -38,6 +38,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -45,12 +46,13 @@ - #include - #include - --#include -+#include -+#include - #include - - static void ringstatusget_do (void) - { -- SaAisErrorT result; -+ cs_error_t result; - corosync_cfg_handle_t handle; - unsigned int interface_count; - char **interface_names; -@@ -59,84 +61,199 @@ - - printf ("Printing ring status.\n"); - result = corosync_cfg_initialize (&handle, NULL); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not initialize corosync configuration API error %d\n", result); - exit (1); - } - -- corosync_cfg_ring_status_get (handle, -- &interface_names, -- &interface_status, -- &interface_count); -- -- for (i = 0; i < interface_count; i++) { -- printf ("RING ID %d\n", i); -- printf ("\tid\t= %s\n", interface_names[i]); -- printf ("\tstatus\t= %s\n", interface_status[i]); -+ result = corosync_cfg_ring_status_get (handle, -+ &interface_names, -+ &interface_status, -+ &interface_count); -+ if (result != CS_OK) { -+ printf ("Could not get the ring status, the error is: %d\n", result); -+ } else { -+ for (i = 0; i < interface_count; i++) { -+ printf ("RING ID %d\n", i); -+ printf ("\tid\t= %s\n", interface_names[i]); -+ printf ("\tstatus\t= %s\n", interface_status[i]); -+ } - } -- -- corosync_cfg_finalize (handle); -+ (void)corosync_cfg_finalize (handle); - } - - static void ringreenable_do (void) - { -- SaAisErrorT result; -+ cs_error_t result; - corosync_cfg_handle_t handle; - - printf ("Re-enabling all failed rings.\n"); - result = corosync_cfg_initialize (&handle, NULL); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not initialize corosync configuration API error %d\n", result); - exit (1); - } - - result = corosync_cfg_ring_reenable (handle); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not reenable ring error %d\n", result); - } - -- corosync_cfg_finalize (handle); -+ (void)corosync_cfg_finalize (handle); - } - - void service_load_do (char *service, unsigned int version) - { -- SaAisErrorT result; -+ cs_error_t result; - corosync_cfg_handle_t handle; - - printf ("Loading service '%s' version '%d'\n", service, version); - result = corosync_cfg_initialize (&handle, NULL); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not initialize corosync configuration API error %d\n", result); - exit (1); - } - result = corosync_cfg_service_load (handle, service, version); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not load service (error = %d)\n", result); - } -- corosync_cfg_finalize (handle); -+ (void)corosync_cfg_finalize (handle); - } - - void service_unload_do (char *service, unsigned int version) - { -- SaAisErrorT result; -+ cs_error_t result; - corosync_cfg_handle_t handle; - - printf ("Unloading service '%s' version '%d'\n", service, version); - result = corosync_cfg_initialize (&handle, NULL); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not initialize corosync configuration API error %d\n", result); - exit (1); - } - result = corosync_cfg_service_unload (handle, service, version); -- if (result != SA_AIS_OK) { -+ if (result != CS_OK) { - printf ("Could not unload service (error = %d)\n", result); - } -- corosync_cfg_finalize (handle); -+ (void)corosync_cfg_finalize (handle); -+} -+ -+void shutdown_callback (corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags) -+{ -+ printf("shutdown callback called, flags = %d\n",flags); -+ -+ (void)corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES); -+} -+ -+void *shutdown_dispatch_thread(void *arg) -+{ -+ int res = CS_OK; -+ corosync_cfg_handle_t *handle = arg; -+ -+ while (res == CS_OK) { -+ res = corosync_cfg_dispatch(*handle, CS_DISPATCH_ALL); -+ if (res != CS_OK) -+ printf ("Could not dispatch cfg messages: %d\n", res); -+ } -+ return NULL; -+} -+ -+void shutdown_do() -+{ -+ cs_error_t result; -+ corosync_cfg_handle_t handle; -+ corosync_cfg_callbacks_t callbacks; -+ corosync_cfg_state_notification_t notification_buffer; -+ pthread_t dispatch_thread; -+ -+ printf ("Shutting down corosync\n"); -+ callbacks.corosync_cfg_shutdown_callback = shutdown_callback; -+ -+ result = corosync_cfg_initialize (&handle, &callbacks); -+ if (result != CS_OK) { -+ printf ("Could not initialize corosync configuration API error %d\n", result); -+ exit (1); -+ } -+ -+ pthread_create(&dispatch_thread, NULL, shutdown_dispatch_thread, &handle); -+ -+ result = corosync_cfg_state_track (handle, -+ 0, -+ ¬ification_buffer); -+ if (result != CS_OK) { -+ printf ("Could not start corosync cfg tracking error %d\n", result); -+ exit (1); -+ } -+ -+ result = corosync_cfg_try_shutdown (handle, COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST); -+ if (result != CS_OK) { -+ printf ("Could not shutdown (error = %d)\n", result); -+ } -+ -+ (void)corosync_cfg_finalize (handle); - } - -+void showaddrs_do(int nodeid) -+{ -+ cs_error_t result; -+ corosync_cfg_handle_t handle; -+ corosync_cfg_callbacks_t callbacks; -+ int numaddrs; -+ int i; -+ corosync_cfg_node_address_t addrs[INTERFACE_MAX]; -+ -+ -+ result = corosync_cfg_initialize (&handle, &callbacks); -+ if (result != CS_OK) { -+ printf ("Could not initialize corosync configuration API error %d\n", result); -+ exit (1); -+ } -+ -+ if (!corosync_cfg_get_node_addrs(handle, nodeid, INTERFACE_MAX, &numaddrs, addrs) == CS_OK) { -+ for (i=0; iss_family == AF_INET6) -+ saddr = &sin6->sin6_addr; -+ else -+ saddr = &sin->sin_addr; -+ -+ inet_ntop(ss->ss_family, saddr, buf, sizeof(buf)); -+ printf("%s", buf); -+ } -+ printf("\n"); -+ } -+ -+ -+ (void)corosync_cfg_finalize (handle); -+} -+ -+void killnode_do(unsigned int nodeid) -+{ -+ cs_error_t result; -+ corosync_cfg_handle_t handle; -+ -+ printf ("Killing node %d\n", nodeid); -+ result = corosync_cfg_initialize (&handle, NULL); -+ if (result != CS_OK) { -+ printf ("Could not initialize corosync configuration API error %d\n", result); -+ exit (1); -+ } -+ result = corosync_cfg_kill_node (handle, nodeid, "Killed by corosync-cfgtool"); -+ if (result != CS_OK) { -+ printf ("Could not kill node (error = %d)\n", result); -+ } -+ (void)corosync_cfg_finalize (handle); -+} -+ -+ - void usage_do (void) - { -- printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version]\n\n"); -+ printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); - printf ("A tool for displaying and configuring active parameters within corosync.\n"); - printf ("options:\n"); - printf ("\t-s\tDisplays the status of the current rings on this node.\n"); -@@ -144,15 +261,19 @@ - printf ("\t\tre-enable redundant ring operation.\n"); - printf ("\t-l\tLoad a service identified by name.\n"); - printf ("\t-u\tUnload a service identified by name.\n"); -+ printf ("\t-a\tDisplay the IP address(es) of a node\n"); -+ printf ("\t-k\tKill a node identified by node id.\n"); -+ printf ("\t-h\tShutdown corosync cleanly on this node.\n"); - } - - int main (int argc, char *argv[]) { -- const char *options = "srl:u:v:"; -+ const char *options = "srl:u:v:k:a:h"; - int opt; - int service_load = 0; -+ unsigned int nodeid; - int service_unload = 0; -- char *service; -- unsigned int version; -+ char *service = NULL; -+ unsigned int version = 0; - - if (argc == 1) { - usage_do (); -@@ -173,17 +294,28 @@ - service_unload = 1; - service = strdup (optarg); - break; -+ case 'k': -+ nodeid = atoi (optarg); -+ killnode_do(nodeid); -+ break; -+ case 'h': -+ shutdown_do(); -+ break; -+ case 'a': -+ showaddrs_do( atoi(optarg) ); -+ break; - case 'v': - version = atoi (optarg); -+ break; - } - } - - if (service_load) { - service_load_do (service, version); -- } else -+ } else - if (service_unload) { - service_unload_do (service, version); - } -- -+ - return (0); - } -diff -Naurd corosync-0.92/tools/corosync-fplay.c corosync-trunk/tools/corosync-fplay.c ---- corosync-0.92/tools/corosync-fplay.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/tools/corosync-fplay.c 2008-11-11 18:25:22.000000000 +0100 -@@ -0,0 +1,485 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+unsigned int flt_data_size = 1000000; -+ -+unsigned int *flt_data; -+#define FDHEAD_INDEX (flt_data_size) -+#define FDTAIL_INDEX (flt_data_size + 1) -+ -+#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr)) -+ -+struct totem_ip_address { -+ unsigned int nodeid; -+ unsigned short family; -+ unsigned char addr[TOTEMIP_ADDRLEN]; -+} __attribute__((packed)); -+ -+struct memb_ring_id { -+ struct totem_ip_address rep; -+ unsigned long long seq; -+} __attribute__((packed)); -+ -+const char *totemip_print(struct totem_ip_address *addr) -+{ -+ static char buf[INET6_ADDRSTRLEN]; -+ -+ return inet_ntop(addr->family, addr->addr, buf, sizeof(buf)); -+} -+ -+char *print_string_len (unsigned char *str, unsigned int len) -+{ -+ unsigned int i; -+ static char buf[1024]; -+ memset (buf, 0, sizeof (buf)); -+ for (i = 0; i < len; i++) { -+ buf[i] = str[i]; -+ } -+ return (buf); -+} -+ -+void sync_printer_confchg_set_sync (void **record) -+{ -+ unsigned int *my_should_sync = record[0]; -+ printf ("Setting my_should_sync to %d\n", *my_should_sync); -+} -+ -+void sync_printer_set_sync_state (void **record) -+{ -+ unsigned int *my_sync_state = record[0]; -+ printf ("Setting my_sync_state to %d\n", *my_sync_state); -+} -+ -+void sync_printer_process_currentstate (void **record) -+{ -+ unsigned int *my_sync_state = record[0]; -+ printf ("Retrieving my_sync_state %d\n", *my_sync_state); -+} -+ -+void sync_printer_process_get_shouldsync (void **record) -+{ -+ unsigned int *my_should_sync = record[0]; -+ printf ("Getting my_should_sync %d\n", *my_should_sync); -+} -+ -+void sync_printer_checkpoint_release (void **record) -+{ -+ unsigned char *name = record[0]; -+ uint16_t *name_len = record[1]; -+ unsigned int *ckpt_id = record[2]; -+ unsigned int *from = record[3]; -+ -+ printf ("Checkpoint release name=[%s] id=[%d] from=[%d] len=[%d]\n", -+ print_string_len (name, *name_len), -+ *ckpt_id, -+ *from, -+ *name_len); -+} -+ -+void sync_printer_checkpoint_transmit (void **record) -+{ -+ unsigned char *name = record[0]; -+ uint16_t *name_len = record[1]; -+ unsigned int *ckpt_id = record[2]; -+ unsigned int *xmit_id = record[3]; -+ -+ printf ("xmit_id=[%d] Checkpoint transmit name=[%s] id=[%d]\n", -+ *xmit_id, print_string_len (name, *name_len), -+ *ckpt_id); -+} -+ -+void sync_printer_section_transmit (void **record) -+{ -+ unsigned char *ckpt_name = record[0]; -+ uint16_t *name_len = record[1]; -+ unsigned int *ckpt_id = record[2]; -+ unsigned int *xmit_id = record[3]; -+ unsigned char *section_name = record[4]; -+ uint16_t *section_name_len = record[5]; -+ -+ printf ("xmit_id=[%d] Section transmit checkpoint name=[%s] id=[%d] ", -+ *xmit_id, print_string_len (ckpt_name, *name_len), -+ *ckpt_id); -+ printf ("section=[%s]\n", -+ print_string_len (section_name, *section_name_len)); -+} -+void sync_printer_checkpoint_receive (void **record) -+{ -+ unsigned char *ckpt_name = record[0]; -+ uint16_t *name_len = record[1]; -+ unsigned int *ckpt_id = record[2]; -+ unsigned int *xmit_id = record[3]; -+ -+ printf ("xmit_id=[%d] Checkpoint receive checkpoint name=[%s] id=[%d]\n", -+ *xmit_id, print_string_len (ckpt_name, *name_len), *ckpt_id); -+} -+ -+void sync_printer_section_receive (void **record) -+{ -+ unsigned char *ckpt_name = record[0]; -+ uint16_t *name_len = record[1]; -+ unsigned int *ckpt_id = record[2]; -+ unsigned int *xmit_id = record[3]; -+ unsigned char *section_name = record[4]; -+ unsigned int *section_name_len = record[5]; -+ -+ printf ("xmit_id=[%d] Section receive checkpoint name=[%s] id=[%d] ", -+ *xmit_id, print_string_len (ckpt_name, *name_len), -+ *ckpt_id); -+ -+ printf ("section=[%s]\n", -+ print_string_len (section_name, *section_name_len)); -+} -+ -+void sync_printer_nada (void **record) -+{ -+printf ("nada\n"); -+} -+void sync_printer_confchg_fn (void **record) -+{ -+ unsigned int i; -+ -+ unsigned int *members = record[0]; -+ unsigned int *member_count = record[1]; -+ struct memb_ring_id *ring_id = record[2]; -+ struct in_addr addr; -+ -+ printf ("sync confchg fn ringid [ip=%s seq=%lld]\n", -+ totemip_print (&ring_id->rep), -+ ring_id->seq); -+ printf ("members [%d]:\n", *member_count); -+ for (i = 0; i < *member_count; i++) { -+ addr.s_addr = members[i]; -+ printf ("\tmember [%s]\n", inet_ntoa (addr)); -+ } -+} -+ -+void printer_totemsrp_mcast (void **record) -+{ -+ unsigned int *msgid = record[0]; -+ -+ printf ("totemsrp_mcast %d\n", *msgid); -+} -+ -+void printer_totemsrp_delv (void **record) -+{ -+ unsigned int *msgid = record[0]; -+ -+ printf ("totemsrp_delv %d\n", *msgid); -+} -+ -+void printer_totempg_mcast_fits (void **record) -+{ -+ unsigned int *index = record[0]; -+ unsigned int *iov_len = record[1]; -+ unsigned int *copy_len = record[2]; -+ unsigned int *fragment_size = record[3]; -+ unsigned int *max_packet_size = record[4]; -+ unsigned int *copy_base = record[5]; -+ unsigned char *next_fragment = record[6]; -+ -+ printf ("totempg_mcast index=[%d] iov_len=[%d] copy_len=[%d] fragment_size=[%d] max_packet_size=[%d] copy_base=[%d] next_fragment[%d]\n", -+ *index, *iov_len, *copy_len, *fragment_size, *max_packet_size, *copy_base, *next_fragment); -+} -+ -+void sync_printer_service_process (void **record) -+{ -+ struct memb_ring_id *ring_id = record[0]; -+ struct memb_ring_id *sync_ring_id = record[1]; -+ -+ printf ("sync service process callback ringid [ip=%s seq=%lld] ", -+ totemip_print (&ring_id->rep), -+ ring_id->seq); -+ printf ("sync ringid [ip=%s seq=%lld]\n", -+ totemip_print (&sync_ring_id->rep), -+ sync_ring_id->seq); -+} -+ -+struct printer_subsys_record_print { -+ int ident; -+ void (*print_fn)(void **record); -+ int record_length; -+}; -+ -+struct printer_subsys { -+ char *subsys; -+ struct printer_subsys_record_print *record_printers; -+ int record_printers_count; -+}; -+ -+#define LOGREC_ID_SYNC_CONFCHG_FN 0 -+#define LOGREC_ID_SYNC_SERVICE_PROCESS 1 -+ -+/* -+ * CKPT subsystem -+ */ -+#define LOGREC_ID_CONFCHG_SETSYNC 0 -+#define LOGREC_ID_SETSYNCSTATE 1 -+#define LOGREC_ID_SYNC_PROCESS_CURRENTSTATE 2 -+#define LOGREC_ID_SYNC_PROCESS_GETSHOULDSYNC 3 -+#define LOGREC_ID_SYNC_CHECKPOINT_TRANSMIT 4 -+#define LOGREC_ID_SYNC_SECTION_TRANSMIT 5 -+#define LOGREC_ID_SYNC_CHECKPOINT_RECEIVE 6 -+#define LOGREC_ID_SYNC_SECTION_RECEIVE 7 -+#define LOGREC_ID_SYNC_CHECKPOINT_RELEASE 8 -+ -+#define LOGREC_ID_TOTEMSRP_MCAST 0 -+#define LOGREC_ID_TOTEMSRP_DELV 1 -+#define LOGREC_ID_TOTEMPG_MCAST_FITS 2 -+ -+ -+struct printer_subsys_record_print record_print_sync[] = { -+ { -+ .ident = LOGREC_ID_SYNC_CONFCHG_FN, -+ .print_fn = sync_printer_confchg_fn, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_SERVICE_PROCESS, -+ .print_fn = sync_printer_service_process, -+ .record_length = 28 -+ } -+}; -+ -+struct printer_subsys_record_print record_print_ckpt[] = { -+ { -+ .ident = LOGREC_ID_CONFCHG_SETSYNC, -+ .print_fn = sync_printer_confchg_set_sync, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SETSYNCSTATE, -+ .print_fn = sync_printer_set_sync_state, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_PROCESS_CURRENTSTATE, -+ .print_fn = sync_printer_process_currentstate, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_PROCESS_GETSHOULDSYNC, -+ .print_fn = sync_printer_process_get_shouldsync, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_CHECKPOINT_TRANSMIT, -+ .print_fn = sync_printer_checkpoint_transmit, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_SECTION_TRANSMIT, -+ .print_fn = sync_printer_section_transmit, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_CHECKPOINT_RECEIVE, -+ .print_fn = sync_printer_checkpoint_receive, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_SECTION_RECEIVE, -+ .print_fn = sync_printer_section_receive, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_SYNC_CHECKPOINT_RELEASE, -+ .print_fn = sync_printer_checkpoint_release, -+ .record_length = 28 -+ } -+ -+}; -+struct printer_subsys_record_print record_print_totem[] = { -+ { -+ .ident = LOGREC_ID_TOTEMSRP_MCAST, -+ .print_fn = printer_totemsrp_mcast, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_TOTEMSRP_DELV, -+ .print_fn = printer_totemsrp_delv, -+ .record_length = 28 -+ }, -+ { -+ .ident = LOGREC_ID_TOTEMPG_MCAST_FITS, -+ .print_fn = printer_totempg_mcast_fits, -+ .record_length = 28 -+ } -+}; -+ -+struct printer_subsys printer_subsystems[] = { -+ { -+ .subsys = "SYNC", -+ .record_printers = record_print_sync, -+ .record_printers_count = sizeof (record_print_sync) / sizeof (struct printer_subsys_record_print) -+ }, -+ { -+ .subsys = "CKPT", -+ .record_printers = record_print_ckpt, -+ .record_printers_count = sizeof (record_print_ckpt) / sizeof (struct printer_subsys_record_print) -+ }, -+ { -+ .subsys = "TOTEM", -+ .record_printers = record_print_totem, -+ .record_printers_count = sizeof (record_print_totem) / sizeof (struct printer_subsys_record_print) -+ } -+}; -+ -+unsigned int printer_subsys_count = sizeof (printer_subsystems) / sizeof (struct printer_subsys); -+ -+unsigned int records_printed = 1; -+ -+unsigned int record[10000]; -+ -+/* -+ * Copy record, dealing with wrapping -+ */ -+int logsys_rec_get (int rec_idx) { -+ unsigned int rec_size; -+ int firstcopy, secondcopy; -+ -+ rec_size = flt_data[rec_idx]; -+ -+ firstcopy = rec_size; -+ secondcopy = 0; -+ if (firstcopy + rec_idx > flt_data_size) { -+ firstcopy = flt_data_size - rec_idx; -+ secondcopy -= firstcopy - rec_size; -+ } -+ memcpy (&record[0], &flt_data[rec_idx], firstcopy<<2); -+ if (secondcopy) { -+ memcpy (&record[firstcopy], &flt_data[0], secondcopy<<2); -+ } -+ return ((rec_idx + rec_size) % flt_data_size); -+} -+ -+void logsys_rec_print (void *record) -+{ -+ unsigned int *buf_uint32t = (unsigned int *)record; -+ unsigned int rec_size; -+ unsigned int rec_ident; -+ unsigned int line; -+ unsigned int arg_size_idx; -+ unsigned int i; -+ unsigned int j; -+ unsigned int rec_idx = 0; -+ unsigned int record_number; -+ unsigned int words_processed; -+ unsigned int found; -+ void *arguments[64]; -+ int arg_count = 0; -+ -+ rec_size = buf_uint32t[rec_idx]; -+ rec_ident = buf_uint32t[rec_idx+1]; -+ line = buf_uint32t[rec_idx+2]; -+ record_number = buf_uint32t[rec_idx+3]; -+ -+printf ("rec=[%d] ", record_number); -+ arg_size_idx = rec_idx + 4; -+ words_processed = 4; -+ for (i = 0; words_processed < rec_size; i++) { -+ arguments[arg_count++] = &buf_uint32t[arg_size_idx + 1]; -+ words_processed += buf_uint32t[arg_size_idx] + 1; -+ arg_size_idx += buf_uint32t[arg_size_idx] + 1; -+ -+ } -+ -+ found = 0; -+ for (i = 0; i < printer_subsys_count; i++) { -+ if (strcmp ((char *)arguments[0], printer_subsystems[i].subsys) == 0) { -+ for (j = 0; j < printer_subsystems[i].record_printers_count; j++) { -+ if (rec_ident == printer_subsystems[i].record_printers[j].ident) { -+ printer_subsystems[i].record_printers[j].print_fn (&arguments[3]); -+ found = 1; -+ } -+ } -+ } -+ } -+ if (rec_ident & LOGSYS_TAG_LOG) { -+ printf ("Log Message=%s\n", (char *)arguments[3]); -+ found = 1; -+ } -+ if (rec_ident & LOGSYS_TAG_ENTER) { -+ printf ("ENTERING function [%s] line [%d]\n", (char *)arguments[2], line); -+ found = 1; -+ } -+ if (rec_ident & LOGSYS_TAG_LEAVE) { -+ printf ("LEAVING function [%s] line [%d]\n", (char *)arguments[2], line); -+ found = 1; -+ } -+ if (found == 0) { -+ printf ("Unknown record type found subsys=[%s] ident=[%d]\n", -+ (char *)arguments[0], rec_ident); -+ } -+ -+ -+ if (rec_ident == 999) { -+ printf ("ENTERING function [%s] line [%d]\n", (char *)arguments[2], line); -+ found = 1; -+ } -+ if (rec_ident == 1000) { -+ printf ("LEAVING function [%s] line [%d]\n", (char *)arguments[2], line); -+ found = 1; -+ } -+ if (found == 0) { -+ printf ("Unknown record type found subsys=[%s] ident=[%d]\n", -+ (char *)arguments[0], rec_ident); -+ } -+ -+ -+#ifdef COMPILE_OUT -+printf ("\n"); -+#endif -+} -+ -+int main (void) -+{ -+ unsigned int fd; -+ int rec_idx; -+ int end_rec; -+ int record_count = 1; -+ int size_read; -+ -+ flt_data = malloc ((flt_data_size + 2) * sizeof (unsigned int)); -+ fd = open ("/var/lib/corosync/fdata", O_RDONLY); -+ size_read = (int)read (fd, flt_data, (flt_data_size + 2) * sizeof (unsigned int)); -+ -+ if (size_read != (flt_data_size + 2) * sizeof (unsigned int)) { -+ printf ("Warning: read %d bytes, but expected %d\n", -+ size_read, (flt_data_size + 2) * sizeof (unsigned int)); -+ } -+ -+ rec_idx = flt_data[FDTAIL_INDEX]; -+ end_rec = flt_data[FDHEAD_INDEX]; -+ -+ printf ("Starting replay: head [%d] tail [%d]\n", -+ flt_data[FDHEAD_INDEX], -+ flt_data[FDTAIL_INDEX]); -+ -+ for (;;) { -+ rec_idx = logsys_rec_get (rec_idx); -+ logsys_rec_print (record); -+ if (rec_idx == end_rec) { -+ break; -+ } -+ record_count += 1; -+ } -+ -+ printf ("Finishing replay: records found [%d]\n", record_count); -+ return (0); -+} -diff -Naurd corosync-0.92/tools/corosync-keygen.c corosync-trunk/tools/corosync-keygen.c ---- corosync-0.92/tools/corosync-keygen.c 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/tools/corosync-keygen.c 2008-11-11 19:13:47.000000000 +0100 -@@ -44,7 +44,7 @@ - int authkey_fd; - int random_fd; - unsigned char key[128]; -- int res; -+ ssize_t res; - - printf ("Corosync Cluster Engine Authentication key generator.\n"); - if (geteuid() != 0) { -@@ -80,7 +80,7 @@ - /* - * Set security of authorization key to uid = 0 uid = 0 mode = 0400 - */ -- res = fchown (authkey_fd, 0, 0); -+ fchown (authkey_fd, 0, 0); - fchmod (authkey_fd, 0400); - - printf ("Writing corosync key to /etc/ais/authkey.\n"); -diff -Naurd corosync-0.92/tools/corosync-objctl.c corosync-trunk/tools/corosync-objctl.c ---- corosync-0.92/tools/corosync-objctl.c 2008-08-14 18:44:26.000000000 +0200 -+++ corosync-trunk/tools/corosync-objctl.c 2008-12-08 17:11:07.000000000 +0100 -@@ -32,6 +32,7 @@ - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -+#include - #include - #include - #include -@@ -41,7 +42,7 @@ - #include - #include - --#include -+#include - #include - - #define SEPERATOR '.' -@@ -104,12 +105,12 @@ - int key_name_len; - char key_value[OBJ_NAME_SIZE]; - int key_value_len; -- confdb_error_t res; -+ cs_error_t res; - int children_printed; - - /* Show the keys */ - res = confdb_key_iter_start(handle, parent_object_handle); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf(stderr, "error resetting key iterator for object %d: %d\n", parent_object_handle, res); - exit(EXIT_FAILURE); - } -@@ -120,7 +121,7 @@ - key_name, - &key_name_len, - key_value, -- &key_value_len)) == CONFDB_OK) { -+ &key_value_len)) == CS_OK) { - key_name[key_name_len] = '\0'; - key_value[key_value_len] = '\0'; - if (parent_name != NULL) -@@ -133,7 +134,7 @@ - - /* Show sub-objects */ - res = confdb_object_iter_start(handle, parent_object_handle); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf(stderr, "error resetting object iterator for object %d: %d\n", parent_object_handle, res); - exit(EXIT_FAILURE); - } -@@ -142,7 +143,7 @@ - parent_object_handle, - &object_handle, - object_name, -- &object_name_len)) == CONFDB_OK) { -+ &object_name_len)) == CS_OK) { - - object_name[object_name_len] = '\0'; - if (parent_name != NULL) { -@@ -165,7 +166,7 @@ - int result; - - result = confdb_initialize (&handle, &callbacks); -- if (result != CONFDB_OK) { -+ if (result != CS_OK) { - fprintf (stderr, "Could not initialize objdb library. Error %d\n", result); - return 1; - } -@@ -181,22 +182,23 @@ - static int print_help(void) - { - printf("\n"); -- printf ("usage: corosync-objctl object%ckey ...\n", SEPERATOR); -- printf (" corosync-objctl -c object%cchild_obj ...\n", SEPERATOR); -- printf (" corosync-objctl -d object%cchild_obj ...\n", SEPERATOR); -- printf (" corosync-objctl -w object%cchild_obj.key=value ...\n", SEPERATOR); -- printf (" corosync-objctl -a (print all objects)\n"); -+ printf ("usage: corosync-objctl object%ckey ... Print an object\n", SEPERATOR); -+ printf (" corosync-objctl -c object%cchild_obj ... Create Object\n", SEPERATOR); -+ printf (" corosync-objctl -d object%cchild_obj ... Delete object\n", SEPERATOR); -+ printf (" corosync-objctl -w object%cchild_obj.key=value ... Create a key\n", SEPERATOR); -+ printf (" corosync-objctl -t object%cchild_obj ... Track changes\n", SEPERATOR); -+ printf (" corosync-objctl -a Print all objects\n"); - printf("\n"); - return 0; - } - --static confdb_error_t validate_name(char * obj_name_pt) -+static cs_error_t validate_name(char * obj_name_pt) - { - if ((strchr (obj_name_pt, SEPERATOR) == NULL) && - (strchr (obj_name_pt, '=') == NULL)) -- return CONFDB_OK; -+ return CS_OK; - else -- return CONFDB_ERR_INVALID_PARAM; -+ return CS_ERR_INVALID_PARAM; - } - - void get_child_name(char * name_pt, char * child_name) -@@ -251,7 +253,7 @@ - strcpy(key_name, tmp+1); - } - --static confdb_error_t find_object (confdb_handle_t handle, -+static cs_error_t find_object (confdb_handle_t handle, - char * name_pt, - find_object_of_type_t type, - uint32_t * out_handle) -@@ -261,21 +263,21 @@ - uint32_t obj_handle; - confdb_handle_t parent_object_handle = OBJECT_PARENT_HANDLE; - char tmp_name[OBJ_NAME_SIZE]; -- confdb_error_t res; -+ cs_error_t res; - - strncpy (tmp_name, name_pt, OBJ_NAME_SIZE); - obj_name_pt = strtok_r(tmp_name, SEPERATOR_STR, &save_pt); - - while (obj_name_pt != NULL) { - res = confdb_object_find_start(handle, parent_object_handle); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf (stderr, "Could not start object_find %d\n", res); - exit (EXIT_FAILURE); - } - - res = confdb_object_find(handle, parent_object_handle, - obj_name_pt, strlen (obj_name_pt), &obj_handle); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - return res; - } - -@@ -291,11 +293,11 @@ - { - char parent_name[OBJ_NAME_SIZE]; - uint32_t obj_handle; -- confdb_error_t res; -+ cs_error_t res; - - get_parent_name(name_pt, parent_name); - res = find_object (handle, name_pt, FIND_OBJECT_OR_KEY, &obj_handle); -- if (res == CONFDB_OK) { -+ if (res == CS_OK) { - print_config_tree(handle, obj_handle, parent_name); - } - } -@@ -308,19 +310,19 @@ - char key_value[OBJ_NAME_SIZE]; - char old_key_value[OBJ_NAME_SIZE]; - int old_key_value_len; -- confdb_error_t res; -+ cs_error_t res; - - /* find the parent object */ - get_parent_name(path_pt, parent_name); - get_key(path_pt, key_name, key_value); - -- if (validate_name(key_name) != CONFDB_OK) { -+ if (validate_name(key_name) != CS_OK) { - fprintf(stderr, "Incorrect key name, can not have \"=\" or \"%c\"\n", SEPERATOR); - exit(EXIT_FAILURE); - } - res = find_object (handle, parent_name, FIND_OBJECT_ONLY, &obj_handle); - -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf(stderr, "Can't find parent object of \"%s\"\n", path_pt); - exit(EXIT_FAILURE); - } -@@ -333,7 +335,7 @@ - old_key_value, - &old_key_value_len); - -- if (res == CONFDB_OK) { -+ if (res == CS_OK) { - /* replace the current value */ - res = confdb_key_replace (handle, - obj_handle, -@@ -344,7 +346,7 @@ - key_value, - strlen(key_value)); - -- if (res != CONFDB_OK) -+ if (res != CS_OK) - fprintf(stderr, "Failed to replace the key %s=%s. Error %d\n", key_name, key_value, res); - } else { - /* not there, create a new key */ -@@ -354,7 +356,7 @@ - strlen(key_name), - key_value, - strlen(key_value)); -- if (res != CONFDB_OK) -+ if (res != CS_OK) - fprintf(stderr, "Failed to create the key %s=%s. Error %d\n", key_name, key_value, res); - } - -@@ -367,23 +369,23 @@ - uint32_t obj_handle; - uint32_t parent_object_handle = OBJECT_PARENT_HANDLE; - char tmp_name[OBJ_NAME_SIZE]; -- confdb_error_t res; -+ cs_error_t res; - - strncpy (tmp_name, name_pt, OBJ_NAME_SIZE); - obj_name_pt = strtok_r(tmp_name, SEPERATOR_STR, &save_pt); - - while (obj_name_pt != NULL) { - res = confdb_object_find_start(handle, parent_object_handle); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf (stderr, "Could not start object_find %d\n", res); - exit (EXIT_FAILURE); - } - - res = confdb_object_find(handle, parent_object_handle, - obj_name_pt, strlen (obj_name_pt), &obj_handle); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - -- if (validate_name(obj_name_pt) != CONFDB_OK) { -+ if (validate_name(obj_name_pt) != CS_OK) { - fprintf(stderr, "Incorrect object name \"%s\", \"=\" not allowed.\n", - obj_name_pt); - exit(EXIT_FAILURE); -@@ -393,7 +395,7 @@ - obj_name_pt, - strlen (obj_name_pt), - &obj_handle); -- if (res != CONFDB_OK) -+ if (res != CS_OK) - fprintf(stderr, "Failed to create object \"%s\". Error %d.\n", - obj_name_pt, res); - } -@@ -449,10 +451,13 @@ - int result; - fd_set read_fds; - int select_fd; -- SaBoolT quit = SA_FALSE; -+ int quit = CS_FALSE; - - FD_ZERO (&read_fds); -- confdb_fd_get(handle, &select_fd); -+ if (confdb_fd_get (handle, &select_fd) != CS_OK) { -+ printf ("can't get the confdb selector object.\n"); -+ return; -+ } - printf ("Type \"q\" to finish\n"); - do { - FD_SET (select_fd, &read_fds); -@@ -464,35 +469,36 @@ - if (FD_ISSET (STDIN_FILENO, &read_fds)) { - char inbuf[3]; - -- fgets(inbuf, sizeof(inbuf), stdin); -- if (strncmp(inbuf, "q", 1) == 0) -- quit = SA_TRUE; -+ if (fgets(inbuf, sizeof(inbuf), stdin) == NULL) -+ quit = CS_TRUE; -+ else if (strncmp(inbuf, "q", 1) == 0) -+ quit = CS_TRUE; - } - if (FD_ISSET (select_fd, &read_fds)) { -- if (confdb_dispatch (handle, CONFDB_DISPATCH_ALL) != CONFDB_OK) -+ if (confdb_dispatch (handle, CONFDB_DISPATCH_ALL) != CS_OK) - exit(1); - } -- } while (result && quit == SA_FALSE); -+ } while (result && quit == CS_FALSE); - -- confdb_stop_track_changes(handle); -+ (void)confdb_stop_track_changes(handle); - - } - - static void track_object(confdb_handle_t handle, char * name_pt) - { -- confdb_error_t res; -+ cs_error_t res; - uint32_t obj_handle; - - res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle); - -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf (stderr, "Could not find object \"%s\". Error %d\n", - name_pt, res); - return; - } - - res = confdb_track_changes (handle, obj_handle, CONFDB_TRACK_DEPTH_RECURSIVE); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf (stderr, "Could not enable tracking on object \"%s\". Error %d\n", - name_pt, res); - return; -@@ -501,10 +507,10 @@ - - static void stop_tracking(confdb_handle_t handle) - { -- confdb_error_t res; -+ cs_error_t res; - - res = confdb_stop_track_changes (handle); -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf (stderr, "Could not stop tracking. Error %d\n", res); - return; - } -@@ -512,14 +518,14 @@ - - static void delete_object(confdb_handle_t handle, char * name_pt) - { -- confdb_error_t res; -+ cs_error_t res; - uint32_t obj_handle; - res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle); - -- if (res == CONFDB_OK) { -+ if (res == CS_OK) { - res = confdb_object_destroy (handle, obj_handle); - -- if (res != CONFDB_OK) -+ if (res != CS_OK) - fprintf(stderr, "Failed to find object \"%s\" to delete. Error %d\n", name_pt, res); - } else { - char parent_name[OBJ_NAME_SIZE]; -@@ -531,7 +537,7 @@ - get_key(name_pt, key_name, key_value); - res = find_object (handle, parent_name, FIND_OBJECT_ONLY, &obj_handle); - -- if (res != CONFDB_OK) { -+ if (res != CS_OK) { - fprintf(stderr, "Failed to find the key's parent object \"%s\". Error %d\n", parent_name, res); - exit (EXIT_FAILURE); - } -@@ -543,7 +549,7 @@ - key_value, - strlen(key_value)); - -- if (res != CONFDB_OK) -+ if (res != CS_OK) - fprintf(stderr, "Failed to delete key \"%s=%s\" from object \"%s\". Error %d\n", - key_name, key_value, parent_name, res); - } -@@ -552,8 +558,8 @@ - - int main (int argc, char *argv[]) { - confdb_handle_t handle; -- confdb_error_t result; -- char c; -+ cs_error_t result; -+ int c; - - action = ACTION_READ; - -@@ -603,7 +609,7 @@ - } - - result = confdb_initialize (&handle, &callbacks); -- if (result != CONFDB_OK) { -+ if (result != CS_OK) { - fprintf (stderr, "Failed to initialize the objdb API. Error %d\n", result); - exit (EXIT_FAILURE); - } -@@ -633,7 +639,7 @@ - } - - result = confdb_finalize (handle); -- if (result != CONFDB_OK) { -+ if (result != CS_OK) { - fprintf (stderr, "Error finalizing objdb API. Error %d\n", result); - exit(EXIT_FAILURE); - } -diff -Naurd corosync-0.92/tools/corosync-pload.c corosync-trunk/tools/corosync-pload.c ---- corosync-0.92/tools/corosync-pload.c 1970-01-01 01:00:00.000000000 +0100 -+++ corosync-trunk/tools/corosync-pload.c 2008-11-06 22:49:07.000000000 +0100 -@@ -0,0 +1,76 @@ -+/* -+ * Copyright (c) 2008 Red Hat, Inc. -+ * -+ * All rights reserved. -+ * -+ * Author: 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#define timersub(a, b, result) \ -+do { \ -+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ -+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ -+ if ((result)->tv_usec < 0) { \ -+ --(result)->tv_sec; \ -+ (result)->tv_usec += 1000000; \ -+ } \ -+} while (0) -+ -+int main (void) { -+ pload_error_t result; -+ pload_handle_t handle; -+ -+ result = pload_initialize (&handle, NULL); -+ printf ("Init result %d\n", result); -+ result = pload_start ( -+ handle, -+ 0, /* code */ -+ 150000000, /* count */ -+ 300); /* size */ -+ return (0); -+} -diff -Naurd corosync-0.92/tools/Makefile corosync-trunk/tools/Makefile ---- corosync-0.92/tools/Makefile 2008-08-15 08:15:26.000000000 +0200 -+++ corosync-trunk/tools/Makefile 2008-11-11 18:28:22.000000000 +0100 -@@ -41,8 +41,8 @@ - override LDFLAGS += -lnsl -lsocket -lrt - endif - --LIBS = ../lib/libconfdb.a ../lib/libcfg.a --BINARIES=corosync-objctl corosync-cfgtool corosync-keygen -+LIBS = ../lib/libconfdb.a ../lib/libcfg.a ../lib/libpload.a -+BINARIES=corosync-objctl corosync-cfgtool corosync-keygen corosync-fplay corosync-pload - APPS_SRC=$(addsuffix .c,$(BINARIES)) - EXTRA_CFLAGS = -I$(srcdir)include - -@@ -57,9 +57,22 @@ - corosync-keygen: corosync-keygen.o - $(CC) $(LDFLAGS) -o $@ $< - -+corosync-fplay: corosync-fplay.o -+ $(CC) $(LDFLAGS) -o $@ $< -+ -+corosync-pload: corosync-pload.o -+ $(CC) $(LDFLAGS) -o $@ $< $(LIBS) -+ - clean: - rm -f *.o $(BINARIES) - -+lint: -+ -splint $(LINT_FLAGS) $(CFLAGS) corosync-objctl.c -+ -splint $(LINT_FLAGS) $(CFLAGS) corosync-cfgtool.c -+ -splint $(LINT_FLAGS) $(CFLAGS) corosync-keygen.c -+ -splint $(LINT_FLAGS) $(CFLAGS) corosync-fplay.c -+ -splint $(LINT_FLAGS) $(CFLAGS) corosync-pload.c -+ - %.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< - diff --git a/corosync.spec b/corosync.spec index b6ce1ec..19f9f91 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,14 +1,14 @@ -%define alphatag svn1756 +## define alphatag svn1756 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.92 -Release: 7%{?alphatag:.%{alphatag}}%{?dist} +Version: 0.93 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: corosync-trunk.diff +Patch0: gcc-44-fix.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -24,7 +24,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %prep %setup -q -n corosync-%{version} -%patch0 -p1 +%patch0 -p0 %build @@ -125,7 +125,7 @@ Summary: The Corosync Cluster Engine Development Kit Group: Development/Libraries Requires: corosynclib = %{version}-%{release} Requires: pkgconfig -Provides: corosync-devel = 0.92-7 +Provides: corosync-devel = %{version} Obsoletes: corosync-devel < 0.92-7 %description -n corosynclib-devel @@ -186,6 +186,13 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Thu Feb 19 2009 Fabio M. Di Nitto - 0.93-1 +- New upstream release. +- Drop alphatag from spec file. +- Drop trunk patch. +- Update Provides for corosynclib-devel. +- Backport gcc-4.4 build fix from trunk. + * Mon Feb 2 2009 Fabio M. Di Nitto - 0.92-7.svn1756 - Update to svn trunk at revision 1756 from upstream. - Add support pkgconfig to devel package. diff --git a/gcc-44-fix.diff b/gcc-44-fix.diff new file mode 100644 index 0000000..73d9a7e --- /dev/null +++ b/gcc-44-fix.diff @@ -0,0 +1,15 @@ +Index: exec/crypto.c +=================================================================== +--- exec/crypto.c (revision 1766) ++++ exec/crypto.c (working copy) +@@ -37,8 +37,8 @@ + #define ENDIAN_LITTLE + #elif _BYTE_ORDER == _BIG_ENDIAN + #define ENDIAN_BIG +-#elif +-#warning "cannot detect byte order" ++#else ++#error "cannot detect byte order" + #endif + + #if defined(COROSYNC_LINUX) diff --git a/sources b/sources index b95caa8..37ff032 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e0fec3c380de83711cf3f4609d59e16e corosync-0.92.tar.gz +8080c8a45304ffb959db74de1ce55fb8 corosync-0.93.tar.gz From 6759e464200b2ecfa8b18f859af35abef73ead87 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 23 Feb 2009 09:32:40 +0000 Subject: [PATCH 013/185] Package clean up + add fix for quorum engine --- gcc-44-fix.diff => corosync-trunk_r1767.diff | 0 corosync-trunk_r1774.diff | 23 ++++++++++++++++++++ corosync.spec | 10 +++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) rename gcc-44-fix.diff => corosync-trunk_r1767.diff (100%) create mode 100644 corosync-trunk_r1774.diff diff --git a/gcc-44-fix.diff b/corosync-trunk_r1767.diff similarity index 100% rename from gcc-44-fix.diff rename to corosync-trunk_r1767.diff diff --git a/corosync-trunk_r1774.diff b/corosync-trunk_r1774.diff new file mode 100644 index 0000000..22252b2 --- /dev/null +++ b/corosync-trunk_r1774.diff @@ -0,0 +1,23 @@ +Index: exec/vsf_quorum.c +=================================================================== +--- exec/vsf_quorum.c (revision 1773) ++++ exec/vsf_quorum.c (revision 1774) +@@ -119,12 +119,14 @@ + memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); + + quorum_view_list_entries = view_list_entries; ++ ++ /* Tell sync() only if there is a new ring_id (ie this is not a 'fake' quorum event) */ ++ if (memcmp(&quorum_ring_id, ring_id, sizeof (quorum_ring_id))) { ++ sync_primary_callback_fn(view_list, view_list_entries, ++ primary_designated, ring_id); ++ } + memcpy(quorum_view_list, view_list, sizeof(unsigned int)*view_list_entries); + +- /* Tell sync() */ +- sync_primary_callback_fn(view_list, view_list_entries, +- primary_designated, &quorum_ring_id); +- + /* Tell internal listeners */ + send_internal_notification(); + diff --git a/corosync.spec b/corosync.spec index 19f9f91..a233eac 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,12 +3,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.93 -Release: 1%{?alphatag:.%{alphatag}}%{?dist} +Release: 2%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: gcc-44-fix.diff +Patch0: corosync-trunk_r1767.diff +Patch1: corosync-trunk_r1774.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -25,6 +26,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %prep %setup -q -n corosync-%{version} %patch0 -p0 +%patch1 -p0 %build @@ -186,6 +188,10 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Mon Feb 23 2009 Fabio M. Di Nitto - 0.93-2 +- Rename gcc-4.4 patch to match svn commit (r1767). +- Backport patch from trunk (commit r1774) to fix quorum engine. + * Thu Feb 19 2009 Fabio M. Di Nitto - 0.93-1 - New upstream release. - Drop alphatag from spec file. From 07f454d46e9d4bf013c5361a6da49f920cdcfc18 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Tue, 24 Feb 2009 09:15:21 +0000 Subject: [PATCH 014/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index a233eac..967f3d4 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,7 +3,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.93 -Release: 2%{?alphatag:.%{alphatag}}%{?dist} +Release: 3%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org @@ -188,6 +188,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Tue Feb 24 2009 Fedora Release Engineering - 0.93-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + * Mon Feb 23 2009 Fabio M. Di Nitto - 0.93-2 - Rename gcc-4.4 patch to match svn commit (r1767). - Backport patch from trunk (commit r1774) to fix quorum engine. From fb8d814e5c33e7ebcc58882b752f72437ff5f280 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 25 Feb 2009 05:12:19 +0000 Subject: [PATCH 015/185] add corosync-fplay and corosync-pload tools to the distribution --- corosync-trunk_r1780.diff | 13 +++++++++++++ corosync.spec | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 corosync-trunk_r1780.diff diff --git a/corosync-trunk_r1780.diff b/corosync-trunk_r1780.diff new file mode 100644 index 0000000..8254119 --- /dev/null +++ b/corosync-trunk_r1780.diff @@ -0,0 +1,13 @@ +Index: Makefile +=================================================================== +--- Makefile (revision 1779) ++++ Makefile (revision 1780) +@@ -171,6 +171,8 @@ + install -m 755 $(builddir)tools/corosync-objctl $(DESTDIR)$(SBINDIR) + install -m 755 $(builddir)tools/corosync-cfgtool $(DESTDIR)$(SBINDIR) + install -m 755 $(builddir)tools/corosync-keygen $(DESTDIR)$(SBINDIR) ++ install -m 755 $(builddir)tools/corosync-fplay $(DESTDIR)$(SBINDIR) ++ install -m 755 $(builddir)tools/corosync-pload $(DESTDIR)$(SBINDIR) + + if [ ! -f $(DESTDIR)$(ETCDIR)/corosync.conf ] ; then \ + install -m 644 $(srcdir)conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \ diff --git a/corosync.spec b/corosync.spec index 967f3d4..3253b76 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,13 +3,14 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.93 -Release: 3%{?alphatag:.%{alphatag}}%{?dist} +Release: 4%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz Patch0: corosync-trunk_r1767.diff Patch1: corosync-trunk_r1774.diff +Patch2: corosync-trunk_r1780.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -27,6 +28,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %setup -q -n corosync-%{version} %patch0 -p0 %patch1 -p0 +%patch2 -p0 %build @@ -78,6 +80,8 @@ fi %{_sbindir}/corosync-keygen %{_sbindir}/corosync-objctl %{_sbindir}/corosync-cfgtool +%{_sbindir}/corosync-fplay +%{_sbindir}/corosync-pload %config(noreplace) /etc/corosync.conf %{_initddir}/corosync %dir %{_libexecdir}/lcrso @@ -188,6 +192,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Wed Feb 25 2009 Fabio M. Di Nitto - 0.93-4 +- Add Makefile fix to install all corosync tools (commit r1780) + * Tue Feb 24 2009 Fedora Release Engineering - 0.93-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild From b824c75d3c14a5339a62a490ddf4389d6eb715a2 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 3 Mar 2009 05:48:35 +0000 Subject: [PATCH 016/185] New upstream release --- .cvsignore | 2 +- corosync-bump-soname.diff | 178 ++++++++++++++++++++++++++++++++++++++ corosync-trunk_r1767.diff | 15 ---- corosync-trunk_r1774.diff | 23 ----- corosync-trunk_r1780.diff | 13 --- corosync.spec | 23 ++--- sources | 2 +- 7 files changed, 192 insertions(+), 64 deletions(-) create mode 100644 corosync-bump-soname.diff delete mode 100644 corosync-trunk_r1767.diff delete mode 100644 corosync-trunk_r1774.diff delete mode 100644 corosync-trunk_r1780.diff diff --git a/.cvsignore b/.cvsignore index ef58238..daeebd7 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-0.93.tar.gz +corosync-0.94.tar.gz diff --git a/corosync-bump-soname.diff b/corosync-bump-soname.diff new file mode 100644 index 0000000..c3788a7 --- /dev/null +++ b/corosync-bump-soname.diff @@ -0,0 +1,178 @@ +diff -Naurd corosync-0.94.orig/exec/Makefile corosync-0.94/exec/Makefile +--- corosync-0.94.orig/exec/Makefile 2009-02-19 03:23:58.000000000 +0100 ++++ corosync-0.94/exec/Makefile 2009-03-03 05:49:45.000000000 +0100 +@@ -73,7 +73,7 @@ + EXEC_OBJS = $(MAIN_OBJS) + override CFLAGS += -fPIC + +-all:libtotem_pg.a libtotem_pg.so.2.0.0 liblogsys.a liblogsys.so.2.0.0 \ ++all:libtotem_pg.a libtotem_pg.so.3.0.0 liblogsys.a liblogsys.so.3.0.0 \ + ../lcr/lcr_ifact.o corosync_ \ + objdb.lcrso vsf_ykd.lcrso coroparse.lcrso vsf_quorum.lcrso + else +@@ -125,18 +125,18 @@ + + ifeq (${COROSYNC_COMPAT}, DARWIN) + +-libtotem_pg.so.2.0.0: $(TOTEM_OBJS) ++libtotem_pg.so.3.0.0: $(TOTEM_OBJS) + $(CC) $(LDFLAGS) -bundle -bind_at_load $(TOTEM_OBJS) -o $@ + +-liblogsys.so.2.0.0: $(LOGSYS_OBJS) ++liblogsys.so.3.0.0: $(LOGSYS_OBJS) + $(CC) $(LDFLAGS) -bundle -bind_at_load $(LOGSYS_OBJS) -o $@ + else + +-libtotem_pg.so.2.0.0: $(TOTEM_OBJS) +- $(CC) $(LDFLAGS) -shared -Wl,-soname,libtotem_pg.so.2 $(TOTEM_OBJS) -o $@ ++libtotem_pg.so.3.0.0: $(TOTEM_OBJS) ++ $(CC) $(LDFLAGS) -shared -Wl,-soname,libtotem_pg.so.3 $(TOTEM_OBJS) -o $@ + +-liblogsys.so.2.0.0: $(LIBLOGSYS_OBJS) +- $(CC) -shared -Wl,-soname,liblogsys.so.2 $(LOGSYS_OBJS) -o $@ $(LDFLAGS) ++liblogsys.so.3.0.0: $(LIBLOGSYS_OBJS) ++ $(CC) -shared -Wl,-soname,liblogsys.so.3 $(LOGSYS_OBJS) -o $@ $(LDFLAGS) + + endif + +diff -Naurd corosync-0.94.orig/lib/Makefile corosync-0.94/lib/Makefile +--- corosync-0.94.orig/lib/Makefile 2009-02-19 03:23:58.000000000 +0100 ++++ corosync-0.94/lib/Makefile 2009-03-03 05:49:45.000000000 +0100 +@@ -37,14 +37,14 @@ + + override LDFLAGS += -L./ + +-all: libcpg.a libcpg.so.2.0.0 \ +- libconfdb.a libconfdb.so.2.0.0 \ +- libevs.a libevs.so.2.0.0 \ +- libcfg.a libcfg.so.2.0.0 \ +- libquorum.a libquorum.so.2.0.0 \ +- libpload.a libpload.so.2.0.0 \ +- libcoroipc.a libcoroipc.so.2.0.0 \ +- libvotequorum.a libvotequorum.so.2.0.0 ++all: libcpg.a libcpg.so.3.0.0 \ ++ libconfdb.a libconfdb.so.3.0.0 \ ++ libevs.a libevs.so.3.0.0 \ ++ libcfg.a libcfg.so.3.0.0 \ ++ libquorum.a libquorum.so.3.0.0 \ ++ libpload.a libpload.so.3.0.0 \ ++ libcoroipc.a libcoroipc.so.3.0.0 \ ++ libvotequorum.a libvotequorum.so.3.0.0 + + libcoroipc.a: coroipc.o + $(AR) -rc libcoroipc.a coroipc.o +@@ -52,55 +52,55 @@ + ifeq (${COROSYNC_COMPAT}, DARWIN) + + DARWIN_OPTS=-dynamiclib -bind_at_load -current_version 2.0.0 -compatibility_version 2.0.0 +-libcoroipc.so.2.0.0: coroipc.o ++libcoroipc.so.3.0.0: coroipc.o + $(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o -o $@ + +-libevs.so.2.0.0: coroipc.o evs.o ++libevs.so.3.0.0: coroipc.o evs.o + $(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o evs.o -o $@ + +-libcpg.so.2.0.0: coroipc.o cpg.o ++libcpg.so.3.0.0: coroipc.o cpg.o + $(CC) $(DARWIN_OPTS) coroipc.o cpg.o -o $@ + +-libquorum.so.2.0.0: coroipc.o quorum.o ++libquorum.so.3.0.0: coroipc.o quorum.o + $(CC) $(DARWIN_OPTS) coroipc.o quorum.o -o $@ + +-libvotequorum.so.2.0.0: coroipc.o votequorum.o ++libvotequorum.so.3.0.0: coroipc.o votequorum.o + $(CC) $(DARWIN_OPTS) coroipc.o votequorum.o -o $@ + +-libconfdb.so.2.0.0: coroipc.o confdb.o sa-confdb.o ++libconfdb.so.3.0.0: coroipc.o confdb.o sa-confdb.o + $(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ + +-libcfg.so.2.0.0: coroipc.o cfg.o ++libcfg.so.3.0.0: coroipc.o cfg.o + $(CC) $(DARWIN_OPTS) coroipc.o cfg.o -o $@ + +-libpload.so.2.0.0: coroipc.o pload.o ++libpload.so.3.0.0: coroipc.o pload.o + $(CC) $(DARWIN_OPTS) coroipc.o pload.o -o $@ + + else + +-libcoroipc.so.2.0.0: coroipc.o +- $(CC) $(LDFLAGS) -shared -Wl,-soname,libcoroipc.so.2,-version-script=$(srcdir)$(subdir)libcoroipc.versions coroipc.o -o $@ ++libcoroipc.so.3.0.0: coroipc.o ++ $(CC) $(LDFLAGS) -shared -Wl,-soname,libcoroipc.so.3,-version-script=$(srcdir)$(subdir)libcoroipc.versions coroipc.o -o $@ + +-libevs.so.2.0.0: coroipc.o evs.o +- $(CC) $(LDFLAGS) -shared -Wl,-soname,libevs.so.2,-version-script=$(srcdir)$(subdir)libevs.versions coroipc.o evs.o -o $@ ++libevs.so.3.0.0: coroipc.o evs.o ++ $(CC) $(LDFLAGS) -shared -Wl,-soname,libevs.so.3,-version-script=$(srcdir)$(subdir)libevs.versions coroipc.o evs.o -o $@ + +-libcpg.so.2.0.0: coroipc.o cpg.o +- $(CC) -shared -Wl,-soname,libcpg.so.2,-version-script=$(srcdir)$(subdir)libcpg.versions coroipc.o cpg.o -o $@ ++libcpg.so.3.0.0: coroipc.o cpg.o ++ $(CC) -shared -Wl,-soname,libcpg.so.3,-version-script=$(srcdir)$(subdir)libcpg.versions coroipc.o cpg.o -o $@ + +-libquorum.so.2.0.0: coroipc.o quorum.o +- $(CC) -shared -Wl,-soname,libquorum.so.2,-version-script=$(srcdir)$(subdir)libquorum.versions coroipc.o quorum.o -o $@ ++libquorum.so.3.0.0: coroipc.o quorum.o ++ $(CC) -shared -Wl,-soname,libquorum.so.3,-version-script=$(srcdir)$(subdir)libquorum.versions coroipc.o quorum.o -o $@ + +-libvotequorum.so.2.0.0: coroipc.o votequorum.o +- $(CC) -shared -Wl,-soname,libvotequorum.so.2,-version-script=$(srcdir)$(subdir)libvotequorum.versions coroipc.o votequorum.o -o $@ ++libvotequorum.so.3.0.0: coroipc.o votequorum.o ++ $(CC) -shared -Wl,-soname,libvotequorum.so.3,-version-script=$(srcdir)$(subdir)libvotequorum.versions coroipc.o votequorum.o -o $@ + +-libconfdb.so.2.0.0: coroipc.o confdb.o sa-confdb.o +- $(CC) $(LDFLAGS) -shared -Wl,-soname,libconfdb.so.2,-version-script=$(srcdir)$(subdir)libconfdb.versions coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ ++libconfdb.so.3.0.0: coroipc.o confdb.o sa-confdb.o ++ $(CC) $(LDFLAGS) -shared -Wl,-soname,libconfdb.so.3,-version-script=$(srcdir)$(subdir)libconfdb.versions coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ + +-libcfg.so.2.0.0: coroipc.o cfg.o +- $(CC) -shared -Wl,-soname,libcfg.so.2,-version-script=$(srcdir)$(subdir)libcfg.versions coroipc.o cfg.o -o $@ ++libcfg.so.3.0.0: coroipc.o cfg.o ++ $(CC) -shared -Wl,-soname,libcfg.so.3,-version-script=$(srcdir)$(subdir)libcfg.versions coroipc.o cfg.o -o $@ + +-libpload.so.2.0.0: coroipc.o pload.o +- $(CC) -shared -Wl,-soname,libpload.so.2,-version-script=$(srcdir)$(subdir)libpload.versions coroipc.o cfg.o -o $@ ++libpload.so.3.0.0: coroipc.o pload.o ++ $(CC) -shared -Wl,-soname,libpload.so.3,-version-script=$(srcdir)$(subdir)libpload.versions coroipc.o cfg.o -o $@ + + endif + +diff -Naurd corosync-0.94.orig/Makefile corosync-0.94/Makefile +--- corosync-0.94.orig/Makefile 2009-02-25 05:58:08.000000000 +0100 ++++ corosync-0.94/Makefile 2009-03-03 05:49:45.000000000 +0100 +@@ -133,11 +133,11 @@ + + for eLib in $(EXEC_LIBS); do \ + ( cd $(builddir) ; \ +- ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so; \ +- ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so.2; \ ++ ln -sf lib$$eLib.so.3.0.0 exec/lib$$eLib.so; \ ++ ln -sf lib$$eLib.so.3.0.0 exec/lib$$eLib.so.3; \ + $(CP) -a exec/lib$$eLib.so $(DESTDIR)$(LIBDIR); \ +- $(CP) -a exec/lib$$eLib.so.2 $(DESTDIR)$(LIBDIR); \ +- install -m 755 exec/lib$$eLib.so.2.* $(DESTDIR)$(LIBDIR); \ ++ $(CP) -a exec/lib$$eLib.so.3 $(DESTDIR)$(LIBDIR); \ ++ install -m 755 exec/lib$$eLib.so.3.* $(DESTDIR)$(LIBDIR); \ + if [ "xYES" = "x$(STATICLIBS)" ]; then \ + install -m 755 exec/lib$$eLib.a $(DESTDIR)$(LIBDIR); \ + if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ +@@ -149,11 +149,11 @@ + + for aLib in $(COROSYNC_LIBS); do \ + ( cd $(builddir) ; \ +- ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so; \ +- ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so.2; \ ++ ln -sf lib$$aLib.so.3.0.0 lib/lib$$aLib.so; \ ++ ln -sf lib$$aLib.so.3.0.0 lib/lib$$aLib.so.3; \ + $(CP) -a lib/lib$$aLib.so $(DESTDIR)$(LIBDIR); \ +- $(CP) -a lib/lib$$aLib.so.2 $(DESTDIR)$(LIBDIR); \ +- install -m 755 lib/lib$$aLib.so.2.* $(DESTDIR)$(LIBDIR); \ ++ $(CP) -a lib/lib$$aLib.so.3 $(DESTDIR)$(LIBDIR); \ ++ install -m 755 lib/lib$$aLib.so.3.* $(DESTDIR)$(LIBDIR); \ + if [ "xYES" = "x$(STATICLIBS)" ]; then \ + install -m 755 lib/lib$$aLib.a $(DESTDIR)$(LIBDIR); \ + if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ diff --git a/corosync-trunk_r1767.diff b/corosync-trunk_r1767.diff deleted file mode 100644 index 73d9a7e..0000000 --- a/corosync-trunk_r1767.diff +++ /dev/null @@ -1,15 +0,0 @@ -Index: exec/crypto.c -=================================================================== ---- exec/crypto.c (revision 1766) -+++ exec/crypto.c (working copy) -@@ -37,8 +37,8 @@ - #define ENDIAN_LITTLE - #elif _BYTE_ORDER == _BIG_ENDIAN - #define ENDIAN_BIG --#elif --#warning "cannot detect byte order" -+#else -+#error "cannot detect byte order" - #endif - - #if defined(COROSYNC_LINUX) diff --git a/corosync-trunk_r1774.diff b/corosync-trunk_r1774.diff deleted file mode 100644 index 22252b2..0000000 --- a/corosync-trunk_r1774.diff +++ /dev/null @@ -1,23 +0,0 @@ -Index: exec/vsf_quorum.c -=================================================================== ---- exec/vsf_quorum.c (revision 1773) -+++ exec/vsf_quorum.c (revision 1774) -@@ -119,12 +119,14 @@ - memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); - - quorum_view_list_entries = view_list_entries; -+ -+ /* Tell sync() only if there is a new ring_id (ie this is not a 'fake' quorum event) */ -+ if (memcmp(&quorum_ring_id, ring_id, sizeof (quorum_ring_id))) { -+ sync_primary_callback_fn(view_list, view_list_entries, -+ primary_designated, ring_id); -+ } - memcpy(quorum_view_list, view_list, sizeof(unsigned int)*view_list_entries); - -- /* Tell sync() */ -- sync_primary_callback_fn(view_list, view_list_entries, -- primary_designated, &quorum_ring_id); -- - /* Tell internal listeners */ - send_internal_notification(); - diff --git a/corosync-trunk_r1780.diff b/corosync-trunk_r1780.diff deleted file mode 100644 index 8254119..0000000 --- a/corosync-trunk_r1780.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: Makefile -=================================================================== ---- Makefile (revision 1779) -+++ Makefile (revision 1780) -@@ -171,6 +171,8 @@ - install -m 755 $(builddir)tools/corosync-objctl $(DESTDIR)$(SBINDIR) - install -m 755 $(builddir)tools/corosync-cfgtool $(DESTDIR)$(SBINDIR) - install -m 755 $(builddir)tools/corosync-keygen $(DESTDIR)$(SBINDIR) -+ install -m 755 $(builddir)tools/corosync-fplay $(DESTDIR)$(SBINDIR) -+ install -m 755 $(builddir)tools/corosync-pload $(DESTDIR)$(SBINDIR) - - if [ ! -f $(DESTDIR)$(ETCDIR)/corosync.conf ] ; then \ - install -m 644 $(srcdir)conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \ diff --git a/corosync.spec b/corosync.spec index 3253b76..1323f52 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,15 +2,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.93 -Release: 4%{?alphatag:.%{alphatag}}%{?dist} +Version: 0.94 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: corosync-trunk_r1767.diff -Patch1: corosync-trunk_r1774.diff -Patch2: corosync-trunk_r1780.diff +Patch0: corosync-bump-soname.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -26,9 +24,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %prep %setup -q -n corosync-%{version} -%patch0 -p0 -%patch1 -p0 -%patch2 -p0 +%patch0 -p1 %build @@ -118,7 +114,7 @@ This package contains corosync libraries. %{_libdir}/corosync/libevs.so.* %{_libdir}/corosync/libtotem_pg.so.* %{_libdir}/corosync/liblogsys.so.* -%{_libdir}/corosync/libcoroutil.so.* +%{_libdir}/corosync/libcoroipc.so.* %{_libdir}/corosync/libquorum.so.* %{_libdir}/corosync/libvotequorum.so.* @@ -143,7 +139,7 @@ The Corosync Cluster Engine APIs. %dir %{_docdir}/%{name}-%{version} %doc %{_docdir}/%{name}-%{version}/README.devmap %dir %{_includedir}/corosync/ -%{_includedir}/corosync/ais_util.h +%{_includedir}/corosync/coroipc.h %{_includedir}/corosync/cfg.h %{_includedir}/corosync/confdb.h %{_includedir}/corosync/corotypes.h @@ -177,7 +173,7 @@ The Corosync Cluster Engine APIs. %{_libdir}/corosync/libevs.so %{_libdir}/corosync/libtotem_pg.so %{_libdir}/corosync/liblogsys.so -%{_libdir}/corosync/libcoroutil.so +%{_libdir}/corosync/libcoroipc.so %{_libdir}/corosync/libquorum.so %{_libdir}/corosync/libvotequorum.so %{_libdir}/pkgconfig/*.pc @@ -192,6 +188,11 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Tue Mar 3 2009 Fabio M. Di Nitto - 0.94-1 +- New upstream release. +- Drop obsolete patches. +- Add soname bump patch that was missing from upstream. + * Wed Feb 25 2009 Fabio M. Di Nitto - 0.93-4 - Add Makefile fix to install all corosync tools (commit r1780) diff --git a/sources b/sources index 37ff032..e921251 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -8080c8a45304ffb959db74de1ce55fb8 corosync-0.93.tar.gz +5839592fbb6982c6c897aa5020f0b629 corosync-0.94.tar.gz From 7231083a285eb2d7ba71b5f9fb3c07e47638fdd6 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 6 Mar 2009 07:30:44 +0000 Subject: [PATCH 017/185] Import fixes from upstream --- corosync-trunk.diff | 82 +++++++++++++++++++++++++++++++++++++++++++++ corosync.spec | 14 ++++++-- 2 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 corosync-trunk.diff diff --git a/corosync-trunk.diff b/corosync-trunk.diff new file mode 100644 index 0000000..7ca8e6a --- /dev/null +++ b/corosync-trunk.diff @@ -0,0 +1,82 @@ +diff -Naurd corosync-0.94/exec/logsys.c corosync-trunk/exec/logsys.c +--- corosync-0.94/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 ++++ corosync-trunk/exec/logsys.c 2009-03-05 06:36:07.000000000 +0100 +@@ -112,8 +112,6 @@ + + static int logsys_facility = LOG_DAEMON; + +-static char *logsys_format = NULL; +- + /* + * operating global variables + */ +@@ -139,7 +137,7 @@ + + static int logsys_buffer_full = 0; + +-static char *format_buffer="[%6s] %b"; ++static char *format_buffer=NULL; + + static int log_requests_pending = 0; + +@@ -875,7 +873,10 @@ + { + pthread_mutex_lock (&logsys_config_mutex); + +- logsys_format = format; ++ if (format) ++ format_buffer = format; ++ else ++ format_buffer = "[%6s] %b"; + + pthread_mutex_unlock (&logsys_config_mutex); + } +diff -Naurd corosync-0.94/exec/mainconfig.c corosync-trunk/exec/mainconfig.c +--- corosync-0.94/exec/mainconfig.c 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/exec/mainconfig.c 2009-03-04 11:14:36.000000000 +0100 +@@ -158,16 +158,14 @@ + } + } + if (!objdb_get_string (objdb,object_service_handle, "timestamp", &value)) { +-/* todo change format string + if (strcmp (value, "on") == 0) { +- main_config->logmode |= LOG_MODE_DISPLAY_TIMESTAMP; ++ logsys_format_set("%t [%6s] %b"); + } else + if (strcmp (value, "off") == 0) { +- main_config->logmode &= ~LOG_MODE_DISPLAY_TIMESTAMP; ++ logsys_format_set("[%6s] %b"); + } else { + goto parse_error; + } +-*/ + } + + /* free old string on reload */ +diff -Naurd corosync-0.94/exec/Makefile corosync-trunk/exec/Makefile +diff -Naurd corosync-0.94/exec/totemip.c corosync-trunk/exec/totemip.c +--- corosync-0.94/exec/totemip.c 2009-01-26 21:46:45.000000000 +0100 ++++ corosync-trunk/exec/totemip.c 2009-03-03 04:57:37.000000000 +0100 +@@ -406,6 +406,7 @@ + memset(&nladdr, 0, sizeof(nladdr)); + nladdr.nl_family = AF_NETLINK; + ++ memset(&req, 0, sizeof(req)); + req.nlh.nlmsg_len = sizeof(req); + req.nlh.nlmsg_type = RTM_GETADDR; + req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST; +diff -Naurd corosync-0.94/lib/Makefile corosync-trunk/lib/Makefile +diff -Naurd corosync-0.94/Makefile corosync-trunk/Makefile +diff -Naurd corosync-0.94/services/cpg.c corosync-trunk/services/cpg.c +--- corosync-0.94/services/cpg.c 2009-03-03 01:57:44.000000000 +0100 ++++ corosync-trunk/services/cpg.c 2009-03-06 03:42:48.000000000 +0100 +@@ -489,8 +489,8 @@ + notify_info.nodeid = api->totem_nodeid_get(); + notify_info.reason = CONFCHG_CPG_REASON_PROCDOWN; + cpg_node_joinleave_send(gi, pi, MESSAGE_REQ_EXEC_CPG_PROCLEAVE, CONFCHG_CPG_REASON_PROCDOWN); +- list_del(&pi->list); + } ++ list_del(&pi->list); + api->ipc_refcnt_dec (conn); + return (0); + } diff --git a/corosync.spec b/corosync.spec index 1323f52..c51f119 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,14 +1,15 @@ -## define alphatag svn1756 +%define alphatag svn1792 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.94 -Release: 1%{?alphatag:.%{alphatag}}%{?dist} +Release: 2%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz Patch0: corosync-bump-soname.diff +Patch1: corosync-trunk.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -25,6 +26,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %prep %setup -q -n corosync-%{version} %patch0 -p1 +%patch1 -p1 %build @@ -188,6 +190,14 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Fri Mar 6 2009 Fabio M. Di Nitto - 0.94-2.svn1792 +- Import fixes from upstream: + * Fix uninitialized memory. Spotted by valgrind (1788) + * Fix logsys_set_format by updating the right bits (1789) + * logsys: re-add support for timestamp (1790) + * Fix cpg crash (1791) + * Allow logsys_format_set to reset to default (1792) + * Tue Mar 3 2009 Fabio M. Di Nitto - 0.94-1 - New upstream release. - Drop obsolete patches. From 2176e01013819a23b6e2bc38d421ca48c0bccda1 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 9 Mar 2009 09:53:21 +0000 Subject: [PATCH 018/185] Update to svn1794 to include some important fixes --- corosync-trunk.diff | 674 +++++++++++++++++++++++++++++++++++++++++++- corosync.spec | 9 +- 2 files changed, 669 insertions(+), 14 deletions(-) diff --git a/corosync-trunk.diff b/corosync-trunk.diff index 7ca8e6a..e7a7690 100644 --- a/corosync-trunk.diff +++ b/corosync-trunk.diff @@ -1,6 +1,70 @@ -diff -Naurd corosync-0.94/exec/logsys.c corosync-trunk/exec/logsys.c ---- corosync-0.94/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 -+++ corosync-trunk/exec/logsys.c 2009-03-05 06:36:07.000000000 +0100 +diff -Naurd corosync-0.94.orig/exec/apidef.c corosync-trunk/exec/apidef.c +--- corosync-0.94.orig/exec/apidef.c 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/exec/apidef.c 2009-03-06 08:38:34.000000000 +0100 +@@ -86,7 +86,6 @@ + .totem_family_get = totempg_my_family_get, + .totem_ring_reenable = totempg_ring_reenable, + .totem_mcast = main_mcast, +- .totem_send_ok = main_send_ok, + .totem_ifaces_get = totempg_ifaces_get, + .totem_ifaces_print = totempg_ifaces_print, + .totem_ip_print = totemip_print, +@@ -96,9 +95,11 @@ + .tpg_join = (typedef_tpg_join)totempg_groups_join, + .tpg_leave = (typedef_tpg_leave)totempg_groups_leave, + .tpg_joined_mcast = totempg_groups_mcast_joined, +- .tpg_joined_send_ok = totempg_groups_send_ok_joined, ++ .tpg_joined_reserve = totempg_groups_joined_reserve, ++ .tpg_joined_release = totempg_groups_joined_release, + .tpg_groups_mcast = (typedef_tpg_groups_mcast)totempg_groups_mcast_groups, +- .tpg_groups_send_ok = (typedef_tpg_groups_send_ok)totempg_groups_send_ok_groups, ++ .tpg_groups_reserve = NULL, ++ .tpg_groups_release = NULL, + .sync_request = sync_request, + .quorum_is_quorate = corosync_quorum_is_quorate, + .quorum_register_callback = corosync_quorum_register_callback, +diff -Naurd corosync-0.94.orig/exec/ipc.c corosync-trunk/exec/ipc.c +--- corosync-0.94.orig/exec/ipc.c 2009-03-03 01:58:16.000000000 +0100 ++++ corosync-trunk/exec/ipc.c 2009-03-06 08:38:34.000000000 +0100 +@@ -270,7 +270,7 @@ + struct res_overlay res_overlay; + struct iovec send_ok_joined_iovec; + int send_ok = 0; +- int send_ok_joined = 0; ++ int reserved_msgs = 0; + + for (;;) { + sop.sem_num = 0; +@@ -296,14 +296,16 @@ + + send_ok_joined_iovec.iov_base = (char *)header; + send_ok_joined_iovec.iov_len = header->size; +- send_ok_joined = totempg_groups_send_ok_joined (corosync_group_handle, ++ ++ reserved_msgs = totempg_groups_joined_reserve ( ++ corosync_group_handle, + &send_ok_joined_iovec, 1); + + send_ok = + (corosync_quorum_is_quorate() == 1 || ais_service[conn_info->service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) && ( + (ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) || + ((ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) && +- (send_ok_joined) && ++ (reserved_msgs) && + (sync_in_process() == 0))); + + if (send_ok) { +@@ -321,6 +323,7 @@ + res_overlay.header.size); + } + ++ totempg_groups_joined_release (reserved_msgs); + cs_conn_refcount_dec (conn); + } + pthread_exit (0); +diff -Naurd corosync-0.94.orig/exec/logsys.c corosync-trunk/exec/logsys.c +--- corosync-0.94.orig/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 ++++ corosync-trunk/exec/logsys.c 2009-03-06 08:09:24.000000000 +0100 @@ -112,8 +112,6 @@ static int logsys_facility = LOG_DAEMON; @@ -31,8 +95,25 @@ diff -Naurd corosync-0.94/exec/logsys.c corosync-trunk/exec/logsys.c pthread_mutex_unlock (&logsys_config_mutex); } -diff -Naurd corosync-0.94/exec/mainconfig.c corosync-trunk/exec/mainconfig.c ---- corosync-0.94/exec/mainconfig.c 2009-02-25 12:14:47.000000000 +0100 +diff -Naurd corosync-0.94.orig/exec/main.c corosync-trunk/exec/main.c +--- corosync-0.94.orig/exec/main.c 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/exec/main.c 2009-03-06 08:38:34.000000000 +0100 +@@ -448,13 +448,6 @@ + return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee)); + } + +-extern int main_send_ok ( +- struct iovec *iovec, +- int iov_len) +-{ +- return (totempg_groups_send_ok_joined (corosync_group_handle, iovec, iov_len)); +-} +- + int main (int argc, char **argv) + { + char *error_string; +diff -Naurd corosync-0.94.orig/exec/mainconfig.c corosync-trunk/exec/mainconfig.c +--- corosync-0.94.orig/exec/mainconfig.c 2009-02-25 12:14:47.000000000 +0100 +++ corosync-trunk/exec/mainconfig.c 2009-03-04 11:14:36.000000000 +0100 @@ -158,16 +158,14 @@ } @@ -53,9 +134,20 @@ diff -Naurd corosync-0.94/exec/mainconfig.c corosync-trunk/exec/mainconfig.c } /* free old string on reload */ -diff -Naurd corosync-0.94/exec/Makefile corosync-trunk/exec/Makefile -diff -Naurd corosync-0.94/exec/totemip.c corosync-trunk/exec/totemip.c ---- corosync-0.94/exec/totemip.c 2009-01-26 21:46:45.000000000 +0100 +diff -Naurd corosync-0.94.orig/exec/main.h corosync-trunk/exec/main.h +--- corosync-0.94.orig/exec/main.h 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/exec/main.h 2009-03-06 08:38:34.000000000 +0100 +@@ -62,8 +62,4 @@ + int iov_len, + unsigned int guarantee); + +-extern int main_send_ok ( +- struct iovec *iovec, +- int iov_len); +- + #endif /* MAIN_H_DEFINED */ +diff -Naurd corosync-0.94.orig/exec/totemip.c corosync-trunk/exec/totemip.c +--- corosync-0.94.orig/exec/totemip.c 2009-01-26 21:46:45.000000000 +0100 +++ corosync-trunk/exec/totemip.c 2009-03-03 04:57:37.000000000 +0100 @@ -406,6 +406,7 @@ memset(&nladdr, 0, sizeof(nladdr)); @@ -65,10 +157,430 @@ diff -Naurd corosync-0.94/exec/totemip.c corosync-trunk/exec/totemip.c req.nlh.nlmsg_len = sizeof(req); req.nlh.nlmsg_type = RTM_GETADDR; req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST; -diff -Naurd corosync-0.94/lib/Makefile corosync-trunk/lib/Makefile -diff -Naurd corosync-0.94/Makefile corosync-trunk/Makefile -diff -Naurd corosync-0.94/services/cpg.c corosync-trunk/services/cpg.c ---- corosync-0.94/services/cpg.c 2009-03-03 01:57:44.000000000 +0100 +diff -Naurd corosync-0.94.orig/exec/totempg.c corosync-trunk/exec/totempg.c +--- corosync-0.94.orig/exec/totempg.c 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/exec/totempg.c 2009-03-06 08:38:34.000000000 +0100 +@@ -145,6 +145,8 @@ + + static int mcast_packed_msg_count = 0; + ++static int totempg_reserved = 0; ++ + /* + * Function and data used to log messages + */ +@@ -225,8 +227,6 @@ + .mutex = PTHREAD_MUTEX_INITIALIZER + }; + +-static int send_ok (int msg_size); +- + static unsigned char next_fragment = 1; + + static pthread_mutex_t totempg_mutex = PTHREAD_MUTEX_INITIALIZER; +@@ -241,6 +241,10 @@ + __FILE__, __LINE__, level, format, ##args); \ + } while (0); + ++static int msg_count_send_ok (int msg_count); ++ ++static int byte_count_send_ok (int byte_count); ++ + static struct assembly *assembly_ref (unsigned int nodeid) + { + struct assembly *assembly; +@@ -765,7 +769,7 @@ + total_size += iovec[i].iov_len; + } + +- if (send_ok (total_size + sizeof(unsigned short) * ++ if (byte_count_send_ok (total_size + sizeof(unsigned short) * + (mcast_packed_msg_count+1)) == 0) { + + pthread_mutex_unlock (&mcast_msg_mutex); +@@ -888,23 +892,44 @@ + /* + * Determine if a message of msg_size could be queued + */ +-#define FUZZY_AVAIL_SUBTRACT 5 +-static int send_ok ( +- int msg_size) ++static int msg_count_send_ok ( ++ int msg_count) + { + int avail = 0; +- int total; + +- avail = totemmrp_avail () - FUZZY_AVAIL_SUBTRACT; ++ avail = totemmrp_avail () - totempg_reserved - 1; + +- /* +- * msg size less then totempg_totem_config->net_mtu - 25 will take up +- * a full message, so add +1 +- * totempg_totem_config->net_mtu - 25 is for the totempg_mcast header +- */ +- total = (msg_size / (totempg_totem_config->net_mtu - 25)) + 1; ++ return (avail > msg_count); ++} + +- return (avail >= total); ++static int byte_count_send_ok ( ++ int byte_count) ++{ ++ unsigned int msg_count = 0; ++ int avail = 0; ++ ++ avail = totemmrp_avail () - 1; ++ ++ msg_count = (byte_count / (totempg_totem_config->net_mtu - 25)) + 1; ++ ++ return (avail > msg_count); ++} ++ ++static int send_reserve ( ++ int msg_size) ++{ ++ unsigned int msg_count = 0; ++ ++ msg_count = (msg_size / (totempg_totem_config->net_mtu - 25)) + 1; ++ totempg_reserved += msg_count; ++ ++ return (msg_count); ++} ++ ++static void send_release ( ++ int msg_count) ++{ ++ totempg_reserved -= msg_count; + } + + int totempg_callback_token_create ( +@@ -1091,7 +1116,7 @@ + return (res); + } + +-int totempg_groups_send_ok_joined ( ++int totempg_groups_joined_reserve ( + hdb_handle_t handle, + struct iovec *iovec, + int iov_len) +@@ -1100,6 +1125,7 @@ + unsigned int size = 0; + unsigned int i; + unsigned int res; ++ unsigned int reserved = 0; + + pthread_mutex_lock (&totempg_mutex); + pthread_mutex_lock (&mcast_msg_mutex); +@@ -1116,14 +1142,28 @@ + size += iovec[i].iov_len; + } + +- res = send_ok (size); ++ reserved = send_reserve (size); ++ if (msg_count_send_ok (reserved) == 0) { ++ send_release (reserved); ++ reserved = 0; ++ } + + hdb_handle_put (&totempg_groups_instance_database, handle); + + error_exit: + pthread_mutex_unlock (&mcast_msg_mutex); + pthread_mutex_unlock (&totempg_mutex); +- return (res); ++ return (reserved); ++} ++ ++ ++void totempg_groups_joined_release (int msg_count) ++{ ++ pthread_mutex_lock (&totempg_mutex); ++ pthread_mutex_lock (&mcast_msg_mutex); ++ send_release (msg_count); ++ pthread_mutex_unlock (&mcast_msg_mutex); ++ pthread_mutex_unlock (&totempg_mutex); + } + + int totempg_groups_mcast_groups ( +@@ -1201,7 +1241,7 @@ + size += iovec[i].iov_len; + } + +- res = send_ok (size); ++ res = msg_count_send_ok (size); + + hdb_handle_put (&totempg_groups_instance_database, handle); + error_exit: +diff -Naurd corosync-0.94.orig/include/corosync/engine/coroapi.h corosync-trunk/include/corosync/engine/coroapi.h +--- corosync-0.94.orig/include/corosync/engine/coroapi.h 2009-02-26 15:49:41.000000000 +0100 ++++ corosync-trunk/include/corosync/engine/coroapi.h 2009-03-06 08:38:34.000000000 +0100 +@@ -413,8 +413,6 @@ + + int (*totem_mcast) (struct iovec *iovec, int iov_len, unsigned int guarantee); + +- int (*totem_send_ok) (struct iovec *iovec, int iov_len); +- + int (*totem_ifaces_get) ( + unsigned int nodeid, + struct totem_ip_address *interfaces, +@@ -472,11 +470,14 @@ + int iov_len, + int guarantee); + +- int (*tpg_joined_send_ok) ( ++ int (*tpg_joined_reserve) ( + hdb_handle_t handle, + struct iovec *iovec, + int iov_len); + ++ int (*tpg_joined_release) ( ++ int reserved_msgs); ++ + int (*tpg_groups_mcast) ( + hdb_handle_t handle, + int guarantee, +@@ -485,13 +486,16 @@ + struct iovec *iovec, + int iov_len); + +- int (*tpg_groups_send_ok) ( ++ int (*tpg_groups_reserve) ( + hdb_handle_t handle, + struct corosync_tpg_group *groups, + int groups_cnt, + struct iovec *iovec, + int iov_len); + ++ int (*tpg_groups_release) ( ++ int reserved_msgs); ++ + int (*sync_request) ( + char *service_name); + +diff -Naurd corosync-0.94.orig/include/corosync/ipc_cfg.h corosync-trunk/include/corosync/ipc_cfg.h +--- corosync-0.94.orig/include/corosync/ipc_cfg.h 2009-02-19 03:23:58.000000000 +0100 ++++ corosync-trunk/include/corosync/ipc_cfg.h 2009-03-06 11:07:35.000000000 +0100 +@@ -69,7 +69,8 @@ + MESSAGE_RES_CFG_TRYSHUTDOWN = 9, + MESSAGE_RES_CFG_TESTSHUTDOWN = 10, + MESSAGE_RES_CFG_GET_NODE_ADDRS = 11, +- MESSAGE_RES_CFG_LOCAL_GET = 12 ++ MESSAGE_RES_CFG_LOCAL_GET = 12, ++ MESSAGE_RES_CFG_REPLYTOSHUTDOWN = 13 + }; + + struct req_lib_cfg_statetrack { +diff -Naurd corosync-0.94.orig/include/corosync/totem/totempg.h corosync-trunk/include/corosync/totem/totempg.h +--- corosync-0.94.orig/include/corosync/totem/totempg.h 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/include/corosync/totem/totempg.h 2009-03-06 08:38:34.000000000 +0100 +@@ -110,10 +110,13 @@ + int iov_len, + int guarantee); + +-extern int totempg_groups_send_ok_joined ( ++extern int totempg_groups_joined_reserve ( + hdb_handle_t handle, + struct iovec *iovec, + int iov_len); ++ ++extern void totempg_groups_joined_release ( ++ int msg_count); + + extern int totempg_groups_mcast_groups ( + hdb_handle_t handle, +diff -Naurd corosync-0.94.orig/lib/cfg.c corosync-trunk/lib/cfg.c +--- corosync-0.94.orig/lib/cfg.c 2009-02-19 03:23:58.000000000 +0100 ++++ corosync-trunk/lib/cfg.c 2009-03-06 11:07:35.000000000 +0100 +@@ -295,8 +295,6 @@ + + pthread_mutex_destroy (&cfg_instance->dispatch_mutex); + +- cslib_service_disconnect (&cfg_instance->ipc_ctx); +- + (void)saHandleDestroy (&cfg_hdb, cfg_handle); + + (void)saHandleInstancePut (&cfg_hdb, cfg_handle); +diff -Naurd corosync-0.94.orig/services/cfg.c corosync-trunk/services/cfg.c +--- corosync-0.94.orig/services/cfg.c 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/services/cfg.c 2009-03-06 11:07:35.000000000 +0100 +@@ -237,8 +237,8 @@ + }, + { /* 10 */ + .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown, +- .response_size = 0, +- .response_id = 0, ++ .response_size = sizeof (struct res_lib_cfg_replytoshutdown), ++ .response_id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN, + .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED + }, + { /* 11 */ +@@ -385,7 +385,7 @@ + return 0; + } + +-static void send_test_shutdown(void * conn, int status) ++static void send_test_shutdown(void *only_conn, void *exclude_conn, int status) + { + struct res_lib_cfg_testshutdown res_lib_cfg_testshutdown; + struct list_head *iter; +@@ -396,17 +396,19 @@ + res_lib_cfg_testshutdown.header.error = status; + res_lib_cfg_testshutdown.flags = shutdown_flags; + +- if (conn) { +- TRACE1("sending testshutdown to %p", conn); +- api->ipc_response_send(conn, &res_lib_cfg_testshutdown, +- sizeof(res_lib_cfg_testshutdown)); ++ if (only_conn) { ++ TRACE1("sending testshutdown to only %p", only_conn); ++ api->ipc_dispatch_send(only_conn, &res_lib_cfg_testshutdown, ++ sizeof(res_lib_cfg_testshutdown)); + } else { + for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { + struct cfg_info *ci = list_entry(iter, struct cfg_info, list); + +- TRACE1("sending testshutdown to %p", ci->tracker_conn); +- api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown, +- sizeof(res_lib_cfg_testshutdown)); ++ if (ci->conn != exclude_conn) { ++ TRACE1("sending testshutdown to %p", ci->tracker_conn); ++ api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown, ++ sizeof(res_lib_cfg_testshutdown)); ++ } + } + } + LEAVE(); +@@ -436,11 +438,6 @@ + shutdown_flags == CFG_SHUTDOWN_FLAG_REGARDLESS) { + TRACE1("shutdown confirmed"); + +- /* +- * Tell other nodes we are going down +- */ +- send_shutdown(); +- + res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); + res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; + res_lib_cfg_tryshutdown.header.error = CS_OK; +@@ -451,6 +448,12 @@ + api->ipc_response_send(shutdown_con->conn, &res_lib_cfg_tryshutdown, + sizeof(res_lib_cfg_tryshutdown)); + shutdown_con = NULL; ++ ++ /* ++ * Tell other nodes we are going down ++ */ ++ send_shutdown(); ++ + } + else { + +@@ -486,7 +489,7 @@ + shutdown_no = shutdown_expected; + check_shutdown_status(); + +- send_test_shutdown(NULL, CS_ERR_TIMEOUT); ++ send_test_shutdown(NULL, NULL, CS_ERR_TIMEOUT); + LEAVE(); + } + +@@ -695,7 +698,6 @@ + void *msg) + { + struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); +-// struct req_lib_cfg_statetrack *req_lib_cfg_statetrack = (struct req_lib_cfg_statetrack *)message; + struct res_lib_cfg_statetrack res_lib_cfg_statetrack; + + ENTER(); +@@ -713,7 +715,7 @@ + */ + ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; + shutdown_expected++; +- send_test_shutdown(conn, CS_OK); ++ send_test_shutdown(conn, NULL, CS_OK); + } + } + +@@ -898,15 +900,32 @@ + shutdown_expected = 0; + + for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { +- struct cfg_info *ci = list_entry(iter, struct cfg_info, list); +- ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; +- shutdown_expected++; ++ struct cfg_info *testci = list_entry(iter, struct cfg_info, list); ++ /* ++ * It is assumed that we will allow shutdown ++ */ ++ if (testci != ci) { ++ testci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; ++ shutdown_expected++; ++ } + } + + /* + * If no-one is listening for events then we can just go down now + */ + if (shutdown_expected == 0) { ++ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; ++ ++ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); ++ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; ++ res_lib_cfg_tryshutdown.header.error = CS_OK; ++ ++ /* ++ * Tell originator that shutdown was confirmed ++ */ ++ api->ipc_response_send(conn, &res_lib_cfg_tryshutdown, ++ sizeof(res_lib_cfg_tryshutdown)); ++ + send_shutdown(); + LEAVE(); + return; +@@ -944,7 +963,7 @@ + /* + * Tell the users we would like to shut down + */ +- send_test_shutdown(NULL, CS_OK); ++ send_test_shutdown(NULL, conn, CS_OK); + } + + /* +@@ -961,11 +980,13 @@ + { + struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); + struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = (struct req_lib_cfg_replytoshutdown *)msg; ++ struct res_lib_cfg_replytoshutdown res_lib_cfg_replytoshutdown; ++ int status = CS_OK; + + ENTER(); + if (!shutdown_con) { +- LEAVE(); +- return; ++ status = CS_ERR_ACCESS; ++ goto exit_fn; + } + + if (req_lib_cfg_replytoshutdown->response) { +@@ -977,6 +998,15 @@ + ci->shutdown_reply = SHUTDOWN_REPLY_NO; + } + check_shutdown_status(); ++ ++exit_fn: ++ res_lib_cfg_replytoshutdown.header.error = status; ++ res_lib_cfg_replytoshutdown.header.id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN; ++ res_lib_cfg_replytoshutdown.header.size = sizeof(res_lib_cfg_replytoshutdown); ++ ++ api->ipc_response_send(conn, &res_lib_cfg_replytoshutdown, ++ sizeof(res_lib_cfg_replytoshutdown)); ++ + LEAVE(); + } + +diff -Naurd corosync-0.94.orig/services/cpg.c corosync-trunk/services/cpg.c +--- corosync-0.94.orig/services/cpg.c 2009-03-03 01:57:44.000000000 +0100 +++ corosync-trunk/services/cpg.c 2009-03-06 03:42:48.000000000 +0100 @@ -489,8 +489,8 @@ notify_info.nodeid = api->totem_nodeid_get(); @@ -80,3 +592,141 @@ diff -Naurd corosync-0.94/services/cpg.c corosync-trunk/services/cpg.c api->ipc_refcnt_dec (conn); return (0); } +diff -Naurd corosync-0.94.orig/services/evs.c corosync-trunk/services/evs.c +--- corosync-0.94.orig/services/evs.c 2009-02-19 03:23:58.000000000 +0100 ++++ corosync-trunk/services/evs.c 2009-03-06 08:38:34.000000000 +0100 +@@ -363,7 +363,6 @@ + struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined; + struct iovec req_exec_evs_mcast_iovec[3]; + struct req_exec_evs_mcast req_exec_evs_mcast; +- int send_ok = 0; + int res; + struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn); + +@@ -382,8 +381,6 @@ + req_exec_evs_mcast_iovec[1].iov_len = evs_pd->group_entries * sizeof (struct evs_group); + req_exec_evs_mcast_iovec[2].iov_base = (char *)&req_lib_evs_mcast_joined->msg; + req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len; +-// TODO this doesn't seem to work for some reason +- send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); + + res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); + // TODO +@@ -407,7 +404,6 @@ + struct iovec req_exec_evs_mcast_iovec[3]; + struct req_exec_evs_mcast req_exec_evs_mcast; + char *msg_addr; +- int send_ok = 0; + int res; + + req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast) + +@@ -430,8 +426,6 @@ + req_exec_evs_mcast_iovec[2].iov_base = msg_addr; + req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_groups->msg_len; + +-// TODO this is wacky +- send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); + res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); + if (res == 0) { + error = CS_OK; +diff -Naurd corosync-0.94.orig/tools/corosync-cfgtool.c corosync-trunk/tools/corosync-cfgtool.c +--- corosync-0.94.orig/tools/corosync-cfgtool.c 2009-02-13 10:21:57.000000000 +0100 ++++ corosync-trunk/tools/corosync-cfgtool.c 2009-03-06 11:07:35.000000000 +0100 +@@ -147,36 +147,13 @@ + (void)corosync_cfg_finalize (handle); + } + +-void shutdown_callback (corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags) +-{ +- printf("shutdown callback called, flags = %d\n",flags); +- +- (void)corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES); +-} +- +-void *shutdown_dispatch_thread(void *arg) +-{ +- int res = CS_OK; +- corosync_cfg_handle_t *handle = arg; +- +- while (res == CS_OK) { +- res = corosync_cfg_dispatch(*handle, CS_DISPATCH_ALL); +- if (res != CS_OK) +- printf ("Could not dispatch cfg messages: %d\n", res); +- } +- return NULL; +-} +- + void shutdown_do() + { + cs_error_t result; + corosync_cfg_handle_t handle; + corosync_cfg_callbacks_t callbacks; +- corosync_cfg_state_notification_t notification_buffer; +- pthread_t dispatch_thread; + +- printf ("Shutting down corosync\n"); +- callbacks.corosync_cfg_shutdown_callback = shutdown_callback; ++ callbacks.corosync_cfg_shutdown_callback = NULL; + + result = corosync_cfg_initialize (&handle, &callbacks); + if (result != CS_OK) { +@@ -184,16 +161,7 @@ + exit (1); + } + +- pthread_create(&dispatch_thread, NULL, shutdown_dispatch_thread, &handle); +- +- result = corosync_cfg_state_track (handle, +- 0, +- ¬ification_buffer); +- if (result != CS_OK) { +- printf ("Could not start corosync cfg tracking error %d\n", result); +- exit (1); +- } +- ++ printf ("Shutting down corosync\n"); + result = corosync_cfg_try_shutdown (handle, COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST); + if (result != CS_OK) { + printf ("Could not shutdown (error = %d)\n", result); +@@ -262,7 +230,7 @@ + + void usage_do (void) + { +- printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); ++ printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [-H] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); + printf ("A tool for displaying and configuring active parameters within corosync.\n"); + printf ("options:\n"); + printf ("\t-s\tDisplays the status of the current rings on this node.\n"); +@@ -272,11 +240,11 @@ + printf ("\t-u\tUnload a service identified by name.\n"); + printf ("\t-a\tDisplay the IP address(es) of a node\n"); + printf ("\t-k\tKill a node identified by node id.\n"); +- printf ("\t-h\tShutdown corosync cleanly on this node.\n"); ++ printf ("\t-H\tShutdown corosync cleanly on this node.\n"); + } + + int main (int argc, char *argv[]) { +- const char *options = "srl:u:v:k:a:h"; ++ const char *options = "srl:u:v:k:a:hH"; + int opt; + int service_load = 0; + unsigned int nodeid; +@@ -307,7 +275,7 @@ + nodeid = atoi (optarg); + killnode_do(nodeid); + break; +- case 'h': ++ case 'H': + shutdown_do(); + break; + case 'a': +@@ -316,6 +284,9 @@ + case 'v': + version = atoi (optarg); + break; ++ case 'h': ++ usage_do(); ++ break; + } + } + diff --git a/corosync.spec b/corosync.spec index c51f119..1079dab 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,9 +1,9 @@ -%define alphatag svn1792 +%define alphatag svn1794 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.94 -Release: 2%{?alphatag:.%{alphatag}}%{?dist} +Release: 3%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org @@ -190,6 +190,11 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Mon Mar 9 2009 Fabio M. Di Nitto - 0.94-3.svn1794 +- Import fixes from upstream: + * Add reserve/release feature to totem message queue space (1793) + * Fix CG shutdown (1794) + * Fri Mar 6 2009 Fabio M. Di Nitto - 0.94-2.svn1792 - Import fixes from upstream: * Fix uninitialized memory. Spotted by valgrind (1788) From cdf706edf8ad399c617f094ec028ecfef2cb9745 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 10 Mar 2009 11:34:31 +0000 Subject: [PATCH 019/185] Cherry pick changes from upstream to unbreak some basic functionalities --- corosync-1807.diff | 20 ++++++++++++++++++++ corosync.spec | 13 +++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 corosync-1807.diff diff --git a/corosync-1807.diff b/corosync-1807.diff new file mode 100644 index 0000000..1b6a643 --- /dev/null +++ b/corosync-1807.diff @@ -0,0 +1,20 @@ +diff -Naurd corosync-trunk.orig/exec/vsf_quorum.c corosync-trunk/exec/vsf_quorum.c +--- corosync-trunk.orig/exec/vsf_quorum.c 2009-02-25 12:14:47.000000000 +0100 ++++ corosync-trunk/exec/vsf_quorum.c 2009-03-10 09:51:09.000000000 +0100 +@@ -116,8 +116,6 @@ + log_printf (LOG_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services.\n"); + } + +- memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); +- + quorum_view_list_entries = view_list_entries; + + /* Tell sync() only if there is a new ring_id (ie this is not a 'fake' quorum event) */ +@@ -125,6 +123,7 @@ + sync_primary_callback_fn(view_list, view_list_entries, + primary_designated, ring_id); + } ++ memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); + memcpy(quorum_view_list, view_list, sizeof(unsigned int)*view_list_entries); + + /* Tell internal listeners */ diff --git a/corosync.spec b/corosync.spec index 1079dab..d863129 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,15 +1,16 @@ -%define alphatag svn1794 +%define alphatag svn1797 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.94 -Release: 3%{?alphatag:.%{alphatag}}%{?dist} +Release: 4%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz Patch0: corosync-bump-soname.diff Patch1: corosync-trunk.diff +Patch2: corosync-1807.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -27,6 +28,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %setup -q -n corosync-%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build @@ -190,6 +192,13 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Tue Mar 10 2009 Fabio M. Di Nitto - 0.94-4.svn1797 +- Import fixes from upstream: + * Cleanup logsys format init around to use default settings (1795) + * logsys_format_set should use its own internal copy of format_buffer (1796) + * Add logsys_format_get to logsys API (1797) +- Cherry pick svn1807 to unbreak CPG. + * Mon Mar 9 2009 Fabio M. Di Nitto - 0.94-3.svn1794 - Import fixes from upstream: * Add reserve/release feature to totem message queue space (1793) From 735411c454f9904edb34165fca310b0b89b99b95 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 10 Mar 2009 11:42:15 +0000 Subject: [PATCH 020/185] Update the corosync-trunk patch for real this time. --- corosync-trunk.diff | 90 ++++++++++++++++++++++++++++++++++++++++----- corosync.spec | 5 ++- 2 files changed, 85 insertions(+), 10 deletions(-) diff --git a/corosync-trunk.diff b/corosync-trunk.diff index e7a7690..1829638 100644 --- a/corosync-trunk.diff +++ b/corosync-trunk.diff @@ -64,7 +64,7 @@ diff -Naurd corosync-0.94.orig/exec/ipc.c corosync-trunk/exec/ipc.c pthread_exit (0); diff -Naurd corosync-0.94.orig/exec/logsys.c corosync-trunk/exec/logsys.c --- corosync-0.94.orig/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 -+++ corosync-trunk/exec/logsys.c 2009-03-06 08:09:24.000000000 +0100 ++++ corosync-trunk/exec/logsys.c 2009-03-10 09:03:50.000000000 +0100 @@ -112,8 +112,6 @@ static int logsys_facility = LOG_DAEMON; @@ -83,21 +83,45 @@ diff -Naurd corosync-0.94.orig/exec/logsys.c corosync-trunk/exec/logsys.c static int log_requests_pending = 0; -@@ -875,7 +873,10 @@ +@@ -875,11 +873,25 @@ { pthread_mutex_lock (&logsys_config_mutex); - logsys_format = format; -+ if (format) -+ format_buffer = format; -+ else -+ format_buffer = "[%6s] %b"; ++ if (format_buffer) { ++ free(format_buffer); ++ format_buffer = NULL; ++ } ++ ++ if (format) { ++ format_buffer = strdup(format); ++ } else { ++ format_buffer = strdup("[%6s] %b"); ++ } pthread_mutex_unlock (&logsys_config_mutex); } + ++char *logsys_format_get (void) ++{ ++ return format_buffer; ++} ++ + void logsys_config_facility_set (char *name, unsigned int facility) + { + pthread_mutex_lock (&logsys_config_mutex); diff -Naurd corosync-0.94.orig/exec/main.c corosync-trunk/exec/main.c --- corosync-0.94.orig/exec/main.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/main.c 2009-03-06 08:38:34.000000000 +0100 ++++ corosync-trunk/exec/main.c 2009-03-09 13:59:40.000000000 +0100 +@@ -83,7 +83,7 @@ + LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED | LOG_MODE_FORK, + NULL, + LOG_DAEMON, +- "[%6s] %b", ++ NULL, + 1000000); + + LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO); @@ -448,13 +448,6 @@ return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee)); } @@ -114,7 +138,7 @@ diff -Naurd corosync-0.94.orig/exec/main.c corosync-trunk/exec/main.c char *error_string; diff -Naurd corosync-0.94.orig/exec/mainconfig.c corosync-trunk/exec/mainconfig.c --- corosync-0.94.orig/exec/mainconfig.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/mainconfig.c 2009-03-04 11:14:36.000000000 +0100 ++++ corosync-trunk/exec/mainconfig.c 2009-03-09 13:59:40.000000000 +0100 @@ -158,16 +158,14 @@ } } @@ -126,7 +150,7 @@ diff -Naurd corosync-0.94.orig/exec/mainconfig.c corosync-trunk/exec/mainconfig. } else if (strcmp (value, "off") == 0) { - main_config->logmode &= ~LOG_MODE_DISPLAY_TIMESTAMP; -+ logsys_format_set("[%6s] %b"); ++ logsys_format_set(NULL); } else { goto parse_error; } @@ -358,6 +382,18 @@ diff -Naurd corosync-0.94.orig/include/corosync/engine/coroapi.h corosync-trunk/ int (*sync_request) ( char *service_name); +diff -Naurd corosync-0.94.orig/include/corosync/engine/logsys.h corosync-trunk/include/corosync/engine/logsys.h +--- corosync-0.94.orig/include/corosync/engine/logsys.h 2009-01-16 09:59:09.000000000 +0100 ++++ corosync-trunk/include/corosync/engine/logsys.h 2009-03-10 09:03:50.000000000 +0100 +@@ -97,6 +97,8 @@ + extern void logsys_format_set ( + char *format); + ++extern char *logsys_format_get (void); ++ + extern unsigned int logsys_config_subsys_set ( + const char *subsys, + unsigned int tags, diff -Naurd corosync-0.94.orig/include/corosync/ipc_cfg.h corosync-trunk/include/corosync/ipc_cfg.h --- corosync-0.94.orig/include/corosync/ipc_cfg.h 2009-02-19 03:23:58.000000000 +0100 +++ corosync-trunk/include/corosync/ipc_cfg.h 2009-03-06 11:07:35.000000000 +0100 @@ -629,6 +665,42 @@ diff -Naurd corosync-0.94.orig/services/evs.c corosync-trunk/services/evs.c res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); if (res == 0) { error = CS_OK; +diff -Naurd corosync-0.94.orig/test/logsysbench.c corosync-trunk/test/logsysbench.c +--- corosync-0.94.orig/test/logsysbench.c 2008-10-30 23:25:56.000000000 +0100 ++++ corosync-trunk/test/logsysbench.c 2009-03-09 13:59:40.000000000 +0100 +@@ -42,7 +42,7 @@ + LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, + NULL, + LOG_DAEMON, +- "[%6s] %b", ++ NULL, + 100000); + + LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); +diff -Naurd corosync-0.94.orig/test/logsysrec.c corosync-trunk/test/logsysrec.c +--- corosync-0.94.orig/test/logsysrec.c 2008-10-30 23:25:56.000000000 +0100 ++++ corosync-trunk/test/logsysrec.c 2009-03-09 13:59:40.000000000 +0100 +@@ -39,7 +39,7 @@ + LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, + NULL, + LOG_DAEMON, +- "[%6s] %b", ++ NULL, + 100000); + + LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); +diff -Naurd corosync-0.94.orig/test/logsys_t2.c corosync-trunk/test/logsys_t2.c +--- corosync-0.94.orig/test/logsys_t2.c 2008-10-30 23:25:56.000000000 +0100 ++++ corosync-trunk/test/logsys_t2.c 2009-03-09 13:59:40.000000000 +0100 +@@ -39,7 +39,7 @@ + LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, + NULL, + LOG_DAEMON, +- "[%6s] %b" ++ NULL, + 100000); + + LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); diff -Naurd corosync-0.94.orig/tools/corosync-cfgtool.c corosync-trunk/tools/corosync-cfgtool.c --- corosync-0.94.orig/tools/corosync-cfgtool.c 2009-02-13 10:21:57.000000000 +0100 +++ corosync-trunk/tools/corosync-cfgtool.c 2009-03-06 11:07:35.000000000 +0100 diff --git a/corosync.spec b/corosync.spec index d863129..0b66fde 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,7 +3,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.94 -Release: 4%{?alphatag:.%{alphatag}}%{?dist} +Release: 5%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org @@ -192,6 +192,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/votequorum_overview.8* %changelog +* Tue Mar 10 2009 Fabio M. Di Nitto - 0.94-5.svn1797 +- Update the corosync-trunk patch for real this time. + * Tue Mar 10 2009 Fabio M. Di Nitto - 0.94-4.svn1797 - Import fixes from upstream: * Cleanup logsys format init around to use default settings (1795) From a60cf36ca68fc440918d1fa7fb7dfc335aa90ebe Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 24 Mar 2009 07:33:41 +0000 Subject: [PATCH 021/185] New upstream release. Serious spec file cleanup. --- .cvsignore | 2 +- corosync-1807.diff | 20 - corosync-bump-soname.diff | 178 --------- corosync-trunk.diff | 804 -------------------------------------- corosync.spec | 135 ++++--- sources | 2 +- 6 files changed, 85 insertions(+), 1056 deletions(-) delete mode 100644 corosync-1807.diff delete mode 100644 corosync-bump-soname.diff delete mode 100644 corosync-trunk.diff diff --git a/.cvsignore b/.cvsignore index daeebd7..3c4452c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-0.94.tar.gz +corosync-0.95.tar.gz diff --git a/corosync-1807.diff b/corosync-1807.diff deleted file mode 100644 index 1b6a643..0000000 --- a/corosync-1807.diff +++ /dev/null @@ -1,20 +0,0 @@ -diff -Naurd corosync-trunk.orig/exec/vsf_quorum.c corosync-trunk/exec/vsf_quorum.c ---- corosync-trunk.orig/exec/vsf_quorum.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/vsf_quorum.c 2009-03-10 09:51:09.000000000 +0100 -@@ -116,8 +116,6 @@ - log_printf (LOG_LEVEL_NOTICE, "This node is within the non-primary component and will NOT provide any services.\n"); - } - -- memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); -- - quorum_view_list_entries = view_list_entries; - - /* Tell sync() only if there is a new ring_id (ie this is not a 'fake' quorum event) */ -@@ -125,6 +123,7 @@ - sync_primary_callback_fn(view_list, view_list_entries, - primary_designated, ring_id); - } -+ memcpy(&quorum_ring_id, ring_id, sizeof (quorum_ring_id)); - memcpy(quorum_view_list, view_list, sizeof(unsigned int)*view_list_entries); - - /* Tell internal listeners */ diff --git a/corosync-bump-soname.diff b/corosync-bump-soname.diff deleted file mode 100644 index c3788a7..0000000 --- a/corosync-bump-soname.diff +++ /dev/null @@ -1,178 +0,0 @@ -diff -Naurd corosync-0.94.orig/exec/Makefile corosync-0.94/exec/Makefile ---- corosync-0.94.orig/exec/Makefile 2009-02-19 03:23:58.000000000 +0100 -+++ corosync-0.94/exec/Makefile 2009-03-03 05:49:45.000000000 +0100 -@@ -73,7 +73,7 @@ - EXEC_OBJS = $(MAIN_OBJS) - override CFLAGS += -fPIC - --all:libtotem_pg.a libtotem_pg.so.2.0.0 liblogsys.a liblogsys.so.2.0.0 \ -+all:libtotem_pg.a libtotem_pg.so.3.0.0 liblogsys.a liblogsys.so.3.0.0 \ - ../lcr/lcr_ifact.o corosync_ \ - objdb.lcrso vsf_ykd.lcrso coroparse.lcrso vsf_quorum.lcrso - else -@@ -125,18 +125,18 @@ - - ifeq (${COROSYNC_COMPAT}, DARWIN) - --libtotem_pg.so.2.0.0: $(TOTEM_OBJS) -+libtotem_pg.so.3.0.0: $(TOTEM_OBJS) - $(CC) $(LDFLAGS) -bundle -bind_at_load $(TOTEM_OBJS) -o $@ - --liblogsys.so.2.0.0: $(LOGSYS_OBJS) -+liblogsys.so.3.0.0: $(LOGSYS_OBJS) - $(CC) $(LDFLAGS) -bundle -bind_at_load $(LOGSYS_OBJS) -o $@ - else - --libtotem_pg.so.2.0.0: $(TOTEM_OBJS) -- $(CC) $(LDFLAGS) -shared -Wl,-soname,libtotem_pg.so.2 $(TOTEM_OBJS) -o $@ -+libtotem_pg.so.3.0.0: $(TOTEM_OBJS) -+ $(CC) $(LDFLAGS) -shared -Wl,-soname,libtotem_pg.so.3 $(TOTEM_OBJS) -o $@ - --liblogsys.so.2.0.0: $(LIBLOGSYS_OBJS) -- $(CC) -shared -Wl,-soname,liblogsys.so.2 $(LOGSYS_OBJS) -o $@ $(LDFLAGS) -+liblogsys.so.3.0.0: $(LIBLOGSYS_OBJS) -+ $(CC) -shared -Wl,-soname,liblogsys.so.3 $(LOGSYS_OBJS) -o $@ $(LDFLAGS) - - endif - -diff -Naurd corosync-0.94.orig/lib/Makefile corosync-0.94/lib/Makefile ---- corosync-0.94.orig/lib/Makefile 2009-02-19 03:23:58.000000000 +0100 -+++ corosync-0.94/lib/Makefile 2009-03-03 05:49:45.000000000 +0100 -@@ -37,14 +37,14 @@ - - override LDFLAGS += -L./ - --all: libcpg.a libcpg.so.2.0.0 \ -- libconfdb.a libconfdb.so.2.0.0 \ -- libevs.a libevs.so.2.0.0 \ -- libcfg.a libcfg.so.2.0.0 \ -- libquorum.a libquorum.so.2.0.0 \ -- libpload.a libpload.so.2.0.0 \ -- libcoroipc.a libcoroipc.so.2.0.0 \ -- libvotequorum.a libvotequorum.so.2.0.0 -+all: libcpg.a libcpg.so.3.0.0 \ -+ libconfdb.a libconfdb.so.3.0.0 \ -+ libevs.a libevs.so.3.0.0 \ -+ libcfg.a libcfg.so.3.0.0 \ -+ libquorum.a libquorum.so.3.0.0 \ -+ libpload.a libpload.so.3.0.0 \ -+ libcoroipc.a libcoroipc.so.3.0.0 \ -+ libvotequorum.a libvotequorum.so.3.0.0 - - libcoroipc.a: coroipc.o - $(AR) -rc libcoroipc.a coroipc.o -@@ -52,55 +52,55 @@ - ifeq (${COROSYNC_COMPAT}, DARWIN) - - DARWIN_OPTS=-dynamiclib -bind_at_load -current_version 2.0.0 -compatibility_version 2.0.0 --libcoroipc.so.2.0.0: coroipc.o -+libcoroipc.so.3.0.0: coroipc.o - $(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o -o $@ - --libevs.so.2.0.0: coroipc.o evs.o -+libevs.so.3.0.0: coroipc.o evs.o - $(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o evs.o -o $@ - --libcpg.so.2.0.0: coroipc.o cpg.o -+libcpg.so.3.0.0: coroipc.o cpg.o - $(CC) $(DARWIN_OPTS) coroipc.o cpg.o -o $@ - --libquorum.so.2.0.0: coroipc.o quorum.o -+libquorum.so.3.0.0: coroipc.o quorum.o - $(CC) $(DARWIN_OPTS) coroipc.o quorum.o -o $@ - --libvotequorum.so.2.0.0: coroipc.o votequorum.o -+libvotequorum.so.3.0.0: coroipc.o votequorum.o - $(CC) $(DARWIN_OPTS) coroipc.o votequorum.o -o $@ - --libconfdb.so.2.0.0: coroipc.o confdb.o sa-confdb.o -+libconfdb.so.3.0.0: coroipc.o confdb.o sa-confdb.o - $(CC) $(LDFLAGS) $(DARWIN_OPTS) coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ - --libcfg.so.2.0.0: coroipc.o cfg.o -+libcfg.so.3.0.0: coroipc.o cfg.o - $(CC) $(DARWIN_OPTS) coroipc.o cfg.o -o $@ - --libpload.so.2.0.0: coroipc.o pload.o -+libpload.so.3.0.0: coroipc.o pload.o - $(CC) $(DARWIN_OPTS) coroipc.o pload.o -o $@ - - else - --libcoroipc.so.2.0.0: coroipc.o -- $(CC) $(LDFLAGS) -shared -Wl,-soname,libcoroipc.so.2,-version-script=$(srcdir)$(subdir)libcoroipc.versions coroipc.o -o $@ -+libcoroipc.so.3.0.0: coroipc.o -+ $(CC) $(LDFLAGS) -shared -Wl,-soname,libcoroipc.so.3,-version-script=$(srcdir)$(subdir)libcoroipc.versions coroipc.o -o $@ - --libevs.so.2.0.0: coroipc.o evs.o -- $(CC) $(LDFLAGS) -shared -Wl,-soname,libevs.so.2,-version-script=$(srcdir)$(subdir)libevs.versions coroipc.o evs.o -o $@ -+libevs.so.3.0.0: coroipc.o evs.o -+ $(CC) $(LDFLAGS) -shared -Wl,-soname,libevs.so.3,-version-script=$(srcdir)$(subdir)libevs.versions coroipc.o evs.o -o $@ - --libcpg.so.2.0.0: coroipc.o cpg.o -- $(CC) -shared -Wl,-soname,libcpg.so.2,-version-script=$(srcdir)$(subdir)libcpg.versions coroipc.o cpg.o -o $@ -+libcpg.so.3.0.0: coroipc.o cpg.o -+ $(CC) -shared -Wl,-soname,libcpg.so.3,-version-script=$(srcdir)$(subdir)libcpg.versions coroipc.o cpg.o -o $@ - --libquorum.so.2.0.0: coroipc.o quorum.o -- $(CC) -shared -Wl,-soname,libquorum.so.2,-version-script=$(srcdir)$(subdir)libquorum.versions coroipc.o quorum.o -o $@ -+libquorum.so.3.0.0: coroipc.o quorum.o -+ $(CC) -shared -Wl,-soname,libquorum.so.3,-version-script=$(srcdir)$(subdir)libquorum.versions coroipc.o quorum.o -o $@ - --libvotequorum.so.2.0.0: coroipc.o votequorum.o -- $(CC) -shared -Wl,-soname,libvotequorum.so.2,-version-script=$(srcdir)$(subdir)libvotequorum.versions coroipc.o votequorum.o -o $@ -+libvotequorum.so.3.0.0: coroipc.o votequorum.o -+ $(CC) -shared -Wl,-soname,libvotequorum.so.3,-version-script=$(srcdir)$(subdir)libvotequorum.versions coroipc.o votequorum.o -o $@ - --libconfdb.so.2.0.0: coroipc.o confdb.o sa-confdb.o -- $(CC) $(LDFLAGS) -shared -Wl,-soname,libconfdb.so.2,-version-script=$(srcdir)$(subdir)libconfdb.versions coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ -+libconfdb.so.3.0.0: coroipc.o confdb.o sa-confdb.o -+ $(CC) $(LDFLAGS) -shared -Wl,-soname,libconfdb.so.3,-version-script=$(srcdir)$(subdir)libconfdb.versions coroipc.o confdb.o sa-confdb.o ../lcr/lcr_ifact.o -o $@ - --libcfg.so.2.0.0: coroipc.o cfg.o -- $(CC) -shared -Wl,-soname,libcfg.so.2,-version-script=$(srcdir)$(subdir)libcfg.versions coroipc.o cfg.o -o $@ -+libcfg.so.3.0.0: coroipc.o cfg.o -+ $(CC) -shared -Wl,-soname,libcfg.so.3,-version-script=$(srcdir)$(subdir)libcfg.versions coroipc.o cfg.o -o $@ - --libpload.so.2.0.0: coroipc.o pload.o -- $(CC) -shared -Wl,-soname,libpload.so.2,-version-script=$(srcdir)$(subdir)libpload.versions coroipc.o cfg.o -o $@ -+libpload.so.3.0.0: coroipc.o pload.o -+ $(CC) -shared -Wl,-soname,libpload.so.3,-version-script=$(srcdir)$(subdir)libpload.versions coroipc.o cfg.o -o $@ - - endif - -diff -Naurd corosync-0.94.orig/Makefile corosync-0.94/Makefile ---- corosync-0.94.orig/Makefile 2009-02-25 05:58:08.000000000 +0100 -+++ corosync-0.94/Makefile 2009-03-03 05:49:45.000000000 +0100 -@@ -133,11 +133,11 @@ - - for eLib in $(EXEC_LIBS); do \ - ( cd $(builddir) ; \ -- ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so; \ -- ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so.2; \ -+ ln -sf lib$$eLib.so.3.0.0 exec/lib$$eLib.so; \ -+ ln -sf lib$$eLib.so.3.0.0 exec/lib$$eLib.so.3; \ - $(CP) -a exec/lib$$eLib.so $(DESTDIR)$(LIBDIR); \ -- $(CP) -a exec/lib$$eLib.so.2 $(DESTDIR)$(LIBDIR); \ -- install -m 755 exec/lib$$eLib.so.2.* $(DESTDIR)$(LIBDIR); \ -+ $(CP) -a exec/lib$$eLib.so.3 $(DESTDIR)$(LIBDIR); \ -+ install -m 755 exec/lib$$eLib.so.3.* $(DESTDIR)$(LIBDIR); \ - if [ "xYES" = "x$(STATICLIBS)" ]; then \ - install -m 755 exec/lib$$eLib.a $(DESTDIR)$(LIBDIR); \ - if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ -@@ -149,11 +149,11 @@ - - for aLib in $(COROSYNC_LIBS); do \ - ( cd $(builddir) ; \ -- ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so; \ -- ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so.2; \ -+ ln -sf lib$$aLib.so.3.0.0 lib/lib$$aLib.so; \ -+ ln -sf lib$$aLib.so.3.0.0 lib/lib$$aLib.so.3; \ - $(CP) -a lib/lib$$aLib.so $(DESTDIR)$(LIBDIR); \ -- $(CP) -a lib/lib$$aLib.so.2 $(DESTDIR)$(LIBDIR); \ -- install -m 755 lib/lib$$aLib.so.2.* $(DESTDIR)$(LIBDIR); \ -+ $(CP) -a lib/lib$$aLib.so.3 $(DESTDIR)$(LIBDIR); \ -+ install -m 755 lib/lib$$aLib.so.3.* $(DESTDIR)$(LIBDIR); \ - if [ "xYES" = "x$(STATICLIBS)" ]; then \ - install -m 755 lib/lib$$aLib.a $(DESTDIR)$(LIBDIR); \ - if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \ diff --git a/corosync-trunk.diff b/corosync-trunk.diff deleted file mode 100644 index 1829638..0000000 --- a/corosync-trunk.diff +++ /dev/null @@ -1,804 +0,0 @@ -diff -Naurd corosync-0.94.orig/exec/apidef.c corosync-trunk/exec/apidef.c ---- corosync-0.94.orig/exec/apidef.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/apidef.c 2009-03-06 08:38:34.000000000 +0100 -@@ -86,7 +86,6 @@ - .totem_family_get = totempg_my_family_get, - .totem_ring_reenable = totempg_ring_reenable, - .totem_mcast = main_mcast, -- .totem_send_ok = main_send_ok, - .totem_ifaces_get = totempg_ifaces_get, - .totem_ifaces_print = totempg_ifaces_print, - .totem_ip_print = totemip_print, -@@ -96,9 +95,11 @@ - .tpg_join = (typedef_tpg_join)totempg_groups_join, - .tpg_leave = (typedef_tpg_leave)totempg_groups_leave, - .tpg_joined_mcast = totempg_groups_mcast_joined, -- .tpg_joined_send_ok = totempg_groups_send_ok_joined, -+ .tpg_joined_reserve = totempg_groups_joined_reserve, -+ .tpg_joined_release = totempg_groups_joined_release, - .tpg_groups_mcast = (typedef_tpg_groups_mcast)totempg_groups_mcast_groups, -- .tpg_groups_send_ok = (typedef_tpg_groups_send_ok)totempg_groups_send_ok_groups, -+ .tpg_groups_reserve = NULL, -+ .tpg_groups_release = NULL, - .sync_request = sync_request, - .quorum_is_quorate = corosync_quorum_is_quorate, - .quorum_register_callback = corosync_quorum_register_callback, -diff -Naurd corosync-0.94.orig/exec/ipc.c corosync-trunk/exec/ipc.c ---- corosync-0.94.orig/exec/ipc.c 2009-03-03 01:58:16.000000000 +0100 -+++ corosync-trunk/exec/ipc.c 2009-03-06 08:38:34.000000000 +0100 -@@ -270,7 +270,7 @@ - struct res_overlay res_overlay; - struct iovec send_ok_joined_iovec; - int send_ok = 0; -- int send_ok_joined = 0; -+ int reserved_msgs = 0; - - for (;;) { - sop.sem_num = 0; -@@ -296,14 +296,16 @@ - - send_ok_joined_iovec.iov_base = (char *)header; - send_ok_joined_iovec.iov_len = header->size; -- send_ok_joined = totempg_groups_send_ok_joined (corosync_group_handle, -+ -+ reserved_msgs = totempg_groups_joined_reserve ( -+ corosync_group_handle, - &send_ok_joined_iovec, 1); - - send_ok = - (corosync_quorum_is_quorate() == 1 || ais_service[conn_info->service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) && ( - (ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_NOT_REQUIRED) || - ((ais_service[conn_info->service]->lib_engine[header->id].flow_control == CS_LIB_FLOW_CONTROL_REQUIRED) && -- (send_ok_joined) && -+ (reserved_msgs) && - (sync_in_process() == 0))); - - if (send_ok) { -@@ -321,6 +323,7 @@ - res_overlay.header.size); - } - -+ totempg_groups_joined_release (reserved_msgs); - cs_conn_refcount_dec (conn); - } - pthread_exit (0); -diff -Naurd corosync-0.94.orig/exec/logsys.c corosync-trunk/exec/logsys.c ---- corosync-0.94.orig/exec/logsys.c 2009-01-23 15:25:30.000000000 +0100 -+++ corosync-trunk/exec/logsys.c 2009-03-10 09:03:50.000000000 +0100 -@@ -112,8 +112,6 @@ - - static int logsys_facility = LOG_DAEMON; - --static char *logsys_format = NULL; -- - /* - * operating global variables - */ -@@ -139,7 +137,7 @@ - - static int logsys_buffer_full = 0; - --static char *format_buffer="[%6s] %b"; -+static char *format_buffer=NULL; - - static int log_requests_pending = 0; - -@@ -875,11 +873,25 @@ - { - pthread_mutex_lock (&logsys_config_mutex); - -- logsys_format = format; -+ if (format_buffer) { -+ free(format_buffer); -+ format_buffer = NULL; -+ } -+ -+ if (format) { -+ format_buffer = strdup(format); -+ } else { -+ format_buffer = strdup("[%6s] %b"); -+ } - - pthread_mutex_unlock (&logsys_config_mutex); - } - -+char *logsys_format_get (void) -+{ -+ return format_buffer; -+} -+ - void logsys_config_facility_set (char *name, unsigned int facility) - { - pthread_mutex_lock (&logsys_config_mutex); -diff -Naurd corosync-0.94.orig/exec/main.c corosync-trunk/exec/main.c ---- corosync-0.94.orig/exec/main.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/main.c 2009-03-09 13:59:40.000000000 +0100 -@@ -83,7 +83,7 @@ - LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED | LOG_MODE_FORK, - NULL, - LOG_DAEMON, -- "[%6s] %b", -+ NULL, - 1000000); - - LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO); -@@ -448,13 +448,6 @@ - return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee)); - } - --extern int main_send_ok ( -- struct iovec *iovec, -- int iov_len) --{ -- return (totempg_groups_send_ok_joined (corosync_group_handle, iovec, iov_len)); --} -- - int main (int argc, char **argv) - { - char *error_string; -diff -Naurd corosync-0.94.orig/exec/mainconfig.c corosync-trunk/exec/mainconfig.c ---- corosync-0.94.orig/exec/mainconfig.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/mainconfig.c 2009-03-09 13:59:40.000000000 +0100 -@@ -158,16 +158,14 @@ - } - } - if (!objdb_get_string (objdb,object_service_handle, "timestamp", &value)) { --/* todo change format string - if (strcmp (value, "on") == 0) { -- main_config->logmode |= LOG_MODE_DISPLAY_TIMESTAMP; -+ logsys_format_set("%t [%6s] %b"); - } else - if (strcmp (value, "off") == 0) { -- main_config->logmode &= ~LOG_MODE_DISPLAY_TIMESTAMP; -+ logsys_format_set(NULL); - } else { - goto parse_error; - } --*/ - } - - /* free old string on reload */ -diff -Naurd corosync-0.94.orig/exec/main.h corosync-trunk/exec/main.h ---- corosync-0.94.orig/exec/main.h 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/main.h 2009-03-06 08:38:34.000000000 +0100 -@@ -62,8 +62,4 @@ - int iov_len, - unsigned int guarantee); - --extern int main_send_ok ( -- struct iovec *iovec, -- int iov_len); -- - #endif /* MAIN_H_DEFINED */ -diff -Naurd corosync-0.94.orig/exec/totemip.c corosync-trunk/exec/totemip.c ---- corosync-0.94.orig/exec/totemip.c 2009-01-26 21:46:45.000000000 +0100 -+++ corosync-trunk/exec/totemip.c 2009-03-03 04:57:37.000000000 +0100 -@@ -406,6 +406,7 @@ - memset(&nladdr, 0, sizeof(nladdr)); - nladdr.nl_family = AF_NETLINK; - -+ memset(&req, 0, sizeof(req)); - req.nlh.nlmsg_len = sizeof(req); - req.nlh.nlmsg_type = RTM_GETADDR; - req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST; -diff -Naurd corosync-0.94.orig/exec/totempg.c corosync-trunk/exec/totempg.c ---- corosync-0.94.orig/exec/totempg.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/exec/totempg.c 2009-03-06 08:38:34.000000000 +0100 -@@ -145,6 +145,8 @@ - - static int mcast_packed_msg_count = 0; - -+static int totempg_reserved = 0; -+ - /* - * Function and data used to log messages - */ -@@ -225,8 +227,6 @@ - .mutex = PTHREAD_MUTEX_INITIALIZER - }; - --static int send_ok (int msg_size); -- - static unsigned char next_fragment = 1; - - static pthread_mutex_t totempg_mutex = PTHREAD_MUTEX_INITIALIZER; -@@ -241,6 +241,10 @@ - __FILE__, __LINE__, level, format, ##args); \ - } while (0); - -+static int msg_count_send_ok (int msg_count); -+ -+static int byte_count_send_ok (int byte_count); -+ - static struct assembly *assembly_ref (unsigned int nodeid) - { - struct assembly *assembly; -@@ -765,7 +769,7 @@ - total_size += iovec[i].iov_len; - } - -- if (send_ok (total_size + sizeof(unsigned short) * -+ if (byte_count_send_ok (total_size + sizeof(unsigned short) * - (mcast_packed_msg_count+1)) == 0) { - - pthread_mutex_unlock (&mcast_msg_mutex); -@@ -888,23 +892,44 @@ - /* - * Determine if a message of msg_size could be queued - */ --#define FUZZY_AVAIL_SUBTRACT 5 --static int send_ok ( -- int msg_size) -+static int msg_count_send_ok ( -+ int msg_count) - { - int avail = 0; -- int total; - -- avail = totemmrp_avail () - FUZZY_AVAIL_SUBTRACT; -+ avail = totemmrp_avail () - totempg_reserved - 1; - -- /* -- * msg size less then totempg_totem_config->net_mtu - 25 will take up -- * a full message, so add +1 -- * totempg_totem_config->net_mtu - 25 is for the totempg_mcast header -- */ -- total = (msg_size / (totempg_totem_config->net_mtu - 25)) + 1; -+ return (avail > msg_count); -+} - -- return (avail >= total); -+static int byte_count_send_ok ( -+ int byte_count) -+{ -+ unsigned int msg_count = 0; -+ int avail = 0; -+ -+ avail = totemmrp_avail () - 1; -+ -+ msg_count = (byte_count / (totempg_totem_config->net_mtu - 25)) + 1; -+ -+ return (avail > msg_count); -+} -+ -+static int send_reserve ( -+ int msg_size) -+{ -+ unsigned int msg_count = 0; -+ -+ msg_count = (msg_size / (totempg_totem_config->net_mtu - 25)) + 1; -+ totempg_reserved += msg_count; -+ -+ return (msg_count); -+} -+ -+static void send_release ( -+ int msg_count) -+{ -+ totempg_reserved -= msg_count; - } - - int totempg_callback_token_create ( -@@ -1091,7 +1116,7 @@ - return (res); - } - --int totempg_groups_send_ok_joined ( -+int totempg_groups_joined_reserve ( - hdb_handle_t handle, - struct iovec *iovec, - int iov_len) -@@ -1100,6 +1125,7 @@ - unsigned int size = 0; - unsigned int i; - unsigned int res; -+ unsigned int reserved = 0; - - pthread_mutex_lock (&totempg_mutex); - pthread_mutex_lock (&mcast_msg_mutex); -@@ -1116,14 +1142,28 @@ - size += iovec[i].iov_len; - } - -- res = send_ok (size); -+ reserved = send_reserve (size); -+ if (msg_count_send_ok (reserved) == 0) { -+ send_release (reserved); -+ reserved = 0; -+ } - - hdb_handle_put (&totempg_groups_instance_database, handle); - - error_exit: - pthread_mutex_unlock (&mcast_msg_mutex); - pthread_mutex_unlock (&totempg_mutex); -- return (res); -+ return (reserved); -+} -+ -+ -+void totempg_groups_joined_release (int msg_count) -+{ -+ pthread_mutex_lock (&totempg_mutex); -+ pthread_mutex_lock (&mcast_msg_mutex); -+ send_release (msg_count); -+ pthread_mutex_unlock (&mcast_msg_mutex); -+ pthread_mutex_unlock (&totempg_mutex); - } - - int totempg_groups_mcast_groups ( -@@ -1201,7 +1241,7 @@ - size += iovec[i].iov_len; - } - -- res = send_ok (size); -+ res = msg_count_send_ok (size); - - hdb_handle_put (&totempg_groups_instance_database, handle); - error_exit: -diff -Naurd corosync-0.94.orig/include/corosync/engine/coroapi.h corosync-trunk/include/corosync/engine/coroapi.h ---- corosync-0.94.orig/include/corosync/engine/coroapi.h 2009-02-26 15:49:41.000000000 +0100 -+++ corosync-trunk/include/corosync/engine/coroapi.h 2009-03-06 08:38:34.000000000 +0100 -@@ -413,8 +413,6 @@ - - int (*totem_mcast) (struct iovec *iovec, int iov_len, unsigned int guarantee); - -- int (*totem_send_ok) (struct iovec *iovec, int iov_len); -- - int (*totem_ifaces_get) ( - unsigned int nodeid, - struct totem_ip_address *interfaces, -@@ -472,11 +470,14 @@ - int iov_len, - int guarantee); - -- int (*tpg_joined_send_ok) ( -+ int (*tpg_joined_reserve) ( - hdb_handle_t handle, - struct iovec *iovec, - int iov_len); - -+ int (*tpg_joined_release) ( -+ int reserved_msgs); -+ - int (*tpg_groups_mcast) ( - hdb_handle_t handle, - int guarantee, -@@ -485,13 +486,16 @@ - struct iovec *iovec, - int iov_len); - -- int (*tpg_groups_send_ok) ( -+ int (*tpg_groups_reserve) ( - hdb_handle_t handle, - struct corosync_tpg_group *groups, - int groups_cnt, - struct iovec *iovec, - int iov_len); - -+ int (*tpg_groups_release) ( -+ int reserved_msgs); -+ - int (*sync_request) ( - char *service_name); - -diff -Naurd corosync-0.94.orig/include/corosync/engine/logsys.h corosync-trunk/include/corosync/engine/logsys.h ---- corosync-0.94.orig/include/corosync/engine/logsys.h 2009-01-16 09:59:09.000000000 +0100 -+++ corosync-trunk/include/corosync/engine/logsys.h 2009-03-10 09:03:50.000000000 +0100 -@@ -97,6 +97,8 @@ - extern void logsys_format_set ( - char *format); - -+extern char *logsys_format_get (void); -+ - extern unsigned int logsys_config_subsys_set ( - const char *subsys, - unsigned int tags, -diff -Naurd corosync-0.94.orig/include/corosync/ipc_cfg.h corosync-trunk/include/corosync/ipc_cfg.h ---- corosync-0.94.orig/include/corosync/ipc_cfg.h 2009-02-19 03:23:58.000000000 +0100 -+++ corosync-trunk/include/corosync/ipc_cfg.h 2009-03-06 11:07:35.000000000 +0100 -@@ -69,7 +69,8 @@ - MESSAGE_RES_CFG_TRYSHUTDOWN = 9, - MESSAGE_RES_CFG_TESTSHUTDOWN = 10, - MESSAGE_RES_CFG_GET_NODE_ADDRS = 11, -- MESSAGE_RES_CFG_LOCAL_GET = 12 -+ MESSAGE_RES_CFG_LOCAL_GET = 12, -+ MESSAGE_RES_CFG_REPLYTOSHUTDOWN = 13 - }; - - struct req_lib_cfg_statetrack { -diff -Naurd corosync-0.94.orig/include/corosync/totem/totempg.h corosync-trunk/include/corosync/totem/totempg.h ---- corosync-0.94.orig/include/corosync/totem/totempg.h 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/include/corosync/totem/totempg.h 2009-03-06 08:38:34.000000000 +0100 -@@ -110,10 +110,13 @@ - int iov_len, - int guarantee); - --extern int totempg_groups_send_ok_joined ( -+extern int totempg_groups_joined_reserve ( - hdb_handle_t handle, - struct iovec *iovec, - int iov_len); -+ -+extern void totempg_groups_joined_release ( -+ int msg_count); - - extern int totempg_groups_mcast_groups ( - hdb_handle_t handle, -diff -Naurd corosync-0.94.orig/lib/cfg.c corosync-trunk/lib/cfg.c ---- corosync-0.94.orig/lib/cfg.c 2009-02-19 03:23:58.000000000 +0100 -+++ corosync-trunk/lib/cfg.c 2009-03-06 11:07:35.000000000 +0100 -@@ -295,8 +295,6 @@ - - pthread_mutex_destroy (&cfg_instance->dispatch_mutex); - -- cslib_service_disconnect (&cfg_instance->ipc_ctx); -- - (void)saHandleDestroy (&cfg_hdb, cfg_handle); - - (void)saHandleInstancePut (&cfg_hdb, cfg_handle); -diff -Naurd corosync-0.94.orig/services/cfg.c corosync-trunk/services/cfg.c ---- corosync-0.94.orig/services/cfg.c 2009-02-25 12:14:47.000000000 +0100 -+++ corosync-trunk/services/cfg.c 2009-03-06 11:07:35.000000000 +0100 -@@ -237,8 +237,8 @@ - }, - { /* 10 */ - .lib_handler_fn = message_handler_req_lib_cfg_replytoshutdown, -- .response_size = 0, -- .response_id = 0, -+ .response_size = sizeof (struct res_lib_cfg_replytoshutdown), -+ .response_id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN, - .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED - }, - { /* 11 */ -@@ -385,7 +385,7 @@ - return 0; - } - --static void send_test_shutdown(void * conn, int status) -+static void send_test_shutdown(void *only_conn, void *exclude_conn, int status) - { - struct res_lib_cfg_testshutdown res_lib_cfg_testshutdown; - struct list_head *iter; -@@ -396,17 +396,19 @@ - res_lib_cfg_testshutdown.header.error = status; - res_lib_cfg_testshutdown.flags = shutdown_flags; - -- if (conn) { -- TRACE1("sending testshutdown to %p", conn); -- api->ipc_response_send(conn, &res_lib_cfg_testshutdown, -- sizeof(res_lib_cfg_testshutdown)); -+ if (only_conn) { -+ TRACE1("sending testshutdown to only %p", only_conn); -+ api->ipc_dispatch_send(only_conn, &res_lib_cfg_testshutdown, -+ sizeof(res_lib_cfg_testshutdown)); - } else { - for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { - struct cfg_info *ci = list_entry(iter, struct cfg_info, list); - -- TRACE1("sending testshutdown to %p", ci->tracker_conn); -- api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown, -- sizeof(res_lib_cfg_testshutdown)); -+ if (ci->conn != exclude_conn) { -+ TRACE1("sending testshutdown to %p", ci->tracker_conn); -+ api->ipc_dispatch_send(ci->tracker_conn, &res_lib_cfg_testshutdown, -+ sizeof(res_lib_cfg_testshutdown)); -+ } - } - } - LEAVE(); -@@ -436,11 +438,6 @@ - shutdown_flags == CFG_SHUTDOWN_FLAG_REGARDLESS) { - TRACE1("shutdown confirmed"); - -- /* -- * Tell other nodes we are going down -- */ -- send_shutdown(); -- - res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); - res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; - res_lib_cfg_tryshutdown.header.error = CS_OK; -@@ -451,6 +448,12 @@ - api->ipc_response_send(shutdown_con->conn, &res_lib_cfg_tryshutdown, - sizeof(res_lib_cfg_tryshutdown)); - shutdown_con = NULL; -+ -+ /* -+ * Tell other nodes we are going down -+ */ -+ send_shutdown(); -+ - } - else { - -@@ -486,7 +489,7 @@ - shutdown_no = shutdown_expected; - check_shutdown_status(); - -- send_test_shutdown(NULL, CS_ERR_TIMEOUT); -+ send_test_shutdown(NULL, NULL, CS_ERR_TIMEOUT); - LEAVE(); - } - -@@ -695,7 +698,6 @@ - void *msg) - { - struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); --// struct req_lib_cfg_statetrack *req_lib_cfg_statetrack = (struct req_lib_cfg_statetrack *)message; - struct res_lib_cfg_statetrack res_lib_cfg_statetrack; - - ENTER(); -@@ -713,7 +715,7 @@ - */ - ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; - shutdown_expected++; -- send_test_shutdown(conn, CS_OK); -+ send_test_shutdown(conn, NULL, CS_OK); - } - } - -@@ -898,15 +900,32 @@ - shutdown_expected = 0; - - for (iter = trackers_list.next; iter != &trackers_list; iter = iter->next) { -- struct cfg_info *ci = list_entry(iter, struct cfg_info, list); -- ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; -- shutdown_expected++; -+ struct cfg_info *testci = list_entry(iter, struct cfg_info, list); -+ /* -+ * It is assumed that we will allow shutdown -+ */ -+ if (testci != ci) { -+ testci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; -+ shutdown_expected++; -+ } - } - - /* - * If no-one is listening for events then we can just go down now - */ - if (shutdown_expected == 0) { -+ struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; -+ -+ res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown); -+ res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN; -+ res_lib_cfg_tryshutdown.header.error = CS_OK; -+ -+ /* -+ * Tell originator that shutdown was confirmed -+ */ -+ api->ipc_response_send(conn, &res_lib_cfg_tryshutdown, -+ sizeof(res_lib_cfg_tryshutdown)); -+ - send_shutdown(); - LEAVE(); - return; -@@ -944,7 +963,7 @@ - /* - * Tell the users we would like to shut down - */ -- send_test_shutdown(NULL, CS_OK); -+ send_test_shutdown(NULL, conn, CS_OK); - } - - /* -@@ -961,11 +980,13 @@ - { - struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn); - struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = (struct req_lib_cfg_replytoshutdown *)msg; -+ struct res_lib_cfg_replytoshutdown res_lib_cfg_replytoshutdown; -+ int status = CS_OK; - - ENTER(); - if (!shutdown_con) { -- LEAVE(); -- return; -+ status = CS_ERR_ACCESS; -+ goto exit_fn; - } - - if (req_lib_cfg_replytoshutdown->response) { -@@ -977,6 +998,15 @@ - ci->shutdown_reply = SHUTDOWN_REPLY_NO; - } - check_shutdown_status(); -+ -+exit_fn: -+ res_lib_cfg_replytoshutdown.header.error = status; -+ res_lib_cfg_replytoshutdown.header.id = MESSAGE_RES_CFG_REPLYTOSHUTDOWN; -+ res_lib_cfg_replytoshutdown.header.size = sizeof(res_lib_cfg_replytoshutdown); -+ -+ api->ipc_response_send(conn, &res_lib_cfg_replytoshutdown, -+ sizeof(res_lib_cfg_replytoshutdown)); -+ - LEAVE(); - } - -diff -Naurd corosync-0.94.orig/services/cpg.c corosync-trunk/services/cpg.c ---- corosync-0.94.orig/services/cpg.c 2009-03-03 01:57:44.000000000 +0100 -+++ corosync-trunk/services/cpg.c 2009-03-06 03:42:48.000000000 +0100 -@@ -489,8 +489,8 @@ - notify_info.nodeid = api->totem_nodeid_get(); - notify_info.reason = CONFCHG_CPG_REASON_PROCDOWN; - cpg_node_joinleave_send(gi, pi, MESSAGE_REQ_EXEC_CPG_PROCLEAVE, CONFCHG_CPG_REASON_PROCDOWN); -- list_del(&pi->list); - } -+ list_del(&pi->list); - api->ipc_refcnt_dec (conn); - return (0); - } -diff -Naurd corosync-0.94.orig/services/evs.c corosync-trunk/services/evs.c ---- corosync-0.94.orig/services/evs.c 2009-02-19 03:23:58.000000000 +0100 -+++ corosync-trunk/services/evs.c 2009-03-06 08:38:34.000000000 +0100 -@@ -363,7 +363,6 @@ - struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined; - struct iovec req_exec_evs_mcast_iovec[3]; - struct req_exec_evs_mcast req_exec_evs_mcast; -- int send_ok = 0; - int res; - struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn); - -@@ -382,8 +381,6 @@ - req_exec_evs_mcast_iovec[1].iov_len = evs_pd->group_entries * sizeof (struct evs_group); - req_exec_evs_mcast_iovec[2].iov_base = (char *)&req_lib_evs_mcast_joined->msg; - req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len; --// TODO this doesn't seem to work for some reason -- send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); - - res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); - // TODO -@@ -407,7 +404,6 @@ - struct iovec req_exec_evs_mcast_iovec[3]; - struct req_exec_evs_mcast req_exec_evs_mcast; - char *msg_addr; -- int send_ok = 0; - int res; - - req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast) + -@@ -430,8 +426,6 @@ - req_exec_evs_mcast_iovec[2].iov_base = msg_addr; - req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_groups->msg_len; - --// TODO this is wacky -- send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3); - res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED); - if (res == 0) { - error = CS_OK; -diff -Naurd corosync-0.94.orig/test/logsysbench.c corosync-trunk/test/logsysbench.c ---- corosync-0.94.orig/test/logsysbench.c 2008-10-30 23:25:56.000000000 +0100 -+++ corosync-trunk/test/logsysbench.c 2009-03-09 13:59:40.000000000 +0100 -@@ -42,7 +42,7 @@ - LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, - NULL, - LOG_DAEMON, -- "[%6s] %b", -+ NULL, - 100000); - - LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); -diff -Naurd corosync-0.94.orig/test/logsysrec.c corosync-trunk/test/logsysrec.c ---- corosync-0.94.orig/test/logsysrec.c 2008-10-30 23:25:56.000000000 +0100 -+++ corosync-trunk/test/logsysrec.c 2009-03-09 13:59:40.000000000 +0100 -@@ -39,7 +39,7 @@ - LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, - NULL, - LOG_DAEMON, -- "[%6s] %b", -+ NULL, - 100000); - - LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); -diff -Naurd corosync-0.94.orig/test/logsys_t2.c corosync-trunk/test/logsys_t2.c ---- corosync-0.94.orig/test/logsys_t2.c 2008-10-30 23:25:56.000000000 +0100 -+++ corosync-trunk/test/logsys_t2.c 2009-03-09 13:59:40.000000000 +0100 -@@ -39,7 +39,7 @@ - LOG_MODE_OUTPUT_STDERR | LOG_MODE_THREADED, - NULL, - LOG_DAEMON, -- "[%6s] %b" -+ NULL, - 100000); - - LOGSYS_DECLARE_NOSUBSYS(LOG_LEVEL_INFO); -diff -Naurd corosync-0.94.orig/tools/corosync-cfgtool.c corosync-trunk/tools/corosync-cfgtool.c ---- corosync-0.94.orig/tools/corosync-cfgtool.c 2009-02-13 10:21:57.000000000 +0100 -+++ corosync-trunk/tools/corosync-cfgtool.c 2009-03-06 11:07:35.000000000 +0100 -@@ -147,36 +147,13 @@ - (void)corosync_cfg_finalize (handle); - } - --void shutdown_callback (corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags) --{ -- printf("shutdown callback called, flags = %d\n",flags); -- -- (void)corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES); --} -- --void *shutdown_dispatch_thread(void *arg) --{ -- int res = CS_OK; -- corosync_cfg_handle_t *handle = arg; -- -- while (res == CS_OK) { -- res = corosync_cfg_dispatch(*handle, CS_DISPATCH_ALL); -- if (res != CS_OK) -- printf ("Could not dispatch cfg messages: %d\n", res); -- } -- return NULL; --} -- - void shutdown_do() - { - cs_error_t result; - corosync_cfg_handle_t handle; - corosync_cfg_callbacks_t callbacks; -- corosync_cfg_state_notification_t notification_buffer; -- pthread_t dispatch_thread; - -- printf ("Shutting down corosync\n"); -- callbacks.corosync_cfg_shutdown_callback = shutdown_callback; -+ callbacks.corosync_cfg_shutdown_callback = NULL; - - result = corosync_cfg_initialize (&handle, &callbacks); - if (result != CS_OK) { -@@ -184,16 +161,7 @@ - exit (1); - } - -- pthread_create(&dispatch_thread, NULL, shutdown_dispatch_thread, &handle); -- -- result = corosync_cfg_state_track (handle, -- 0, -- ¬ification_buffer); -- if (result != CS_OK) { -- printf ("Could not start corosync cfg tracking error %d\n", result); -- exit (1); -- } -- -+ printf ("Shutting down corosync\n"); - result = corosync_cfg_try_shutdown (handle, COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST); - if (result != CS_OK) { - printf ("Could not shutdown (error = %d)\n", result); -@@ -262,7 +230,7 @@ - - void usage_do (void) - { -- printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); -+ printf ("corosync-cfgtool [-s] [-r] [-l] [-u] [-H] [service_name] [-v] [version] [-k] [nodeid] [-a] [nodeid]\n\n"); - printf ("A tool for displaying and configuring active parameters within corosync.\n"); - printf ("options:\n"); - printf ("\t-s\tDisplays the status of the current rings on this node.\n"); -@@ -272,11 +240,11 @@ - printf ("\t-u\tUnload a service identified by name.\n"); - printf ("\t-a\tDisplay the IP address(es) of a node\n"); - printf ("\t-k\tKill a node identified by node id.\n"); -- printf ("\t-h\tShutdown corosync cleanly on this node.\n"); -+ printf ("\t-H\tShutdown corosync cleanly on this node.\n"); - } - - int main (int argc, char *argv[]) { -- const char *options = "srl:u:v:k:a:h"; -+ const char *options = "srl:u:v:k:a:hH"; - int opt; - int service_load = 0; - unsigned int nodeid; -@@ -307,7 +275,7 @@ - nodeid = atoi (optarg); - killnode_do(nodeid); - break; -- case 'h': -+ case 'H': - shutdown_do(); - break; - case 'a': -@@ -316,6 +284,9 @@ - case 'v': - version = atoi (optarg); - break; -+ case 'h': -+ usage_do(); -+ break; - } - } - diff --git a/corosync.spec b/corosync.spec index 0b66fde..9adcd38 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,16 +1,13 @@ -%define alphatag svn1797 +## define alphatag svn1797 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.94 -Release: 5%{?alphatag:.%{alphatag}}%{?dist} +Version: 0.95 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: corosync-bump-soname.diff -Patch1: corosync-trunk.diff -Patch2: corosync-1807.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -22,33 +19,48 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 # Setup/build bits %define ais_user_uid 39 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +%define buildtrunk 0 +%{?_with_buildtrunk: %define buildtrunk 1} + +%if %{buildtrunk} +BuildRequires: autoconf automake +%endif + +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n corosync-%{version} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 + +%if %{buildtrunk} +if [ ! -f configure ]; then + ./autogen.sh +fi +%endif + +%{_configure} CFLAGS="$(echo '%{optflags}')" \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libdir=%{_libdir} %build - -# -O3 required for performance reasons -# So we get proper debug output, for now we don't compile with O3 -#CFLAGS="$(echo '%{optflags}' | sed -e 's/-O[0-9]*//') -O3" -CFLAGS="$(echo '%{optflags}')" -make CFLAGS="$CFLAGS" +make %{_smp_mflags} %install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT STATICLIBS=NO -mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} -mkdir -p $RPM_BUILD_ROOT%{_initddir} -install -m 644 LICENSE SECURITY README.devmap \ - $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/ -install -m 755 init/redhat $RPM_BUILD_ROOT%{_initddir}/corosync +rm -rf %{buildroot} + +make install DESTDIR=%{buildroot} +install -d %{buildroot}%{_initddir} +install -m 755 init/redhat %{buildroot}%{_initddir}/corosync + +## tree fixup +# drop static libs +rm -f %{buildroot}%{_libdir}/*.a +# drop docs and html docs for now +rm -rf %{buildroot}%{_docdir}/* %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %description This package contains the Corosync Cluster Engine Executive, several default @@ -73,9 +85,7 @@ fi %files %defattr(-,root,root,-) -%dir %{_docdir}/%{name}-%{version} -%doc %{_docdir}/%{name}-%{version}/LICENSE -%doc %{_docdir}/%{name}-%{version}/SECURITY +%doc LICENSE SECURITY %{_sbindir}/corosync %{_sbindir}/corosync-keygen %{_sbindir}/corosync-objctl @@ -92,10 +102,11 @@ fi %{_libexecdir}/lcrso/service_evs.lcrso %{_libexecdir}/lcrso/service_confdb.lcrso %{_libexecdir}/lcrso/service_pload.lcrso -%{_libexecdir}/lcrso/service_votequorum.lcrso -%{_libexecdir}/lcrso/testquorum.lcrso +%{_libexecdir}/lcrso/quorum_votequorum.lcrso +%{_libexecdir}/lcrso/quorum_testquorum.lcrso %{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso +%{_libexecdir}/lcrso/quorum.lcrso %{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* @@ -110,17 +121,18 @@ This package contains corosync libraries. %files -n corosynclib %defattr(-,root,root,-) -%dir %{_libdir}/corosync -%config(noreplace) /etc/ld.so.conf.d/corosync-*.conf -%{_libdir}/corosync/libcfg.so.* -%{_libdir}/corosync/libcpg.so.* -%{_libdir}/corosync/libconfdb.so.* -%{_libdir}/corosync/libevs.so.* -%{_libdir}/corosync/libtotem_pg.so.* -%{_libdir}/corosync/liblogsys.so.* -%{_libdir}/corosync/libcoroipc.so.* -%{_libdir}/corosync/libquorum.so.* -%{_libdir}/corosync/libvotequorum.so.* +%doc LICENSE +%{_libdir}/libcfg.so.* +%{_libdir}/libcpg.so.* +%{_libdir}/libconfdb.so.* +%{_libdir}/libevs.so.* +%{_libdir}/libtotem_pg.so.* +%{_libdir}/liblogsys.so.* +%{_libdir}/libcoroipcc.so.* +%{_libdir}/libcoroipcs.so.* +%{_libdir}/libquorum.so.* +%{_libdir}/libvotequorum.so.* +%{_libdir}/libpload.so.* %post -n corosynclib -p /sbin/ldconfig @@ -140,10 +152,10 @@ The Corosync Cluster Engine APIs. %files -n corosynclib-devel %defattr(-,root,root,-) -%dir %{_docdir}/%{name}-%{version} -%doc %{_docdir}/%{name}-%{version}/README.devmap +%doc LICENSE README.devmap %dir %{_includedir}/corosync/ -%{_includedir}/corosync/coroipc.h +%{_includedir}/corosync/cs_config.h +%{_includedir}/corosync/coroipcc.h %{_includedir}/corosync/cfg.h %{_includedir}/corosync/confdb.h %{_includedir}/corosync/corotypes.h @@ -171,15 +183,17 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/engine/logsys.h %{_includedir}/corosync/engine/objdb.h %{_includedir}/corosync/engine/quorum.h -%{_libdir}/corosync/libcfg.so -%{_libdir}/corosync/libcpg.so -%{_libdir}/corosync/libconfdb.so -%{_libdir}/corosync/libevs.so -%{_libdir}/corosync/libtotem_pg.so -%{_libdir}/corosync/liblogsys.so -%{_libdir}/corosync/libcoroipc.so -%{_libdir}/corosync/libquorum.so -%{_libdir}/corosync/libvotequorum.so +%{_libdir}/libcfg.so +%{_libdir}/libcpg.so +%{_libdir}/libconfdb.so +%{_libdir}/libevs.so +%{_libdir}/libtotem_pg.so +%{_libdir}/liblogsys.so +%{_libdir}/libcoroipcc.so +%{_libdir}/libcoroipcs.so +%{_libdir}/libquorum.so +%{_libdir}/libvotequorum.so +%{_libdir}/libpload.so %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* @@ -190,8 +204,25 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/confdb_overview.8* %{_mandir}/man8/logsys_overview.8* %{_mandir}/man8/votequorum_overview.8* +%{_mandir}/man8/coroipc_overview.8* %changelog +* Tue Mar 24 2009 Fabio M. Di Nitto - 0.95-1 +- New upstream release +- spec file updates: + * Drop alpha tag + * Drop local patches (no longer required) + * Allow to build from svn trunk by supporting rpmbuild --with buildtrunk + * BuildRequires autoconf automake if building from trunk + * Execute autogen.sh if building from trunk and if no configure is available + * Switch to use rpm configure macro and set standard install paths + * Build invokation now supports _smp_mflags + * Remove install section for docs and use proper doc macro instead + * Add tree fixup bits to drop static libs and html docs (only for now) + * Add LICENSE file to all subpackages + * libraries have moved to libdir. Drop ld.so.conf.d corosync file + * Update BuildRoot usage to preferred versions/names + * Tue Mar 10 2009 Fabio M. Di Nitto - 0.94-5.svn1797 - Update the corosync-trunk patch for real this time. diff --git a/sources b/sources index e921251..d4304e3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -5839592fbb6982c6c897aa5020f0b629 corosync-0.94.tar.gz +24b268b66d95b09f7177c73bb226de74 corosync-0.95.tar.gz From ebf0cd693dc83250ace88adbcc35b04907436ad4 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 30 Mar 2009 07:00:39 +0000 Subject: [PATCH 022/185] Fix pkgconfig and unbreak lvm2 build --- corosync.spec | 8 +++++++- fix-pkgconfig.diff | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 fix-pkgconfig.diff diff --git a/corosync.spec b/corosync.spec index 9adcd38..20dfa57 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,11 +3,12 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 0.95 -Release: 1%{?alphatag:.%{alphatag}}%{?dist} +Release: 2%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz +Patch0: fix-pkgconfig.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -30,6 +31,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n corosync-%{version} +%patch0 -p1 %if %{buildtrunk} if [ ! -f configure ]; then @@ -207,6 +209,10 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Mon Mar 30 2009 Fabio M. Di Nitto - 0.95-2 +- Backport svn commit 1913 to fix pkgconfig files generation + and unbreak lvm2 build. + * Tue Mar 24 2009 Fabio M. Di Nitto - 0.95-1 - New upstream release - spec file updates: diff --git a/fix-pkgconfig.diff b/fix-pkgconfig.diff new file mode 100644 index 0000000..94503cf --- /dev/null +++ b/fix-pkgconfig.diff @@ -0,0 +1,24 @@ +diff -Naurd corosync-0.95.orig/pkgconfig/Makefile.am corosync-0.95/pkgconfig/Makefile.am +--- corosync-0.95.orig/pkgconfig/Makefile.am 2009-03-22 19:44:33.000000000 +0100 ++++ corosync-0.95/pkgconfig/Makefile.am 2009-03-30 08:48:32.000000000 +0200 +@@ -44,7 +44,7 @@ + -e 's#@PREFIX@#$(exec_prefix)#g' \ + -e 's#@LIBDIR@#$(libdir)#g' \ + -e 's#@LIBVERSION@#$(VERSION)#g' \ +- -e 's#@LIB@#'$@'#g' \ ++ -e 's#@LIB@#'$(@:lib%=%)'#g' \ + > $@.pc; + touch $@ + +diff -Naurd corosync-0.95.orig/pkgconfig/Makefile.in corosync-0.95/pkgconfig/Makefile.in +--- corosync-0.95.orig/pkgconfig/Makefile.in 2009-03-23 23:14:38.000000000 +0100 ++++ corosync-0.95/pkgconfig/Makefile.in 2009-03-30 08:48:56.000000000 +0200 +@@ -353,7 +353,7 @@ + -e 's#@PREFIX@#$(exec_prefix)#g' \ + -e 's#@LIBDIR@#$(libdir)#g' \ + -e 's#@LIBVERSION@#$(VERSION)#g' \ +- -e 's#@LIB@#'$@'#g' \ ++ -e 's#@LIB@#'$(@:lib%=%)'#g' \ + > $@.pc; + touch $@ + From 0b8e8ea5c4989ecc1b00b505eae876ba5d8b61a0 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 10 Jun 2009 06:59:19 +0000 Subject: [PATCH 023/185] Update to 0.97 + svn 2226 --- .cvsignore | 3 ++- corosync.spec | 40 ++++++++++++++++++++++++++++------------ fix-pkgconfig.diff | 24 ------------------------ sources | 3 ++- 4 files changed, 32 insertions(+), 38 deletions(-) delete mode 100644 fix-pkgconfig.diff diff --git a/.cvsignore b/.cvsignore index 3c4452c..86f4529 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1,2 @@ -corosync-0.95.tar.gz +corosync-0.97.tar.gz +corosync-trunk.diff diff --git a/corosync.spec b/corosync.spec index 20dfa57..51c41eb 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,14 +1,14 @@ -## define alphatag svn1797 +%define alphatag svn2226 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.95 -Release: 2%{?alphatag:.%{alphatag}}%{?dist} +Version: 0.97 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: fix-pkgconfig.diff +Patch0: corosync-trunk.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -20,26 +20,29 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 # Setup/build bits %define ais_user_uid 39 +%if %{alphatag} +%define buildtrunk 1 +%else %define buildtrunk 0 +%endif %{?_with_buildtrunk: %define buildtrunk 1} %if %{buildtrunk} BuildRequires: autoconf automake %endif +BuildRequires: nss-devel BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n corosync-%{version} -%patch0 -p1 +%patch0 -p0 %if %{buildtrunk} -if [ ! -f configure ]; then - ./autogen.sh -fi +./autogen.sh %endif -%{_configure} CFLAGS="$(echo '%{optflags}')" \ +%{_configure} CFLAGS="$(echo '%{optflags}')" \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ @@ -94,7 +97,7 @@ fi %{_sbindir}/corosync-cfgtool %{_sbindir}/corosync-fplay %{_sbindir}/corosync-pload -%config(noreplace) /etc/corosync.conf +%config(noreplace) /etc/corosync.conf.example %{_initddir}/corosync %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso @@ -108,7 +111,6 @@ fi %{_libexecdir}/lcrso/quorum_testquorum.lcrso %{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso -%{_libexecdir}/lcrso/quorum.lcrso %{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* @@ -157,6 +159,9 @@ The Corosync Cluster Engine APIs. %doc LICENSE README.devmap %dir %{_includedir}/corosync/ %{_includedir}/corosync/cs_config.h +%{_includedir}/corosync/corodefs.h +%{_includedir}/corosync/coroipc_types.h +%{_includedir}/corosync/coroipcs.h %{_includedir}/corosync/coroipcc.h %{_includedir}/corosync/cfg.h %{_includedir}/corosync/confdb.h @@ -164,7 +169,6 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/cpg.h %{_includedir}/corosync/evs.h %{_includedir}/corosync/hdb.h -%{_includedir}/corosync/ipc_gen.h %{_includedir}/corosync/list.h %{_includedir}/corosync/mar_gen.h %{_includedir}/corosync/swab.h @@ -209,6 +213,18 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Wed May 6 2009 Fabio M. Di Nitto - 0.97-1.svn2226 +- New upstream release +- spec file updates: + * Drop pkgconfig fix that's now upstream + * Update to svn version 2226 + * Define buildtrunk if we are using svn snapshots + * BuildRequires: nss-devel to enable nss crypto for network communication + * Force autogen invokation if buildtrunk is defined + * Whitespace cleanup + * Stop shipping corosync.conf in favour of a generic example + * Update file list + * Mon Mar 30 2009 Fabio M. Di Nitto - 0.95-2 - Backport svn commit 1913 to fix pkgconfig files generation and unbreak lvm2 build. diff --git a/fix-pkgconfig.diff b/fix-pkgconfig.diff deleted file mode 100644 index 94503cf..0000000 --- a/fix-pkgconfig.diff +++ /dev/null @@ -1,24 +0,0 @@ -diff -Naurd corosync-0.95.orig/pkgconfig/Makefile.am corosync-0.95/pkgconfig/Makefile.am ---- corosync-0.95.orig/pkgconfig/Makefile.am 2009-03-22 19:44:33.000000000 +0100 -+++ corosync-0.95/pkgconfig/Makefile.am 2009-03-30 08:48:32.000000000 +0200 -@@ -44,7 +44,7 @@ - -e 's#@PREFIX@#$(exec_prefix)#g' \ - -e 's#@LIBDIR@#$(libdir)#g' \ - -e 's#@LIBVERSION@#$(VERSION)#g' \ -- -e 's#@LIB@#'$@'#g' \ -+ -e 's#@LIB@#'$(@:lib%=%)'#g' \ - > $@.pc; - touch $@ - -diff -Naurd corosync-0.95.orig/pkgconfig/Makefile.in corosync-0.95/pkgconfig/Makefile.in ---- corosync-0.95.orig/pkgconfig/Makefile.in 2009-03-23 23:14:38.000000000 +0100 -+++ corosync-0.95/pkgconfig/Makefile.in 2009-03-30 08:48:56.000000000 +0200 -@@ -353,7 +353,7 @@ - -e 's#@PREFIX@#$(exec_prefix)#g' \ - -e 's#@LIBDIR@#$(libdir)#g' \ - -e 's#@LIBVERSION@#$(VERSION)#g' \ -- -e 's#@LIB@#'$@'#g' \ -+ -e 's#@LIB@#'$(@:lib%=%)'#g' \ - > $@.pc; - touch $@ - diff --git a/sources b/sources index d4304e3..027304a 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -24b268b66d95b09f7177c73bb226de74 corosync-0.95.tar.gz +1bab8a601e9c546c8307ca673427afbd corosync-0.97.tar.gz +c6563f1bbec1cce3f32397c9bee69166 corosync-trunk.diff From 2687a776d1cfc18006f1ab6920dae07bc726381d Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 10 Jun 2009 07:10:31 +0000 Subject: [PATCH 024/185] Update changelog date entry --- corosync.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 51c41eb..eaa764e 100644 --- a/corosync.spec +++ b/corosync.spec @@ -213,7 +213,7 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog -* Wed May 6 2009 Fabio M. Di Nitto - 0.97-1.svn2226 +* Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2226 - New upstream release - spec file updates: * Drop pkgconfig fix that's now upstream From 6e238f7e4d1caaf9bd9c52182a649f76d02aba71 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Thu, 11 Jun 2009 05:50:25 +0000 Subject: [PATCH 025/185] Update to svn2232 to import totem_pg library fix --- corosync.spec | 6 +++--- sources | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/corosync.spec b/corosync.spec index eaa764e..ce3c5e9 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,4 +1,4 @@ -%define alphatag svn2226 +%define alphatag svn2232 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces @@ -213,11 +213,11 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog -* Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2226 +* Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2232 - New upstream release - spec file updates: * Drop pkgconfig fix that's now upstream - * Update to svn version 2226 + * Update to svn version 2232 * Define buildtrunk if we are using svn snapshots * BuildRequires: nss-devel to enable nss crypto for network communication * Force autogen invokation if buildtrunk is defined diff --git a/sources b/sources index 027304a..18dfdee 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ 1bab8a601e9c546c8307ca673427afbd corosync-0.97.tar.gz -c6563f1bbec1cce3f32397c9bee69166 corosync-trunk.diff +717810286fb1d60f3240de069b94c855 corosync-trunk.diff From 852d25102541e6cf4368cf3e5e60b9a06e58e1bf Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Thu, 11 Jun 2009 14:34:26 +0000 Subject: [PATCH 026/185] Update to svn2233 to fix library linking --- corosync.spec | 6 +++++- sources | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/corosync.spec b/corosync.spec index ce3c5e9..4eb4f34 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,4 +1,4 @@ -%define alphatag svn2232 +%define alphatag svn2233 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces @@ -213,6 +213,10 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2233 +- spec file updates: + * Update to svn version 2233 to include library linking fixes + * Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2232 - New upstream release - spec file updates: diff --git a/sources b/sources index 18dfdee..0feeb79 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ 1bab8a601e9c546c8307ca673427afbd corosync-0.97.tar.gz -717810286fb1d60f3240de069b94c855 corosync-trunk.diff +4265b7e1fe87a3bb471c5c637d94e905 corosync-trunk.diff From e3192a13359718fcf9393c830f76c3c9bf8dd09d Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Sat, 20 Jun 2009 07:52:36 +0000 Subject: [PATCH 027/185] New upstream release --- .cvsignore | 3 +-- corosync.spec | 31 ++++++++++++++----------------- sources | 3 +-- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.cvsignore b/.cvsignore index 86f4529..f5800a4 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1 @@ -corosync-0.97.tar.gz -corosync-trunk.diff +corosync-0.98.tar.gz diff --git a/corosync.spec b/corosync.spec index 4eb4f34..6a64c10 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,14 +1,13 @@ -%define alphatag svn2233 +# define alphatag svn1211 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.97 +Version: 0.98 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -Patch0: corosync-trunk.diff # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -17,14 +16,8 @@ Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Conflicts: openais <= 0.89, openais-devel <= 0.89 -# Setup/build bits -%define ais_user_uid 39 - -%if %{alphatag} -%define buildtrunk 1 -%else %define buildtrunk 0 -%endif +%{?alphatag: %define buildtrunk 1} %{?_with_buildtrunk: %define buildtrunk 1} %if %{buildtrunk} @@ -36,7 +29,6 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n corosync-%{version} -%patch0 -p0 %if %{buildtrunk} ./autogen.sh @@ -71,11 +63,6 @@ rm -rf %{buildroot} This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. -%pre -# Add the "ais" user -/usr/sbin/useradd -c 'The Corosync Cluster Engine' \ - -u %{ais_user_uid} -s /sbin/nologin -r -d '/' ais 2> /dev/null || : - %post /sbin/chkconfig --add corosync || : @@ -97,7 +84,9 @@ fi %{_sbindir}/corosync-cfgtool %{_sbindir}/corosync-fplay %{_sbindir}/corosync-pload -%config(noreplace) /etc/corosync.conf.example +%dir /etc/corosync +%dir /etc/corosync/uidgid.d +%config(noreplace) /etc/corosync/corosync.conf.example %{_initddir}/corosync %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso @@ -213,6 +202,14 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Sat Jun 20 2009 Fabio M. Di Nitto - 0.98-1 +- New upstream release +- spec file updates: + * Drop corosync-trunk patch and alpha tag. + * Fix alphatag vs buildtrunk handling. + * Drop requirement on ais user/group and stop creating them. + * New config file locations from upstream: /etc/corosync/corosync.conf. + * Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2233 - spec file updates: * Update to svn version 2233 to include library linking fixes diff --git a/sources b/sources index 0feeb79..72282c9 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -1bab8a601e9c546c8307ca673427afbd corosync-0.97.tar.gz -4265b7e1fe87a3bb471c5c637d94e905 corosync-trunk.diff +49a058b7384003132cd82c4676faa75f corosync-0.98.tar.gz From 6c1483a137805265d43b768339e3018e2e1d2c29 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 1 Jul 2009 22:10:28 +0000 Subject: [PATCH 028/185] corosync 1.0.0.rc1 release --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index f5800a4..3e60ce9 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-0.98.tar.gz +corosync-0.100.tar.gz diff --git a/corosync.spec b/corosync.spec index 6a64c10..171de99 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.98 +Version: 0.100 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -202,6 +202,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Thu Jul 2 2009 Fabio M. Di Nitto - 0.100-1 +- New upstream release + * Sat Jun 20 2009 Fabio M. Di Nitto - 0.98-1 - New upstream release - spec file updates: diff --git a/sources b/sources index 72282c9..ce6e4ac 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -49a058b7384003132cd82c4676faa75f corosync-0.98.tar.gz +a46f68e60eea5bd60436af2a7af79d68 corosync-0.100.tar.gz From 1a58ebf167d6daa42e10441608dd1a844146fba4 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 8 Jul 2009 19:03:18 +0000 Subject: [PATCH 029/185] New upstream stable release --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 3e60ce9..f0b4159 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-0.100.tar.gz +corosync-1.0.0.tar.gz diff --git a/corosync.spec b/corosync.spec index 171de99..01cfef0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.100 +Version: 1.0.0 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -202,6 +202,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Wed Jul 8 2009 Fabio M. Di Nitto - 1.0.0-1 +- New upstream release + * Thu Jul 2 2009 Fabio M. Di Nitto - 0.100-1 - New upstream release diff --git a/sources b/sources index ce6e4ac..1fda852 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a46f68e60eea5bd60436af2a7af79d68 corosync-0.100.tar.gz +257f5509f3da951ba84b596fedf42185 corosync-1.0.0.tar.gz From fbf523437ef987c6f92b86f4c30e0c23865baff9 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Fri, 24 Jul 2009 19:30:46 +0000 Subject: [PATCH 030/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 01cfef0..29c9b84 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,7 +3,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.0.0 -Release: 1%{?alphatag:.%{alphatag}}%{?dist} +Release: 2%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org @@ -202,6 +202,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Fri Jul 24 2009 Fedora Release Engineering - 1.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + * Wed Jul 8 2009 Fabio M. Di Nitto - 1.0.0-1 - New upstream release From e106048a7a7d24e02432410952292b8e0884e822 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 28 Jul 2009 07:22:41 +0000 Subject: [PATCH 031/185] Fix directory ownership and consistent use of macros --- corosync.spec | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/corosync.spec b/corosync.spec index 29c9b84..0326cf5 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,7 +3,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.0.0 -Release: 2%{?alphatag:.%{alphatag}}%{?dist} +Release: 3%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org @@ -35,9 +35,9 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %endif %{_configure} CFLAGS="$(echo '%{optflags}')" \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ + --prefix=%{_prefix} \ + --sysconfdir=%{_sysconfdir} \ + --localstatedir=%{_localstatedir} \ --libdir=%{_libdir} %build @@ -84,9 +84,9 @@ fi %{_sbindir}/corosync-cfgtool %{_sbindir}/corosync-fplay %{_sbindir}/corosync-pload -%dir /etc/corosync -%dir /etc/corosync/uidgid.d -%config(noreplace) /etc/corosync/corosync.conf.example +%dir %{_sysconfdir}/corosync +%dir %{_sysconfdir}/corosync/uidgid.d +%config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %{_initddir}/corosync %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso @@ -100,6 +100,7 @@ fi %{_libexecdir}/lcrso/quorum_testquorum.lcrso %{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso +%dir %{_localstatedir}/lib/corosync %{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* @@ -202,6 +203,11 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Tue Jul 28 2009 Fabio M. Di Nitto - 1.0.0-3 +- spec file updates: + * more consistent use of macros across the board + * fix directory ownership + * Fri Jul 24 2009 Fedora Release Engineering - 1.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild From e6f9afc45ddfbfab9730ca9f765d031d70f43af9 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 31 Jul 2009 08:17:19 +0000 Subject: [PATCH 032/185] New upstream stable release fixes several major bugs --- corosync.spec | 311 +++++++++++++++++++++++++++++++++++++++----------- sources | 2 +- 2 files changed, 243 insertions(+), 70 deletions(-) diff --git a/corosync.spec b/corosync.spec index d15f780..faa3670 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,64 +1,70 @@ +# define alphatag svn1211 + Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 0.92 -Release: 3%{?alphatag:.%{alphatag}}%{?dist} +Version: 1.0.0 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Runtime bits +Requires: corosynclib = %{version}-%{release} Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Conflicts: openais <= 0.89, openais-devel <= 0.89 -%define ais_user_uid 39 +%define buildtrunk 0 +%{?alphatag: %define buildtrunk 1} +%{?_with_buildtrunk: %define buildtrunk 1} + +%if %{buildtrunk} +BuildRequires: autoconf automake +%endif +BuildRequires: nss-devel + +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) + +%prep +%setup -q -n corosync-%{version} + +%if %{buildtrunk} +./autogen.sh +%endif + +%{_configure} CFLAGS="$(echo '%{optflags}')" \ + --prefix=%{_prefix} \ + --sysconfdir=%{_sysconfdir} \ + --localstatedir=%{_localstatedir} \ + --libdir=%{_libdir} + +%build +make %{_smp_mflags} + +%install +rm -rf %{buildroot} + +make install DESTDIR=%{buildroot} +install -d %{buildroot}%{_initddir} +install -m 755 init/redhat %{buildroot}%{_initddir}/corosync + +## tree fixup +# drop static libs +rm -f %{buildroot}%{_libdir}/*.a +# drop docs and html docs for now +rm -rf %{buildroot}%{_docdir}/* + +%clean +rm -rf %{buildroot} %description This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. -%package devel -Summary: The Corosync Cluster Engine -Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -This package contains include files and man pages used to develop using -The Corosync Cluster Engine APIs. - -%prep -%setup -q -n corosync-%{version} - -%build - -# -O3 required for performance reasons -# So we get proper debug output, for now we don't compile with O3 -#CFLAGS="$(echo '%{optflags}' | sed -e 's/-O[0-9]*//') -O3" -CFLAGS="$(echo '%{optflags}')" -make CFLAGS="$CFLAGS" - -%install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT STATICLIBS=NO -mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} -mkdir -p $RPM_BUILD_ROOT%{_initddir} -install -m 644 LICENSE SECURITY README.devmap \ - $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/ -install -m 755 init/redhat $RPM_BUILD_ROOT%{_initddir}/corosync - -%clean -rm -rf $RPM_BUILD_ROOT - -%pre -# Add the "ais" user -/usr/sbin/useradd -c 'The Corosync Cluster Engine' \ - -u %{ais_user_uid} -s /sbin/nologin -r -d '/' ais 2> /dev/null || : - %post /sbin/chkconfig --add corosync || : -/sbin/ldconfig > /dev/null %preun if [ $1 -eq 0 ]; then @@ -68,19 +74,19 @@ fi %postun [ "$1" -ge "1" ] && /sbin/service corosync condrestart &>/dev/null || : -/sbin/ldconfig > /dev/null %files %defattr(-,root,root,-) -%dir %{_docdir}/%{name}-%{version} -%doc %{_docdir}/%{name}-%{version}/LICENSE -%doc %{_docdir}/%{name}-%{version}/SECURITY +%doc LICENSE SECURITY %{_sbindir}/corosync %{_sbindir}/corosync-keygen %{_sbindir}/corosync-objctl %{_sbindir}/corosync-cfgtool -%config(noreplace) /etc/corosync.conf -%config(noreplace) /etc/ld.so.conf.d/corosync-*.conf +%{_sbindir}/corosync-fplay +%{_sbindir}/corosync-pload +%dir %{_sysconfdir}/corosync +%dir %{_sysconfdir}/corosync/uidgid.d +%config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %{_initddir}/corosync %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso @@ -89,35 +95,75 @@ fi %{_libexecdir}/lcrso/service_cpg.lcrso %{_libexecdir}/lcrso/service_evs.lcrso %{_libexecdir}/lcrso/service_confdb.lcrso +%{_libexecdir}/lcrso/service_pload.lcrso +%{_libexecdir}/lcrso/quorum_votequorum.lcrso +%{_libexecdir}/lcrso/quorum_testquorum.lcrso +%{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso -%dir %{_libdir}/corosync -%{_libdir}/corosync/libcfg.so.* -%{_libdir}/corosync/libcpg.so.* -%{_libdir}/corosync/libconfdb.so.* -%{_libdir}/corosync/libevs.so.* -%{_libdir}/corosync/libtotem_pg.so.* -%{_libdir}/corosync/liblogsys.so.* -%{_libdir}/corosync/libcoroutil.so.* +%dir %{_localstatedir}/lib/corosync %{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync-objctl.8* %{_mandir}/man5/corosync.conf.5* -%files devel +%package -n corosynclib +Summary: The Corosync Cluster Engine Libraries +Group: System Environment/Libraries +Conflicts: corosync < 0.92-7 + +%description -n corosynclib +This package contains corosync libraries. + +%files -n corosynclib %defattr(-,root,root,-) -%dir %{_docdir}/%{name}-%{version} -%doc %{_docdir}/%{name}-%{version}/README.devmap +%doc LICENSE +%{_libdir}/libcfg.so.* +%{_libdir}/libcpg.so.* +%{_libdir}/libconfdb.so.* +%{_libdir}/libevs.so.* +%{_libdir}/libtotem_pg.so.* +%{_libdir}/liblogsys.so.* +%{_libdir}/libcoroipcc.so.* +%{_libdir}/libcoroipcs.so.* +%{_libdir}/libquorum.so.* +%{_libdir}/libvotequorum.so.* +%{_libdir}/libpload.so.* + +%post -n corosynclib -p /sbin/ldconfig + +%postun -n corosynclib -p /sbin/ldconfig + +%package -n corosynclib-devel +Summary: The Corosync Cluster Engine Development Kit +Group: Development/Libraries +Requires: corosynclib = %{version}-%{release} +Requires: pkgconfig +Provides: corosync-devel = %{version} +Obsoletes: corosync-devel < 0.92-7 + +%description -n corosynclib-devel +This package contains include files and man pages used to develop using +The Corosync Cluster Engine APIs. + +%files -n corosynclib-devel +%defattr(-,root,root,-) +%doc LICENSE README.devmap %dir %{_includedir}/corosync/ -%{_includedir}/corosync/saAis.h -%{_includedir}/corosync/ais_util.h +%{_includedir}/corosync/cs_config.h +%{_includedir}/corosync/corodefs.h +%{_includedir}/corosync/coroipc_types.h +%{_includedir}/corosync/coroipcs.h +%{_includedir}/corosync/coroipcc.h %{_includedir}/corosync/cfg.h %{_includedir}/corosync/confdb.h +%{_includedir}/corosync/corotypes.h %{_includedir}/corosync/cpg.h %{_includedir}/corosync/evs.h %{_includedir}/corosync/hdb.h -%{_includedir}/corosync/ipc_gen.h %{_includedir}/corosync/list.h %{_includedir}/corosync/mar_gen.h %{_includedir}/corosync/swab.h +%{_includedir}/corosync/quorum.h +%{_includedir}/corosync/votequorum.h %dir %{_includedir}/corosync/totem/ %{_includedir}/corosync/totem/coropoll.h %{_includedir}/corosync/totem/totem.h @@ -132,22 +178,149 @@ fi %{_includedir}/corosync/engine/coroapi.h %{_includedir}/corosync/engine/logsys.h %{_includedir}/corosync/engine/objdb.h -%{_libdir}/corosync/libcfg.so -%{_libdir}/corosync/libcpg.so -%{_libdir}/corosync/libconfdb.so -%{_libdir}/corosync/libevs.so -%{_libdir}/corosync/libtotem_pg.so -%{_libdir}/corosync/liblogsys.so -%{_libdir}/corosync/libcoroutil.so +%{_includedir}/corosync/engine/quorum.h +%{_libdir}/libcfg.so +%{_libdir}/libcpg.so +%{_libdir}/libconfdb.so +%{_libdir}/libevs.so +%{_libdir}/libtotem_pg.so +%{_libdir}/liblogsys.so +%{_libdir}/libcoroipcc.so +%{_libdir}/libcoroipcs.so +%{_libdir}/libquorum.so +%{_libdir}/libvotequorum.so +%{_libdir}/libpload.so +%{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* %{_mandir}/man3/confdb_*3* +%{_mandir}/man3/votequorum_*3* %{_mandir}/man8/cpg_overview.8* %{_mandir}/man8/evs_overview.8* %{_mandir}/man8/confdb_overview.8* %{_mandir}/man8/logsys_overview.8* +%{_mandir}/man8/votequorum_overview.8* +%{_mandir}/man8/coroipc_overview.8* %changelog +* Tue Jul 28 2009 Fabio M. Di Nitto - 1.0.0-1 +- New upstream release +- spec file updates: + * more consistent use of macros across the board + * fix directory ownership + +* Thu Jul 2 2009 Fabio M. Di Nitto - 0.100-1 +- New upstream release + +* Sat Jun 20 2009 Fabio M. Di Nitto - 0.98-1 +- New upstream release +- spec file updates: + * Drop corosync-trunk patch and alpha tag. + * Fix alphatag vs buildtrunk handling. + * Drop requirement on ais user/group and stop creating them. + * New config file locations from upstream: /etc/corosync/corosync.conf. + +* Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2233 +- spec file updates: + * Update to svn version 2233 to include library linking fixes + +* Wed Jun 10 2009 Fabio M. Di Nitto - 0.97-1.svn2232 +- New upstream release +- spec file updates: + * Drop pkgconfig fix that's now upstream + * Update to svn version 2232 + * Define buildtrunk if we are using svn snapshots + * BuildRequires: nss-devel to enable nss crypto for network communication + * Force autogen invokation if buildtrunk is defined + * Whitespace cleanup + * Stop shipping corosync.conf in favour of a generic example + * Update file list + +* Mon Mar 30 2009 Fabio M. Di Nitto - 0.95-2 +- Backport svn commit 1913 to fix pkgconfig files generation + and unbreak lvm2 build. + +* Tue Mar 24 2009 Fabio M. Di Nitto - 0.95-1 +- New upstream release +- spec file updates: + * Drop alpha tag + * Drop local patches (no longer required) + * Allow to build from svn trunk by supporting rpmbuild --with buildtrunk + * BuildRequires autoconf automake if building from trunk + * Execute autogen.sh if building from trunk and if no configure is available + * Switch to use rpm configure macro and set standard install paths + * Build invokation now supports _smp_mflags + * Remove install section for docs and use proper doc macro instead + * Add tree fixup bits to drop static libs and html docs (only for now) + * Add LICENSE file to all subpackages + * libraries have moved to libdir. Drop ld.so.conf.d corosync file + * Update BuildRoot usage to preferred versions/names + +* Tue Mar 10 2009 Fabio M. Di Nitto - 0.94-5.svn1797 +- Update the corosync-trunk patch for real this time. + +* Tue Mar 10 2009 Fabio M. Di Nitto - 0.94-4.svn1797 +- Import fixes from upstream: + * Cleanup logsys format init around to use default settings (1795) + * logsys_format_set should use its own internal copy of format_buffer (1796) + * Add logsys_format_get to logsys API (1797) +- Cherry pick svn1807 to unbreak CPG. + +* Mon Mar 9 2009 Fabio M. Di Nitto - 0.94-3.svn1794 +- Import fixes from upstream: + * Add reserve/release feature to totem message queue space (1793) + * Fix CG shutdown (1794) + +* Fri Mar 6 2009 Fabio M. Di Nitto - 0.94-2.svn1792 +- Import fixes from upstream: + * Fix uninitialized memory. Spotted by valgrind (1788) + * Fix logsys_set_format by updating the right bits (1789) + * logsys: re-add support for timestamp (1790) + * Fix cpg crash (1791) + * Allow logsys_format_set to reset to default (1792) + +* Tue Mar 3 2009 Fabio M. Di Nitto - 0.94-1 +- New upstream release. +- Drop obsolete patches. +- Add soname bump patch that was missing from upstream. + +* Wed Feb 25 2009 Fabio M. Di Nitto - 0.93-4 +- Add Makefile fix to install all corosync tools (commit r1780) + +* Tue Feb 24 2009 Fedora Release Engineering - 0.93-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 23 2009 Fabio M. Di Nitto - 0.93-2 +- Rename gcc-4.4 patch to match svn commit (r1767). +- Backport patch from trunk (commit r1774) to fix quorum engine. + +* Thu Feb 19 2009 Fabio M. Di Nitto - 0.93-1 +- New upstream release. +- Drop alphatag from spec file. +- Drop trunk patch. +- Update Provides for corosynclib-devel. +- Backport gcc-4.4 build fix from trunk. + +* Mon Feb 2 2009 Fabio M. Di Nitto - 0.92-7.svn1756 +- Update to svn trunk at revision 1756 from upstream. +- Add support pkgconfig to devel package. +- Tidy up spec files by re-organazing sections according to packages. +- Split libraries from corosync to corosynclib. +- Rename corosync-devel to corosynclib-devel. +- Comply with multiarch requirements (libraries). + +* Tue Jan 27 2009 Fabio M. Di Nitto - 0.92-6.svn1750 +- Update to svn trunk at revision 1750 from upstream. +- Include new quorum service in the packaging. + +* Mon Dec 15 2008 Fabio M. Di Nitto - 0.92-5.svn1709 +- Update to svn trunk at revision 1709 from upstream. +- Update spec file to include new include files. + +* Wed Dec 10 2008 Fabio M. Di Nitto - 0.92-4.svn1707 +- Update to svn trunk at revision 1707 from upstream. +- Update spec file to include new lcrso services and include file. + * Mon Oct 13 2008 Dennis Gilmore - 0.92-3 - remove ExclusiveArch line diff --git a/sources b/sources index b95caa8..1fda852 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e0fec3c380de83711cf3f4609d59e16e corosync-0.92.tar.gz +257f5509f3da951ba84b596fedf42185 corosync-1.0.0.tar.gz From 3e9e2ce9f5da5bb12452821fa7c6dadc9a63ac75 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 22 Sep 2009 13:15:23 +0000 Subject: [PATCH 033/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 15 ++++++++------- sources | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.cvsignore b/.cvsignore index f0b4159..6002f7b 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.0.0.tar.gz +corosync-1.0.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 0326cf5..aca686d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,8 +2,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.0.0 -Release: 3%{?alphatag:.%{alphatag}}%{?dist} +Version: 1.0.1 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org @@ -34,11 +34,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) ./autogen.sh %endif -%{_configure} CFLAGS="$(echo '%{optflags}')" \ - --prefix=%{_prefix} \ - --sysconfdir=%{_sysconfdir} \ - --localstatedir=%{_localstatedir} \ - --libdir=%{_libdir} +%{configure} %build make %{_smp_mflags} @@ -203,6 +199,11 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Tue Sep 22 2009 Fabio M. Di Nitto - 1.0.1-1 +- New upstream release +- spec file updates: + * use proper configure macro + * Tue Jul 28 2009 Fabio M. Di Nitto - 1.0.0-3 - spec file updates: * more consistent use of macros across the board diff --git a/sources b/sources index 1fda852..9848fdb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -257f5509f3da951ba84b596fedf42185 corosync-1.0.0.tar.gz +75fe306a8e23c31a3b0a42798e01e466 corosync-1.0.1.tar.gz From bbe1b81942872deb0555864292cd98fadb5ae9e0 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 25 Sep 2009 09:52:16 +0000 Subject: [PATCH 034/185] New upstream release, enable InfiniBand support --- .cvsignore | 2 +- corosync.spec | 19 +++++++++++++++++-- sources | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.cvsignore b/.cvsignore index 6002f7b..87cccb0 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.0.1.tar.gz +corosync-1.1.0.tar.gz diff --git a/corosync.spec b/corosync.spec index aca686d..1f30c3c 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.0.1 +Version: 1.1.0 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -24,6 +24,7 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 BuildRequires: autoconf automake %endif BuildRequires: nss-devel +BuildRequires: libibverbs-devel librdmacm-devel BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -34,7 +35,13 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) ./autogen.sh %endif -%{configure} +export ibverbs_CFLAGS=-I/usr/include/infiniband \ +export ibverbs_LIBS=-libverbs \ +export rdmacm_CFLAGS=-I/usr/include/rdma \ +export rdmacm_LIBS=-lrdmacm \ +%{configure} \ + --enable-nss \ + --enable-rdma %build make %{_smp_mflags} @@ -80,6 +87,8 @@ fi %{_sbindir}/corosync-cfgtool %{_sbindir}/corosync-fplay %{_sbindir}/corosync-pload +%{_sbindir}/corosync-cpgtool +%{_sbindir}/corosync-quorumtool %dir %{_sysconfdir}/corosync %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example @@ -199,6 +208,12 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Fri Sep 25 2009 Fabio M. Di Nitto - 1.1.0-1 +- New upstream release +- spec file updates: + * enable IB support + * explicitly define built-in features at configure time + * Tue Sep 22 2009 Fabio M. Di Nitto - 1.0.1-1 - New upstream release - spec file updates: diff --git a/sources b/sources index 9848fdb..84a3599 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -75fe306a8e23c31a3b0a42798e01e466 corosync-1.0.1.tar.gz +f1ae40281356446d1af31a75068ec3d0 corosync-1.1.0.tar.gz From ed839b003bcbe88f4217a0ee5b7945296bcbe951 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Tue, 29 Sep 2009 04:40:30 +0000 Subject: [PATCH 035/185] Initialize branch F-12 for corosync --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..06de2d2 --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-12 From d13335a89d9acfd348bb0bcac0c20e33a9810f31 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 21 Oct 2009 05:00:41 +0000 Subject: [PATCH 036/185] New upstream release fixes a few severe bugs --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 87cccb0..3c7f24a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.1.0.tar.gz +corosync-1.1.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 1f30c3c..5770449 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.1.0 +Version: 1.1.1 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -208,6 +208,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Wed Oct 21 2009 Fabio M. Di Nitto - 1.1.1-1 +- New upstream release + * Fri Sep 25 2009 Fabio M. Di Nitto - 1.1.0-1 - New upstream release - spec file updates: diff --git a/sources b/sources index 84a3599..fffa0ae 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f1ae40281356446d1af31a75068ec3d0 corosync-1.1.0.tar.gz +148c0690d4734bae819504534d6decbe corosync-1.1.1.tar.gz From 8189b0b4af2aa6ec6a6b78140a51503898ecd07d Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 21 Oct 2009 05:02:30 +0000 Subject: [PATCH 037/185] New upstream release fixes a few severe bugs --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 87cccb0..3c7f24a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.1.0.tar.gz +corosync-1.1.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 1f30c3c..5770449 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.1.0 +Version: 1.1.1 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -208,6 +208,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Wed Oct 21 2009 Fabio M. Di Nitto - 1.1.1-1 +- New upstream release + * Fri Sep 25 2009 Fabio M. Di Nitto - 1.1.0-1 - New upstream release - spec file updates: diff --git a/sources b/sources index 84a3599..fffa0ae 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f1ae40281356446d1af31a75068ec3d0 corosync-1.1.0.tar.gz +148c0690d4734bae819504534d6decbe corosync-1.1.1.tar.gz From 9ce68cc438b6f409619c4ff1d3e925f6bc6f8b9b Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 21 Oct 2009 05:25:59 +0000 Subject: [PATCH 038/185] New upstream release fixes few severe bugs --- .cvsignore | 2 +- corosync.spec | 38 +++++++++++++++++++++++++++++++------- sources | 2 +- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/.cvsignore b/.cvsignore index 6877867..3c7f24a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-0.92.tar.gz +corosync-1.1.1.tar.gz diff --git a/corosync.spec b/corosync.spec index faa3670..5770449 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.0.0 +Version: 1.1.1 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -24,6 +24,7 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 BuildRequires: autoconf automake %endif BuildRequires: nss-devel +BuildRequires: libibverbs-devel librdmacm-devel BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -34,11 +35,13 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) ./autogen.sh %endif -%{_configure} CFLAGS="$(echo '%{optflags}')" \ - --prefix=%{_prefix} \ - --sysconfdir=%{_sysconfdir} \ - --localstatedir=%{_localstatedir} \ - --libdir=%{_libdir} +export ibverbs_CFLAGS=-I/usr/include/infiniband \ +export ibverbs_LIBS=-libverbs \ +export rdmacm_CFLAGS=-I/usr/include/rdma \ +export rdmacm_LIBS=-lrdmacm \ +%{configure} \ + --enable-nss \ + --enable-rdma %build make %{_smp_mflags} @@ -84,6 +87,8 @@ fi %{_sbindir}/corosync-cfgtool %{_sbindir}/corosync-fplay %{_sbindir}/corosync-pload +%{_sbindir}/corosync-cpgtool +%{_sbindir}/corosync-quorumtool %dir %{_sysconfdir}/corosync %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example @@ -203,12 +208,31 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog -* Tue Jul 28 2009 Fabio M. Di Nitto - 1.0.0-1 +* Wed Oct 21 2009 Fabio M. Di Nitto - 1.1.1-1 - New upstream release + +* Fri Sep 25 2009 Fabio M. Di Nitto - 1.1.0-1 +- New upstream release +- spec file updates: + * enable IB support + * explicitly define built-in features at configure time + +* Tue Sep 22 2009 Fabio M. Di Nitto - 1.0.1-1 +- New upstream release +- spec file updates: + * use proper configure macro + +* Tue Jul 28 2009 Fabio M. Di Nitto - 1.0.0-3 - spec file updates: * more consistent use of macros across the board * fix directory ownership +* Fri Jul 24 2009 Fedora Release Engineering - 1.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Jul 8 2009 Fabio M. Di Nitto - 1.0.0-1 +- New upstream release + * Thu Jul 2 2009 Fabio M. Di Nitto - 0.100-1 - New upstream release diff --git a/sources b/sources index 1fda852..fffa0ae 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -257f5509f3da951ba84b596fedf42185 corosync-1.0.0.tar.gz +148c0690d4734bae819504534d6decbe corosync-1.1.1.tar.gz From 66f0af15d60cfb8ea78efa926aa5ca05829732b9 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 23 Oct 2009 06:13:15 +0000 Subject: [PATCH 039/185] New upstream release fixes major regression on specific loads --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 3c7f24a..77e627c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.1.1.tar.gz +corosync-1.1.2.tar.gz diff --git a/corosync.spec b/corosync.spec index 5770449..d9394d0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.1.1 +Version: 1.1.2 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -208,6 +208,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Fri Oct 23 2009 Fabio M. Di Nitto - 1.1.2-1 +- New upstream release fixes major regression on specific loads + * Wed Oct 21 2009 Fabio M. Di Nitto - 1.1.1-1 - New upstream release diff --git a/sources b/sources index fffa0ae..48ee40f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -148c0690d4734bae819504534d6decbe corosync-1.1.1.tar.gz +03ea8d775b2855fd3c0a1ed5e7705a86 corosync-1.1.2.tar.gz From 2fbd98e9f6d78e3a92ffb0dfdd47822067f4f779 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 23 Oct 2009 07:28:29 +0000 Subject: [PATCH 040/185] New upstream release fixes serious regression on specific loads --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 3c7f24a..77e627c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.1.1.tar.gz +corosync-1.1.2.tar.gz diff --git a/corosync.spec b/corosync.spec index 5770449..d9394d0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.1.1 +Version: 1.1.2 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -208,6 +208,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Fri Oct 23 2009 Fabio M. Di Nitto - 1.1.2-1 +- New upstream release fixes major regression on specific loads + * Wed Oct 21 2009 Fabio M. Di Nitto - 1.1.1-1 - New upstream release diff --git a/sources b/sources index fffa0ae..48ee40f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -148c0690d4734bae819504534d6decbe corosync-1.1.1.tar.gz +03ea8d775b2855fd3c0a1ed5e7705a86 corosync-1.1.2.tar.gz From 6046f3e3c025768f9122b35c9c6b22ded233aa06 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 23 Oct 2009 07:30:36 +0000 Subject: [PATCH 041/185] New upstream release fixes major regression on specific loads --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 3c7f24a..77e627c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.1.1.tar.gz +corosync-1.1.2.tar.gz diff --git a/corosync.spec b/corosync.spec index 5770449..d9394d0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.1.1 +Version: 1.1.2 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -208,6 +208,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/coroipc_overview.8* %changelog +* Fri Oct 23 2009 Fabio M. Di Nitto - 1.1.2-1 +- New upstream release fixes major regression on specific loads + * Wed Oct 21 2009 Fabio M. Di Nitto - 1.1.1-1 - New upstream release diff --git a/sources b/sources index fffa0ae..48ee40f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -148c0690d4734bae819504534d6decbe corosync-1.1.1.tar.gz +03ea8d775b2855fd3c0a1ed5e7705a86 corosync-1.1.2.tar.gz From 47d3968e02352a955af9f4016395035980047157 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 25 Nov 2009 22:47:36 +0000 Subject: [PATCH 042/185] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9d9b66..030097c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ NAME := corosync SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From 63ece51c7bbc0f34370ea476eded267f32a13902 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:33:14 +0000 Subject: [PATCH 043/185] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9d9b66..030097c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ NAME := corosync SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From aba5ec8b30d2c10c03c75782393e39f0bccf8784 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:33:14 +0000 Subject: [PATCH 044/185] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9d9b66..030097c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ NAME := corosync SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From bea615755a02163f1873ced34f50fa9b4b4c56e4 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 8 Dec 2009 01:38:52 +0000 Subject: [PATCH 045/185] New upstream release --- corosync.spec | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/corosync.spec b/corosync.spec index d9394d0..005d1b6 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,13 +1,13 @@ -# define alphatag svn1211 +# global alphatag svn1211 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.1.2 +Version: 1.2.0 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org -Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz +Source0: http://developer.osdl.org/dev/openais/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -16,8 +16,9 @@ Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Conflicts: openais <= 0.89, openais-devel <= 0.89 +# Build bits + %define buildtrunk 0 -%{?alphatag: %define buildtrunk 1} %{?_with_buildtrunk: %define buildtrunk 1} %if %{buildtrunk} @@ -29,7 +30,7 @@ BuildRequires: libibverbs-devel librdmacm-devel BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep -%setup -q -n corosync-%{version} +%setup -q -n %{name}-%{version} %if %{buildtrunk} ./autogen.sh @@ -41,7 +42,8 @@ export rdmacm_CFLAGS=-I/usr/include/rdma \ export rdmacm_LIBS=-lrdmacm \ %{configure} \ --enable-nss \ - --enable-rdma + --enable-rdma \ + --with-initddir=%{_initddir} %build make %{_smp_mflags} @@ -50,8 +52,6 @@ make %{_smp_mflags} rm -rf %{buildroot} make install DESTDIR=%{buildroot} -install -d %{buildroot}%{_initddir} -install -m 755 init/redhat %{buildroot}%{_initddir}/corosync ## tree fixup # drop static libs @@ -62,7 +62,7 @@ rm -rf %{buildroot}%{_docdir}/* %clean rm -rf %{buildroot} -%description +%description This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. @@ -75,10 +75,7 @@ if [ $1 -eq 0 ]; then /sbin/chkconfig --del corosync || : fi -%postun -[ "$1" -ge "1" ] && /sbin/service corosync condrestart &>/dev/null || : - -%files +%files %defattr(-,root,root,-) %doc LICENSE SECURITY %{_sbindir}/corosync @@ -90,6 +87,7 @@ fi %{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-quorumtool %dir %{_sysconfdir}/corosync +%dir %{_sysconfdir}/corosync/service.d %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %{_initddir}/corosync @@ -113,7 +111,7 @@ fi %package -n corosynclib Summary: The Corosync Cluster Engine Libraries Group: System Environment/Libraries -Conflicts: corosync < 0.92-7 +Requires: %{name} = %{version}-%{release} %description -n corosynclib This package contains corosync libraries. @@ -132,6 +130,7 @@ This package contains corosync libraries. %{_libdir}/libquorum.so.* %{_libdir}/libvotequorum.so.* %{_libdir}/libpload.so.* +%{_libdir}/libsam.so.* %post -n corosynclib -p /sbin/ldconfig @@ -166,6 +165,7 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/hdb.h %{_includedir}/corosync/list.h %{_includedir}/corosync/mar_gen.h +%{_includedir}/corosync/sam.h %{_includedir}/corosync/swab.h %{_includedir}/corosync/quorum.h %{_includedir}/corosync/votequorum.h @@ -195,19 +195,34 @@ The Corosync Cluster Engine APIs. %{_libdir}/libquorum.so %{_libdir}/libvotequorum.so %{_libdir}/libpload.so +%{_libdir}/libsam.so %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* %{_mandir}/man3/confdb_*3* %{_mandir}/man3/votequorum_*3* +%{_mandir}/man3/sam_*3* %{_mandir}/man8/cpg_overview.8* %{_mandir}/man8/evs_overview.8* %{_mandir}/man8/confdb_overview.8* %{_mandir}/man8/logsys_overview.8* %{_mandir}/man8/votequorum_overview.8* %{_mandir}/man8/coroipc_overview.8* +%{_mandir}/man8/sam_overview.8* %changelog +* Tue Dec 8 2009 Fabio M. Di Nitto - 1.2.0-1 +- New upstream release +- Use global instead of define +- Update Source0 url +- Use more %name macro around +- Cleanup install section. Init script is now installed by upstream +- Cleanup whitespace +- Don't deadlock between package upgrade and corosync condrestart +- Ship service.d config directory +- Fix Conflicts vs Requires +- Ship new sam library and man pages + * Fri Oct 23 2009 Fabio M. Di Nitto - 1.1.2-1 - New upstream release fixes major regression on specific loads From 454cec9b6c9a21d46f4ca5b5d783249209a1906f Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 8 Dec 2009 01:40:25 +0000 Subject: [PATCH 046/185] Really use the new tarball --- .cvsignore | 2 +- sources | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cvsignore b/.cvsignore index 77e627c..215bc9c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.1.2.tar.gz +corosync-1.2.0.tar.gz diff --git a/sources b/sources index 48ee40f..ead7229 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -03ea8d775b2855fd3c0a1ed5e7705a86 corosync-1.1.2.tar.gz +789bea831a97977e56900477c3022cc1 corosync-1.2.0.tar.gz From d5420dd95752e8ccfc6eb81e2d82d145692fea2f Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 8 Dec 2009 01:46:33 +0000 Subject: [PATCH 047/185] New upstream release, fixes a few gazzillion bugs --- .cvsignore | 2 +- corosync.spec | 43 +++++++++++++++++++++++++++++-------------- sources | 2 +- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.cvsignore b/.cvsignore index 77e627c..215bc9c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.1.2.tar.gz +corosync-1.2.0.tar.gz diff --git a/corosync.spec b/corosync.spec index d9394d0..005d1b6 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,13 +1,13 @@ -# define alphatag svn1211 +# global alphatag svn1211 Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.1.2 +Version: 1.2.0 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://www.openais.org -Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz +Source0: http://developer.osdl.org/dev/openais/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -16,8 +16,9 @@ Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Conflicts: openais <= 0.89, openais-devel <= 0.89 +# Build bits + %define buildtrunk 0 -%{?alphatag: %define buildtrunk 1} %{?_with_buildtrunk: %define buildtrunk 1} %if %{buildtrunk} @@ -29,7 +30,7 @@ BuildRequires: libibverbs-devel librdmacm-devel BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep -%setup -q -n corosync-%{version} +%setup -q -n %{name}-%{version} %if %{buildtrunk} ./autogen.sh @@ -41,7 +42,8 @@ export rdmacm_CFLAGS=-I/usr/include/rdma \ export rdmacm_LIBS=-lrdmacm \ %{configure} \ --enable-nss \ - --enable-rdma + --enable-rdma \ + --with-initddir=%{_initddir} %build make %{_smp_mflags} @@ -50,8 +52,6 @@ make %{_smp_mflags} rm -rf %{buildroot} make install DESTDIR=%{buildroot} -install -d %{buildroot}%{_initddir} -install -m 755 init/redhat %{buildroot}%{_initddir}/corosync ## tree fixup # drop static libs @@ -62,7 +62,7 @@ rm -rf %{buildroot}%{_docdir}/* %clean rm -rf %{buildroot} -%description +%description This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. @@ -75,10 +75,7 @@ if [ $1 -eq 0 ]; then /sbin/chkconfig --del corosync || : fi -%postun -[ "$1" -ge "1" ] && /sbin/service corosync condrestart &>/dev/null || : - -%files +%files %defattr(-,root,root,-) %doc LICENSE SECURITY %{_sbindir}/corosync @@ -90,6 +87,7 @@ fi %{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-quorumtool %dir %{_sysconfdir}/corosync +%dir %{_sysconfdir}/corosync/service.d %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %{_initddir}/corosync @@ -113,7 +111,7 @@ fi %package -n corosynclib Summary: The Corosync Cluster Engine Libraries Group: System Environment/Libraries -Conflicts: corosync < 0.92-7 +Requires: %{name} = %{version}-%{release} %description -n corosynclib This package contains corosync libraries. @@ -132,6 +130,7 @@ This package contains corosync libraries. %{_libdir}/libquorum.so.* %{_libdir}/libvotequorum.so.* %{_libdir}/libpload.so.* +%{_libdir}/libsam.so.* %post -n corosynclib -p /sbin/ldconfig @@ -166,6 +165,7 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/hdb.h %{_includedir}/corosync/list.h %{_includedir}/corosync/mar_gen.h +%{_includedir}/corosync/sam.h %{_includedir}/corosync/swab.h %{_includedir}/corosync/quorum.h %{_includedir}/corosync/votequorum.h @@ -195,19 +195,34 @@ The Corosync Cluster Engine APIs. %{_libdir}/libquorum.so %{_libdir}/libvotequorum.so %{_libdir}/libpload.so +%{_libdir}/libsam.so %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* %{_mandir}/man3/confdb_*3* %{_mandir}/man3/votequorum_*3* +%{_mandir}/man3/sam_*3* %{_mandir}/man8/cpg_overview.8* %{_mandir}/man8/evs_overview.8* %{_mandir}/man8/confdb_overview.8* %{_mandir}/man8/logsys_overview.8* %{_mandir}/man8/votequorum_overview.8* %{_mandir}/man8/coroipc_overview.8* +%{_mandir}/man8/sam_overview.8* %changelog +* Tue Dec 8 2009 Fabio M. Di Nitto - 1.2.0-1 +- New upstream release +- Use global instead of define +- Update Source0 url +- Use more %name macro around +- Cleanup install section. Init script is now installed by upstream +- Cleanup whitespace +- Don't deadlock between package upgrade and corosync condrestart +- Ship service.d config directory +- Fix Conflicts vs Requires +- Ship new sam library and man pages + * Fri Oct 23 2009 Fabio M. Di Nitto - 1.1.2-1 - New upstream release fixes major regression on specific loads diff --git a/sources b/sources index 48ee40f..ead7229 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -03ea8d775b2855fd3c0a1ed5e7705a86 corosync-1.1.2.tar.gz +789bea831a97977e56900477c3022cc1 corosync-1.2.0.tar.gz From 0b09a0ee482e6d288ce15bfe03e88915755d8f33 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 17 Feb 2010 01:06:10 +0000 Subject: [PATCH 048/185] Initialize branch F-13 for corosync --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..baa94ef --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-13 From b135376e6438525079cca90a0f18fe60a5efd965 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 24 Mar 2010 19:54:45 +0000 Subject: [PATCH 049/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 215bc9c..6e836fb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.0.tar.gz +corosync-1.2.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 005d1b6..6d35e18 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.0 +Version: 1.2.1 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -211,6 +211,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Wed Mar 24 2010 Fabio M. Di Nitto - 1.2.1-1 +- New upstream release + * Tue Dec 8 2009 Fabio M. Di Nitto - 1.2.0-1 - New upstream release - Use global instead of define diff --git a/sources b/sources index ead7229..9f490cb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -789bea831a97977e56900477c3022cc1 corosync-1.2.0.tar.gz +cba5eb5da41630f53e54b90c449c056d corosync-1.2.1.tar.gz From 9810953e312e09ad45f7114981460b658050d679 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 12 Apr 2010 03:29:01 +0000 Subject: [PATCH 050/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 215bc9c..6e836fb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.0.tar.gz +corosync-1.2.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 005d1b6..6d35e18 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.0 +Version: 1.2.1 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -211,6 +211,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Wed Mar 24 2010 Fabio M. Di Nitto - 1.2.1-1 +- New upstream release + * Tue Dec 8 2009 Fabio M. Di Nitto - 1.2.0-1 - New upstream release - Use global instead of define diff --git a/sources b/sources index ead7229..9f490cb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -789bea831a97977e56900477c3022cc1 corosync-1.2.0.tar.gz +cba5eb5da41630f53e54b90c449c056d corosync-1.2.1.tar.gz From e8f42a997c4c1cb10e2e1a4b520c446f648dc6a4 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 12 Apr 2010 03:35:52 +0000 Subject: [PATCH 051/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.cvsignore b/.cvsignore index 215bc9c..6e836fb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.0.tar.gz +corosync-1.2.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 005d1b6..6d35e18 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.0 +Version: 1.2.1 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -211,6 +211,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Wed Mar 24 2010 Fabio M. Di Nitto - 1.2.1-1 +- New upstream release + * Tue Dec 8 2009 Fabio M. Di Nitto - 1.2.0-1 - New upstream release - Use global instead of define diff --git a/sources b/sources index ead7229..9f490cb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -789bea831a97977e56900477c3022cc1 corosync-1.2.0.tar.gz +cba5eb5da41630f53e54b90c449c056d corosync-1.2.1.tar.gz From 40734bc6f57fff7a3567dbf291260866b3bd8ea7 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 17 May 2010 07:42:06 +0000 Subject: [PATCH 052/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 19 +- revision-2770.patch | 855 ++++++++++++++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 872 insertions(+), 6 deletions(-) create mode 100644 revision-2770.patch diff --git a/.cvsignore b/.cvsignore index 6e836fb..9b08e28 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.1.tar.gz +corosync-1.2.2.tar.gz diff --git a/corosync.spec b/corosync.spec index 6d35e18..33f334b 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,12 +2,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.1 +Version: 1.2.2 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base -URL: http://www.openais.org -Source0: http://developer.osdl.org/dev/openais/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz +URL: http://ftp.corosync.org +Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz +Patch0: revision-2770.patch # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -24,6 +25,7 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 %if %{buildtrunk} BuildRequires: autoconf automake %endif + BuildRequires: nss-devel BuildRequires: libibverbs-devel librdmacm-devel @@ -31,6 +33,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version} +%patch0 %if %{buildtrunk} ./autogen.sh @@ -46,7 +49,9 @@ export rdmacm_LIBS=-lrdmacm \ --with-initddir=%{_initddir} %build -make %{_smp_mflags} +make +# 1.2.2 introduced problem where make -j fails. +#make %{_smp_mflags} %install rm -rf %{buildroot} @@ -211,6 +216,12 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Mon May 17 2010 Fabio M. Di Nitto - 1.2.2-1 +- New upstream release +- Add upstream trunk revision 2770 to add cpg_model_initialize api. +- Fix URL and Source0 entries. +- Add workaround to broken 1.2.2 Makefile with make -j. + * Wed Mar 24 2010 Fabio M. Di Nitto - 1.2.1-1 - New upstream release diff --git a/revision-2770.patch b/revision-2770.patch new file mode 100644 index 0000000..08743a7 --- /dev/null +++ b/revision-2770.patch @@ -0,0 +1,855 @@ +Index: test/testcpg.c +=================================================================== +--- test/testcpg.c (revision 2769) ++++ test/testcpg.c (revision 2770) +@@ -132,9 +132,29 @@ + } + } + +-static cpg_callbacks_t callbacks = { ++static void TotemConfchgCallback ( ++ cpg_handle_t handle, ++ struct cpg_ring_id ring_id, ++ uint32_t member_list_entries, ++ const uint32_t *member_list) ++{ ++ int i; ++ ++ printf("\nTotemConfchgCallback: ringid (%u.%llu)\n", ring_id.nodeid, ring_id.seq); ++ ++ printf("active processors %lu: ", ++ (unsigned long int) member_list_entries); ++ for (i=0; igroup, &src->group); + }; + ++typedef struct { ++ mar_uint32_t nodeid __attribute__((aligned(8))); ++ mar_uint64_t seq __attribute__((aligned(8))); ++} mar_cpg_ring_id_t; ++ ++static inline void marshall_from_mar_cpg_ring_id_t ( ++ struct cpg_ring_id *dest, ++ const mar_cpg_ring_id_t *src) ++{ ++ dest->nodeid = src->nodeid; ++ dest->seq = src->seq; ++} ++ + struct req_lib_cpg_join { + coroipc_request_header_t header __attribute__((aligned(8))); + mar_cpg_name_t group_name __attribute__((aligned(8))); + mar_uint32_t pid __attribute__((aligned(8))); ++ mar_uint32_t flags __attribute__((aligned(8))); + }; + + struct res_lib_cpg_join { +@@ -238,6 +253,13 @@ + // struct cpg_address joined_list[]; + }; + ++struct res_lib_cpg_totem_confchg_callback { ++ coroipc_response_header_t header __attribute__((aligned(8))); ++ mar_cpg_ring_id_t ring_id __attribute__((aligned(8))); ++ mar_uint32_t member_list_entries __attribute__((aligned(8))); ++ mar_uint32_t member_list[]; ++}; ++ + struct req_lib_cpg_leave { + coroipc_request_header_t header __attribute__((aligned(8))); + mar_cpg_name_t group_name __attribute__((aligned(8))); +Index: include/corosync/cpg.h +=================================================================== +--- include/corosync/cpg.h (revision 2769) ++++ include/corosync/cpg.h (revision 2770) +@@ -78,6 +78,10 @@ + CPG_ITERATION_ALL = 3, + } cpg_iteration_type_t; + ++typedef enum { ++ CPG_MODEL_V1 = 1, ++} cpg_model_t; ++ + struct cpg_address { + uint32_t nodeid; + uint32_t pid; +@@ -98,6 +102,11 @@ + uint32_t pid; + }; + ++struct cpg_ring_id { ++ uint32_t nodeid; ++ uint64_t seq; ++}; ++ + typedef void (*cpg_deliver_fn_t) ( + cpg_handle_t handle, + const struct cpg_name *group_name, +@@ -117,11 +126,32 @@ + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries); + ++typedef void (*cpg_totem_confchg_fn_t) ( ++ cpg_handle_t handle, ++ struct cpg_ring_id ring_id, ++ uint32_t member_list_entries, ++ const uint32_t *member_list); ++ + typedef struct { + cpg_deliver_fn_t cpg_deliver_fn; + cpg_confchg_fn_t cpg_confchg_fn; + } cpg_callbacks_t; + ++typedef struct { ++ cpg_model_t model; ++} cpg_model_data_t; ++ ++#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF 0x01 ++ ++typedef struct { ++ cpg_model_t model; ++ cpg_deliver_fn_t cpg_deliver_fn; ++ cpg_confchg_fn_t cpg_confchg_fn; ++ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; ++ unsigned int flags; ++} cpg_model_v1_data_t; ++ ++ + /** @} */ + + /* +@@ -132,6 +162,15 @@ + cpg_callbacks_t *callbacks); + + /* ++ * Create a new cpg connection, initialize with model ++ */ ++cs_error_t cpg_model_initialize ( ++ cpg_handle_t *handle, ++ cpg_model_t model, ++ cpg_model_data_t *model_data, ++ void *context); ++ ++/* + * Close the cpg handle + */ + cs_error_t cpg_finalize ( +Index: services/cpg.c +=================================================================== +--- services/cpg.c (revision 2769) ++++ services/cpg.c (revision 2770) +@@ -133,6 +133,8 @@ + mar_cpg_name_t group_name; + uint32_t pid; + enum cpd_state cpd_state; ++ unsigned int flags; ++ int initial_totem_conf_sent; + struct list_head list; + struct list_head iteration_instance_list_head; + }; +@@ -160,6 +162,8 @@ + + static enum cpg_sync_state my_sync_state = CPGSYNC_DOWNLIST; + ++static mar_cpg_ring_id_t last_sync_ring_id; ++ + struct process_info { + unsigned int nodeid; + uint32_t pid; +@@ -255,6 +259,11 @@ + + static void cpg_sync_abort (void); + ++static int notify_lib_totem_membership ( ++ void *conn, ++ int member_list_entries, ++ const unsigned int *member_list); ++ + /* + * Library Handler Definition + */ +@@ -432,6 +441,9 @@ + sizeof (unsigned int)); + my_member_list_entries = member_list_entries; + ++ last_sync_ring_id.nodeid = ring_id->rep.nodeid; ++ last_sync_ring_id.seq = ring_id->seq; ++ + for (i = 0; i < my_member_list_entries; i++) { + if (my_member_list[i] < lowest_nodeid) { + lowest_nodeid = my_member_list[i]; +@@ -482,14 +494,51 @@ + memcpy (my_old_member_list, my_member_list, + my_member_list_entries * sizeof (unsigned int)); + my_old_member_list_entries = my_member_list_entries; ++ ++ notify_lib_totem_membership (NULL, my_member_list_entries, my_member_list); + } + + static void cpg_sync_abort (void) + { + } + ++static int notify_lib_totem_membership ( ++ void *conn, ++ int member_list_entries, ++ const unsigned int *member_list) ++{ ++ struct list_head *iter; ++ char *buf; ++ int size; ++ struct res_lib_cpg_totem_confchg_callback *res; + ++ size = sizeof(struct res_lib_cpg_totem_confchg_callback) + ++ sizeof(mar_uint32_t) * (member_list_entries); ++ buf = alloca(size); ++ if (!buf) ++ return CPG_ERR_LIBRARY; + ++ res = (struct res_lib_cpg_totem_confchg_callback *)buf; ++ res->member_list_entries = member_list_entries; ++ res->header.size = size; ++ res->header.id = MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK; ++ res->header.error = CS_OK; ++ ++ memcpy (&res->ring_id, &last_sync_ring_id, sizeof (mar_cpg_ring_id_t)); ++ memcpy (res->member_list, member_list, res->member_list_entries * sizeof (mar_uint32_t)); ++ ++ if (conn == NULL) { ++ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { ++ struct cpg_pd *cpg_pd = list_entry (iter, struct cpg_pd, list); ++ api->ipc_dispatch_send (cpg_pd->conn, buf, size); ++ } ++ } else { ++ api->ipc_dispatch_send (conn, buf, size); ++ } ++ ++ return CPG_OK; ++} ++ + static int notify_lib_joinlist( + const mar_cpg_name_t *group_name, + void *conn, +@@ -604,6 +653,20 @@ + } + } + ++ ++ /* ++ * Traverse thru cpds and send totem membership for cpd, where it is not send yet ++ */ ++ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { ++ struct cpg_pd *cpd = list_entry (iter, struct cpg_pd, list); ++ ++ if ((cpd->flags & CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF) && (cpd->initial_totem_conf_sent == 0)) { ++ cpd->initial_totem_conf_sent = 1; ++ ++ notify_lib_totem_membership (cpd->conn, my_old_member_list_entries, my_old_member_list); ++ } ++ } ++ + return CPG_OK; + } + +@@ -1093,6 +1156,7 @@ + error = CPG_OK; + cpd->cpd_state = CPD_STATE_JOIN_STARTED; + cpd->pid = req_lib_cpg_join->pid; ++ cpd->flags = req_lib_cpg_join->flags; + memcpy (&cpd->group_name, &req_lib_cpg_join->group_name, + sizeof (cpd->group_name)); + +Index: lib/cpg.c +=================================================================== +--- lib/cpg.c (revision 2769) ++++ lib/cpg.c (revision 2770) +@@ -62,8 +62,11 @@ + struct cpg_inst { + hdb_handle_t handle; + int finalize; +- cpg_callbacks_t callbacks; + void *context; ++ union { ++ cpg_model_data_t model_data; ++ cpg_model_v1_data_t model_v1_data; ++ }; + struct list_head iteration_list_head; + }; + +@@ -118,9 +121,32 @@ + cpg_handle_t *handle, + cpg_callbacks_t *callbacks) + { ++ cpg_model_v1_data_t model_v1_data; ++ ++ memset (&model_v1_data, 0, sizeof (cpg_model_v1_data_t)); ++ ++ if (callbacks) { ++ model_v1_data.cpg_deliver_fn = callbacks->cpg_deliver_fn; ++ model_v1_data.cpg_confchg_fn = callbacks->cpg_confchg_fn; ++ } ++ ++ return (cpg_model_initialize (handle, CPG_MODEL_V1, (cpg_model_data_t *)&model_v1_data, NULL)); ++} ++ ++cs_error_t cpg_model_initialize ( ++ cpg_handle_t *handle, ++ cpg_model_t model, ++ cpg_model_data_t *model_data, ++ void *context) ++{ + cs_error_t error; + struct cpg_inst *cpg_inst; + ++ if (model != CPG_MODEL_V1) { ++ error = CPG_ERR_INVALID_PARAM; ++ goto error_no_destroy; ++ } ++ + error = hdb_error_to_cs (hdb_handle_create (&cpg_handle_t_db, sizeof (struct cpg_inst), handle)); + if (error != CS_OK) { + goto error_no_destroy; +@@ -142,10 +168,26 @@ + goto error_put_destroy; + } + +- if (callbacks) { +- memcpy (&cpg_inst->callbacks, callbacks, sizeof (cpg_callbacks_t)); ++ if (model_data != NULL) { ++ switch (model) { ++ case CPG_MODEL_V1: ++ memcpy (&cpg_inst->model_v1_data, model_data, sizeof (cpg_model_v1_data_t)); ++ if ((cpg_inst->model_v1_data.flags & ~(CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF)) != 0) { ++ error = CS_ERR_INVALID_PARAM; ++ ++ goto error_destroy; ++ } ++ break; ++ default: ++ error = CS_ERR_LIBRARY; ++ goto error_destroy; ++ break; ++ } + } + ++ cpg_inst->model_data.model = model; ++ cpg_inst->context = context; ++ + list_init(&cpg_inst->iteration_list_head); + + hdb_handle_put (&cpg_handle_t_db, *handle); +@@ -283,7 +325,8 @@ + struct cpg_inst *cpg_inst; + struct res_lib_cpg_confchg_callback *res_cpg_confchg_callback; + struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback; +- cpg_callbacks_t callbacks; ++ struct res_lib_cpg_totem_confchg_callback *res_cpg_totem_confchg_callback; ++ struct cpg_inst cpg_inst_copy; + coroipc_response_header_t *dispatch_data; + struct cpg_address member_list[CPG_MEMBERS_MAX]; + struct cpg_address left_list[CPG_MEMBERS_MAX]; +@@ -292,6 +335,8 @@ + mar_cpg_address_t *left_list_start; + mar_cpg_address_t *joined_list_start; + unsigned int i; ++ struct cpg_ring_id ring_id; ++ uint32_t totem_member_list[CPG_MEMBERS_MAX]; + + error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst)); + if (error != CS_OK) { +@@ -332,74 +377,96 @@ + * A risk of this dispatch method is that the callback routines may + * operate at the same time that cpgFinalize has been called. + */ +- memcpy (&callbacks, &cpg_inst->callbacks, sizeof (cpg_callbacks_t)); +- /* +- * Dispatch incoming message +- */ +- switch (dispatch_data->id) { +- case MESSAGE_RES_CPG_DELIVER_CALLBACK: +- if (callbacks.cpg_deliver_fn == NULL) { ++ memcpy (&cpg_inst_copy, cpg_inst, sizeof (struct cpg_inst)); ++ ++ switch (cpg_inst_copy.model_data.model) { ++ case CPG_MODEL_V1: ++ /* ++ * Dispatch incoming message ++ */ ++ switch (dispatch_data->id) { ++ case MESSAGE_RES_CPG_DELIVER_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_deliver_fn == NULL) { ++ break; ++ } ++ ++ res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; ++ ++ marshall_from_mar_cpg_name_t ( ++ &group_name, ++ &res_cpg_deliver_callback->group_name); ++ ++ cpg_inst_copy.model_v1_data.cpg_deliver_fn (handle, ++ &group_name, ++ res_cpg_deliver_callback->nodeid, ++ res_cpg_deliver_callback->pid, ++ &res_cpg_deliver_callback->message, ++ res_cpg_deliver_callback->msglen); + break; +- } + +- res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; ++ case MESSAGE_RES_CPG_CONFCHG_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_confchg_fn == NULL) { ++ break; ++ } + +- marshall_from_mar_cpg_name_t ( +- &group_name, +- &res_cpg_deliver_callback->group_name); ++ res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; + +- callbacks.cpg_deliver_fn (handle, +- &group_name, +- res_cpg_deliver_callback->nodeid, +- res_cpg_deliver_callback->pid, +- &res_cpg_deliver_callback->message, +- res_cpg_deliver_callback->msglen); +- break; ++ for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&member_list[i], ++ &res_cpg_confchg_callback->member_list[i]); ++ } ++ left_list_start = res_cpg_confchg_callback->member_list + ++ res_cpg_confchg_callback->member_list_entries; ++ for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&left_list[i], ++ &left_list_start[i]); ++ } ++ joined_list_start = res_cpg_confchg_callback->member_list + ++ res_cpg_confchg_callback->member_list_entries + ++ res_cpg_confchg_callback->left_list_entries; ++ for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&joined_list[i], ++ &joined_list_start[i]); ++ } ++ marshall_from_mar_cpg_name_t ( ++ &group_name, ++ &res_cpg_confchg_callback->group_name); + +- case MESSAGE_RES_CPG_CONFCHG_CALLBACK: +- if (callbacks.cpg_confchg_fn == NULL) { ++ cpg_inst_copy.model_v1_data.cpg_confchg_fn (handle, ++ &group_name, ++ member_list, ++ res_cpg_confchg_callback->member_list_entries, ++ left_list, ++ res_cpg_confchg_callback->left_list_entries, ++ joined_list, ++ res_cpg_confchg_callback->joined_list_entries); ++ + break; +- } ++ case MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn == NULL) { ++ break; ++ } + +- res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; ++ res_cpg_totem_confchg_callback = (struct res_lib_cpg_totem_confchg_callback *)dispatch_data; + +- for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&member_list[i], +- &res_cpg_confchg_callback->member_list[i]); +- } +- left_list_start = res_cpg_confchg_callback->member_list + +- res_cpg_confchg_callback->member_list_entries; +- for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&left_list[i], +- &left_list_start[i]); +- } +- joined_list_start = res_cpg_confchg_callback->member_list + +- res_cpg_confchg_callback->member_list_entries + +- res_cpg_confchg_callback->left_list_entries; +- for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&joined_list[i], +- &joined_list_start[i]); +- } +- marshall_from_mar_cpg_name_t ( +- &group_name, +- &res_cpg_confchg_callback->group_name); ++ marshall_from_mar_cpg_ring_id_t (&ring_id, &res_cpg_totem_confchg_callback->ring_id); ++ for (i = 0; i < res_cpg_totem_confchg_callback->member_list_entries; i++) { ++ totem_member_list[i] = res_cpg_totem_confchg_callback->member_list[i]; ++ } + +- callbacks.cpg_confchg_fn (handle, +- &group_name, +- member_list, +- res_cpg_confchg_callback->member_list_entries, +- left_list, +- res_cpg_confchg_callback->left_list_entries, +- joined_list, +- res_cpg_confchg_callback->joined_list_entries); +- break; +- +- default: +- coroipcc_dispatch_put (cpg_inst->handle); +- error = CS_ERR_LIBRARY; +- goto error_put; +- break; +- } ++ cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn (handle, ++ ring_id, ++ res_cpg_totem_confchg_callback->member_list_entries, ++ totem_member_list); ++ break; ++ default: ++ coroipcc_dispatch_put (cpg_inst->handle); ++ error = CS_ERR_LIBRARY; ++ goto error_put; ++ break; ++ } /* - switch (dispatch_data->id) */ ++ break; /* case CPG_MODEL_V1 */ ++ } /* - switch (cpg_inst_copy.model_data.model) */ + coroipcc_dispatch_put (cpg_inst->handle); + + /* +@@ -434,6 +501,14 @@ + req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join); + req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN; + req_lib_cpg_join.pid = getpid(); ++ req_lib_cpg_join.flags = 0; ++ ++ switch (cpg_inst->model_data.model) { ++ case CPG_MODEL_V1: ++ req_lib_cpg_join.flags = cpg_inst->model_v1_data.flags; ++ break; ++ } ++ + marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name, + group); + +Index: lib/libcpg.verso +=================================================================== +--- lib/libcpg.verso (revision 2769) ++++ lib/libcpg.verso (revision 2770) +@@ -1 +1 @@ +-4.0.1 ++4.1.0 +Index: man/cpg_initialize.3 +=================================================================== +--- man/cpg_initialize.3 (revision 2769) ++++ man/cpg_initialize.3 (revision 2770) +@@ -41,7 +41,10 @@ + .SH DESCRIPTION + The + .B cpg_initialize +-function is used to initialize a connection to the closed process groups API. ++function is used to initialize a connection to the closed process groups API. This function is deprecated ++and ++.B cpg_model_initialize ++should be used in newly written code. + .PP + Each application may have several connections to the CPG API. Each application + uses the +@@ -167,5 +170,6 @@ + .BR cpg_context_get (3) + .BR cpg_context_set (3) + .BR cpg_local_get (3) ++.BR cpg_model_initialize (3) + + .PP +Index: man/cpg_overview.8 +=================================================================== +--- man/cpg_overview.8 (revision 2769) ++++ man/cpg_overview.8 (revision 2770) +@@ -61,6 +61,7 @@ + .BR cpg_join (3), + .BR cpg_leave (3), + .BR cpg_mcast_joined (3), ++.BR cpg_model_initialize (3), + .BR cpg_membership_get (3) + .BR cpg_zcb_alloc (3) + .BR cpg_zcb_free (3) +Index: man/cpg_model_initialize.3 +=================================================================== +--- man/cpg_model_initialize.3 (revision 0) ++++ man/cpg_model_initialize.3 (revision 2770) +@@ -0,0 +1,231 @@ ++.\"/* ++.\" * Copyright (c) 2010 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Jan Friesse ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH CPG_MODEL_INITIALIZE 3 2010-04-07 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++cpg_model_initialize \- Create a new connection to the CPG service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "cs_error_t cpg_model_initialize(cpg_handle_t *" handle ", cpg_model_t " model ", cpg_model_data_t *" model_data ", void *" context "); ++ ++.SH DESCRIPTION ++The ++.B cpg_model_initialize ++function is used to initialize a connection to the closed process groups API. ++.PP ++Each application may have several connections to the CPG API. Each application ++uses the ++.I handle ++argument to uniquely identify the connection. The ++.I handle ++argument is then used in other function calls to identify the connection to be used ++for communication with the CPG service. ++.PP ++Argument ++.I model ++is used to explicitly choose set of callbacks and internal parameters. Currently only model ++.I CPG_MODEL_V1 ++is defined. ++.PP ++Callbacks and internal parameters are passed by ++.I model_data ++argument. This is casted pointer (idea is similar as in sockaddr function) to one of structures ++corresponding to chosen model. Currently only ++.I cpg_model_v1_data_t ++is needed. ++.SH MODEL_V1 ++The ++.I MODEL_V1 ++is backwards compatible with original callbacks initialized by ++.I cpg_initialize ++but new callback ++.I cpg_totem_confchg_fn ++is defined. ++.PP ++Every time an CPG event occurs within the joined group, one of the callbacks specified by the argument ++.I callbacks ++is called. The callback functions are described by the following type definitions: ++.PP ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.ta 4n 20n 32n ++ ++typedef void (*cpg_deliver_fn_t) ( ++ cpg_handle_t handle, ++ const struct cpg_name *group_name, ++ uint32_t nodeid, ++ uint32_t pid, ++ const void *msg, ++ size_t msg_len); ++ ++ ++typedef void (*cpg_confchg_fn_t) ( ++ cpg_handle_t handle, ++ const struct cpg_name *group_name, ++ const struct cpg_address *member_list, size_t member_list_entries, ++ const struct cpg_address *left_list, size_t left_list_entries, ++ const struct cpg_address *joined_list, size_t joined_list_entries); ++ ++ ++typedef void (*cpg_totem_confchg_fn_t) ( ++ cpg_handle_t handle, ++ struct cpg_ring_id ring_id, ++ uint32_t member_list_entries, ++ const uint32_t *member_list); ++.ta ++.fi ++.RE ++.IP ++.PP ++.PP ++The ++.I cpg_model_v1_data_t ++structure is defined as: ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++typedef struct { ++ cpg_model_t model; ++ cpg_deliver_fn_t cpg_deliver_fn; ++ cpg_confchg_fn_t cpg_confchg_fn; ++ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; ++ unsigned int flags; ++} cpg_model_v1_data_t; ++.ta ++.fi ++.RE ++.IP ++.PP ++When a configuration change occurs or a message is to be delivered one of the callbacks ++is called from the ++.B cpg_dispatch() ++function. If a configuration change occurs, ++.I cpg_confchg_fn ++is called. If a delivery of a message occurs, ++.I cpg_deliver_fn ++is called. ++When totem membership change occurs, ++.I cpg_totem_confchg_fn ++is called. You can OR ++.I CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF ++constant to flags to get callback after first confchg event. ++ ++The ++.I cpg_address ++structure is defined ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++struct cpg_address { ++ unsigned int nodeid; ++ unsigned int pid; ++ unsigned int reason; ++}; ++.ta ++.fi ++.RE ++.IP ++.PP ++where nodeid is a 32 bit unique node identifier, pid is the process ID of the process that has joined/left the group ++or sent the message, and reason is an integer code indicating why the node joined/left the group. ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++CPG_REASON_JOIN - the process joined a group using cpg_join(). ++CPG_REASON_LEAVE - the process left a group using cpg_leave() ++CPG_REASON_NODEDOWN - the process left a group because the node left the cluster. ++CPG_REASON_NODEUP - the process joined a group because it was already a member of a group on a node that has just joined the cluster ++CPG_REASON_PROCDOWN - the process left a group without calling cpg_leave() ++.ta ++.fi ++.RE ++.IP ++.PP ++The ++.I cpg_ring_id ++structure is defined ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++struct cpg_ring_id { ++ uint32_t nodeid; ++ uint64_t seq; ++}; ++.ta ++.fi ++.RE ++.IP ++.PP ++where ++.I nodeid ++is if of node of current Totem leader and seq is increasing number. ++ ++.PP ++.SH RETURN VALUE ++This call returns the CPG_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR cpg_overview (8), ++.BR cpg_initialize (3), ++.BR cpg_finalize (3), ++.BR cpg_fd_get (3), ++.BR cpg_dispatch (3), ++.BR cpg_join (3), ++.BR cpg_leave (3), ++.BR cpg_mcast_joined (3), ++.BR cpg_membership_get (3) ++.BR cpg_zcb_alloc (3) ++.BR cpg_zcb_free (3) ++.BR cpg_zcb_mcast_joined (3) ++.BR cpg_context_get (3) ++.BR cpg_context_set (3) ++.BR cpg_local_get (3) ++.BR cpg_model_initialize (3) ++ ++.PP +Index: man/Makefile.am +=================================================================== +--- man/Makefile.am (revision 2769) ++++ man/Makefile.am (revision 2770) +@@ -71,6 +71,7 @@ + cpg_leave.3 \ + cpg_local_get.3 \ + cpg_mcast_joined.3 \ ++ cpg_model_initialize.3 \ + cpg_zcb_mcast_joined.3 \ + cpg_zcb_alloc.3 \ + cpg_zcb_free.3 \ diff --git a/sources b/sources index 9f490cb..58b36ff 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -cba5eb5da41630f53e54b90c449c056d corosync-1.2.1.tar.gz +7e7c47fa7280f51418369fb2b7f3846e corosync-1.2.2.tar.gz From da46e4ae7e650ef665681a110c786dde07bec8d6 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 25 May 2010 06:12:52 +0000 Subject: [PATCH 053/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 10 ++++++---- revision-2770.patch | 44 -------------------------------------------- sources | 2 +- 4 files changed, 8 insertions(+), 50 deletions(-) diff --git a/.cvsignore b/.cvsignore index 9b08e28..4c48ceb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.2.tar.gz +corosync-1.2.3.tar.gz diff --git a/corosync.spec b/corosync.spec index 33f334b..8ff4113 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.2 +Version: 1.2.3 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -49,9 +49,7 @@ export rdmacm_LIBS=-lrdmacm \ --with-initddir=%{_initddir} %build -make -# 1.2.2 introduced problem where make -j fails. -#make %{_smp_mflags} +make %{_smp_mflags} %install rm -rf %{buildroot} @@ -216,6 +214,10 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Tue May 25 2010 Fabio M. Di Nitto - 1.2.3-1 +- New upstream release +- Rediff revision 2770 patch + * Mon May 17 2010 Fabio M. Di Nitto - 1.2.2-1 - New upstream release - Add upstream trunk revision 2770 to add cpg_model_initialize api. diff --git a/revision-2770.patch b/revision-2770.patch index 08743a7..766c980 100644 --- a/revision-2770.patch +++ b/revision-2770.patch @@ -1,47 +1,3 @@ -Index: test/testcpg.c -=================================================================== ---- test/testcpg.c (revision 2769) -+++ test/testcpg.c (revision 2770) -@@ -132,9 +132,29 @@ - } - } - --static cpg_callbacks_t callbacks = { -+static void TotemConfchgCallback ( -+ cpg_handle_t handle, -+ struct cpg_ring_id ring_id, -+ uint32_t member_list_entries, -+ const uint32_t *member_list) -+{ -+ int i; -+ -+ printf("\nTotemConfchgCallback: ringid (%u.%llu)\n", ring_id.nodeid, ring_id.seq); -+ -+ printf("active processors %lu: ", -+ (unsigned long int) member_list_entries); -+ for (i=0; i Date: Tue, 25 May 2010 07:57:03 +0000 Subject: [PATCH 054/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 19 +- revision-2770.patch | 811 ++++++++++++++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 829 insertions(+), 5 deletions(-) create mode 100644 revision-2770.patch diff --git a/.cvsignore b/.cvsignore index 6e836fb..4c48ceb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.1.tar.gz +corosync-1.2.3.tar.gz diff --git a/corosync.spec b/corosync.spec index 6d35e18..8ff4113 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,12 +2,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.1 +Version: 1.2.3 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base -URL: http://www.openais.org -Source0: http://developer.osdl.org/dev/openais/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz +URL: http://ftp.corosync.org +Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz +Patch0: revision-2770.patch # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -24,6 +25,7 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 %if %{buildtrunk} BuildRequires: autoconf automake %endif + BuildRequires: nss-devel BuildRequires: libibverbs-devel librdmacm-devel @@ -31,6 +33,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version} +%patch0 %if %{buildtrunk} ./autogen.sh @@ -211,6 +214,16 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Tue May 25 2010 Fabio M. Di Nitto - 1.2.3-1 +- New upstream release +- Rediff revision 2770 patch + +* Mon May 17 2010 Fabio M. Di Nitto - 1.2.2-1 +- New upstream release +- Add upstream trunk revision 2770 to add cpg_model_initialize api. +- Fix URL and Source0 entries. +- Add workaround to broken 1.2.2 Makefile with make -j. + * Wed Mar 24 2010 Fabio M. Di Nitto - 1.2.1-1 - New upstream release diff --git a/revision-2770.patch b/revision-2770.patch new file mode 100644 index 0000000..766c980 --- /dev/null +++ b/revision-2770.patch @@ -0,0 +1,811 @@ +Index: include/corosync/ipc_cpg.h +=================================================================== +--- include/corosync/ipc_cpg.h (revision 2769) ++++ include/corosync/ipc_cpg.h (revision 2770) +@@ -65,6 +65,7 @@ + MESSAGE_RES_CPG_ITERATIONNEXT = 10, + MESSAGE_RES_CPG_ITERATIONFINALIZE = 11, + MESSAGE_RES_CPG_FINALIZE = 12, ++ MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK = 13, + }; + + enum lib_cpg_confchg_reason { +@@ -149,10 +150,24 @@ + marshall_from_mar_cpg_name_t (&dest->group, &src->group); + }; + ++typedef struct { ++ mar_uint32_t nodeid __attribute__((aligned(8))); ++ mar_uint64_t seq __attribute__((aligned(8))); ++} mar_cpg_ring_id_t; ++ ++static inline void marshall_from_mar_cpg_ring_id_t ( ++ struct cpg_ring_id *dest, ++ const mar_cpg_ring_id_t *src) ++{ ++ dest->nodeid = src->nodeid; ++ dest->seq = src->seq; ++} ++ + struct req_lib_cpg_join { + coroipc_request_header_t header __attribute__((aligned(8))); + mar_cpg_name_t group_name __attribute__((aligned(8))); + mar_uint32_t pid __attribute__((aligned(8))); ++ mar_uint32_t flags __attribute__((aligned(8))); + }; + + struct res_lib_cpg_join { +@@ -238,6 +253,13 @@ + // struct cpg_address joined_list[]; + }; + ++struct res_lib_cpg_totem_confchg_callback { ++ coroipc_response_header_t header __attribute__((aligned(8))); ++ mar_cpg_ring_id_t ring_id __attribute__((aligned(8))); ++ mar_uint32_t member_list_entries __attribute__((aligned(8))); ++ mar_uint32_t member_list[]; ++}; ++ + struct req_lib_cpg_leave { + coroipc_request_header_t header __attribute__((aligned(8))); + mar_cpg_name_t group_name __attribute__((aligned(8))); +Index: include/corosync/cpg.h +=================================================================== +--- include/corosync/cpg.h (revision 2769) ++++ include/corosync/cpg.h (revision 2770) +@@ -78,6 +78,10 @@ + CPG_ITERATION_ALL = 3, + } cpg_iteration_type_t; + ++typedef enum { ++ CPG_MODEL_V1 = 1, ++} cpg_model_t; ++ + struct cpg_address { + uint32_t nodeid; + uint32_t pid; +@@ -98,6 +102,11 @@ + uint32_t pid; + }; + ++struct cpg_ring_id { ++ uint32_t nodeid; ++ uint64_t seq; ++}; ++ + typedef void (*cpg_deliver_fn_t) ( + cpg_handle_t handle, + const struct cpg_name *group_name, +@@ -117,11 +126,32 @@ + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries); + ++typedef void (*cpg_totem_confchg_fn_t) ( ++ cpg_handle_t handle, ++ struct cpg_ring_id ring_id, ++ uint32_t member_list_entries, ++ const uint32_t *member_list); ++ + typedef struct { + cpg_deliver_fn_t cpg_deliver_fn; + cpg_confchg_fn_t cpg_confchg_fn; + } cpg_callbacks_t; + ++typedef struct { ++ cpg_model_t model; ++} cpg_model_data_t; ++ ++#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF 0x01 ++ ++typedef struct { ++ cpg_model_t model; ++ cpg_deliver_fn_t cpg_deliver_fn; ++ cpg_confchg_fn_t cpg_confchg_fn; ++ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; ++ unsigned int flags; ++} cpg_model_v1_data_t; ++ ++ + /** @} */ + + /* +@@ -132,6 +162,15 @@ + cpg_callbacks_t *callbacks); + + /* ++ * Create a new cpg connection, initialize with model ++ */ ++cs_error_t cpg_model_initialize ( ++ cpg_handle_t *handle, ++ cpg_model_t model, ++ cpg_model_data_t *model_data, ++ void *context); ++ ++/* + * Close the cpg handle + */ + cs_error_t cpg_finalize ( +Index: services/cpg.c +=================================================================== +--- services/cpg.c (revision 2769) ++++ services/cpg.c (revision 2770) +@@ -133,6 +133,8 @@ + mar_cpg_name_t group_name; + uint32_t pid; + enum cpd_state cpd_state; ++ unsigned int flags; ++ int initial_totem_conf_sent; + struct list_head list; + struct list_head iteration_instance_list_head; + }; +@@ -160,6 +162,8 @@ + + static enum cpg_sync_state my_sync_state = CPGSYNC_DOWNLIST; + ++static mar_cpg_ring_id_t last_sync_ring_id; ++ + struct process_info { + unsigned int nodeid; + uint32_t pid; +@@ -255,6 +259,11 @@ + + static void cpg_sync_abort (void); + ++static int notify_lib_totem_membership ( ++ void *conn, ++ int member_list_entries, ++ const unsigned int *member_list); ++ + /* + * Library Handler Definition + */ +@@ -432,6 +441,9 @@ + sizeof (unsigned int)); + my_member_list_entries = member_list_entries; + ++ last_sync_ring_id.nodeid = ring_id->rep.nodeid; ++ last_sync_ring_id.seq = ring_id->seq; ++ + for (i = 0; i < my_member_list_entries; i++) { + if (my_member_list[i] < lowest_nodeid) { + lowest_nodeid = my_member_list[i]; +@@ -482,14 +494,51 @@ + memcpy (my_old_member_list, my_member_list, + my_member_list_entries * sizeof (unsigned int)); + my_old_member_list_entries = my_member_list_entries; ++ ++ notify_lib_totem_membership (NULL, my_member_list_entries, my_member_list); + } + + static void cpg_sync_abort (void) + { + } + ++static int notify_lib_totem_membership ( ++ void *conn, ++ int member_list_entries, ++ const unsigned int *member_list) ++{ ++ struct list_head *iter; ++ char *buf; ++ int size; ++ struct res_lib_cpg_totem_confchg_callback *res; + ++ size = sizeof(struct res_lib_cpg_totem_confchg_callback) + ++ sizeof(mar_uint32_t) * (member_list_entries); ++ buf = alloca(size); ++ if (!buf) ++ return CPG_ERR_LIBRARY; + ++ res = (struct res_lib_cpg_totem_confchg_callback *)buf; ++ res->member_list_entries = member_list_entries; ++ res->header.size = size; ++ res->header.id = MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK; ++ res->header.error = CS_OK; ++ ++ memcpy (&res->ring_id, &last_sync_ring_id, sizeof (mar_cpg_ring_id_t)); ++ memcpy (res->member_list, member_list, res->member_list_entries * sizeof (mar_uint32_t)); ++ ++ if (conn == NULL) { ++ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { ++ struct cpg_pd *cpg_pd = list_entry (iter, struct cpg_pd, list); ++ api->ipc_dispatch_send (cpg_pd->conn, buf, size); ++ } ++ } else { ++ api->ipc_dispatch_send (conn, buf, size); ++ } ++ ++ return CPG_OK; ++} ++ + static int notify_lib_joinlist( + const mar_cpg_name_t *group_name, + void *conn, +@@ -604,6 +653,20 @@ + } + } + ++ ++ /* ++ * Traverse thru cpds and send totem membership for cpd, where it is not send yet ++ */ ++ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { ++ struct cpg_pd *cpd = list_entry (iter, struct cpg_pd, list); ++ ++ if ((cpd->flags & CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF) && (cpd->initial_totem_conf_sent == 0)) { ++ cpd->initial_totem_conf_sent = 1; ++ ++ notify_lib_totem_membership (cpd->conn, my_old_member_list_entries, my_old_member_list); ++ } ++ } ++ + return CPG_OK; + } + +@@ -1093,6 +1156,7 @@ + error = CPG_OK; + cpd->cpd_state = CPD_STATE_JOIN_STARTED; + cpd->pid = req_lib_cpg_join->pid; ++ cpd->flags = req_lib_cpg_join->flags; + memcpy (&cpd->group_name, &req_lib_cpg_join->group_name, + sizeof (cpd->group_name)); + +Index: lib/cpg.c +=================================================================== +--- lib/cpg.c (revision 2769) ++++ lib/cpg.c (revision 2770) +@@ -62,8 +62,11 @@ + struct cpg_inst { + hdb_handle_t handle; + int finalize; +- cpg_callbacks_t callbacks; + void *context; ++ union { ++ cpg_model_data_t model_data; ++ cpg_model_v1_data_t model_v1_data; ++ }; + struct list_head iteration_list_head; + }; + +@@ -118,9 +121,32 @@ + cpg_handle_t *handle, + cpg_callbacks_t *callbacks) + { ++ cpg_model_v1_data_t model_v1_data; ++ ++ memset (&model_v1_data, 0, sizeof (cpg_model_v1_data_t)); ++ ++ if (callbacks) { ++ model_v1_data.cpg_deliver_fn = callbacks->cpg_deliver_fn; ++ model_v1_data.cpg_confchg_fn = callbacks->cpg_confchg_fn; ++ } ++ ++ return (cpg_model_initialize (handle, CPG_MODEL_V1, (cpg_model_data_t *)&model_v1_data, NULL)); ++} ++ ++cs_error_t cpg_model_initialize ( ++ cpg_handle_t *handle, ++ cpg_model_t model, ++ cpg_model_data_t *model_data, ++ void *context) ++{ + cs_error_t error; + struct cpg_inst *cpg_inst; + ++ if (model != CPG_MODEL_V1) { ++ error = CPG_ERR_INVALID_PARAM; ++ goto error_no_destroy; ++ } ++ + error = hdb_error_to_cs (hdb_handle_create (&cpg_handle_t_db, sizeof (struct cpg_inst), handle)); + if (error != CS_OK) { + goto error_no_destroy; +@@ -142,10 +168,26 @@ + goto error_put_destroy; + } + +- if (callbacks) { +- memcpy (&cpg_inst->callbacks, callbacks, sizeof (cpg_callbacks_t)); ++ if (model_data != NULL) { ++ switch (model) { ++ case CPG_MODEL_V1: ++ memcpy (&cpg_inst->model_v1_data, model_data, sizeof (cpg_model_v1_data_t)); ++ if ((cpg_inst->model_v1_data.flags & ~(CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF)) != 0) { ++ error = CS_ERR_INVALID_PARAM; ++ ++ goto error_destroy; ++ } ++ break; ++ default: ++ error = CS_ERR_LIBRARY; ++ goto error_destroy; ++ break; ++ } + } + ++ cpg_inst->model_data.model = model; ++ cpg_inst->context = context; ++ + list_init(&cpg_inst->iteration_list_head); + + hdb_handle_put (&cpg_handle_t_db, *handle); +@@ -283,7 +325,8 @@ + struct cpg_inst *cpg_inst; + struct res_lib_cpg_confchg_callback *res_cpg_confchg_callback; + struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback; +- cpg_callbacks_t callbacks; ++ struct res_lib_cpg_totem_confchg_callback *res_cpg_totem_confchg_callback; ++ struct cpg_inst cpg_inst_copy; + coroipc_response_header_t *dispatch_data; + struct cpg_address member_list[CPG_MEMBERS_MAX]; + struct cpg_address left_list[CPG_MEMBERS_MAX]; +@@ -292,6 +335,8 @@ + mar_cpg_address_t *left_list_start; + mar_cpg_address_t *joined_list_start; + unsigned int i; ++ struct cpg_ring_id ring_id; ++ uint32_t totem_member_list[CPG_MEMBERS_MAX]; + + error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst)); + if (error != CS_OK) { +@@ -332,74 +377,96 @@ + * A risk of this dispatch method is that the callback routines may + * operate at the same time that cpgFinalize has been called. + */ +- memcpy (&callbacks, &cpg_inst->callbacks, sizeof (cpg_callbacks_t)); +- /* +- * Dispatch incoming message +- */ +- switch (dispatch_data->id) { +- case MESSAGE_RES_CPG_DELIVER_CALLBACK: +- if (callbacks.cpg_deliver_fn == NULL) { ++ memcpy (&cpg_inst_copy, cpg_inst, sizeof (struct cpg_inst)); ++ ++ switch (cpg_inst_copy.model_data.model) { ++ case CPG_MODEL_V1: ++ /* ++ * Dispatch incoming message ++ */ ++ switch (dispatch_data->id) { ++ case MESSAGE_RES_CPG_DELIVER_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_deliver_fn == NULL) { ++ break; ++ } ++ ++ res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; ++ ++ marshall_from_mar_cpg_name_t ( ++ &group_name, ++ &res_cpg_deliver_callback->group_name); ++ ++ cpg_inst_copy.model_v1_data.cpg_deliver_fn (handle, ++ &group_name, ++ res_cpg_deliver_callback->nodeid, ++ res_cpg_deliver_callback->pid, ++ &res_cpg_deliver_callback->message, ++ res_cpg_deliver_callback->msglen); + break; +- } + +- res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; ++ case MESSAGE_RES_CPG_CONFCHG_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_confchg_fn == NULL) { ++ break; ++ } + +- marshall_from_mar_cpg_name_t ( +- &group_name, +- &res_cpg_deliver_callback->group_name); ++ res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; + +- callbacks.cpg_deliver_fn (handle, +- &group_name, +- res_cpg_deliver_callback->nodeid, +- res_cpg_deliver_callback->pid, +- &res_cpg_deliver_callback->message, +- res_cpg_deliver_callback->msglen); +- break; ++ for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&member_list[i], ++ &res_cpg_confchg_callback->member_list[i]); ++ } ++ left_list_start = res_cpg_confchg_callback->member_list + ++ res_cpg_confchg_callback->member_list_entries; ++ for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&left_list[i], ++ &left_list_start[i]); ++ } ++ joined_list_start = res_cpg_confchg_callback->member_list + ++ res_cpg_confchg_callback->member_list_entries + ++ res_cpg_confchg_callback->left_list_entries; ++ for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&joined_list[i], ++ &joined_list_start[i]); ++ } ++ marshall_from_mar_cpg_name_t ( ++ &group_name, ++ &res_cpg_confchg_callback->group_name); + +- case MESSAGE_RES_CPG_CONFCHG_CALLBACK: +- if (callbacks.cpg_confchg_fn == NULL) { ++ cpg_inst_copy.model_v1_data.cpg_confchg_fn (handle, ++ &group_name, ++ member_list, ++ res_cpg_confchg_callback->member_list_entries, ++ left_list, ++ res_cpg_confchg_callback->left_list_entries, ++ joined_list, ++ res_cpg_confchg_callback->joined_list_entries); ++ + break; +- } ++ case MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn == NULL) { ++ break; ++ } + +- res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; ++ res_cpg_totem_confchg_callback = (struct res_lib_cpg_totem_confchg_callback *)dispatch_data; + +- for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&member_list[i], +- &res_cpg_confchg_callback->member_list[i]); +- } +- left_list_start = res_cpg_confchg_callback->member_list + +- res_cpg_confchg_callback->member_list_entries; +- for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&left_list[i], +- &left_list_start[i]); +- } +- joined_list_start = res_cpg_confchg_callback->member_list + +- res_cpg_confchg_callback->member_list_entries + +- res_cpg_confchg_callback->left_list_entries; +- for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&joined_list[i], +- &joined_list_start[i]); +- } +- marshall_from_mar_cpg_name_t ( +- &group_name, +- &res_cpg_confchg_callback->group_name); ++ marshall_from_mar_cpg_ring_id_t (&ring_id, &res_cpg_totem_confchg_callback->ring_id); ++ for (i = 0; i < res_cpg_totem_confchg_callback->member_list_entries; i++) { ++ totem_member_list[i] = res_cpg_totem_confchg_callback->member_list[i]; ++ } + +- callbacks.cpg_confchg_fn (handle, +- &group_name, +- member_list, +- res_cpg_confchg_callback->member_list_entries, +- left_list, +- res_cpg_confchg_callback->left_list_entries, +- joined_list, +- res_cpg_confchg_callback->joined_list_entries); +- break; +- +- default: +- coroipcc_dispatch_put (cpg_inst->handle); +- error = CS_ERR_LIBRARY; +- goto error_put; +- break; +- } ++ cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn (handle, ++ ring_id, ++ res_cpg_totem_confchg_callback->member_list_entries, ++ totem_member_list); ++ break; ++ default: ++ coroipcc_dispatch_put (cpg_inst->handle); ++ error = CS_ERR_LIBRARY; ++ goto error_put; ++ break; ++ } /* - switch (dispatch_data->id) */ ++ break; /* case CPG_MODEL_V1 */ ++ } /* - switch (cpg_inst_copy.model_data.model) */ + coroipcc_dispatch_put (cpg_inst->handle); + + /* +@@ -434,6 +501,14 @@ + req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join); + req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN; + req_lib_cpg_join.pid = getpid(); ++ req_lib_cpg_join.flags = 0; ++ ++ switch (cpg_inst->model_data.model) { ++ case CPG_MODEL_V1: ++ req_lib_cpg_join.flags = cpg_inst->model_v1_data.flags; ++ break; ++ } ++ + marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name, + group); + +Index: lib/libcpg.verso +=================================================================== +--- lib/libcpg.verso (revision 2769) ++++ lib/libcpg.verso (revision 2770) +@@ -1 +1 @@ +-4.0.1 ++4.1.0 +Index: man/cpg_initialize.3 +=================================================================== +--- man/cpg_initialize.3 (revision 2769) ++++ man/cpg_initialize.3 (revision 2770) +@@ -41,7 +41,10 @@ + .SH DESCRIPTION + The + .B cpg_initialize +-function is used to initialize a connection to the closed process groups API. ++function is used to initialize a connection to the closed process groups API. This function is deprecated ++and ++.B cpg_model_initialize ++should be used in newly written code. + .PP + Each application may have several connections to the CPG API. Each application + uses the +@@ -167,5 +170,6 @@ + .BR cpg_context_get (3) + .BR cpg_context_set (3) + .BR cpg_local_get (3) ++.BR cpg_model_initialize (3) + + .PP +Index: man/cpg_overview.8 +=================================================================== +--- man/cpg_overview.8 (revision 2769) ++++ man/cpg_overview.8 (revision 2770) +@@ -61,6 +61,7 @@ + .BR cpg_join (3), + .BR cpg_leave (3), + .BR cpg_mcast_joined (3), ++.BR cpg_model_initialize (3), + .BR cpg_membership_get (3) + .BR cpg_zcb_alloc (3) + .BR cpg_zcb_free (3) +Index: man/cpg_model_initialize.3 +=================================================================== +--- man/cpg_model_initialize.3 (revision 0) ++++ man/cpg_model_initialize.3 (revision 2770) +@@ -0,0 +1,231 @@ ++.\"/* ++.\" * Copyright (c) 2010 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Jan Friesse ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH CPG_MODEL_INITIALIZE 3 2010-04-07 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++cpg_model_initialize \- Create a new connection to the CPG service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "cs_error_t cpg_model_initialize(cpg_handle_t *" handle ", cpg_model_t " model ", cpg_model_data_t *" model_data ", void *" context "); ++ ++.SH DESCRIPTION ++The ++.B cpg_model_initialize ++function is used to initialize a connection to the closed process groups API. ++.PP ++Each application may have several connections to the CPG API. Each application ++uses the ++.I handle ++argument to uniquely identify the connection. The ++.I handle ++argument is then used in other function calls to identify the connection to be used ++for communication with the CPG service. ++.PP ++Argument ++.I model ++is used to explicitly choose set of callbacks and internal parameters. Currently only model ++.I CPG_MODEL_V1 ++is defined. ++.PP ++Callbacks and internal parameters are passed by ++.I model_data ++argument. This is casted pointer (idea is similar as in sockaddr function) to one of structures ++corresponding to chosen model. Currently only ++.I cpg_model_v1_data_t ++is needed. ++.SH MODEL_V1 ++The ++.I MODEL_V1 ++is backwards compatible with original callbacks initialized by ++.I cpg_initialize ++but new callback ++.I cpg_totem_confchg_fn ++is defined. ++.PP ++Every time an CPG event occurs within the joined group, one of the callbacks specified by the argument ++.I callbacks ++is called. The callback functions are described by the following type definitions: ++.PP ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.ta 4n 20n 32n ++ ++typedef void (*cpg_deliver_fn_t) ( ++ cpg_handle_t handle, ++ const struct cpg_name *group_name, ++ uint32_t nodeid, ++ uint32_t pid, ++ const void *msg, ++ size_t msg_len); ++ ++ ++typedef void (*cpg_confchg_fn_t) ( ++ cpg_handle_t handle, ++ const struct cpg_name *group_name, ++ const struct cpg_address *member_list, size_t member_list_entries, ++ const struct cpg_address *left_list, size_t left_list_entries, ++ const struct cpg_address *joined_list, size_t joined_list_entries); ++ ++ ++typedef void (*cpg_totem_confchg_fn_t) ( ++ cpg_handle_t handle, ++ struct cpg_ring_id ring_id, ++ uint32_t member_list_entries, ++ const uint32_t *member_list); ++.ta ++.fi ++.RE ++.IP ++.PP ++.PP ++The ++.I cpg_model_v1_data_t ++structure is defined as: ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++typedef struct { ++ cpg_model_t model; ++ cpg_deliver_fn_t cpg_deliver_fn; ++ cpg_confchg_fn_t cpg_confchg_fn; ++ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; ++ unsigned int flags; ++} cpg_model_v1_data_t; ++.ta ++.fi ++.RE ++.IP ++.PP ++When a configuration change occurs or a message is to be delivered one of the callbacks ++is called from the ++.B cpg_dispatch() ++function. If a configuration change occurs, ++.I cpg_confchg_fn ++is called. If a delivery of a message occurs, ++.I cpg_deliver_fn ++is called. ++When totem membership change occurs, ++.I cpg_totem_confchg_fn ++is called. You can OR ++.I CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF ++constant to flags to get callback after first confchg event. ++ ++The ++.I cpg_address ++structure is defined ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++struct cpg_address { ++ unsigned int nodeid; ++ unsigned int pid; ++ unsigned int reason; ++}; ++.ta ++.fi ++.RE ++.IP ++.PP ++where nodeid is a 32 bit unique node identifier, pid is the process ID of the process that has joined/left the group ++or sent the message, and reason is an integer code indicating why the node joined/left the group. ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++CPG_REASON_JOIN - the process joined a group using cpg_join(). ++CPG_REASON_LEAVE - the process left a group using cpg_leave() ++CPG_REASON_NODEDOWN - the process left a group because the node left the cluster. ++CPG_REASON_NODEUP - the process joined a group because it was already a member of a group on a node that has just joined the cluster ++CPG_REASON_PROCDOWN - the process left a group without calling cpg_leave() ++.ta ++.fi ++.RE ++.IP ++.PP ++The ++.I cpg_ring_id ++structure is defined ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++struct cpg_ring_id { ++ uint32_t nodeid; ++ uint64_t seq; ++}; ++.ta ++.fi ++.RE ++.IP ++.PP ++where ++.I nodeid ++is if of node of current Totem leader and seq is increasing number. ++ ++.PP ++.SH RETURN VALUE ++This call returns the CPG_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR cpg_overview (8), ++.BR cpg_initialize (3), ++.BR cpg_finalize (3), ++.BR cpg_fd_get (3), ++.BR cpg_dispatch (3), ++.BR cpg_join (3), ++.BR cpg_leave (3), ++.BR cpg_mcast_joined (3), ++.BR cpg_membership_get (3) ++.BR cpg_zcb_alloc (3) ++.BR cpg_zcb_free (3) ++.BR cpg_zcb_mcast_joined (3) ++.BR cpg_context_get (3) ++.BR cpg_context_set (3) ++.BR cpg_local_get (3) ++.BR cpg_model_initialize (3) ++ ++.PP +Index: man/Makefile.am +=================================================================== +--- man/Makefile.am (revision 2769) ++++ man/Makefile.am (revision 2770) +@@ -71,6 +71,7 @@ + cpg_leave.3 \ + cpg_local_get.3 \ + cpg_mcast_joined.3 \ ++ cpg_model_initialize.3 \ + cpg_zcb_mcast_joined.3 \ + cpg_zcb_alloc.3 \ + cpg_zcb_free.3 \ diff --git a/sources b/sources index 9f490cb..e99be3c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -cba5eb5da41630f53e54b90c449c056d corosync-1.2.1.tar.gz +03b8cc311619c07ae1a84a5d59f13d0b corosync-1.2.3.tar.gz From 3afd892ecacb6fd33f38a24ab7870c6e77a1a5cc Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 25 May 2010 07:58:10 +0000 Subject: [PATCH 055/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 19 +- revision-2770.patch | 811 ++++++++++++++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 829 insertions(+), 5 deletions(-) create mode 100644 revision-2770.patch diff --git a/.cvsignore b/.cvsignore index 6e836fb..4c48ceb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.1.tar.gz +corosync-1.2.3.tar.gz diff --git a/corosync.spec b/corosync.spec index 6d35e18..8ff4113 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,12 +2,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.1 +Version: 1.2.3 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base -URL: http://www.openais.org -Source0: http://developer.osdl.org/dev/openais/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz +URL: http://ftp.corosync.org +Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz +Patch0: revision-2770.patch # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -24,6 +25,7 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 %if %{buildtrunk} BuildRequires: autoconf automake %endif + BuildRequires: nss-devel BuildRequires: libibverbs-devel librdmacm-devel @@ -31,6 +33,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version} +%patch0 %if %{buildtrunk} ./autogen.sh @@ -211,6 +214,16 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Tue May 25 2010 Fabio M. Di Nitto - 1.2.3-1 +- New upstream release +- Rediff revision 2770 patch + +* Mon May 17 2010 Fabio M. Di Nitto - 1.2.2-1 +- New upstream release +- Add upstream trunk revision 2770 to add cpg_model_initialize api. +- Fix URL and Source0 entries. +- Add workaround to broken 1.2.2 Makefile with make -j. + * Wed Mar 24 2010 Fabio M. Di Nitto - 1.2.1-1 - New upstream release diff --git a/revision-2770.patch b/revision-2770.patch new file mode 100644 index 0000000..766c980 --- /dev/null +++ b/revision-2770.patch @@ -0,0 +1,811 @@ +Index: include/corosync/ipc_cpg.h +=================================================================== +--- include/corosync/ipc_cpg.h (revision 2769) ++++ include/corosync/ipc_cpg.h (revision 2770) +@@ -65,6 +65,7 @@ + MESSAGE_RES_CPG_ITERATIONNEXT = 10, + MESSAGE_RES_CPG_ITERATIONFINALIZE = 11, + MESSAGE_RES_CPG_FINALIZE = 12, ++ MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK = 13, + }; + + enum lib_cpg_confchg_reason { +@@ -149,10 +150,24 @@ + marshall_from_mar_cpg_name_t (&dest->group, &src->group); + }; + ++typedef struct { ++ mar_uint32_t nodeid __attribute__((aligned(8))); ++ mar_uint64_t seq __attribute__((aligned(8))); ++} mar_cpg_ring_id_t; ++ ++static inline void marshall_from_mar_cpg_ring_id_t ( ++ struct cpg_ring_id *dest, ++ const mar_cpg_ring_id_t *src) ++{ ++ dest->nodeid = src->nodeid; ++ dest->seq = src->seq; ++} ++ + struct req_lib_cpg_join { + coroipc_request_header_t header __attribute__((aligned(8))); + mar_cpg_name_t group_name __attribute__((aligned(8))); + mar_uint32_t pid __attribute__((aligned(8))); ++ mar_uint32_t flags __attribute__((aligned(8))); + }; + + struct res_lib_cpg_join { +@@ -238,6 +253,13 @@ + // struct cpg_address joined_list[]; + }; + ++struct res_lib_cpg_totem_confchg_callback { ++ coroipc_response_header_t header __attribute__((aligned(8))); ++ mar_cpg_ring_id_t ring_id __attribute__((aligned(8))); ++ mar_uint32_t member_list_entries __attribute__((aligned(8))); ++ mar_uint32_t member_list[]; ++}; ++ + struct req_lib_cpg_leave { + coroipc_request_header_t header __attribute__((aligned(8))); + mar_cpg_name_t group_name __attribute__((aligned(8))); +Index: include/corosync/cpg.h +=================================================================== +--- include/corosync/cpg.h (revision 2769) ++++ include/corosync/cpg.h (revision 2770) +@@ -78,6 +78,10 @@ + CPG_ITERATION_ALL = 3, + } cpg_iteration_type_t; + ++typedef enum { ++ CPG_MODEL_V1 = 1, ++} cpg_model_t; ++ + struct cpg_address { + uint32_t nodeid; + uint32_t pid; +@@ -98,6 +102,11 @@ + uint32_t pid; + }; + ++struct cpg_ring_id { ++ uint32_t nodeid; ++ uint64_t seq; ++}; ++ + typedef void (*cpg_deliver_fn_t) ( + cpg_handle_t handle, + const struct cpg_name *group_name, +@@ -117,11 +126,32 @@ + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries); + ++typedef void (*cpg_totem_confchg_fn_t) ( ++ cpg_handle_t handle, ++ struct cpg_ring_id ring_id, ++ uint32_t member_list_entries, ++ const uint32_t *member_list); ++ + typedef struct { + cpg_deliver_fn_t cpg_deliver_fn; + cpg_confchg_fn_t cpg_confchg_fn; + } cpg_callbacks_t; + ++typedef struct { ++ cpg_model_t model; ++} cpg_model_data_t; ++ ++#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF 0x01 ++ ++typedef struct { ++ cpg_model_t model; ++ cpg_deliver_fn_t cpg_deliver_fn; ++ cpg_confchg_fn_t cpg_confchg_fn; ++ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; ++ unsigned int flags; ++} cpg_model_v1_data_t; ++ ++ + /** @} */ + + /* +@@ -132,6 +162,15 @@ + cpg_callbacks_t *callbacks); + + /* ++ * Create a new cpg connection, initialize with model ++ */ ++cs_error_t cpg_model_initialize ( ++ cpg_handle_t *handle, ++ cpg_model_t model, ++ cpg_model_data_t *model_data, ++ void *context); ++ ++/* + * Close the cpg handle + */ + cs_error_t cpg_finalize ( +Index: services/cpg.c +=================================================================== +--- services/cpg.c (revision 2769) ++++ services/cpg.c (revision 2770) +@@ -133,6 +133,8 @@ + mar_cpg_name_t group_name; + uint32_t pid; + enum cpd_state cpd_state; ++ unsigned int flags; ++ int initial_totem_conf_sent; + struct list_head list; + struct list_head iteration_instance_list_head; + }; +@@ -160,6 +162,8 @@ + + static enum cpg_sync_state my_sync_state = CPGSYNC_DOWNLIST; + ++static mar_cpg_ring_id_t last_sync_ring_id; ++ + struct process_info { + unsigned int nodeid; + uint32_t pid; +@@ -255,6 +259,11 @@ + + static void cpg_sync_abort (void); + ++static int notify_lib_totem_membership ( ++ void *conn, ++ int member_list_entries, ++ const unsigned int *member_list); ++ + /* + * Library Handler Definition + */ +@@ -432,6 +441,9 @@ + sizeof (unsigned int)); + my_member_list_entries = member_list_entries; + ++ last_sync_ring_id.nodeid = ring_id->rep.nodeid; ++ last_sync_ring_id.seq = ring_id->seq; ++ + for (i = 0; i < my_member_list_entries; i++) { + if (my_member_list[i] < lowest_nodeid) { + lowest_nodeid = my_member_list[i]; +@@ -482,14 +494,51 @@ + memcpy (my_old_member_list, my_member_list, + my_member_list_entries * sizeof (unsigned int)); + my_old_member_list_entries = my_member_list_entries; ++ ++ notify_lib_totem_membership (NULL, my_member_list_entries, my_member_list); + } + + static void cpg_sync_abort (void) + { + } + ++static int notify_lib_totem_membership ( ++ void *conn, ++ int member_list_entries, ++ const unsigned int *member_list) ++{ ++ struct list_head *iter; ++ char *buf; ++ int size; ++ struct res_lib_cpg_totem_confchg_callback *res; + ++ size = sizeof(struct res_lib_cpg_totem_confchg_callback) + ++ sizeof(mar_uint32_t) * (member_list_entries); ++ buf = alloca(size); ++ if (!buf) ++ return CPG_ERR_LIBRARY; + ++ res = (struct res_lib_cpg_totem_confchg_callback *)buf; ++ res->member_list_entries = member_list_entries; ++ res->header.size = size; ++ res->header.id = MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK; ++ res->header.error = CS_OK; ++ ++ memcpy (&res->ring_id, &last_sync_ring_id, sizeof (mar_cpg_ring_id_t)); ++ memcpy (res->member_list, member_list, res->member_list_entries * sizeof (mar_uint32_t)); ++ ++ if (conn == NULL) { ++ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { ++ struct cpg_pd *cpg_pd = list_entry (iter, struct cpg_pd, list); ++ api->ipc_dispatch_send (cpg_pd->conn, buf, size); ++ } ++ } else { ++ api->ipc_dispatch_send (conn, buf, size); ++ } ++ ++ return CPG_OK; ++} ++ + static int notify_lib_joinlist( + const mar_cpg_name_t *group_name, + void *conn, +@@ -604,6 +653,20 @@ + } + } + ++ ++ /* ++ * Traverse thru cpds and send totem membership for cpd, where it is not send yet ++ */ ++ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { ++ struct cpg_pd *cpd = list_entry (iter, struct cpg_pd, list); ++ ++ if ((cpd->flags & CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF) && (cpd->initial_totem_conf_sent == 0)) { ++ cpd->initial_totem_conf_sent = 1; ++ ++ notify_lib_totem_membership (cpd->conn, my_old_member_list_entries, my_old_member_list); ++ } ++ } ++ + return CPG_OK; + } + +@@ -1093,6 +1156,7 @@ + error = CPG_OK; + cpd->cpd_state = CPD_STATE_JOIN_STARTED; + cpd->pid = req_lib_cpg_join->pid; ++ cpd->flags = req_lib_cpg_join->flags; + memcpy (&cpd->group_name, &req_lib_cpg_join->group_name, + sizeof (cpd->group_name)); + +Index: lib/cpg.c +=================================================================== +--- lib/cpg.c (revision 2769) ++++ lib/cpg.c (revision 2770) +@@ -62,8 +62,11 @@ + struct cpg_inst { + hdb_handle_t handle; + int finalize; +- cpg_callbacks_t callbacks; + void *context; ++ union { ++ cpg_model_data_t model_data; ++ cpg_model_v1_data_t model_v1_data; ++ }; + struct list_head iteration_list_head; + }; + +@@ -118,9 +121,32 @@ + cpg_handle_t *handle, + cpg_callbacks_t *callbacks) + { ++ cpg_model_v1_data_t model_v1_data; ++ ++ memset (&model_v1_data, 0, sizeof (cpg_model_v1_data_t)); ++ ++ if (callbacks) { ++ model_v1_data.cpg_deliver_fn = callbacks->cpg_deliver_fn; ++ model_v1_data.cpg_confchg_fn = callbacks->cpg_confchg_fn; ++ } ++ ++ return (cpg_model_initialize (handle, CPG_MODEL_V1, (cpg_model_data_t *)&model_v1_data, NULL)); ++} ++ ++cs_error_t cpg_model_initialize ( ++ cpg_handle_t *handle, ++ cpg_model_t model, ++ cpg_model_data_t *model_data, ++ void *context) ++{ + cs_error_t error; + struct cpg_inst *cpg_inst; + ++ if (model != CPG_MODEL_V1) { ++ error = CPG_ERR_INVALID_PARAM; ++ goto error_no_destroy; ++ } ++ + error = hdb_error_to_cs (hdb_handle_create (&cpg_handle_t_db, sizeof (struct cpg_inst), handle)); + if (error != CS_OK) { + goto error_no_destroy; +@@ -142,10 +168,26 @@ + goto error_put_destroy; + } + +- if (callbacks) { +- memcpy (&cpg_inst->callbacks, callbacks, sizeof (cpg_callbacks_t)); ++ if (model_data != NULL) { ++ switch (model) { ++ case CPG_MODEL_V1: ++ memcpy (&cpg_inst->model_v1_data, model_data, sizeof (cpg_model_v1_data_t)); ++ if ((cpg_inst->model_v1_data.flags & ~(CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF)) != 0) { ++ error = CS_ERR_INVALID_PARAM; ++ ++ goto error_destroy; ++ } ++ break; ++ default: ++ error = CS_ERR_LIBRARY; ++ goto error_destroy; ++ break; ++ } + } + ++ cpg_inst->model_data.model = model; ++ cpg_inst->context = context; ++ + list_init(&cpg_inst->iteration_list_head); + + hdb_handle_put (&cpg_handle_t_db, *handle); +@@ -283,7 +325,8 @@ + struct cpg_inst *cpg_inst; + struct res_lib_cpg_confchg_callback *res_cpg_confchg_callback; + struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback; +- cpg_callbacks_t callbacks; ++ struct res_lib_cpg_totem_confchg_callback *res_cpg_totem_confchg_callback; ++ struct cpg_inst cpg_inst_copy; + coroipc_response_header_t *dispatch_data; + struct cpg_address member_list[CPG_MEMBERS_MAX]; + struct cpg_address left_list[CPG_MEMBERS_MAX]; +@@ -292,6 +335,8 @@ + mar_cpg_address_t *left_list_start; + mar_cpg_address_t *joined_list_start; + unsigned int i; ++ struct cpg_ring_id ring_id; ++ uint32_t totem_member_list[CPG_MEMBERS_MAX]; + + error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst)); + if (error != CS_OK) { +@@ -332,74 +377,96 @@ + * A risk of this dispatch method is that the callback routines may + * operate at the same time that cpgFinalize has been called. + */ +- memcpy (&callbacks, &cpg_inst->callbacks, sizeof (cpg_callbacks_t)); +- /* +- * Dispatch incoming message +- */ +- switch (dispatch_data->id) { +- case MESSAGE_RES_CPG_DELIVER_CALLBACK: +- if (callbacks.cpg_deliver_fn == NULL) { ++ memcpy (&cpg_inst_copy, cpg_inst, sizeof (struct cpg_inst)); ++ ++ switch (cpg_inst_copy.model_data.model) { ++ case CPG_MODEL_V1: ++ /* ++ * Dispatch incoming message ++ */ ++ switch (dispatch_data->id) { ++ case MESSAGE_RES_CPG_DELIVER_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_deliver_fn == NULL) { ++ break; ++ } ++ ++ res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; ++ ++ marshall_from_mar_cpg_name_t ( ++ &group_name, ++ &res_cpg_deliver_callback->group_name); ++ ++ cpg_inst_copy.model_v1_data.cpg_deliver_fn (handle, ++ &group_name, ++ res_cpg_deliver_callback->nodeid, ++ res_cpg_deliver_callback->pid, ++ &res_cpg_deliver_callback->message, ++ res_cpg_deliver_callback->msglen); + break; +- } + +- res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; ++ case MESSAGE_RES_CPG_CONFCHG_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_confchg_fn == NULL) { ++ break; ++ } + +- marshall_from_mar_cpg_name_t ( +- &group_name, +- &res_cpg_deliver_callback->group_name); ++ res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; + +- callbacks.cpg_deliver_fn (handle, +- &group_name, +- res_cpg_deliver_callback->nodeid, +- res_cpg_deliver_callback->pid, +- &res_cpg_deliver_callback->message, +- res_cpg_deliver_callback->msglen); +- break; ++ for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&member_list[i], ++ &res_cpg_confchg_callback->member_list[i]); ++ } ++ left_list_start = res_cpg_confchg_callback->member_list + ++ res_cpg_confchg_callback->member_list_entries; ++ for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&left_list[i], ++ &left_list_start[i]); ++ } ++ joined_list_start = res_cpg_confchg_callback->member_list + ++ res_cpg_confchg_callback->member_list_entries + ++ res_cpg_confchg_callback->left_list_entries; ++ for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { ++ marshall_from_mar_cpg_address_t (&joined_list[i], ++ &joined_list_start[i]); ++ } ++ marshall_from_mar_cpg_name_t ( ++ &group_name, ++ &res_cpg_confchg_callback->group_name); + +- case MESSAGE_RES_CPG_CONFCHG_CALLBACK: +- if (callbacks.cpg_confchg_fn == NULL) { ++ cpg_inst_copy.model_v1_data.cpg_confchg_fn (handle, ++ &group_name, ++ member_list, ++ res_cpg_confchg_callback->member_list_entries, ++ left_list, ++ res_cpg_confchg_callback->left_list_entries, ++ joined_list, ++ res_cpg_confchg_callback->joined_list_entries); ++ + break; +- } ++ case MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK: ++ if (cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn == NULL) { ++ break; ++ } + +- res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; ++ res_cpg_totem_confchg_callback = (struct res_lib_cpg_totem_confchg_callback *)dispatch_data; + +- for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&member_list[i], +- &res_cpg_confchg_callback->member_list[i]); +- } +- left_list_start = res_cpg_confchg_callback->member_list + +- res_cpg_confchg_callback->member_list_entries; +- for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&left_list[i], +- &left_list_start[i]); +- } +- joined_list_start = res_cpg_confchg_callback->member_list + +- res_cpg_confchg_callback->member_list_entries + +- res_cpg_confchg_callback->left_list_entries; +- for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { +- marshall_from_mar_cpg_address_t (&joined_list[i], +- &joined_list_start[i]); +- } +- marshall_from_mar_cpg_name_t ( +- &group_name, +- &res_cpg_confchg_callback->group_name); ++ marshall_from_mar_cpg_ring_id_t (&ring_id, &res_cpg_totem_confchg_callback->ring_id); ++ for (i = 0; i < res_cpg_totem_confchg_callback->member_list_entries; i++) { ++ totem_member_list[i] = res_cpg_totem_confchg_callback->member_list[i]; ++ } + +- callbacks.cpg_confchg_fn (handle, +- &group_name, +- member_list, +- res_cpg_confchg_callback->member_list_entries, +- left_list, +- res_cpg_confchg_callback->left_list_entries, +- joined_list, +- res_cpg_confchg_callback->joined_list_entries); +- break; +- +- default: +- coroipcc_dispatch_put (cpg_inst->handle); +- error = CS_ERR_LIBRARY; +- goto error_put; +- break; +- } ++ cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn (handle, ++ ring_id, ++ res_cpg_totem_confchg_callback->member_list_entries, ++ totem_member_list); ++ break; ++ default: ++ coroipcc_dispatch_put (cpg_inst->handle); ++ error = CS_ERR_LIBRARY; ++ goto error_put; ++ break; ++ } /* - switch (dispatch_data->id) */ ++ break; /* case CPG_MODEL_V1 */ ++ } /* - switch (cpg_inst_copy.model_data.model) */ + coroipcc_dispatch_put (cpg_inst->handle); + + /* +@@ -434,6 +501,14 @@ + req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join); + req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN; + req_lib_cpg_join.pid = getpid(); ++ req_lib_cpg_join.flags = 0; ++ ++ switch (cpg_inst->model_data.model) { ++ case CPG_MODEL_V1: ++ req_lib_cpg_join.flags = cpg_inst->model_v1_data.flags; ++ break; ++ } ++ + marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name, + group); + +Index: lib/libcpg.verso +=================================================================== +--- lib/libcpg.verso (revision 2769) ++++ lib/libcpg.verso (revision 2770) +@@ -1 +1 @@ +-4.0.1 ++4.1.0 +Index: man/cpg_initialize.3 +=================================================================== +--- man/cpg_initialize.3 (revision 2769) ++++ man/cpg_initialize.3 (revision 2770) +@@ -41,7 +41,10 @@ + .SH DESCRIPTION + The + .B cpg_initialize +-function is used to initialize a connection to the closed process groups API. ++function is used to initialize a connection to the closed process groups API. This function is deprecated ++and ++.B cpg_model_initialize ++should be used in newly written code. + .PP + Each application may have several connections to the CPG API. Each application + uses the +@@ -167,5 +170,6 @@ + .BR cpg_context_get (3) + .BR cpg_context_set (3) + .BR cpg_local_get (3) ++.BR cpg_model_initialize (3) + + .PP +Index: man/cpg_overview.8 +=================================================================== +--- man/cpg_overview.8 (revision 2769) ++++ man/cpg_overview.8 (revision 2770) +@@ -61,6 +61,7 @@ + .BR cpg_join (3), + .BR cpg_leave (3), + .BR cpg_mcast_joined (3), ++.BR cpg_model_initialize (3), + .BR cpg_membership_get (3) + .BR cpg_zcb_alloc (3) + .BR cpg_zcb_free (3) +Index: man/cpg_model_initialize.3 +=================================================================== +--- man/cpg_model_initialize.3 (revision 0) ++++ man/cpg_model_initialize.3 (revision 2770) +@@ -0,0 +1,231 @@ ++.\"/* ++.\" * Copyright (c) 2010 Red Hat, Inc. ++.\" * ++.\" * All rights reserved. ++.\" * ++.\" * Author: Jan Friesse ++.\" * Author: Christine Caulfield ++.\" * ++.\" * 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. ++.\" */ ++.TH CPG_MODEL_INITIALIZE 3 2010-04-07 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.SH NAME ++cpg_model_initialize \- Create a new connection to the CPG service ++.SH SYNOPSIS ++.B #include ++.sp ++.BI "cs_error_t cpg_model_initialize(cpg_handle_t *" handle ", cpg_model_t " model ", cpg_model_data_t *" model_data ", void *" context "); ++ ++.SH DESCRIPTION ++The ++.B cpg_model_initialize ++function is used to initialize a connection to the closed process groups API. ++.PP ++Each application may have several connections to the CPG API. Each application ++uses the ++.I handle ++argument to uniquely identify the connection. The ++.I handle ++argument is then used in other function calls to identify the connection to be used ++for communication with the CPG service. ++.PP ++Argument ++.I model ++is used to explicitly choose set of callbacks and internal parameters. Currently only model ++.I CPG_MODEL_V1 ++is defined. ++.PP ++Callbacks and internal parameters are passed by ++.I model_data ++argument. This is casted pointer (idea is similar as in sockaddr function) to one of structures ++corresponding to chosen model. Currently only ++.I cpg_model_v1_data_t ++is needed. ++.SH MODEL_V1 ++The ++.I MODEL_V1 ++is backwards compatible with original callbacks initialized by ++.I cpg_initialize ++but new callback ++.I cpg_totem_confchg_fn ++is defined. ++.PP ++Every time an CPG event occurs within the joined group, one of the callbacks specified by the argument ++.I callbacks ++is called. The callback functions are described by the following type definitions: ++.PP ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.ta 4n 20n 32n ++ ++typedef void (*cpg_deliver_fn_t) ( ++ cpg_handle_t handle, ++ const struct cpg_name *group_name, ++ uint32_t nodeid, ++ uint32_t pid, ++ const void *msg, ++ size_t msg_len); ++ ++ ++typedef void (*cpg_confchg_fn_t) ( ++ cpg_handle_t handle, ++ const struct cpg_name *group_name, ++ const struct cpg_address *member_list, size_t member_list_entries, ++ const struct cpg_address *left_list, size_t left_list_entries, ++ const struct cpg_address *joined_list, size_t joined_list_entries); ++ ++ ++typedef void (*cpg_totem_confchg_fn_t) ( ++ cpg_handle_t handle, ++ struct cpg_ring_id ring_id, ++ uint32_t member_list_entries, ++ const uint32_t *member_list); ++.ta ++.fi ++.RE ++.IP ++.PP ++.PP ++The ++.I cpg_model_v1_data_t ++structure is defined as: ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++typedef struct { ++ cpg_model_t model; ++ cpg_deliver_fn_t cpg_deliver_fn; ++ cpg_confchg_fn_t cpg_confchg_fn; ++ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; ++ unsigned int flags; ++} cpg_model_v1_data_t; ++.ta ++.fi ++.RE ++.IP ++.PP ++When a configuration change occurs or a message is to be delivered one of the callbacks ++is called from the ++.B cpg_dispatch() ++function. If a configuration change occurs, ++.I cpg_confchg_fn ++is called. If a delivery of a message occurs, ++.I cpg_deliver_fn ++is called. ++When totem membership change occurs, ++.I cpg_totem_confchg_fn ++is called. You can OR ++.I CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF ++constant to flags to get callback after first confchg event. ++ ++The ++.I cpg_address ++structure is defined ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++struct cpg_address { ++ unsigned int nodeid; ++ unsigned int pid; ++ unsigned int reason; ++}; ++.ta ++.fi ++.RE ++.IP ++.PP ++where nodeid is a 32 bit unique node identifier, pid is the process ID of the process that has joined/left the group ++or sent the message, and reason is an integer code indicating why the node joined/left the group. ++.PP ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++CPG_REASON_JOIN - the process joined a group using cpg_join(). ++CPG_REASON_LEAVE - the process left a group using cpg_leave() ++CPG_REASON_NODEDOWN - the process left a group because the node left the cluster. ++CPG_REASON_NODEUP - the process joined a group because it was already a member of a group on a node that has just joined the cluster ++CPG_REASON_PROCDOWN - the process left a group without calling cpg_leave() ++.ta ++.fi ++.RE ++.IP ++.PP ++The ++.I cpg_ring_id ++structure is defined ++.IP ++.RS ++.ne 18 ++.nf ++.PP ++struct cpg_ring_id { ++ uint32_t nodeid; ++ uint64_t seq; ++}; ++.ta ++.fi ++.RE ++.IP ++.PP ++where ++.I nodeid ++is if of node of current Totem leader and seq is increasing number. ++ ++.PP ++.SH RETURN VALUE ++This call returns the CPG_OK value if successful, otherwise an error is returned. ++.PP ++.SH ERRORS ++The errors are undocumented. ++.SH "SEE ALSO" ++.BR cpg_overview (8), ++.BR cpg_initialize (3), ++.BR cpg_finalize (3), ++.BR cpg_fd_get (3), ++.BR cpg_dispatch (3), ++.BR cpg_join (3), ++.BR cpg_leave (3), ++.BR cpg_mcast_joined (3), ++.BR cpg_membership_get (3) ++.BR cpg_zcb_alloc (3) ++.BR cpg_zcb_free (3) ++.BR cpg_zcb_mcast_joined (3) ++.BR cpg_context_get (3) ++.BR cpg_context_set (3) ++.BR cpg_local_get (3) ++.BR cpg_model_initialize (3) ++ ++.PP +Index: man/Makefile.am +=================================================================== +--- man/Makefile.am (revision 2769) ++++ man/Makefile.am (revision 2770) +@@ -71,6 +71,7 @@ + cpg_leave.3 \ + cpg_local_get.3 \ + cpg_mcast_joined.3 \ ++ cpg_model_initialize.3 \ + cpg_zcb_mcast_joined.3 \ + cpg_zcb_alloc.3 \ + cpg_zcb_free.3 \ diff --git a/sources b/sources index 9f490cb..e99be3c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -cba5eb5da41630f53e54b90c449c056d corosync-1.2.1.tar.gz +03b8cc311619c07ae1a84a5d59f13d0b corosync-1.2.3.tar.gz From a976cdd22f6792258056460f23315bc615566986 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Mon, 5 Jul 2010 12:15:34 +0000 Subject: [PATCH 056/185] New upstream release --- .cvsignore | 2 +- corosync.spec | 26 ++++++++++++++++++++------ sources | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.cvsignore b/.cvsignore index 4c48ceb..4524b03 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -corosync-1.2.3.tar.gz +corosync-1.2.6.tar.gz diff --git a/corosync.spec b/corosync.spec index 8ff4113..0141caf 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.3 +Version: 1.2.6 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -25,7 +25,6 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 %if %{buildtrunk} BuildRequires: autoconf automake %endif - BuildRequires: nss-devel BuildRequires: libibverbs-devel librdmacm-devel @@ -35,6 +34,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %setup -q -n %{name}-%{version} %patch0 +%build %if %{buildtrunk} ./autogen.sh %endif @@ -46,9 +46,8 @@ export rdmacm_LIBS=-lrdmacm \ %{configure} \ --enable-nss \ --enable-rdma \ - --with-initddir=%{_initddir} + --with-initddir=%{_initrddir} -%build make %{_smp_mflags} %install @@ -70,7 +69,9 @@ This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. %post -/sbin/chkconfig --add corosync || : +if [ $1 -eq 1 ]; then + /sbin/chkconfig --add corosync || : +fi %preun if [ $1 -eq 0 ]; then @@ -93,7 +94,7 @@ fi %dir %{_sysconfdir}/corosync/service.d %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example -%{_initddir}/corosync +%{_initrddir}/corosync %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso %{_libexecdir}/lcrso/objdb.lcrso @@ -107,8 +108,17 @@ fi %{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso %dir %{_localstatedir}/lib/corosync +%dir %{_localstatedir}/log/cluster %{_mandir}/man8/corosync_overview.8* +%{_mandir}/man8/corosync.8* +%{_mandir}/man8/corosync-blackbox.8* %{_mandir}/man8/corosync-objctl.8* +%{_mandir}/man8/corosync-keygen.8* +%{_mandir}/man8/corosync-cfgtool.8* +%{_mandir}/man8/corosync-cpgtool.8* +%{_mandir}/man8/corosync-fplay.8* +%{_mandir}/man8/corosync-pload.8* +%{_mandir}/man8/corosync-quorumtool.8* %{_mandir}/man5/corosync.conf.5* %package -n corosynclib @@ -214,6 +224,10 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Mon Jul 5 2010 Fabio M. Di Nitto - 1.2.6-1 +- New upstream release +- Resync spec file with upstream changes + * Tue May 25 2010 Fabio M. Di Nitto - 1.2.3-1 - New upstream release - Rediff revision 2770 patch diff --git a/sources b/sources index e99be3c..a3a14c6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -03b8cc311619c07ae1a84a5d59f13d0b corosync-1.2.3.tar.gz +82d91373585f0d48cb98a8599a237e48 corosync-1.2.6.tar.gz From 39f48a390a032f960a0b35e9bef48d727e1c5d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 9 Jul 2010 11:10:57 +0000 Subject: [PATCH 057/185] - no InfiniBand stack on s390(x) --- corosync.spec | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 0141caf..c716be1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,7 +3,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.2.6 -Release: 1%{?alphatag:.%{alphatag}}%{?dist} +Release: 2%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -19,6 +19,13 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 # Build bits +# no InfiniBand stack on s390(x) +%ifarch s390 s390x +%define have_ib 0 +%else +%define have_ib 1 +%endif + %define buildtrunk 0 %{?_with_buildtrunk: %define buildtrunk 1} @@ -26,7 +33,9 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 BuildRequires: autoconf automake %endif BuildRequires: nss-devel +%if %{have_ib} BuildRequires: libibverbs-devel librdmacm-devel +%endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -39,13 +48,17 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) ./autogen.sh %endif +%if %{have_ib} export ibverbs_CFLAGS=-I/usr/include/infiniband \ export ibverbs_LIBS=-libverbs \ export rdmacm_CFLAGS=-I/usr/include/rdma \ export rdmacm_LIBS=-lrdmacm \ +%endif %{configure} \ --enable-nss \ +%if %{have_ib} --enable-rdma \ +%endif --with-initddir=%{_initrddir} make %{_smp_mflags} @@ -224,6 +237,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Fri Jul 9 2010 Dan Horák - 1.2.6-2 +- no InfiniBand stack on s390(x) + * Mon Jul 5 2010 Fabio M. Di Nitto - 1.2.6-1 - New upstream release - Resync spec file with upstream changes From 7d9ad2b86499086cf084757b8b69295dab6217b6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 28 Jul 2010 12:12:25 +0000 Subject: [PATCH 058/185] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - import.log | 2 -- 4 files changed, 24 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 030097c..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: corosync -# $Id$ -NAME := corosync -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index baa94ef..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-13 diff --git a/import.log b/import.log deleted file mode 100644 index f1ab5e0..0000000 --- a/import.log +++ /dev/null @@ -1,2 +0,0 @@ -corosync-0_92-1_fc10:HEAD:corosync-0.92-1.fc10.src.rpm:1222323286 -corosync-0_92-2_fc10:HEAD:corosync-0.92-2.fc10.src.rpm:1222462910 From 7f9f0d1107c1b00d5751015945394b311565ea12 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 28 Jul 2010 12:12:27 +0000 Subject: [PATCH 059/185] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - import.log | 2 -- 4 files changed, 24 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 030097c..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: corosync -# $Id$ -NAME := corosync -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index 06de2d2..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-12 diff --git a/import.log b/import.log deleted file mode 100644 index f1ab5e0..0000000 --- a/import.log +++ /dev/null @@ -1,2 +0,0 @@ -corosync-0_92-1_fc10:HEAD:corosync-0.92-1.fc10.src.rpm:1222323286 -corosync-0_92-2_fc10:HEAD:corosync-0.92-2.fc10.src.rpm:1222462910 From a0c530f3b1bf08e2f0fe42d6457290cf8eaba283 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 28 Jul 2010 12:12:28 +0000 Subject: [PATCH 060/185] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - import.log | 2 -- 4 files changed, 24 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 030097c..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: corosync -# $Id$ -NAME := corosync -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index dc32377..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-10 diff --git a/import.log b/import.log deleted file mode 100644 index f1ab5e0..0000000 --- a/import.log +++ /dev/null @@ -1,2 +0,0 @@ -corosync-0_92-1_fc10:HEAD:corosync-0.92-1.fc10.src.rpm:1222323286 -corosync-0_92-2_fc10:HEAD:corosync-0.92-2.fc10.src.rpm:1222462910 From 3425473f7bc3f44010decfbd61b1d7a538fce2cb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 28 Jul 2010 12:12:30 +0000 Subject: [PATCH 061/185] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- import.log | 2 -- 3 files changed, 23 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 030097c..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: corosync -# $Id$ -NAME := corosync -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/import.log b/import.log deleted file mode 100644 index f1ab5e0..0000000 --- a/import.log +++ /dev/null @@ -1,2 +0,0 @@ -corosync-0_92-1_fc10:HEAD:corosync-0.92-1.fc10.src.rpm:1222323286 -corosync-0_92-2_fc10:HEAD:corosync-0.92-2.fc10.src.rpm:1222462910 From cd479e973d156f4f816aed81e747b60621b522a0 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 30 Jul 2010 14:17:12 +0200 Subject: [PATCH 062/185] New upstream release --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4524b03..edd3ce7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ corosync-1.2.6.tar.gz +corosync-1.2.7.tar.gz diff --git a/corosync.spec b/corosync.spec index c716be1..e7a4863 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,8 +2,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.6 -Release: 2%{?alphatag:.%{alphatag}}%{?dist} +Version: 1.2.7 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -237,6 +237,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Thu Jul 29 2010 Fabio M. Di Nitto - 1.2.7-1 +- New upstream release + * Fri Jul 9 2010 Dan Horák - 1.2.6-2 - no InfiniBand stack on s390(x) diff --git a/sources b/sources index a3a14c6..bf975ce 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -82d91373585f0d48cb98a8599a237e48 corosync-1.2.6.tar.gz +a1f5b03512977d495819e2ed05ba645b corosync-1.2.7.tar.gz From 93320f7ff8b49d65e6d121f1f104b304155f1681 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Thu, 2 Sep 2010 09:28:44 +0200 Subject: [PATCH 063/185] New upstream release Signed-off-by: Fabio M. Di Nitto --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index edd3ce7..d12d7aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ corosync-1.2.6.tar.gz corosync-1.2.7.tar.gz +/corosync-1.2.8.tar.gz diff --git a/corosync.spec b/corosync.spec index e7a4863..f358790 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.7 +Version: 1.2.8 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -237,6 +237,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Thu Sep 2 2010 Fabio M. Di Nitto - 1.2.8-1 +- New upstream release + * Thu Jul 29 2010 Fabio M. Di Nitto - 1.2.7-1 - New upstream release diff --git a/sources b/sources index bf975ce..46c3b90 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a1f5b03512977d495819e2ed05ba645b corosync-1.2.7.tar.gz +43e97ef0d964ccb4063f40a4478eb679 corosync-1.2.8.tar.gz From 19fea9feb3104487fb1be1c9d5429e82eb64603a Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Thu, 2 Dec 2010 09:21:21 +0100 Subject: [PATCH 064/185] New upstream release Signed-off-by: Fabio M. Di Nitto --- .gitignore | 1 + corosync.spec | 11 +- revision-2770.patch | 811 -------------------------------------------- sources | 2 +- 4 files changed, 10 insertions(+), 815 deletions(-) delete mode 100644 revision-2770.patch diff --git a/.gitignore b/.gitignore index d12d7aa..1ce0b80 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ corosync-1.2.6.tar.gz corosync-1.2.7.tar.gz /corosync-1.2.8.tar.gz +/corosync-1.3.0.tar.gz diff --git a/corosync.spec b/corosync.spec index f358790..c4e16bf 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,13 +2,12 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.2.8 +Version: 1.3.0 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz -Patch0: revision-2770.patch # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -41,7 +40,6 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version} -%patch0 %build %if %{buildtrunk} @@ -96,6 +94,7 @@ fi %defattr(-,root,root,-) %doc LICENSE SECURITY %{_sbindir}/corosync +%{_bindir}/corosync-blackbox %{_sbindir}/corosync-keygen %{_sbindir}/corosync-objctl %{_sbindir}/corosync-cfgtool @@ -107,6 +106,7 @@ fi %dir %{_sysconfdir}/corosync/service.d %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example +%config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu %{_initrddir}/corosync %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso @@ -237,6 +237,11 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Thu Dec 2 2010 Fabio M. Di Nitto - 1.3.0-1 +- New upstream release +- drop upstream patch revision-2770.patch now included in release +- update spec file to ship corosync-blackbox + * Thu Sep 2 2010 Fabio M. Di Nitto - 1.2.8-1 - New upstream release diff --git a/revision-2770.patch b/revision-2770.patch deleted file mode 100644 index 766c980..0000000 --- a/revision-2770.patch +++ /dev/null @@ -1,811 +0,0 @@ -Index: include/corosync/ipc_cpg.h -=================================================================== ---- include/corosync/ipc_cpg.h (revision 2769) -+++ include/corosync/ipc_cpg.h (revision 2770) -@@ -65,6 +65,7 @@ - MESSAGE_RES_CPG_ITERATIONNEXT = 10, - MESSAGE_RES_CPG_ITERATIONFINALIZE = 11, - MESSAGE_RES_CPG_FINALIZE = 12, -+ MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK = 13, - }; - - enum lib_cpg_confchg_reason { -@@ -149,10 +150,24 @@ - marshall_from_mar_cpg_name_t (&dest->group, &src->group); - }; - -+typedef struct { -+ mar_uint32_t nodeid __attribute__((aligned(8))); -+ mar_uint64_t seq __attribute__((aligned(8))); -+} mar_cpg_ring_id_t; -+ -+static inline void marshall_from_mar_cpg_ring_id_t ( -+ struct cpg_ring_id *dest, -+ const mar_cpg_ring_id_t *src) -+{ -+ dest->nodeid = src->nodeid; -+ dest->seq = src->seq; -+} -+ - struct req_lib_cpg_join { - coroipc_request_header_t header __attribute__((aligned(8))); - mar_cpg_name_t group_name __attribute__((aligned(8))); - mar_uint32_t pid __attribute__((aligned(8))); -+ mar_uint32_t flags __attribute__((aligned(8))); - }; - - struct res_lib_cpg_join { -@@ -238,6 +253,13 @@ - // struct cpg_address joined_list[]; - }; - -+struct res_lib_cpg_totem_confchg_callback { -+ coroipc_response_header_t header __attribute__((aligned(8))); -+ mar_cpg_ring_id_t ring_id __attribute__((aligned(8))); -+ mar_uint32_t member_list_entries __attribute__((aligned(8))); -+ mar_uint32_t member_list[]; -+}; -+ - struct req_lib_cpg_leave { - coroipc_request_header_t header __attribute__((aligned(8))); - mar_cpg_name_t group_name __attribute__((aligned(8))); -Index: include/corosync/cpg.h -=================================================================== ---- include/corosync/cpg.h (revision 2769) -+++ include/corosync/cpg.h (revision 2770) -@@ -78,6 +78,10 @@ - CPG_ITERATION_ALL = 3, - } cpg_iteration_type_t; - -+typedef enum { -+ CPG_MODEL_V1 = 1, -+} cpg_model_t; -+ - struct cpg_address { - uint32_t nodeid; - uint32_t pid; -@@ -98,6 +102,11 @@ - uint32_t pid; - }; - -+struct cpg_ring_id { -+ uint32_t nodeid; -+ uint64_t seq; -+}; -+ - typedef void (*cpg_deliver_fn_t) ( - cpg_handle_t handle, - const struct cpg_name *group_name, -@@ -117,11 +126,32 @@ - const struct cpg_address *left_list, size_t left_list_entries, - const struct cpg_address *joined_list, size_t joined_list_entries); - -+typedef void (*cpg_totem_confchg_fn_t) ( -+ cpg_handle_t handle, -+ struct cpg_ring_id ring_id, -+ uint32_t member_list_entries, -+ const uint32_t *member_list); -+ - typedef struct { - cpg_deliver_fn_t cpg_deliver_fn; - cpg_confchg_fn_t cpg_confchg_fn; - } cpg_callbacks_t; - -+typedef struct { -+ cpg_model_t model; -+} cpg_model_data_t; -+ -+#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF 0x01 -+ -+typedef struct { -+ cpg_model_t model; -+ cpg_deliver_fn_t cpg_deliver_fn; -+ cpg_confchg_fn_t cpg_confchg_fn; -+ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; -+ unsigned int flags; -+} cpg_model_v1_data_t; -+ -+ - /** @} */ - - /* -@@ -132,6 +162,15 @@ - cpg_callbacks_t *callbacks); - - /* -+ * Create a new cpg connection, initialize with model -+ */ -+cs_error_t cpg_model_initialize ( -+ cpg_handle_t *handle, -+ cpg_model_t model, -+ cpg_model_data_t *model_data, -+ void *context); -+ -+/* - * Close the cpg handle - */ - cs_error_t cpg_finalize ( -Index: services/cpg.c -=================================================================== ---- services/cpg.c (revision 2769) -+++ services/cpg.c (revision 2770) -@@ -133,6 +133,8 @@ - mar_cpg_name_t group_name; - uint32_t pid; - enum cpd_state cpd_state; -+ unsigned int flags; -+ int initial_totem_conf_sent; - struct list_head list; - struct list_head iteration_instance_list_head; - }; -@@ -160,6 +162,8 @@ - - static enum cpg_sync_state my_sync_state = CPGSYNC_DOWNLIST; - -+static mar_cpg_ring_id_t last_sync_ring_id; -+ - struct process_info { - unsigned int nodeid; - uint32_t pid; -@@ -255,6 +259,11 @@ - - static void cpg_sync_abort (void); - -+static int notify_lib_totem_membership ( -+ void *conn, -+ int member_list_entries, -+ const unsigned int *member_list); -+ - /* - * Library Handler Definition - */ -@@ -432,6 +441,9 @@ - sizeof (unsigned int)); - my_member_list_entries = member_list_entries; - -+ last_sync_ring_id.nodeid = ring_id->rep.nodeid; -+ last_sync_ring_id.seq = ring_id->seq; -+ - for (i = 0; i < my_member_list_entries; i++) { - if (my_member_list[i] < lowest_nodeid) { - lowest_nodeid = my_member_list[i]; -@@ -482,14 +494,51 @@ - memcpy (my_old_member_list, my_member_list, - my_member_list_entries * sizeof (unsigned int)); - my_old_member_list_entries = my_member_list_entries; -+ -+ notify_lib_totem_membership (NULL, my_member_list_entries, my_member_list); - } - - static void cpg_sync_abort (void) - { - } - -+static int notify_lib_totem_membership ( -+ void *conn, -+ int member_list_entries, -+ const unsigned int *member_list) -+{ -+ struct list_head *iter; -+ char *buf; -+ int size; -+ struct res_lib_cpg_totem_confchg_callback *res; - -+ size = sizeof(struct res_lib_cpg_totem_confchg_callback) + -+ sizeof(mar_uint32_t) * (member_list_entries); -+ buf = alloca(size); -+ if (!buf) -+ return CPG_ERR_LIBRARY; - -+ res = (struct res_lib_cpg_totem_confchg_callback *)buf; -+ res->member_list_entries = member_list_entries; -+ res->header.size = size; -+ res->header.id = MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK; -+ res->header.error = CS_OK; -+ -+ memcpy (&res->ring_id, &last_sync_ring_id, sizeof (mar_cpg_ring_id_t)); -+ memcpy (res->member_list, member_list, res->member_list_entries * sizeof (mar_uint32_t)); -+ -+ if (conn == NULL) { -+ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { -+ struct cpg_pd *cpg_pd = list_entry (iter, struct cpg_pd, list); -+ api->ipc_dispatch_send (cpg_pd->conn, buf, size); -+ } -+ } else { -+ api->ipc_dispatch_send (conn, buf, size); -+ } -+ -+ return CPG_OK; -+} -+ - static int notify_lib_joinlist( - const mar_cpg_name_t *group_name, - void *conn, -@@ -604,6 +653,20 @@ - } - } - -+ -+ /* -+ * Traverse thru cpds and send totem membership for cpd, where it is not send yet -+ */ -+ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) { -+ struct cpg_pd *cpd = list_entry (iter, struct cpg_pd, list); -+ -+ if ((cpd->flags & CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF) && (cpd->initial_totem_conf_sent == 0)) { -+ cpd->initial_totem_conf_sent = 1; -+ -+ notify_lib_totem_membership (cpd->conn, my_old_member_list_entries, my_old_member_list); -+ } -+ } -+ - return CPG_OK; - } - -@@ -1093,6 +1156,7 @@ - error = CPG_OK; - cpd->cpd_state = CPD_STATE_JOIN_STARTED; - cpd->pid = req_lib_cpg_join->pid; -+ cpd->flags = req_lib_cpg_join->flags; - memcpy (&cpd->group_name, &req_lib_cpg_join->group_name, - sizeof (cpd->group_name)); - -Index: lib/cpg.c -=================================================================== ---- lib/cpg.c (revision 2769) -+++ lib/cpg.c (revision 2770) -@@ -62,8 +62,11 @@ - struct cpg_inst { - hdb_handle_t handle; - int finalize; -- cpg_callbacks_t callbacks; - void *context; -+ union { -+ cpg_model_data_t model_data; -+ cpg_model_v1_data_t model_v1_data; -+ }; - struct list_head iteration_list_head; - }; - -@@ -118,9 +121,32 @@ - cpg_handle_t *handle, - cpg_callbacks_t *callbacks) - { -+ cpg_model_v1_data_t model_v1_data; -+ -+ memset (&model_v1_data, 0, sizeof (cpg_model_v1_data_t)); -+ -+ if (callbacks) { -+ model_v1_data.cpg_deliver_fn = callbacks->cpg_deliver_fn; -+ model_v1_data.cpg_confchg_fn = callbacks->cpg_confchg_fn; -+ } -+ -+ return (cpg_model_initialize (handle, CPG_MODEL_V1, (cpg_model_data_t *)&model_v1_data, NULL)); -+} -+ -+cs_error_t cpg_model_initialize ( -+ cpg_handle_t *handle, -+ cpg_model_t model, -+ cpg_model_data_t *model_data, -+ void *context) -+{ - cs_error_t error; - struct cpg_inst *cpg_inst; - -+ if (model != CPG_MODEL_V1) { -+ error = CPG_ERR_INVALID_PARAM; -+ goto error_no_destroy; -+ } -+ - error = hdb_error_to_cs (hdb_handle_create (&cpg_handle_t_db, sizeof (struct cpg_inst), handle)); - if (error != CS_OK) { - goto error_no_destroy; -@@ -142,10 +168,26 @@ - goto error_put_destroy; - } - -- if (callbacks) { -- memcpy (&cpg_inst->callbacks, callbacks, sizeof (cpg_callbacks_t)); -+ if (model_data != NULL) { -+ switch (model) { -+ case CPG_MODEL_V1: -+ memcpy (&cpg_inst->model_v1_data, model_data, sizeof (cpg_model_v1_data_t)); -+ if ((cpg_inst->model_v1_data.flags & ~(CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF)) != 0) { -+ error = CS_ERR_INVALID_PARAM; -+ -+ goto error_destroy; -+ } -+ break; -+ default: -+ error = CS_ERR_LIBRARY; -+ goto error_destroy; -+ break; -+ } - } - -+ cpg_inst->model_data.model = model; -+ cpg_inst->context = context; -+ - list_init(&cpg_inst->iteration_list_head); - - hdb_handle_put (&cpg_handle_t_db, *handle); -@@ -283,7 +325,8 @@ - struct cpg_inst *cpg_inst; - struct res_lib_cpg_confchg_callback *res_cpg_confchg_callback; - struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback; -- cpg_callbacks_t callbacks; -+ struct res_lib_cpg_totem_confchg_callback *res_cpg_totem_confchg_callback; -+ struct cpg_inst cpg_inst_copy; - coroipc_response_header_t *dispatch_data; - struct cpg_address member_list[CPG_MEMBERS_MAX]; - struct cpg_address left_list[CPG_MEMBERS_MAX]; -@@ -292,6 +335,8 @@ - mar_cpg_address_t *left_list_start; - mar_cpg_address_t *joined_list_start; - unsigned int i; -+ struct cpg_ring_id ring_id; -+ uint32_t totem_member_list[CPG_MEMBERS_MAX]; - - error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst)); - if (error != CS_OK) { -@@ -332,74 +377,96 @@ - * A risk of this dispatch method is that the callback routines may - * operate at the same time that cpgFinalize has been called. - */ -- memcpy (&callbacks, &cpg_inst->callbacks, sizeof (cpg_callbacks_t)); -- /* -- * Dispatch incoming message -- */ -- switch (dispatch_data->id) { -- case MESSAGE_RES_CPG_DELIVER_CALLBACK: -- if (callbacks.cpg_deliver_fn == NULL) { -+ memcpy (&cpg_inst_copy, cpg_inst, sizeof (struct cpg_inst)); -+ -+ switch (cpg_inst_copy.model_data.model) { -+ case CPG_MODEL_V1: -+ /* -+ * Dispatch incoming message -+ */ -+ switch (dispatch_data->id) { -+ case MESSAGE_RES_CPG_DELIVER_CALLBACK: -+ if (cpg_inst_copy.model_v1_data.cpg_deliver_fn == NULL) { -+ break; -+ } -+ -+ res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; -+ -+ marshall_from_mar_cpg_name_t ( -+ &group_name, -+ &res_cpg_deliver_callback->group_name); -+ -+ cpg_inst_copy.model_v1_data.cpg_deliver_fn (handle, -+ &group_name, -+ res_cpg_deliver_callback->nodeid, -+ res_cpg_deliver_callback->pid, -+ &res_cpg_deliver_callback->message, -+ res_cpg_deliver_callback->msglen); - break; -- } - -- res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data; -+ case MESSAGE_RES_CPG_CONFCHG_CALLBACK: -+ if (cpg_inst_copy.model_v1_data.cpg_confchg_fn == NULL) { -+ break; -+ } - -- marshall_from_mar_cpg_name_t ( -- &group_name, -- &res_cpg_deliver_callback->group_name); -+ res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; - -- callbacks.cpg_deliver_fn (handle, -- &group_name, -- res_cpg_deliver_callback->nodeid, -- res_cpg_deliver_callback->pid, -- &res_cpg_deliver_callback->message, -- res_cpg_deliver_callback->msglen); -- break; -+ for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { -+ marshall_from_mar_cpg_address_t (&member_list[i], -+ &res_cpg_confchg_callback->member_list[i]); -+ } -+ left_list_start = res_cpg_confchg_callback->member_list + -+ res_cpg_confchg_callback->member_list_entries; -+ for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { -+ marshall_from_mar_cpg_address_t (&left_list[i], -+ &left_list_start[i]); -+ } -+ joined_list_start = res_cpg_confchg_callback->member_list + -+ res_cpg_confchg_callback->member_list_entries + -+ res_cpg_confchg_callback->left_list_entries; -+ for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { -+ marshall_from_mar_cpg_address_t (&joined_list[i], -+ &joined_list_start[i]); -+ } -+ marshall_from_mar_cpg_name_t ( -+ &group_name, -+ &res_cpg_confchg_callback->group_name); - -- case MESSAGE_RES_CPG_CONFCHG_CALLBACK: -- if (callbacks.cpg_confchg_fn == NULL) { -+ cpg_inst_copy.model_v1_data.cpg_confchg_fn (handle, -+ &group_name, -+ member_list, -+ res_cpg_confchg_callback->member_list_entries, -+ left_list, -+ res_cpg_confchg_callback->left_list_entries, -+ joined_list, -+ res_cpg_confchg_callback->joined_list_entries); -+ - break; -- } -+ case MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK: -+ if (cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn == NULL) { -+ break; -+ } - -- res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data; -+ res_cpg_totem_confchg_callback = (struct res_lib_cpg_totem_confchg_callback *)dispatch_data; - -- for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) { -- marshall_from_mar_cpg_address_t (&member_list[i], -- &res_cpg_confchg_callback->member_list[i]); -- } -- left_list_start = res_cpg_confchg_callback->member_list + -- res_cpg_confchg_callback->member_list_entries; -- for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) { -- marshall_from_mar_cpg_address_t (&left_list[i], -- &left_list_start[i]); -- } -- joined_list_start = res_cpg_confchg_callback->member_list + -- res_cpg_confchg_callback->member_list_entries + -- res_cpg_confchg_callback->left_list_entries; -- for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) { -- marshall_from_mar_cpg_address_t (&joined_list[i], -- &joined_list_start[i]); -- } -- marshall_from_mar_cpg_name_t ( -- &group_name, -- &res_cpg_confchg_callback->group_name); -+ marshall_from_mar_cpg_ring_id_t (&ring_id, &res_cpg_totem_confchg_callback->ring_id); -+ for (i = 0; i < res_cpg_totem_confchg_callback->member_list_entries; i++) { -+ totem_member_list[i] = res_cpg_totem_confchg_callback->member_list[i]; -+ } - -- callbacks.cpg_confchg_fn (handle, -- &group_name, -- member_list, -- res_cpg_confchg_callback->member_list_entries, -- left_list, -- res_cpg_confchg_callback->left_list_entries, -- joined_list, -- res_cpg_confchg_callback->joined_list_entries); -- break; -- -- default: -- coroipcc_dispatch_put (cpg_inst->handle); -- error = CS_ERR_LIBRARY; -- goto error_put; -- break; -- } -+ cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn (handle, -+ ring_id, -+ res_cpg_totem_confchg_callback->member_list_entries, -+ totem_member_list); -+ break; -+ default: -+ coroipcc_dispatch_put (cpg_inst->handle); -+ error = CS_ERR_LIBRARY; -+ goto error_put; -+ break; -+ } /* - switch (dispatch_data->id) */ -+ break; /* case CPG_MODEL_V1 */ -+ } /* - switch (cpg_inst_copy.model_data.model) */ - coroipcc_dispatch_put (cpg_inst->handle); - - /* -@@ -434,6 +501,14 @@ - req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join); - req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN; - req_lib_cpg_join.pid = getpid(); -+ req_lib_cpg_join.flags = 0; -+ -+ switch (cpg_inst->model_data.model) { -+ case CPG_MODEL_V1: -+ req_lib_cpg_join.flags = cpg_inst->model_v1_data.flags; -+ break; -+ } -+ - marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name, - group); - -Index: lib/libcpg.verso -=================================================================== ---- lib/libcpg.verso (revision 2769) -+++ lib/libcpg.verso (revision 2770) -@@ -1 +1 @@ --4.0.1 -+4.1.0 -Index: man/cpg_initialize.3 -=================================================================== ---- man/cpg_initialize.3 (revision 2769) -+++ man/cpg_initialize.3 (revision 2770) -@@ -41,7 +41,10 @@ - .SH DESCRIPTION - The - .B cpg_initialize --function is used to initialize a connection to the closed process groups API. -+function is used to initialize a connection to the closed process groups API. This function is deprecated -+and -+.B cpg_model_initialize -+should be used in newly written code. - .PP - Each application may have several connections to the CPG API. Each application - uses the -@@ -167,5 +170,6 @@ - .BR cpg_context_get (3) - .BR cpg_context_set (3) - .BR cpg_local_get (3) -+.BR cpg_model_initialize (3) - - .PP -Index: man/cpg_overview.8 -=================================================================== ---- man/cpg_overview.8 (revision 2769) -+++ man/cpg_overview.8 (revision 2770) -@@ -61,6 +61,7 @@ - .BR cpg_join (3), - .BR cpg_leave (3), - .BR cpg_mcast_joined (3), -+.BR cpg_model_initialize (3), - .BR cpg_membership_get (3) - .BR cpg_zcb_alloc (3) - .BR cpg_zcb_free (3) -Index: man/cpg_model_initialize.3 -=================================================================== ---- man/cpg_model_initialize.3 (revision 0) -+++ man/cpg_model_initialize.3 (revision 2770) -@@ -0,0 +1,231 @@ -+.\"/* -+.\" * Copyright (c) 2010 Red Hat, Inc. -+.\" * -+.\" * All rights reserved. -+.\" * -+.\" * Author: Jan Friesse -+.\" * Author: Christine Caulfield -+.\" * -+.\" * 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. -+.\" */ -+.TH CPG_MODEL_INITIALIZE 3 2010-04-07 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.SH NAME -+cpg_model_initialize \- Create a new connection to the CPG service -+.SH SYNOPSIS -+.B #include -+.sp -+.BI "cs_error_t cpg_model_initialize(cpg_handle_t *" handle ", cpg_model_t " model ", cpg_model_data_t *" model_data ", void *" context "); -+ -+.SH DESCRIPTION -+The -+.B cpg_model_initialize -+function is used to initialize a connection to the closed process groups API. -+.PP -+Each application may have several connections to the CPG API. Each application -+uses the -+.I handle -+argument to uniquely identify the connection. The -+.I handle -+argument is then used in other function calls to identify the connection to be used -+for communication with the CPG service. -+.PP -+Argument -+.I model -+is used to explicitly choose set of callbacks and internal parameters. Currently only model -+.I CPG_MODEL_V1 -+is defined. -+.PP -+Callbacks and internal parameters are passed by -+.I model_data -+argument. This is casted pointer (idea is similar as in sockaddr function) to one of structures -+corresponding to chosen model. Currently only -+.I cpg_model_v1_data_t -+is needed. -+.SH MODEL_V1 -+The -+.I MODEL_V1 -+is backwards compatible with original callbacks initialized by -+.I cpg_initialize -+but new callback -+.I cpg_totem_confchg_fn -+is defined. -+.PP -+Every time an CPG event occurs within the joined group, one of the callbacks specified by the argument -+.I callbacks -+is called. The callback functions are described by the following type definitions: -+.PP -+.PP -+.IP -+.RS -+.ne 18 -+.nf -+.ta 4n 20n 32n -+ -+typedef void (*cpg_deliver_fn_t) ( -+ cpg_handle_t handle, -+ const struct cpg_name *group_name, -+ uint32_t nodeid, -+ uint32_t pid, -+ const void *msg, -+ size_t msg_len); -+ -+ -+typedef void (*cpg_confchg_fn_t) ( -+ cpg_handle_t handle, -+ const struct cpg_name *group_name, -+ const struct cpg_address *member_list, size_t member_list_entries, -+ const struct cpg_address *left_list, size_t left_list_entries, -+ const struct cpg_address *joined_list, size_t joined_list_entries); -+ -+ -+typedef void (*cpg_totem_confchg_fn_t) ( -+ cpg_handle_t handle, -+ struct cpg_ring_id ring_id, -+ uint32_t member_list_entries, -+ const uint32_t *member_list); -+.ta -+.fi -+.RE -+.IP -+.PP -+.PP -+The -+.I cpg_model_v1_data_t -+structure is defined as: -+.IP -+.RS -+.ne 18 -+.nf -+.PP -+typedef struct { -+ cpg_model_t model; -+ cpg_deliver_fn_t cpg_deliver_fn; -+ cpg_confchg_fn_t cpg_confchg_fn; -+ cpg_totem_confchg_fn_t cpg_totem_confchg_fn; -+ unsigned int flags; -+} cpg_model_v1_data_t; -+.ta -+.fi -+.RE -+.IP -+.PP -+When a configuration change occurs or a message is to be delivered one of the callbacks -+is called from the -+.B cpg_dispatch() -+function. If a configuration change occurs, -+.I cpg_confchg_fn -+is called. If a delivery of a message occurs, -+.I cpg_deliver_fn -+is called. -+When totem membership change occurs, -+.I cpg_totem_confchg_fn -+is called. You can OR -+.I CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF -+constant to flags to get callback after first confchg event. -+ -+The -+.I cpg_address -+structure is defined -+.IP -+.RS -+.ne 18 -+.nf -+.PP -+struct cpg_address { -+ unsigned int nodeid; -+ unsigned int pid; -+ unsigned int reason; -+}; -+.ta -+.fi -+.RE -+.IP -+.PP -+where nodeid is a 32 bit unique node identifier, pid is the process ID of the process that has joined/left the group -+or sent the message, and reason is an integer code indicating why the node joined/left the group. -+.PP -+.IP -+.RS -+.ne 18 -+.nf -+.PP -+CPG_REASON_JOIN - the process joined a group using cpg_join(). -+CPG_REASON_LEAVE - the process left a group using cpg_leave() -+CPG_REASON_NODEDOWN - the process left a group because the node left the cluster. -+CPG_REASON_NODEUP - the process joined a group because it was already a member of a group on a node that has just joined the cluster -+CPG_REASON_PROCDOWN - the process left a group without calling cpg_leave() -+.ta -+.fi -+.RE -+.IP -+.PP -+The -+.I cpg_ring_id -+structure is defined -+.IP -+.RS -+.ne 18 -+.nf -+.PP -+struct cpg_ring_id { -+ uint32_t nodeid; -+ uint64_t seq; -+}; -+.ta -+.fi -+.RE -+.IP -+.PP -+where -+.I nodeid -+is if of node of current Totem leader and seq is increasing number. -+ -+.PP -+.SH RETURN VALUE -+This call returns the CPG_OK value if successful, otherwise an error is returned. -+.PP -+.SH ERRORS -+The errors are undocumented. -+.SH "SEE ALSO" -+.BR cpg_overview (8), -+.BR cpg_initialize (3), -+.BR cpg_finalize (3), -+.BR cpg_fd_get (3), -+.BR cpg_dispatch (3), -+.BR cpg_join (3), -+.BR cpg_leave (3), -+.BR cpg_mcast_joined (3), -+.BR cpg_membership_get (3) -+.BR cpg_zcb_alloc (3) -+.BR cpg_zcb_free (3) -+.BR cpg_zcb_mcast_joined (3) -+.BR cpg_context_get (3) -+.BR cpg_context_set (3) -+.BR cpg_local_get (3) -+.BR cpg_model_initialize (3) -+ -+.PP -Index: man/Makefile.am -=================================================================== ---- man/Makefile.am (revision 2769) -+++ man/Makefile.am (revision 2770) -@@ -71,6 +71,7 @@ - cpg_leave.3 \ - cpg_local_get.3 \ - cpg_mcast_joined.3 \ -+ cpg_model_initialize.3 \ - cpg_zcb_mcast_joined.3 \ - cpg_zcb_alloc.3 \ - cpg_zcb_free.3 \ diff --git a/sources b/sources index 46c3b90..ee13c94 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -43e97ef0d964ccb4063f40a4478eb679 corosync-1.2.8.tar.gz +66a527d668b0f908db89be26c83ca7d6 corosync-1.3.0.tar.gz From 5721f27cd08890b35a344f3b73d8f39fa3e8ddc2 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Tue, 8 Feb 2011 05:30:07 -0600 Subject: [PATCH 065/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index c4e16bf..21c9f87 100644 --- a/corosync.spec +++ b/corosync.spec @@ -3,7 +3,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.3.0 -Release: 1%{?alphatag:.%{alphatag}}%{?dist} +Release: 2%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -237,6 +237,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Tue Feb 08 2011 Fedora Release Engineering - 1.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + * Thu Dec 2 2010 Fabio M. Di Nitto - 1.3.0-1 - New upstream release - drop upstream patch revision-2770.patch now included in release From aa72b1c0dabdee1650b565d78d158bb7b057e52a Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 10 May 2011 12:00:28 +0200 Subject: [PATCH 066/185] New upstream release Signed-off-by: Fabio M. Di Nitto --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1ce0b80..1d7e098 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ corosync-1.2.6.tar.gz corosync-1.2.7.tar.gz /corosync-1.2.8.tar.gz /corosync-1.3.0.tar.gz +/corosync-1.3.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 21c9f87..b797f12 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,8 +2,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.3.0 -Release: 2%{?alphatag:.%{alphatag}}%{?dist} +Version: 1.3.1 +Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -237,6 +237,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Tue May 10 2011 Fabio M. Di Nitto - 1.3.1-1 +- New upstream release + * Tue Feb 08 2011 Fedora Release Engineering - 1.3.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild diff --git a/sources b/sources index ee13c94..d06f5d1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -66a527d668b0f908db89be26c83ca7d6 corosync-1.3.0.tar.gz +c58459a009a3a9d0b9c00e276a190d90 corosync-1.3.1.tar.gz From 8f4d39243baecbf3ce8161969af9e3ed4e81464c Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 8 Jul 2011 10:10:54 +0200 Subject: [PATCH 067/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1d7e098..95b202d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ corosync-1.2.7.tar.gz /corosync-1.2.8.tar.gz /corosync-1.3.0.tar.gz /corosync-1.3.1.tar.gz +/corosync-1.3.2.tar.gz diff --git a/corosync.spec b/corosync.spec index b797f12..6c1d6fc 100644 --- a/corosync.spec +++ b/corosync.spec @@ -2,7 +2,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.3.1 +Version: 1.3.2 Release: 1%{?alphatag:.%{alphatag}}%{?dist} License: BSD Group: System Environment/Base @@ -237,6 +237,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Fri Jul 08 2011 Jan Friesse - 1.3.2-1 +- New upstream release + * Tue May 10 2011 Fabio M. Di Nitto - 1.3.1-1 - New upstream release diff --git a/sources b/sources index d06f5d1..ca34dad 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c58459a009a3a9d0b9c00e276a190d90 corosync-1.3.1.tar.gz +81cde28b070043b9a862ab4a333f52ba corosync-1.3.2.tar.gz From 774717140726046610a65659fabec51e5d7a3ce3 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 19 Jul 2011 16:45:40 +0200 Subject: [PATCH 068/185] New upstream release Spec file is also changed to reflect upstream changes Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 75 ++++++++++++++++++++++++++++++++++++++++----------- sources | 2 +- 3 files changed, 61 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 95b202d..d3d40fc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ corosync-1.2.7.tar.gz /corosync-1.3.0.tar.gz /corosync-1.3.1.tar.gz /corosync-1.3.2.tar.gz +/corosync-1.4.0.tar.gz diff --git a/corosync.spec b/corosync.spec index 6c1d6fc..16880e1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,13 +1,24 @@ -# global alphatag svn1211 +# Conditionals +# Invoke "rpmbuild --without " or "rpmbuild --with " +# to disable or enable specific features +%bcond_with testagents +%bcond_with watchdog +%bcond_with monitoring +%bcond_without snmp +%bcond_without dbus +# no InfiniBand stack on s390(x) +%ifnarch s390 s390x +%bcond_without rdma +%endif Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.3.2 -Release: 1%{?alphatag:.%{alphatag}}%{?dist} +Version: 1.4.0 +Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org -Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz +Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -18,13 +29,6 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 # Build bits -# no InfiniBand stack on s390(x) -%ifarch s390 s390x -%define have_ib 0 -%else -%define have_ib 1 -%endif - %define buildtrunk 0 %{?_with_buildtrunk: %define buildtrunk 1} @@ -32,21 +36,27 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89 BuildRequires: autoconf automake %endif BuildRequires: nss-devel -%if %{have_ib} +%if %{with rdma} BuildRequires: libibverbs-devel librdmacm-devel %endif +%if %{with snmp} +BuildRequires: net-snmp-devel +%endif +%if %{with dbus} +BuildRequires: dbus-devel +%endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep -%setup -q -n %{name}-%{version} +%setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} %build %if %{buildtrunk} ./autogen.sh %endif -%if %{have_ib} +%if %{with rdma} export ibverbs_CFLAGS=-I/usr/include/infiniband \ export ibverbs_LIBS=-libverbs \ export rdmacm_CFLAGS=-I/usr/include/rdma \ @@ -54,7 +64,22 @@ export rdmacm_LIBS=-lrdmacm \ %endif %{configure} \ --enable-nss \ -%if %{have_ib} +%if %{with testagents} + --enable-testagents \ +%endif +%if %{with watchdog} + --enable-watchdog \ +%endif +%if %{with monitoring} + --enable-monitoring \ +%endif +%if %{with snmp} + --enable-snmp \ +%endif +%if %{with dbus} + --enable-dbus \ +%endif +%if %{with rdma} --enable-rdma \ %endif --with-initddir=%{_initrddir} @@ -66,6 +91,11 @@ rm -rf %{buildroot} make install DESTDIR=%{buildroot} +%if %{with dbus} +mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d +install -m 644 %{_builddir}/%{name}-%{version}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf +%endif + ## tree fixup # drop static libs rm -f %{buildroot}%{_libdir}/*.a @@ -93,8 +123,8 @@ fi %files %defattr(-,root,root,-) %doc LICENSE SECURITY -%{_sbindir}/corosync %{_bindir}/corosync-blackbox +%{_sbindir}/corosync %{_sbindir}/corosync-keygen %{_sbindir}/corosync-objctl %{_sbindir}/corosync-cfgtool @@ -102,12 +132,20 @@ fi %{_sbindir}/corosync-pload %{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-quorumtool +%{_sbindir}/corosync-notifyd %dir %{_sysconfdir}/corosync %dir %{_sysconfdir}/corosync/service.d %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu +%if %{with dbus} +%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf +%endif +%if %{with snmp} +%{_datadir}/snmp/mibs/COROSYNC-MIB.txt +%endif %{_initrddir}/corosync +%{_initrddir}/corosync-notifyd %dir %{_libexecdir}/lcrso %{_libexecdir}/lcrso/coroparse.lcrso %{_libexecdir}/lcrso/objdb.lcrso @@ -131,6 +169,7 @@ fi %{_mandir}/man8/corosync-cpgtool.8* %{_mandir}/man8/corosync-fplay.8* %{_mandir}/man8/corosync-pload.8* +%{_mandir}/man8/corosync-notifyd.8* %{_mandir}/man8/corosync-quorumtool.8* %{_mandir}/man5/corosync.conf.5* @@ -237,6 +276,10 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Wed Jul 19 2011 Jan Friesse - 1.4.0-1 +- New upstream release +- Resync spec file with upstream changes + * Fri Jul 08 2011 Jan Friesse - 1.3.2-1 - New upstream release diff --git a/sources b/sources index ca34dad..b7d45bc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -81cde28b070043b9a862ab4a333f52ba corosync-1.3.2.tar.gz +b833913dd35b047b7fea329e4f1b133c corosync-1.4.0.tar.gz From 241d0f47c57033142cf663241516196004fce036 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 20 Jul 2011 13:54:22 +0200 Subject: [PATCH 069/185] Change attributes of cluster log directory Signed-off-by: Jan Friesse --- corosync.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 16880e1..e898293 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,7 +14,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.4.0 -Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -159,6 +159,7 @@ fi %{_libexecdir}/lcrso/vsf_quorum.lcrso %{_libexecdir}/lcrso/vsf_ykd.lcrso %dir %{_localstatedir}/lib/corosync +%attr(700, root, root) %{_localstatedir}/log/cluster %dir %{_localstatedir}/log/cluster %{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync.8* @@ -276,6 +277,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Wed Jul 20 2011 Jan Friesse - 1.4.0-2 +- Change attributes of cluster log directory + * Wed Jul 19 2011 Jan Friesse - 1.4.0-1 - New upstream release - Resync spec file with upstream changes From a9111fec33a85070800bfb2987a28ed191a6cf89 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 26 Jul 2011 10:24:59 +0200 Subject: [PATCH 070/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d3d40fc..3cd6472 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ corosync-1.2.7.tar.gz /corosync-1.3.1.tar.gz /corosync-1.3.2.tar.gz /corosync-1.4.0.tar.gz +/corosync-1.4.1.tar.gz diff --git a/corosync.spec b/corosync.spec index e898293..7f3ff28 100644 --- a/corosync.spec +++ b/corosync.spec @@ -13,8 +13,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.4.0 -Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Version: 1.4.1 +Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -277,6 +277,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Tue Jul 26 2011 Jan Friesse - 1.4.1-1 +- New upstream release + * Wed Jul 20 2011 Jan Friesse - 1.4.0-2 - Change attributes of cluster log directory diff --git a/sources b/sources index b7d45bc..ec31e29 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b833913dd35b047b7fea329e4f1b133c corosync-1.4.0.tar.gz +66231146af210637393748add091021d corosync-1.4.1.tar.gz From f0be19d9dbf28c2dff0cefde0821f60398d59009 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 8 Sep 2011 10:00:35 +0200 Subject: [PATCH 071/185] Import fixes from upstream Signed-off-by: Jan Friesse --- ...oin-messages-during-flush-operations.patch | 58 ++++++++ corosync.spec | 14 +- ...ndless-loop-if-all-ifaces-are-faulty.patch | 85 +++++++++++ ...-threshold-in-passive-mode-for-mcast.patch | 140 ++++++++++++++++++ ...mconfig-change-minimum-RRP-threshold.patch | 30 ++++ 5 files changed, 326 insertions(+), 1 deletion(-) create mode 100644 Ignore-memb_join-messages-during-flush-operations.patch create mode 100644 rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch create mode 100644 rrp-Higher-threshold-in-passive-mode-for-mcast.patch create mode 100644 totemconfig-change-minimum-RRP-threshold.patch diff --git a/Ignore-memb_join-messages-during-flush-operations.patch b/Ignore-memb_join-messages-during-flush-operations.patch new file mode 100644 index 0000000..906f28b --- /dev/null +++ b/Ignore-memb_join-messages-during-flush-operations.patch @@ -0,0 +1,58 @@ +From be608c050247e5f9c8266b8a0f9803cc0a3dc881 Mon Sep 17 00:00:00 2001 +From: Steven Dake +Date: Tue, 30 Aug 2011 22:25:21 -0700 +Subject: [PATCH] Ignore memb_join messages during flush operations + +a memb_join operation that occurs during flushing can result in an +entry into the GATHER state from the RECOVERY state. This results in the +regular sort queue being used instead of the recovery sort queue, resulting +in segfault. + +Signed-off-by: Steven Dake +Reviewed-by: Jan Friesse +(cherry picked from commit 48ffa8892daac18935d96ae46a72aebe2fb70430) +--- + exec/totemudp.c | 13 +++++++++++++ + 1 files changed, 13 insertions(+), 0 deletions(-) + +diff --git a/exec/totemudp.c b/exec/totemudp.c +index 96849b7..0c12b56 100644 +--- a/exec/totemudp.c ++++ b/exec/totemudp.c +@@ -90,6 +90,8 @@ + #define BIND_STATE_REGULAR 1 + #define BIND_STATE_LOOPBACK 2 + ++#define MESSAGE_TYPE_MCAST 1 ++ + #define HMAC_HASH_SIZE 20 + struct security_header { + unsigned char hash_digest[HMAC_HASH_SIZE]; /* The hash *MUST* be first in the data structure */ +@@ -1172,6 +1174,7 @@ static int net_deliver_fn ( + int res = 0; + unsigned char *msg_offset; + unsigned int size_delv; ++ char *message_type; + + if (instance->flushing == 1) { + iovec = &instance->totemudp_iov_recv_flush; +@@ -1234,6 +1237,16 @@ static int net_deliver_fn ( + } + + /* ++ * Drop all non-mcast messages (more specifically join ++ * messages should be dropped) ++ */ ++ message_type = (char *)msg_offset; ++ if (instance->flushing == 1 && *message_type != MESSAGE_TYPE_MCAST) { ++ iovec->iov_len = FRAME_SIZE_MAX; ++ return (0); ++ } ++ ++ /* + * Handle incoming message + */ + instance->totemudp_deliver_fn ( +-- +1.7.1 + diff --git a/corosync.spec b/corosync.spec index 7f3ff28..9bd7946 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,12 +14,17 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.4.1 -Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz +Patch0: rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch +Patch1: rrp-Higher-threshold-in-passive-mode-for-mcast.patch +Patch2: Ignore-memb_join-messages-during-flush-operations.patch +Patch3: totemconfig-change-minimum-RRP-threshold.patch + # Runtime bits Requires: corosynclib = %{version}-%{release} Requires(pre): /usr/sbin/useradd @@ -50,6 +55,10 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %if %{buildtrunk} @@ -277,6 +286,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Thu Sep 08 2011 Jan Friesse - 1.4.1-2 +- Add upstream fixes + * Tue Jul 26 2011 Jan Friesse - 1.4.1-1 - New upstream release diff --git a/rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch b/rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch new file mode 100644 index 0000000..7c70e9b --- /dev/null +++ b/rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch @@ -0,0 +1,85 @@ +From dc862e15cc084926eccc5e1ff3241611c0cb54f0 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Mon, 29 Aug 2011 10:44:05 +0200 +Subject: [PATCH] rrp: Handle endless loop if all ifaces are faulty + +If all interfaces were faulty, passive_mcast_flush_send and related +functions ended in endless loop. This is now handled and if there is no +live interface, message is dropped. + +Signed-off-by: Jan Friesse +Reviewed by: Steven Dake +(cherry picked from commit 0eade8de79b6e5b28e91604d4d460627c7a61ddd) +--- + exec/totemrrp.c | 29 ++++++++++++++++++++--------- + 1 files changed, 20 insertions(+), 9 deletions(-) + +diff --git a/exec/totemrrp.c b/exec/totemrrp.c +index 83292ad..a5abb1b 100644 +--- a/exec/totemrrp.c ++++ b/exec/totemrrp.c +@@ -1015,12 +1015,16 @@ static void passive_mcast_flush_send ( + unsigned int msg_len) + { + struct passive_instance *passive_instance = (struct passive_instance *)instance->rrp_algo_instance; ++ int i = 0; + + do { + passive_instance->msg_xmit_iface = (passive_instance->msg_xmit_iface + 1) % instance->interface_count; +- } while (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1); ++ i++; ++ } while ((i <= instance->interface_count) && (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1)); + +- totemnet_mcast_flush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); ++ if (i <= instance->interface_count) { ++ totemnet_mcast_flush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); ++ } + } + + static void passive_mcast_noflush_send ( +@@ -1029,13 +1033,16 @@ static void passive_mcast_noflush_send ( + unsigned int msg_len) + { + struct passive_instance *passive_instance = (struct passive_instance *)instance->rrp_algo_instance; ++ int i = 0; + + do { + passive_instance->msg_xmit_iface = (passive_instance->msg_xmit_iface + 1) % instance->interface_count; +- } while (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1); +- ++ i++; ++ } while ((i <= instance->interface_count) && (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1)); + +- totemnet_mcast_noflush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); ++ if (i <= instance->interface_count) { ++ totemnet_mcast_noflush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); ++ } + } + + static void passive_token_recv ( +@@ -1070,14 +1077,18 @@ static void passive_token_send ( + unsigned int msg_len) + { + struct passive_instance *passive_instance = (struct passive_instance *)instance->rrp_algo_instance; ++ int i = 0; + + do { + passive_instance->token_xmit_iface = (passive_instance->token_xmit_iface + 1) % instance->interface_count; +- } while (passive_instance->faulty[passive_instance->token_xmit_iface] == 1); ++ i++; ++ } while ((i <= instance->interface_count) && (passive_instance->faulty[passive_instance->token_xmit_iface] == 1)); + +- totemnet_token_send ( +- instance->net_handles[passive_instance->token_xmit_iface], +- msg, msg_len); ++ if (i <= instance->interface_count) { ++ totemnet_token_send ( ++ instance->net_handles[passive_instance->token_xmit_iface], ++ msg, msg_len); ++ } + + } + +-- +1.7.1 + diff --git a/rrp-Higher-threshold-in-passive-mode-for-mcast.patch b/rrp-Higher-threshold-in-passive-mode-for-mcast.patch new file mode 100644 index 0000000..3b52bac --- /dev/null +++ b/rrp-Higher-threshold-in-passive-mode-for-mcast.patch @@ -0,0 +1,140 @@ +From 4e32c3112a2f13a302709d72b0ae989287a48563 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Mon, 29 Aug 2011 15:09:52 +0200 +Subject: [PATCH] rrp: Higher threshold in passive mode for mcast + +There were too much false positives with passive mode rrp when high +number of messages were received. + +Patch adds new configurable variable rrp_problem_count_mcast_threshold +which is by default 10 times rrp_problem_count_threshold and this is +used as threshold for multicast packets in passive mode. Variable is +unused in active mode. + +Signed-off-by: Jan Friesse +Reviewed by: Steven Dake +(cherry picked from commit 752239eaa1edd68695a6e40bcde60471f34a02fd) +--- + exec/totemconfig.c | 11 +++++++++++ + exec/totemrrp.c | 6 ++++-- + exec/totemsrp.c | 3 +++ + include/corosync/totem/totem.h | 2 ++ + man/corosync.conf.5 | 8 ++++++++ + 5 files changed, 28 insertions(+), 2 deletions(-) + +diff --git a/exec/totemconfig.c b/exec/totemconfig.c +index 80ca182..f767f69 100644 +--- a/exec/totemconfig.c ++++ b/exec/totemconfig.c +@@ -213,6 +213,8 @@ static void totem_volatile_config_read ( + + objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_threshold", &totem_config->rrp_problem_count_threshold); + ++ objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_mcast_threshold", &totem_config->rrp_problem_count_mcast_threshold); ++ + objdb_get_int (objdb,object_totem_handle, "rrp_autorecovery_check_timeout", &totem_config->rrp_autorecovery_check_timeout); + + objdb_get_int (objdb,object_totem_handle, "heartbeat_failures_allowed", &totem_config->heartbeat_failures_allowed); +@@ -667,12 +669,21 @@ int totem_config_validate ( + if (totem_config->rrp_problem_count_threshold == 0) { + totem_config->rrp_problem_count_threshold = RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT; + } ++ if (totem_config->rrp_problem_count_mcast_threshold == 0) { ++ totem_config->rrp_problem_count_mcast_threshold = totem_config->rrp_problem_count_threshold * 10; ++ } + if (totem_config->rrp_problem_count_threshold < RRP_PROBLEM_COUNT_THRESHOLD_MIN) { + snprintf (local_error_reason, sizeof(local_error_reason), + "The RRP problem count threshold (%d problem count) may not be less then (%d problem count).", + totem_config->rrp_problem_count_threshold, RRP_PROBLEM_COUNT_THRESHOLD_MIN); + goto parse_error; + } ++ if (totem_config->rrp_problem_count_mcast_threshold < RRP_PROBLEM_COUNT_THRESHOLD_MIN) { ++ snprintf (local_error_reason, sizeof(local_error_reason), ++ "The RRP multicast problem count threshold (%d problem count) may not be less then (%d problem count).", ++ totem_config->rrp_problem_count_mcast_threshold, RRP_PROBLEM_COUNT_THRESHOLD_MIN); ++ goto parse_error; ++ } + if (totem_config->rrp_token_expired_timeout == 0) { + totem_config->rrp_token_expired_timeout = + totem_config->token_retransmit_timeout; +diff --git a/exec/totemrrp.c b/exec/totemrrp.c +index a5abb1b..616d0d5 100644 +--- a/exec/totemrrp.c ++++ b/exec/totemrrp.c +@@ -890,14 +890,17 @@ static void passive_monitor ( + unsigned int max; + unsigned int i; + unsigned int min_all, min_active; ++ unsigned int threshold; + + /* + * Monitor for failures + */ + if (is_token_recv_count) { + recv_count = passive_instance->token_recv_count; ++ threshold = rrp_instance->totem_config->rrp_problem_count_threshold; + } else { + recv_count = passive_instance->mcast_recv_count; ++ threshold = rrp_instance->totem_config->rrp_problem_count_mcast_threshold; + } + + recv_count[iface_no] += 1; +@@ -959,8 +962,7 @@ static void passive_monitor ( + + for (i = 0; i < rrp_instance->interface_count; i++) { + if ((passive_instance->faulty[i] == 0) && +- (max - recv_count[i] > +- rrp_instance->totem_config->rrp_problem_count_threshold)) { ++ (max - recv_count[i] > threshold)) { + passive_instance->faulty[i] = 1; + poll_timer_add (rrp_instance->poll_handle, + rrp_instance->totem_config->rrp_autorecovery_check_timeout, +diff --git a/exec/totemsrp.c b/exec/totemsrp.c +index 40460e0..6981ac1 100644 +--- a/exec/totemsrp.c ++++ b/exec/totemsrp.c +@@ -858,6 +858,9 @@ int totemsrp_initialize ( + "RRP threshold (%d problem count)\n", + totem_config->rrp_problem_count_threshold); + log_printf (instance->totemsrp_log_level_debug, ++ "RRP multicast threshold (%d problem count)\n", ++ totem_config->rrp_problem_count_mcast_threshold); ++ log_printf (instance->totemsrp_log_level_debug, + "RRP automatic recovery check timeout (%d ms)\n", + totem_config->rrp_autorecovery_check_timeout); + log_printf (instance->totemsrp_log_level_debug, +diff --git a/include/corosync/totem/totem.h b/include/corosync/totem/totem.h +index f3ac9cc..4dce3b3 100644 +--- a/include/corosync/totem/totem.h ++++ b/include/corosync/totem/totem.h +@@ -143,6 +143,8 @@ struct totem_config { + + unsigned int rrp_problem_count_threshold; + ++ unsigned int rrp_problem_count_mcast_threshold; ++ + unsigned int rrp_autorecovery_check_timeout; + + char rrp_mode[TOTEM_RRP_MODE_BYTES]; +diff --git a/man/corosync.conf.5 b/man/corosync.conf.5 +index b6f769e..78eb2bb 100644 +--- a/man/corosync.conf.5 ++++ b/man/corosync.conf.5 +@@ -472,6 +472,14 @@ may occur. + The default is 10 problem counts. + + .TP ++rrp_problem_count_mcast_threshold ++This specifies the number of times a problem is detected with multicast before ++setting the link faulty for passive rrp mode. This variable is unused in active ++rrp mode. ++ ++The default is 10 times rrp_problem_count_threshold. ++ ++.TP + rrp_token_expired_timeout + This specifies the time in milliseconds to increment the problem counter for + the redundant ring protocol after not having received a token from all rings +-- +1.7.1 + diff --git a/totemconfig-change-minimum-RRP-threshold.patch b/totemconfig-change-minimum-RRP-threshold.patch new file mode 100644 index 0000000..0c70451 --- /dev/null +++ b/totemconfig-change-minimum-RRP-threshold.patch @@ -0,0 +1,30 @@ +From b1aba94732edc2ff084b7dd559a08b687f464ed0 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Thu, 8 Sep 2011 09:40:04 +0200 +Subject: [PATCH] totemconfig: change minimum RRP threshold + +RRP threshold can be lower value then 5. + +Signed-off-by: Jan Friesse +Reviewed-by: Fabio M. Di Nitto +(cherry picked from commit f6c2a8dab786c50ece36dd3424e258e93a1000d3) +--- + exec/totemconfig.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/exec/totemconfig.c b/exec/totemconfig.c +index f767f69..a475bb3 100644 +--- a/exec/totemconfig.c ++++ b/exec/totemconfig.c +@@ -82,7 +82,7 @@ + #define MISS_COUNT_CONST 5 + #define RRP_PROBLEM_COUNT_TIMEOUT 2000 + #define RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT 10 +-#define RRP_PROBLEM_COUNT_THRESHOLD_MIN 5 ++#define RRP_PROBLEM_COUNT_THRESHOLD_MIN 2 + #define RRP_AUTORECOVERY_CHECK_TIMEOUT 1000 + + static char error_string_response[512]; +-- +1.7.1 + From e04b9ae0e764492faf9ecb3a05e494a1eeb76310 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 6 Oct 2011 10:21:42 +0200 Subject: [PATCH 072/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + ...oin-messages-during-flush-operations.patch | 58 -------- corosync.spec | 16 +- ...ndless-loop-if-all-ifaces-are-faulty.patch | 85 ----------- ...-threshold-in-passive-mode-for-mcast.patch | 140 ------------------ sources | 2 +- ...mconfig-change-minimum-RRP-threshold.patch | 30 ---- 7 files changed, 7 insertions(+), 325 deletions(-) delete mode 100644 Ignore-memb_join-messages-during-flush-operations.patch delete mode 100644 rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch delete mode 100644 rrp-Higher-threshold-in-passive-mode-for-mcast.patch delete mode 100644 totemconfig-change-minimum-RRP-threshold.patch diff --git a/.gitignore b/.gitignore index 3cd6472..ea43b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ corosync-1.2.7.tar.gz /corosync-1.3.2.tar.gz /corosync-1.4.0.tar.gz /corosync-1.4.1.tar.gz +/corosync-1.4.2.tar.gz diff --git a/Ignore-memb_join-messages-during-flush-operations.patch b/Ignore-memb_join-messages-during-flush-operations.patch deleted file mode 100644 index 906f28b..0000000 --- a/Ignore-memb_join-messages-during-flush-operations.patch +++ /dev/null @@ -1,58 +0,0 @@ -From be608c050247e5f9c8266b8a0f9803cc0a3dc881 Mon Sep 17 00:00:00 2001 -From: Steven Dake -Date: Tue, 30 Aug 2011 22:25:21 -0700 -Subject: [PATCH] Ignore memb_join messages during flush operations - -a memb_join operation that occurs during flushing can result in an -entry into the GATHER state from the RECOVERY state. This results in the -regular sort queue being used instead of the recovery sort queue, resulting -in segfault. - -Signed-off-by: Steven Dake -Reviewed-by: Jan Friesse -(cherry picked from commit 48ffa8892daac18935d96ae46a72aebe2fb70430) ---- - exec/totemudp.c | 13 +++++++++++++ - 1 files changed, 13 insertions(+), 0 deletions(-) - -diff --git a/exec/totemudp.c b/exec/totemudp.c -index 96849b7..0c12b56 100644 ---- a/exec/totemudp.c -+++ b/exec/totemudp.c -@@ -90,6 +90,8 @@ - #define BIND_STATE_REGULAR 1 - #define BIND_STATE_LOOPBACK 2 - -+#define MESSAGE_TYPE_MCAST 1 -+ - #define HMAC_HASH_SIZE 20 - struct security_header { - unsigned char hash_digest[HMAC_HASH_SIZE]; /* The hash *MUST* be first in the data structure */ -@@ -1172,6 +1174,7 @@ static int net_deliver_fn ( - int res = 0; - unsigned char *msg_offset; - unsigned int size_delv; -+ char *message_type; - - if (instance->flushing == 1) { - iovec = &instance->totemudp_iov_recv_flush; -@@ -1234,6 +1237,16 @@ static int net_deliver_fn ( - } - - /* -+ * Drop all non-mcast messages (more specifically join -+ * messages should be dropped) -+ */ -+ message_type = (char *)msg_offset; -+ if (instance->flushing == 1 && *message_type != MESSAGE_TYPE_MCAST) { -+ iovec->iov_len = FRAME_SIZE_MAX; -+ return (0); -+ } -+ -+ /* - * Handle incoming message - */ - instance->totemudp_deliver_fn ( --- -1.7.1 - diff --git a/corosync.spec b/corosync.spec index 9bd7946..7345fd8 100644 --- a/corosync.spec +++ b/corosync.spec @@ -13,18 +13,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.4.1 -Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Version: 1.4.2 +Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz -Patch0: rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch -Patch1: rrp-Higher-threshold-in-passive-mode-for-mcast.patch -Patch2: Ignore-memb_join-messages-during-flush-operations.patch -Patch3: totemconfig-change-minimum-RRP-threshold.patch - # Runtime bits Requires: corosynclib = %{version}-%{release} Requires(pre): /usr/sbin/useradd @@ -55,10 +50,6 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 %build %if %{buildtrunk} @@ -286,6 +277,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Wed Oct 06 2011 Jan Friesse - 1.4.2-1 +- New upstream release + * Thu Sep 08 2011 Jan Friesse - 1.4.1-2 - Add upstream fixes diff --git a/rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch b/rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch deleted file mode 100644 index 7c70e9b..0000000 --- a/rrp-Handle-endless-loop-if-all-ifaces-are-faulty.patch +++ /dev/null @@ -1,85 +0,0 @@ -From dc862e15cc084926eccc5e1ff3241611c0cb54f0 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Mon, 29 Aug 2011 10:44:05 +0200 -Subject: [PATCH] rrp: Handle endless loop if all ifaces are faulty - -If all interfaces were faulty, passive_mcast_flush_send and related -functions ended in endless loop. This is now handled and if there is no -live interface, message is dropped. - -Signed-off-by: Jan Friesse -Reviewed by: Steven Dake -(cherry picked from commit 0eade8de79b6e5b28e91604d4d460627c7a61ddd) ---- - exec/totemrrp.c | 29 ++++++++++++++++++++--------- - 1 files changed, 20 insertions(+), 9 deletions(-) - -diff --git a/exec/totemrrp.c b/exec/totemrrp.c -index 83292ad..a5abb1b 100644 ---- a/exec/totemrrp.c -+++ b/exec/totemrrp.c -@@ -1015,12 +1015,16 @@ static void passive_mcast_flush_send ( - unsigned int msg_len) - { - struct passive_instance *passive_instance = (struct passive_instance *)instance->rrp_algo_instance; -+ int i = 0; - - do { - passive_instance->msg_xmit_iface = (passive_instance->msg_xmit_iface + 1) % instance->interface_count; -- } while (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1); -+ i++; -+ } while ((i <= instance->interface_count) && (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1)); - -- totemnet_mcast_flush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); -+ if (i <= instance->interface_count) { -+ totemnet_mcast_flush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); -+ } - } - - static void passive_mcast_noflush_send ( -@@ -1029,13 +1033,16 @@ static void passive_mcast_noflush_send ( - unsigned int msg_len) - { - struct passive_instance *passive_instance = (struct passive_instance *)instance->rrp_algo_instance; -+ int i = 0; - - do { - passive_instance->msg_xmit_iface = (passive_instance->msg_xmit_iface + 1) % instance->interface_count; -- } while (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1); -- -+ i++; -+ } while ((i <= instance->interface_count) && (passive_instance->faulty[passive_instance->msg_xmit_iface] == 1)); - -- totemnet_mcast_noflush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); -+ if (i <= instance->interface_count) { -+ totemnet_mcast_noflush_send (instance->net_handles[passive_instance->msg_xmit_iface], msg, msg_len); -+ } - } - - static void passive_token_recv ( -@@ -1070,14 +1077,18 @@ static void passive_token_send ( - unsigned int msg_len) - { - struct passive_instance *passive_instance = (struct passive_instance *)instance->rrp_algo_instance; -+ int i = 0; - - do { - passive_instance->token_xmit_iface = (passive_instance->token_xmit_iface + 1) % instance->interface_count; -- } while (passive_instance->faulty[passive_instance->token_xmit_iface] == 1); -+ i++; -+ } while ((i <= instance->interface_count) && (passive_instance->faulty[passive_instance->token_xmit_iface] == 1)); - -- totemnet_token_send ( -- instance->net_handles[passive_instance->token_xmit_iface], -- msg, msg_len); -+ if (i <= instance->interface_count) { -+ totemnet_token_send ( -+ instance->net_handles[passive_instance->token_xmit_iface], -+ msg, msg_len); -+ } - - } - --- -1.7.1 - diff --git a/rrp-Higher-threshold-in-passive-mode-for-mcast.patch b/rrp-Higher-threshold-in-passive-mode-for-mcast.patch deleted file mode 100644 index 3b52bac..0000000 --- a/rrp-Higher-threshold-in-passive-mode-for-mcast.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 4e32c3112a2f13a302709d72b0ae989287a48563 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Mon, 29 Aug 2011 15:09:52 +0200 -Subject: [PATCH] rrp: Higher threshold in passive mode for mcast - -There were too much false positives with passive mode rrp when high -number of messages were received. - -Patch adds new configurable variable rrp_problem_count_mcast_threshold -which is by default 10 times rrp_problem_count_threshold and this is -used as threshold for multicast packets in passive mode. Variable is -unused in active mode. - -Signed-off-by: Jan Friesse -Reviewed by: Steven Dake -(cherry picked from commit 752239eaa1edd68695a6e40bcde60471f34a02fd) ---- - exec/totemconfig.c | 11 +++++++++++ - exec/totemrrp.c | 6 ++++-- - exec/totemsrp.c | 3 +++ - include/corosync/totem/totem.h | 2 ++ - man/corosync.conf.5 | 8 ++++++++ - 5 files changed, 28 insertions(+), 2 deletions(-) - -diff --git a/exec/totemconfig.c b/exec/totemconfig.c -index 80ca182..f767f69 100644 ---- a/exec/totemconfig.c -+++ b/exec/totemconfig.c -@@ -213,6 +213,8 @@ static void totem_volatile_config_read ( - - objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_threshold", &totem_config->rrp_problem_count_threshold); - -+ objdb_get_int (objdb,object_totem_handle, "rrp_problem_count_mcast_threshold", &totem_config->rrp_problem_count_mcast_threshold); -+ - objdb_get_int (objdb,object_totem_handle, "rrp_autorecovery_check_timeout", &totem_config->rrp_autorecovery_check_timeout); - - objdb_get_int (objdb,object_totem_handle, "heartbeat_failures_allowed", &totem_config->heartbeat_failures_allowed); -@@ -667,12 +669,21 @@ int totem_config_validate ( - if (totem_config->rrp_problem_count_threshold == 0) { - totem_config->rrp_problem_count_threshold = RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT; - } -+ if (totem_config->rrp_problem_count_mcast_threshold == 0) { -+ totem_config->rrp_problem_count_mcast_threshold = totem_config->rrp_problem_count_threshold * 10; -+ } - if (totem_config->rrp_problem_count_threshold < RRP_PROBLEM_COUNT_THRESHOLD_MIN) { - snprintf (local_error_reason, sizeof(local_error_reason), - "The RRP problem count threshold (%d problem count) may not be less then (%d problem count).", - totem_config->rrp_problem_count_threshold, RRP_PROBLEM_COUNT_THRESHOLD_MIN); - goto parse_error; - } -+ if (totem_config->rrp_problem_count_mcast_threshold < RRP_PROBLEM_COUNT_THRESHOLD_MIN) { -+ snprintf (local_error_reason, sizeof(local_error_reason), -+ "The RRP multicast problem count threshold (%d problem count) may not be less then (%d problem count).", -+ totem_config->rrp_problem_count_mcast_threshold, RRP_PROBLEM_COUNT_THRESHOLD_MIN); -+ goto parse_error; -+ } - if (totem_config->rrp_token_expired_timeout == 0) { - totem_config->rrp_token_expired_timeout = - totem_config->token_retransmit_timeout; -diff --git a/exec/totemrrp.c b/exec/totemrrp.c -index a5abb1b..616d0d5 100644 ---- a/exec/totemrrp.c -+++ b/exec/totemrrp.c -@@ -890,14 +890,17 @@ static void passive_monitor ( - unsigned int max; - unsigned int i; - unsigned int min_all, min_active; -+ unsigned int threshold; - - /* - * Monitor for failures - */ - if (is_token_recv_count) { - recv_count = passive_instance->token_recv_count; -+ threshold = rrp_instance->totem_config->rrp_problem_count_threshold; - } else { - recv_count = passive_instance->mcast_recv_count; -+ threshold = rrp_instance->totem_config->rrp_problem_count_mcast_threshold; - } - - recv_count[iface_no] += 1; -@@ -959,8 +962,7 @@ static void passive_monitor ( - - for (i = 0; i < rrp_instance->interface_count; i++) { - if ((passive_instance->faulty[i] == 0) && -- (max - recv_count[i] > -- rrp_instance->totem_config->rrp_problem_count_threshold)) { -+ (max - recv_count[i] > threshold)) { - passive_instance->faulty[i] = 1; - poll_timer_add (rrp_instance->poll_handle, - rrp_instance->totem_config->rrp_autorecovery_check_timeout, -diff --git a/exec/totemsrp.c b/exec/totemsrp.c -index 40460e0..6981ac1 100644 ---- a/exec/totemsrp.c -+++ b/exec/totemsrp.c -@@ -858,6 +858,9 @@ int totemsrp_initialize ( - "RRP threshold (%d problem count)\n", - totem_config->rrp_problem_count_threshold); - log_printf (instance->totemsrp_log_level_debug, -+ "RRP multicast threshold (%d problem count)\n", -+ totem_config->rrp_problem_count_mcast_threshold); -+ log_printf (instance->totemsrp_log_level_debug, - "RRP automatic recovery check timeout (%d ms)\n", - totem_config->rrp_autorecovery_check_timeout); - log_printf (instance->totemsrp_log_level_debug, -diff --git a/include/corosync/totem/totem.h b/include/corosync/totem/totem.h -index f3ac9cc..4dce3b3 100644 ---- a/include/corosync/totem/totem.h -+++ b/include/corosync/totem/totem.h -@@ -143,6 +143,8 @@ struct totem_config { - - unsigned int rrp_problem_count_threshold; - -+ unsigned int rrp_problem_count_mcast_threshold; -+ - unsigned int rrp_autorecovery_check_timeout; - - char rrp_mode[TOTEM_RRP_MODE_BYTES]; -diff --git a/man/corosync.conf.5 b/man/corosync.conf.5 -index b6f769e..78eb2bb 100644 ---- a/man/corosync.conf.5 -+++ b/man/corosync.conf.5 -@@ -472,6 +472,14 @@ may occur. - The default is 10 problem counts. - - .TP -+rrp_problem_count_mcast_threshold -+This specifies the number of times a problem is detected with multicast before -+setting the link faulty for passive rrp mode. This variable is unused in active -+rrp mode. -+ -+The default is 10 times rrp_problem_count_threshold. -+ -+.TP - rrp_token_expired_timeout - This specifies the time in milliseconds to increment the problem counter for - the redundant ring protocol after not having received a token from all rings --- -1.7.1 - diff --git a/sources b/sources index ec31e29..bd01b5d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -66231146af210637393748add091021d corosync-1.4.1.tar.gz +061ee5522097fee69475b38a66bf1d6a corosync-1.4.2.tar.gz diff --git a/totemconfig-change-minimum-RRP-threshold.patch b/totemconfig-change-minimum-RRP-threshold.patch deleted file mode 100644 index 0c70451..0000000 --- a/totemconfig-change-minimum-RRP-threshold.patch +++ /dev/null @@ -1,30 +0,0 @@ -From b1aba94732edc2ff084b7dd559a08b687f464ed0 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Thu, 8 Sep 2011 09:40:04 +0200 -Subject: [PATCH] totemconfig: change minimum RRP threshold - -RRP threshold can be lower value then 5. - -Signed-off-by: Jan Friesse -Reviewed-by: Fabio M. Di Nitto -(cherry picked from commit f6c2a8dab786c50ece36dd3424e258e93a1000d3) ---- - exec/totemconfig.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/exec/totemconfig.c b/exec/totemconfig.c -index f767f69..a475bb3 100644 ---- a/exec/totemconfig.c -+++ b/exec/totemconfig.c -@@ -82,7 +82,7 @@ - #define MISS_COUNT_CONST 5 - #define RRP_PROBLEM_COUNT_TIMEOUT 2000 - #define RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT 10 --#define RRP_PROBLEM_COUNT_THRESHOLD_MIN 5 -+#define RRP_PROBLEM_COUNT_THRESHOLD_MIN 2 - #define RRP_AUTORECOVERY_CHECK_TIMEOUT 1000 - - static char error_string_response[512]; --- -1.7.1 - From 60c95290e20982bb49b23bbf59ae9dcf850cf1f8 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 12 Jan 2012 17:53:26 -0600 Subject: [PATCH 073/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 7345fd8..2f37e75 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,7 +14,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.4.2 -Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -277,6 +277,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Thu Jan 12 2012 Fedora Release Engineering - 1.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + * Wed Oct 06 2011 Jan Friesse - 1.4.2-1 - New upstream release From 7303bfe4668692aaeae6df8cfca838f47e067902 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 1 Feb 2012 06:14:45 +0100 Subject: [PATCH 074/185] New upstream release Signed-off-by: Fabio M. Di Nitto --- .gitignore | 1 + corosync.spec | 122 +++++++++++++++++++++++++++++++------------------- sources | 2 +- 3 files changed, 78 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index ea43b1d..3903a41 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ corosync-1.2.7.tar.gz /corosync-1.4.0.tar.gz /corosync-1.4.1.tar.gz /corosync-1.4.2.tar.gz +/corosync-1.99.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 2f37e75..e70d9a6 100644 --- a/corosync.spec +++ b/corosync.spec @@ -10,11 +10,14 @@ %ifnarch s390 s390x %bcond_without rdma %endif +%bcond_without systemd +%bcond_without nss +%bcond_with xmlconf Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.4.2 -Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Version: 1.99.1 +Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -25,17 +28,20 @@ Requires: corosynclib = %{version}-%{release} Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig -Conflicts: openais <= 0.89, openais-devel <= 0.89 +Conflicts: openais, openais-devel # Build bits %define buildtrunk 0 %{?_with_buildtrunk: %define buildtrunk 1} +BuildRequires: libqb-devel >= 0.9.0 %if %{buildtrunk} BuildRequires: autoconf automake %endif +%if %{with nss} BuildRequires: nss-devel +%endif %if %{with rdma} BuildRequires: libibverbs-devel librdmacm-devel %endif @@ -45,6 +51,12 @@ BuildRequires: net-snmp-devel %if %{with dbus} BuildRequires: dbus-devel %endif +%if %{with systemd} +BuildRequires: systemd-units +%endif +%if %{with xmlconf} +Requires: libxslt +%endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -63,7 +75,11 @@ export rdmacm_CFLAGS=-I/usr/include/rdma \ export rdmacm_LIBS=-lrdmacm \ %endif %{configure} \ +%if %{with nss} --enable-nss \ +%else + --disable-nss \ +%endif %if %{with testagents} --enable-testagents \ %endif @@ -81,6 +97,12 @@ export rdmacm_LIBS=-lrdmacm \ %endif %if %{with rdma} --enable-rdma \ +%endif +%if %{with systemd} + --enable-systemd \ +%endif +%if %{with xmlconf} + --enable-xmlconf \ %endif --with-initddir=%{_initrddir} @@ -123,18 +145,20 @@ fi %files %defattr(-,root,root,-) %doc LICENSE SECURITY -%{_bindir}/corosync-blackbox %{_sbindir}/corosync %{_sbindir}/corosync-keygen -%{_sbindir}/corosync-objctl +%{_sbindir}/corosync-cmapctl %{_sbindir}/corosync-cfgtool %{_sbindir}/corosync-fplay %{_sbindir}/corosync-pload %{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-quorumtool %{_sbindir}/corosync-notifyd +%{_bindir}/corosync-blackbox +%if %{with xmlconf} +%{_bindir}/corosync-xmlproc +%endif %dir %{_sysconfdir}/corosync -%dir %{_sysconfdir}/corosync/service.d %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu @@ -144,27 +168,19 @@ fi %if %{with snmp} %{_datadir}/snmp/mibs/COROSYNC-MIB.txt %endif +%if %{with systemd} +%{_unitdir}/corosync.service +%{_unitdir}/corosync-notifyd.service +%else %{_initrddir}/corosync %{_initrddir}/corosync-notifyd -%dir %{_libexecdir}/lcrso -%{_libexecdir}/lcrso/coroparse.lcrso -%{_libexecdir}/lcrso/objdb.lcrso -%{_libexecdir}/lcrso/service_cfg.lcrso -%{_libexecdir}/lcrso/service_cpg.lcrso -%{_libexecdir}/lcrso/service_evs.lcrso -%{_libexecdir}/lcrso/service_confdb.lcrso -%{_libexecdir}/lcrso/service_pload.lcrso -%{_libexecdir}/lcrso/quorum_votequorum.lcrso -%{_libexecdir}/lcrso/quorum_testquorum.lcrso -%{_libexecdir}/lcrso/vsf_quorum.lcrso -%{_libexecdir}/lcrso/vsf_ykd.lcrso +%endif %dir %{_localstatedir}/lib/corosync -%attr(700, root, root) %{_localstatedir}/log/cluster %dir %{_localstatedir}/log/cluster %{_mandir}/man8/corosync_overview.8* %{_mandir}/man8/corosync.8* %{_mandir}/man8/corosync-blackbox.8* -%{_mandir}/man8/corosync-objctl.8* +%{_mandir}/man8/corosync-cmapctl.8* %{_mandir}/man8/corosync-keygen.8* %{_mandir}/man8/corosync-cfgtool.8* %{_mandir}/man8/corosync-cpgtool.8* @@ -173,7 +189,35 @@ fi %{_mandir}/man8/corosync-notifyd.8* %{_mandir}/man8/corosync-quorumtool.8* %{_mandir}/man5/corosync.conf.5* +%{_mandir}/man5/votequorum.5* +# optional testagent rpm +# +%if %{with testagents} + +%package -n corosync-testagents +Summary: The Corosync Cluster Engine Test Agents +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: libqb >= 0.9.0 + +%description -n corosync-testagents +This package contains corosync test agents. + +%files -n corosync-testagents +%defattr(755,root,root,-) +%{_datadir}/corosync/tests/mem_leak_test.sh +%{_datadir}/corosync/tests/net_breaker.sh +%{_datadir}/corosync/tests/cmap-dispatch-deadlock.sh +%{_datadir}/corosync/tests/shm_leak_audit.sh +%{_bindir}/cpg_test_agent +%{_bindir}/sam_test_agent +%{_bindir}/votequorum_test_agent + +%endif + +# library +# %package -n corosynclib Summary: The Corosync Cluster Engine Libraries Group: System Environment/Libraries @@ -187,12 +231,9 @@ This package contains corosync libraries. %doc LICENSE %{_libdir}/libcfg.so.* %{_libdir}/libcpg.so.* -%{_libdir}/libconfdb.so.* +%{_libdir}/libcmap.so.* %{_libdir}/libevs.so.* %{_libdir}/libtotem_pg.so.* -%{_libdir}/liblogsys.so.* -%{_libdir}/libcoroipcc.so.* -%{_libdir}/libcoroipcs.so.* %{_libdir}/libquorum.so.* %{_libdir}/libvotequorum.so.* %{_libdir}/libpload.so.* @@ -216,15 +257,12 @@ The Corosync Cluster Engine APIs. %files -n corosynclib-devel %defattr(-,root,root,-) -%doc LICENSE README.devmap +%doc LICENSE %dir %{_includedir}/corosync/ %{_includedir}/corosync/cs_config.h %{_includedir}/corosync/corodefs.h -%{_includedir}/corosync/coroipc_types.h -%{_includedir}/corosync/coroipcs.h -%{_includedir}/corosync/coroipcc.h %{_includedir}/corosync/cfg.h -%{_includedir}/corosync/confdb.h +%{_includedir}/corosync/cmap.h %{_includedir}/corosync/corotypes.h %{_includedir}/corosync/cpg.h %{_includedir}/corosync/evs.h @@ -236,28 +274,16 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/quorum.h %{_includedir}/corosync/votequorum.h %dir %{_includedir}/corosync/totem/ -%{_includedir}/corosync/totem/coropoll.h %{_includedir}/corosync/totem/totem.h %{_includedir}/corosync/totem/totemip.h %{_includedir}/corosync/totem/totempg.h -%dir %{_includedir}/corosync/lcr/ -%{_includedir}/corosync/lcr/lcr_ckpt.h -%{_includedir}/corosync/lcr/lcr_comp.h -%{_includedir}/corosync/lcr/lcr_ifact.h %dir %{_includedir}/corosync/engine -%{_includedir}/corosync/engine/config.h -%{_includedir}/corosync/engine/coroapi.h -%{_includedir}/corosync/engine/logsys.h -%{_includedir}/corosync/engine/objdb.h %{_includedir}/corosync/engine/quorum.h %{_libdir}/libcfg.so %{_libdir}/libcpg.so -%{_libdir}/libconfdb.so +%{_libdir}/libcmap.so %{_libdir}/libevs.so %{_libdir}/libtotem_pg.so -%{_libdir}/liblogsys.so -%{_libdir}/libcoroipcc.so -%{_libdir}/libcoroipcs.so %{_libdir}/libquorum.so %{_libdir}/libvotequorum.so %{_libdir}/libpload.so @@ -265,18 +291,22 @@ The Corosync Cluster Engine APIs. %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* -%{_mandir}/man3/confdb_*3* +%{_mandir}/man3/quorum_*3* %{_mandir}/man3/votequorum_*3* %{_mandir}/man3/sam_*3* %{_mandir}/man8/cpg_overview.8* %{_mandir}/man8/evs_overview.8* -%{_mandir}/man8/confdb_overview.8* -%{_mandir}/man8/logsys_overview.8* %{_mandir}/man8/votequorum_overview.8* -%{_mandir}/man8/coroipc_overview.8* %{_mandir}/man8/sam_overview.8* %changelog +* Wed Feb 1 2012 Fabio M. Di Nitto - 1.99.1-1 +- New upstream release +- Temporary disable xml config (broken upstream tarball) + +* Wed Jan 24 2012 Jan Friesse - 1.99.0-1 +- New upstream release + * Thu Jan 12 2012 Fedora Release Engineering - 1.4.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/sources b/sources index bd01b5d..65759d4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -061ee5522097fee69475b38a66bf1d6a corosync-1.4.2.tar.gz +d4bfd60d967cfa05a12d369c446aa415 corosync-1.99.1.tar.gz From 061092e5bdbc441e9358c43d8efc6b37c2f99c75 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Thu, 2 Feb 2012 11:19:50 +0100 Subject: [PATCH 075/185] Add Obsoletes on openais/cluster Signed-off-by: Fabio M. Di Nitto --- corosync.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/corosync.spec b/corosync.spec index e70d9a6..26678b3 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.99.1 -Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -28,7 +28,8 @@ Requires: corosynclib = %{version}-%{release} Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig -Conflicts: openais, openais-devel +Obsoletes: openais, openais-devel, openaislib, openaislib-devel +Obsoletes: cman, clusterlib, clusterlib-devel # Build bits @@ -300,6 +301,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/sam_overview.8* %changelog +* Thu Feb 2 2012 Fabio M. Di Nitto - 1.99.1-2 +- Add proper Obsoltes on openais/cman/clusterlib + * Wed Feb 1 2012 Fabio M. Di Nitto - 1.99.1-1 - New upstream release - Temporary disable xml config (broken upstream tarball) From 89af1f54ef79df51b7f1518bebcf8d6b2fb36a2f Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 7 Feb 2012 12:01:32 +0100 Subject: [PATCH 076/185] New upstream release Signed-off-by: Fabio M. Di Nitto --- .gitignore | 1 + corosync.spec | 24 +++++++++++++++++++++--- sources | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 3903a41..a8cee69 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ corosync-1.2.7.tar.gz /corosync-1.4.1.tar.gz /corosync-1.4.2.tar.gz /corosync-1.99.1.tar.gz +/corosync-1.99.2.tar.gz diff --git a/corosync.spec b/corosync.spec index 26678b3..1023b10 100644 --- a/corosync.spec +++ b/corosync.spec @@ -12,12 +12,12 @@ %endif %bcond_without systemd %bcond_without nss -%bcond_with xmlconf +%bcond_without xmlconf Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.1 -Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Version: 1.99.2 +Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -119,6 +119,11 @@ mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d install -m 644 %{_builddir}/%{name}-%{version}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %endif +%if %{with systemd} +mkdir -p %{buildroot}/%{_unitdir}/ +mv %{buildroot}/lib/systemd/system/*.service %{buildroot}/%{_unitdir}/ +%endif + ## tree fixup # drop static libs rm -f %{buildroot}%{_libdir}/*.a @@ -158,6 +163,11 @@ fi %{_bindir}/corosync-blackbox %if %{with xmlconf} %{_bindir}/corosync-xmlproc +%config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example +%dir %{_datadir}/corosync +%dir %{_datadir}/corosync/xml2conf.xsl +%{_mandir}/man8/corosync-xmlproc.8* +%{_mandir}/man5/corosync.xml.5* %endif %dir %{_sysconfdir}/corosync %dir %{_sysconfdir}/corosync/uidgid.d @@ -290,17 +300,25 @@ The Corosync Cluster Engine APIs. %{_libdir}/libpload.so %{_libdir}/libsam.so %{_libdir}/pkgconfig/*.pc +%{_mandir}/man3/cmap_*3* %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* %{_mandir}/man3/quorum_*3* %{_mandir}/man3/votequorum_*3* %{_mandir}/man3/sam_*3* +%{_mandir}/man8/cmap_overview.8* %{_mandir}/man8/cpg_overview.8* %{_mandir}/man8/evs_overview.8* %{_mandir}/man8/votequorum_overview.8* %{_mandir}/man8/sam_overview.8* %changelog +* Tue Feb 7 2012 Fabio M. Di Nitto - 1.99.2-1 +- New upstream release +- Re-enable xmlconfig bits +- Ship cmap man pages +- Add workaround to usrmove breakage!! + * Thu Feb 2 2012 Fabio M. Di Nitto - 1.99.1-2 - Add proper Obsoltes on openais/cman/clusterlib diff --git a/sources b/sources index 65759d4..6459375 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d4bfd60d967cfa05a12d369c446aa415 corosync-1.99.1.tar.gz +a42f6529c393dd93d8b6e92346ebad92 corosync-1.99.2.tar.gz From 3270172cbcffdf9774a37979b98c4f71480cf677 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 14 Feb 2012 12:28:45 +0100 Subject: [PATCH 077/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 20 +++++++++----------- sources | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index a8cee69..b7e74b6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ corosync-1.2.7.tar.gz /corosync-1.4.2.tar.gz /corosync-1.99.1.tar.gz /corosync-1.99.2.tar.gz +/corosync-1.99.3.tar.gz diff --git a/corosync.spec b/corosync.spec index 1023b10..1be982a 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.2 +Version: 1.99.3 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base @@ -36,7 +36,7 @@ Obsoletes: cman, clusterlib, clusterlib-devel %define buildtrunk 0 %{?_with_buildtrunk: %define buildtrunk 1} -BuildRequires: libqb-devel >= 0.9.0 +BuildRequires: libqb-devel >= 0.10.1 %if %{buildtrunk} BuildRequires: autoconf automake %endif @@ -210,7 +210,7 @@ fi Summary: The Corosync Cluster Engine Test Agents Group: Development/Libraries Requires: %{name} = %{version}-%{release} -Requires: libqb >= 0.9.0 +Requires: libqb >= 0.10.1 %description -n corosync-testagents This package contains corosync test agents. @@ -270,7 +270,6 @@ The Corosync Cluster Engine APIs. %defattr(-,root,root,-) %doc LICENSE %dir %{_includedir}/corosync/ -%{_includedir}/corosync/cs_config.h %{_includedir}/corosync/corodefs.h %{_includedir}/corosync/cfg.h %{_includedir}/corosync/cmap.h @@ -278,18 +277,13 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/cpg.h %{_includedir}/corosync/evs.h %{_includedir}/corosync/hdb.h -%{_includedir}/corosync/list.h -%{_includedir}/corosync/mar_gen.h %{_includedir}/corosync/sam.h -%{_includedir}/corosync/swab.h %{_includedir}/corosync/quorum.h %{_includedir}/corosync/votequorum.h %dir %{_includedir}/corosync/totem/ %{_includedir}/corosync/totem/totem.h %{_includedir}/corosync/totem/totemip.h %{_includedir}/corosync/totem/totempg.h -%dir %{_includedir}/corosync/engine -%{_includedir}/corosync/engine/quorum.h %{_libdir}/libcfg.so %{_libdir}/libcpg.so %{_libdir}/libcmap.so @@ -300,19 +294,23 @@ The Corosync Cluster Engine APIs. %{_libdir}/libpload.so %{_libdir}/libsam.so %{_libdir}/pkgconfig/*.pc -%{_mandir}/man3/cmap_*3* %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* %{_mandir}/man3/quorum_*3* %{_mandir}/man3/votequorum_*3* %{_mandir}/man3/sam_*3* -%{_mandir}/man8/cmap_overview.8* %{_mandir}/man8/cpg_overview.8* %{_mandir}/man8/evs_overview.8* %{_mandir}/man8/votequorum_overview.8* %{_mandir}/man8/sam_overview.8* +%{_mandir}/man3/cmap_*3* +%{_mandir}/man8/cmap_overview.8* +%{_mandir}/man8/quorum_overview.8* %changelog +* Tue Feb 14 2012 Jan Friesse - 1.99.3-1 +- New upstream release + * Tue Feb 7 2012 Fabio M. Di Nitto - 1.99.2-1 - New upstream release - Re-enable xmlconfig bits diff --git a/sources b/sources index 6459375..df46f6f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a42f6529c393dd93d8b6e92346ebad92 corosync-1.99.2.tar.gz +4fc39233c326367bd90519eb52bc8c41 corosync-1.99.3.tar.gz From a1f06432214782b6f691b3d26d11888d8930a084 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 14 Feb 2012 13:54:57 +0100 Subject: [PATCH 078/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b7e74b6..2e0a393 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.1.tar.gz /corosync-1.99.2.tar.gz /corosync-1.99.3.tar.gz +/corosync-1.99.4.tar.gz diff --git a/corosync.spec b/corosync.spec index 1be982a..df4c194 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.3 +Version: 1.99.4 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base @@ -308,6 +308,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Feb 14 2012 Jan Friesse - 1.99.4-1 +- New upstream release + * Tue Feb 14 2012 Jan Friesse - 1.99.3-1 - New upstream release diff --git a/sources b/sources index df46f6f..3f20280 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4fc39233c326367bd90519eb52bc8c41 corosync-1.99.3.tar.gz +999af1eaceb5dade00ef66fccfccd3da corosync-1.99.4.tar.gz From 6e7efc6e72c8ead73df4d5c1aaf31a3ff1343b8b Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 22 Feb 2012 13:58:06 +0100 Subject: [PATCH 079/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 ++++++- sources | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2e0a393..b452a1b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.2.tar.gz /corosync-1.99.3.tar.gz /corosync-1.99.4.tar.gz +/corosync-1.99.5.tar.gz diff --git a/corosync.spec b/corosync.spec index df4c194..e12b5db 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.4 +Version: 1.99.5 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base @@ -249,6 +249,7 @@ This package contains corosync libraries. %{_libdir}/libvotequorum.so.* %{_libdir}/libpload.so.* %{_libdir}/libsam.so.* +%{_libdir}/libcorosync_common.so.* %post -n corosynclib -p /sbin/ldconfig @@ -293,6 +294,7 @@ The Corosync Cluster Engine APIs. %{_libdir}/libvotequorum.so %{_libdir}/libpload.so %{_libdir}/libsam.so +%{_libdir}/libcorosync_common.so %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* %{_mandir}/man3/evs_*3* @@ -308,6 +310,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Feb 22 2012 Jan Friesse - 1.99.5-1 +- New upstream release + * Tue Feb 14 2012 Jan Friesse - 1.99.4-1 - New upstream release diff --git a/sources b/sources index 3f20280..c03b870 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -999af1eaceb5dade00ef66fccfccd3da corosync-1.99.4.tar.gz +2e0bd841781fe21a8ef71fae6dd7a002 corosync-1.99.5.tar.gz From 6015e93c9d96d1d669a6746d73e0c7e91aee6d59 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 28 Feb 2012 13:27:17 +0100 Subject: [PATCH 080/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b452a1b..f2333c2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.3.tar.gz /corosync-1.99.4.tar.gz /corosync-1.99.5.tar.gz +/corosync-1.99.6.tar.gz diff --git a/corosync.spec b/corosync.spec index e12b5db..880bd95 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.5 +Version: 1.99.6 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base @@ -310,6 +310,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Feb 28 2012 Jan Friesse - 1.99.6-1 +- New upstream release + * Wed Feb 22 2012 Jan Friesse - 1.99.5-1 - New upstream release diff --git a/sources b/sources index c03b870..898787e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -2e0bd841781fe21a8ef71fae6dd7a002 corosync-1.99.5.tar.gz +199dd0374c71e88934390caa8b042307 corosync-1.99.6.tar.gz From 68546ee92db387b417edbeaa355e886f2d6cbf3f Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 6 Mar 2012 10:21:30 +0100 Subject: [PATCH 081/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f2333c2..7074314 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.4.tar.gz /corosync-1.99.5.tar.gz /corosync-1.99.6.tar.gz +/corosync-1.99.7.tar.gz diff --git a/corosync.spec b/corosync.spec index 880bd95..e6cff7a 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.6 +Version: 1.99.7 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base @@ -310,6 +310,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Mar 6 2012 Jan Friesse - 1.99.7-1 +- New upstream release + * Tue Feb 28 2012 Jan Friesse - 1.99.6-1 - New upstream release diff --git a/sources b/sources index 898787e..9df9f4b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -199dd0374c71e88934390caa8b042307 corosync-1.99.6.tar.gz +20fca47b32a8310b938361893d93f38b corosync-1.99.7.tar.gz From 68d2d8677a6546dede4233fa5cef3361f7bc212d Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 16 Mar 2012 10:52:12 +0100 Subject: [PATCH 082/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 25 ++++++------------------- sources | 2 +- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 7074314..e8faa4c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.5.tar.gz /corosync-1.99.6.tar.gz /corosync-1.99.7.tar.gz +/corosync-1.99.8.tar.gz diff --git a/corosync.spec b/corosync.spec index e6cff7a..c6ce1da 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.7 +Version: 1.99.8 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base @@ -36,13 +36,11 @@ Obsoletes: cman, clusterlib, clusterlib-devel %define buildtrunk 0 %{?_with_buildtrunk: %define buildtrunk 1} -BuildRequires: libqb-devel >= 0.10.1 +BuildRequires: libqb-devel >= 0.11.1 +BuildRequires: nss-devel %if %{buildtrunk} BuildRequires: autoconf automake %endif -%if %{with nss} -BuildRequires: nss-devel -%endif %if %{with rdma} BuildRequires: libibverbs-devel librdmacm-devel %endif @@ -76,11 +74,6 @@ export rdmacm_CFLAGS=-I/usr/include/rdma \ export rdmacm_LIBS=-lrdmacm \ %endif %{configure} \ -%if %{with nss} - --enable-nss \ -%else - --disable-nss \ -%endif %if %{with testagents} --enable-testagents \ %endif @@ -156,7 +149,6 @@ fi %{_sbindir}/corosync-cmapctl %{_sbindir}/corosync-cfgtool %{_sbindir}/corosync-fplay -%{_sbindir}/corosync-pload %{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-quorumtool %{_sbindir}/corosync-notifyd @@ -196,7 +188,6 @@ fi %{_mandir}/man8/corosync-cfgtool.8* %{_mandir}/man8/corosync-cpgtool.8* %{_mandir}/man8/corosync-fplay.8* -%{_mandir}/man8/corosync-pload.8* %{_mandir}/man8/corosync-notifyd.8* %{_mandir}/man8/corosync-quorumtool.8* %{_mandir}/man5/corosync.conf.5* @@ -243,11 +234,9 @@ This package contains corosync libraries. %{_libdir}/libcfg.so.* %{_libdir}/libcpg.so.* %{_libdir}/libcmap.so.* -%{_libdir}/libevs.so.* %{_libdir}/libtotem_pg.so.* %{_libdir}/libquorum.so.* %{_libdir}/libvotequorum.so.* -%{_libdir}/libpload.so.* %{_libdir}/libsam.so.* %{_libdir}/libcorosync_common.so.* @@ -276,7 +265,6 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/cmap.h %{_includedir}/corosync/corotypes.h %{_includedir}/corosync/cpg.h -%{_includedir}/corosync/evs.h %{_includedir}/corosync/hdb.h %{_includedir}/corosync/sam.h %{_includedir}/corosync/quorum.h @@ -288,21 +276,17 @@ The Corosync Cluster Engine APIs. %{_libdir}/libcfg.so %{_libdir}/libcpg.so %{_libdir}/libcmap.so -%{_libdir}/libevs.so %{_libdir}/libtotem_pg.so %{_libdir}/libquorum.so %{_libdir}/libvotequorum.so -%{_libdir}/libpload.so %{_libdir}/libsam.so %{_libdir}/libcorosync_common.so %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/cpg_*3* -%{_mandir}/man3/evs_*3* %{_mandir}/man3/quorum_*3* %{_mandir}/man3/votequorum_*3* %{_mandir}/man3/sam_*3* %{_mandir}/man8/cpg_overview.8* -%{_mandir}/man8/evs_overview.8* %{_mandir}/man8/votequorum_overview.8* %{_mandir}/man8/sam_overview.8* %{_mandir}/man3/cmap_*3* @@ -310,6 +294,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Fri Mar 16 2012 Jan Friesse - 1.99.8-1 +- New upstream release + * Tue Mar 6 2012 Jan Friesse - 1.99.7-1 - New upstream release diff --git a/sources b/sources index 9df9f4b..8a7ba89 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -20fca47b32a8310b938361893d93f38b corosync-1.99.7.tar.gz +b87e0d48cba27519b5a3ba54cac63132 corosync-1.99.8.tar.gz From 0ff14dd2376f5438aed87709ac80bd9b0ef2b3ce Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 27 Mar 2012 13:39:56 +0200 Subject: [PATCH 083/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e8faa4c..5988649 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.6.tar.gz /corosync-1.99.7.tar.gz /corosync-1.99.8.tar.gz +/corosync-1.99.9.tar.gz diff --git a/corosync.spec b/corosync.spec index c6ce1da..c253583 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.8 +Version: 1.99.9 Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base @@ -294,6 +294,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Mar 27 2012 Jan Friesse - 1.99.9-1 +- New upstream release + * Fri Mar 16 2012 Jan Friesse - 1.99.8-1 - New upstream release diff --git a/sources b/sources index 8a7ba89..8861515 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b87e0d48cba27519b5a3ba54cac63132 corosync-1.99.8.tar.gz +011fb6c8426b2f218cfaf169288a098d corosync-1.99.9.tar.gz From 20236a83c7b23aa38a421aa6a9d1964fc96b8d4f Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Thu, 5 Apr 2012 00:37:52 +0200 Subject: [PATCH 084/185] bump release and rebuild on PPC --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index c253583..70abebd 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 1.99.9 -Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 1.1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -294,6 +294,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Thu Apr 05 2012 Karsten Hopp 1.99.9-1.1 +- bump release and rebuild on PPC + * Tue Mar 27 2012 Jan Friesse - 1.99.9-1 - New upstream release From 625451f43f863a7427215ed0955513d561a77f5f Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 10 Apr 2012 17:05:59 +0200 Subject: [PATCH 085/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 16 ++++++++-------- sources | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 5988649..e590578 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.7.tar.gz /corosync-1.99.8.tar.gz /corosync-1.99.9.tar.gz +/corosync-2.0.0.tar.gz diff --git a/corosync.spec b/corosync.spec index 70abebd..0855a40 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,8 +16,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 1.99.9 -Release: 1.1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Version: 2.0.0 +Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -98,7 +98,8 @@ export rdmacm_LIBS=-lrdmacm \ %if %{with xmlconf} --enable-xmlconf \ %endif - --with-initddir=%{_initrddir} + --with-initddir=%{_initrddir} \ + --with-systemddir=%{_unitdir} make %{_smp_mflags} @@ -112,11 +113,6 @@ mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d install -m 644 %{_builddir}/%{name}-%{version}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %endif -%if %{with systemd} -mkdir -p %{buildroot}/%{_unitdir}/ -mv %{buildroot}/lib/systemd/system/*.service %{buildroot}/%{_unitdir}/ -%endif - ## tree fixup # drop static libs rm -f %{buildroot}%{_libdir}/*.a @@ -192,6 +188,7 @@ fi %{_mandir}/man8/corosync-quorumtool.8* %{_mandir}/man5/corosync.conf.5* %{_mandir}/man5/votequorum.5* +%{_mandir}/man8/cmap_keys.8* # optional testagent rpm # @@ -294,6 +291,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Apr 10 2012 Jan Friesse - 2.0.0-1 +- New upstream release + * Thu Apr 05 2012 Karsten Hopp 1.99.9-1.1 - bump release and rebuild on PPC diff --git a/sources b/sources index 8861515..92d68ea 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -011fb6c8426b2f218cfaf169288a098d corosync-1.99.9.tar.gz +72592510e7a142e60191ff2468c116f8 corosync-2.0.0.tar.gz From 8fbedd4f31d2bd2cf9b82e2cc4067d5d123c3cb5 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 17 Apr 2012 08:44:31 +0200 Subject: [PATCH 086/185] Backport IPCS fix from master Signed-off-by: Fabio M. Di Nitto --- corosync.spec | 7 +- ...ns_only_after_all_services_are_ready.patch | 77 +++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 ipcs_allow_connections_only_after_all_services_are_ready.patch diff --git a/corosync.spec b/corosync.spec index 0855a40..99ddfe9 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,11 +17,12 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.0.0 -Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz +Patch0: ipcs_allow_connections_only_after_all_services_are_ready.patch # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -61,6 +62,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} +%patch0 -p1 %build %if %{buildtrunk} @@ -291,6 +293,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Apr 17 2012 Fabio M. Di Nitto - 2.0.0-2 +- Backport IPCS fix from master (ack by Steven) + * Tue Apr 10 2012 Jan Friesse - 2.0.0-1 - New upstream release diff --git a/ipcs_allow_connections_only_after_all_services_are_ready.patch b/ipcs_allow_connections_only_after_all_services_are_ready.patch new file mode 100644 index 0000000..19283d1 --- /dev/null +++ b/ipcs_allow_connections_only_after_all_services_are_ready.patch @@ -0,0 +1,77 @@ +commit b34c1e28704fef38fb3f5eb1a0b418c84a2f0863 +Author: Fabio M. Di Nitto +Date: Mon Apr 16 13:39:03 2012 +0200 + + ipcs: allow connections only after all services are ready + + this fixes a rather annoying race condition at startup where a client + connects to corosync "too fast" before the service is ready to operate + and client gets some random data during initialization phase. + + With this fix, we allow connections to ipc only after the main engine + is operational and configured (and after the first totem transition). + + Signed-off-by: Fabio M. Di Nitto + Reviewed-by: Angus Salkeld + +diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c +index c1d6034..592f9f6 100644 +--- a/exec/ipc_glue.c ++++ b/exec/ipc_glue.c +@@ -69,6 +69,7 @@ static int32_t ipc_not_enough_fds_left = 0; + static int32_t ipc_fc_is_quorate; /* boolean */ + static int32_t ipc_fc_totem_queue_level; /* percentage used */ + static int32_t ipc_fc_sync_in_process; /* boolean */ ++static int32_t ipc_allow_connections = 0; /* boolean */ + + struct cs_ipcs_mapper { + int32_t id; +@@ -149,6 +150,11 @@ static const char* cs_ipcs_serv_short_name(int32_t service_id) + return name; + } + ++void cs_ipc_allow_connections(int32_t allow) ++{ ++ ipc_allow_connections = allow; ++} ++ + int32_t cs_ipcs_service_destroy(int32_t service_id) + { + if (ipcs_mapper[service_id].inst) { +@@ -164,6 +170,11 @@ static int32_t cs_ipcs_connection_accept (qb_ipcs_connection_t *c, uid_t euid, g + uint8_t u8; + char key_name[ICMAP_KEYNAME_MAXLEN]; + ++ if (!ipc_allow_connections) { ++ log_printf(LOGSYS_LEVEL_DEBUG, "Denied connection, corosync is not ready"); ++ return -EAGAIN; ++ } ++ + if (corosync_service[service] == NULL || + corosync_service_exiting[service] || + ipcs_mapper[service].inst == NULL) { +diff --git a/exec/main.c b/exec/main.c +index 474e0c2..2f3d242 100644 +--- a/exec/main.c ++++ b/exec/main.c +@@ -252,6 +252,7 @@ static void corosync_sync_completed (void) + sync_in_process = 0; + + cs_ipcs_sync_state_changed(sync_in_process); ++ cs_ipc_allow_connections(1); + } + + static int corosync_sync_callbacks_retrieve ( +diff --git a/exec/main.h b/exec/main.h +index 9d27670..13b7e12 100644 +--- a/exec/main.h ++++ b/exec/main.h +@@ -119,6 +119,8 @@ extern void cs_ipc_refcnt_inc(void *conn); + + extern void cs_ipc_refcnt_dec(void *conn); + ++extern void cs_ipc_allow_connections(int32_t allow); ++ + int coroparse_configparse (const char **error_string); + + #endif /* MAIN_H_DEFINED */ From c06da6b7a81144387006024ec271e5fade9d3f9e Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 22 May 2012 10:42:02 +0200 Subject: [PATCH 087/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 18 +++-- ...ns_only_after_all_services_are_ready.patch | 77 ------------------- sources | 2 +- 4 files changed, 15 insertions(+), 83 deletions(-) delete mode 100644 ipcs_allow_connections_only_after_all_services_are_ready.patch diff --git a/.gitignore b/.gitignore index e590578..03483b0 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.8.tar.gz /corosync-1.99.9.tar.gz /corosync-2.0.0.tar.gz +/corosync-2.0.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 99ddfe9..fee0219 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,13 +16,16 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.0.0 -Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Version: 2.0.1 +Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz -Patch0: ipcs_allow_connections_only_after_all_services_are_ready.patch + +%if 0%{?rhel} +ExclusiveArch: i686 x86_64 +%endif # Runtime bits Requires: corosynclib = %{version}-%{release} @@ -37,7 +40,7 @@ Obsoletes: cman, clusterlib, clusterlib-devel %define buildtrunk 0 %{?_with_buildtrunk: %define buildtrunk 1} -BuildRequires: libqb-devel >= 0.11.1 +BuildRequires: libqb-devel >= 0.13.0 BuildRequires: nss-devel %if %{buildtrunk} BuildRequires: autoconf automake @@ -62,7 +65,6 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} -%patch0 -p1 %build %if %{buildtrunk} @@ -172,6 +174,9 @@ fi %if %{with systemd} %{_unitdir}/corosync.service %{_unitdir}/corosync-notifyd.service +%dir %{_datadir}/corosync +%{_datadir}/corosync/corosync +%{_datadir}/corosync/corosync-notifyd %else %{_initrddir}/corosync %{_initrddir}/corosync-notifyd @@ -293,6 +298,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue May 12 2012 Jan Friesse - 2.0.1-1 +- New upstream release + * Tue Apr 17 2012 Fabio M. Di Nitto - 2.0.0-2 - Backport IPCS fix from master (ack by Steven) diff --git a/ipcs_allow_connections_only_after_all_services_are_ready.patch b/ipcs_allow_connections_only_after_all_services_are_ready.patch deleted file mode 100644 index 19283d1..0000000 --- a/ipcs_allow_connections_only_after_all_services_are_ready.patch +++ /dev/null @@ -1,77 +0,0 @@ -commit b34c1e28704fef38fb3f5eb1a0b418c84a2f0863 -Author: Fabio M. Di Nitto -Date: Mon Apr 16 13:39:03 2012 +0200 - - ipcs: allow connections only after all services are ready - - this fixes a rather annoying race condition at startup where a client - connects to corosync "too fast" before the service is ready to operate - and client gets some random data during initialization phase. - - With this fix, we allow connections to ipc only after the main engine - is operational and configured (and after the first totem transition). - - Signed-off-by: Fabio M. Di Nitto - Reviewed-by: Angus Salkeld - -diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c -index c1d6034..592f9f6 100644 ---- a/exec/ipc_glue.c -+++ b/exec/ipc_glue.c -@@ -69,6 +69,7 @@ static int32_t ipc_not_enough_fds_left = 0; - static int32_t ipc_fc_is_quorate; /* boolean */ - static int32_t ipc_fc_totem_queue_level; /* percentage used */ - static int32_t ipc_fc_sync_in_process; /* boolean */ -+static int32_t ipc_allow_connections = 0; /* boolean */ - - struct cs_ipcs_mapper { - int32_t id; -@@ -149,6 +150,11 @@ static const char* cs_ipcs_serv_short_name(int32_t service_id) - return name; - } - -+void cs_ipc_allow_connections(int32_t allow) -+{ -+ ipc_allow_connections = allow; -+} -+ - int32_t cs_ipcs_service_destroy(int32_t service_id) - { - if (ipcs_mapper[service_id].inst) { -@@ -164,6 +170,11 @@ static int32_t cs_ipcs_connection_accept (qb_ipcs_connection_t *c, uid_t euid, g - uint8_t u8; - char key_name[ICMAP_KEYNAME_MAXLEN]; - -+ if (!ipc_allow_connections) { -+ log_printf(LOGSYS_LEVEL_DEBUG, "Denied connection, corosync is not ready"); -+ return -EAGAIN; -+ } -+ - if (corosync_service[service] == NULL || - corosync_service_exiting[service] || - ipcs_mapper[service].inst == NULL) { -diff --git a/exec/main.c b/exec/main.c -index 474e0c2..2f3d242 100644 ---- a/exec/main.c -+++ b/exec/main.c -@@ -252,6 +252,7 @@ static void corosync_sync_completed (void) - sync_in_process = 0; - - cs_ipcs_sync_state_changed(sync_in_process); -+ cs_ipc_allow_connections(1); - } - - static int corosync_sync_callbacks_retrieve ( -diff --git a/exec/main.h b/exec/main.h -index 9d27670..13b7e12 100644 ---- a/exec/main.h -+++ b/exec/main.h -@@ -119,6 +119,8 @@ extern void cs_ipc_refcnt_inc(void *conn); - - extern void cs_ipc_refcnt_dec(void *conn); - -+extern void cs_ipc_allow_connections(int32_t allow); -+ - int coroparse_configparse (const char **error_string); - - #endif /* MAIN_H_DEFINED */ diff --git a/sources b/sources index 92d68ea..5775d31 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -72592510e7a142e60191ff2468c116f8 corosync-2.0.0.tar.gz +9e23f3f5594676455ff39ff363658155 corosync-2.0.1.tar.gz From b1ab20a5bc3de04cc5e82e1351384896aa98fbd2 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 18 Jul 2012 14:42:16 -0500 Subject: [PATCH 088/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index fee0219..3c6b7e2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.0.1 -Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -298,6 +298,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Jul 18 2012 Fedora Release Engineering - 2.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + * Tue May 12 2012 Jan Friesse - 2.0.1-1 - New upstream release From bf0a059597e83def2c2171b789dcaddb8e2e3f61 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Fri, 3 Aug 2012 09:26:58 -0700 Subject: [PATCH 089/185] Add buildrequires on groff as it is no longer installed in the default buildroot Signed-off-by: Steven Dake --- corosync.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 3c6b7e2..431617d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.0.1 -Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 3%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: BSD Group: System Environment/Base URL: http://ftp.corosync.org @@ -40,6 +40,7 @@ Obsoletes: cman, clusterlib, clusterlib-devel %define buildtrunk 0 %{?_with_buildtrunk: %define buildtrunk 1} +BuildRequires: groff BuildRequires: libqb-devel >= 0.13.0 BuildRequires: nss-devel %if %{buildtrunk} @@ -298,6 +299,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Fri Aug 3 2012 Steven Dake - 2.0.1-3 +- add groff as a BuildRequires as it is no longer installed in the buildroot + * Wed Jul 18 2012 Fedora Release Engineering - 2.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild From 526c1ed11d11bd4c6ac22ddd3ba8748d1d627114 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 11 Oct 2012 11:16:29 +0200 Subject: [PATCH 090/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 54 ++++++++++++++++++++++++++++++++++++--------------- sources | 2 +- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 03483b0..ebbb6a2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ corosync-1.2.7.tar.gz /corosync-1.99.9.tar.gz /corosync-2.0.0.tar.gz /corosync-2.0.1.tar.gz +/corosync-2.1.0.tar.gz diff --git a/corosync.spec b/corosync.spec index 431617d..47261c1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -13,15 +13,19 @@ %bcond_without systemd %bcond_without nss %bcond_without xmlconf +%bcond_with runautogen + +%global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} +%global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.0.1 -Release: 3%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Version: 2.1.0 +Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base -URL: http://ftp.corosync.org -Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz +URL: http://www.corosync.org/ +Source0: https://github.com/downloads/corosync/corosync/%{name}-%{version}%{?gittarver}.tar.gz %if 0%{?rhel} ExclusiveArch: i686 x86_64 @@ -37,14 +41,14 @@ Obsoletes: cman, clusterlib, clusterlib-devel # Build bits -%define buildtrunk 0 -%{?_with_buildtrunk: %define buildtrunk 1} - BuildRequires: groff -BuildRequires: libqb-devel >= 0.13.0 +BuildRequires: libqb-devel >= 0.14.2 BuildRequires: nss-devel -%if %{buildtrunk} -BuildRequires: autoconf automake +%if %{with runautogen} +BuildRequires: autoconf automake libtool +%endif +%if %{with monitoring} +BuildRequires: libstatgrab-devel %endif %if %{with rdma} BuildRequires: libibverbs-devel librdmacm-devel @@ -57,6 +61,9 @@ BuildRequires: dbus-devel %endif %if %{with systemd} BuildRequires: systemd-units +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd %endif %if %{with xmlconf} Requires: libxslt @@ -65,10 +72,10 @@ Requires: libxslt BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep -%setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} +%setup -q -n %{name}-%{version}%{?gittarver} %build -%if %{buildtrunk} +%if %{with runautogen} ./autogen.sh %endif @@ -115,12 +122,13 @@ make install DESTDIR=%{buildroot} %if %{with dbus} mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d -install -m 644 %{_builddir}/%{name}-%{version}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf +install -m 644 %{_builddir}/%{name}-%{version}%{?gittarver}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %endif ## tree fixup # drop static libs rm -f %{buildroot}%{_libdir}/*.a +rm -f %{buildroot}%{_libdir}/*.la # drop docs and html docs for now rm -rf %{buildroot}%{_docdir}/* @@ -132,15 +140,28 @@ This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. %post +%if %{with systemd} && 0%{?systemd_post:1} +%systemd_post corosync.service +%else if [ $1 -eq 1 ]; then /sbin/chkconfig --add corosync || : fi +%endif %preun +%if %{with systemd} && 0%{?systemd_preun:1} +%systemd_preun corosync.service +%else if [ $1 -eq 0 ]; then /sbin/service corosync stop &>/dev/null || : /sbin/chkconfig --del corosync || : fi +%endif + +%postun +%if %{with systemd} && 0%{?systemd_postun:1} +%systemd_postun +%endif %files %defattr(-,root,root,-) @@ -149,7 +170,6 @@ fi %{_sbindir}/corosync-keygen %{_sbindir}/corosync-cmapctl %{_sbindir}/corosync-cfgtool -%{_sbindir}/corosync-fplay %{_sbindir}/corosync-cpgtool %{_sbindir}/corosync-quorumtool %{_sbindir}/corosync-notifyd @@ -191,7 +211,6 @@ fi %{_mandir}/man8/corosync-keygen.8* %{_mandir}/man8/corosync-cfgtool.8* %{_mandir}/man8/corosync-cpgtool.8* -%{_mandir}/man8/corosync-fplay.8* %{_mandir}/man8/corosync-notifyd.8* %{_mandir}/man8/corosync-quorumtool.8* %{_mandir}/man5/corosync.conf.5* @@ -206,7 +225,7 @@ fi Summary: The Corosync Cluster Engine Test Agents Group: Development/Libraries Requires: %{name} = %{version}-%{release} -Requires: libqb >= 0.10.1 +Requires: libqb >= 0.14.2 %description -n corosync-testagents This package contains corosync test agents. @@ -299,6 +318,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Thu Oct 11 2012 Jan Friesse - 2.1.0-1 +- New upstream release + * Fri Aug 3 2012 Steven Dake - 2.0.1-3 - add groff as a BuildRequires as it is no longer installed in the buildroot diff --git a/sources b/sources index 5775d31..bd85612 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9e23f3f5594676455ff39ff363658155 corosync-2.0.1.tar.gz +dc5152e6dfdb4638ab544e587884483a corosync-2.1.0.tar.gz From 7e32dd855e22fc62fa5589816314f0eb58eb4341 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 11 Oct 2012 11:20:53 +0200 Subject: [PATCH 091/185] Remove NSS conditional Signed-off-by: Jan Friesse --- corosync.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 47261c1..3d1cb6a 100644 --- a/corosync.spec +++ b/corosync.spec @@ -11,7 +11,6 @@ %bcond_without rdma %endif %bcond_without systemd -%bcond_without nss %bcond_without xmlconf %bcond_with runautogen From 261cf8c49870741e35aa14de290238e86589db1e Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 12 Dec 2012 15:39:05 +0100 Subject: [PATCH 092/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ebbb6a2..67ec5a8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ corosync-1.2.7.tar.gz /corosync-2.0.0.tar.gz /corosync-2.0.1.tar.gz /corosync-2.1.0.tar.gz +/corosync-2.2.0.tar.gz diff --git a/corosync.spec b/corosync.spec index 3d1cb6a..b638ce2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -19,12 +19,12 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.1.0 +Version: 2.2.0 Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ -Source0: https://github.com/downloads/corosync/corosync/%{name}-%{version}%{?gittarver}.tar.gz +Source0: http://corosync.org/download/%{name}-%{version}%{?gittarver}.tar.gz %if 0%{?rhel} ExclusiveArch: i686 x86_64 @@ -317,6 +317,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Dec 12 2012 Jan Friesse - 2.2.0-1 +- New upstream release + * Thu Oct 11 2012 Jan Friesse - 2.1.0-1 - New upstream release diff --git a/sources b/sources index bd85612..42da6f7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -dc5152e6dfdb4638ab544e587884483a corosync-2.1.0.tar.gz +1bdae48c4ec1df653809d3dc04b3d121 corosync-2.2.0.tar.gz From 4a16359e1491c4d8c9ff24faac98bfa96cd1cd18 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 18 Jan 2013 10:08:19 +0100 Subject: [PATCH 093/185] New upstream release Also remove hash from macro name in specfile to make rpmlint happy. Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 67ec5a8..28d242c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ corosync-1.2.7.tar.gz /corosync-2.0.1.tar.gz /corosync-2.1.0.tar.gz /corosync-2.2.0.tar.gz +/corosync-2.3.0.tar.gz diff --git a/corosync.spec b/corosync.spec index b638ce2..8939f00 100644 --- a/corosync.spec +++ b/corosync.spec @@ -19,7 +19,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.2.0 +Version: 2.3.0 Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base @@ -317,6 +317,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Fri Jan 18 2013 Jan Friesse - 2.3.0-1 +- New upstream release + * Wed Dec 12 2012 Jan Friesse - 2.2.0-1 - New upstream release @@ -441,7 +444,7 @@ The Corosync Cluster Engine APIs. - New upstream release - Use global instead of define - Update Source0 url -- Use more %name macro around +- Use more name macro around - Cleanup install section. Init script is now installed by upstream - Cleanup whitespace - Don't deadlock between package upgrade and corosync condrestart diff --git a/sources b/sources index 42da6f7..4b9d54d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -1bdae48c4ec1df653809d3dc04b3d121 corosync-2.2.0.tar.gz +4689279c36b1417e122a23c6818017dd corosync-2.3.0.tar.gz From 46bc7b208bb6780c4f72a669fdccc5fa4694b2e6 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 13 Feb 2013 12:59:39 -0600 Subject: [PATCH 094/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 8939f00..3bcda35 100644 --- a/corosync.spec +++ b/corosync.spec @@ -20,7 +20,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.0 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -317,6 +317,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Feb 13 2013 Fedora Release Engineering - 2.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + * Fri Jan 18 2013 Jan Friesse - 2.3.0-1 - New upstream release From d82bb905188c39c04ab0c865edcd1edb45b3480a Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 25 Mar 2013 17:11:32 +0100 Subject: [PATCH 095/185] Run autogen by default Signed-off-by: Jan Friesse --- corosync.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/corosync.spec b/corosync.spec index 3bcda35..58b2faa 100644 --- a/corosync.spec +++ b/corosync.spec @@ -12,7 +12,7 @@ %endif %bcond_without systemd %bcond_without xmlconf -%bcond_with runautogen +%bcond_without runautogen %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} @@ -20,7 +20,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.0 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -317,6 +317,11 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Mon Mar 25 2013 Jan Friesse - 2.3.0-3 +- Resolves: rhbz#925185 + +- Run autogen by default + * Wed Feb 13 2013 Fedora Release Engineering - 2.3.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild From 226a071f0cfe62ea876a28a15f9b93eff0a618dd Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 10 Jul 2013 13:13:55 +0200 Subject: [PATCH 096/185] New upstream release Also incorrect dates in specfile changelog section are fixed. Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 36 +++++++++++++++++++++++++++--------- sources | 2 +- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 28d242c..73fdaf6 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ corosync-1.2.7.tar.gz /corosync-2.1.0.tar.gz /corosync-2.2.0.tar.gz /corosync-2.3.0.tar.gz +/corosync-2.3.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 58b2faa..834f405 100644 --- a/corosync.spec +++ b/corosync.spec @@ -11,6 +11,7 @@ %bcond_without rdma %endif %bcond_without systemd +%bcond_with upstart %bcond_without xmlconf %bcond_without runautogen @@ -19,8 +20,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.3.0 -Release: 3%{?gitver}%{?dist} +Version: 2.3.1 +Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -106,11 +107,15 @@ export rdmacm_LIBS=-lrdmacm \ %if %{with systemd} --enable-systemd \ %endif +%if %{with upstart} + --enable-upstart \ +%endif %if %{with xmlconf} --enable-xmlconf \ %endif --with-initddir=%{_initrddir} \ - --with-systemddir=%{_unitdir} + --with-systemddir=%{_unitdir} \ + --with-upstartdir=%{_sysconfdir}/init make %{_smp_mflags} @@ -130,6 +135,10 @@ rm -f %{buildroot}%{_libdir}/*.a rm -f %{buildroot}%{_libdir}/*.la # drop docs and html docs for now rm -rf %{buildroot}%{_docdir}/* +# /etc/sysconfig/corosync-notifyd +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +install -m 644 tools/corosync-notifyd.sysconfig.example \ + %{buildroot}%{_sysconfdir}/sysconfig/corosync-notifyd %clean rm -rf %{buildroot} @@ -177,7 +186,7 @@ fi %{_bindir}/corosync-xmlproc %config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example %dir %{_datadir}/corosync -%dir %{_datadir}/corosync/xml2conf.xsl +%{_datadir}/corosync/xml2conf.xsl %{_mandir}/man8/corosync-xmlproc.8* %{_mandir}/man5/corosync.xml.5* %endif @@ -185,6 +194,7 @@ fi %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu +%config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd %if %{with dbus} %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %endif @@ -201,6 +211,10 @@ fi %{_initrddir}/corosync %{_initrddir}/corosync-notifyd %endif +%if %{with upstart} +%{_sysconfdir}/init/corosync.conf +%{_sysconfdir}/init/corosync-notifyd.conf +%endif %dir %{_localstatedir}/lib/corosync %dir %{_localstatedir}/log/cluster %{_mandir}/man8/corosync_overview.8* @@ -317,6 +331,10 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Jul 10 2013 Jan Friesse - 2.3.1-1 +- New upstream release +- Fix incorrect dates in specfile changelog section + * Mon Mar 25 2013 Jan Friesse - 2.3.0-3 - Resolves: rhbz#925185 @@ -340,7 +358,7 @@ The Corosync Cluster Engine APIs. * Wed Jul 18 2012 Fedora Release Engineering - 2.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild -* Tue May 12 2012 Jan Friesse - 2.0.1-1 +* Tue May 22 2012 Jan Friesse - 2.0.1-1 - New upstream release * Tue Apr 17 2012 Fabio M. Di Nitto - 2.0.0-2 @@ -386,13 +404,13 @@ The Corosync Cluster Engine APIs. - New upstream release - Temporary disable xml config (broken upstream tarball) -* Wed Jan 24 2012 Jan Friesse - 1.99.0-1 +* Tue Jan 24 2012 Jan Friesse - 1.99.0-1 - New upstream release * Thu Jan 12 2012 Fedora Release Engineering - 1.4.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild -* Wed Oct 06 2011 Jan Friesse - 1.4.2-1 +* Thu Oct 06 2011 Jan Friesse - 1.4.2-1 - New upstream release * Thu Sep 08 2011 Jan Friesse - 1.4.1-2 @@ -404,7 +422,7 @@ The Corosync Cluster Engine APIs. * Wed Jul 20 2011 Jan Friesse - 1.4.0-2 - Change attributes of cluster log directory -* Wed Jul 19 2011 Jan Friesse - 1.4.0-1 +* Tue Jul 19 2011 Jan Friesse - 1.4.0-1 - New upstream release - Resync spec file with upstream changes @@ -603,7 +621,7 @@ The Corosync Cluster Engine APIs. * Mon Oct 13 2008 Dennis Gilmore - 0.92-3 - remove ExclusiveArch line -* Fri Sep 24 2008 Steven Dake - 0.92-2 +* Wed Sep 24 2008 Steven Dake - 0.92-2 - Add conflicts for openais and openais-devel packages older then 0.90. * Wed Sep 24 2008 Steven Dake - 0.92-1 diff --git a/sources b/sources index 4b9d54d..8aba322 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4689279c36b1417e122a23c6818017dd corosync-2.3.0.tar.gz +d3a76155e05c0a6ec34b2d0ad281fb02 corosync-2.3.1.tar.gz From 5995710316f36d2e1011c4219b324e44f8ed50b4 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 3 Aug 2013 00:53:34 -0500 Subject: [PATCH 097/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 834f405..a9d698f 100644 --- a/corosync.spec +++ b/corosync.spec @@ -21,7 +21,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.1 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -331,6 +331,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Sat Aug 03 2013 Fedora Release Engineering - 2.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + * Wed Jul 10 2013 Jan Friesse - 2.3.1-1 - New upstream release - Fix incorrect dates in specfile changelog section From a8e1235b864a43eca88edd1bdf85c05ba7104b01 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 19 Aug 2013 11:04:03 +0200 Subject: [PATCH 098/185] Fix scheduler pause-detection timeout patch Signed-off-by: Jan Friesse --- ...ix-scheduler-pause-detection-timeout.patch | 30 +++++++++++++++++++ corosync.spec | 11 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 bz998362-1-Fix-scheduler-pause-detection-timeout.patch diff --git a/bz998362-1-Fix-scheduler-pause-detection-timeout.patch b/bz998362-1-Fix-scheduler-pause-detection-timeout.patch new file mode 100644 index 0000000..d766a17 --- /dev/null +++ b/bz998362-1-Fix-scheduler-pause-detection-timeout.patch @@ -0,0 +1,30 @@ +From 2740cfd1eac60714601c74df2137fe588b607866 Mon Sep 17 00:00:00 2001 +From: Michael Chapman +Date: Mon, 19 Aug 2013 01:30:15 +0000 +Subject: [PATCH] Fix scheduler pause-detection timeout + +qb_loop_timer_add expects the timeout to be in nanoseconds, but we were +passing the value in milliseconds. Scale the timeout appropriately. + +Signed-off-by: Michael Chapman +Reviewed-by: Jan Friesse +--- + exec/main.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/exec/main.c b/exec/main.c +index 65b28c2..6c69ee5 100644 +--- a/exec/main.c ++++ b/exec/main.c +@@ -824,7 +824,7 @@ static void timer_function_scheduler_timeout (void *data) + timeout_data->max_tv_diff = timeout_data->totem_config->token_timeout * QB_TIME_NS_IN_MSEC * 0.8; + qb_loop_timer_add (corosync_poll_handle, + QB_LOOP_MED, +- timeout_data->totem_config->token_timeout / 3, ++ timeout_data->totem_config->token_timeout * QB_TIME_NS_IN_MSEC / 3, + timeout_data, + timer_function_scheduler_timeout, + &timeout_data->handle); +-- +1.7.1 + diff --git a/corosync.spec b/corosync.spec index a9d698f..c25cf3d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -21,12 +21,14 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.1 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ Source0: http://corosync.org/download/%{name}-%{version}%{?gittarver}.tar.gz +Patch0: bz998362-1-Fix-scheduler-pause-detection-timeout.patch + %if 0%{?rhel} ExclusiveArch: i686 x86_64 %endif @@ -73,6 +75,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version}%{?gittarver} +%patch0 -p1 -b .bz998362-1 %build %if %{with runautogen} @@ -331,6 +334,12 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Mon Aug 19 2013 Jan Friesse 2.3.1-3 +- Resolves: rhbz#998362 + +- Fix scheduler pause-detection timeout (rhbz#998362) +- merge upstream commit 2740cfd1eac60714601c74df2137fe588b607866 (rhbz#998362) + * Sat Aug 03 2013 Fedora Release Engineering - 2.3.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild From 81a2f52716f7f8c145d09a0df95b8100c6c78c3e Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 16 Sep 2013 11:18:36 +0200 Subject: [PATCH 099/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 10 +++++----- sources | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 73fdaf6..19dcad9 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ corosync-1.2.7.tar.gz /corosync-2.2.0.tar.gz /corosync-2.3.0.tar.gz /corosync-2.3.1.tar.gz +/corosync-2.3.2.tar.gz diff --git a/corosync.spec b/corosync.spec index c25cf3d..79ece5b 100644 --- a/corosync.spec +++ b/corosync.spec @@ -20,15 +20,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.3.1 -Release: 3%{?gitver}%{?dist} +Version: 2.3.2 +Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ Source0: http://corosync.org/download/%{name}-%{version}%{?gittarver}.tar.gz -Patch0: bz998362-1-Fix-scheduler-pause-detection-timeout.patch - %if 0%{?rhel} ExclusiveArch: i686 x86_64 %endif @@ -75,7 +73,6 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version}%{?gittarver} -%patch0 -p1 -b .bz998362-1 %build %if %{with runautogen} @@ -334,6 +331,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Mon Sep 16 2013 Jan Friesse - 2.3.2-1 +- New upstream release + * Mon Aug 19 2013 Jan Friesse 2.3.1-3 - Resolves: rhbz#998362 diff --git a/sources b/sources index 8aba322..29d89dd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d3a76155e05c0a6ec34b2d0ad281fb02 corosync-2.3.1.tar.gz +0471219664186d110273b8ce48b1d169 corosync-2.3.2.tar.gz From dca2a96fb20997e777b587bd3ad6dde4148ebc19 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 16 Sep 2013 11:34:26 +0200 Subject: [PATCH 100/185] Delete no longer needed patch Signed-off-by: Jan Friesse --- ...ix-scheduler-pause-detection-timeout.patch | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 bz998362-1-Fix-scheduler-pause-detection-timeout.patch diff --git a/bz998362-1-Fix-scheduler-pause-detection-timeout.patch b/bz998362-1-Fix-scheduler-pause-detection-timeout.patch deleted file mode 100644 index d766a17..0000000 --- a/bz998362-1-Fix-scheduler-pause-detection-timeout.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 2740cfd1eac60714601c74df2137fe588b607866 Mon Sep 17 00:00:00 2001 -From: Michael Chapman -Date: Mon, 19 Aug 2013 01:30:15 +0000 -Subject: [PATCH] Fix scheduler pause-detection timeout - -qb_loop_timer_add expects the timeout to be in nanoseconds, but we were -passing the value in milliseconds. Scale the timeout appropriately. - -Signed-off-by: Michael Chapman -Reviewed-by: Jan Friesse ---- - exec/main.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/exec/main.c b/exec/main.c -index 65b28c2..6c69ee5 100644 ---- a/exec/main.c -+++ b/exec/main.c -@@ -824,7 +824,7 @@ static void timer_function_scheduler_timeout (void *data) - timeout_data->max_tv_diff = timeout_data->totem_config->token_timeout * QB_TIME_NS_IN_MSEC * 0.8; - qb_loop_timer_add (corosync_poll_handle, - QB_LOOP_MED, -- timeout_data->totem_config->token_timeout / 3, -+ timeout_data->totem_config->token_timeout * QB_TIME_NS_IN_MSEC / 3, - timeout_data, - timer_function_scheduler_timeout, - &timeout_data->handle); --- -1.7.1 - From b88f7f989343e97b7ac21c81baa27f6bef7b220a Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 14 Jan 2014 16:25:55 +0100 Subject: [PATCH 101/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 19dcad9..464489a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ corosync-1.2.7.tar.gz /corosync-2.3.0.tar.gz /corosync-2.3.1.tar.gz /corosync-2.3.2.tar.gz +/corosync-2.3.3.tar.gz diff --git a/corosync.spec b/corosync.spec index 79ece5b..b8968bd 100644 --- a/corosync.spec +++ b/corosync.spec @@ -20,7 +20,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.3.2 +Version: 2.3.3 Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base @@ -331,6 +331,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Jan 14 2014 Jan Friesse - 2.3.3-1 +- New upstream release + * Mon Sep 16 2013 Jan Friesse - 2.3.2-1 - New upstream release diff --git a/sources b/sources index 29d89dd..1a0e5e5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0471219664186d110273b8ce48b1d169 corosync-2.3.2.tar.gz +e68e97bff74fc56c86493dc7def5f1bc corosync-2.3.3.tar.gz From d3f9a42bd6c3529b5fe67a008d18e5d9ac6a13d8 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 7 Jun 2014 00:57:18 -0500 Subject: [PATCH 102/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index b8968bd..f2a253f 100644 --- a/corosync.spec +++ b/corosync.spec @@ -21,7 +21,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.3 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -331,6 +331,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Sat Jun 07 2014 Fedora Release Engineering - 2.3.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + * Tue Jan 14 2014 Jan Friesse - 2.3.3-1 - New upstream release From ade6ec54235080584a56653bf127d6fd0934b874 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 16 Aug 2014 01:19:51 +0000 Subject: [PATCH 103/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index f2a253f..7436e71 100644 --- a/corosync.spec +++ b/corosync.spec @@ -21,7 +21,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.3 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -331,6 +331,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Sat Aug 16 2014 Fedora Release Engineering - 2.3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + * Sat Jun 07 2014 Fedora Release Engineering - 2.3.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild From 483cf17e2bf7ec7319b33bd9a43f7875d603028c Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 26 Aug 2014 16:20:19 +0200 Subject: [PATCH 104/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 11 +++++++++-- sources | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 464489a..b66bacd 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ corosync-1.2.7.tar.gz /corosync-2.3.1.tar.gz /corosync-2.3.2.tar.gz /corosync-2.3.3.tar.gz +/corosync-2.3.4.tar.gz diff --git a/corosync.spec b/corosync.spec index 7436e71..3a9286f 100644 --- a/corosync.spec +++ b/corosync.spec @@ -20,8 +20,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.3.3 -Release: 3%{?gitver}%{?dist} +Version: 2.3.4 +Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -139,6 +139,9 @@ rm -rf %{buildroot}%{_docdir}/* mkdir -p %{buildroot}%{_sysconfdir}/sysconfig install -m 644 tools/corosync-notifyd.sysconfig.example \ %{buildroot}%{_sysconfdir}/sysconfig/corosync-notifyd +# /etc/sysconfig/corosync +install -m 644 init/corosync.sysconfig.example \ + %{buildroot}%{_sysconfdir}/sysconfig/corosync %clean rm -rf %{buildroot} @@ -195,6 +198,7 @@ fi %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd +%config(noreplace) %{_sysconfdir}/sysconfig/corosync %if %{with dbus} %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %endif @@ -331,6 +335,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Tue Aug 26 2014 Jan Friesse - 2.3.4-1 +- New upstream release + * Sat Aug 16 2014 Fedora Release Engineering - 2.3.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild diff --git a/sources b/sources index 1a0e5e5..aea9f05 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e68e97bff74fc56c86493dc7def5f1bc corosync-2.3.3.tar.gz +4b0f36a1dc014527e5b192265dbd7e70 corosync-2.3.4.tar.gz From 472b5254a9f5226aa06cc44ab5433840b70e3fe4 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 17 Jun 2015 03:16:37 +0000 Subject: [PATCH 105/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 3a9286f..45be214 100644 --- a/corosync.spec +++ b/corosync.spec @@ -21,7 +21,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.4 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -335,6 +335,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Jun 17 2015 Fedora Release Engineering - 2.3.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + * Tue Aug 26 2014 Jan Friesse - 2.3.4-1 - New upstream release From 821fb616df2c11fcfc09d0ff3c620aa9113515b7 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 1 Jul 2015 17:32:58 +0200 Subject: [PATCH 106/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 9 +++++++-- sources | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b66bacd..4ab6972 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ corosync-1.2.7.tar.gz /corosync-2.3.2.tar.gz /corosync-2.3.3.tar.gz /corosync-2.3.4.tar.gz +/corosync-2.3.5.tar.gz diff --git a/corosync.spec b/corosync.spec index 45be214..6dece5a 100644 --- a/corosync.spec +++ b/corosync.spec @@ -20,8 +20,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.3.4 -Release: 2%{?gitver}%{?dist} +Version: 2.3.5 +Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://www.corosync.org/ @@ -44,6 +44,7 @@ Obsoletes: cman, clusterlib, clusterlib-devel BuildRequires: groff BuildRequires: libqb-devel >= 0.14.2 BuildRequires: nss-devel +BuildRequires: zlib-devel %if %{with runautogen} BuildRequires: autoconf automake libtool %endif @@ -199,6 +200,7 @@ fi %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd %config(noreplace) %{_sysconfdir}/sysconfig/corosync +%config(noreplace) %{_sysconfdir}/logrotate.d/corosync %if %{with dbus} %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf %endif @@ -335,6 +337,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Jul 01 2015 Jan Friesse - 2.3.5-1 +- New upstream release + * Wed Jun 17 2015 Fedora Release Engineering - 2.3.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild diff --git a/sources b/sources index aea9f05..c5cfc17 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4b0f36a1dc014527e5b192265dbd7e70 corosync-2.3.4.tar.gz +8894f00d499e0755467b381e6346f9ff corosync-2.3.5.tar.gz From cbc7fd190e07736ebe0aa32799929f9c66c39a17 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 5 Jan 2016 17:12:38 +0100 Subject: [PATCH 107/185] Update corosync links Signed-off-by: Jan Friesse --- corosync.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/corosync.spec b/corosync.spec index 6dece5a..b062b66 100644 --- a/corosync.spec +++ b/corosync.spec @@ -24,8 +24,8 @@ Version: 2.3.5 Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base -URL: http://www.corosync.org/ -Source0: http://corosync.org/download/%{name}-%{version}%{?gittarver}.tar.gz +URL: http://corosync.github.io/corosync/ +Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz %if 0%{?rhel} ExclusiveArch: i686 x86_64 From 0e1ea2e2f6cfd573e63bf9f75544dcbc55da8306 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Wed, 3 Feb 2016 18:08:13 +0000 Subject: [PATCH 108/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index b062b66..aef3cd0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -21,7 +21,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.3.5 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -337,6 +337,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Wed Feb 03 2016 Fedora Release Engineering - 2.3.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + * Wed Jul 01 2015 Jan Friesse - 2.3.5-1 - New upstream release From 7a3d782cc29a242d347abbaaf53585d070d0e753 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 16 Jun 2016 10:56:18 +0200 Subject: [PATCH 109/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4ab6972..4fff9c4 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ corosync-1.2.7.tar.gz /corosync-2.3.3.tar.gz /corosync-2.3.4.tar.gz /corosync-2.3.5.tar.gz +/corosync-2.3.6.tar.gz diff --git a/corosync.spec b/corosync.spec index aef3cd0..8cadae2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -20,8 +20,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.3.5 -Release: 2%{?gitver}%{?dist} +Version: 2.3.6 +Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -337,6 +337,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/quorum_overview.8* %changelog +* Thu Jun 16 2016 Jan Friesse - 2.3.6-1 +- New upstream release + * Wed Feb 03 2016 Fedora Release Engineering - 2.3.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index c5cfc17..e64b846 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -8894f00d499e0755467b381e6346f9ff corosync-2.3.5.tar.gz +ea1e0421d474017d9ef3d6b741b7aaad corosync-2.3.6.tar.gz From 650faf4f11bac37086a326fb0d0e8fccea15c6de Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 30 Jun 2016 17:38:02 +0200 Subject: [PATCH 110/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 179 +++++++++++++++++++++++++++++++++++++++++++++++++- sources | 2 +- 3 files changed, 179 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4fff9c4..371cd36 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ corosync-1.2.7.tar.gz /corosync-2.3.4.tar.gz /corosync-2.3.5.tar.gz /corosync-2.3.6.tar.gz +/corosync-2.4.0.tar.gz diff --git a/corosync.spec b/corosync.spec index 8cadae2..5925634 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,13 +14,15 @@ %bcond_with upstart %bcond_without xmlconf %bcond_without runautogen +%bcond_without qdevices +%bcond_without qnetd %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.3.6 +Version: 2.4.0 Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base @@ -69,6 +71,12 @@ Requires(postun): systemd %if %{with xmlconf} Requires: libxslt %endif +%if %{with qdevices} || %{with qnetd} +Requires: nss-tools +%endif +%if %{with qnetd} +BuildRequires: sed +%endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -113,10 +121,17 @@ export rdmacm_LIBS=-lrdmacm \ %endif %if %{with xmlconf} --enable-xmlconf \ +%endif +%if %{with qdevices} + --enable-qdevices \ +%endif +%if %{with qnetd} + --enable-qnetd \ %endif --with-initddir=%{_initrddir} \ --with-systemddir=%{_unitdir} \ - --with-upstartdir=%{_sysconfdir}/init + --with-upstartdir=%{_sysconfdir}/init \ + --with-tmpfilesdir=%{_tmpfilesdir} make %{_smp_mflags} @@ -144,6 +159,27 @@ install -m 644 tools/corosync-notifyd.sysconfig.example \ install -m 644 init/corosync.sysconfig.example \ %{buildroot}%{_sysconfdir}/sysconfig/corosync +%if %{with qdevices} +# /etc/sysconfig/corosync-qdevice +install -m 644 init/corosync-qdevice.sysconfig.example \ + %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice +%endif + +%if %{with qnetd} +# /etc/sysconfig/corosync-qnetd +install -m 644 init/corosync-qnetd.sysconfig.example \ + %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd +%if %{with systemd} +sed -i -e 's/^#User=/User=/' \ + %{buildroot}%{_unitdir}/corosync-qnetd.service +sed -i -e 's/root/coroqnetd/g' \ + %{buildroot}%{_tmpfilesdir}/corosync-qnetd.conf +%else +sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \ + %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd +%endif +%endif + %clean rm -rf %{buildroot} @@ -336,7 +372,146 @@ The Corosync Cluster Engine APIs. %{_mandir}/man8/cmap_overview.8* %{_mandir}/man8/quorum_overview.8* +# optional qdevices +# +%if %{with qdevices} + +%package -n corosync-qdevice +Summary: The Corosync Cluster Engine Qdevice +Group: System Environment/Base +Requires: corosync +Requires: nss-tools + +%if %{with systemd} +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%endif + +%description -n corosync-qdevice +This package contains the Corosync Cluster Engine Qdevice, script for creating +NSS certificates and an init script. + +%post -n corosync-qdevice +%if %{with systemd} && 0%{?systemd_post:1} +%systemd_post corosync-qdevice.service +%else +if [ $1 -eq 1 ]; then + /sbin/chkconfig --add corosync-qdevice || : +fi +%endif + +%preun -n corosync-qdevice +%if %{with systemd} && 0%{?systemd_preun:1} +%systemd_preun corosync-qdevice.service +%else +if [ $1 -eq 0 ]; then + /sbin/service corosync-qdevice stop &>/dev/null || : + /sbin/chkconfig --del corosync-qdevice || : +fi +%endif + +%postun -n corosync-qdevice +%if %{with systemd} && 0%{?systemd_postun:1} +%systemd_postun +%endif + +%files -n corosync-qdevice +%defattr(-,root,root,-) +%dir %{_sysconfdir}/corosync/qdevice +%dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net +%dir %{_localstatedir}/run/corosync-qdevice +%{_sbindir}/corosync-qdevice +%{_sbindir}/corosync-qdevice-net-certutil +%{_sbindir}/corosync-qdevice-tool +%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice +%if %{with systemd} +%{_unitdir}/corosync-qdevice.service +%dir %{_datadir}/corosync +%{_datadir}/corosync/corosync-qdevice +%else +%{_initrddir}/corosync-qdevice +%endif +%{_mandir}/man8/corosync-qdevice-tool.8* +%{_mandir}/man8/corosync-qdevice-net-certutil.8* +%{_mandir}/man8/corosync-qdevice.8* +%endif + +# optional qnetd +# +%if %{with qnetd} + +%package -n corosync-qnetd +Summary: The Corosync Cluster Engine Qdevice Network Daemon +Group: System Environment/Base +Requires: nss-tools +Requires(pre): shadow-utils + +%if %{with systemd} +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%endif + +%description -n corosync-qnetd +This package contains the Corosync Cluster Engine Qdevice Network Daemon, script for creating +NSS certificates and an init script. + +%pre -n corosync-qnetd +getent group coroqnetd >/dev/null || groupadd -r coroqnetd +getent passwd coroqnetd >/dev/null || \ + useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd +exit 0 + +%post -n corosync-qnetd +%if %{with systemd} && 0%{?systemd_post:1} +%systemd_post corosync-qnetd.service +%else +if [ $1 -eq 1 ]; then + /sbin/chkconfig --add corosync-qnetd || : +fi +%endif + +%preun -n corosync-qnetd +%if %{with systemd} && 0%{?systemd_preun:1} +%systemd_preun corosync-qnetd.service +%else +if [ $1 -eq 0 ]; then + /sbin/service corosync-qnetd stop &>/dev/null || : + /sbin/chkconfig --del corosync-qnetd || : +fi +%endif + +%postun -n corosync-qnetd +%if %{with systemd} && 0%{?systemd_postun:1} +%systemd_postun +%endif + +%files -n corosync-qnetd +%defattr(-,root,root,-) +%dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd +%dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd +%{_bindir}/corosync-qnetd +%{_bindir}/corosync-qnetd-certutil +%{_bindir}/corosync-qnetd-tool +%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd +%if %{with systemd} +%{_unitdir}/corosync-qnetd.service +%dir %{_datadir}/corosync +%{_datadir}/corosync/corosync-qnetd +%{_tmpfilesdir}/corosync-qnetd.conf +%else +%{_initrddir}/corosync-qnetd +%endif +%{_mandir}/man8/corosync-qnetd-tool.8* +%{_mandir}/man8/corosync-qnetd-certutil.8* +%{_mandir}/man8/corosync-qnetd.8* +%endif + %changelog +* Thu Jun 30 2016 Jan Friesse - 2.4.0-1 +- New upstream release + * Thu Jun 16 2016 Jan Friesse - 2.3.6-1 - New upstream release diff --git a/sources b/sources index e64b846..c9a166f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -ea1e0421d474017d9ef3d6b741b7aaad corosync-2.3.6.tar.gz +11bdd5ee2aed5eb2443dd6d6acd6a1ab corosync-2.4.0.tar.gz From 3360c3f91b9f8e7cce05e9b18a4524d2ce24e4de Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 4 Aug 2016 17:51:46 +0200 Subject: [PATCH 111/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 8 ++++++-- sources | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 371cd36..e47d3ed 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ corosync-1.2.7.tar.gz /corosync-2.3.5.tar.gz /corosync-2.3.6.tar.gz /corosync-2.4.0.tar.gz +/corosync-2.4.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 5925634..f6e93f2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -22,7 +22,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.4.0 +Version: 2.4.1 Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base @@ -379,7 +379,8 @@ The Corosync Cluster Engine APIs. %package -n corosync-qdevice Summary: The Corosync Cluster Engine Qdevice Group: System Environment/Base -Requires: corosync +Requires: %{name} = %{version}-%{release} +Requires: corosynclib = %{version}-%{release} Requires: nss-tools %if %{with systemd} @@ -509,6 +510,9 @@ fi %endif %changelog +* Thu Aug 4 2016 Jan Friesse - 2.4.1-1 +- New upstream release + * Thu Jun 30 2016 Jan Friesse - 2.4.0-1 - New upstream release diff --git a/sources b/sources index c9a166f..9157da0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -11bdd5ee2aed5eb2443dd6d6acd6a1ab corosync-2.4.0.tar.gz +211a18722c9e98c35c421f32e719adb4 corosync-2.4.1.tar.gz From ba44badb827d9e6767f5fa0c9e02840fe07fe8c8 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 7 Nov 2016 17:52:52 +0100 Subject: [PATCH 112/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e47d3ed..59db94b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ corosync-1.2.7.tar.gz /corosync-2.3.6.tar.gz /corosync-2.4.0.tar.gz /corosync-2.4.1.tar.gz +/corosync-2.4.2.tar.gz diff --git a/corosync.spec b/corosync.spec index f6e93f2..820a569 100644 --- a/corosync.spec +++ b/corosync.spec @@ -22,7 +22,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.4.1 +Version: 2.4.2 Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base @@ -510,6 +510,9 @@ fi %endif %changelog +* Mon Nov 7 2016 Jan Friesse - 2.4.2-1 +- New upstream release + * Thu Aug 4 2016 Jan Friesse - 2.4.1-1 - New upstream release diff --git a/sources b/sources index 9157da0..96f2148 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -211a18722c9e98c35c421f32e719adb4 corosync-2.4.1.tar.gz +547fa78704da53aa35912be58d31035f corosync-2.4.2.tar.gz From 23e24a991e8a117bbcf4ce74d4da392080fa05ef Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 10 Feb 2017 07:54:54 +0000 Subject: [PATCH 113/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 820a569..07479ed 100644 --- a/corosync.spec +++ b/corosync.spec @@ -23,7 +23,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.2 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -510,6 +510,9 @@ fi %endif %changelog +* Fri Feb 10 2017 Fedora Release Engineering - 2.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + * Mon Nov 7 2016 Jan Friesse - 2.4.2-1 - New upstream release From f04e0e0f756dc060a554787cc8a01d9d8abdc2ee Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 26 Jul 2017 05:32:01 +0000 Subject: [PATCH 114/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 07479ed..2c9a301 100644 --- a/corosync.spec +++ b/corosync.spec @@ -23,7 +23,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.2 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -510,6 +510,9 @@ fi %endif %changelog +* Wed Jul 26 2017 Fedora Release Engineering - 2.4.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Fri Feb 10 2017 Fedora Release Engineering - 2.4.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild From 6373c76267f95f9ba4eda9eb4977bfeee2b80f0e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 2 Aug 2017 19:11:31 +0000 Subject: [PATCH 115/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 2c9a301..aa09770 100644 --- a/corosync.spec +++ b/corosync.spec @@ -23,7 +23,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.2 -Release: 3%{?gitver}%{?dist} +Release: 4%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -510,6 +510,9 @@ fi %endif %changelog +* Wed Aug 02 2017 Fedora Release Engineering - 2.4.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + * Wed Jul 26 2017 Fedora Release Engineering - 2.4.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 6752825d5fec0ef9db1536d7ed4e2525db89e8b0 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 23 Aug 2017 11:48:07 -0700 Subject: [PATCH 116/185] Disable RDMA on 32-bit ARM (#1484155) --- corosync.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/corosync.spec b/corosync.spec index aa09770..e281afb 100644 --- a/corosync.spec +++ b/corosync.spec @@ -6,8 +6,8 @@ %bcond_with monitoring %bcond_without snmp %bcond_without dbus -# no InfiniBand stack on s390(x) -%ifnarch s390 s390x +# no InfiniBand stack on s390(x) and 32-bit ARM +%ifnarch s390 s390x %{arm} %bcond_without rdma %endif %bcond_without systemd @@ -23,7 +23,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.2 -Release: 4%{?gitver}%{?dist} +Release: 5%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -510,6 +510,9 @@ fi %endif %changelog +* Wed Aug 23 2017 Adam Williamson - 2.4.2-5 +- Disable RDMA on 32-bit ARM (#1484155) + * Wed Aug 02 2017 Fedora Release Engineering - 2.4.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild From 990e0df2b56715dfa62abf0d5c7e1d394d596e89 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Mon, 2 Oct 2017 07:27:50 -0700 Subject: [PATCH 117/185] Bump to rebuild on newer binutils --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index e281afb..6028f89 100644 --- a/corosync.spec +++ b/corosync.spec @@ -23,7 +23,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.2 -Release: 5%{?gitver}%{?dist} +Release: 6%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -510,6 +510,9 @@ fi %endif %changelog +* Mon Oct 02 2017 Troy Dawson - 2.4.2-6 +- Bump to rebuild on newer binutils + * Wed Aug 23 2017 Adam Williamson - 2.4.2-5 - Disable RDMA on 32-bit ARM (#1484155) From 8306a5738470f7d759898f828b566673c3cbf0e5 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Mon, 9 Oct 2017 14:53:31 -0700 Subject: [PATCH 118/185] Cleanup spec file conditionals --- corosync.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/corosync.spec b/corosync.spec index 6028f89..bf1ed98 100644 --- a/corosync.spec +++ b/corosync.spec @@ -23,13 +23,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.2 -Release: 6%{?gitver}%{?dist} +Release: 7%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz -%if 0%{?rhel} +%if 0%{?rhel} && 0%{?rhel} <= 7 ExclusiveArch: i686 x86_64 %endif @@ -510,6 +510,9 @@ fi %endif %changelog +* Mon Oct 09 2017 Troy Dawson - 2.4.2-7 +- Cleanup spec file conditionals + * Mon Oct 02 2017 Troy Dawson - 2.4.2-6 - Bump to rebuild on newer binutils From 64e30d76c247c8ceeca7356ce0639162e95be310 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 20 Oct 2017 16:35:57 +0200 Subject: [PATCH 119/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 23 +++++++++++++++++------ sources | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 59db94b..bad6b37 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ corosync-1.2.7.tar.gz /corosync-2.4.0.tar.gz /corosync-2.4.1.tar.gz /corosync-2.4.2.tar.gz +/corosync-2.4.3.tar.gz diff --git a/corosync.spec b/corosync.spec index bf1ed98..a147d78 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,14 +16,15 @@ %bcond_without runautogen %bcond_without qdevices %bcond_without qnetd +%bcond_without libcgroup %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.4.2 -Release: 7%{?gitver}%{?dist} +Version: 2.4.3 +Release: 1%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -34,7 +35,8 @@ ExclusiveArch: i686 x86_64 %endif # Runtime bits -Requires: corosynclib = %{version}-%{release} +# The automatic dependency overridden in favor of explicit version lock +Requires: corosynclib%{?_isa} = %{version}-%{release} Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig @@ -77,6 +79,9 @@ Requires: nss-tools %if %{with qnetd} BuildRequires: sed %endif +%if %{with libcgroup} +BuildRequires: libcgroup-devel +%endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -127,6 +132,9 @@ export rdmacm_LIBS=-lrdmacm \ %endif %if %{with qnetd} --enable-qnetd \ +%endif +%if %{with libcgroup} + --enable-libcgroup \ %endif --with-initddir=%{_initrddir} \ --with-systemddir=%{_unitdir} \ @@ -302,7 +310,6 @@ This package contains corosync test agents. %package -n corosynclib Summary: The Corosync Cluster Engine Libraries Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} %description -n corosynclib This package contains corosync libraries. @@ -326,7 +333,7 @@ This package contains corosync libraries. %package -n corosynclib-devel Summary: The Corosync Cluster Engine Development Kit Group: Development/Libraries -Requires: corosynclib = %{version}-%{release} +Requires: corosynclib%{?_isa} = %{version}-%{release} Requires: pkgconfig Provides: corosync-devel = %{version} Obsoletes: corosync-devel < 0.92-7 @@ -380,7 +387,8 @@ The Corosync Cluster Engine APIs. Summary: The Corosync Cluster Engine Qdevice Group: System Environment/Base Requires: %{name} = %{version}-%{release} -Requires: corosynclib = %{version}-%{release} +# The automatic dependency overridden in favor of explicit version lock +Requires: corosynclib%{?_isa} = %{version}-%{release} Requires: nss-tools %if %{with systemd} @@ -510,6 +518,9 @@ fi %endif %changelog +* Fri Oct 20 2017 Jan Friesse - 2.4.3-1 +- New upstream release + * Mon Oct 09 2017 Troy Dawson - 2.4.2-7 - Cleanup spec file conditionals diff --git a/sources b/sources index 96f2148..acca7c2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -547fa78704da53aa35912be58d31035f corosync-2.4.2.tar.gz +SHA512 (corosync-2.4.3.tar.gz) = 3e07da606c7004846739ab9b3446a75e5026158f731e68c671716ead7c370f9d7d97bd3ace94bc3cc52144b39da96dc3cb1882fca743ac4a771b911415b3d5b2 From 0faff4d9a3c7ac5e2bc6448e48d4d633a4a8165b Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 19 Jan 2018 10:14:55 +0100 Subject: [PATCH 120/185] Rebuild to fix upgradepath Signed-off-by: Igor Gnatenko --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index a147d78..32ddd94 100644 --- a/corosync.spec +++ b/corosync.spec @@ -24,7 +24,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.3 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -518,6 +518,9 @@ fi %endif %changelog +* Fri Jan 19 2018 Igor Gnatenko - 2.4.3-2 +- Rebuild to fix upgradepath + * Fri Oct 20 2017 Jan Friesse - 2.4.3-1 - New upstream release From 1f4e674cb904e644436947910ef9b330bf9b6ff1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 7 Feb 2018 05:46:28 +0000 Subject: [PATCH 121/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 32ddd94..5509cd2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -24,7 +24,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.4.3 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD Group: System Environment/Base URL: http://corosync.github.io/corosync/ @@ -518,6 +518,9 @@ fi %endif %changelog +* Wed Feb 07 2018 Fedora Release Engineering - 2.4.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Fri Jan 19 2018 Igor Gnatenko - 2.4.3-2 - Rebuild to fix upgradepath From bf6213bc3f60a4271023699ca02fcc516c59e1ac Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 13 Feb 2018 23:10:16 +0100 Subject: [PATCH 122/185] Remove BuildRoot definition None of currently supported distributions need that. It was needed last for EL5 which is EOL now Signed-off-by: Igor Gnatenko --- corosync.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 5509cd2..feeb886 100644 --- a/corosync.spec +++ b/corosync.spec @@ -83,7 +83,6 @@ BuildRequires: sed BuildRequires: libcgroup-devel %endif -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %prep %setup -q -n %{name}-%{version}%{?gittarver} From 24004b75d82c9682a83e9be473fabea74aa5cd55 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 07:04:21 +0100 Subject: [PATCH 123/185] Remove %clean section None of currently supported distributions need that. Last one was EL5 which is EOL for a while. Signed-off-by: Igor Gnatenko --- corosync.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/corosync.spec b/corosync.spec index feeb886..1616ad6 100644 --- a/corosync.spec +++ b/corosync.spec @@ -187,9 +187,6 @@ sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \ %endif %endif -%clean -rm -rf %{buildroot} - %description This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. From 84a99727719fa742ce97c7166448c4ffee2b2be1 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 22 Mar 2018 09:03:07 +0100 Subject: [PATCH 124/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 254 ++++---------------------------------------------- sources | 2 +- 3 files changed, 19 insertions(+), 238 deletions(-) diff --git a/.gitignore b/.gitignore index bad6b37..be45a88 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ corosync-1.2.7.tar.gz /corosync-2.4.1.tar.gz /corosync-2.4.2.tar.gz /corosync-2.4.3.tar.gz +/corosync-2.99.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 1616ad6..8c80d6a 100644 --- a/corosync.spec +++ b/corosync.spec @@ -6,16 +6,9 @@ %bcond_with monitoring %bcond_without snmp %bcond_without dbus -# no InfiniBand stack on s390(x) and 32-bit ARM -%ifnarch s390 s390x %{arm} -%bcond_without rdma -%endif %bcond_without systemd -%bcond_with upstart %bcond_without xmlconf %bcond_without runautogen -%bcond_without qdevices -%bcond_without qnetd %bcond_without libcgroup %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} @@ -23,31 +16,22 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.4.3 -Release: 3%{?gitver}%{?dist} +Version: 2.99.1 +Release: 1%{?gitver}%{?dist} License: BSD -Group: System Environment/Base URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz -%if 0%{?rhel} && 0%{?rhel} <= 7 -ExclusiveArch: i686 x86_64 -%endif - # Runtime bits # The automatic dependency overridden in favor of explicit version lock Requires: corosynclib%{?_isa} = %{version}-%{release} -Requires(pre): /usr/sbin/useradd -Requires(post): /sbin/chkconfig -Requires(preun): /sbin/chkconfig -Obsoletes: openais, openais-devel, openaislib, openaislib-devel -Obsoletes: cman, clusterlib, clusterlib-devel # Build bits BuildRequires: groff -BuildRequires: libqb-devel >= 0.14.2 +BuildRequires: libqb-devel BuildRequires: nss-devel +BuildRequires: libknet1-devel BuildRequires: zlib-devel %if %{with runautogen} BuildRequires: autoconf automake libtool @@ -55,9 +39,6 @@ BuildRequires: autoconf automake libtool %if %{with monitoring} BuildRequires: libstatgrab-devel %endif -%if %{with rdma} -BuildRequires: libibverbs-devel librdmacm-devel -%endif %if %{with snmp} BuildRequires: net-snmp-devel %endif @@ -65,25 +46,20 @@ BuildRequires: net-snmp-devel BuildRequires: dbus-devel %endif %if %{with systemd} -BuildRequires: systemd-units -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd +%{?systemd_requires} +BuildRequires: systemd +BuildRequires: systemd-devel +%else +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig %endif %if %{with xmlconf} Requires: libxslt %endif -%if %{with qdevices} || %{with qnetd} -Requires: nss-tools -%endif -%if %{with qnetd} -BuildRequires: sed -%endif %if %{with libcgroup} BuildRequires: libcgroup-devel %endif - %prep %setup -q -n %{name}-%{version}%{?gittarver} @@ -92,12 +68,6 @@ BuildRequires: libcgroup-devel ./autogen.sh %endif -%if %{with rdma} -export ibverbs_CFLAGS=-I/usr/include/infiniband \ -export ibverbs_LIBS=-libverbs \ -export rdmacm_CFLAGS=-I/usr/include/rdma \ -export rdmacm_LIBS=-lrdmacm \ -%endif %{configure} \ %if %{with testagents} --enable-testagents \ @@ -114,37 +84,22 @@ export rdmacm_LIBS=-lrdmacm \ %if %{with dbus} --enable-dbus \ %endif -%if %{with rdma} - --enable-rdma \ -%endif %if %{with systemd} --enable-systemd \ %endif -%if %{with upstart} - --enable-upstart \ -%endif %if %{with xmlconf} --enable-xmlconf \ %endif -%if %{with qdevices} - --enable-qdevices \ -%endif -%if %{with qnetd} - --enable-qnetd \ -%endif %if %{with libcgroup} --enable-libcgroup \ %endif --with-initddir=%{_initrddir} \ --with-systemddir=%{_unitdir} \ - --with-upstartdir=%{_sysconfdir}/init \ - --with-tmpfilesdir=%{_tmpfilesdir} + --docdir=%{_docdir} make %{_smp_mflags} %install -rm -rf %{buildroot} - make install DESTDIR=%{buildroot} %if %{with dbus} @@ -166,27 +121,6 @@ install -m 644 tools/corosync-notifyd.sysconfig.example \ install -m 644 init/corosync.sysconfig.example \ %{buildroot}%{_sysconfdir}/sysconfig/corosync -%if %{with qdevices} -# /etc/sysconfig/corosync-qdevice -install -m 644 init/corosync-qdevice.sysconfig.example \ - %{buildroot}%{_sysconfdir}/sysconfig/corosync-qdevice -%endif - -%if %{with qnetd} -# /etc/sysconfig/corosync-qnetd -install -m 644 init/corosync-qnetd.sysconfig.example \ - %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd -%if %{with systemd} -sed -i -e 's/^#User=/User=/' \ - %{buildroot}%{_unitdir}/corosync-qnetd.service -sed -i -e 's/root/coroqnetd/g' \ - %{buildroot}%{_tmpfilesdir}/corosync-qnetd.conf -%else -sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \ - %{buildroot}%{_sysconfdir}/sysconfig/corosync-qnetd -%endif -%endif - %description This package contains the Corosync Cluster Engine Executive, several default APIs and libraries, default configuration files, and an init script. @@ -212,11 +146,10 @@ fi %postun %if %{with systemd} && 0%{?systemd_postun:1} -%systemd_postun +%systemd_postun corosync.service %endif %files -%defattr(-,root,root,-) %doc LICENSE SECURITY %{_sbindir}/corosync %{_sbindir}/corosync-keygen @@ -250,20 +183,13 @@ fi %if %{with systemd} %{_unitdir}/corosync.service %{_unitdir}/corosync-notifyd.service -%dir %{_datadir}/corosync -%{_datadir}/corosync/corosync -%{_datadir}/corosync/corosync-notifyd %else %{_initrddir}/corosync %{_initrddir}/corosync-notifyd %endif -%if %{with upstart} -%{_sysconfdir}/init/corosync.conf -%{_sysconfdir}/init/corosync-notifyd.conf -%endif %dir %{_localstatedir}/lib/corosync %dir %{_localstatedir}/log/cluster -%{_mandir}/man8/corosync_overview.8* +%{_mandir}/man7/corosync_overview.7* %{_mandir}/man8/corosync.8* %{_mandir}/man8/corosync-blackbox.8* %{_mandir}/man8/corosync-cmapctl.8* @@ -282,9 +208,7 @@ fi %package -n corosync-testagents Summary: The Corosync Cluster Engine Test Agents -Group: Development/Libraries Requires: %{name} = %{version}-%{release} -Requires: libqb >= 0.14.2 %description -n corosync-testagents This package contains corosync test agents. @@ -305,13 +229,11 @@ This package contains corosync test agents. # %package -n corosynclib Summary: The Corosync Cluster Engine Libraries -Group: System Environment/Libraries %description -n corosynclib This package contains corosync libraries. %files -n corosynclib -%defattr(-,root,root,-) %doc LICENSE %{_libdir}/libcfg.so.* %{_libdir}/libcpg.so.* @@ -328,18 +250,15 @@ This package contains corosync libraries. %package -n corosynclib-devel Summary: The Corosync Cluster Engine Development Kit -Group: Development/Libraries Requires: corosynclib%{?_isa} = %{version}-%{release} Requires: pkgconfig Provides: corosync-devel = %{version} -Obsoletes: corosync-devel < 0.92-7 %description -n corosynclib-devel This package contains include files and man pages used to develop using The Corosync Cluster Engine APIs. %files -n corosynclib-devel -%defattr(-,root,root,-) %doc LICENSE %dir %{_includedir}/corosync/ %{_includedir}/corosync/corodefs.h @@ -355,6 +274,7 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/totem/totem.h %{_includedir}/corosync/totem/totemip.h %{_includedir}/corosync/totem/totempg.h +%{_includedir}/corosync/totem/totemstats.h %{_libdir}/libcfg.so %{_libdir}/libcpg.so %{_libdir}/libcmap.so @@ -368,152 +288,12 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/quorum_*3* %{_mandir}/man3/votequorum_*3* %{_mandir}/man3/sam_*3* -%{_mandir}/man8/cpg_overview.8* -%{_mandir}/man8/votequorum_overview.8* -%{_mandir}/man8/sam_overview.8* %{_mandir}/man3/cmap_*3* -%{_mandir}/man8/cmap_overview.8* -%{_mandir}/man8/quorum_overview.8* - -# optional qdevices -# -%if %{with qdevices} - -%package -n corosync-qdevice -Summary: The Corosync Cluster Engine Qdevice -Group: System Environment/Base -Requires: %{name} = %{version}-%{release} -# The automatic dependency overridden in favor of explicit version lock -Requires: corosynclib%{?_isa} = %{version}-%{release} -Requires: nss-tools - -%if %{with systemd} -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -%endif - -%description -n corosync-qdevice -This package contains the Corosync Cluster Engine Qdevice, script for creating -NSS certificates and an init script. - -%post -n corosync-qdevice -%if %{with systemd} && 0%{?systemd_post:1} -%systemd_post corosync-qdevice.service -%else -if [ $1 -eq 1 ]; then - /sbin/chkconfig --add corosync-qdevice || : -fi -%endif - -%preun -n corosync-qdevice -%if %{with systemd} && 0%{?systemd_preun:1} -%systemd_preun corosync-qdevice.service -%else -if [ $1 -eq 0 ]; then - /sbin/service corosync-qdevice stop &>/dev/null || : - /sbin/chkconfig --del corosync-qdevice || : -fi -%endif - -%postun -n corosync-qdevice -%if %{with systemd} && 0%{?systemd_postun:1} -%systemd_postun -%endif - -%files -n corosync-qdevice -%defattr(-,root,root,-) -%dir %{_sysconfdir}/corosync/qdevice -%dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net -%dir %{_localstatedir}/run/corosync-qdevice -%{_sbindir}/corosync-qdevice -%{_sbindir}/corosync-qdevice-net-certutil -%{_sbindir}/corosync-qdevice-tool -%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice -%if %{with systemd} -%{_unitdir}/corosync-qdevice.service -%dir %{_datadir}/corosync -%{_datadir}/corosync/corosync-qdevice -%else -%{_initrddir}/corosync-qdevice -%endif -%{_mandir}/man8/corosync-qdevice-tool.8* -%{_mandir}/man8/corosync-qdevice-net-certutil.8* -%{_mandir}/man8/corosync-qdevice.8* -%endif - -# optional qnetd -# -%if %{with qnetd} - -%package -n corosync-qnetd -Summary: The Corosync Cluster Engine Qdevice Network Daemon -Group: System Environment/Base -Requires: nss-tools -Requires(pre): shadow-utils - -%if %{with systemd} -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -%endif - -%description -n corosync-qnetd -This package contains the Corosync Cluster Engine Qdevice Network Daemon, script for creating -NSS certificates and an init script. - -%pre -n corosync-qnetd -getent group coroqnetd >/dev/null || groupadd -r coroqnetd -getent passwd coroqnetd >/dev/null || \ - useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd -exit 0 - -%post -n corosync-qnetd -%if %{with systemd} && 0%{?systemd_post:1} -%systemd_post corosync-qnetd.service -%else -if [ $1 -eq 1 ]; then - /sbin/chkconfig --add corosync-qnetd || : -fi -%endif - -%preun -n corosync-qnetd -%if %{with systemd} && 0%{?systemd_preun:1} -%systemd_preun corosync-qnetd.service -%else -if [ $1 -eq 0 ]; then - /sbin/service corosync-qnetd stop &>/dev/null || : - /sbin/chkconfig --del corosync-qnetd || : -fi -%endif - -%postun -n corosync-qnetd -%if %{with systemd} && 0%{?systemd_postun:1} -%systemd_postun -%endif - -%files -n corosync-qnetd -%defattr(-,root,root,-) -%dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd -%dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd -%{_bindir}/corosync-qnetd -%{_bindir}/corosync-qnetd-certutil -%{_bindir}/corosync-qnetd-tool -%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd -%if %{with systemd} -%{_unitdir}/corosync-qnetd.service -%dir %{_datadir}/corosync -%{_datadir}/corosync/corosync-qnetd -%{_tmpfilesdir}/corosync-qnetd.conf -%else -%{_initrddir}/corosync-qnetd -%endif -%{_mandir}/man8/corosync-qnetd-tool.8* -%{_mandir}/man8/corosync-qnetd-certutil.8* -%{_mandir}/man8/corosync-qnetd.8* -%endif %changelog +* Fri Mar 16 2018 Jan Friesse - 2.99.1-1 +- New upstream release + * Wed Feb 07 2018 Fedora Release Engineering - 2.4.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild diff --git a/sources b/sources index acca7c2..2215492 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-2.4.3.tar.gz) = 3e07da606c7004846739ab9b3446a75e5026158f731e68c671716ead7c370f9d7d97bd3ace94bc3cc52144b39da96dc3cb1882fca743ac4a771b911415b3d5b2 +SHA512 (corosync-2.99.1.tar.gz) = 67ac34e7ace93efeefd60a06f6ba320b55f122308a00279f7273beb9b5798694015356f060ba3155f8dede1627adf2006aa2c2c4cbf48090feb1b51152155ef3 From 2db81d5d6ecf44c5ab071b0fd6bc24fe5429d9f7 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 30 Apr 2018 16:24:16 +0200 Subject: [PATCH 125/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index be45a88..a877a22 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ corosync-1.2.7.tar.gz /corosync-2.4.2.tar.gz /corosync-2.4.3.tar.gz /corosync-2.99.1.tar.gz +/corosync-2.99.2.tar.gz diff --git a/corosync.spec b/corosync.spec index 8c80d6a..fd7e508 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,7 +16,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.99.1 +Version: 2.99.2 Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ @@ -150,7 +150,7 @@ fi %endif %files -%doc LICENSE SECURITY +%doc LICENSE %{_sbindir}/corosync %{_sbindir}/corosync-keygen %{_sbindir}/corosync-cmapctl @@ -291,6 +291,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Mon Apr 30 2018 Jan Friesse - 2.99.2-1 +- New upstream release + * Fri Mar 16 2018 Jan Friesse - 2.99.1-1 - New upstream release diff --git a/sources b/sources index 2215492..6870395 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-2.99.1.tar.gz) = 67ac34e7ace93efeefd60a06f6ba320b55f122308a00279f7273beb9b5798694015356f060ba3155f8dede1627adf2006aa2c2c4cbf48090feb1b51152155ef3 +SHA512 (corosync-2.99.2.tar.gz) = 9029607ec3054d64cde89e84660962b34465ec31ba81e3568cad33d4a18c269e4ac718fdf192893dca7eb96c5bc0143cb9cefca499d87a64e46ac8c82f1bb901 From 72bbfc3f90cb6675587af220fd0a8b6f44da69a9 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 10 Jul 2018 08:16:51 +0200 Subject: [PATCH 126/185] Add gcc build require Signed-off-by: Jan Friesse --- corosync.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index fd7e508..302612c 100644 --- a/corosync.spec +++ b/corosync.spec @@ -27,7 +27,7 @@ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?git Requires: corosynclib%{?_isa} = %{version}-%{release} # Build bits - +BuildRequires: gcc BuildRequires: groff BuildRequires: libqb-devel BuildRequires: nss-devel From 8770850e742f46593930960d1d2792a8b1f49abf Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 12 Jul 2018 22:15:59 +0000 Subject: [PATCH 127/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 302612c..bd13f5b 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.99.2 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -291,6 +291,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Thu Jul 12 2018 Fedora Release Engineering - 2.99.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Mon Apr 30 2018 Jan Friesse - 2.99.2-1 - New upstream release From 44fbaf9d1a2e0bf8801ba0123876db7a20dce1fd Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 13 Jul 2018 14:28:39 +0200 Subject: [PATCH 128/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a877a22..0d4c0be 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ corosync-1.2.7.tar.gz /corosync-2.4.3.tar.gz /corosync-2.99.1.tar.gz /corosync-2.99.2.tar.gz +/corosync-2.99.3.tar.gz diff --git a/corosync.spec b/corosync.spec index bd13f5b..b082dc4 100644 --- a/corosync.spec +++ b/corosync.spec @@ -16,8 +16,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.99.2 -Release: 2%{?gitver}%{?dist} +Version: 2.99.3 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -291,6 +291,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Fri Jul 13 2018 Jan Friesse - 2.99.3-1 +- New upstream release + * Thu Jul 12 2018 Fedora Release Engineering - 2.99.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild diff --git a/sources b/sources index 6870395..fc569dc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-2.99.2.tar.gz) = 9029607ec3054d64cde89e84660962b34465ec31ba81e3568cad33d4a18c269e4ac718fdf192893dca7eb96c5bc0143cb9cefca499d87a64e46ac8c82f1bb901 +SHA512 (corosync-2.99.3.tar.gz) = 32a5ac4ba1c4eefd52c27b9fc42932be3731548652cb4bafb82acb04527c75d49f0659378340e8a0b73d195a571aea83e57e4ae321e2a1cd67c8f2c03e5b85ac From ddb1e0a841b6c893bf174a6c944c3e1994515e42 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 24 Jul 2018 14:40:15 -0700 Subject: [PATCH 129/185] Rebuild for new net-snmp --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index b082dc4..23b69c3 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.99.3 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -291,6 +291,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Tue Jul 24 2018 Adam Williamson - 2.99.3-2 +- Rebuild for new net-snmp + * Fri Jul 13 2018 Jan Friesse - 2.99.3-1 - New upstream release From 887b18eb357c9167bc7302702cb08932e09862fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Thu, 16 Aug 2018 21:06:55 +0200 Subject: [PATCH 130/185] 2.99.3-3 - Rebuild again, since the previous one was so unfortunate... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...it got affected with binutils (2.31.1-3.fc29) producing non-monotonically increasing section offsets causing unprepared eu-strip to damage the binary (related: rhbz#1609577) Apply patch to drop prevent redundancy in systemd journal Signed-off-by: Jan Pokorný --- ...08ad402b45f52b5d3ee8d2a08df0779ec9aa.patch | 43 +++++++++++++++++++ corosync.spec | 16 ++++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch diff --git a/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch b/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch new file mode 100644 index 0000000..77da7f8 --- /dev/null +++ b/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch @@ -0,0 +1,43 @@ +From c34208ad402b45f52b5d3ee8d2a08df0779ec9aa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= +Date: Tue, 14 Aug 2018 01:18:47 +0200 +Subject: [PATCH] systemd: prevent redundancy in journal +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Originating from a dual sink (stderr and syslog). + +Annotated example from "journalctl -b --no-hostname -u corosync": + +Aug 14 00:27:45 corosync[5203]: [MAIN ] Corosync Cluster +Engine ('2.99.3'): started and ready to provide service. + ^ from syslog source +Aug 14 00:27:45 corosync[5203]: notice [MAIN ] Corosync Cluster +Engine ('2.99.3'): started and ready to provide service. + ^ from stderr source + +Signed-off-by: Jan Pokorný +Reviewed-by: Jan Friesse +--- + init/corosync.service.in | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/init/corosync.service.in b/init/corosync.service.in +index 8c57652d4..654e41fc2 100644 +--- a/init/corosync.service.in ++++ b/init/corosync.service.in +@@ -10,6 +10,13 @@ EnvironmentFile=-@INITCONFIGDIR@/corosync + ExecStart=@SBINDIR@/corosync -f $COROSYNC_OPTIONS + Type=notify + ++# In typical systemd deployments, both standard outputs are forwarded to ++# journal (stderr is what's relevant in the pristine corosync configuration), ++# which hazards a message redundancy since the syslog stream usually ends there ++# as well; before editing this line, you may want to check DefaultStandardError ++# in systemd-system.conf(5) and whether /dev/log is a systemd related symlink. ++StandardError=null ++ + # The following config is for corosync with enabled watchdog service. + # + # When corosync watchdog service is being enabled and using with diff --git a/corosync.spec b/corosync.spec index 23b69c3..9d3fb26 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,10 +17,11 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.99.3 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz +Patch0: https://github.com/corosync/corosync/commit/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch # Runtime bits # The automatic dependency overridden in favor of explicit version lock @@ -60,8 +61,14 @@ Requires: libxslt BuildRequires: libcgroup-devel %endif +# git-style patch application +BuildRequires: git + %prep %setup -q -n %{name}-%{version}%{?gittarver} +%global __scm git_am +%__scm_setup_git +%autopatch -p1 %build %if %{with runautogen} @@ -291,6 +298,13 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Thu Aug 16 2018 Jan Pokorný - 2.99.3-3 +- Rebuild again, since the previous one was so unfortunate it got affected + with binutils (2.31.1-3.fc29) producing non-monotonically increasing + section offsets causing unprepared eu-strip to damage the binary + (related: rhbz#1609577) +- Apply patch to drop prevent redundancy in systemd journal + * Tue Jul 24 2018 Adam Williamson - 2.99.3-2 - Rebuild for new net-snmp From 0b6b7e10ef253a93d3cff7311245e81843082651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Thu, 16 Aug 2018 21:36:20 +0200 Subject: [PATCH 131/185] Re 2.99.3-3: fix a changelog typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- corosync.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 9d3fb26..bbd3b7b 100644 --- a/corosync.spec +++ b/corosync.spec @@ -303,7 +303,7 @@ The Corosync Cluster Engine APIs. with binutils (2.31.1-3.fc29) producing non-monotonically increasing section offsets causing unprepared eu-strip to damage the binary (related: rhbz#1609577) -- Apply patch to drop prevent redundancy in systemd journal +- Apply patch to prevent redundancy in systemd journal * Tue Jul 24 2018 Adam Williamson - 2.99.3-2 - Rebuild for new net-snmp From da8712b0025e97aa8a42ef078d23c6dd57cacfd8 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 20 Nov 2018 16:06:56 +0100 Subject: [PATCH 132/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + ...08ad402b45f52b5d3ee8d2a08df0779ec9aa.patch | 43 -------------- corosync.spec | 58 ++----------------- sources | 2 +- 4 files changed, 7 insertions(+), 97 deletions(-) delete mode 100644 c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch diff --git a/.gitignore b/.gitignore index 0d4c0be..a0b50ac 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ corosync-1.2.7.tar.gz /corosync-2.99.1.tar.gz /corosync-2.99.2.tar.gz /corosync-2.99.3.tar.gz +/corosync-2.99.4.tar.gz diff --git a/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch b/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch deleted file mode 100644 index 77da7f8..0000000 --- a/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch +++ /dev/null @@ -1,43 +0,0 @@ -From c34208ad402b45f52b5d3ee8d2a08df0779ec9aa Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= -Date: Tue, 14 Aug 2018 01:18:47 +0200 -Subject: [PATCH] systemd: prevent redundancy in journal -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Originating from a dual sink (stderr and syslog). - -Annotated example from "journalctl -b --no-hostname -u corosync": - -Aug 14 00:27:45 corosync[5203]: [MAIN ] Corosync Cluster -Engine ('2.99.3'): started and ready to provide service. - ^ from syslog source -Aug 14 00:27:45 corosync[5203]: notice [MAIN ] Corosync Cluster -Engine ('2.99.3'): started and ready to provide service. - ^ from stderr source - -Signed-off-by: Jan Pokorný -Reviewed-by: Jan Friesse ---- - init/corosync.service.in | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/init/corosync.service.in b/init/corosync.service.in -index 8c57652d4..654e41fc2 100644 ---- a/init/corosync.service.in -+++ b/init/corosync.service.in -@@ -10,6 +10,13 @@ EnvironmentFile=-@INITCONFIGDIR@/corosync - ExecStart=@SBINDIR@/corosync -f $COROSYNC_OPTIONS - Type=notify - -+# In typical systemd deployments, both standard outputs are forwarded to -+# journal (stderr is what's relevant in the pristine corosync configuration), -+# which hazards a message redundancy since the syslog stream usually ends there -+# as well; before editing this line, you may want to check DefaultStandardError -+# in systemd-system.conf(5) and whether /dev/log is a systemd related symlink. -+StandardError=null -+ - # The following config is for corosync with enabled watchdog service. - # - # When corosync watchdog service is being enabled and using with diff --git a/corosync.spec b/corosync.spec index bbd3b7b..0fa3ea0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -1,7 +1,6 @@ # Conditionals # Invoke "rpmbuild --without " or "rpmbuild --with " # to disable or enable specific features -%bcond_with testagents %bcond_with watchdog %bcond_with monitoring %bcond_without snmp @@ -9,19 +8,17 @@ %bcond_without systemd %bcond_without xmlconf %bcond_without runautogen -%bcond_without libcgroup %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.99.3 -Release: 3%{?gitver}%{?dist} +Version: 2.99.4 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz -Patch0: https://github.com/corosync/corosync/commit/c34208ad402b45f52b5d3ee8d2a08df0779ec9aa.patch # Runtime bits # The automatic dependency overridden in favor of explicit version lock @@ -31,7 +28,6 @@ Requires: corosynclib%{?_isa} = %{version}-%{release} BuildRequires: gcc BuildRequires: groff BuildRequires: libqb-devel -BuildRequires: nss-devel BuildRequires: libknet1-devel BuildRequires: zlib-devel %if %{with runautogen} @@ -57,18 +53,9 @@ Requires(preun): /sbin/chkconfig %if %{with xmlconf} Requires: libxslt %endif -%if %{with libcgroup} -BuildRequires: libcgroup-devel -%endif - -# git-style patch application -BuildRequires: git %prep %setup -q -n %{name}-%{version}%{?gittarver} -%global __scm git_am -%__scm_setup_git -%autopatch -p1 %build %if %{with runautogen} @@ -76,9 +63,6 @@ BuildRequires: git %endif %{configure} \ -%if %{with testagents} - --enable-testagents \ -%endif %if %{with watchdog} --enable-watchdog \ %endif @@ -96,9 +80,6 @@ BuildRequires: git %endif %if %{with xmlconf} --enable-xmlconf \ -%endif -%if %{with libcgroup} - --enable-libcgroup \ %endif --with-initddir=%{_initrddir} \ --with-systemddir=%{_unitdir} \ @@ -168,7 +149,6 @@ fi %{_bindir}/corosync-blackbox %if %{with xmlconf} %{_bindir}/corosync-xmlproc -%config(noreplace) %{_sysconfdir}/corosync/corosync.xml.example %dir %{_datadir}/corosync %{_datadir}/corosync/xml2conf.xsl %{_mandir}/man8/corosync-xmlproc.8* @@ -177,7 +157,6 @@ fi %dir %{_sysconfdir}/corosync %dir %{_sysconfdir}/corosync/uidgid.d %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example -%config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd %config(noreplace) %{_sysconfdir}/sysconfig/corosync %config(noreplace) %{_sysconfdir}/logrotate.d/corosync @@ -209,29 +188,6 @@ fi %{_mandir}/man5/votequorum.5* %{_mandir}/man8/cmap_keys.8* -# optional testagent rpm -# -%if %{with testagents} - -%package -n corosync-testagents -Summary: The Corosync Cluster Engine Test Agents -Requires: %{name} = %{version}-%{release} - -%description -n corosync-testagents -This package contains corosync test agents. - -%files -n corosync-testagents -%defattr(755,root,root,-) -%{_datadir}/corosync/tests/mem_leak_test.sh -%{_datadir}/corosync/tests/net_breaker.sh -%{_datadir}/corosync/tests/cmap-dispatch-deadlock.sh -%{_datadir}/corosync/tests/shm_leak_audit.sh -%{_bindir}/cpg_test_agent -%{_bindir}/sam_test_agent -%{_bindir}/votequorum_test_agent - -%endif - # library # %package -n corosynclib @@ -245,7 +201,6 @@ This package contains corosync libraries. %{_libdir}/libcfg.so.* %{_libdir}/libcpg.so.* %{_libdir}/libcmap.so.* -%{_libdir}/libtotem_pg.so.* %{_libdir}/libquorum.so.* %{_libdir}/libvotequorum.so.* %{_libdir}/libsam.so.* @@ -277,15 +232,9 @@ The Corosync Cluster Engine APIs. %{_includedir}/corosync/sam.h %{_includedir}/corosync/quorum.h %{_includedir}/corosync/votequorum.h -%dir %{_includedir}/corosync/totem/ -%{_includedir}/corosync/totem/totem.h -%{_includedir}/corosync/totem/totemip.h -%{_includedir}/corosync/totem/totempg.h -%{_includedir}/corosync/totem/totemstats.h %{_libdir}/libcfg.so %{_libdir}/libcpg.so %{_libdir}/libcmap.so -%{_libdir}/libtotem_pg.so %{_libdir}/libquorum.so %{_libdir}/libvotequorum.so %{_libdir}/libsam.so @@ -298,6 +247,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Tue Nov 20 2018 Jan Friesse - 2.99.4-1 +- New upstream release + * Thu Aug 16 2018 Jan Pokorný - 2.99.3-3 - Rebuild again, since the previous one was so unfortunate it got affected with binutils (2.31.1-3.fc29) producing non-monotonically increasing diff --git a/sources b/sources index fc569dc..af8e88d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-2.99.3.tar.gz) = 32a5ac4ba1c4eefd52c27b9fc42932be3731548652cb4bafb82acb04527c75d49f0659378340e8a0b73d195a571aea83e57e4ae321e2a1cd67c8f2c03e5b85ac +SHA512 (corosync-2.99.4.tar.gz) = 3475441d23d2218f70e93674ea61ba2bca40202a93a17fbfa086acb7654a38f7e248463035fb8e904479170c93b057ae00ad7203b6a0f1db2da388b7ad07072b From aa14fb4aa43ed5d25611060e54bed6676ab6ada9 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 4 Dec 2018 18:21:03 +0100 Subject: [PATCH 133/185] Add libknet1-crypto-nss-plugin dependency Signed-off-by: Jan Friesse --- corosync.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 0fa3ea0..bde8a87 100644 --- a/corosync.spec +++ b/corosync.spec @@ -15,7 +15,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 2.99.4 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -24,6 +24,9 @@ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?git # The automatic dependency overridden in favor of explicit version lock Requires: corosynclib%{?_isa} = %{version}-%{release} +# NSS crypto plugin should be always installed +Requires: libknet1-crypto-nss-plugin + # Build bits BuildRequires: gcc BuildRequires: groff @@ -247,6 +250,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Tue Dec 4 2018 Jan Friesse - 2.99.4-2 +- Add libknet1-crypto-nss-plugin dependency + * Tue Nov 20 2018 Jan Friesse - 2.99.4-1 - New upstream release From cf418a73bc532672c17ae3ea9203d1a8878bb0b6 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 7 Dec 2018 17:15:26 +0100 Subject: [PATCH 134/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a0b50ac..bba8cc3 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ corosync-1.2.7.tar.gz /corosync-2.99.2.tar.gz /corosync-2.99.3.tar.gz /corosync-2.99.4.tar.gz +/corosync-2.99.5.tar.gz diff --git a/corosync.spec b/corosync.spec index bde8a87..f7c879e 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,8 +14,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.99.4 -Release: 2%{?gitver}%{?dist} +Version: 2.99.5 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -250,6 +250,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Fri Dec 7 2018 Jan Friesse - 2.99.5-1 +- New upstream release + * Tue Dec 4 2018 Jan Friesse - 2.99.4-2 - Add libknet1-crypto-nss-plugin dependency diff --git a/sources b/sources index af8e88d..5ed0193 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-2.99.4.tar.gz) = 3475441d23d2218f70e93674ea61ba2bca40202a93a17fbfa086acb7654a38f7e248463035fb8e904479170c93b057ae00ad7203b6a0f1db2da388b7ad07072b +SHA512 (corosync-2.99.5.tar.gz) = b8433f23d55993a8bba754ed3926fea0c7d7e3a9a3e1c03f0d0a34be1fce58007b81cb3da0bc991035250fc67a16351312c5225763303b7e3034de8cac4b582b From 2297645dcf9487035dd980a261e1c7301c699500 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 14 Dec 2018 14:11:29 +0100 Subject: [PATCH 135/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bba8cc3..82b1cf3 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ corosync-1.2.7.tar.gz /corosync-2.99.3.tar.gz /corosync-2.99.4.tar.gz /corosync-2.99.5.tar.gz +/corosync-3.0.0.tar.gz diff --git a/corosync.spec b/corosync.spec index f7c879e..d6d370b 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,7 +14,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 2.99.5 +Version: 3.0.0 Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ @@ -250,6 +250,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Fri Dec 14 2018 Jan Friesse - 3.0.0-1 +- New upstream release + * Fri Dec 7 2018 Jan Friesse - 2.99.5-1 - New upstream release diff --git a/sources b/sources index 5ed0193..b7a07d5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-2.99.5.tar.gz) = b8433f23d55993a8bba754ed3926fea0c7d7e3a9a3e1c03f0d0a34be1fce58007b81cb3da0bc991035250fc67a16351312c5225763303b7e3034de8cac4b582b +SHA512 (corosync-3.0.0.tar.gz) = 2e4f8216ee9b09654cf00fd26d116e00afd5330965203889e49b8fcef7c68fe65fd007402247a5a3df1c15b246c0d6de9aeb236a46c59ee91408a584b91269c9 From 2f2b1dd77422af476784e49f50c36907a63957b9 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 15 Jan 2019 14:31:27 +0100 Subject: [PATCH 136/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 82b1cf3..3567e84 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ corosync-1.2.7.tar.gz /corosync-2.99.4.tar.gz /corosync-2.99.5.tar.gz /corosync-3.0.0.tar.gz +/corosync-3.0.1.tar.gz diff --git a/corosync.spec b/corosync.spec index d6d370b..4bcce2c 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,7 +14,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.0.0 +Version: 3.0.1 Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ @@ -250,6 +250,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Tue Jan 15 2019 Jan Friesse - 3.0.1-1 +- New upstream release + * Fri Dec 14 2018 Jan Friesse - 3.0.0-1 - New upstream release diff --git a/sources b/sources index b7a07d5..3d585e7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.0.0.tar.gz) = 2e4f8216ee9b09654cf00fd26d116e00afd5330965203889e49b8fcef7c68fe65fd007402247a5a3df1c15b246c0d6de9aeb236a46c59ee91408a584b91269c9 +SHA512 (corosync-3.0.1.tar.gz) = 9e70aadb331ffb3ef86b4c7dff8608ef3723810b3065e9aa2dc8a7abe84a26c34445c7a6d872339e19e77247aac1be7297c97d2012fe64502372eeb3e2aa19b7 From f7bc9a1c2270d93585739bd18ad779bf8f533912 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 22 Jan 2019 18:38:44 +0100 Subject: [PATCH 137/185] Remove obsolete ldconfig scriptlets References: https://fedoraproject.org/wiki/Changes/RemoveObsoleteScriptlets Signed-off-by: Igor Gnatenko --- corosync.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/corosync.spec b/corosync.spec index 4bcce2c..25dfe13 100644 --- a/corosync.spec +++ b/corosync.spec @@ -209,9 +209,7 @@ This package contains corosync libraries. %{_libdir}/libsam.so.* %{_libdir}/libcorosync_common.so.* -%post -n corosynclib -p /sbin/ldconfig - -%postun -n corosynclib -p /sbin/ldconfig +%ldconfig_scriptlets -n corosynclib %package -n corosynclib-devel Summary: The Corosync Cluster Engine Development Kit From e4857e19a16bc2ecff69b68918c16304624785cc Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 31 Jan 2019 16:18:30 +0000 Subject: [PATCH 138/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 25dfe13..4c7984d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -15,7 +15,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.1 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -248,6 +248,9 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/cmap_*3* %changelog +* Thu Jan 31 2019 Fedora Release Engineering - 3.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Tue Jan 15 2019 Jan Friesse - 3.0.1-1 - New upstream release From 7d603e7ff1ed6631d9ecc8aa3e34becd369434c6 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 12 Jun 2019 17:34:50 +0200 Subject: [PATCH 139/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 44 ++++++++++++++++++++++++++++++++++++++++++-- sources | 2 +- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3567e84..7567368 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ corosync-1.2.7.tar.gz /corosync-2.99.5.tar.gz /corosync-3.0.0.tar.gz /corosync-3.0.1.tar.gz +/corosync-3.0.2.tar.gz diff --git a/corosync.spec b/corosync.spec index 4c7984d..391972c 100644 --- a/corosync.spec +++ b/corosync.spec @@ -7,15 +7,18 @@ %bcond_without dbus %bcond_without systemd %bcond_without xmlconf +%bcond_without nozzle +%bcond_without vqsim %bcond_without runautogen +%bcond_without userflags %global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} %global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.0.1 -Release: 2%{?gitver}%{?dist} +Version: 3.0.2 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -45,6 +48,9 @@ BuildRequires: net-snmp-devel %if %{with dbus} BuildRequires: dbus-devel %endif +%if %{with nozzle} +BuildRequires: libnozzle1-devel +%endif %if %{with systemd} %{?systemd_requires} BuildRequires: systemd @@ -56,6 +62,9 @@ Requires(preun): /sbin/chkconfig %if %{with xmlconf} Requires: libxslt %endif +%if %{with vqsim} +BuildRequires: readline-devel +%endif %prep %setup -q -n %{name}-%{version}%{?gittarver} @@ -83,6 +92,15 @@ Requires: libxslt %endif %if %{with xmlconf} --enable-xmlconf \ +%endif +%if %{with nozzle} + --enable-nozzle \ +%endif +%if %{with vqsim} + --enable-vqsim \ +%endif +%if %{with userflags} + --enable-user-flags \ %endif --with-initddir=%{_initrddir} \ --with-systemddir=%{_unitdir} \ @@ -247,7 +265,29 @@ The Corosync Cluster Engine APIs. %{_mandir}/man3/sam_*3* %{_mandir}/man3/cmap_*3* +%if %{with vqsim} +%package -n corosync-vqsim +Summary: The Corosync Cluster Engine - Votequorum Simulator +Requires: corosynclib%{?_isa} = %{version}-%{release} +Requires: pkgconfig + +%description -n corosync-vqsim +A command-line simulator for the corosync votequorum subsystem. +It uses the same code as the corosync quorum system but forks +them into subprocesses to simulate nodes. +Nodes can be added and removed as well as partitioned (to simulate +network splits) + +%files -n corosync-vqsim +%doc LICENSE +%{_bindir}/corosync-vqsim +%{_mandir}/man8/corosync-vqsim.8* +%endif + %changelog +* Wed Jun 12 2019 Jan Friesse - 3.0.2-1 +- New upstream release + * Thu Jan 31 2019 Fedora Release Engineering - 3.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index 3d585e7..c31c546 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.0.1.tar.gz) = 9e70aadb331ffb3ef86b4c7dff8608ef3723810b3065e9aa2dc8a7abe84a26c34445c7a6d872339e19e77247aac1be7297c97d2012fe64502372eeb3e2aa19b7 +SHA512 (corosync-3.0.2.tar.gz) = be2d5caf41fea9dc337a317ee4f2f90ad6587b2ad2ff09b62e376e0d9273fb8ac6b71a4c1b0ac8e263f1eef2fbc2fb7c0558f1c78cd71f1242a57c58b6d137ca From 49fbb1275f135807b3b003448b558e149732d343 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jul 2019 21:02:45 +0000 Subject: [PATCH 140/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 391972c..7d05b54 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.2 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Wed Jul 24 2019 Fedora Release Engineering - 3.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Wed Jun 12 2019 Jan Friesse - 3.0.2-1 - New upstream release From 4b7a0f46e61610b42502033c64926a1261f055a8 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 25 Nov 2019 13:48:55 +0100 Subject: [PATCH 141/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7567368..9c73c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ corosync-1.2.7.tar.gz /corosync-3.0.0.tar.gz /corosync-3.0.1.tar.gz /corosync-3.0.2.tar.gz +/corosync-3.0.3.tar.gz diff --git a/corosync.spec b/corosync.spec index 7d05b54..90913ad 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,8 +17,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.0.2 -Release: 2%{?gitver}%{?dist} +Version: 3.0.3 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Mon Nov 25 2019 Jan Friesse - 3.0.3-1 +- New upstream release + * Wed Jul 24 2019 Fedora Release Engineering - 3.0.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/sources b/sources index c31c546..0cf7000 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.0.2.tar.gz) = be2d5caf41fea9dc337a317ee4f2f90ad6587b2ad2ff09b62e376e0d9273fb8ac6b71a4c1b0ac8e263f1eef2fbc2fb7c0558f1c78cd71f1242a57c58b6d137ca +SHA512 (corosync-3.0.3.tar.gz) = 6ffabb3261bcff18611a029f0c2682367f301caac6f5ddb2cfb2c1bbc69c67f1d1e7b9475eee8f40bcdca8fbc73cb8ec3854f74002dda9c3b70a27c8d3d16ec5 From ae11d23e5a50cd7ae8c60e3a4ea2087cb9cbdfdd Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jan 2020 14:50:41 +0000 Subject: [PATCH 142/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 90913ad..3884b41 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.3 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Tue Jan 28 2020 Fedora Release Engineering - 3.0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Mon Nov 25 2019 Jan Friesse - 3.0.3-1 - New upstream release From d68d041157007ec050cb15c52fb23c580ce96857 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 26 Mar 2020 18:29:31 +0100 Subject: [PATCH 143/185] Add CI tests using the Standard Test Interface --- tests/.gitignore | 3 + tests/smoke/runtest.sh | 623 +++++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 12 + 3 files changed, 638 insertions(+) create mode 100644 tests/.gitignore create mode 100644 tests/smoke/runtest.sh create mode 100644 tests/tests.yml diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..e6c79fd --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,3 @@ +# Ignore tests runs/artefacts. +artifacts/** +**/*.retry diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100644 index 0000000..9fd5e68 --- /dev/null +++ b/tests/smoke/runtest.sh @@ -0,0 +1,623 @@ +#!/bin/bash + +# This file was autogenerated at 2019-05-13T13:43:38+02:00 from 90bd97ada89befa1a63133335a419ad7311c3d75 + +# Copyright (c) 2019, Red Hat, Inc. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND RED HAT, INC. DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RED HAT, INC. BE LIABLE +# FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Author: Jan Friesse + + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# !!! Script overwrites corosync.conf, authkey and qdevice/qnetd certificates !!! +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +# Home https://github.com/jfriesse/csts/tree/master/smoke + +# -e is really important +set -xe +set -o pipefail + +# Variables changing test behavior +PREFIX="/" + +COROSYNC_SYSCONFD="${PREFIX}etc/corosync" +COROSYNC_CONF="${COROSYNC_SYSCONFD}/corosync.conf" +COROSYNC_AUTHKEY="${COROSYNC_SYSCONFD}/authkey" +COROSYNC_CLUSTER_NAME="smoketestcluster" + +TOKEN_TIMEOUT=1000 +MAX_REPEATS=60 + +#################### +# Helper functions # +#################### +get_ip() { + ip_res=$(ip route get 8.8.8.8) + # Format is "8.8.8.8 via ROUTE_IPADDR dev DEV src IPADDR uid NUMBER" + # Remove everything up to "src " and then everything after " " + addr=${ip_res##*src } + addr=${addr%% *} + + echo "$addr" +} + +# generate_corosync_conf crypto [token] [qdevice] +# crypto can be on or off +# when token is defined it is used for token timeout +# when qdevice is set to on qdevice section is created and second node is added +generate_corosync_conf() { + case "$1" in + "on") + cipher="aes256" + hash="sha256" + ;; + "off") + cipher="none" + hash="none" + ;; + *) + # Unknown crypto + exit 1 + esac + + token=$TOKEN_TIMEOUT + if [ ! -z "$2" ];then + token="$2" + fi + qdevice="$3" + true_command=`which true` + +cat << _EOF_ + totem { + version: 2 + cluster_name: $COROSYNC_CLUSTER_NAME + transport: knet + crypto_cipher: $cipher + crypto_hash: $hash + token: $token + } + + logging { + to_logfile: yes + logfile: /var/log/cluster/corosync.log + to_syslog: yes + } + + quorum { + provider: corosync_votequorum +_EOF_ + + if [ "$qdevice" == "on" ];then +cat << _EOF_ + device { + votes: 1 + model: net + net { + host: $LOCAL_IP + algorithm: ffsplit + } + heuristics { + mode: sync + exec_true: $true_command + } + } +_EOF_ + fi + +cat << _EOF_ + } + + nodelist { + node { + nodeid: 1 + ring0_addr: $LOCAL_IP + } +_EOF_ + + if [ "$qdevice" == "on" ];then +cat << _EOF_ + node { + nodeid: 2 + ring0_addr: 192.0.2.2 + } +_EOF_ + fi + +cat << _EOF_ + } +_EOF_ +} + +# service_start service +service_start() { + # service service must be inactive + systemctl is-active "$1" && exit 1 || true + + systemctl start "$1" + + systemctl is-active "$1" +} + +# service_stop service +service_stop() { + systemctl is-active "$1" || exit 1 + + systemctl stop "$1" + + systemctl is-active "$1" && exit 1 || true +} + +###################### +# Computed variables # +###################### +LOCAL_IP=$(get_ip) + +################## +# C test sources # +################## + +# Test sources are encoded as a base64 string and piped to base64 to store them in /tmp +# corosync-api-test.c +echo "LyoKICogQ29weXJpZ2h0IChjKSAyMDE5LCBSZWQgSGF0LCBJbmMuCiAqCiAqIFBlcm1pc3Npb24g +dG8gdXNlLCBjb3B5LCBtb2RpZnksIGFuZC9vciBkaXN0cmlidXRlIHRoaXMgc29mdHdhcmUgZm9y +IGFueQogKiBwdXJwb3NlIHdpdGggb3Igd2l0aG91dCBmZWUgaXMgaGVyZWJ5IGdyYW50ZWQsIHBy +b3ZpZGVkIHRoYXQgdGhlIGFib3ZlCiAqIGNvcHlyaWdodCBub3RpY2UgYW5kIHRoaXMgcGVybWlz +c2lvbiBub3RpY2UgYXBwZWFyIGluIGFsbCBjb3BpZXMuCiAqCiAqIFRIRSBTT0ZUV0FSRSBJUyBQ +Uk9WSURFRCAiQVMgSVMiIEFORCBSRUQgSEFULCBJTkMuIERJU0NMQUlNUyBBTEwgV0FSUkFOVElF +UwogKiBXSVRIIFJFR0FSRCBUTyBUSElTIFNPRlRXQVJFIElOQ0xVRElORyBBTEwgSU1QTElFRCBX +QVJSQU5USUVTCiAqIE9GIE1FUkNIQU5UQUJJTElUWSBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQg +U0hBTEwgUkVEIEhBVCwgSU5DLiBCRSBMSUFCTEUKICogRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1Qs +IElORElSRUNULCBPUiBDT05TRVFVRU5USUFMIERBTUFHRVMgT1IgQU5ZIERBTUFHRVMKICogV0hB +VFNPRVZFUiBSRVNVTFRJTkcgRlJPTSBMT1NTIE9GIFVTRSwgREFUQSBPUiBQUk9GSVRTLCBXSEVU +SEVSIElOIEFOIEFDVElPTgogKiBPRiBDT05UUkFDVCwgTkVHTElHRU5DRSBPUiBPVEhFUiBUT1JU +SU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOCiAqIENPTk5FQ1RJT04gV0lUSCBUSEUg +VVNFIE9SIFBFUkZPUk1BTkNFIE9GIFRISVMgU09GVFdBUkUuCiAqCiAqIEF1dGhvcjogSmFuIEZy +aWVzc2UgPGpmcmllc3NlQHJlZGhhdC5jb20+CiAqLwoKLyoKICogU2ltcGxlIHRlc3Qgb2YgQ1BH +IGNhbGxiYWNrcy4gUHJvZ3JhbSBpbml0aWFsbHkgam9pbnMgQ1BHIGdyb3VwLCB3YWl0cyBmb3IK +ICogY3BnX2NvbmZjaGcgYW5kIGNwZ190b3RlbV9jb25mY2hnIGNhbGxiYWNrcyBhbmQgdGhlbiBz +dGFydHMgbG9vcCBvZiBzZW5kaW5nCiAqIGFuZCB3YWl0aW5nIGZvciB0aGUgbWVzc2FnZS4gTWVz +c2FnZSBoYXMgcmFuZG9tIGxlbmd0aCAodXAtdG8gTUFYX01TR19MRU4pCiAqIGFuZCByYW5kb20g +Y29udGVudC4gcmFuZF9yIGlzIHVzZWQgZm9yIHJhbmRvbSBudW1iZXIgZ2VuZXJhdGluZy4gTWVz +c2FnZQogKiBpcyBjaGVja2VkIG9uIGRlbGl2ZXJ5IGJ5IGlzc3Vpbmcgc2FtZSByYW5kX3IuIFNl +ZWQgZm9yIHJhbmRfciBhcmUKICogc3RvcmVkIGluIHNlbnRfcmFuZF9zZWVkIGFuZCByZWNlaXZl +ZF9yYW5kX3NlZWQgdmFyaWFibGVzLgogKgogKiBUaGlzIHRlc3QgY2hlY2tzIGZvbGxvd2luZyBD +UEcgcHJvcGVydGllczoKICogLSBQcm9jZXNzIGNhbiBqb2luIENQRyBncm91cAogKiAtIEJvdGgg +Y3BnX2NvbmZjaGcgYW5kIGNwZ190b3RlbV9jb25mY2hnIGNhbGxiYWNrcyBhcmUgcmVjZWl2ZWQg +d2l0aAogKiAgIG9ubHkgb25lIG5vZGUgYW5kIG9ubHkgb25lIHByb2Nlc3MgaW4gdGhlcmUKICog +LSBNZXNzYWdlcyBhcmUgc2VudCBhbmQgcmVjZWl2ZWQgd2l0aG91dCBhbnkgY29ycnVwdGlvbgog +Ki8KCiNpbmNsdWRlIDxzeXMvdHlwZXMuaD4KI2luY2x1ZGUgPHN5cy9zb2NrZXQuaD4KCiNpbmNs +dWRlIDxhc3NlcnQuaD4KI2luY2x1ZGUgPGVycm5vLmg+CiNpbmNsdWRlIDxpbnR0eXBlcy5oPgoj +aW5jbHVkZSA8cG9sbC5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgoj +aW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDx1bmlzdGQuaD4KCiNpbmNsdWRlIDxjb3Jvc3lu +Yy9jb3JvdHlwZXMuaD4KI2luY2x1ZGUgPGNvcm9zeW5jL2NwZy5oPgoKLyoKICogUHJlZGVmaW5l +ZCB0ZXN0IGNvbnN0YW50cwogKi8KI2RlZmluZSBURVNUX05PREVJRAkJMQojZGVmaW5lIFRFU1Rf +R1JPVVBfTkFNRQkJInNtb2tlLWFwaS10ZXN0LWNwZy1ncm91cCIKI2RlZmluZSBNQVhfUkVUUklF +UwkJMzAKI2RlZmluZSBNQVhfTVNHX0xFTgkJKDEwMjQgKiAxMjgpCiNkZWZpbmUgTUVTU0FHRVNf +VE9fU0VOVAkxMjgKCi8qCiAqIFVzZWZ1bCBtYWNyb3MKICovCiNkZWZpbmUgY3NfcmVwZWF0KGNv +ZGUpIGRvIHsJCQkJXAoJaW50IGNzX3JlcGVhdF9jb3VudGVyID0gMDsJCQlcCglkbyB7CQkJCQkJ +XAoJCWlmICgoY29kZSkgPT0gQ1NfRVJSX1RSWV9BR0FJTikgewlcCgkJCWNzX3JlcGVhdF9jb3Vu +dGVyKys7CQlcCgkJCXBvbGwoTlVMTCwgMCwgMTAwMCk7CQlcCgkJfSBlbHNlIHsJCQkJXAoJCQli +cmVhazsJCQkJXAoJCX0JCQkJCVwKCX0gd2hpbGUgKGNzX3JlcGVhdF9jb3VudGVyIDwgTUFYX1JF +VFJJRVMpOwlcCn0gd2hpbGUgKDApCgojaWZuZGVmIElORlRJTQojZGVmaW5lIElORlRJTQkJCS0x +CiNlbmRpZgoKI2RlZmluZSBFTlRFUigpIHByaW50ZigiKyAlczoldSAlc1xuIiwgX19GSUxFX18s +IF9fTElORV9fLCBfX2Z1bmNfXykKI2RlZmluZSBMRUFWRSgpIHByaW50ZigiLSAlczoldSAlc1xu +IiwgX19GSUxFX18sIF9fTElORV9fLCBfX2Z1bmNfXykKCnN0YXRpYyBpbnQgY3BnX2NvbmZjaGdf +cmVjZWl2ZWQgPSAwOwpzdGF0aWMgaW50IGNwZ190b3RlbV9jb25mY2hnX3JlY2VpdmVkID0gMDsK +Ci8qCiAqIGJvdGggcmFuZCBzZWVkcyBtdXN0IGJlIGluIHN5bmMKICovCnN0YXRpYyB1bnNpZ25l +ZCBpbnQgc2VudF9yYW5kX3NlZWQgPSAwOwpzdGF0aWMgdW5zaWduZWQgaW50IHJlY2VpdmVkX3Jh +bmRfc2VlZCA9IDA7CnN0YXRpYyB1aW50MzJfdCBzZW50X21zZ19zZXFfbm8gPSAwOwpzdGF0aWMg +dWludDMyX3QgcmVjZWl2ZWRfbXNnX3NlcV9ubyA9IDA7CgpzdHJ1Y3QgdGVzdF9tc2cgewoJdWlu +dDMyX3Qgc2VxX25vIF9fYXR0cmlidXRlX18gKChhbGlnbmVkICg4KSkpOwoJdWludDMyX3QgZGF0 +YV9sZW4gX19hdHRyaWJ1dGVfXyAoKGFsaWduZWQgKDgpKSk7Cgl1bnNpZ25lZCBjaGFyIGRhdGFb +MF0gX19hdHRyaWJ1dGVfXyAoKGFsaWduZWQgKDgpKSk7Cn07CgpzdGF0aWMgdm9pZApEZWxpdmVy +Q2FsbGJhY2soY3BnX2hhbmRsZV90IGhhbmRsZSwKICAgIGNvbnN0IHN0cnVjdCBjcGdfbmFtZSAq +Z3JvdXBOYW1lLAogICAgdWludDMyX3Qgbm9kZWlkLAogICAgdWludDMyX3QgcGlkLAogICAgdm9p +ZCAqY3BnX21zZywKICAgIHNpemVfdCBjcGdfbXNnX2xlbikKewoJc3RydWN0IHRlc3RfbXNnICpt +c2c7Cgl1aW50MzJfdCB1MzI7CgoJRU5URVIoKTsKCglhc3NlcnQobm9kZWlkID09IFRFU1RfTk9E +RUlEKTsKCWFzc2VydChwaWQgPT0gZ2V0cGlkKCkpOwoKCWFzc2VydChjcGdfbXNnX2xlbiA+PSBz +aXplb2Yoc3RydWN0IHRlc3RfbXNnKSk7CgoJbXNnID0gKHN0cnVjdCB0ZXN0X21zZyAqKWNwZ19t +c2c7Cglhc3NlcnQobXNnLT5zZXFfbm8gPT0gcmVjZWl2ZWRfbXNnX3NlcV9ubyk7CglyZWNlaXZl +ZF9tc2dfc2VxX25vKys7CgoJYXNzZXJ0KGNwZ19tc2dfbGVuID09IG1zZy0+ZGF0YV9sZW4gKyBz +aXplb2Yoc3RydWN0IHRlc3RfbXNnKSk7CgoJLyoKCSAqIE1lc3NhZ2UgaGFzIGV4cGVjdGVkIGxl +bmd0aCBhbmQgY29udGVudAoJICovCglhc3NlcnQobXNnLT5kYXRhX2xlbiA9PSAodWludDMyX3Qp +KHJhbmRfcigmcmVjZWl2ZWRfcmFuZF9zZWVkKSAlIE1BWF9NU0dfTEVOKSk7CgoJZm9yICh1MzIg +PSAwOyB1MzIgPCBtc2ctPmRhdGFfbGVuOyB1MzIrKykgewoJCWFzc2VydChtc2ctPmRhdGFbdTMy +XSA9PSAodW5zaWduZWQgY2hhcilyYW5kX3IoJnJlY2VpdmVkX3JhbmRfc2VlZCkpOwoJfQoKCUxF +QVZFKCk7Cn0KCnN0YXRpYyB2b2lkClRvdGVtQ29uZmNoZ0NhbGxiYWNrKGNwZ19oYW5kbGVfdCBo +YW5kbGUsCiAgICBzdHJ1Y3QgY3BnX3JpbmdfaWQgcmluZ19pZCwKICAgIHVpbnQzMl90IG1lbWJl +cl9saXN0X2VudHJpZXMsCiAgICBjb25zdCB1aW50MzJfdCAqbWVtYmVyX2xpc3QpCnsKCglFTlRF +UigpOwoKCWFzc2VydChtZW1iZXJfbGlzdF9lbnRyaWVzID09IDEpOwoJYXNzZXJ0KG1lbWJlcl9s +aXN0WzBdID09IFRFU1RfTk9ERUlEKTsKCgljcGdfdG90ZW1fY29uZmNoZ19yZWNlaXZlZCA9IDE7 +CgoJTEVBVkUoKTsKfQoKc3RhdGljIHZvaWQKQ29uZmNoZ0NhbGxiYWNrKGNwZ19oYW5kbGVfdCBo +YW5kbGUsCiAgICBjb25zdCBzdHJ1Y3QgY3BnX25hbWUgKmdyb3VwX25hbWUsCiAgICBjb25zdCBz +dHJ1Y3QgY3BnX2FkZHJlc3MgKm1lbWJlcl9saXN0LCBzaXplX3QgbWVtYmVyX2xpc3RfZW50cmll +cywKICAgIGNvbnN0IHN0cnVjdCBjcGdfYWRkcmVzcyAqbGVmdF9saXN0LCBzaXplX3QgbGVmdF9s +aXN0X2VudHJpZXMsCiAgICBjb25zdCBzdHJ1Y3QgY3BnX2FkZHJlc3MgKmpvaW5lZF9saXN0LCBz +aXplX3Qgam9pbmVkX2xpc3RfZW50cmllcykKewoKCUVOVEVSKCk7CgoJYXNzZXJ0KGdyb3VwX25h +bWUtPmxlbmd0aCA9PSBzdHJsZW4oVEVTVF9HUk9VUF9OQU1FKSk7Cglhc3NlcnQobWVtY21wKGdy +b3VwX25hbWUtPnZhbHVlLCBURVNUX0dST1VQX05BTUUsIHN0cmxlbihURVNUX0dST1VQX05BTUUp +KSA9PSAwKTsKCWFzc2VydChtZW1iZXJfbGlzdF9lbnRyaWVzID09IDEpOwoJYXNzZXJ0KG1lbWJl +cl9saXN0WzBdLm5vZGVpZCA9PSBURVNUX05PREVJRCk7Cglhc3NlcnQobWVtYmVyX2xpc3RbMF0u +cGlkID09IGdldHBpZCgpKTsKCgljcGdfY29uZmNoZ19yZWNlaXZlZCA9IDE7CgoJTEVBVkUoKTsK +fQoKc3RhdGljIGNwZ19tb2RlbF92MV9kYXRhX3QgbW9kZWxfZGF0YSA9IHsKCS5jcGdfZGVsaXZl +cl9mbiA9CURlbGl2ZXJDYWxsYmFjaywKCS5jcGdfY29uZmNoZ19mbiA9CUNvbmZjaGdDYWxsYmFj +aywKCS5jcGdfdG90ZW1fY29uZmNoZ19mbiA9CVRvdGVtQ29uZmNoZ0NhbGxiYWNrLAoJLmZsYWdz +ID0JCUNQR19NT0RFTF9WMV9ERUxJVkVSX0lOSVRJQUxfVE9URU1fQ09ORiwKfTsKCnN0YXRpYyB2 +b2lkCnNlbmRfbXNnKGNwZ19oYW5kbGVfdCBjcGdfaGFuZGxlKQp7CglzdHJ1Y3QgdGVzdF9tc2cg +bXNnOwoJdW5zaWduZWQgY2hhciAqZGF0YTsKCXVpbnQzMl90IHUzMjsKCXN0cnVjdCBpb3ZlYyBp +b3ZbMl07Cgljc19lcnJvcl90IGNzX3JlczsKCglFTlRFUigpOwoKCW1zZy5kYXRhX2xlbiA9IHJh +bmRfcigmc2VudF9yYW5kX3NlZWQpICUgTUFYX01TR19MRU47Cgltc2cuc2VxX25vID0gc2VudF9t +c2dfc2VxX25vOwoKCXNlbnRfbXNnX3NlcV9ubysrOwoKCWRhdGEgPSBtYWxsb2Moc2l6ZW9mKHVu +c2lnbmVkIGNoYXIpICogbXNnLmRhdGFfbGVuKTsKCWFzc2VydChkYXRhICE9IE5VTEwpOwoKCWZv +ciAodTMyID0gMDsgdTMyIDwgbXNnLmRhdGFfbGVuOyB1MzIrKykgewoJCWRhdGFbdTMyXSA9ICh1 +bnNpZ25lZCBjaGFyKXJhbmRfcigmc2VudF9yYW5kX3NlZWQpOwoJfQoKCWlvdlswXS5pb3ZfYmFz +ZSA9ICh2b2lkICopJm1zZzsKCWlvdlswXS5pb3ZfbGVuID0gc2l6ZW9mKG1zZyk7Cglpb3ZbMV0u +aW92X2Jhc2UgPSAodm9pZCAqKWRhdGE7Cglpb3ZbMV0uaW92X2xlbiA9IG1zZy5kYXRhX2xlbjsK +Cgljc19yZXMgPSBjcGdfbWNhc3Rfam9pbmVkKGNwZ19oYW5kbGUsIENQR19UWVBFX0FHUkVFRCwg +aW92LCAyKTsKCWFzc2VydChjc19yZXMgPT0gQ1NfT0spOwoKCWZyZWUoZGF0YSk7CgoJTEVBVkUo +KTsKfQoKc3RhdGljIHZvaWQKdGVzdF9jcGcodm9pZCkKewoJY3BnX2hhbmRsZV90IGNwZ19oYW5k +bGU7CglzdHJ1Y3QgY3BnX25hbWUgZ3JvdXBfbmFtZTsKCWNzX2Vycm9yX3QgY3NfcmVzOwoJdW5z +aWduZWQgaW50IGxvY2FsX25vZGVpZDsKCWludCBjcGdfZmQ7CglzdHJ1Y3QgcG9sbGZkIHBmZDsK +CWludCBwb2xsX3JlczsKCWludCBzdGF0ZTsKCWludCBjb250OwoKCUVOVEVSKCk7CgoJc3RhdGUg +PSAwOwoKCXN0cmNweShncm91cF9uYW1lLnZhbHVlLCBURVNUX0dST1VQX05BTUUpOwoJZ3JvdXBf +bmFtZS5sZW5ndGggPSBzdHJsZW4oVEVTVF9HUk9VUF9OQU1FKTsKCgljc19yZXBlYXQoY3NfcmVz +ID0gY3BnX21vZGVsX2luaXRpYWxpemUoJmNwZ19oYW5kbGUsIENQR19NT0RFTF9WMSwKCSAgICAo +Y3BnX21vZGVsX2RhdGFfdCAqKSZtb2RlbF9kYXRhLCBOVUxMKSk7Cglhc3NlcnQoY3NfcmVzID09 +IENTX09LKTsKCgljc19yZXBlYXQoY3NfcmVzID0gY3BnX2pvaW4oY3BnX2hhbmRsZSwgJmdyb3Vw +X25hbWUpKTsKCWFzc2VydChjc19yZXMgPT0gQ1NfT0spOwoKCWNzX3JlcGVhdChjc19yZXMgPSBj +cGdfbG9jYWxfZ2V0KGNwZ19oYW5kbGUsICZsb2NhbF9ub2RlaWQpKTsKCWFzc2VydChjc19yZXMg +PT0gQ1NfT0spOwoJYXNzZXJ0KGxvY2FsX25vZGVpZCA9PSBURVNUX05PREVJRCk7CgoJY3NfcmVw +ZWF0KGNzX3JlcyA9IGNwZ19mZF9nZXQoY3BnX2hhbmRsZSwgJmNwZ19mZCkpOwoJYXNzZXJ0KGNz +X3JlcyA9PSBDU19PSyk7CgoJY29udCA9IDE7CgoJZG8gewoJCXBmZC5mZCA9IGNwZ19mZDsKCQlw +ZmQuZXZlbnRzID0gUE9MTElOOwoJCXBmZC5yZXZlbnRzID0gMDsKCgkJcG9sbF9yZXMgPSBwb2xs +KCZwZmQsIDEsIElORlRJTSk7CgkJaWYgKHBvbGxfcmVzID09IC0xKSB7CgkJCXBlcnJvcigicG9s +bF9yZXMgPT0gLTEiKTsKCQl9CgoJCWFzc2VydChwb2xsX3JlcyAhPSAwKTsKCQlhc3NlcnQocGZk +LnJldmVudHMgJiBQT0xMSU4pOwoKCQljc19yZXBlYXQoY3NfcmVzID0gY3BnX2Rpc3BhdGNoKGNw +Z19oYW5kbGUsIENTX0RJU1BBVENIX0FMTCkpOwoJCWFzc2VydChjc19yZXMgPT0gQ1NfT0spOwoK +CQlzd2l0Y2ggKHN0YXRlKSB7CgkJY2FzZSAwOgoJCQkvKgoJCQkgKiBXYWl0aW5nIGZvciBjcGdf +Y29uZmNoZ19yZWNlaXZlZCBhbmQgY3BnX3RvdGVtX2NvbmZjaGdfcmVjZWl2ZWQKCQkJICovCgkJ +CWlmIChjcGdfY29uZmNoZ19yZWNlaXZlZCAmJiBjcGdfdG90ZW1fY29uZmNoZ19yZWNlaXZlZCkg +ewoJCQkJLyoKCQkJCSAqIFNlbmQgZmlyc3QgbWVzc2FnZSBhbmQgd2FpdCBmb3IgaXQgaW4gbmV4 +dCBzdGF0ZQoJCQkJICovCgkJCQlzZW5kX21zZyhjcGdfaGFuZGxlKTsKCQkJCXN0YXRlID0gMTsK +CQkJfQoJCQlicmVhazsKCQljYXNlIDE6CgkJCWlmIChyZWNlaXZlZF9tc2dfc2VxX25vID49IE1F +U1NBR0VTX1RPX1NFTlQpIHsKCQkJCWNvbnQgPSAwOwoJCQl9IGVsc2UgIGlmIChyZWNlaXZlZF9t +c2dfc2VxX25vID09IHNlbnRfbXNnX3NlcV9ubykgewoJCQkJLyoKCQkJCSAqIE1lc3NhZ2UgZGVs +aXZlcmVkIHNvIHNlbnQgbmV3IG9uZSBhbmQgd2FpdCBmb3IgaXQKCQkJCSAqLwoJCQkJc2VuZF9t +c2coY3BnX2hhbmRsZSk7CgkJCX0KCQkJYnJlYWs7CgkJfQoJfSB3aGlsZSAoY29udCk7CgoJY3Nf +cmVwZWF0KGNzX3JlcyA9IGNwZ19sZWF2ZShjcGdfaGFuZGxlLCAmZ3JvdXBfbmFtZSkpOwoJYXNz +ZXJ0KGNzX3JlcyA9PSBDU19PSyk7CgoJY3NfcmVwZWF0KGNzX3JlcyA9IGNwZ19maW5hbGl6ZShj +cGdfaGFuZGxlKSk7Cglhc3NlcnQoY3NfcmVzID09IENTX09LKTsKCglMRUFWRSgpOwp9CgppbnQK +bWFpbih2b2lkKQp7CgoJRU5URVIoKTsKCglzZXRsaW5lYnVmKHN0ZG91dCk7CgoJdGVzdF9jcGco +KTsKCglMRUFWRSgpOwoKCXJldHVybiAoMCk7Cn0K" | base64 -d | tee "/tmp/corosync-api-test.c" +# - corosync-api-test.c +# corosync-api-test-mp.c +echo "LyoKICogQ29weXJpZ2h0IChjKSAyMDE5LCBSZWQgSGF0LCBJbmMuCiAqCiAqIFBlcm1pc3Npb24g +dG8gdXNlLCBjb3B5LCBtb2RpZnksIGFuZC9vciBkaXN0cmlidXRlIHRoaXMgc29mdHdhcmUgZm9y +IGFueQogKiBwdXJwb3NlIHdpdGggb3Igd2l0aG91dCBmZWUgaXMgaGVyZWJ5IGdyYW50ZWQsIHBy +b3ZpZGVkIHRoYXQgdGhlIGFib3ZlCiAqIGNvcHlyaWdodCBub3RpY2UgYW5kIHRoaXMgcGVybWlz +c2lvbiBub3RpY2UgYXBwZWFyIGluIGFsbCBjb3BpZXMuCiAqCiAqIFRIRSBTT0ZUV0FSRSBJUyBQ +Uk9WSURFRCAiQVMgSVMiIEFORCBSRUQgSEFULCBJTkMuIERJU0NMQUlNUyBBTEwgV0FSUkFOVElF +UwogKiBXSVRIIFJFR0FSRCBUTyBUSElTIFNPRlRXQVJFIElOQ0xVRElORyBBTEwgSU1QTElFRCBX +QVJSQU5USUVTCiAqIE9GIE1FUkNIQU5UQUJJTElUWSBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQg +U0hBTEwgUkVEIEhBVCwgSU5DLiBCRSBMSUFCTEUKICogRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1Qs +IElORElSRUNULCBPUiBDT05TRVFVRU5USUFMIERBTUFHRVMgT1IgQU5ZIERBTUFHRVMKICogV0hB +VFNPRVZFUiBSRVNVTFRJTkcgRlJPTSBMT1NTIE9GIFVTRSwgREFUQSBPUiBQUk9GSVRTLCBXSEVU +SEVSIElOIEFOIEFDVElPTgogKiBPRiBDT05UUkFDVCwgTkVHTElHRU5DRSBPUiBPVEhFUiBUT1JU +SU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOCiAqIENPTk5FQ1RJT04gV0lUSCBUSEUg +VVNFIE9SIFBFUkZPUk1BTkNFIE9GIFRISVMgU09GVFdBUkUuCiAqCiAqIEF1dGhvcjogSmFuIEZy +aWVzc2UgPGpmcmllc3NlQHJlZGhhdC5jb20+CiAqLwoKLyoKICogTWFpbiBwcm9jZXNzIGNyZWF0 +ZXMgbXVsdGlwbGUgKE5PX0NISUxEUykgY2hpbGRzIGFuZCB3YWl0cyBmb3IgdGhlaXIgZXhpdC4K +ICogRWFjaCBjaGlsZCBqb2lucyBDUEcgZ3JvdXAgYW5kIHN0YXJ0cyBwcm9jZXNzaW5nIENQRyBl +dmVudHMuIEVhY2ggY2hpbGQgaXMKICogaWRlbnRpZmllZCBieSBJRCAobXlfaWQpIHdoaWNoIGlz +IHNldCBieSBtYWluIHByb2Nlc3MgaW4gaW5jcmVhc2luZyBvcmRlciAoc28KICogdmFsdWUgaXMg +MC4uTk9fQ0hJTERTLTEpLiBXaGVuIGFsbCBjaGlsZHMgam9pbiBDUEcgZ3JvdXAgKENvbmZjaGdD +YWxsYmFjayB2YXJpYWJsZQogKiBtZW1iZXJfbGlzdF9lbnRyaWVzIGlzIGVxdWFsIHRvIE5PX0NI +SUxEUykgdGhlbiBjaGlsZCB3aXRoIElEIDAgc2VuZHMgQ1BHIG1lc3NhZ2UKICogd2l0aCByYW5k +b20gbGVuZ3RoICh1cC10byBNQVhfTVNHX0xFTikgYW5kIHJhbmRvbSBjb250ZW50LiBXaGVuIGNo +aWxkIHdpdGggSUQgMQogKiByZWNlaXZlcyBtZXNzYWdlIGlzc3VlZCBieSBjaGlsZCB3aXRoIElE +IDAsIGl0IHNlbmRzIGFub3RoZXIgcmFuZG9tIG1lc3NhZ2UuCiAqIFRoaXMgcHJvY2VzcyBjb250 +aW51ZXMgd2l0aCBjaGlsZCB3aXRoIElEIDIsIHRoZW4gd2l0aCBjaGlsZCAzLCAuLi4gTk9fQ0hJ +TERTIC0gMSBhbmQKICogdGhlbiBvdmVybGFwcyBiYWNrIHRvIDAuIEVhY2ggY2hpbGQgY29tcGFy +ZXMgcmVjZWl2ZWQgbWVzc2FnZSBieSBnZW5lcmF0aW5nIHNhbWUKICogcmFuZG9tIG51bWJlcnMg +KHJhbmRfciBmdW5jdGlvbiBpcyB1c2VkKSBzdHJlYW0gYXMgc2VuZGVyIHNvIHNlbnRfcmFuZF9z +ZWVkIGFuZAogKiByZWNlaXZlZF9yYW5kX3NlZWQgbXVzdCBiZSBrZXB0IGluIHN5bmMuIEtlZXBp +bmcgcmVjZWllZF9yYW5kX3NlZWQgaW4gc3luYyBpcwogKiBzaW1wbGUsIGJlY2F1c2UgaXQgaXMg +dXBkYXRlZCBldmVyeSB0aW1lIHdoZW4gbWVzc2FnZSBpcyByZWNlaXZlZC4KICogc2VudF9yYW5k +X3NlZWQgaXMgdXBkYXRlZCBldGhlciBieSBzZW5kaW5nIG1lc3NhZ2Ugb3IgYnkKICogY2FsbGlu +ZyBhZGp1c3Rfc2VudF9yYW5kX3NlZWQgZnVuY3Rpb24uCiAqCiAqIFRoaXMgdGVzdCBjaGVja3Mg +Zm9sbG93aW5nIHByb3BlcnRpZXMgQ1BHOgogKiAtIE1vcmUgdGhhbiBvbmUgY2xpZW50IGNhbiBq +b2luIENQRyBncm91cAogKiAtIEVhY2ggY2xpZW50IGV2ZW50dWFsbHkgc2VlcyBhbGwgb3RoZXIg +Y2xpZW50cwogKiAtIEVhY2ggY2xpZW50IHJlY2VpdmVzIG1lc3NhZ2VzIHNlbnQgYnkgb3RoZXIg +Y2xpZW50cyBbMV0KICogLSBNZXNzYWdlIGlzIG5vdCBjb3JydXB0ZWQgWzFdCiAqIC0gTWVzc2Fn +ZXMgYXJlIGRlbGl2ZXJlZCB3aXRoIEZJRk8gcXVhcmFudGVlIFsxXQogKgogKiBbMV0gLSBFbnN1 +cmVkIGJ5IGVxdWFsaXR5IG9mIHJhbmRfciBnZW5lcmF0ZWQgYnl0ZXMgd2hlcmUgc2VuZGVyIHNl +ZWQKICogICAgICAgKHNlbnRfcmFuZF9zZWVkKSBhbmQgcmVjZWl2ZXIgc2VlZCAocmVjZWl2ZWRf +cmFuZF9zZWVkKSBhcmUga2VwdCBpbgogKiAgICAgICBzeW5jLgogKi8KCiNpbmNsdWRlIDxzeXMv +dHlwZXMuaD4KI2luY2x1ZGUgPHN5cy9zb2NrZXQuaD4KI2luY2x1ZGUgPHN5cy93YWl0Lmg+Cgoj +aW5jbHVkZSA8YXNzZXJ0Lmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5jbHVkZSA8aW50dHlwZXMu +aD4KI2luY2x1ZGUgPHBvbGwuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIu +aD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8dW5pc3RkLmg+CgojaW5jbHVkZSA8Y29y +b3N5bmMvY29yb3R5cGVzLmg+CiNpbmNsdWRlIDxjb3Jvc3luYy9jcGcuaD4KCi8qCiAqIFByZWRl +ZmluZWQgdGVzdCBjb25zdGFudHMKICovCiNkZWZpbmUgVEVTVF9OT0RFSUQJCTEKI2RlZmluZSBU +RVNUX0dST1VQX05BTUUJCSJzbW9rZS1hcGktdGVzdC1jcGctZ3JvdXAtbXAiCiNkZWZpbmUgTUFY +X1JFVFJJRVMJCTMwCiNkZWZpbmUgTUFYX01TR19MRU4JCSgxMDI0ICogMTI4KQoKI2RlZmluZSBO +T19DSElMRFMJCTMKCiNkZWZpbmUgTUVTU0FHRVNfVE9fU0VOVAkoMTI4ICogTk9fQ0hJTERTKQoK +LyoKICogVXNlZnVsIG1hY3JvcwogKi8KI2RlZmluZSBjc19yZXBlYXQoY29kZSkgZG8gewkJCQlc +CglpbnQgY3NfcmVwZWF0X2NvdW50ZXIgPSAwOwkJCVwKCWRvIHsJCQkJCQlcCgkJaWYgKChjb2Rl +KSA9PSBDU19FUlJfVFJZX0FHQUlOKSB7CVwKCQkJY3NfcmVwZWF0X2NvdW50ZXIrKzsJCVwKCQkJ +cG9sbChOVUxMLCAwLCAxMDAwKTsJCVwKCQl9IGVsc2UgewkJCQlcCgkJCWJyZWFrOwkJCQlcCgkJ +fQkJCQkJXAoJfSB3aGlsZSAoY3NfcmVwZWF0X2NvdW50ZXIgPCBNQVhfUkVUUklFUyk7CVwKfSB3 +aGlsZSAoMCkKCiNpZm5kZWYgSU5GVElNCiNkZWZpbmUgSU5GVElNCQkJLTEKI2VuZGlmCgojZGVm +aW5lIEVOVEVSKCkgcHJpbnRmKCJbJWxkXSArICVzOiV1ICVzXG4iLCAobG9uZyBzaWduZWQgaW50 +KWdldHBpZCgpLCBfX0ZJTEVfXyxcCiAgICBfX0xJTkVfXywgX19mdW5jX18pCiNkZWZpbmUgTEVB +VkUoKSBwcmludGYoIlslbGRdIC0gJXM6JXUgJXNcbiIsIChsb25nIHNpZ25lZCBpbnQpZ2V0cGlk +KCksIF9fRklMRV9fLFwKICAgIF9fTElORV9fLCBfX2Z1bmNfXykKCnN0YXRpYyBpbnQzMl90IG15 +X2lkID0gLTE7CnN0YXRpYyBpbnQgZnVsbF9tZW1iZXJzaGlwX3NlZW4gPSAwOwpzdGF0aWMgaW50 +IHNlbnRfbWVzc2FnZXMgPSAwOwpzdGF0aWMgaW50IHRlc3RfY3BnX2xvb3BfY29udCA9IDE7Cgov +KgogKiBib3RoIHJhbmQgc2VlZHMgbXVzdCBiZSBpbiBzeW5jCiAqLwpzdGF0aWMgdW5zaWduZWQg +aW50IHNlbnRfcmFuZF9zZWVkID0gMDsKc3RhdGljIHVuc2lnbmVkIGludCByZWNlaXZlZF9yYW5k +X3NlZWQgPSAwOwpzdGF0aWMgaW50MzJfdCBleHBlY3RlZF9zZW5kZXJfaWQ7CnN0YXRpYyB1aW50 +MzJfdCBleHBlY3RlZF9tc2dfc2VxX25vID0gMDsKCnN0cnVjdCB0ZXN0X21zZyB7CglpbnQzMl90 +IHNlbmRlcl9pZCBfX2F0dHJpYnV0ZV9fICgoYWxpZ25lZCAoOCkpKTsKCXVpbnQzMl90IHNlcV9u +byBfX2F0dHJpYnV0ZV9fICgoYWxpZ25lZCAoOCkpKTsKCXVpbnQzMl90IGRhdGFfbGVuIF9fYXR0 +cmlidXRlX18gKChhbGlnbmVkICg4KSkpOwoJdW5zaWduZWQgY2hhciBkYXRhWzBdIF9fYXR0cmli +dXRlX18gKChhbGlnbmVkICg4KSkpOwp9OwoKc3RhdGljIHZvaWQKc2VuZF9tc2coY3BnX2hhbmRs +ZV90IGNwZ19oYW5kbGUpCnsKCXN0cnVjdCB0ZXN0X21zZyBtc2c7Cgl1bnNpZ25lZCBjaGFyICpk +YXRhOwoJdWludDMyX3QgdTMyOwoJc3RydWN0IGlvdmVjIGlvdlsyXTsKCWNzX2Vycm9yX3QgY3Nf +cmVzOwoKCUVOVEVSKCk7CgoJbXNnLnNlbmRlcl9pZCA9IG15X2lkOwoJbXNnLmRhdGFfbGVuID0g +cmFuZF9yKCZzZW50X3JhbmRfc2VlZCkgJSBNQVhfTVNHX0xFTjsKCW1zZy5zZXFfbm8gPSBleHBl +Y3RlZF9tc2dfc2VxX25vOwoKCWRhdGEgPSBtYWxsb2Moc2l6ZW9mKHVuc2lnbmVkIGNoYXIpICog +bXNnLmRhdGFfbGVuKTsKCWFzc2VydChkYXRhICE9IE5VTEwpOwoKCWZvciAodTMyID0gMDsgdTMy +IDwgbXNnLmRhdGFfbGVuOyB1MzIrKykgewoJCWRhdGFbdTMyXSA9ICh1bnNpZ25lZCBjaGFyKXJh +bmRfcigmc2VudF9yYW5kX3NlZWQpOwoJfQoKCWlvdlswXS5pb3ZfYmFzZSA9ICh2b2lkICopJm1z +ZzsKCWlvdlswXS5pb3ZfbGVuID0gc2l6ZW9mKG1zZyk7Cglpb3ZbMV0uaW92X2Jhc2UgPSAodm9p +ZCAqKWRhdGE7Cglpb3ZbMV0uaW92X2xlbiA9IG1zZy5kYXRhX2xlbjsKCgljc19yZXMgPSBjcGdf +bWNhc3Rfam9pbmVkKGNwZ19oYW5kbGUsIENQR19UWVBFX0FHUkVFRCwgaW92LCAyKTsKCWFzc2Vy +dChjc19yZXMgPT0gQ1NfT0spOwoKCWZyZWUoZGF0YSk7CgoJc2VudF9tZXNzYWdlcysrOwoKCUxF +QVZFKCk7Cn0KCnN0YXRpYyB2b2lkCmFkanVzdF9zZW50X3JhbmRfc2VlZCh2b2lkKQp7Cgl1aW50 +MzJfdCBkYXRhX2xlbjsKCXVpbnQzMl90IHUzMjsKCglkYXRhX2xlbiA9IHJhbmRfcigmc2VudF9y +YW5kX3NlZWQpICUgTUFYX01TR19MRU47CgoJZm9yICh1MzIgPSAwOyB1MzIgPCBkYXRhX2xlbjsg +dTMyKyspIHsKCQkodm9pZClyYW5kX3IoJnNlbnRfcmFuZF9zZWVkKTsKCX0KfQoKc3RhdGljIHZv +aWQKRGVsaXZlckNhbGxiYWNrKGNwZ19oYW5kbGVfdCBoYW5kbGUsCiAgICBjb25zdCBzdHJ1Y3Qg +Y3BnX25hbWUgKmdyb3VwTmFtZSwKICAgIHVpbnQzMl90IG5vZGVpZCwKICAgIHVpbnQzMl90IHBp +ZCwKICAgIHZvaWQgKmNwZ19tc2csCiAgICBzaXplX3QgY3BnX21zZ19sZW4pCnsKCXN0cnVjdCB0 +ZXN0X21zZyAqbXNnOwoJdWludDMyX3QgdTMyOwoKCUVOVEVSKCk7CgoJYXNzZXJ0KG5vZGVpZCA9 +PSBURVNUX05PREVJRCk7CgoJYXNzZXJ0KGNwZ19tc2dfbGVuID49IHNpemVvZihzdHJ1Y3QgdGVz +dF9tc2cpKTsKCgltc2cgPSAoc3RydWN0IHRlc3RfbXNnICopY3BnX21zZzsKCWFzc2VydChtc2ct +PnNlbmRlcl9pZCA9PSBleHBlY3RlZF9zZW5kZXJfaWQpOwoKCWV4cGVjdGVkX3NlbmRlcl9pZCA9 +IChleHBlY3RlZF9zZW5kZXJfaWQgKyAxKSAlIE5PX0NISUxEUzsKCglhc3NlcnQobXNnLT5zZXFf +bm8gPT0gZXhwZWN0ZWRfbXNnX3NlcV9ubyk7CglleHBlY3RlZF9tc2dfc2VxX25vKys7CgoJYXNz +ZXJ0KGNwZ19tc2dfbGVuID09IG1zZy0+ZGF0YV9sZW4gKyBzaXplb2Yoc3RydWN0IHRlc3RfbXNn +KSk7CgoJLyoKCSAqIE1lc3NhZ2UgaGFzIGV4cGVjdGVkIGxlbmd0aCBhbmQgY29udGVudAoJICov +Cglhc3NlcnQobXNnLT5kYXRhX2xlbiA9PSAodWludDMyX3QpKHJhbmRfcigmcmVjZWl2ZWRfcmFu +ZF9zZWVkKSAlIE1BWF9NU0dfTEVOKSk7CgoJZm9yICh1MzIgPSAwOyB1MzIgPCBtc2ctPmRhdGFf +bGVuOyB1MzIrKykgewoJCWFzc2VydChtc2ctPmRhdGFbdTMyXSA9PSAodW5zaWduZWQgY2hhcily +YW5kX3IoJnJlY2VpdmVkX3JhbmRfc2VlZCkpOwoJfQoKCWlmIChleHBlY3RlZF9tc2dfc2VxX25v +ID4gTUVTU0FHRVNfVE9fU0VOVCkgewoJCXRlc3RfY3BnX2xvb3BfY29udCA9IDA7Cgl9CgoJaWYg +KGV4cGVjdGVkX3NlbmRlcl9pZCA9PSBteV9pZCkgewoJCXNlbmRfbXNnKGhhbmRsZSk7Cgl9IGVs +c2UgewoJCWFkanVzdF9zZW50X3JhbmRfc2VlZCgpOwoJfQoKCUxFQVZFKCk7Cn0KCnN0YXRpYyB2 +b2lkClRvdGVtQ29uZmNoZ0NhbGxiYWNrKGNwZ19oYW5kbGVfdCBoYW5kbGUsCiAgICBzdHJ1Y3Qg +Y3BnX3JpbmdfaWQgcmluZ19pZCwKICAgIHVpbnQzMl90IG1lbWJlcl9saXN0X2VudHJpZXMsCiAg +ICBjb25zdCB1aW50MzJfdCAqbWVtYmVyX2xpc3QpCnsKCglFTlRFUigpOwoKCWFzc2VydChtZW1i +ZXJfbGlzdF9lbnRyaWVzID09IDEpOwoJYXNzZXJ0KG1lbWJlcl9saXN0WzBdID09IFRFU1RfTk9E +RUlEKTsKCglMRUFWRSgpOwp9CgpzdGF0aWMgdm9pZApDb25mY2hnQ2FsbGJhY2soY3BnX2hhbmRs +ZV90IGhhbmRsZSwKICAgIGNvbnN0IHN0cnVjdCBjcGdfbmFtZSAqZ3JvdXBfbmFtZSwKICAgIGNv +bnN0IHN0cnVjdCBjcGdfYWRkcmVzcyAqbWVtYmVyX2xpc3QsIHNpemVfdCBtZW1iZXJfbGlzdF9l +bnRyaWVzLAogICAgY29uc3Qgc3RydWN0IGNwZ19hZGRyZXNzICpsZWZ0X2xpc3QsIHNpemVfdCBs +ZWZ0X2xpc3RfZW50cmllcywKICAgIGNvbnN0IHN0cnVjdCBjcGdfYWRkcmVzcyAqam9pbmVkX2xp +c3QsIHNpemVfdCBqb2luZWRfbGlzdF9lbnRyaWVzKQp7CglpbnQgaTsKCglFTlRFUigpOwoKCWFz +c2VydChncm91cF9uYW1lLT5sZW5ndGggPT0gc3RybGVuKFRFU1RfR1JPVVBfTkFNRSkpOwoJYXNz +ZXJ0KG1lbWNtcChncm91cF9uYW1lLT52YWx1ZSwgVEVTVF9HUk9VUF9OQU1FLCBzdHJsZW4oVEVT +VF9HUk9VUF9OQU1FKSkgPT0gMCk7CgoJZm9yIChpID0gMDsgaSA8IG1lbWJlcl9saXN0X2VudHJp +ZXM7IGkrKykgewoJCWFzc2VydChtZW1iZXJfbGlzdFtpXS5ub2RlaWQgPT0gVEVTVF9OT0RFSUQp +OwoJfQoKCWlmICghZnVsbF9tZW1iZXJzaGlwX3NlZW4gJiYgbWVtYmVyX2xpc3RfZW50cmllcyA9 +PSBOT19DSElMRFMpIHsKCQlpZiAobXlfaWQgPT0gMCkgewoJCQkvKgoJCQkgKiBGaXJzdCBjaGls +ZCBzZW5kcyBmaXJzdCBtZXNzYWdlCgkJCSAqLwoJCQlzZW5kX21zZyhoYW5kbGUpOwoJCX0gZWxz +ZSB7CgkJCWFkanVzdF9zZW50X3JhbmRfc2VlZCgpOwoJCX0KCgkJZnVsbF9tZW1iZXJzaGlwX3Nl +ZW4gPSAxOwoJfQoKCUxFQVZFKCk7Cn0KCnN0YXRpYyBjcGdfbW9kZWxfdjFfZGF0YV90IG1vZGVs +X2RhdGEgPSB7CgkuY3BnX2RlbGl2ZXJfZm4gPQlEZWxpdmVyQ2FsbGJhY2ssCgkuY3BnX2NvbmZj +aGdfZm4gPQlDb25mY2hnQ2FsbGJhY2ssCgkuY3BnX3RvdGVtX2NvbmZjaGdfZm4gPQlUb3RlbUNv +bmZjaGdDYWxsYmFjaywKCS5mbGFncyA9CQlDUEdfTU9ERUxfVjFfREVMSVZFUl9JTklUSUFMX1RP +VEVNX0NPTkYsCn07CgoKc3RhdGljIHZvaWQKdGVzdF9jcGcodm9pZCkKewoJY3BnX2hhbmRsZV90 +IGNwZ19oYW5kbGU7CglzdHJ1Y3QgY3BnX25hbWUgZ3JvdXBfbmFtZTsKCWNzX2Vycm9yX3QgY3Nf +cmVzOwoJdW5zaWduZWQgaW50IGxvY2FsX25vZGVpZDsKCWludCBjcGdfZmQ7CglzdHJ1Y3QgcG9s +bGZkIHBmZDsKCWludCBwb2xsX3JlczsKCglFTlRFUigpOwoKCXN0cmNweShncm91cF9uYW1lLnZh +bHVlLCBURVNUX0dST1VQX05BTUUpOwoJZ3JvdXBfbmFtZS5sZW5ndGggPSBzdHJsZW4oVEVTVF9H +Uk9VUF9OQU1FKTsKCgljc19yZXBlYXQoY3NfcmVzID0gY3BnX21vZGVsX2luaXRpYWxpemUoJmNw +Z19oYW5kbGUsIENQR19NT0RFTF9WMSwKCSAgICAoY3BnX21vZGVsX2RhdGFfdCAqKSZtb2RlbF9k +YXRhLCBOVUxMKSk7Cglhc3NlcnQoY3NfcmVzID09IENTX09LKTsKCgljc19yZXBlYXQoY3NfcmVz +ID0gY3BnX2pvaW4oY3BnX2hhbmRsZSwgJmdyb3VwX25hbWUpKTsKCWFzc2VydChjc19yZXMgPT0g +Q1NfT0spOwoKCWNzX3JlcGVhdChjc19yZXMgPSBjcGdfbG9jYWxfZ2V0KGNwZ19oYW5kbGUsICZs +b2NhbF9ub2RlaWQpKTsKCWFzc2VydChjc19yZXMgPT0gQ1NfT0spOwoJYXNzZXJ0KGxvY2FsX25v +ZGVpZCA9PSBURVNUX05PREVJRCk7CgoJY3NfcmVwZWF0KGNzX3JlcyA9IGNwZ19mZF9nZXQoY3Bn +X2hhbmRsZSwgJmNwZ19mZCkpOwoJYXNzZXJ0KGNzX3JlcyA9PSBDU19PSyk7CgoJZG8gewoJCXBm +ZC5mZCA9IGNwZ19mZDsKCQlwZmQuZXZlbnRzID0gUE9MTElOOwoJCXBmZC5yZXZlbnRzID0gMDsK +CgkJcG9sbF9yZXMgPSBwb2xsKCZwZmQsIDEsIElORlRJTSk7CgkJaWYgKHBvbGxfcmVzID09IC0x +KSB7CgkJCXBlcnJvcigicG9sbF9yZXMgPT0gLTEiKTsKCQl9CgoJCWFzc2VydChwb2xsX3JlcyAh +PSAwKTsKCQlhc3NlcnQocGZkLnJldmVudHMgJiBQT0xMSU4pOwoKCQljc19yZXBlYXQoY3NfcmVz +ID0gY3BnX2Rpc3BhdGNoKGNwZ19oYW5kbGUsIENTX0RJU1BBVENIX0FMTCkpOwoJCWFzc2VydChj +c19yZXMgPT0gQ1NfT0spOwoJfSB3aGlsZSAodGVzdF9jcGdfbG9vcF9jb250KTsKCgljc19yZXBl +YXQoY3NfcmVzID0gY3BnX2xlYXZlKGNwZ19oYW5kbGUsICZncm91cF9uYW1lKSk7Cglhc3NlcnQo +Y3NfcmVzID09IENTX09LKTsKCgljc19yZXBlYXQoY3NfcmVzID0gY3BnX2ZpbmFsaXplKGNwZ19o +YW5kbGUpKTsKCWFzc2VydChjc19yZXMgPT0gQ1NfT0spOwoKCUxFQVZFKCk7Cn0KCmludAptYWlu +KHZvaWQpCnsKCWludCBpOwoJcGlkX3QgZm9ya19yZXM7CglwaWRfdCB3YWl0X3JlczsKCWludCBz +dGF0dXM7CgoJRU5URVIoKTsKCglzZXRsaW5lYnVmKHN0ZG91dCk7CgoJZm9yIChpID0gMDsgaSA8 +IE5PX0NISUxEUzsgaSsrKSB7CgkJbXlfaWQgPSBpOwoKCQlmb3JrX3JlcyA9IGZvcmsoKTsKCgkJ +aWYgKGZvcmtfcmVzID09IC0xKSB7CgkJCXBlcnJvcigiZm9yayIpOwoJCX0KCgkJaWYgKGZvcmtf +cmVzID09IDApIHsKCQkJLyoKCQkJICogQ2hpbGQKCQkJICovCgkJCWJyZWFrIDsKCQl9IGVsc2Ug +ewoJCQkvKgoJCQkgKiBQYXJlbnQKCQkJICovCgkJCW15X2lkID0gLTE7CgkJfQoJfQoKCWlmIChm +b3JrX3JlcyA9PSAwKSB7CgkJLyoKCQkgKiBDaGlsZCBydW5zIHRoZSB0ZXN0CgkJICovCgkJdGVz +dF9jcGcoKTsKCX0gZWxzZSB7CgkJLyoKCQkgKiBXYWl0IGZvciBjaGlsZHMKCQkgKi8KCQlmb3Ig +KGkgPSAwOyBpIDwgTk9fQ0hJTERTOyBpKyspIHsKCQkJd2FpdF9yZXMgPSB3YWl0KCZzdGF0dXMp +OwoJCQlpZiAod2FpdF9yZXMgPT0gLTEpIHsKCQkJCXBlcnJvcigid2FpdCIpOwoJCQl9CgoJCQlh +c3NlcnQoV0lGRVhJVEVEKHN0YXR1cykpOwoJCQlhc3NlcnQoV0VYSVRTVEFUVVMoc3RhdHVzKSA9 +PSAwKTsKCQl9Cgl9CgoJTEVBVkUoKTsKCglyZXR1cm4gKDApOwp9Cg==" | base64 -d | tee "/tmp/corosync-api-test-mp.c" +# - corosync-api-test-mp.c +################## +# Test functions # +################## +test_corosync_v() { + # Check corosync -v exits without error and + # result version contain numbers in path format [0-9]*.[0-9]*.[0-9] + ver_res=$(corosync -v) + [ "$ver_res" != "${ver_res/[0-9]*\.[0-9]*\.[0-9]/}" ] +} + +test_corosync_keygen() { + rm -f "$COROSYNC_AUTHKEY" + corosync-keygen + + # File exists + [ -f "$COROSYNC_AUTHKEY" ] + + # ... and is not empty (wc format is "SIZE FILENAME" - remove FILENAME part) + wc_res=$(wc -c "$COROSYNC_AUTHKEY") + [ "${wc_res%% *}" -gt 0 ] +} + +# test_corosync_start crypto +# crypto can be on or off +test_corosync_start() { + generate_corosync_conf "$1" > "$COROSYNC_CONF" + cat "$COROSYNC_CONF" + + service_start "corosync" +} + +test_corosync_stop() { + service_stop "corosync" +} + +test_corosync_quorumtool() { + quorumtool_res_file=`mktemp` + # This is already fixed in upstream db38e3958c4f88d5d06e8f7c83d6d90334d9fbd2 + (corosync-quorumtool -ips || true) | tee "$quorumtool_res_file" + + # Ensure this is single node cluster + grep -qi '^Nodes:.*1$' "$quorumtool_res_file" + # Current node id is 1 + grep -qi '^Node ID:.*1$' "$quorumtool_res_file" + # Is quorate (libquorum) + grep -qi '^Quorate:.*Yes$' "$quorumtool_res_file" + # Quorum is 1 + grep -qi '^Quorum:.*1' "$quorumtool_res_file" + # Is quorate (libvotequorum) + grep -qi '^Flags:.*Quorate' "$quorumtool_res_file" + + rm -f "$quorumtool_res_file" +} + +test_corosync_cmapctl() { + cmapctl_res_file=`mktemp` + corosync-cmapctl | tee "$cmapctl_res_file" + # cluster_name key exists in full output + grep -qi '^totem.cluster_name (str) = smoketestcluster$' "$cmapctl_res_file" + + corosync-cmapctl "totem." | tee "$cmapctl_res_file" + # cluster_name key exists in reduced output + grep -qi '^totem.cluster_name (str) = smoketestcluster$' "$cmapctl_res_file" + + # cluster_name key should be returned + corosync-cmapctl -g "totem.cluster_name" | tee "$cmapctl_res_file" + grep -qi '^totem.cluster_name (str) = smoketestcluster$' "$cmapctl_res_file" + + rm -f "$cmapctl_res_file" +} + +# test_corosync_reload - requires stopped corosync +test_corosync_reload() { + cmapctl_res_file=`mktemp` + + test_corosync_start "off" + + # Get current token timeout + corosync-cmapctl -g "runtime.config.totem.token" | tee "$cmapctl_res_file" + cmapctl_res=$(cat "$cmapctl_res_file") + # Format is runtime.config.totem.token (u32) = value + token_pre_reload=${cmapctl_res##* } + [ "$token_pre_reload" -eq "$TOKEN_TIMEOUT" ] + + # Generate new corosync.conf with token_timeout*10 + new_token_timeout=$((TOKEN_TIMEOUT*10)) + generate_corosync_conf "off" "$new_token_timeout" > "$COROSYNC_CONF" + cat "$COROSYNC_CONF" + + # Main call of the test + corosync-cfgtool -R + + # Check that new token timeout is in use + corosync-cmapctl -g "runtime.config.totem.token" | tee "$cmapctl_res_file" + cmapctl_res=$(cat "$cmapctl_res_file") + # Format is runtime.config.totem.token (u32) = value + token_post_reload=${cmapctl_res##* } + [ "$token_post_reload" -eq "$new_token_timeout" ] + + test_corosync_stop + + rm -f "$cmapctl_res_file" +} + +test_corosync_api() { + cflags=$(pkg-config --cflags libcpg) + libs=$(pkg-config --libs libcpg) + + gcc -ggdb -Wall $cflags "/tmp/corosync-api-test.c" \ + $libs -o "/tmp/corosync-api-test" + + /tmp/corosync-api-test +} + +test_corosync_api_mp() { + cflags=$(pkg-config --cflags libcpg) + libs=$(pkg-config --libs libcpg) + + gcc -ggdb -Wall $cflags "/tmp/corosync-api-test-mp.c" \ + $libs -o "/tmp/corosync-api-test-mp" + + /tmp/corosync-api-test-mp +} + +test_corosync_man_pages() { + # At least these man pages should be installed + expected_mp="corosync corosync.conf corosync-cfgtool corosync-cmapctl + corosync-keygen corosync-quorumtool" + + for mp in $expected_mp;do + man -w "$mp" + done +} + +######## +# main # +######## +if [ -z "$PREFIX" ];then + echo "PREFIX not defined. Do not run *.inc.sh directly" + exit 1 +fi + +test_corosync_v +test_corosync_keygen +test_corosync_man_pages + +for crypto in "off" "on";do + test_corosync_start "$crypto" + test_corosync_quorumtool + test_corosync_cmapctl + test_corosync_api + test_corosync_api_mp + test_corosync_stop +done + +test_corosync_reload diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..39b6209 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,12 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - smoke + required_packages: + - gcc + - iproute + - corosync + - corosync-devel From 0baeb3b0de2bc10b36b50d953b35e43b3451d18e Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 19 Mar 2020 14:51:48 +0100 Subject: [PATCH 144/185] Enable gating Signed-off-by: Jan Friesse --- gating.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gating.yaml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..f075ad7 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,15 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_testing +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} From 299a3b42dc4b145a4dfae27be9b8b5016b7260f0 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 27 Mar 2020 08:59:36 +0100 Subject: [PATCH 145/185] Test build with CI gating enabled Signed-off-by: Jan Friesse --- corosync.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 3884b41..f8e67b1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.3 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,10 @@ network splits) %endif %changelog +* Fri Mar 27 2020 Jan Friesse - 3.0.3-3 +- Add CI tests +- Enable gating + * Tue Jan 28 2020 Fedora Release Engineering - 3.0.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From bcd074e27ec97de9cfc7f4f2c1db39cbd04739ae Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 27 Mar 2020 11:59:24 +0100 Subject: [PATCH 146/185] Add rpmlint error whitelist Signed-off-by: Jan Friesse --- corosync.rpmlintrc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 corosync.rpmlintrc diff --git a/corosync.rpmlintrc b/corosync.rpmlintrc new file mode 100644 index 0000000..39e1f00 --- /dev/null +++ b/corosync.rpmlintrc @@ -0,0 +1,29 @@ +# Empty %postun +addFilter(r'W: empty-%postun') + +# Spelling error init +addFilter(r'W: spelling-error %description -l en_US init') + +# Spelling error corosync +addFilter(r'W: spelling-error .* (C|c)orosync') + +# Spelling error votequorum and subprocesses +addFilter(r'corosync-vqsim\.[^:]+: W: spelling-error .* votequorum') +addFilter(r'corosync-vqsim\.[^:]+: W: spelling-error .* subprocesses') + +# Repeated Corosync +addFilter(r'W: name-repeated-in-summary C Corosync') + +# Explicit lib dependency - knet nss has been requested by QA, +# libxslt may be replaced with xsltproc binary +addFilter(r'corosync\.[^:]+: (E|W): explicit-lib-dependency libknet1-crypto-nss-plugin') +addFilter(r'corosync\.[^:]+: (E|W): explicit-lib-dependency libxslt') + +# Dbus is not config file +addFilter(r'corosync\.[^:]+: (E|W): non-conffile-in-etc /etc/dbus-1/system\.d/corosync-signals\.conf') + +# Logrotate is not requirement +addFilter(r'corosync\.[^:]+: (E|W): missing-dependency-to-logrotate') + +# libcorosync_common.so has no libc call +addFilter(r'corosynclib\.[^:]+: (E|W): library-not-linked-against-libc /usr/lib(64)?/libcorosync_common\.so') From 275d61fa9577f734064a9557160355b8150322e6 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 23 Apr 2020 12:51:33 +0200 Subject: [PATCH 147/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 9 ++++++--- sources | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9c73c8f..5e07c7c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ corosync-1.2.7.tar.gz /corosync-3.0.1.tar.gz /corosync-3.0.2.tar.gz /corosync-3.0.3.tar.gz +/corosync-3.0.4.tar.gz diff --git a/corosync.spec b/corosync.spec index f8e67b1..4ffeeff 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,8 +17,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.0.3 -Release: 3%{?gitver}%{?dist} +Version: 3.0.4 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -207,7 +207,7 @@ fi %{_mandir}/man8/corosync-quorumtool.8* %{_mandir}/man5/corosync.conf.5* %{_mandir}/man5/votequorum.5* -%{_mandir}/man8/cmap_keys.8* +%{_mandir}/man7/cmap_keys.7* # library # @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Thu Apr 23 2020 Jan Friesse - 3.0.4-1 +- New upstream release + * Fri Mar 27 2020 Jan Friesse - 3.0.3-3 - Add CI tests - Enable gating diff --git a/sources b/sources index 0cf7000..4427f75 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.0.3.tar.gz) = 6ffabb3261bcff18611a029f0c2682367f301caac6f5ddb2cfb2c1bbc69c67f1d1e7b9475eee8f40bcdca8fbc73cb8ec3854f74002dda9c3b70a27c8d3d16ec5 +SHA512 (corosync-3.0.4.tar.gz) = 0d3a19d8811f15d7e4ca6b0805bbd007726751626633279ddb40db37069aa789261b203b2e74474f6ceda366f30391e7effe2efa1e471fbd7dce17a04077e534 From e1a29e0daf6f0361a78e10bcf783fbb92ddaf581 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 13 May 2020 10:24:44 +0200 Subject: [PATCH 148/185] Rebuild for new libqb Signed-off-by: Jan Friesse --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 4ffeeff..ec8f9a1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.4 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Wed May 13 2020 Jan Friesse - 3.0.4-2 +5- Rebuild for new libqb + * Thu Apr 23 2020 Jan Friesse - 3.0.4-1 - New upstream release From 937f18d7a2db2e34fd0eb40b744a2855a937b204 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 13 May 2020 10:38:46 +0200 Subject: [PATCH 149/185] Fix changelog typo Signed-off-by: Jan Friesse --- corosync.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index ec8f9a1..f3c19f5 100644 --- a/corosync.spec +++ b/corosync.spec @@ -286,7 +286,7 @@ network splits) %changelog * Wed May 13 2020 Jan Friesse - 3.0.4-2 -5- Rebuild for new libqb +- Rebuild for new libqb * Thu Apr 23 2020 Jan Friesse - 3.0.4-1 - New upstream release From fa278792f79555d8eade73a141262a87843edf55 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 13 May 2020 10:49:03 +0200 Subject: [PATCH 150/185] Really fix typo in the changelog Signed-off-by: Jan Friesse --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index f3c19f5..ab308d2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.4 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Wed May 13 2020 Jan Friesse - 3.0.4-3 +- Fix typo in the changelog + * Wed May 13 2020 Jan Friesse - 3.0.4-2 - Rebuild for new libqb From 3e139736ed6e29a1a9c7388359fcbd93bdc0d85d Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 13 Jul 2020 18:53:52 +0000 Subject: [PATCH 151/185] Use make macros https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro --- corosync.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/corosync.spec b/corosync.spec index ab308d2..2a2ac7c 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.4 -Release: 3%{?gitver}%{?dist} +Release: 4%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -106,10 +106,10 @@ BuildRequires: readline-devel --with-systemddir=%{_unitdir} \ --docdir=%{_docdir} -make %{_smp_mflags} +%make_build %install -make install DESTDIR=%{buildroot} +%make_install %if %{with dbus} mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d @@ -285,6 +285,10 @@ network splits) %endif %changelog +* Mon Jul 13 2020 Tom Stellard - 3.0.4-4 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + * Wed May 13 2020 Jan Friesse - 3.0.4-3 - Fix typo in the changelog From a5acc2f9165d8bc4bbc5a0864de4f0ce9b16e800 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 27 Jul 2020 14:35:52 +0000 Subject: [PATCH 152/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 2a2ac7c..7d15ede 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.4 -Release: 4%{?gitver}%{?dist} +Release: 5%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Mon Jul 27 2020 Fedora Release Engineering - 3.0.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Mon Jul 13 2020 Tom Stellard - 3.0.4-4 - Use make macros - https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro From f5d04d3ef888057942681da291d516392bfd597b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= Date: Thu, 27 Aug 2020 14:13:47 +0200 Subject: [PATCH 153/185] Rebuilt for new net-snmp release --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 7d15ede..62223ad 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.0.4 -Release: 5%{?gitver}%{?dist} +Release: 6%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -285,6 +285,9 @@ network splits) %endif %changelog +* Thu Aug 27 2020 Josef Řídký - 3.0.4-6 +- Rebuilt for new net-snmp release + * Mon Jul 27 2020 Fedora Release Engineering - 3.0.4-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 0b059adcd75f2badb4cadba99662f6247cc8636e Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 20 Oct 2020 17:18:14 +0200 Subject: [PATCH 154/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 13 +++++++++---- sources | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5e07c7c..1afb5d3 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ corosync-1.2.7.tar.gz /corosync-3.0.2.tar.gz /corosync-3.0.3.tar.gz /corosync-3.0.4.tar.gz +/corosync-3.1.0.tar.gz diff --git a/corosync.spec b/corosync.spec index 62223ad..fa58235 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,8 +17,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.0.4 -Release: 6%{?gitver}%{?dist} +Version: 3.1.0 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -27,14 +27,16 @@ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?git # The automatic dependency overridden in favor of explicit version lock Requires: corosynclib%{?_isa} = %{version}-%{release} +# Support crypto reload +Requires: libknet1 >= 1.18 # NSS crypto plugin should be always installed -Requires: libknet1-crypto-nss-plugin +Requires: libknet1-crypto-nss-plugin >= 1.18 # Build bits BuildRequires: gcc BuildRequires: groff BuildRequires: libqb-devel -BuildRequires: libknet1-devel +BuildRequires: libknet1-devel >= 1.18 BuildRequires: zlib-devel %if %{with runautogen} BuildRequires: autoconf automake libtool @@ -285,6 +287,9 @@ network splits) %endif %changelog +* Tue Oct 20 2020 Jan Friesse - 3.1.0-1 +- New upstream release + * Thu Aug 27 2020 Josef Řídký - 3.0.4-6 - Rebuilt for new net-snmp release diff --git a/sources b/sources index 4427f75..b9407c6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.0.4.tar.gz) = 0d3a19d8811f15d7e4ca6b0805bbd007726751626633279ddb40db37069aa789261b203b2e74474f6ceda366f30391e7effe2efa1e471fbd7dce17a04077e534 +SHA512 (corosync-3.1.0.tar.gz) = 1982549ea3031c7bc30cdf9d7d0a353717d35ad96c46a01a8af6e12072630d4d2b26657fd4987ff7f56b0cc0038edb1c6cc41f7a12a7249e714353de52118ba0 From aa04197369e74d7a27657dae591fdb2d1ecd2fdf Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 2 Nov 2020 17:47:37 +0100 Subject: [PATCH 155/185] Add isa version of corosync-devel provides Also add release to version to match autogenerated corosynclib-devel provides. Signed-off-by: Jan Friesse --- corosync.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/corosync.spec b/corosync.spec index fa58235..d6dd720 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.0 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -235,7 +235,8 @@ This package contains corosync libraries. Summary: The Corosync Cluster Engine Development Kit Requires: corosynclib%{?_isa} = %{version}-%{release} Requires: pkgconfig -Provides: corosync-devel = %{version} +Provides: corosync-devel = %{version}-%{release} +Provides: corosync-devel%{?_isa} = %{version}-%{release} %description -n corosynclib-devel This package contains include files and man pages used to develop using @@ -287,6 +288,11 @@ network splits) %endif %changelog +* Mon Nov 02 2020 Jan Friesse - 3.1.0-2 +- Add isa version of corosync-devel +- Add release to corosync-devel version to match autogenerated + corosynclib-devel provides + * Tue Oct 20 2020 Jan Friesse - 3.1.0-1 - New upstream release From 6cabdfe2009dc5c6a5203615b57ac059358f82d6 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sat, 19 Dec 2020 05:28:56 +0000 Subject: [PATCH 156/185] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- corosync.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/corosync.spec b/corosync.spec index d6dd720..8cc8a66 100644 --- a/corosync.spec +++ b/corosync.spec @@ -67,6 +67,7 @@ Requires: libxslt %if %{with vqsim} BuildRequires: readline-devel %endif +BuildRequires: make %prep %setup -q -n %{name}-%{version}%{?gittarver} From 57744512c8df377a3eb1452925975fe74f8cbdf7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 02:34:27 +0000 Subject: [PATCH 157/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 8cc8a66..677e869 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.0 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 3.1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Mon Nov 02 2020 Jan Friesse - 3.1.0-2 - Add isa version of corosync-devel - Add release to corosync-devel version to match autogenerated From f9116a5084bdb829877f8858ea06a981d0baafc7 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 31 Mar 2021 15:19:39 +0200 Subject: [PATCH 158/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1afb5d3..508417d 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ corosync-1.2.7.tar.gz /corosync-3.0.3.tar.gz /corosync-3.0.4.tar.gz /corosync-3.1.0.tar.gz +/corosync-3.1.1.tar.gz diff --git a/corosync.spec b/corosync.spec index 677e869..d15772d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,8 +17,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.0 -Release: 3%{?gitver}%{?dist} +Version: 3.1.1 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Mar 31 2021 Jan Friesse - 3.1.1-1 +- New upstream release + * Tue Jan 26 2021 Fedora Release Engineering - 3.1.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index b9407c6..97c32ec 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.0.tar.gz) = 1982549ea3031c7bc30cdf9d7d0a353717d35ad96c46a01a8af6e12072630d4d2b26657fd4987ff7f56b0cc0038edb1c6cc41f7a12a7249e714353de52118ba0 +SHA512 (corosync-3.1.1.tar.gz) = a2a2ca9110e8c2955f4be131ac6411d66f1cfbc7b3b2bcf2862501367c22d615e3e35ea269b537778cd55e18c94d0e1504e8a3b6eb1bad67054c2fd6dbbb554c From 6e3877b72df162383e1f4e2207f7a735d4efeb22 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 6 Apr 2021 12:25:25 +0200 Subject: [PATCH 159/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 508417d..61ed832 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ corosync-1.2.7.tar.gz /corosync-3.0.4.tar.gz /corosync-3.1.0.tar.gz /corosync-3.1.1.tar.gz +/corosync-3.1.2.tar.gz diff --git a/corosync.spec b/corosync.spec index d15772d..88edbe5 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.1 +Version: 3.1.2 Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Tue Apr 06 2021 Jan Friesse - 3.1.2-1 +- New upstream release + * Wed Mar 31 2021 Jan Friesse - 3.1.1-1 - New upstream release diff --git a/sources b/sources index 97c32ec..ff6fd8a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.1.tar.gz) = a2a2ca9110e8c2955f4be131ac6411d66f1cfbc7b3b2bcf2862501367c22d615e3e35ea269b537778cd55e18c94d0e1504e8a3b6eb1bad67054c2fd6dbbb554c +SHA512 (corosync-3.1.2.tar.gz) = 8ac35c3d8d3a869dfabc4383ae7b5bc31d4cfe344082451594b571a06c0412536b04301e32e30fda09c0d0aa975124cbb7018686d93b4a94e46041990b179098 From c8d63add1e9d4de3740702995da555a459090412 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 21 May 2021 09:23:39 +0200 Subject: [PATCH 160/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 61ed832..e47254d 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.0.tar.gz /corosync-3.1.1.tar.gz /corosync-3.1.2.tar.gz +/corosync-3.1.3.tar.gz diff --git a/corosync.spec b/corosync.spec index 88edbe5..8d6bae4 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.2 +Version: 3.1.3 Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Fri May 21 2021 Jan Friesse - 3.1.3-1 +- New upstream release + * Tue Apr 06 2021 Jan Friesse - 3.1.2-1 - New upstream release diff --git a/sources b/sources index ff6fd8a..31321cc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.2.tar.gz) = 8ac35c3d8d3a869dfabc4383ae7b5bc31d4cfe344082451594b571a06c0412536b04301e32e30fda09c0d0aa975124cbb7018686d93b4a94e46041990b179098 +SHA512 (corosync-3.1.3.tar.gz) = 5985b6a6163cfbc2ccdad9bfb3fa1c5f56c6d1f866a783a2ddc6a04f036850e119d0a31aea9c5e73cb289c4cfb7d05a81c90389d97bd0c62f39fbcfbfdc1d9b5 From e4b2ca892c20c8e0b209685adb4e8641e1098cf2 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 3 Jun 2021 14:39:32 +0200 Subject: [PATCH 161/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e47254d..e882047 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.1.tar.gz /corosync-3.1.2.tar.gz /corosync-3.1.3.tar.gz +/corosync-3.1.4.tar.gz diff --git a/corosync.spec b/corosync.spec index 8d6bae4..9eab928 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.3 +Version: 3.1.4 Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Thu Jun 03 2021 Jan Friesse - 3.1.4-1 +- New upstream release + * Fri May 21 2021 Jan Friesse - 3.1.3-1 - New upstream release diff --git a/sources b/sources index 31321cc..232fe18 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.3.tar.gz) = 5985b6a6163cfbc2ccdad9bfb3fa1c5f56c6d1f866a783a2ddc6a04f036850e119d0a31aea9c5e73cb289c4cfb7d05a81c90389d97bd0c62f39fbcfbfdc1d9b5 +SHA512 (corosync-3.1.4.tar.gz) = 3e8ed70653d2559449765dac91f3ad87b8a474b81529895a7b33dee044946e05b08dbf9f36da5be60d93527976ac0e390beb3ce2f77d088613fdb45e940558ec From 9fc14848551deeb30b8ce44d32c961c3c02d54fb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 15:05:29 +0000 Subject: [PATCH 162/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering From bca70d1078cbd6a479737dad05912bba121f69b0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 20:02:30 +0000 Subject: [PATCH 163/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 9eab928..105bdeb 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.4 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Jul 21 2021 Fedora Release Engineering - 3.1.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Thu Jun 03 2021 Jan Friesse - 3.1.4-1 - New upstream release From 15caf43c068f7a4b53b74de2937b32c1ac6973c0 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 4 Aug 2021 11:12:27 +0200 Subject: [PATCH 164/185] New upstream release --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e882047..8e9ea1a 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.2.tar.gz /corosync-3.1.3.tar.gz /corosync-3.1.4.tar.gz +/corosync-3.1.5.tar.gz diff --git a/corosync.spec b/corosync.spec index 105bdeb..2f9e429 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,8 +17,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.4 -Release: 2%{?gitver}%{?dist} +Version: 3.1.5 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Aug 04 2021 Jan Friesse - 3.1.5-1 +- New upstream release + * Wed Jul 21 2021 Fedora Release Engineering - 3.1.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 232fe18..2a816ad 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.4.tar.gz) = 3e8ed70653d2559449765dac91f3ad87b8a474b81529895a7b33dee044946e05b08dbf9f36da5be60d93527976ac0e390beb3ce2f77d088613fdb45e940558ec +SHA512 (corosync-3.1.5.tar.gz) = eb974a32f60c52564057ed41c1ebf31fe4332a5a082ebbd5fa2540af8fa9e8c0c42d4ef9066abcb9d7dd04c12b97cd13642289c65b5b6b65cfd30c12641ada1d From 16d3278606285c5cb3f3c546a9804eff8fde350f Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 15 Nov 2021 11:17:44 +0100 Subject: [PATCH 165/185] New upstream release --- .gitignore | 1 + corosync.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8e9ea1a..15b906f 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.3.tar.gz /corosync-3.1.4.tar.gz /corosync-3.1.5.tar.gz +/corosync-3.1.6.tar.gz diff --git a/corosync.spec b/corosync.spec index 2f9e429..98497d1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,7 +17,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.5 +Version: 3.1.6 Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Mon Nov 15 2021 Jan Friesse - 3.1.6-1 +- New upstream release + * Wed Aug 04 2021 Jan Friesse - 3.1.5-1 - New upstream release diff --git a/sources b/sources index 2a816ad..4a1cc64 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.5.tar.gz) = eb974a32f60c52564057ed41c1ebf31fe4332a5a082ebbd5fa2540af8fa9e8c0c42d4ef9066abcb9d7dd04c12b97cd13642289c65b5b6b65cfd30c12641ada1d +SHA512 (corosync-3.1.6.tar.gz) = 8f5d12851f296e0ee9dd425d40252988f0b8485d2c2098028b25265506f846e3f34df86007a7c273d020921b2532bdbc01b52e1631f6abfae79981436230225e From e2d21ef16620443ed7858b6ab2431582438bbef9 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jan 2022 23:51:25 +0000 Subject: [PATCH 166/185] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 98497d1..d08a460 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.6 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Jan 19 2022 Fedora Release Engineering - 3.1.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Mon Nov 15 2021 Jan Friesse - 3.1.6-1 - New upstream release From 6d8d5bd0e799d8a1f50604a4afea7e1d6458087d Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 30 Mar 2022 16:54:41 +0200 Subject: [PATCH 167/185] Use copytruncate method for logrotate --- corosync.spec | 8 ++- ...e-Use-copytruncate-method-by-default.patch | 60 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 logrotate-Use-copytruncate-method-by-default.patch diff --git a/corosync.spec b/corosync.spec index d08a460..6a7ad52 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,11 +18,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.6 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz +Patch0: logrotate-Use-copytruncate-method-by-default.patch + # Runtime bits # The automatic dependency overridden in favor of explicit version lock Requires: corosynclib%{?_isa} = %{version}-%{release} @@ -71,6 +73,7 @@ BuildRequires: make %prep %setup -q -n %{name}-%{version}%{?gittarver} +%patch0 -p1 %build %if %{with runautogen} @@ -289,6 +292,9 @@ network splits) %endif %changelog +* Wed Mar 30 2022 Jan Friesse - 3.1.6-3 +- Use copytruncate method for logrotate + * Wed Jan 19 2022 Fedora Release Engineering - 3.1.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/logrotate-Use-copytruncate-method-by-default.patch b/logrotate-Use-copytruncate-method-by-default.patch new file mode 100644 index 0000000..11d2cf3 --- /dev/null +++ b/logrotate-Use-copytruncate-method-by-default.patch @@ -0,0 +1,60 @@ +From 04362046c4a9d7307feb5b68341d567b7d0b94d6 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Tue, 29 Mar 2022 17:09:22 +0200 +Subject: [PATCH] logrotate: Use copytruncate method by default + +The reopen lograte method has two main problems: +1. It does fail when corosync is not running (solvable by + adding "|| true") +2. If (for some reason, like SELinux) cfgtool -L fails, logrotate + fails and corosync keeps logging into old file. Added "|| true" + makes situation even worse because logrotate removes file but + corosync keeps logging into it. + +Solution is to install copytruncate logrotate snip by default (and +keep reopen config file only for reference). + +Signed-off-by: Jan Friesse +Reviewed-by: Christine Caulfield +--- + conf/logrotate/Makefile.am | 7 ------- + conf/logrotate/corosync-reopen.in | 5 +++++ + 2 files changed, 5 insertions(+), 7 deletions(-) + +diff --git a/conf/logrotate/Makefile.am b/conf/logrotate/Makefile.am +index 4f7b7536..35efa2de 100644 +--- a/conf/logrotate/Makefile.am ++++ b/conf/logrotate/Makefile.am +@@ -34,16 +34,9 @@ MAINTAINERCLEANFILES = Makefile.in + + EXTRA_DIST = corosync-reopen.in corosync-copytruncate.in + +-if HAVE_QB_LOG_FILE_REOPEN +-corosync: corosync-reopen.in +- $(SED) -e 's#@''LOGDIR@#${LOGDIR}#g' \ +- -e 's#@''SBINDIR@#$(sbindir)#g' \ +- $< > $@ +-else + corosync: corosync-copytruncate.in + $(SED) -e 's#@''LOGDIR@#${LOGDIR}#g' \ + $< > $@ +-endif + + logrotatecorosyncdir = ${LOGROTATEDIR} + logrotatecorosync_DATA = corosync +diff --git a/conf/logrotate/corosync-reopen.in b/conf/logrotate/corosync-reopen.in +index 839c5dae..730fb741 100644 +--- a/conf/logrotate/corosync-reopen.in ++++ b/conf/logrotate/corosync-reopen.in +@@ -1,3 +1,8 @@ ++# This logrotate method has two main problems and it's kept only for reference: ++# 1. It does fail when corosync is not running (solvable by adding "|| true") ++# 2. If (for some reason) cfgtool -L fails, logrotate fails and corosync keeps ++# logging into old file. Added "|| true" makes situation even worse ++# because logrotate removes file but corosync keeps logging into it. + @LOGDIR@/corosync.log { + missingok + compress +-- +2.33.1 + From 35376a7b8ddd64e67900c4649ea8216d7ad2a995 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 20 Jul 2022 23:36:04 +0000 Subject: [PATCH 168/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 6a7ad52..9516414 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.6 -Release: 3%{?gitver}%{?dist} +Release: 4%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -292,6 +292,9 @@ network splits) %endif %changelog +* Wed Jul 20 2022 Fedora Release Engineering - 3.1.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Wed Mar 30 2022 Jan Friesse - 3.1.6-3 - Use copytruncate method for logrotate From 8fc25245a8ba4ab89b58d42a13ef03db13061f38 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 15 Nov 2022 18:31:51 +0100 Subject: [PATCH 169/185] New upstream release --- .gitignore | 1 + corosync.spec | 10 ++-- ...e-Use-copytruncate-method-by-default.patch | 60 ------------------- sources | 2 +- 4 files changed, 7 insertions(+), 66 deletions(-) delete mode 100644 logrotate-Use-copytruncate-method-by-default.patch diff --git a/.gitignore b/.gitignore index 15b906f..58e7955 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.4.tar.gz /corosync-3.1.5.tar.gz /corosync-3.1.6.tar.gz +/corosync-3.1.7.tar.gz diff --git a/corosync.spec b/corosync.spec index 9516414..f7e783e 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,14 +17,12 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.6 -Release: 4%{?gitver}%{?dist} +Version: 3.1.7 +Release: 1%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz -Patch0: logrotate-Use-copytruncate-method-by-default.patch - # Runtime bits # The automatic dependency overridden in favor of explicit version lock Requires: corosynclib%{?_isa} = %{version}-%{release} @@ -73,7 +71,6 @@ BuildRequires: make %prep %setup -q -n %{name}-%{version}%{?gittarver} -%patch0 -p1 %build %if %{with runautogen} @@ -292,6 +289,9 @@ network splits) %endif %changelog +* Tue Nov 15 2022 Jan Friesse - 3.1.7-1 +- New upstream release + * Wed Jul 20 2022 Fedora Release Engineering - 3.1.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/logrotate-Use-copytruncate-method-by-default.patch b/logrotate-Use-copytruncate-method-by-default.patch deleted file mode 100644 index 11d2cf3..0000000 --- a/logrotate-Use-copytruncate-method-by-default.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 04362046c4a9d7307feb5b68341d567b7d0b94d6 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Tue, 29 Mar 2022 17:09:22 +0200 -Subject: [PATCH] logrotate: Use copytruncate method by default - -The reopen lograte method has two main problems: -1. It does fail when corosync is not running (solvable by - adding "|| true") -2. If (for some reason, like SELinux) cfgtool -L fails, logrotate - fails and corosync keeps logging into old file. Added "|| true" - makes situation even worse because logrotate removes file but - corosync keeps logging into it. - -Solution is to install copytruncate logrotate snip by default (and -keep reopen config file only for reference). - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield ---- - conf/logrotate/Makefile.am | 7 ------- - conf/logrotate/corosync-reopen.in | 5 +++++ - 2 files changed, 5 insertions(+), 7 deletions(-) - -diff --git a/conf/logrotate/Makefile.am b/conf/logrotate/Makefile.am -index 4f7b7536..35efa2de 100644 ---- a/conf/logrotate/Makefile.am -+++ b/conf/logrotate/Makefile.am -@@ -34,16 +34,9 @@ MAINTAINERCLEANFILES = Makefile.in - - EXTRA_DIST = corosync-reopen.in corosync-copytruncate.in - --if HAVE_QB_LOG_FILE_REOPEN --corosync: corosync-reopen.in -- $(SED) -e 's#@''LOGDIR@#${LOGDIR}#g' \ -- -e 's#@''SBINDIR@#$(sbindir)#g' \ -- $< > $@ --else - corosync: corosync-copytruncate.in - $(SED) -e 's#@''LOGDIR@#${LOGDIR}#g' \ - $< > $@ --endif - - logrotatecorosyncdir = ${LOGROTATEDIR} - logrotatecorosync_DATA = corosync -diff --git a/conf/logrotate/corosync-reopen.in b/conf/logrotate/corosync-reopen.in -index 839c5dae..730fb741 100644 ---- a/conf/logrotate/corosync-reopen.in -+++ b/conf/logrotate/corosync-reopen.in -@@ -1,3 +1,8 @@ -+# This logrotate method has two main problems and it's kept only for reference: -+# 1. It does fail when corosync is not running (solvable by adding "|| true") -+# 2. If (for some reason) cfgtool -L fails, logrotate fails and corosync keeps -+# logging into old file. Added "|| true" makes situation even worse -+# because logrotate removes file but corosync keeps logging into it. - @LOGDIR@/corosync.log { - missingok - compress --- -2.33.1 - diff --git a/sources b/sources index 4a1cc64..5abef83 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.6.tar.gz) = 8f5d12851f296e0ee9dd425d40252988f0b8485d2c2098028b25265506f846e3f34df86007a7c273d020921b2532bdbc01b52e1631f6abfae79981436230225e +SHA512 (corosync-3.1.7.tar.gz) = a4d00f18a6dda07f36e77fc48f5bddff77e12a3e6ee40d9450734e281d20479b90cd0c653e255cfc46e0e42e4a0177291a3daba671e751d027e4317e601f0cd2 From 1d119ea67b3232d1a35824f97b8f3d4c4415c80d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 00:31:29 +0000 Subject: [PATCH 170/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index f7e783e..43b0a20 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.7 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 3.1.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Tue Nov 15 2022 Jan Friesse - 3.1.7-1 - New upstream release From 5f9286ab9f329e1b4b5da763d04a061ff7098e4b Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 6 Jun 2023 11:39:03 +0200 Subject: [PATCH 171/185] Migrated to SPDX license Signed-off-by: Jan Friesse --- corosync.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/corosync.spec b/corosync.spec index 43b0a20..2855445 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,8 +18,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.7 -Release: 2%{?gitver}%{?dist} -License: BSD +Release: 3%{?gitver}%{?dist} +License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Tue Jun 06 2023 Jan Friesse - 3.1.7-3 +- migrated to SPDX license + * Thu Jan 19 2023 Fedora Release Engineering - 3.1.7-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From e0bfdb2bb991ac15880517db945e0b2ea2adf1f8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 16:24:33 +0000 Subject: [PATCH 172/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 2855445..e48b3b8 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.7 -Release: 3%{?gitver}%{?dist} +Release: 4%{?gitver}%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 3.1.7-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue Jun 06 2023 Jan Friesse - 3.1.7-3 - migrated to SPDX license From a39be7a0603803f428c67af9f39bb93fd83ebe65 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 15 Nov 2023 18:07:22 +0100 Subject: [PATCH 173/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 58e7955..63f502d 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.5.tar.gz /corosync-3.1.6.tar.gz /corosync-3.1.7.tar.gz +/corosync-3.1.8.tar.gz diff --git a/corosync.spec b/corosync.spec index e48b3b8..614a28d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,8 +17,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.7 -Release: 4%{?gitver}%{?dist} +Version: 3.1.8 +Release: 1%{?gitver}%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Nov 15 2023 Jan Friesse - 3.1.8-1 +- New upstream release + * Wed Jul 19 2023 Fedora Release Engineering - 3.1.7-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/sources b/sources index 5abef83..fd916ac 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.7.tar.gz) = a4d00f18a6dda07f36e77fc48f5bddff77e12a3e6ee40d9450734e281d20479b90cd0c653e255cfc46e0e42e4a0177291a3daba671e751d027e4317e601f0cd2 +SHA512 (corosync-3.1.8.tar.gz) = 6325ae39bada33dbc0c85eb07d137af78235a1c0f8a4d1f90a20088e011bff65263903e5688956256ddfb58daec45f6d96c04624ff320be0c00ec36aa5d568f8 From b333a9fbaeb5ce3a0cb71f5aba39ae05961d7181 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jan 2024 16:12:20 +0000 Subject: [PATCH 174/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 614a28d..d622fec 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.8 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Fri Jan 19 2024 Fedora Release Engineering - 3.1.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Wed Nov 15 2023 Jan Friesse - 3.1.8-1 - New upstream release From 88be69d4432a370699f692b6d2e751c870d55ce5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jan 2024 08:07:39 +0000 Subject: [PATCH 175/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index d622fec..1494717 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.8 -Release: 2%{?gitver}%{?dist} +Release: 3%{?gitver}%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Jan 24 2024 Fedora Release Engineering - 3.1.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jan 19 2024 Fedora Release Engineering - 3.1.8-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 2bba86553f6f25d79ca8ef0ce9f0681bf7221f5c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 20:01:05 +0000 Subject: [PATCH 176/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 1494717..0430a0b 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.8 -Release: 3%{?gitver}%{?dist} +Release: 4%{?gitver}%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Wed Jul 17 2024 Fedora Release Engineering - 3.1.8-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Wed Jan 24 2024 Fedora Release Engineering - 3.1.8-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 8abfa3b0c91092c447e003bafcb3c60dda1c4096 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Fri, 15 Nov 2024 11:03:23 +0100 Subject: [PATCH 177/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 11 +++++++---- sources | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 63f502d..836dba5 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.6.tar.gz /corosync-3.1.7.tar.gz /corosync-3.1.8.tar.gz +/corosync-3.1.9.tar.gz diff --git a/corosync.spec b/corosync.spec index 0430a0b..1e545f0 100644 --- a/corosync.spec +++ b/corosync.spec @@ -17,8 +17,8 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.8 -Release: 4%{?gitver}%{?dist} +Version: 3.1.9 +Release: 1%{?gitver}%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -116,7 +116,7 @@ BuildRequires: make %if %{with dbus} mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d -install -m 644 %{_builddir}/%{name}-%{version}%{?gittarver}/conf/corosync-signals.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf +install -m 644 %{_builddir}/%{name}-%{version}%{?gittarver}/conf/corosync-signals.conf %{buildroot}/%{_datadir}/dbus-1/system.d/corosync-signals.conf %endif ## tree fixup @@ -185,7 +185,7 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/corosync %config(noreplace) %{_sysconfdir}/logrotate.d/corosync %if %{with dbus} -%{_sysconfdir}/dbus-1/system.d/corosync-signals.conf +%{_datadir}/dbus-1/system.d/corosync-signals.conf %endif %if %{with snmp} %{_datadir}/snmp/mibs/COROSYNC-MIB.txt @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Fri Nov 15 2024 Jan Friesse - 3.1.9-1 +- New upstream release + * Wed Jul 17 2024 Fedora Release Engineering - 3.1.8-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/sources b/sources index fd916ac..d3e0db1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.8.tar.gz) = 6325ae39bada33dbc0c85eb07d137af78235a1c0f8a4d1f90a20088e011bff65263903e5688956256ddfb58daec45f6d96c04624ff320be0c00ec36aa5d568f8 +SHA512 (corosync-3.1.9.tar.gz) = d5332c65535dd40e3bee48912ebf2e71c55380b3dba93c36ff8b74090edf3ec44b69685cd11fda3732e4b0dab0b2954f08be94d772fcff6aaf9a4a846ef2e4cc From a1ab73206a26a800959cff958d267d18b6dad352 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 14:33:06 +0000 Subject: [PATCH 178/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 1e545f0..a4022f1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.9 -Release: 1%{?gitver}%{?dist} +Release: 2%{?gitver}%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz @@ -289,6 +289,9 @@ network splits) %endif %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 3.1.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Fri Nov 15 2024 Jan Friesse - 3.1.9-1 - New upstream release From c97695360d63da3cc1143591780c7c869c85c6d4 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Tue, 25 Mar 2025 11:40:52 +0100 Subject: [PATCH 179/185] Use autosetup - Add git build dependency required for autosetup git_am - Remove unused gitver and gittarver Signed-off-by: Jan Friesse --- corosync.spec | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/corosync.spec b/corosync.spec index a4022f1..67ff94d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -12,16 +12,13 @@ %bcond_without runautogen %bcond_without userflags -%global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}} -%global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}} - Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.9 -Release: 2%{?gitver}%{?dist} +Release: 2%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ -Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz +Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}.tar.gz # Runtime bits # The automatic dependency overridden in favor of explicit version lock @@ -68,9 +65,10 @@ Requires: libxslt BuildRequires: readline-devel %endif BuildRequires: make +BuildRequires: git %prep -%setup -q -n %{name}-%{version}%{?gittarver} +%autosetup -S git_am %build %if %{with runautogen} @@ -116,7 +114,7 @@ BuildRequires: make %if %{with dbus} mkdir -p -m 0700 %{buildroot}/%{_sysconfdir}/dbus-1/system.d -install -m 644 %{_builddir}/%{name}-%{version}%{?gittarver}/conf/corosync-signals.conf %{buildroot}/%{_datadir}/dbus-1/system.d/corosync-signals.conf +install -m 644 %{_builddir}/%{name}-%{version}/conf/corosync-signals.conf %{buildroot}/%{_datadir}/dbus-1/system.d/corosync-signals.conf %endif ## tree fixup From 10cd9580c6f290706c1ab4dd5f34385a67cd269c Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 26 Mar 2025 10:27:31 +0100 Subject: [PATCH 180/185] Fix CVE-2025-30472 - totemsrp: Check size of orf_token msg (fixes CVE-2025-30472) Signed-off-by: Jan Friesse --- corosync.spec | 8 ++- totemsrp-Check-size-of-orf_token-msg.patch | 68 ++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 totemsrp-Check-size-of-orf_token-msg.patch diff --git a/corosync.spec b/corosync.spec index 67ff94d..e433376 100644 --- a/corosync.spec +++ b/corosync.spec @@ -15,11 +15,13 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.9 -Release: 2%{?dist} +Release: 3%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}.tar.gz +Patch0: totemsrp-Check-size-of-orf_token-msg.patch + # Runtime bits # The automatic dependency overridden in favor of explicit version lock Requires: corosynclib%{?_isa} = %{version}-%{release} @@ -287,6 +289,10 @@ network splits) %endif %changelog +* Wed Mar 26 2025 Jan Friesse - 3.1.9-3 +- totemsrp: Check size of orf_token msg + (fixes CVE-2025-30472) + * Thu Jan 16 2025 Fedora Release Engineering - 3.1.9-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/totemsrp-Check-size-of-orf_token-msg.patch b/totemsrp-Check-size-of-orf_token-msg.patch new file mode 100644 index 0000000..17b4c3e --- /dev/null +++ b/totemsrp-Check-size-of-orf_token-msg.patch @@ -0,0 +1,68 @@ +From 7839990f9cdf34e55435ed90109e82709032466a Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Mon, 24 Mar 2025 12:05:08 +0100 +Subject: [PATCH] totemsrp: Check size of orf_token msg + +orf_token message is stored into preallocated array on endian convert +so carefully crafted malicious message can lead to crash of corosync. + +Solution is to check message size beforehand. + +Signed-off-by: Jan Friesse +Reviewed-by: Christine Caulfield +--- + exec/totemsrp.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/exec/totemsrp.c b/exec/totemsrp.c +index 962d0e2a..364528ce 100644 +--- a/exec/totemsrp.c ++++ b/exec/totemsrp.c +@@ -3679,12 +3679,20 @@ static int check_orf_token_sanity( + const struct totemsrp_instance *instance, + const void *msg, + size_t msg_len, ++ size_t max_msg_len, + int endian_conversion_needed) + { + int rtr_entries; + const struct orf_token *token = (const struct orf_token *)msg; + size_t required_len; + ++ if (msg_len > max_msg_len) { ++ log_printf (instance->totemsrp_log_level_security, ++ "Received orf_token message is too long... ignoring."); ++ ++ return (-1); ++ } ++ + if (msg_len < sizeof(struct orf_token)) { + log_printf (instance->totemsrp_log_level_security, + "Received orf_token message is too short... ignoring."); +@@ -3698,6 +3706,13 @@ static int check_orf_token_sanity( + rtr_entries = token->rtr_list_entries; + } + ++ if (rtr_entries > RETRANSMIT_ENTRIES_MAX) { ++ log_printf (instance->totemsrp_log_level_security, ++ "Received orf_token message rtr_entries is corrupted... ignoring."); ++ ++ return (-1); ++ } ++ + required_len = sizeof(struct orf_token) + rtr_entries * sizeof(struct rtr_item); + if (msg_len < required_len) { + log_printf (instance->totemsrp_log_level_security, +@@ -3868,7 +3883,8 @@ static int message_handler_orf_token ( + "Time since last token %0.4f ms", tv_diff / (float)QB_TIME_NS_IN_MSEC); + #endif + +- if (check_orf_token_sanity(instance, msg, msg_len, endian_conversion_needed) == -1) { ++ if (check_orf_token_sanity(instance, msg, msg_len, sizeof(token_storage), ++ endian_conversion_needed) == -1) { + return (0); + } + +-- +2.47.0 + From ea77d15fb73753ce9d5253957b5ea9c4f8b81408 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 16 Jun 2025 15:35:55 +0200 Subject: [PATCH 181/185] Fix bootc container lint warnings Signed-off-by: Jan Friesse --- corosync.spec | 10 +- ...-Add-support-for-env-STATE_DIRECTORY.patch | 113 ++++++++++++++++++ ...e-LogsDirectory-in-systemd-unit-file.patch | 50 ++++++++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 exec-Add-support-for-env-STATE_DIRECTORY.patch create mode 100644 init-Use-LogsDirectory-in-systemd-unit-file.patch diff --git a/corosync.spec b/corosync.spec index e433376..c568fd2 100644 --- a/corosync.spec +++ b/corosync.spec @@ -15,12 +15,14 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.9 -Release: 3%{?dist} +Release: 4%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}.tar.gz Patch0: totemsrp-Check-size-of-orf_token-msg.patch +Patch1: exec-Add-support-for-env-STATE_DIRECTORY.patch +Patch2: init-Use-LogsDirectory-in-systemd-unit-file.patch # Runtime bits # The automatic dependency overridden in favor of explicit version lock @@ -197,8 +199,10 @@ fi %{_initrddir}/corosync %{_initrddir}/corosync-notifyd %endif +%if %{without systemd} %dir %{_localstatedir}/lib/corosync %dir %{_localstatedir}/log/cluster +%endif %{_mandir}/man7/corosync_overview.7* %{_mandir}/man8/corosync.8* %{_mandir}/man8/corosync-blackbox.8* @@ -289,6 +293,10 @@ network splits) %endif %changelog +* Mon Jun 16 2025 Jan Friesse - 3.1.9-4 +- exec: Add support for env STATE_DIRECTORY +- init: Use LogsDirectory in systemd unit file + * Wed Mar 26 2025 Jan Friesse - 3.1.9-3 - totemsrp: Check size of orf_token msg (fixes CVE-2025-30472) diff --git a/exec-Add-support-for-env-STATE_DIRECTORY.patch b/exec-Add-support-for-env-STATE_DIRECTORY.patch new file mode 100644 index 0000000..461a668 --- /dev/null +++ b/exec-Add-support-for-env-STATE_DIRECTORY.patch @@ -0,0 +1,113 @@ +From: Jan Friesse +Date: Wed, 11 Jun 2025 17:26:41 +0200 +Subject: [PATCH 1/2] exec: Add support for env STATE_DIRECTORY + +Image mode recommendation is to not ship /var/lib subdirectories if +possible and bootc lint produces warning if not. This was the case +also for Corosync. + +Simplest possible solution seems to implement support for systemd +unit StateDirectory functionality and not ship /var/lib/corosync +in rpm. + +So patch: +1. Adds support for reading the environment variable STATE_DIRECTORY + which is set by systemd and use it as a default value for + system.state_dir configuration option. This is generally useful + feature even for non-systemd builds. +2. Set StateDirectory in service file +3. Drop /var/lib/corosync directory from RPM for systemd builds + +Signed-off-by: Jan Friesse +Reviewed-by: Christine Caulfield +--- + corosync.spec.in | 2 ++ + exec/util.c | 19 +++++++++++++++---- + init/corosync.service.in | 1 + + man/corosync.conf.5 | 4 ++-- + 4 files changed, 20 insertions(+), 6 deletions(-) + +diff --git a/corosync.spec.in b/corosync.spec.in +index 80040a46..049c585a 100644 +--- a/corosync.spec.in ++++ b/corosync.spec.in +@@ -207,7 +207,9 @@ fi + %{_initrddir}/corosync + %{_initrddir}/corosync-notifyd + %endif ++%if %{without systemd} + %dir %{_localstatedir}/lib/corosync ++%endif + %dir %{_localstatedir}/log/cluster + %{_mandir}/man7/corosync_overview.7* + %{_mandir}/man8/corosync.8* +diff --git a/exec/util.c b/exec/util.c +index 8988ab29..795ea5c5 100644 +--- a/exec/util.c ++++ b/exec/util.c +@@ -174,13 +174,24 @@ int cs_name_tisEqual (cs_name_t *str1, char *str2) { + const char *get_state_dir(void) + { + static char path[PATH_MAX] = {'\0'}; +- char *cmap_state_dir; ++ char *state_dir; + int res; + + if (path[0] == '\0') { +- if (icmap_get_string("system.state_dir", &cmap_state_dir) == CS_OK) { +- res = snprintf(path, PATH_MAX, "%s", cmap_state_dir); +- free(cmap_state_dir); ++ if (icmap_get_string("system.state_dir", &state_dir) == CS_OK) { ++ res = snprintf(path, PATH_MAX, "%s", state_dir); ++ free(state_dir); ++ } else if ((state_dir = getenv("STATE_DIRECTORY")) != NULL) { ++ /* ++ * systemd allows multiple directory names that are ++ * passed to env variable separated by colon. Support for this feature ++ * is deliberately not implemented because corosync always ++ * uses just one state directory and it is unclear what behavior should ++ * be taken for multiple ones. If reasonable need for ++ * supporting multiple directories appear, it must be implemented also ++ * for cmap. ++ */ ++ res = snprintf(path, PATH_MAX, "%s", state_dir); + } else { + res = snprintf(path, PATH_MAX, "%s/%s", LOCALSTATEDIR, "lib/corosync"); + } +diff --git a/init/corosync.service.in b/init/corosync.service.in +index bd2a48a9..3e3efef8 100644 +--- a/init/corosync.service.in ++++ b/init/corosync.service.in +@@ -9,6 +9,7 @@ After=network-online.target + EnvironmentFile=-@INITCONFIGDIR@/corosync + ExecStart=@SBINDIR@/corosync -f $COROSYNC_OPTIONS + ExecStop=@SBINDIR@/corosync-cfgtool -H --force ++StateDirectory=corosync + Type=notify + + # In typical systemd deployments, both standard outputs are forwarded to +diff --git a/man/corosync.conf.5 b/man/corosync.conf.5 +index 3510ab6b..3bcda7c7 100644 +--- a/man/corosync.conf.5 ++++ b/man/corosync.conf.5 +@@ -32,7 +32,7 @@ + .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + .\" * THE POSSIBILITY OF SUCH DAMAGE. + .\" */ +-.TH COROSYNC_CONF 5 2024-07-22 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" ++.TH COROSYNC_CONF 5 2025-06-12 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" + .SH NAME + corosync.conf - corosync executive configuration file + +@@ -900,7 +900,7 @@ state_dir + Existing directory where corosync should chdir into. Corosync stores + important state files and blackboxes there. + +-The default is /var/lib/corosync. ++The default is the value of the environment variable STATE_DIRECTORY or /var/lib/corosync. + + .PP + Within the +-- +2.47.0 + diff --git a/init-Use-LogsDirectory-in-systemd-unit-file.patch b/init-Use-LogsDirectory-in-systemd-unit-file.patch new file mode 100644 index 0000000..eb38f6f --- /dev/null +++ b/init-Use-LogsDirectory-in-systemd-unit-file.patch @@ -0,0 +1,50 @@ +From 050933cf334ef4ac6a6b4a3988508ca181da34b0 Mon Sep 17 00:00:00 2001 +From: Jan Friesse +Date: Thu, 12 Jun 2025 09:40:45 +0200 +Subject: [PATCH 2/2] init: Use LogsDirectory in systemd unit file + +Similarly as StateDirectory, this is mainly for image mode. +/var/log/cluster shouldn't be included in rpm package, so +use LogsDirectory to make systemd create /var/log/cluster during +corosync startup. + +No code change is needed, because logging to log file is fully +configured by user in config file so there is no default to read from +environment variable. + +Signed-off-by: Jan Friesse +Reviewed-by: Christine Caulfield +--- + corosync.spec.in | 2 +- + init/corosync.service.in | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/corosync.spec.in b/corosync.spec.in +index 049c585a..7cb70114 100644 +--- a/corosync.spec.in ++++ b/corosync.spec.in +@@ -209,8 +209,8 @@ fi + %endif + %if %{without systemd} + %dir %{_localstatedir}/lib/corosync +-%endif + %dir %{_localstatedir}/log/cluster ++%endif + %{_mandir}/man7/corosync_overview.7* + %{_mandir}/man8/corosync.8* + %{_mandir}/man8/corosync-blackbox.8* +diff --git a/init/corosync.service.in b/init/corosync.service.in +index 3e3efef8..89d67b5e 100644 +--- a/init/corosync.service.in ++++ b/init/corosync.service.in +@@ -10,6 +10,7 @@ EnvironmentFile=-@INITCONFIGDIR@/corosync + ExecStart=@SBINDIR@/corosync -f $COROSYNC_OPTIONS + ExecStop=@SBINDIR@/corosync-cfgtool -H --force + StateDirectory=corosync ++LogsDirectory=cluster + Type=notify + + # In typical systemd deployments, both standard outputs are forwarded to +-- +2.47.0 + From a2c975b92de91e7e600828e1e8c3f2557a7c1551 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 18:40:51 +0000 Subject: [PATCH 182/185] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- corosync.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index c568fd2..4989c5a 100644 --- a/corosync.spec +++ b/corosync.spec @@ -15,7 +15,7 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces Version: 3.1.9 -Release: 4%{?dist} +Release: 5%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}.tar.gz @@ -293,6 +293,9 @@ network splits) %endif %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 3.1.9-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Mon Jun 16 2025 Jan Friesse - 3.1.9-4 - exec: Add support for env STATE_DIRECTORY - init: Use LogsDirectory in systemd unit file From 290649b778a9c526f3843b6bec9b0c47f211524e Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Thu, 24 Jul 2025 10:47:31 +0200 Subject: [PATCH 183/185] Migrate tests from STI to TMT format Signed-off-by: Jan Friesse --- .fmf/version | 1 + tests/.gitignore | 3 --- tests/plan.fmf | 12 ++++++++++++ tests/smoke/main.fmf | 2 ++ tests/smoke/runtest.sh | 0 tests/tests.yml | 12 ------------ 6 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 .fmf/version delete mode 100644 tests/.gitignore create mode 100644 tests/plan.fmf create mode 100644 tests/smoke/main.fmf mode change 100644 => 100755 tests/smoke/runtest.sh delete mode 100644 tests/tests.yml diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index e6c79fd..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Ignore tests runs/artefacts. -artifacts/** -**/*.retry diff --git a/tests/plan.fmf b/tests/plan.fmf new file mode 100644 index 0000000..1c97683 --- /dev/null +++ b/tests/plan.fmf @@ -0,0 +1,12 @@ +summary: Run all smoke tests +discover: + how: fmf +execute: + how: tmt +prepare: + how: install + package: + - gcc + - iproute + - corosync + - corosync-devel diff --git a/tests/smoke/main.fmf b/tests/smoke/main.fmf new file mode 100644 index 0000000..c431594 --- /dev/null +++ b/tests/smoke/main.fmf @@ -0,0 +1,2 @@ +summary: Basic smoke test +test: ./runtest.sh diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh old mode 100644 new mode 100755 diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 39b6209..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,12 +0,0 @@ -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - tests: - - smoke - required_packages: - - gcc - - iproute - - corosync - - corosync-devel From 2de47be2d1227827c642eeb38faf1938e11064d3 Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Sat, 15 Nov 2025 16:44:01 +0100 Subject: [PATCH 184/185] New upstream release Signed-off-by: Jan Friesse --- .gitignore | 1 + corosync.spec | 13 +- ...-Add-support-for-env-STATE_DIRECTORY.patch | 113 ------------------ ...e-LogsDirectory-in-systemd-unit-file.patch | 50 -------- sources | 2 +- totemsrp-Check-size-of-orf_token-msg.patch | 68 ----------- 6 files changed, 8 insertions(+), 239 deletions(-) delete mode 100644 exec-Add-support-for-env-STATE_DIRECTORY.patch delete mode 100644 init-Use-LogsDirectory-in-systemd-unit-file.patch delete mode 100644 totemsrp-Check-size-of-orf_token-msg.patch diff --git a/.gitignore b/.gitignore index 836dba5..be468d1 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ corosync-1.2.7.tar.gz /corosync-3.1.7.tar.gz /corosync-3.1.8.tar.gz /corosync-3.1.9.tar.gz +/corosync-3.1.10.tar.gz diff --git a/corosync.spec b/corosync.spec index 4989c5a..3cb7648 100644 --- a/corosync.spec +++ b/corosync.spec @@ -14,15 +14,11 @@ Name: corosync Summary: The Corosync Cluster Engine and Application Programming Interfaces -Version: 3.1.9 -Release: 5%{?dist} +Version: 3.1.10 +Release: 1%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ -Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}.tar.gz - -Patch0: totemsrp-Check-size-of-orf_token-msg.patch -Patch1: exec-Add-support-for-env-STATE_DIRECTORY.patch -Patch2: init-Use-LogsDirectory-in-systemd-unit-file.patch +Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}%{?gittarver}.tar.gz # Runtime bits # The automatic dependency overridden in favor of explicit version lock @@ -293,6 +289,9 @@ network splits) %endif %changelog +* Sat Nov 15 2025 Jan Friesse - 3.1.10-1 +- New upstream release + * Wed Jul 23 2025 Fedora Release Engineering - 3.1.9-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/exec-Add-support-for-env-STATE_DIRECTORY.patch b/exec-Add-support-for-env-STATE_DIRECTORY.patch deleted file mode 100644 index 461a668..0000000 --- a/exec-Add-support-for-env-STATE_DIRECTORY.patch +++ /dev/null @@ -1,113 +0,0 @@ -From: Jan Friesse -Date: Wed, 11 Jun 2025 17:26:41 +0200 -Subject: [PATCH 1/2] exec: Add support for env STATE_DIRECTORY - -Image mode recommendation is to not ship /var/lib subdirectories if -possible and bootc lint produces warning if not. This was the case -also for Corosync. - -Simplest possible solution seems to implement support for systemd -unit StateDirectory functionality and not ship /var/lib/corosync -in rpm. - -So patch: -1. Adds support for reading the environment variable STATE_DIRECTORY - which is set by systemd and use it as a default value for - system.state_dir configuration option. This is generally useful - feature even for non-systemd builds. -2. Set StateDirectory in service file -3. Drop /var/lib/corosync directory from RPM for systemd builds - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield ---- - corosync.spec.in | 2 ++ - exec/util.c | 19 +++++++++++++++---- - init/corosync.service.in | 1 + - man/corosync.conf.5 | 4 ++-- - 4 files changed, 20 insertions(+), 6 deletions(-) - -diff --git a/corosync.spec.in b/corosync.spec.in -index 80040a46..049c585a 100644 ---- a/corosync.spec.in -+++ b/corosync.spec.in -@@ -207,7 +207,9 @@ fi - %{_initrddir}/corosync - %{_initrddir}/corosync-notifyd - %endif -+%if %{without systemd} - %dir %{_localstatedir}/lib/corosync -+%endif - %dir %{_localstatedir}/log/cluster - %{_mandir}/man7/corosync_overview.7* - %{_mandir}/man8/corosync.8* -diff --git a/exec/util.c b/exec/util.c -index 8988ab29..795ea5c5 100644 ---- a/exec/util.c -+++ b/exec/util.c -@@ -174,13 +174,24 @@ int cs_name_tisEqual (cs_name_t *str1, char *str2) { - const char *get_state_dir(void) - { - static char path[PATH_MAX] = {'\0'}; -- char *cmap_state_dir; -+ char *state_dir; - int res; - - if (path[0] == '\0') { -- if (icmap_get_string("system.state_dir", &cmap_state_dir) == CS_OK) { -- res = snprintf(path, PATH_MAX, "%s", cmap_state_dir); -- free(cmap_state_dir); -+ if (icmap_get_string("system.state_dir", &state_dir) == CS_OK) { -+ res = snprintf(path, PATH_MAX, "%s", state_dir); -+ free(state_dir); -+ } else if ((state_dir = getenv("STATE_DIRECTORY")) != NULL) { -+ /* -+ * systemd allows multiple directory names that are -+ * passed to env variable separated by colon. Support for this feature -+ * is deliberately not implemented because corosync always -+ * uses just one state directory and it is unclear what behavior should -+ * be taken for multiple ones. If reasonable need for -+ * supporting multiple directories appear, it must be implemented also -+ * for cmap. -+ */ -+ res = snprintf(path, PATH_MAX, "%s", state_dir); - } else { - res = snprintf(path, PATH_MAX, "%s/%s", LOCALSTATEDIR, "lib/corosync"); - } -diff --git a/init/corosync.service.in b/init/corosync.service.in -index bd2a48a9..3e3efef8 100644 ---- a/init/corosync.service.in -+++ b/init/corosync.service.in -@@ -9,6 +9,7 @@ After=network-online.target - EnvironmentFile=-@INITCONFIGDIR@/corosync - ExecStart=@SBINDIR@/corosync -f $COROSYNC_OPTIONS - ExecStop=@SBINDIR@/corosync-cfgtool -H --force -+StateDirectory=corosync - Type=notify - - # In typical systemd deployments, both standard outputs are forwarded to -diff --git a/man/corosync.conf.5 b/man/corosync.conf.5 -index 3510ab6b..3bcda7c7 100644 ---- a/man/corosync.conf.5 -+++ b/man/corosync.conf.5 -@@ -32,7 +32,7 @@ - .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - .\" * THE POSSIBILITY OF SUCH DAMAGE. - .\" */ --.TH COROSYNC_CONF 5 2024-07-22 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" -+.TH COROSYNC_CONF 5 2025-06-12 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual" - .SH NAME - corosync.conf - corosync executive configuration file - -@@ -900,7 +900,7 @@ state_dir - Existing directory where corosync should chdir into. Corosync stores - important state files and blackboxes there. - --The default is /var/lib/corosync. -+The default is the value of the environment variable STATE_DIRECTORY or /var/lib/corosync. - - .PP - Within the --- -2.47.0 - diff --git a/init-Use-LogsDirectory-in-systemd-unit-file.patch b/init-Use-LogsDirectory-in-systemd-unit-file.patch deleted file mode 100644 index eb38f6f..0000000 --- a/init-Use-LogsDirectory-in-systemd-unit-file.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 050933cf334ef4ac6a6b4a3988508ca181da34b0 Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Thu, 12 Jun 2025 09:40:45 +0200 -Subject: [PATCH 2/2] init: Use LogsDirectory in systemd unit file - -Similarly as StateDirectory, this is mainly for image mode. -/var/log/cluster shouldn't be included in rpm package, so -use LogsDirectory to make systemd create /var/log/cluster during -corosync startup. - -No code change is needed, because logging to log file is fully -configured by user in config file so there is no default to read from -environment variable. - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield ---- - corosync.spec.in | 2 +- - init/corosync.service.in | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/corosync.spec.in b/corosync.spec.in -index 049c585a..7cb70114 100644 ---- a/corosync.spec.in -+++ b/corosync.spec.in -@@ -209,8 +209,8 @@ fi - %endif - %if %{without systemd} - %dir %{_localstatedir}/lib/corosync --%endif - %dir %{_localstatedir}/log/cluster -+%endif - %{_mandir}/man7/corosync_overview.7* - %{_mandir}/man8/corosync.8* - %{_mandir}/man8/corosync-blackbox.8* -diff --git a/init/corosync.service.in b/init/corosync.service.in -index 3e3efef8..89d67b5e 100644 ---- a/init/corosync.service.in -+++ b/init/corosync.service.in -@@ -10,6 +10,7 @@ EnvironmentFile=-@INITCONFIGDIR@/corosync - ExecStart=@SBINDIR@/corosync -f $COROSYNC_OPTIONS - ExecStop=@SBINDIR@/corosync-cfgtool -H --force - StateDirectory=corosync -+LogsDirectory=cluster - Type=notify - - # In typical systemd deployments, both standard outputs are forwarded to --- -2.47.0 - diff --git a/sources b/sources index d3e0db1..9c626fd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (corosync-3.1.9.tar.gz) = d5332c65535dd40e3bee48912ebf2e71c55380b3dba93c36ff8b74090edf3ec44b69685cd11fda3732e4b0dab0b2954f08be94d772fcff6aaf9a4a846ef2e4cc +SHA512 (corosync-3.1.10.tar.gz) = cf2014d15fdbd3495cfe64629255f7855a79651a595938dac7bc7ec67338d843079ae40cf1c15de23b50d85cb39b2c2e3e3448a9cc33759ad8988b8c85ce59d3 diff --git a/totemsrp-Check-size-of-orf_token-msg.patch b/totemsrp-Check-size-of-orf_token-msg.patch deleted file mode 100644 index 17b4c3e..0000000 --- a/totemsrp-Check-size-of-orf_token-msg.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 7839990f9cdf34e55435ed90109e82709032466a Mon Sep 17 00:00:00 2001 -From: Jan Friesse -Date: Mon, 24 Mar 2025 12:05:08 +0100 -Subject: [PATCH] totemsrp: Check size of orf_token msg - -orf_token message is stored into preallocated array on endian convert -so carefully crafted malicious message can lead to crash of corosync. - -Solution is to check message size beforehand. - -Signed-off-by: Jan Friesse -Reviewed-by: Christine Caulfield ---- - exec/totemsrp.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/exec/totemsrp.c b/exec/totemsrp.c -index 962d0e2a..364528ce 100644 ---- a/exec/totemsrp.c -+++ b/exec/totemsrp.c -@@ -3679,12 +3679,20 @@ static int check_orf_token_sanity( - const struct totemsrp_instance *instance, - const void *msg, - size_t msg_len, -+ size_t max_msg_len, - int endian_conversion_needed) - { - int rtr_entries; - const struct orf_token *token = (const struct orf_token *)msg; - size_t required_len; - -+ if (msg_len > max_msg_len) { -+ log_printf (instance->totemsrp_log_level_security, -+ "Received orf_token message is too long... ignoring."); -+ -+ return (-1); -+ } -+ - if (msg_len < sizeof(struct orf_token)) { - log_printf (instance->totemsrp_log_level_security, - "Received orf_token message is too short... ignoring."); -@@ -3698,6 +3706,13 @@ static int check_orf_token_sanity( - rtr_entries = token->rtr_list_entries; - } - -+ if (rtr_entries > RETRANSMIT_ENTRIES_MAX) { -+ log_printf (instance->totemsrp_log_level_security, -+ "Received orf_token message rtr_entries is corrupted... ignoring."); -+ -+ return (-1); -+ } -+ - required_len = sizeof(struct orf_token) + rtr_entries * sizeof(struct rtr_item); - if (msg_len < required_len) { - log_printf (instance->totemsrp_log_level_security, -@@ -3868,7 +3883,8 @@ static int message_handler_orf_token ( - "Time since last token %0.4f ms", tv_diff / (float)QB_TIME_NS_IN_MSEC); - #endif - -- if (check_orf_token_sanity(instance, msg, msg_len, endian_conversion_needed) == -1) { -+ if (check_orf_token_sanity(instance, msg, msg_len, sizeof(token_storage), -+ endian_conversion_needed) == -1) { - return (0); - } - --- -2.47.0 - From 46f6d72cf7e780b4aaee985a882f75ded1c697cd Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Mon, 24 Nov 2025 15:55:35 +0100 Subject: [PATCH 185/185] Remove unused gittarver from source URL Signed-off-by: Jan Friesse --- corosync.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corosync.spec b/corosync.spec index 3cb7648..6e04bf1 100644 --- a/corosync.spec +++ b/corosync.spec @@ -18,7 +18,7 @@ Version: 3.1.10 Release: 1%{?dist} License: BSD-3-Clause URL: http://corosync.github.io/corosync/ -Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}%{?gittarver}.tar.gz +Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz # Runtime bits # The automatic dependency overridden in favor of explicit version lock