diff --git a/Makefile b/Makefile index 3b1d6ac5..6b7fca0f 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,7 @@ 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 --git a/exec/apidef.c b/exec/apidef.c index 7be37a7f..0ada397d 100644 --- a/exec/apidef.c +++ b/exec/apidef.c @@ -55,13 +55,13 @@ LOGSYS_DECLARE_SUBSYS ("APIDEF", LOG_INFO); /* * 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 ( - corosync_fatal_error_t err, const char *file, unsigned int line) + cs_fatal_error_t err, const char *file, unsigned int line) { _corosync_exit_error (err, file, line); } @@ -73,16 +73,16 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = { .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, diff --git a/exec/flow.c b/exec/flow.c index 5b4d3333..fd84d53c 100644 --- a/exec/flow.c +++ b/exec/flow.c @@ -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 @@ struct flow_control_message { 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 @@ struct flow_control_service { 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 unsigned int flow_control_member_list_entries; 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 @@ static void flow_control_deliver_fn ( * 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 @@ static void flow_control_confchg_fn ( */ 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 @@ static void flow_control_confchg_fn ( * 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 @@ static void flow_control_confchg_fn ( /* * External API */ -unsigned int corosync_flow_control_initialize (void) +unsigned int cs_flow_control_initialize (void) { unsigned int res; @@ -271,7 +271,7 @@ unsigned int corosync_flow_control_initialize (void) 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 @@ error_exit: } -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 @@ unsigned int corosync_flow_control_create ( */ 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 @@ error_exit: 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 @@ unsigned int corosync_flow_control_destroy ( 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 @@ error_exit: * 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 @@ unsigned int corosync_flow_control_disable ( 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 @@ error_exit: * 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 @@ unsigned int corosync_flow_control_enable ( 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 --git a/exec/flow.h b/exec/flow.h index c675c2b4..f843606e 100644 --- a/exec/flow.h +++ b/exec/flow.h @@ -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 --git a/exec/ipc.c b/exec/ipc.c index 42505210..91669a5f 100644 --- a/exec/ipc.c +++ b/exec/ipc.c @@ -62,7 +62,7 @@ #endif #include -#include +#include #include #include #include @@ -153,7 +153,7 @@ struct conn_info { 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 +193,26 @@ static int response_init_send_response ( 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 +223,7 @@ static int dispatch_init_send_response ( 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 +232,9 @@ static int dispatch_init_send_response ( 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 +252,7 @@ static int dispatch_init_send_response ( 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 +261,7 @@ static int dispatch_init_send_response ( 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 +276,16 @@ static int dispatch_init_send_response ( 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 +296,8 @@ static int dispatch_init_send_response ( 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 +448,7 @@ static int libais_disconnect (struct conn_info *conn_info) 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 +633,14 @@ static void ipc_flow_control (struct conn_info *conn_info) /* * 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 +651,7 @@ static void ipc_flow_control (struct conn_info *conn_info) 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; } @@ -897,9 +897,9 @@ retry_recv: &send_ok_joined_iovec, 1); send_ok = - (sync_primary_designated() == 1 || ais_service[service]->allow_inquorate == COROSYNC_LIB_ALLOW_INQUORATE) && ( - (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) && + (sync_primary_designated() == 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))); @@ -914,8 +914,8 @@ retry_recv: 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 +1030,7 @@ static void ipc_confchg_fn ( { } -void corosync_ipc_init ( +void cs_ipc_init ( void (*serialize_lock_fn) (void), void (*serialize_unlock_fn) (void), unsigned int gid_valid) @@ -1102,7 +1102,7 @@ void corosync_ipc_init ( /* * 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 +1116,7 @@ void *corosync_conn_private_data_get (void *conn) /* * 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,20 +1127,20 @@ void *corosync_conn_partner_get (void *conn) } } -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; - ret = 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) @@ -1284,17 +1284,17 @@ retry_sendmsg_two: 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, @@ -1304,7 +1304,7 @@ void corosync_ipc_flow_control_create ( 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, @@ -1312,14 +1312,14 @@ void corosync_ipc_flow_control_destroy ( { 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; @@ -1331,7 +1331,7 @@ void corosync_ipc_flow_control_local_increment ( 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 --git a/exec/ipc.h b/exec/ipc.h index 48da14fe..85edc204 100644 --- a/exec/ipc.h +++ b/exec/ipc.h @@ -46,52 +46,52 @@ extern void message_source_set (mar_message_source_t *source, void *conn); extern int message_source_is_local (mar_message_source_t *source); -extern void *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 --git a/exec/main.c b/exec/main.c index ce62c203..6062c7aa 100644 --- a/exec/main.c +++ b/exec/main.c @@ -56,7 +56,7 @@ #include #include -#include +#include #include #include #include @@ -713,7 +713,7 @@ int main (int argc, char **argv) totem_config.vsf_type); - res = corosync_flow_control_initialize (); + res = cs_flow_control_initialize (); /* * Drop root privleges to user 'ais' @@ -727,7 +727,7 @@ int main (int argc, char **argv) aisexec_mempool_init (); - corosync_ipc_init ( + cs_ipc_init ( serialize_mutex_lock, serialize_mutex_unlock, gid_valid); diff --git a/exec/main.h b/exec/main.h index 73f964a0..8aed9535 100644 --- a/exec/main.h +++ b/exec/main.h @@ -37,7 +37,7 @@ #define TRUE 1 #define FALSE 0 -#include +#include #include #include #include diff --git a/exec/mainconfig.c b/exec/mainconfig.c index e6fddee6..9fd2f2c7 100644 --- a/exec/mainconfig.c +++ b/exec/mainconfig.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include #include diff --git a/exec/sync.c b/exec/sync.c index 6967b591..a5e279b5 100644 --- a/exec/sync.c +++ b/exec/sync.c @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include #include diff --git a/exec/timer.c b/exec/timer.c index e8f6aacf..70837e2a 100644 --- a/exec/timer.c +++ b/exec/timer.c @@ -56,7 +56,7 @@ #include #include -#include +#include #include #include #include diff --git a/exec/totemconfig.h b/exec/totemconfig.h index 20277865..afc99557 100644 --- a/exec/totemconfig.h +++ b/exec/totemconfig.h @@ -36,7 +36,7 @@ #define TOTEMCONFIG_H_DEFINED #include -#include +#include #include #include #include diff --git a/exec/util.c b/exec/util.c index 50233254..4ce71a8d 100644 --- a/exec/util.c +++ b/exec/util.c @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include "util.h" @@ -49,7 +49,7 @@ LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO); /* * 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 @@ int name_match(SaNameT *name1, SaNameT *name2) /* * 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; } @@ -92,14 +92,14 @@ void _corosync_exit_error ( #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); @@ -133,16 +133,16 @@ char *strstr_rs (const char *haystack, const char *needle) 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 --git a/exec/util.h b/exec/util.h index 1d999d6d..385a361d 100644 --- a/exec/util.h +++ b/exec/util.h @@ -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 @@ enum e_ais_done { /* * 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 --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c index bbfd2e28..b7b95238 100644 --- a/exec/vsf_quorum.c +++ b/exec/vsf_quorum.c @@ -152,19 +152,19 @@ static struct corosync_lib_handler quorum_lib_service[] = .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 = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED + .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 = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED + .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 = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED + .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED } }; @@ -172,8 +172,8 @@ 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 = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED, - .allow_inquorate = COROSYNC_LIB_ALLOW_INQUORATE, + .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, @@ -292,7 +292,7 @@ static int send_quorum_notification(void *conn) res_lib_quorum_notification->header.id = MESSAGE_RES_QUORUM_NOTIFICATION; res_lib_quorum_notification->header.size = size; - res_lib_quorum_notification->header.error = SA_AIS_OK; + res_lib_quorum_notification->header.error = CS_OK; /* Send it to all interested parties */ if (conn) { @@ -322,7 +322,7 @@ static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg) 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 = SA_AIS_OK; + res_lib_quorum_getquorate.header.error = CS_OK; corosync_api->ipc_conn_send_response(conn, &res_lib_quorum_getquorate, sizeof(res_lib_quorum_getquorate)); } @@ -339,8 +339,8 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg) * If an immediate listing of the current cluster membership * is requested, generate membership list */ - if (req_lib_quorum_trackstart->track_flags & SA_TRACK_CURRENT || - req_lib_quorum_trackstart->track_flags & SA_TRACK_CHANGES) { + 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_quorum_notification(corosync_api->ipc_conn_partner_get (conn)); } @@ -348,8 +348,8 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg) /* * Record requests for tracking */ - if (req_lib_quorum_trackstart->track_flags & SA_TRACK_CHANGES || - req_lib_quorum_trackstart->track_flags & SA_TRACK_CHANGES_ONLY) { + 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; @@ -360,7 +360,7 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg) /* send status */ res.size = sizeof(res); res.id = MESSAGE_RES_QUORUM_TRACKSTART; - res.error = SA_AIS_OK; + res.error = CS_OK; corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t)); } @@ -372,18 +372,18 @@ static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg) log_printf(LOG_LEVEL_DEBUG, "got trackstop request on %p\n", conn); if (quorum_pd->tracking_enabled) { - res.error = SA_AIS_OK; + res.error = CS_OK; quorum_pd->tracking_enabled = 0; list_del (&quorum_pd->list); list_init (&quorum_pd->list); } else { - res.error = SA_AIS_ERR_NOT_EXIST; + res.error = CS_ERR_NOT_EXIST; } /* send status */ res.size = sizeof(res); res.id = MESSAGE_RES_QUORUM_TRACKSTOP; - res.error = SA_AIS_OK; + res.error = CS_OK; corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t)); } diff --git a/include/corosync/ais_util.h b/include/corosync/ais_util.h index 63ac1d10..18c87058 100644 --- a/include/corosync/ais_util.h +++ b/include/corosync/ais_util.h @@ -67,71 +67,71 @@ struct saHandleDatabase { 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 --git a/include/corosync/cfg.h b/include/corosync/cfg.h index 21df69f3..90a37b45 100644 --- a/include/corosync/cfg.h +++ b/include/corosync/cfg.h @@ -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, @@ -99,19 +99,19 @@ typedef enum { } 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, @@ -131,84 +131,84 @@ typedef struct { 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); -SaAisErrorT +cs_error_t corosync_cfg_try_shutdown ( corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownFlagsT flags); -SaAisErrorT +cs_error_t corosync_cfg_replyto_shutdown ( corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownReplyFlagsT flags); -SaAisErrorT +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 --git a/include/corosync/confdb.h b/include/corosync/confdb.h index a37f10f9..0432e390 100644 --- a/include/corosync/confdb.h +++ b/include/corosync/confdb.h @@ -34,6 +34,7 @@ #ifndef COROSYNC_CONFDB_H_DEFINED #define COROSYNC_CONFDB_H_DEFINED +#include /** * @addtogroup confdb_corosync * @@ -43,33 +44,11 @@ typedef uint64_t confdb_handle_t; #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, @@ -112,28 +91,28 @@ typedef struct { /* * 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 @@ confdb_error_t confdb_reload ( * 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 @@ confdb_error_t confdb_object_parent_get ( /* * 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 @@ confdb_error_t confdb_key_create ( 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 @@ confdb_error_t confdb_key_delete ( /* * 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 @@ confdb_error_t confdb_key_get ( 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 @@ confdb_error_t confdb_key_replace ( 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 @@ confdb_error_t confdb_key_decrement ( * 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 --git a/include/corosync/cpg.h b/include/corosync/cpg.h index 4c6afe25..348ddb1d 100644 --- a/include/corosync/cpg.h +++ b/include/corosync/cpg.h @@ -35,6 +35,7 @@ #define COROSYNC_CPG_H_DEFINED #include +#include /** * @addtogroup cpg_corosync @@ -43,12 +44,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 */ @@ -61,21 +56,6 @@ typedef enum { 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 @@ typedef struct { /* * 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 @@ cpg_error_t cpg_context_set ( /* * 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 @@ cpg_error_t cpg_dispatch ( * 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 @@ cpg_error_t cpg_leave ( * 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 @@ cpg_error_t cpg_mcast_joined ( /* * 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 --git a/include/corosync/engine/coroapi.h b/include/corosync/engine/coroapi.h index f0da9b8e..9bb382dd 100644 --- a/include/corosync/engine/coroapi.h +++ b/include/corosync/engine/coroapi.h @@ -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; @@ -95,22 +95,29 @@ enum totem_callback_token_type { }; #endif -enum corosync_lib_flow_control { - COROSYNC_LIB_FLOW_CONTROL_REQUIRED = 1, - COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED = 2 +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 corosync_lib_allow_inquorate { - COROSYNC_LIB_DISALLOW_INQUORATE = 0, /* default */ - COROSYNC_LIB_ALLOW_INQUORATE = 1 +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, @@ -121,7 +128,8 @@ typedef enum { 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 @@ -137,6 +145,7 @@ struct object_key_valid { int key_len; int (*validate_callback) (void *key, int key_len, void *value, int value_len); }; +/* deprecated */ typedef enum { OBJECT_TRACK_DEPTH_ONE, @@ -380,7 +389,7 @@ struct corosync_api_v1 { 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) ( @@ -429,7 +438,7 @@ struct corosync_api_v1 { * wanting their own groups */ int (*tpg_init) ( - corosync_tpg_handle *handle, + cs_tpg_handle *handle, void (*deliver_fn) ( unsigned int nodeid, @@ -445,31 +454,31 @@ struct corosync_api_v1 { 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, @@ -477,7 +486,7 @@ struct corosync_api_v1 { 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, @@ -516,7 +525,7 @@ struct corosync_api_v1 { */ 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) ) @@ -527,7 +536,7 @@ struct corosync_lib_handler { 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 { @@ -543,8 +552,8 @@ struct corosync_service_engine { char *name; unsigned short id; unsigned int private_data_size; - enum corosync_lib_flow_control flow_control; - enum corosync_lib_allow_inquorate allow_inquorate; + 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 --git a/include/corosync/evs.h b/include/corosync/evs.h index b4ac292e..e0dc2677 100644 --- a/include/corosync/evs.h +++ b/include/corosync/evs.h @@ -36,6 +36,7 @@ #include #include +#include /** * @defgroup corosync Other API services provided by corosync @@ -48,12 +49,6 @@ 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 */ @@ -61,22 +56,6 @@ typedef enum { 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 @@ typedef struct { /* * 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 @@ evs_error_t evs_dispatch ( * 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 @@ evs_error_t evs_join ( /* * 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 @@ evs_error_t evs_leave ( * 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 @@ evs_error_t evs_mcast_joined ( * 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 @@ evs_error_t evs_mcast_groups ( /* * 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 --git a/include/corosync/ipc_cfg.h b/include/corosync/ipc_cfg.h index 0585343e..588fb2c0 100644 --- a/include/corosync/ipc_cfg.h +++ b/include/corosync/ipc_cfg.h @@ -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 { @@ -69,7 +69,7 @@ enum res_lib_cfg_types { struct req_lib_cfg_statetrack { mar_req_header_t header; - SaUint8T trackFlags; + uint8_t trackFlags; CorosyncCfgStateNotificationT *notificationBufferAddress; }; @@ -87,7 +87,7 @@ struct res_lib_cfg_statetrackstop { struct req_lib_cfg_administrativestateset { mar_req_header_t header; - SaNameT compName; + cs_name_t compName; CorosyncCfgAdministrativeTargetT administrativeTarget; CorosyncCfgAdministrativeStateT administrativeState; }; @@ -98,7 +98,7 @@ struct res_lib_cfg_administrativestateset { struct req_lib_cfg_administrativestateget { mar_req_header_t header; - SaNameT compName; + cs_name_t compName; CorosyncCfgAdministrativeTargetT administrativeTarget; CorosyncCfgAdministrativeStateT administrativeState; }; @@ -149,7 +149,7 @@ struct res_lib_cfg_serviceunload { struct req_lib_cfg_killnode { mar_req_header_t header __attribute__((aligned(8))); unsigned int nodeid __attribute__((aligned(8))); - SaNameT reason __attribute__((aligned(8))); + cs_name_t reason __attribute__((aligned(8))); }; struct res_lib_cfg_killnode { diff --git a/include/corosync/ipc_confdb.h b/include/corosync/ipc_confdb.h index 9fea766a..d466af8e 100644 --- a/include/corosync/ipc_confdb.h +++ b/include/corosync/ipc_confdb.h @@ -35,7 +35,7 @@ #define IPC_CONFDB_H_DEFINED #include -#include "saAis.h" +#include #include "ipc_gen.h" enum req_confdb_types { diff --git a/include/corosync/ipc_cpg.h b/include/corosync/ipc_cpg.h index c1e68bef..9e0e4f01 100644 --- a/include/corosync/ipc_cpg.h +++ b/include/corosync/ipc_cpg.h @@ -35,7 +35,7 @@ #define IPC_CPG_H_DEFINED #include -#include "saAis.h" +#include #include "ipc_gen.h" #include "mar_cpg.h" diff --git a/include/corosync/ipc_evs.h b/include/corosync/ipc_evs.h index 1d88a431..a6a496f7 100644 --- a/include/corosync/ipc_evs.h +++ b/include/corosync/ipc_evs.h @@ -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 --git a/include/corosync/ipc_gen.h b/include/corosync/ipc_gen.h index 392286d9..83094f20 100644 --- a/include/corosync/ipc_gen.h +++ b/include/corosync/ipc_gen.h @@ -74,7 +74,7 @@ static inline void swab_mar_req_header_t (mar_req_header_t *to_swab) 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 --git a/include/corosync/ipc_pload.h b/include/corosync/ipc_pload.h index fe079b6e..fdc3c44b 100644 --- a/include/corosync/ipc_pload.h +++ b/include/corosync/ipc_pload.h @@ -34,7 +34,7 @@ #ifndef IPC_PLOAD_H_DEFINED #define IPC_PLOAD_H_DEFINED -#include "saAis.h" +#include #include "pload.h" #include "ipc_gen.h" diff --git a/include/corosync/ipc_quorum.h b/include/corosync/ipc_quorum.h index 89915047..d45dc373 100644 --- a/include/corosync/ipc_quorum.h +++ b/include/corosync/ipc_quorum.h @@ -35,7 +35,7 @@ #define IPC_QUORUM_H_DEFINED #include -#include "saAis.h" +#include #include "corosync/ipc_gen.h" enum req_quorum_types { diff --git a/include/corosync/mar_gen.h b/include/corosync/mar_gen.h index 0ea3c064..d1713fb1 100644 --- a/include/corosync/mar_gen.h +++ b/include/corosync/mar_gen.h @@ -43,7 +43,7 @@ #endif #include -#include +#include #include typedef int8_t mar_int8_t; @@ -98,7 +98,7 @@ static inline void swab_mar_uint64_t (mar_uint64_t *to_swab) 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 swab_mar_name_t (mar_name_t *to_swab) } 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 @@ static inline void swab_mar_time_t (mar_time_t *to_swab) 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 @@ static inline void swab_mar_time_t (mar_time_t *to_swab) #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 --git a/include/corosync/quorum.h b/include/corosync/quorum.h index 816f5e6e..5380dc5b 100644 --- a/include/corosync/quorum.h +++ b/include/corosync/quorum.h @@ -34,36 +34,15 @@ #ifndef COROSYNC_QUORUM_H_DEFINED #define COROSYNC_QUORUM_H_DEFINED +#include + typedef uint64_t quorum_handle_t; - -typedef enum { - QUORUM_OK = 1, - QUORUM_ERR_LIBRARY = 2, - QUORUM_ERR_TIMEOUT = 5, - QUORUM_ERR_TRY_AGAIN = 6, - QUORUM_ERR_INVALID_PARAM = 7, - QUORUM_ERR_NO_MEMORY = 8, - QUORUM_ERR_BAD_HANDLE = 9, - QUORUM_ERR_ACCESS = 11, - QUORUM_ERR_NOT_EXIST = 12, - QUORUM_ERR_EXIST = 14, - QUORUM_ERR_NOT_SUPPORTED = 20, - QUORUM_ERR_SECURITY = 29 -} quorum_error_t; - -typedef enum { - QUORUM_DISPATCH_ONE, - QUORUM_DISPATCH_ALL, - QUORUM_DISPATCH_BLOCKING -} quorum_dispatch_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, @@ -80,38 +59,38 @@ typedef struct { /* * Create a new quorum connection */ -quorum_error_t quorum_initialize ( +cs_error_t quorum_initialize ( quorum_handle_t *handle, quorum_callbacks_t *callbacks); /* * Close the quorum handle */ -quorum_error_t quorum_finalize ( +cs_error_t quorum_finalize ( quorum_handle_t handle); /* * Dispatch messages and configuration changes */ -quorum_error_t quorum_dispatch ( +cs_error_t quorum_dispatch ( quorum_handle_t handle, - quorum_dispatch_t dispatch_types); + cs_dispatch_flags_t dispatch_types); /* * Get quorum information. */ -quorum_error_t quorum_getquorate ( +cs_error_t quorum_getquorate ( quorum_handle_t handle, int *quorate); /* Track node and quorum changes */ -quorum_error_t quorum_trackstart ( +cs_error_t quorum_trackstart ( quorum_handle_t handle, unsigned int flags ); -quorum_error_t quorum_trackstop ( +cs_error_t quorum_trackstop ( quorum_handle_t handle); diff --git a/lib/cfg.c b/lib/cfg.c index 4bfdead0..a5d456d7 100644 --- a/lib/cfg.c +++ b/lib/cfg.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include #include @@ -64,7 +64,7 @@ struct cfg_instance { int response_fd; int dispatch_fd; CorosyncCfgCallbacksT callbacks; - SaNameT compName; + cs_name_t compName; int compRegistered; int finalize; pthread_mutex_t response_mutex; @@ -94,21 +94,21 @@ void cfg_handleInstanceDestructor (void *instance) 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; } @@ -118,7 +118,7 @@ corosync_cfg_initialize ( 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; } @@ -132,7 +132,7 @@ corosync_cfg_initialize ( saHandleInstancePut (&cfg_hdb, *cfg_handle); - return (SA_AIS_OK); + return (CS_OK); error_put_destroy: saHandleInstancePut (&cfg_hdb, *cfg_handle); @@ -142,33 +142,33 @@ 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); + 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; @@ -185,14 +185,14 @@ corosync_cfg_dispatch ( 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; } @@ -205,14 +205,14 @@ corosync_cfg_dispatch ( 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; } @@ -220,13 +220,13 @@ corosync_cfg_dispatch ( * 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 @@ -241,13 +241,13 @@ corosync_cfg_dispatch ( */ 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; } } @@ -275,7 +275,7 @@ corosync_cfg_dispatch ( } break; default: - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_nounlock; break; } @@ -284,12 +284,12 @@ corosync_cfg_dispatch ( * 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); @@ -300,15 +300,15 @@ 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); } @@ -323,7 +323,7 @@ corosync_cfg_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); + return (CS_ERR_BAD_HANDLE); } cfg_instance->finalize = 1; @@ -352,7 +352,7 @@ corosync_cfg_finalize ( return (error); } -SaAisErrorT +cs_error_t corosync_cfg_ring_status_get ( corosync_cfg_handle_t cfg_handle, char ***interface_names, @@ -363,10 +363,10 @@ corosync_cfg_ring_status_get ( 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); } @@ -386,13 +386,13 @@ corosync_cfg_ring_status_get ( *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); @@ -400,12 +400,12 @@ corosync_cfg_ring_status_get ( 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; } } @@ -432,17 +432,17 @@ no_error: 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); } @@ -463,7 +463,7 @@ corosync_cfg_ring_reenable ( return (error); } -SaAisErrorT +cs_error_t corosync_cfg_service_load ( corosync_cfg_handle_t cfg_handle, char *service_name, @@ -472,10 +472,10 @@ corosync_cfg_service_load ( 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); } @@ -501,7 +501,7 @@ corosync_cfg_service_load ( return (error); } -SaAisErrorT +cs_error_t corosync_cfg_service_unload ( corosync_cfg_handle_t cfg_handle, char *service_name, @@ -510,10 +510,10 @@ corosync_cfg_service_unload ( 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); } @@ -538,16 +538,16 @@ corosync_cfg_service_unload ( 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; @@ -556,7 +556,7 @@ corosync_cfg_state_track ( error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -572,21 +572,21 @@ corosync_cfg_state_track ( 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); } @@ -605,10 +605,10 @@ corosync_cfg_state_track_stop ( 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, @@ -617,11 +617,11 @@ corosync_cfg_admin_state_get ( 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); } @@ -641,10 +641,10 @@ corosync_cfg_admin_state_get ( 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, @@ -653,11 +653,11 @@ corosync_cfg_admin_state_set ( 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); } @@ -678,10 +678,10 @@ corosync_cfg_admin_state_set ( 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); } -SaAisErrorT +cs_error_t corosync_cfg_kill_node ( corosync_cfg_handle_t cfg_handle, unsigned int nodeid, @@ -690,14 +690,14 @@ corosync_cfg_kill_node ( struct cfg_instance *cfg_instance; struct req_lib_cfg_killnode req_lib_cfg_killnode; struct res_lib_cfg_killnode res_lib_cfg_killnode; - SaAisErrorT error; + cs_error_t error; - if (strlen(reason) >= SA_MAX_NAME_LENGTH) - return SA_AIS_ERR_NAME_TOO_LONG; + if (strlen(reason) >= CS_MAX_NAME_LENGTH) + return CS_ERR_NAME_TOO_LONG; error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -719,10 +719,10 @@ corosync_cfg_kill_node ( saHandleInstancePut (&cfg_hdb, cfg_handle); - return (error == SA_AIS_OK ? res_lib_cfg_killnode.header.error : error); + return (error == CS_OK ? res_lib_cfg_killnode.header.error : error); } -SaAisErrorT +cs_error_t corosync_cfg_try_shutdown ( corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownFlagsT flags) @@ -730,11 +730,11 @@ corosync_cfg_try_shutdown ( struct cfg_instance *cfg_instance; struct req_lib_cfg_tryshutdown req_lib_cfg_tryshutdown; struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown; - 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); } @@ -752,10 +752,10 @@ corosync_cfg_try_shutdown ( saHandleInstancePut (&cfg_hdb, cfg_handle); - return (error == SA_AIS_OK ? res_lib_cfg_tryshutdown.header.error : error); + return (error == CS_OK ? res_lib_cfg_tryshutdown.header.error : error); } -SaAisErrorT +cs_error_t corosync_cfg_replyto_shutdown ( corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownReplyFlagsT response) @@ -763,11 +763,11 @@ corosync_cfg_replyto_shutdown ( struct cfg_instance *cfg_instance; struct req_lib_cfg_replytoshutdown req_lib_cfg_replytoshutdown; struct iovec iov; - 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); } diff --git a/lib/confdb.c b/lib/confdb.c index 905f0012..20c09706 100644 --- a/lib/confdb.c +++ b/lib/confdb.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include #include @@ -86,7 +86,7 @@ static struct saHandleDatabase confdb_handle_t_db = { }; -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 */ @@ -137,20 +137,20 @@ static struct iter_context *find_iter_context(struct list_head *list, unsigned i * @{ */ -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_error_t confdb_initialize ( &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)); @@ -177,7 +177,7 @@ confdb_error_t confdb_initialize ( saHandleInstancePut (&confdb_handle_t_db, *handle); - return (SA_AIS_OK); + return (CS_OK); error_put_destroy: saHandleInstancePut (&confdb_handle_t_db, *handle); @@ -187,14 +187,14 @@ 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); } @@ -206,7 +206,7 @@ confdb_error_t confdb_finalize ( if (confdb_inst->finalize) { pthread_mutex_unlock (&confdb_inst->response_mutex); saHandleInstancePut (&confdb_handle_t_db, handle); - return (CONFDB_ERR_BAD_HANDLE); + return (CS_ERR_BAD_HANDLE); } confdb_inst->finalize = 1; @@ -235,18 +235,18 @@ confdb_error_t confdb_finalize ( } 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); } @@ -254,18 +254,18 @@ confdb_error_t confdb_fd_get ( 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); } @@ -273,18 +273,18 @@ confdb_error_t confdb_context_get ( 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); } @@ -292,7 +292,7 @@ confdb_error_t confdb_context_set ( saHandleInstancePut (&confdb_handle_t_db, handle); - return (SA_AIS_OK); + return (CS_OK); } struct res_overlay { @@ -300,13 +300,13 @@ struct res_overlay { 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; @@ -318,12 +318,12 @@ confdb_error_t confdb_dispatch ( 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 @@ confdb_error_t confdb_dispatch ( ufds.revents = 0; error = saPollRetry (&ufds, 1, timeout); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_nounlock; } @@ -351,7 +351,7 @@ confdb_error_t confdb_dispatch ( * 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 @@ confdb_error_t confdb_dispatch ( * 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 @@ confdb_error_t confdb_dispatch ( */ 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 @@ confdb_error_t confdb_dispatch ( break; default: - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_nounlock; break; } @@ -475,31 +475,31 @@ 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 @@ confdb_error_t confdb_object_create ( &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; } @@ -531,26 +531,26 @@ error_exit: 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,7 +567,7 @@ confdb_error_t confdb_object_destroy ( &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; } @@ -579,27 +579,27 @@ error_exit: 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 @@ confdb_error_t confdb_object_parent_get ( &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; } @@ -629,23 +629,23 @@ error_exit: 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 @@ static confdb_error_t do_find_destroy( &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,22 +673,22 @@ error_exit: 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); } @@ -697,22 +697,22 @@ confdb_error_t confdb_object_find_destroy( 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); } @@ -722,7 +722,7 @@ confdb_error_t confdb_object_iter_destroy( } -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 @@ confdb_error_t confdb_key_create ( 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,7 +768,7 @@ confdb_error_t confdb_key_create ( &res, sizeof (res)); pthread_mutex_unlock (&confdb_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -780,7 +780,7 @@ error_exit: 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 @@ confdb_error_t confdb_key_delete ( 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,7 +826,7 @@ confdb_error_t confdb_key_delete ( &res, sizeof (res)); pthread_mutex_unlock (&confdb_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -838,7 +838,7 @@ error_exit: 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 @@ confdb_error_t confdb_key_get ( 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,12 +882,12 @@ confdb_error_t confdb_key_get ( &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); } @@ -898,31 +898,31 @@ error_exit: 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,12 +941,12 @@ confdb_error_t confdb_key_increment ( &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; } @@ -956,31 +956,31 @@ error_exit: 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,12 +999,12 @@ confdb_error_t confdb_key_decrement ( &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; } @@ -1014,7 +1014,7 @@ error_exit: 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 @@ confdb_error_t confdb_key_replace ( 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,7 +1064,7 @@ confdb_error_t confdb_key_replace ( &res, sizeof (res)); pthread_mutex_unlock (&confdb_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -1076,16 +1076,16 @@ error_exit: 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 @@ confdb_error_t confdb_object_iter_start ( 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; @@ -1113,16 +1113,16 @@ 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 @@ confdb_error_t confdb_key_iter_start ( 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; @@ -1146,16 +1146,16 @@ 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 @@ confdb_error_t confdb_object_find_start ( 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; @@ -1182,14 +1182,14 @@ 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 @@ confdb_error_t confdb_object_find ( 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 @@ confdb_error_t confdb_object_find ( &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; } @@ -1251,14 +1251,14 @@ error_exit: } -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 @@ confdb_error_t confdb_object_iter ( 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 @@ confdb_error_t confdb_object_iter ( object_handle, object_name, object_name_len, 1)) - error = SA_AIS_ERR_ACCESS; + error = CS_ERR_ACCESS; goto sa_exit; } @@ -1304,12 +1304,12 @@ confdb_error_t confdb_object_iter ( &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; @@ -1323,7 +1323,7 @@ error_exit: 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 @@ confdb_error_t confdb_key_iter ( 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 @@ confdb_error_t confdb_key_iter ( 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 @@ confdb_error_t confdb_key_iter ( &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; @@ -1396,26 +1396,26 @@ error_exit: 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 @@ confdb_error_t confdb_write ( &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; } @@ -1445,27 +1445,27 @@ error_exit: 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 @@ confdb_error_t confdb_reload ( pthread_mutex_unlock (&confdb_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -1497,24 +1497,24 @@ error_exit: 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,7 +1532,7 @@ confdb_error_t confdb_track_changes ( &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; } @@ -1544,21 +1544,21 @@ error_exit: 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,7 +1574,7 @@ confdb_error_t confdb_stop_track_changes (confdb_handle_t handle) &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; } diff --git a/lib/cpg.c b/lib/cpg.c index 89390f7a..05aaa1a2 100644 --- a/lib/cpg.c +++ b/lib/cpg.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include #include @@ -90,27 +90,27 @@ static void cpg_instance_destructor (void *instance) * @{ */ -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; } @@ -122,7 +122,7 @@ cpg_error_t cpg_initialize ( saHandleInstancePut (&cpg_handle_t_db, *handle); - return (SA_AIS_OK); + return (CS_OK); error_put_destroy: saHandleInstancePut (&cpg_handle_t_db, *handle); @@ -132,14 +132,14 @@ 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); } @@ -151,7 +151,7 @@ cpg_error_t cpg_finalize ( if (cpg_inst->finalize) { pthread_mutex_unlock (&cpg_inst->response_mutex); saHandleInstancePut (&cpg_handle_t_db, handle); - return (CPG_ERR_BAD_HANDLE); + return (CS_ERR_BAD_HANDLE); } cpg_inst->finalize = 1; @@ -173,18 +173,18 @@ cpg_error_t cpg_finalize ( } 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); } @@ -192,18 +192,18 @@ cpg_error_t cpg_fd_get ( 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); } @@ -211,18 +211,18 @@ cpg_error_t cpg_context_get ( 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); } @@ -230,7 +230,7 @@ cpg_error_t cpg_context_set ( saHandleInstancePut (&cpg_handle_t_db, handle); - return (SA_AIS_OK); + return (CS_OK); } struct res_overlay { @@ -238,13 +238,13 @@ struct res_overlay { 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; @@ -264,7 +264,7 @@ cpg_error_t cpg_dispatch ( 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 @@ cpg_error_t cpg_dispatch ( * 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 @@ cpg_error_t cpg_dispatch ( ufds.revents = 0; error = saPollRetry (&ufds, 1, timeout); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_nounlock; } @@ -292,7 +292,7 @@ cpg_error_t cpg_dispatch ( * 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 @@ cpg_error_t cpg_dispatch ( * 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 @@ cpg_error_t cpg_dispatch ( */ 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 @@ cpg_error_t cpg_dispatch ( break; default: - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_nounlock; break; } @@ -433,19 +433,19 @@ cpg_error_t cpg_dispatch ( * 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); @@ -456,11 +456,11 @@ 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 @@ cpg_error_t cpg_join ( 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 @@ cpg_error_t cpg_join ( 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,7 +507,7 @@ cpg_error_t cpg_join ( pthread_mutex_unlock (&cpg_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -519,18 +519,18 @@ error_exit: 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,7 +549,7 @@ cpg_error_t cpg_leave ( &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; } @@ -561,14 +561,14 @@ error_exit: 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 @@ cpg_error_t cpg_mcast_joined ( 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 @@ cpg_error_t cpg_mcast_joined ( pthread_mutex_unlock (&cpg_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -612,7 +612,7 @@ cpg_error_t cpg_mcast_joined ( * 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; @@ -623,13 +623,13 @@ error_exit: 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 @@ cpg_error_t cpg_membership_get ( 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 @@ cpg_error_t cpg_membership_get ( pthread_mutex_unlock (&cpg_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -679,18 +679,18 @@ error_exit: 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 @@ cpg_error_t cpg_local_get ( pthread_mutex_unlock (&cpg_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -721,18 +721,18 @@ error_exit: 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 @@ cpg_error_t cpg_groups_get ( pthread_mutex_unlock (&cpg_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -763,15 +763,15 @@ error_exit: 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); } diff --git a/lib/evs.c b/lib/evs.c index 2146389e..c0dcdb7b 100644 --- a/lib/evs.c +++ b/lib/evs.c @@ -48,7 +48,7 @@ #include #include -#include +#include #include #include #include @@ -98,29 +98,29 @@ static void evs_instance_destructor (void *instance) * 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; } @@ -132,7 +132,7 @@ evs_error_t evs_initialize ( saHandleInstancePut (&evs_handle_t_db, *handle); - return (SA_AIS_OK); + return (CS_OK); error_put_destroy: saHandleInstancePut (&evs_handle_t_db, *handle); @@ -142,14 +142,14 @@ 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 @@ -161,7 +161,7 @@ evs_error_t evs_finalize ( if (evs_inst->finalize) { pthread_mutex_unlock (&evs_inst->response_mutex); saHandleInstancePut (&evs_handle_t_db, handle); - return (EVS_ERR_BAD_HANDLE); + return (CS_ERR_BAD_HANDLE); } evs_inst->finalize = 1; @@ -183,18 +183,18 @@ evs_error_t evs_finalize ( 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); } @@ -202,16 +202,16 @@ evs_error_t evs_fd_get ( 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; @@ -222,7 +222,7 @@ evs_error_t evs_dispatch ( 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 @@ evs_error_t evs_dispatch ( * 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 @@ evs_error_t evs_dispatch ( ufds.revents = 0; error = saPollRetry (&ufds, 1, timeout); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_nounlock; } @@ -250,7 +250,7 @@ evs_error_t evs_dispatch ( * 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 @@ evs_error_t evs_dispatch ( * 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 @@ evs_error_t evs_dispatch ( */ 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 @@ evs_error_t evs_dispatch ( break; default: - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_nounlock; break; } @@ -336,19 +336,19 @@ evs_error_t evs_dispatch ( * 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); @@ -359,19 +359,19 @@ 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,7 +392,7 @@ evs_error_t evs_join ( pthread_mutex_unlock (&evs_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -404,19 +404,19 @@ error_exit: 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,7 +437,7 @@ evs_error_t evs_leave ( pthread_mutex_unlock (&evs_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -449,14 +449,14 @@ error_exit: 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 @@ evs_error_t evs_mcast_joined ( 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,7 +490,7 @@ evs_error_t evs_mcast_joined ( pthread_mutex_unlock (&evs_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -502,7 +502,7 @@ error_exit: 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 @@ evs_error_t evs_mcast_groups ( 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 @@ evs_error_t evs_mcast_groups ( 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,7 +544,7 @@ evs_error_t evs_mcast_groups ( &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; } @@ -556,20 +556,20 @@ error_exit: 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 @@ evs_error_t evs_membership_get ( pthread_mutex_unlock (&evs_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } diff --git a/lib/pload.c b/lib/pload.c index f74a2ff2..0d1a90b2 100644 --- a/lib/pload.c +++ b/lib/pload.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include #include @@ -91,23 +91,23 @@ unsigned int pload_initialize ( pload_handle_t *handle, pload_callbacks_t *callbacks) { - SaAisErrorT error; + cs_error_t error; struct pload_inst *pload_inst; error = saHandleCreate (&pload_handle_t_db, sizeof (struct pload_inst), handle); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_no_destroy; } error = saHandleInstanceGet (&pload_handle_t_db, *handle, (void *)&pload_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_destroy; } error = saServiceConnect (&pload_inst->response_fd, &pload_inst->dispatch_fd, PLOAD_SERVICE); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_put_destroy; } @@ -117,7 +117,7 @@ unsigned int pload_initialize ( saHandleInstancePut (&pload_handle_t_db, *handle); - return (SA_AIS_OK); + return (CS_OK); error_put_destroy: saHandleInstancePut (&pload_handle_t_db, *handle); @@ -131,10 +131,10 @@ unsigned int pload_finalize ( pload_handle_t handle) { struct pload_inst *pload_inst; - SaAisErrorT error; + cs_error_t error; error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } // TODO is the locking right here @@ -175,11 +175,11 @@ unsigned int pload_fd_get ( pload_handle_t handle, int *fd) { - SaAisErrorT error; + cs_error_t error; struct pload_inst *pload_inst; error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -187,7 +187,7 @@ unsigned int pload_fd_get ( saHandleInstancePut (&pload_handle_t_db, handle); - return (SA_AIS_OK); + return (CS_OK); } unsigned int pload_start ( @@ -203,7 +203,7 @@ unsigned int pload_start ( struct res_lib_pload_start res_lib_pload_start; error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -223,7 +223,7 @@ unsigned int pload_start ( pthread_mutex_unlock (&pload_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } diff --git a/lib/quorum.c b/lib/quorum.c index e2b63999..348878d9 100644 --- a/lib/quorum.c +++ b/lib/quorum.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include #include @@ -79,27 +79,27 @@ static void quorum_instance_destructor (void *instance) pthread_mutex_destroy (&quorum_inst->response_mutex); } -quorum_error_t quorum_initialize ( +cs_error_t quorum_initialize ( quorum_handle_t *handle, quorum_callbacks_t *callbacks) { - SaAisErrorT error; + cs_error_t error; struct quorum_inst *quorum_inst; error = saHandleCreate (&quorum_handle_t_db, sizeof (struct quorum_inst), handle); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_no_destroy; } error = saHandleInstanceGet (&quorum_handle_t_db, *handle, (void *)&quorum_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_destroy; } error = saServiceConnect (&quorum_inst->dispatch_fd, &quorum_inst->response_fd, QUORUM_SERVICE); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_put_destroy; } @@ -112,7 +112,7 @@ quorum_error_t quorum_initialize ( saHandleInstancePut (&quorum_handle_t_db, *handle); - return (SA_AIS_OK); + return (CS_OK); error_put_destroy: saHandleInstancePut (&quorum_handle_t_db, *handle); @@ -122,14 +122,14 @@ error_no_destroy: return (error); } -quorum_error_t quorum_finalize ( +cs_error_t quorum_finalize ( quorum_handle_t handle) { struct quorum_inst *quorum_inst; - SaAisErrorT error; + cs_error_t error; error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -141,7 +141,7 @@ quorum_error_t quorum_finalize ( if (quorum_inst->finalize) { pthread_mutex_unlock (&quorum_inst->response_mutex); saHandleInstancePut (&quorum_handle_t_db, handle); - return (QUORUM_ERR_BAD_HANDLE); + return (CS_ERR_BAD_HANDLE); } quorum_inst->finalize = 1; @@ -159,21 +159,21 @@ quorum_error_t quorum_finalize ( } saHandleInstancePut (&quorum_handle_t_db, handle); - return (QUORUM_OK); + return (CS_OK); } -quorum_error_t quorum_getquorate ( +cs_error_t quorum_getquorate ( quorum_handle_t handle, int *quorate) { - quorum_error_t error; + 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 != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -190,7 +190,7 @@ quorum_error_t quorum_getquorate ( pthread_mutex_unlock (&quorum_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -204,15 +204,15 @@ error_exit: return (error); } -quorum_error_t quorum_fd_get ( +cs_error_t quorum_fd_get ( quorum_handle_t handle, int *fd) { - SaAisErrorT error; + cs_error_t error; struct quorum_inst *quorum_inst; error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -220,19 +220,19 @@ quorum_error_t quorum_fd_get ( saHandleInstancePut (&quorum_handle_t_db, handle); - return (SA_AIS_OK); + return (CS_OK); } -quorum_error_t quorum_context_get ( +cs_error_t quorum_context_get ( quorum_handle_t handle, void **context) { - SaAisErrorT error; + cs_error_t error; struct quorum_inst *quorum_inst; error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -240,18 +240,18 @@ quorum_error_t quorum_context_get ( saHandleInstancePut (&quorum_handle_t_db, handle); - return (SA_AIS_OK); + return (CS_OK); } -quorum_error_t quorum_context_set ( +cs_error_t quorum_context_set ( quorum_handle_t handle, void *context) { - SaAisErrorT error; + cs_error_t error; struct quorum_inst *quorum_inst; error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -259,22 +259,22 @@ quorum_error_t quorum_context_set ( saHandleInstancePut (&quorum_handle_t_db, handle); - return (SA_AIS_OK); + return (CS_OK); } -quorum_error_t quorum_trackstart ( +cs_error_t quorum_trackstart ( quorum_handle_t handle, unsigned int flags ) { - quorum_error_t error; + 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 != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -292,7 +292,7 @@ quorum_error_t quorum_trackstart ( pthread_mutex_unlock (&quorum_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -304,17 +304,17 @@ error_exit: return (error); } -quorum_error_t quorum_trackstop ( +cs_error_t quorum_trackstop ( quorum_handle_t handle) { - quorum_error_t error; + 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 != SA_AIS_OK) { + if (error != CS_OK) { return (error); } @@ -331,7 +331,7 @@ quorum_error_t quorum_trackstop ( pthread_mutex_unlock (&quorum_inst->response_mutex); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_exit; } @@ -348,13 +348,13 @@ struct res_overlay { char data[512000]; }; -quorum_error_t quorum_dispatch ( +cs_error_t quorum_dispatch ( quorum_handle_t handle, - quorum_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 quorum_inst *quorum_inst; @@ -362,24 +362,24 @@ quorum_error_t quorum_dispatch ( struct res_overlay dispatch_data; struct res_lib_quorum_notification *res_lib_quorum_notification; - if (dispatch_types != SA_DISPATCH_ONE && - dispatch_types != SA_DISPATCH_ALL && - dispatch_types != SA_DISPATCH_BLOCKING) { + if (dispatch_types != CS_DISPATCH_ONE && + dispatch_types != CS_DISPATCH_ALL && + dispatch_types != CS_DISPATCH_BLOCKING) { - return (SA_AIS_ERR_INVALID_PARAM); + return (CS_ERR_INVALID_PARAM); } error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst); - if (error != SA_AIS_OK) { + if (error != CS_OK) { return (error); } /* - * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and - * wait indefinately for SA_DISPATCH_BLOCKING + * Timeout instantly for CS_DISPATCH_ONE or SA_DISPATCH_ALL and + * wait indefinately for CS_DISPATCH_BLOCKING */ - if (dispatch_types == SA_DISPATCH_ALL) { + if (dispatch_types == CS_DISPATCH_ALL) { timeout = 0; } @@ -391,7 +391,7 @@ quorum_error_t quorum_dispatch ( pthread_mutex_lock (&quorum_inst->dispatch_mutex); error = saPollRetry (&ufds, 1, timeout); - if (error != SA_AIS_OK) { + if (error != CS_OK) { goto error_unlock; } @@ -399,17 +399,17 @@ quorum_error_t quorum_dispatch ( * Handle has been finalized in another thread */ if (quorum_inst->finalize == 1) { - error = SA_AIS_OK; + error = CS_OK; goto error_unlock; } if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) { - error = SA_AIS_ERR_BAD_HANDLE; + error = CS_ERR_BAD_HANDLE; goto error_unlock; } dispatch_avail = ufds.revents & POLLIN; - if (dispatch_avail == 0 && dispatch_types == SA_DISPATCH_ALL) { + 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 @@ -421,13 +421,13 @@ quorum_error_t quorum_dispatch ( if (ufds.revents & POLLIN) { error = saRecvRetry (quorum_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 (quorum_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; } } @@ -463,7 +463,7 @@ quorum_error_t quorum_dispatch ( break; default: - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_put; break; } @@ -472,12 +472,12 @@ quorum_error_t quorum_dispatch ( * Determine if more messages should be processed * */ switch (dispatch_types) { - case QUORUM_DISPATCH_ONE: + case CS_DISPATCH_ONE: cont = 0; break; - case QUORUM_DISPATCH_ALL: + case CS_DISPATCH_ALL: break; - case QUORUM_DISPATCH_BLOCKING: + case CS_DISPATCH_BLOCKING: break; } } while (cont); diff --git a/lib/sa-confdb.c b/lib/sa-confdb.c index 1083c7cb..96cf75a4 100644 --- a/lib/sa-confdb.c +++ b/lib/sa-confdb.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include #include @@ -80,7 +80,7 @@ static int load_objdb() 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 @@ static int load_config() 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 confdb_sa_init (void) int res; res = load_objdb(); - if (res != SA_AIS_OK) + if (res != CS_OK) return res; res = load_config(); diff --git a/lib/util.c b/lib/util.c index b56a6073..ad61f336 100644 --- a/lib/util.c +++ b/lib/util.c @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include @@ -96,7 +96,7 @@ void socket_nosigpipe(int s) } #endif -SaAisErrorT +cs_error_t saServiceConnect ( int *responseOut, int *callbackOut, @@ -110,7 +110,7 @@ saServiceConnect ( 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 @@ saServiceConnect ( #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 @@ saServiceConnect ( 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 @@ saServiceConnect ( 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 @@ saServiceConnect ( 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 @@ saServiceConnect ( 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 @@ saServiceConnect ( 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,13 +218,13 @@ error_exit: return (error); } -SaAisErrorT +cs_error_t saRecvRetry ( int s, void *msg, size_t len) { - SaAisErrorT error = SA_AIS_OK; + cs_error_t error = CS_OK; int result; struct msghdr msg_recv; struct iovec iov_recv; @@ -260,12 +260,12 @@ retry_recv: * 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,13 +277,13 @@ error_exit: return (error); } -SaAisErrorT +cs_error_t saSendRetry ( int s, const void *msg, size_t len) { - SaAisErrorT error = SA_AIS_OK; + cs_error_t error = CS_OK; int result; struct msghdr msg_send; struct iovec iov_send; @@ -315,15 +315,15 @@ retry_send: */ 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 @@ retry_send: goto retry_send; } if (errno == EFAULT) { - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_exit; } } @@ -349,7 +349,7 @@ retry_send: * return ERR_LIBRARY on any other syscall error */ if (result == -1) { - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_exit; } @@ -362,12 +362,12 @@ error_exit: return (error); } -SaAisErrorT saSendMsgRetry ( +cs_error_t saSendMsgRetry ( int s, struct iovec *iov, int iov_len) { - SaAisErrorT error = SA_AIS_OK; + cs_error_t error = CS_OK; int result; int total_size = 0; int i; @@ -404,15 +404,15 @@ retry_sendmsg: */ 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 @@ retry_sendmsg: goto retry_sendmsg; } if (errno == EFAULT) { - error = SA_AIS_ERR_LIBRARY; + error = CS_ERR_LIBRARY; goto error_exit; } } @@ -437,7 +437,7 @@ retry_sendmsg: * 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 @@ error_exit: 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 @@ error_exit: 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 @@ error_exit: 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 @@ retry_poll: 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 @@ saHandleCreate ( 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 @@ saHandleCreate ( 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 @@ saHandleCreate ( 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 @@ saHandleDestroy ( if (check != handleDatabase->handles[handle].check) { pthread_mutex_unlock (&handleDatabase->mutex); - error = SA_AIS_ERR_BAD_HANDLE; + error = CS_ERR_BAD_HANDLE; return (error); } @@ -636,28 +636,28 @@ saHandleDestroy ( } -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 @@ error_exit: } -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 @@ error_exit: } -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 @@ saVersionVerify ( * 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 @@ saVersionVerify ( /* * 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 --git a/lib/util.h b/lib/util.h index 513fba91..a00da834 100644 --- a/lib/util.h +++ b/lib/util.h @@ -72,72 +72,72 @@ struct saVersionDatabase { 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 --git a/services/cfg.c b/services/cfg.c index c20910c4..1239d239 100644 --- a/services/cfg.c +++ b/services/cfg.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include #include @@ -169,67 +169,67 @@ static struct corosync_lib_handler cfg_lib_engine[] = .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 = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED + .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 = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED + .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 = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED + .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED } }; @@ -254,8 +254,8 @@ struct corosync_service_engine cfg_service_engine = { .name = "corosync configuration service", .id = CFG_SERVICE, .private_data_size = sizeof(struct cfg_info), - .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED, - .allow_inquorate = COROSYNC_LIB_ALLOW_INQUORATE, + .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, @@ -421,7 +421,7 @@ static void check_shutdown_status() 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 = SA_AIS_OK; + res_lib_cfg_tryshutdown.header.error = CS_OK; /* * Tell originator that shutdown was confirmed @@ -435,7 +435,7 @@ static void check_shutdown_status() 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 = SA_AIS_ERR_BUSY; + res_lib_cfg_tryshutdown.header.error = CS_ERR_BUSY; /* * Tell originator that shutdown was cancelled @@ -464,7 +464,7 @@ static void shutdown_timer_fn(void *arg) shutdown_no = shutdown_expected; check_shutdown_status(); - send_test_shutdown(NULL, SA_AIS_ERR_TIMEOUT); + send_test_shutdown(NULL, CS_ERR_TIMEOUT); LEAVE(); } @@ -547,7 +547,7 @@ static void message_handler_req_exec_cfg_ringreenable ( 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, @@ -573,7 +573,7 @@ static void message_handler_req_exec_cfg_killnode ( { struct req_exec_cfg_killnode *req_exec_cfg_killnode = (struct req_exec_cfg_killnode *)message; - SaNameT reason; + 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); @@ -621,7 +621,7 @@ static void message_handler_req_lib_cfg_ringstatusget ( 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(), @@ -691,13 +691,13 @@ static void message_handler_req_lib_cfg_statetrack ( */ ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN; shutdown_expected++; - send_test_shutdown(ci->tracker_conn, SA_AIS_OK); + 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 = SA_AIS_OK; + res_lib_cfg_statetrack.header.error = CS_OK; api->ipc_conn_send_response(conn, &res_lib_cfg_statetrack, sizeof(res_lib_cfg_statetrack)); @@ -751,7 +751,7 @@ static void message_handler_req_lib_cfg_serviceload ( 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, @@ -774,7 +774,7 @@ static void message_handler_req_lib_cfg_serviceunload ( 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, @@ -808,7 +808,7 @@ static void message_handler_req_lib_cfg_killnode ( 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 = SA_AIS_OK; + res_lib_cfg_killnode.header.error = CS_OK; api->ipc_conn_send_response(conn, &res_lib_cfg_killnode, sizeof(res_lib_cfg_killnode)); @@ -837,7 +837,7 @@ static void message_handler_req_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 = SA_AIS_OK; + res_lib_cfg_tryshutdown.header.error = CS_OK; api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown, sizeof(res_lib_cfg_tryshutdown)); @@ -853,7 +853,7 @@ static void message_handler_req_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 = SA_AIS_ERR_EXIST; + res_lib_cfg_tryshutdown.header.error = CS_ERR_EXIST; api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown, sizeof(res_lib_cfg_tryshutdown)); @@ -922,7 +922,7 @@ static void message_handler_req_lib_cfg_tryshutdown ( /* * Tell the users we would like to shut down */ - send_test_shutdown(NULL, SA_AIS_OK); + send_test_shutdown(NULL, CS_OK); } /* diff --git a/services/confdb.c b/services/confdb.c index d59c1840..497540ad 100644 --- a/services/confdb.c +++ b/services/confdb.c @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include @@ -106,103 +106,103 @@ static struct corosync_lib_handler confdb_lib_engine[] = .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,7 @@ struct corosync_service_engine confdb_service_engine = { .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, .lib_init_fn = confdb_lib_init_fn, .lib_exit_fn = confdb_lib_exit_fn, .lib_engine = confdb_lib_engine, @@ -289,13 +289,13 @@ static void message_handler_req_lib_confdb_object_create (void *conn, void *mess 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); @@ -308,10 +308,10 @@ static void message_handler_req_lib_confdb_object_destroy (void *conn, void *mes { 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; @@ -323,12 +323,12 @@ static void message_handler_req_lib_confdb_object_find_destroy (void *conn, void { 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; @@ -341,14 +341,14 @@ static void message_handler_req_lib_confdb_key_create (void *conn, void *message { 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; @@ -362,14 +362,14 @@ static void message_handler_req_lib_confdb_key_get (void *conn, void *message) 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; @@ -385,13 +385,13 @@ static void message_handler_req_lib_confdb_key_increment (void *conn, void *mess { 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 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; @@ -403,13 +403,13 @@ static void message_handler_req_lib_confdb_key_decrement (void *conn, void *mess { 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 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; @@ -421,7 +421,7 @@ static void message_handler_req_lib_confdb_key_replace (void *conn, void *messag { 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, @@ -430,7 +430,7 @@ static void message_handler_req_lib_confdb_key_replace (void *conn, void *messag 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; @@ -442,14 +442,14 @@ static void message_handler_req_lib_confdb_key_delete (void *conn, void *message { 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; @@ -462,11 +462,11 @@ static void message_handler_req_lib_confdb_object_parent_get (void *conn, void * 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); @@ -484,7 +484,7 @@ static void message_handler_req_lib_confdb_key_iter (void *conn, void *message) 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, @@ -492,7 +492,7 @@ static void message_handler_req_lib_confdb_key_iter (void *conn, void *message) &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); @@ -511,7 +511,7 @@ static void message_handler_req_lib_confdb_object_iter (void *conn, void *messag 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, @@ -523,7 +523,7 @@ static void message_handler_req_lib_confdb_object_iter (void *conn, void *messag 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, @@ -542,7 +542,7 @@ static void message_handler_req_lib_confdb_object_find (void *conn, void *messag { 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, @@ -555,7 +555,7 @@ static void message_handler_req_lib_confdb_object_find (void *conn, void *messag 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; @@ -568,11 +568,11 @@ static void message_handler_req_lib_confdb_object_find (void *conn, void *messag 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; @@ -590,11 +590,11 @@ static void message_handler_req_lib_confdb_reload (void *conn, void *message) { 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; @@ -621,7 +621,7 @@ static void confdb_notify_lib_of_key_change(object_change_type_t change_type, 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; @@ -648,7 +648,7 @@ static void confdb_notify_lib_of_new_object(unsigned int parent_object_handle, 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); @@ -665,7 +665,7 @@ static void confdb_notify_lib_of_destroyed_object(unsigned int parent_object_han 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; @@ -687,7 +687,7 @@ static void message_handler_req_lib_confdb_track_start (void *conn, void *messag 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)); } @@ -703,7 +703,7 @@ static void message_handler_req_lib_confdb_track_stop (void *conn, void *message 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 --git a/services/cpg.c b/services/cpg.c index 01405e00..f943ef5d 100644 --- a/services/cpg.c +++ b/services/cpg.c @@ -51,7 +51,7 @@ #include #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ struct process_info { 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 @@ static struct corosync_lib_handler cpg_lib_engine[] = .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 @@ struct corosync_service_engine cpg_service_engine = { .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 @@ static int notify_lib_joinlist( 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 @@ static int notify_lib_joinlist( } } - return SA_AIS_OK; + return CS_OK; } static void remove_group(struct group_info *gi) @@ -736,7 +736,7 @@ static void cpg_confchg_fn ( 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 @@ static void message_handler_req_lib_cpg_join (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_leave (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_membership (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_trackstart (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_trackstart (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_trackstop (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_trackstop (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_local_get (void *conn, void *message) 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 @@ static void message_handler_req_lib_cpg_groups_get (void *conn, void *message) 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 --git a/services/evs.c b/services/evs.c index 6e9f5524..6ce9f429 100644 --- a/services/evs.c +++ b/services/evs.c @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include #include @@ -104,31 +104,31 @@ static struct corosync_lib_handler evs_lib_engine[] = .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 @@ struct corosync_service_engine evs_service_engine = { .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 @@ static void evs_confchg_fn ( */ 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 int evs_lib_exit_fn (void *conn) 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 @@ static void message_handler_req_evs_leave (void *conn, void *msg) { 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 @@ static void message_handler_req_evs_leave (void *conn, void *msg) } } 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_leave (void *conn, void *msg) 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 @@ static void message_handler_req_evs_mcast_joined (void *conn, void *msg) 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_joined (void *conn, void *msg) 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 @@ static void message_handler_req_evs_mcast_groups (void *conn, void *msg) 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 @@ static void message_handler_req_evs_membership_get (void *conn, void *msg) 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 @@ static void message_handler_req_exec_mcast ( 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 --git a/services/pload.c b/services/pload.c index 04c7fa90..54954406 100644 --- a/services/pload.c +++ b/services/pload.c @@ -50,7 +50,7 @@ #include #include -#include +#include #include #include #include @@ -126,7 +126,7 @@ static struct corosync_lib_handler pload_lib_engine[] = .lib_handler_fn = message_handler_req_pload_start, .response_size = sizeof (struct res_lib_pload_start), .response_id = MESSAGE_RES_PLOAD_START, - .flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED + .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED } }; @@ -146,7 +146,7 @@ struct corosync_service_engine pload_service_engine = { .name = "corosync profile loading service", .id = PLOAD_SERVICE, .private_data_size = 0, - .flow_control = COROSYNC_LIB_FLOW_CONTROL_REQUIRED, + .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, diff --git a/test/cpgbench.c b/test/cpgbench.c index ed3477f3..a41c6694 100644 --- a/test/cpgbench.c +++ b/test/cpgbench.c @@ -50,7 +50,7 @@ #include #include -#include +#include #include #ifdef COROSYNC_SOLARIS @@ -121,12 +121,12 @@ void cpg_benchmark ( 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 @@ int main (void) { 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 @@ int main (void) { } res = cpg_finalize (handle); - if (res != CPG_OK) { + if (res != CS_OK) { printf ("cpg_join failed with result %d\n", res); exit (1); } diff --git a/test/evsbench.c b/test/evsbench.c index 2ccefb66..028960d8 100644 --- a/test/evsbench.c +++ b/test/evsbench.c @@ -49,7 +49,7 @@ #include #include -#include +#include #include #ifdef COROSYNC_SOLARIS @@ -124,7 +124,7 @@ void evs_benchmark (evs_handle_t handle, 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 @@ void evs_benchmark (evs_handle_t handle, 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 @@ void sigintr_handler (int num) int main (void) { int size; int i; - evs_error_t result; + cs_error_t result; evs_handle_t handle; signal (SIGALRM, sigalrm_handler); diff --git a/test/evsverify.c b/test/evsverify.c index c6777e5c..7044923d 100644 --- a/test/evsverify.c +++ b/test/evsverify.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "../exec/crypto.h" @@ -116,7 +117,7 @@ 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]; @@ -127,7 +128,7 @@ int main (void) 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 @@ int main (void) 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 --git a/test/sa_error.c b/test/sa_error.c index 8c488b49..27b83631 100644 --- a/test/sa_error.c +++ b/test/sa_error.c @@ -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 @@ int get_sa_error(SaAisErrorT error, char *str, int len) 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 --git a/test/sa_error.h b/test/sa_error.h index b73a6d6c..f8114b39 100644 --- a/test/sa_error.h +++ b/test/sa_error.h @@ -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 --git a/test/testconfdb.c b/test/testconfdb.c index be16718f..25e1c746 100644 --- a/test/testconfdb.c +++ b/test/testconfdb.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #define INCDEC_VALUE 45 @@ -68,13 +68,13 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object /* 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 #include static int quit = 0; @@ -206,25 +206,25 @@ int main (int argc, char *argv[]) { } 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 @@ int main (int argc, char *argv[]) { } } 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 --git a/test/testcpg2.c b/test/testcpg2.c index b11119a8..0aec5147 100644 --- a/test/testcpg2.c +++ b/test/testcpg2.c @@ -37,6 +37,7 @@ #include #include +#include #include void deliver( @@ -70,17 +71,17 @@ int main(int argc, char** argv) { 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 --git a/test/testevs.c b/test/testevs.c index 84e2b482..7c73d392 100644 --- a/test/testevs.c +++ b/test/testevs.c @@ -38,6 +38,7 @@ #include #include #include +#include #include char *delivery_string; @@ -99,7 +100,7 @@ struct iovec iov = { 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 @@ int main (void) 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 @@ int main (void) 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_one: 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 --git a/test/testquorum.c b/test/testquorum.c index d2d7a8b9..87f57bca 100644 --- a/test/testquorum.c +++ b/test/testquorum.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include static quorum_handle_t handle; @@ -36,13 +36,13 @@ int main(int argc, char *argv[]) int err; callbacks.quorum_notify_fn = quorum_notification_fn; - if ( (err=quorum_initialize(&handle, &callbacks)) != QUORUM_OK) + if ( (err=quorum_initialize(&handle, &callbacks)) != CS_OK) fprintf(stderr, "quorum_initialize FAILED: %d\n", err); - if ( (err=quorum_trackstart(handle, SA_TRACK_CHANGES)) != QUORUM_OK) + if ( (err=quorum_trackstart(handle, CS_TRACK_CHANGES)) != CS_OK) fprintf(stderr, "quorum_trackstart FAILED: %d\n", err); - if ( (err=quorum_getquorate(handle, &quorate)) != QUORUM_OK) + if ( (err=quorum_getquorate(handle, &quorate)) != CS_OK) fprintf(stderr, "quorum_getquorate FAILED: %d\n", err); else { printf("quorate %d\n", quorate); @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) printf("-------------------\n"); while (1) - quorum_dispatch(handle, QUORUM_DISPATCH_ALL); + quorum_dispatch(handle, CS_DISPATCH_ALL); return 0; } diff --git a/tools/corosync-cfgtool.c b/tools/corosync-cfgtool.c index 0b4b36e8..f3c2fcfd 100644 --- a/tools/corosync-cfgtool.c +++ b/tools/corosync-cfgtool.c @@ -46,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; @@ -60,7 +60,7 @@ static void ringstatusget_do (void) 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); } @@ -81,18 +81,18 @@ static void ringstatusget_do (void) 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); } @@ -101,17 +101,17 @@ static void ringreenable_do (void) 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); @@ -119,17 +119,17 @@ void service_load_do (char *service, unsigned int version) 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); @@ -144,12 +144,12 @@ void shutdown_callback (corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownFla void *shutdown_dispatch_thread(void *arg) { - int res = SA_AIS_OK; + int res = CS_OK; corosync_cfg_handle_t *handle = arg; - while (res == SA_AIS_OK) { - res = corosync_cfg_dispatch(*handle, SA_DISPATCH_ALL); - if (res != SA_AIS_OK) + 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; @@ -157,7 +157,7 @@ void *shutdown_dispatch_thread(void *arg) void shutdown_do() { - SaAisErrorT result; + cs_error_t result; corosync_cfg_handle_t handle; CorosyncCfgCallbacksT callbacks; CorosyncCfgStateNotificationT notificationBuffer; @@ -167,7 +167,7 @@ void shutdown_do() callbacks.corosyncCfgShutdownCallback = shutdown_callback; result = corosync_cfg_initialize (&handle, &callbacks); - if (result != SA_AIS_OK) { + if (result != CS_OK) { printf ("Could not initialize corosync configuration API error %d\n", result); exit (1); } @@ -177,13 +177,13 @@ void shutdown_do() result = corosync_cfg_state_track (handle, 0, ¬ificationBuffer); - if (result != SA_AIS_OK) { + 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 != SA_AIS_OK) { + if (result != CS_OK) { printf ("Could not shutdown (error = %d)\n", result); } @@ -192,17 +192,17 @@ void shutdown_do() void killnode_do(unsigned int nodeid) { - SaAisErrorT result; + cs_error_t result; corosync_cfg_handle_t handle; printf ("Killing node %d\n", nodeid); 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_kill_node (handle, nodeid, "Killed by corosync-cfgtool"); - if (result != SA_AIS_OK) { + if (result != CS_OK) { printf ("Could not kill node (error = %d)\n", result); } corosync_cfg_finalize (handle); diff --git a/tools/corosync-objctl.c b/tools/corosync-objctl.c index 17ef274b..5d46d21a 100644 --- a/tools/corosync-objctl.c +++ b/tools/corosync-objctl.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #define SEPERATOR '.' @@ -104,12 +104,12 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object 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 +120,7 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object 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 +133,7 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object /* 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 +142,7 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object 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 +165,7 @@ static int print_all(void) 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; } @@ -191,13 +191,13 @@ static int print_help(void) 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) @@ -252,7 +252,7 @@ void get_key(char * name_pt, char * key_name, char * key_value) 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) @@ -262,21 +262,21 @@ static confdb_error_t find_object (confdb_handle_t handle, 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; } @@ -292,11 +292,11 @@ static void read_object(confdb_handle_t handle, char * name_pt) { 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); } } @@ -309,19 +309,19 @@ static void write_key(confdb_handle_t handle, char * path_pt) 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); } @@ -334,7 +334,7 @@ static void write_key(confdb_handle_t handle, char * path_pt) 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, @@ -345,7 +345,7 @@ static void write_key(confdb_handle_t handle, char * path_pt) 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 */ @@ -355,7 +355,7 @@ static void write_key(confdb_handle_t handle, char * path_pt) 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); } @@ -368,23 +368,23 @@ static void create_object(confdb_handle_t handle, char * name_pt) 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); @@ -394,7 +394,7 @@ static void create_object(confdb_handle_t handle, char * name_pt) 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); } @@ -450,7 +450,7 @@ static void listen_for_object_changes(confdb_handle_t handle) 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); @@ -467,13 +467,13 @@ static void listen_for_object_changes(confdb_handle_t handle) fgets(inbuf, sizeof(inbuf), stdin); if (strncmp(inbuf, "q", 1) == 0) - quit = SA_TRUE; + 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); @@ -481,19 +481,19 @@ static void listen_for_object_changes(confdb_handle_t 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; @@ -502,10 +502,10 @@ static void track_object(confdb_handle_t handle, char * name_pt) 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; } @@ -513,14 +513,14 @@ static void stop_tracking(confdb_handle_t handle) 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]; @@ -532,7 +532,7 @@ static void delete_object(confdb_handle_t handle, char * name_pt) 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); } @@ -544,7 +544,7 @@ static void delete_object(confdb_handle_t handle, char * name_pt) 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); } @@ -553,7 +553,7 @@ static void delete_object(confdb_handle_t handle, char * name_pt) int main (int argc, char *argv[]) { confdb_handle_t handle; - confdb_error_t result; + cs_error_t result; int c; action = ACTION_READ; @@ -604,7 +604,7 @@ int main (int argc, char *argv[]) { } 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); } @@ -634,7 +634,7 @@ int main (int argc, char *argv[]) { } 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 --git a/tools/corosync-pload.c b/tools/corosync-pload.c index ab9ba125..841f97d7 100644 --- a/tools/corosync-pload.c +++ b/tools/corosync-pload.c @@ -48,7 +48,7 @@ #include #include -#include +#include #include #define timersub(a, b, result) \