diff --git a/exec/apidef.c b/exec/apidef.c index fb49c7ce..0a52275d 100644 --- a/exec/apidef.c +++ b/exec/apidef.c @@ -56,10 +56,10 @@ LOGSYS_DECLARE_SUBSYS ("APIDEF", LOG_INFO); /* * Remove compile warnings about type name changes */ -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); +typedef int (*typedef_tpg_join) (hdb_handle_t, struct corosync_tpg_group *, int); +typedef int (*typedef_tpg_leave) (hdb_handle_t, struct corosync_tpg_group *, int); +typedef int (*typedef_tpg_groups_mcast) (hdb_handle_t, int, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); +typedef int (*typedef_tpg_groups_send_ok) (hdb_handle_t, struct corosync_tpg_group *, int groups_cnt, struct iovec *, int); static inline void _corosync_public_exit_error ( cs_fatal_error_t err, const char *file, unsigned int line) diff --git a/exec/coroparse.c b/exec/coroparse.c index 7abc4006..d4acf700 100644 --- a/exec/coroparse.c +++ b/exec/coroparse.c @@ -83,7 +83,7 @@ static char *remove_whitespace(char *string) static int parse_section(FILE *fp, struct objdb_iface_ver0 *objdb, - unsigned int parent_handle, + hdb_handle_t parent_handle, char **error_string) { char line[512]; @@ -111,7 +111,7 @@ static int parse_section(FILE *fp, /* New section ? */ if ((loc = strstr_rs (line, "{"))) { - unsigned int new_parent; + hdb_handle_t new_parent; char *section = remove_whitespace(line); loc--; diff --git a/exec/coropoll.c b/exec/coropoll.c index ec56a9c3..db039c49 100644 --- a/exec/coropoll.c +++ b/exec/coropoll.c @@ -39,12 +39,12 @@ #include #include +#include #include #include -#include #include "tlist.h" -typedef int (*dispatch_fn_t) (poll_handle poll_handle, int fd, int revents, void *data); +typedef int (*dispatch_fn_t) (hdb_handle_t hdb_handle_t, int fd, int revents, void *data); struct poll_entry { struct pollfd ufd; @@ -71,11 +71,11 @@ static struct hdb_handle_database poll_instance_database = { .iterator = 0 }; -poll_handle poll_create ( +hdb_handle_t poll_create ( void (*serialize_lock_fn) (void), void (*serialize_unlock_fn) (void)) { - poll_handle handle; + hdb_handle_t handle; struct poll_instance *poll_instance; unsigned int res; @@ -107,7 +107,7 @@ error_exit: return (-1); } -int poll_destroy (poll_handle handle) +int poll_destroy (hdb_handle_t handle) { struct poll_instance *poll_instance; int res = 0; @@ -135,12 +135,12 @@ error_exit: } int poll_dispatch_add ( - poll_handle handle, + hdb_handle_t handle, int fd, int events, void *data, int (*dispatch_fn) ( - poll_handle poll_handle, + hdb_handle_t hdb_handle_t, int fd, int revents, void *data)) @@ -209,11 +209,11 @@ error_exit: } int poll_dispatch_modify ( - poll_handle handle, + hdb_handle_t handle, int fd, int events, int (*dispatch_fn) ( - poll_handle poll_handle, + hdb_handle_t hdb_handle_t, int fd, int revents, void *data)) @@ -251,7 +251,7 @@ error_exit: } int poll_dispatch_delete ( - poll_handle handle, + hdb_handle_t handle, int fd) { struct poll_instance *poll_instance; @@ -285,7 +285,7 @@ error_exit: } int poll_timer_add ( - poll_handle handle, + hdb_handle_t handle, int msec_duration, void *data, void (*timer_fn) (void *data), poll_timer_handle *timer_handle_out) @@ -314,7 +314,7 @@ error_exit: } int poll_timer_delete ( - poll_handle handle, + hdb_handle_t handle, poll_timer_handle timer_handle) { struct poll_instance *poll_instance; @@ -339,7 +339,7 @@ error_exit: } int poll_stop ( - poll_handle handle) + hdb_handle_t handle) { struct poll_instance *poll_instance; unsigned int res; @@ -360,7 +360,7 @@ error_exit: int poll_run ( - poll_handle handle) + hdb_handle_t handle) { struct poll_instance *poll_instance; int i; @@ -432,7 +432,7 @@ error_exit: #ifdef COMPILE_OUT void poll_print_state ( - poll_handle handle, + hdb_handle_t handle, int fd) { struct poll_instance *poll_instance; diff --git a/exec/ipc.c b/exec/ipc.c index 9647743f..d0df68d9 100644 --- a/exec/ipc.c +++ b/exec/ipc.c @@ -435,7 +435,7 @@ static int poll_handler_connection_destroy( } static int poll_handler_connection ( - poll_handle handle, + hdb_handle_t handle, int fd, int revent, void *data) @@ -577,7 +577,7 @@ static int poll_handler_connection ( if (conn_info->notify_flow_control_enabled == 0 && conn_info->pending_semops == 0) { - poll_dispatch_modify (aisexec_poll_handle, + poll_dispatch_modify (corosync_poll_handle, conn_info->fd, POLLIN|POLLNVAL, poll_handler_connection); } @@ -592,7 +592,7 @@ static void ipc_disconnect (struct conn_info *conn_info) conn_info->disconnect_requested = 1; pthread_mutex_unlock (&conn_info->mutex); - poll_dispatch_modify (aisexec_poll_handle, + poll_dispatch_modify (corosync_poll_handle, conn_info->fd, POLLOUT|POLLNVAL, poll_handler_connection); } @@ -613,7 +613,7 @@ static int conn_info_create (int fd) list_init (&conn_info->list); list_add (&conn_info->list, &conn_info_list_head); - poll_dispatch_add (aisexec_poll_handle, fd, POLLIN|POLLNVAL, + poll_dispatch_add (corosync_poll_handle, fd, POLLIN|POLLNVAL, conn_info, poll_handler_connection); return (0); } @@ -633,7 +633,7 @@ char *socketname = "/var/run/libais.socket"; #endif static int poll_handler_accept ( - poll_handle handle, + hdb_handle_t handle, int fd, int revent, void *data) @@ -759,7 +759,7 @@ extern void cs_ipc_init ( /* * Setup libais connection dispatch routine */ - poll_dispatch_add (aisexec_poll_handle, libais_server_fd, + poll_dispatch_add (corosync_poll_handle, libais_server_fd, POLLIN|POLLNVAL, 0, poll_handler_accept); g_gid_valid = gid_valid; @@ -904,7 +904,7 @@ void msg_send (void *conn, struct iovec *iov, int iov_len, int locked) if (locked == 0) { pthread_mutex_unlock (&conn_info->mutex); } - poll_dispatch_modify (aisexec_poll_handle, conn_info->fd, + poll_dispatch_modify (corosync_poll_handle, conn_info->fd, POLLIN|POLLOUT|POLLNVAL, poll_handler_connection); } else if (res == -1) { @@ -1046,7 +1046,7 @@ static void msg_send_or_queue (void *conn, struct iovec *iov, int iov_len) pthread_mutex_lock (&conn_info->mutex); if (list_empty (&conn_info->outq_head)) { conn_info->notify_flow_control_enabled = 1; - poll_dispatch_modify (aisexec_poll_handle, + poll_dispatch_modify (corosync_poll_handle, conn_info->fd, POLLOUT|POLLIN|POLLNVAL, poll_handler_connection); } diff --git a/exec/main.c b/exec/main.c index 98a1fe09..de8bf737 100644 --- a/exec/main.c +++ b/exec/main.c @@ -108,6 +108,8 @@ static struct corosync_api_v1 *api = NULL; unsigned long long *(*main_clm_get_by_nodeid) (unsigned int node_id); +hdb_handle_t corosync_poll_handle; + static void sigusr2_handler (int num) { int i; @@ -119,7 +121,7 @@ static void sigusr2_handler (int num) } } -static void *aisexec_exit (void *arg) +static void *corosync_exit (void *arg) { if (api) { corosync_service_unlink_all (api); @@ -148,10 +150,10 @@ static void *aisexec_exit (void *arg) return NULL; } -pthread_t aisexec_exit_thread; +pthread_t corosync_exit_thread; static void init_shutdown(void *data) { - pthread_create (&aisexec_exit_thread, NULL, aisexec_exit, NULL); + pthread_create (&corosync_exit_thread, NULL, corosync_exit, NULL); } @@ -159,7 +161,7 @@ static poll_timer_handle shutdown_handle; static void sigquit_handler (int num) { /* avoid creating threads from within the interrupt context */ - poll_timer_add (aisexec_poll_handle, 500, NULL, init_shutdown, &shutdown_handle); + poll_timer_add (corosync_poll_handle, 500, NULL, init_shutdown, &shutdown_handle); } @@ -181,7 +183,7 @@ static void sigabrt_handler (int num) #define LOCALHOST_IP inet_addr("127.0.0.1") -totempg_groups_handle corosync_group_handle; +hdb_handle_t corosync_group_handle; struct totempg_group corosync_group = { .group = "a", @@ -190,7 +192,7 @@ struct totempg_group corosync_group = { void sigintr_handler (int signum) { - poll_timer_add (aisexec_poll_handle, 500, NULL, init_shutdown, &shutdown_handle); + poll_timer_add (corosync_poll_handle, 500, NULL, init_shutdown, &shutdown_handle); } @@ -242,7 +244,7 @@ static int corosync_sync_callbacks_retrieve (int sync_id, return (0); } -static struct memb_ring_id aisexec_ring_id; +static struct memb_ring_id corosync_ring_id; static void confchg_fn ( enum totem_configuration_type configuration_type, @@ -253,7 +255,7 @@ static void confchg_fn ( { int i; - memcpy (&aisexec_ring_id, ring_id, sizeof (struct memb_ring_id)); + memcpy (&corosync_ring_id, ring_id, sizeof (struct memb_ring_id)); /* * Call configuration change for all services @@ -275,7 +277,7 @@ return; /* TODO: we are still not dropping privs */ setegid (main_config->gid); } -static void aisexec_mempool_init (void) +static void corosync_mempool_init (void) { int res; @@ -286,7 +288,7 @@ static void aisexec_mempool_init (void) } } -static void aisexec_tty_detach (void) +static void corosync_tty_detach (void) { int fd; @@ -332,7 +334,7 @@ static void aisexec_tty_detach (void) } } -static void aisexec_setscheduler (void) +static void corosync_setscheduler (void) { #if ! defined(TS_CLASS) && (defined(COROSYNC_BSD) || defined(COROSYNC_LINUX) || defined(COROSYNC_SOLARIS)) struct sched_param sched_param; @@ -353,7 +355,7 @@ static void aisexec_setscheduler (void) #endif } -static void aisexec_mlockall (void) +static void corosync_mlockall (void) { #if !defined(COROSYNC_BSD) int res; @@ -458,8 +460,8 @@ int main (int argc, char **argv) char *error_string; struct main_config main_config; struct totem_config totem_config; - unsigned int objdb_handle; - unsigned int config_handle; + hdb_handle_t objdb_handle; + hdb_handle_t config_handle; unsigned int config_version = 0; void *objdb_p; struct config_iface_ver0 *config; @@ -494,7 +496,7 @@ int main (int argc, char **argv) } if (background) - aisexec_tty_detach (); + corosync_tty_detach (); log_printf (LOG_LEVEL_NOTICE, "Corosync Executive Service RELEASE '%s'\n", RELEASE_VERSION); log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2002-2006 MontaVista Software, Inc and contributors.\n"); @@ -512,7 +514,7 @@ int main (int argc, char **argv) log_printf (LOG_LEVEL_NOTICE, "Corosync Executive Service: started and ready to provide service.\n"); - aisexec_poll_handle = poll_create ( + corosync_poll_handle = poll_create ( serialize_mutex_lock, serialize_mutex_unlock); @@ -614,9 +616,9 @@ int main (int argc, char **argv) * application healthchecking */ if (setprio) - aisexec_setscheduler (); + corosync_setscheduler (); - aisexec_mlockall (); + corosync_mlockall (); totem_config.totem_logging_configuration = totem_logging_configuration; totem_config.totem_logging_configuration.log_subsys_id = @@ -631,7 +633,7 @@ int main (int argc, char **argv) /* * Sleep for a while to let other nodes in the cluster * understand that this node has been away (if it was - * an aisexec restart). + * an corosync restart). */ // TODO what is this hack for? usleep(totem_config.token_timeout * 2000); @@ -647,7 +649,7 @@ int main (int argc, char **argv) * and configuration change functions */ totempg_initialize ( - aisexec_poll_handle, + corosync_poll_handle, &totem_config); totempg_groups_initialize ( @@ -682,14 +684,14 @@ int main (int argc, char **argv) */ priv_drop (&main_config); - aisexec_mempool_init (); + corosync_mempool_init (); cs_ipc_init (main_config.gid); /* * Start main processing loop */ - poll_run (aisexec_poll_handle); + poll_run (corosync_poll_handle); return EXIT_SUCCESS; } diff --git a/exec/main.h b/exec/main.h index 8aed9535..95e5e2a4 100644 --- a/exec/main.h +++ b/exec/main.h @@ -32,35 +32,26 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AIS_EXEC_H_DEFINED -#define AIS_EXEC_H_DEFINED +#ifndef MAIN_H_DEFINED +#define MAIN_H_DEFINED #define TRUE 1 #define FALSE 0 #include +#include #include #include #include #include #include -/* - * Size of the queue (entries) for I/O's to the API over socket IPC. - */ - -#ifndef SIZEQUEUE -#define SIZEQUEUE 800 -#endif /* SIZEQUEUE */ - #define SOCKET_SERVICE_INIT 254 -#define SIZEINB MESSAGE_SIZE_MAX - extern struct totempg_group corosync_group; -extern totempg_groups_handle corosync_group_handle; +extern hdb_handle_t corosync_group_handle; -poll_handle aisexec_poll_handle; +extern hdb_handle_t corosync_poll_handle; extern unsigned long long *(*main_clm_get_by_nodeid) (unsigned int node_id); @@ -75,4 +66,4 @@ extern int main_send_ok ( struct iovec *iovec, int iov_len); -#endif /* AIS_EXEC_H_DEFINED */ +#endif /* MAIN_H_DEFINED */ diff --git a/exec/mainconfig.c b/exec/mainconfig.c index 14cc88aa..f8ffb0b2 100644 --- a/exec/mainconfig.c +++ b/exec/mainconfig.c @@ -63,7 +63,7 @@ static void add_logsys_config_notification( /* This just makes the code below a little neater */ static inline int objdb_get_string ( struct objdb_iface_ver0 *objdb, - unsigned int object_service_handle, + hdb_handle_t object_service_handle, char *key, char **value) { int res; @@ -83,7 +83,8 @@ static inline int objdb_get_string ( } static inline void objdb_get_int ( - struct objdb_iface_ver0 *objdb, unsigned int object_service_handle, + struct objdb_iface_ver0 *objdb, + hdb_handle_t object_service_handle, char *key, unsigned int *intvalue) { char *value = NULL; @@ -114,12 +115,12 @@ int corosync_main_config_read_logging ( char **error_string, struct main_config *main_config) { - unsigned int object_service_handle; - unsigned int object_logger_subsys_handle; + hdb_handle_t object_service_handle; + hdb_handle_t object_logger_subsys_handle; char *value; char *error_reason = error_string_response; - unsigned int object_find_handle; - unsigned int object_find_logsys_handle; + hdb_handle_t object_find_handle; + hdb_handle_t object_find_logsys_handle; objdb->object_find_create ( OBJECT_PARENT_HANDLE, @@ -316,10 +317,10 @@ int corosync_main_config_read ( char **error_string, struct main_config *main_config) { - unsigned int object_service_handle; + hdb_handle_t object_service_handle; char *value; char *error_reason = error_string_response; - unsigned int object_find_handle; + hdb_handle_t object_find_handle; memset (main_config, 0, sizeof (struct main_config)); diff --git a/exec/objdb.c b/exec/objdb.c index dda02409..5e89fe48 100644 --- a/exec/objdb.c +++ b/exec/objdb.c @@ -53,7 +53,7 @@ struct object_key { }; struct object_tracker { - unsigned int object_handle; + hdb_handle_t object_handle; void * data_pt; object_track_depth_t depth; object_key_change_notify_fn_t key_change_notify_fn; @@ -67,8 +67,8 @@ struct object_tracker { struct object_instance { void *object_name; int object_name_len; - unsigned int object_handle; - unsigned int parent_handle; + hdb_handle_t object_handle; + hdb_handle_t parent_handle; struct list_head key_head; struct list_head child_head; struct list_head child_list; @@ -145,7 +145,7 @@ static void objdb_wrunlock() static int objdb_init (void) { - unsigned int handle; + hdb_handle_t handle; struct object_instance *instance; unsigned int res; @@ -219,14 +219,15 @@ static int _object_notify_deleted_children(struct object_instance *parent_pt) return 0; } -static void object_created_notification(unsigned int object_handle, - unsigned int parent_object_handle, - void *name_pt, int name_len) +static void object_created_notification( + hdb_handle_t object_handle, + hdb_handle_t parent_object_handle, + void *name_pt, int name_len) { struct list_head * list; struct object_instance * obj_pt; struct object_tracker * tracker_pt; - unsigned int obj_handle = object_handle; + hdb_handle_t obj_handle = object_handle; unsigned int res; do { @@ -254,7 +255,7 @@ static void object_created_notification(unsigned int object_handle, } -static void object_pre_deletion_notification(unsigned int object_handle, +static void object_pre_deletion_notification(hdb_handle_t object_handle, unsigned int parent_object_handle, void *name_pt, int name_len) { @@ -292,7 +293,7 @@ static void object_pre_deletion_notification(unsigned int object_handle, } -static void object_key_changed_notification(unsigned int object_handle, +static void object_key_changed_notification(hdb_handle_t object_handle, void *name_pt, int name_len, void *value_pt, int value_len, object_change_type_t type) @@ -301,7 +302,7 @@ static void object_key_changed_notification(unsigned int object_handle, struct object_instance * obj_pt; struct object_instance * owner_pt = NULL; struct object_tracker * tracker_pt; - unsigned int obj_handle = object_handle; + hdb_handle_t obj_handle = object_handle; unsigned int res; do { @@ -359,8 +360,8 @@ static void object_reload_notification(int startstop, int flush) * object db create/destroy/set */ static int object_create ( - unsigned int parent_object_handle, - unsigned int *object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t *object_handle, void *object_name, unsigned int object_name_len) { @@ -461,7 +462,7 @@ error_exit: } static int object_priv_set ( - unsigned int object_handle, + hdb_handle_t object_handle, void *priv) { int res; @@ -487,7 +488,7 @@ error_exit: } static int object_key_create ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *value, @@ -620,7 +621,7 @@ static int _clear_object(struct object_instance *instance) } static int object_destroy ( - unsigned int object_handle) + hdb_handle_t object_handle) { struct object_instance *instance; unsigned int res; @@ -651,7 +652,7 @@ static int object_destroy ( } static int object_valid_set ( - unsigned int object_handle, + hdb_handle_t object_handle, struct object_valid *object_valid_list, unsigned int object_valid_list_entries) { @@ -679,7 +680,7 @@ error_exit: } static int object_key_valid_set ( - unsigned int object_handle, + hdb_handle_t object_handle, struct object_key_valid *object_key_valid_list, unsigned int object_key_valid_list_entries) { @@ -710,10 +711,10 @@ error_exit: * object db reading */ static int object_find_create ( - unsigned int object_handle, + hdb_handle_t object_handle, void *object_name, int object_len, - unsigned int *object_find_handle) + hdb_handle_t *object_find_handle) { unsigned int res; struct object_instance *object_instance; @@ -760,8 +761,8 @@ error_exit: } static int object_find_next ( - unsigned int object_find_handle, - unsigned int *object_handle) + hdb_handle_t object_find_handle, + hdb_handle_t *object_handle) { unsigned int res; struct object_find_instance *object_find_instance; @@ -809,7 +810,7 @@ error_exit: } static int object_find_destroy ( - unsigned int object_find_handle) + hdb_handle_t object_find_handle) { struct object_find_instance *object_find_instance; unsigned int res; @@ -832,7 +833,7 @@ error_exit: } static int object_key_get ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void **value, @@ -881,7 +882,7 @@ error_exit: } static int object_key_increment ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, unsigned int *value) @@ -927,7 +928,7 @@ error_exit: } static int object_key_decrement ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, unsigned int *value) @@ -973,7 +974,7 @@ error_exit: } static int object_key_delete ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *value, @@ -1030,7 +1031,7 @@ error_exit: } static int object_key_replace ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *old_value, @@ -1134,7 +1135,7 @@ error_exit: } static int object_priv_get ( - unsigned int object_handle, + hdb_handle_t object_handle, void **priv) { int res; @@ -1212,7 +1213,7 @@ static int _dump_object(struct object_instance *instance, FILE *file, int depth) return 0; } -static int object_key_iter_reset(unsigned int object_handle) +static int object_key_iter_reset(hdb_handle_t object_handle) { unsigned int res; struct object_instance *instance; @@ -1236,7 +1237,7 @@ error_exit: } -static int object_key_iter(unsigned int parent_object_handle, +static int object_key_iter(hdb_handle_t parent_object_handle, void **key_name, int *key_len, void **value, @@ -1284,8 +1285,8 @@ error_exit: return (-1); } -static int object_key_iter_from(unsigned int parent_object_handle, - unsigned int start_pos, +static int object_key_iter_from(hdb_handle_t parent_object_handle, + hdb_handle_t start_pos, void **key_name, int *key_len, void **value, @@ -1341,8 +1342,8 @@ error_exit: } -static int object_parent_get(unsigned int object_handle, - unsigned int *parent_handle) +static int object_parent_get(hdb_handle_t object_handle, + hdb_handle_t *parent_handle) { struct object_instance *instance; unsigned int res; @@ -1367,7 +1368,7 @@ static int object_parent_get(unsigned int object_handle, return (0); } -static int object_name_get(unsigned int object_handle, +static int object_name_get(hdb_handle_t object_handle, char *object_name, int *object_name_len) { @@ -1392,7 +1393,7 @@ static int object_name_get(unsigned int object_handle, } -static int object_track_start(unsigned int object_handle, +static int object_track_start(hdb_handle_t object_handle, object_track_depth_t depth, object_key_change_notify_fn_t key_change_notify_fn, object_create_notify_fn_t object_create_notify_fn, @@ -1479,7 +1480,7 @@ static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn } } -static int object_dump(unsigned int object_handle, +static int object_dump(hdb_handle_t object_handle, FILE *file) { struct object_instance *instance; diff --git a/exec/service.c b/exec/service.c index f7caf321..9be917b7 100644 --- a/exec/service.c +++ b/exec/service.c @@ -86,13 +86,13 @@ static struct default_service default_services[] = { struct corosync_service_engine *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT]; -static unsigned int object_internal_configuration_handle; +static hdb_handle_t object_internal_configuration_handle; static unsigned int default_services_requested (struct corosync_api_v1 *corosync_api) { - unsigned int object_service_handle; - unsigned int object_find_handle; + hdb_handle_t object_service_handle; + hdb_handle_t object_find_handle; char *value; /* @@ -132,10 +132,10 @@ unsigned int corosync_service_link_and_init ( { struct corosync_service_engine_iface_ver0 *iface_ver0; void *iface_ver0_p; - unsigned int handle; + hdb_handle_t handle; struct corosync_service_engine *service; unsigned int res; - unsigned int object_service_handle; + hdb_handle_t object_service_handle; /* * reference the service interface @@ -208,7 +208,7 @@ unsigned int corosync_service_link_and_init ( static int corosync_service_unlink_common ( struct corosync_api_v1 *corosync_api, - unsigned int object_service_handle, + hdb_handle_t object_service_handle, const char *service_name, unsigned int service_version) { @@ -245,10 +245,10 @@ extern unsigned int corosync_service_unlink_and_exit ( unsigned int service_ver) { unsigned int res; - unsigned int object_service_handle; + hdb_handle_t object_service_handle; char *found_service_name; unsigned int *found_service_ver; - unsigned int object_find_handle; + hdb_handle_t object_find_handle; corosync_api->object_find_create ( object_internal_configuration_handle, @@ -297,8 +297,8 @@ extern unsigned int corosync_service_unlink_all ( { char *service_name; unsigned int *service_ver; - unsigned int object_service_handle; - unsigned int object_find_handle; + hdb_handle_t object_service_handle; + hdb_handle_t object_find_handle; int found; log_printf(LOG_LEVEL_NOTICE, "Unloading all corosync components\n"); @@ -359,11 +359,11 @@ unsigned int corosync_service_defaults_link_and_init (struct corosync_api_v1 *co { unsigned int i; - unsigned int object_service_handle; + hdb_handle_t object_service_handle; char *found_service_name; char *found_service_ver; unsigned int found_service_ver_atoi; - unsigned int object_find_handle; + hdb_handle_t object_find_handle; corosync_api->object_create (OBJECT_PARENT_HANDLE, &object_internal_configuration_handle, diff --git a/exec/sync.c b/exec/sync.c index 7979e8b6..fd465e34 100644 --- a/exec/sync.c +++ b/exec/sync.c @@ -118,7 +118,7 @@ static struct totempg_group sync_group = { .group_len = 4 }; -static totempg_groups_handle sync_group_handle; +static hdb_handle_t sync_group_handle; static char *service_name; static unsigned int current_members[PROCESSOR_COUNT_MAX]; static unsigned int current_members_cnt; diff --git a/exec/totemconfig.c b/exec/totemconfig.c index b4509d33..5c9d35ba 100644 --- a/exec/totemconfig.c +++ b/exec/totemconfig.c @@ -81,13 +81,13 @@ static struct objdb_iface_ver0 *global_objdb; static void add_totem_config_notification( struct objdb_iface_ver0 *objdb, struct totem_config *totem_config, - unsigned int totem_object_handle); + hdb_handle_t totem_object_handle); /* These just makes the code below a little neater */ static inline int objdb_get_string ( struct objdb_iface_ver0 *objdb, - unsigned int object_service_handle, + hdb_handle_t object_service_handle, char *key, char **value) { int res; @@ -126,9 +126,9 @@ static inline void objdb_get_int ( static unsigned int totem_handle_find ( struct objdb_iface_ver0 *objdb, - unsigned int *totem_find_handle) { + hdb_handle_t *totem_find_handle) { - unsigned int object_find_handle; + hdb_handle_t object_find_handle; unsigned int res; /* @@ -173,7 +173,7 @@ static unsigned int totem_handle_find ( static void totem_volatile_config_read ( struct objdb_iface_ver0 *objdb, struct totem_config *totem_config, - unsigned int object_totem_handle) + hdb_handle_t object_totem_handle) { objdb_get_int (objdb,object_totem_handle, "token", &totem_config->token_timeout); @@ -220,11 +220,11 @@ extern int totem_config_read ( char **error_string) { int res = 0; - unsigned int object_totem_handle; - unsigned int object_interface_handle; + hdb_handle_t object_totem_handle; + hdb_handle_t object_interface_handle; char *str; unsigned int ringnumber = 0; - unsigned int object_find_interface_handle; + hdb_handle_t object_find_interface_handle; res = totem_handle_find (objdb, &object_totem_handle); if (res == -1) { @@ -624,7 +624,7 @@ int totem_config_keyread ( { int got_key = 0; char *key_location = NULL; - unsigned int object_totem_handle; + hdb_handle_t object_totem_handle; int res; memset (totem_config->private_key, 0, 128); @@ -682,8 +682,8 @@ key_error: } static void totem_key_change_notify(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, void *object_name_pt, int object_name_len, void *key_name_pt, int key_len, void *key_value_pt, int key_value_len, @@ -701,7 +701,7 @@ static void totem_objdb_reload_notify(objdb_reload_notify_type_t type, int flush void *priv_data_pt) { struct totem_config *totem_config = priv_data_pt; - unsigned int totem_object_handle; + hdb_handle_t totem_object_handle; /* * A new totem {} key might exist, cancel the @@ -745,7 +745,7 @@ static void totem_objdb_reload_notify(objdb_reload_notify_type_t type, int flush static void add_totem_config_notification( struct objdb_iface_ver0 *objdb, struct totem_config *totem_config, - unsigned int totem_object_handle) + hdb_handle_t totem_object_handle) { global_objdb = objdb; diff --git a/exec/totemmrp.c b/exec/totemmrp.c index ff8e50ce..f0bfd819 100644 --- a/exec/totemmrp.c +++ b/exec/totemmrp.c @@ -56,10 +56,11 @@ #include #include +#include #include "totemsrp.h" -totemsrp_handle totemsrp_handle_in; +hdb_handle_t totemsrp_handle_in; void (*pg_deliver_fn) ( unsigned int nodeid, @@ -101,7 +102,7 @@ void totemmrp_confchg_fn ( * Initialize the totem multiple ring protocol */ int totemmrp_initialize ( - poll_handle poll_handle, + hdb_handle_t poll_handle, struct totem_config *totem_config, void (*deliver_fn) ( diff --git a/exec/totemmrp.h b/exec/totemmrp.h index 53e4f56f..f669b52b 100644 --- a/exec/totemmrp.h +++ b/exec/totemmrp.h @@ -56,7 +56,7 @@ extern void totemmrp_log_printf_init ( * Initialize the group messaging interface */ extern int totemmrp_initialize ( - poll_handle poll_handle, + hdb_handle_t poll_handle, struct totem_config *totem_config, void (*deliver_fn) ( diff --git a/exec/totemnet.c b/exec/totemnet.c index 9df7d85a..3ae89d4e 100644 --- a/exec/totemnet.c +++ b/exec/totemnet.c @@ -103,7 +103,7 @@ struct totemnet_instance { unsigned int totemnet_private_key_len; - poll_handle totemnet_poll_handle; + hdb_handle_t totemnet_poll_handle; struct totem_interface *totem_interface; @@ -143,7 +143,7 @@ struct totemnet_instance { int line, unsigned int level, char *format, ...)__attribute__((format(printf, 6, 7))); - totemnet_handle handle; + hdb_handle_t handle; char iov_buffer[FRAME_SIZE_MAX]; @@ -583,7 +583,7 @@ static void totemnet_mcast_worker_fn (void *thread_state, void *work_item_in) } int totemnet_finalize ( - totemnet_handle handle) + hdb_handle_t handle) { struct totemnet_instance *instance; int res = 0; @@ -608,7 +608,7 @@ error_exit: */ static int net_deliver_fn ( - poll_handle handle, + hdb_handle_t handle, int fd, int revents, void *data) @@ -1151,8 +1151,8 @@ static int totemnet_build_sockets ( * Create an instance */ int totemnet_initialize ( - poll_handle poll_handle, - totemnet_handle *handle, + hdb_handle_t poll_handle, + hdb_handle_t *handle, struct totem_config *totem_config, int interface_no, void *context, @@ -1251,7 +1251,7 @@ error_destroy: } int totemnet_processor_count_set ( - totemnet_handle handle, + hdb_handle_t handle, int processor_count) { struct totemnet_instance *instance; @@ -1280,7 +1280,7 @@ error_exit: return (res); } -int totemnet_recv_flush (totemnet_handle handle) +int totemnet_recv_flush (hdb_handle_t handle) { struct totemnet_instance *instance; struct pollfd ufd; @@ -1314,7 +1314,7 @@ error_exit: return (res); } -int totemnet_send_flush (totemnet_handle handle) +int totemnet_send_flush (hdb_handle_t handle) { struct totemnet_instance *instance; int res = 0; @@ -1335,7 +1335,7 @@ error_exit: } int totemnet_token_send ( - totemnet_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len) { @@ -1357,7 +1357,7 @@ error_exit: return (res); } int totemnet_mcast_flush_send ( - totemnet_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len) { @@ -1380,7 +1380,7 @@ error_exit: } int totemnet_mcast_noflush_send ( - totemnet_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len) { @@ -1411,7 +1411,7 @@ error_exit: return (res); } -extern int totemnet_iface_check (totemnet_handle handle) +extern int totemnet_iface_check (hdb_handle_t handle) { struct totemnet_instance *instance; int res = 0; @@ -1441,7 +1441,7 @@ extern void totemnet_net_mtu_adjust (struct totem_config *totem_config) } } -char *totemnet_iface_print (totemnet_handle handle) { +char *totemnet_iface_print (hdb_handle_t handle) { struct totemnet_instance *instance; int res = 0; char *ret_char; @@ -1461,7 +1461,7 @@ error_exit: } int totemnet_iface_get ( - totemnet_handle handle, + hdb_handle_t handle, struct totem_ip_address *addr) { struct totemnet_instance *instance; @@ -1482,7 +1482,7 @@ error_exit: } int totemnet_token_target_set ( - totemnet_handle handle, + hdb_handle_t handle, struct totem_ip_address *token_target) { struct totemnet_instance *instance; diff --git a/exec/totemnet.h b/exec/totemnet.h index 221d8437..026c10ea 100644 --- a/exec/totemnet.h +++ b/exec/totemnet.h @@ -40,8 +40,6 @@ #include -typedef unsigned int totemnet_handle; - #define TOTEMNET_NOFLUSH 0 #define TOTEMNET_FLUSH 1 /* @@ -53,8 +51,8 @@ typedef unsigned int totemnet_handle; * Create an instance */ extern int totemnet_initialize ( - poll_handle poll_handle, - totemnet_handle *handle, + hdb_handle_t poll_handle, + hdb_handle_t *handle, struct totem_config *totem_config, int interface_no, void *context, @@ -69,42 +67,42 @@ extern int totemnet_initialize ( struct totem_ip_address *iface_address)); extern int totemnet_processor_count_set ( - totemnet_handle handle, + hdb_handle_t handle, int processor_count); extern int totemnet_token_send ( - totemnet_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len); extern int totemnet_mcast_flush_send ( - totemnet_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len); extern int totemnet_mcast_noflush_send ( - totemnet_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len); -extern int totemnet_recv_flush (totemnet_handle handle); +extern int totemnet_recv_flush (hdb_handle_t handle); -extern int totemnet_send_flush (totemnet_handle handle); +extern int totemnet_send_flush (hdb_handle_t handle); -extern int totemnet_iface_check (totemnet_handle handle); +extern int totemnet_iface_check (hdb_handle_t handle); -extern int totemnet_finalize (totemnet_handle handle); +extern int totemnet_finalize (hdb_handle_t handle); extern void totemnet_net_mtu_adjust (struct totem_config *totem_config); -extern char *totemnet_iface_print (totemnet_handle handle); +extern char *totemnet_iface_print (hdb_handle_t handle); extern int totemnet_iface_get ( - totemnet_handle handle, + hdb_handle_t handle, struct totem_ip_address *addr); extern int totemnet_token_target_set ( - totemnet_handle handle, + hdb_handle_t handle, struct totem_ip_address *token_target); #endif /* TOTEMNET_H_DEFINED */ diff --git a/exec/totempg.c b/exec/totempg.c index 120e1c25..1a33812b 100644 --- a/exec/totempg.c +++ b/exec/totempg.c @@ -675,7 +675,7 @@ int callback_token_received_fn (enum totem_callback_token_type type, * Initialize the totem process group abstraction */ int totempg_initialize ( - poll_handle poll_handle, + hdb_handle_t poll_handle, struct totem_config *totem_config) { int res; @@ -935,7 +935,7 @@ void totempg_callback_token_destroy ( */ int totempg_groups_initialize ( - totempg_groups_handle *handle, + hdb_handle_t *handle, void (*deliver_fn) ( unsigned int nodeid, @@ -989,7 +989,7 @@ error_exit: } int totempg_groups_join ( - totempg_groups_handle handle, + hdb_handle_t handle, struct totempg_group *groups, int group_cnt) { @@ -1024,7 +1024,7 @@ error_exit: } int totempg_groups_leave ( - totempg_groups_handle handle, + hdb_handle_t handle, struct totempg_group *groups, int group_cnt) { @@ -1049,7 +1049,7 @@ error_exit: #define MAX_GROUPS_PER_MSG 32 int totempg_groups_mcast_joined ( - totempg_groups_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len, int guarantee) @@ -1092,7 +1092,7 @@ error_exit: } int totempg_groups_send_ok_joined ( - totempg_groups_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len) { @@ -1127,7 +1127,7 @@ error_exit: } int totempg_groups_mcast_groups ( - totempg_groups_handle handle, + hdb_handle_t handle, int guarantee, struct totempg_group *groups, int groups_cnt, @@ -1176,7 +1176,7 @@ error_exit: * Returns -1 if error, 0 if can't send, 1 if can send the message */ int totempg_groups_send_ok_groups ( - totempg_groups_handle handle, + hdb_handle_t handle, struct totempg_group *groups, int groups_cnt, struct iovec *iovec, diff --git a/exec/totemrrp.c b/exec/totemrrp.c index 4f21d263..e96f4334 100644 --- a/exec/totemrrp.c +++ b/exec/totemrrp.c @@ -154,7 +154,7 @@ struct rrp_algo { }; struct totemrrp_instance { - poll_handle totemrrp_poll_handle; + hdb_handle_t totemrrp_poll_handle; struct totem_interface *interfaces; @@ -200,15 +200,15 @@ struct totemrrp_instance { int line, unsigned int level, char *format, ...)__attribute__((format(printf, 6, 7))); - totemrrp_handle handle; + hdb_handle_t handle; - totemnet_handle *net_handles; + hdb_handle_t *net_handles; void *rrp_algo_instance; int interface_count; - int poll_handle; + hdb_handle_t poll_handle; int processor_count; @@ -1348,7 +1348,7 @@ void rrp_iface_change_fn ( } int totemrrp_finalize ( - totemrrp_handle handle) + hdb_handle_t handle) { struct totemrrp_instance *instance; int res = 0; @@ -1380,8 +1380,8 @@ error_exit: * Create an instance */ int totemrrp_initialize ( - poll_handle poll_handle, - totemrrp_handle *handle, + hdb_handle_t poll_handle, + hdb_handle_t *handle, struct totem_config *totem_config, void *context, @@ -1453,7 +1453,7 @@ int totemrrp_initialize ( instance->interface_count = totem_config->interface_count; - instance->net_handles = malloc (sizeof (totemnet_handle) * totem_config->interface_count); + instance->net_handles = malloc (sizeof (hdb_handle_t) * totem_config->interface_count); instance->context = context; @@ -1492,7 +1492,7 @@ error_destroy: } int totemrrp_processor_count_set ( - totemrrp_handle handle, + hdb_handle_t handle, unsigned int processor_count) { struct totemrrp_instance *instance; @@ -1516,7 +1516,7 @@ error_exit: } int totemrrp_token_target_set ( - totemrrp_handle handle, + hdb_handle_t handle, struct totem_ip_address *addr, unsigned int iface_no) { @@ -1537,7 +1537,7 @@ int totemrrp_token_target_set ( error_exit: return (res); } -int totemrrp_recv_flush (totemrrp_handle handle) +int totemrrp_recv_flush (hdb_handle_t handle) { struct totemrrp_instance *instance; int res = 0; @@ -1557,7 +1557,7 @@ error_exit: return (res); } -int totemrrp_send_flush (totemrrp_handle handle) +int totemrrp_send_flush (hdb_handle_t handle) { struct totemrrp_instance *instance; int res = 0; @@ -1578,7 +1578,7 @@ error_exit: } int totemrrp_token_send ( - totemrrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len) { @@ -1601,7 +1601,7 @@ error_exit: } int totemrrp_mcast_flush_send ( - totemrrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len) { @@ -1624,7 +1624,7 @@ error_exit: } int totemrrp_mcast_noflush_send ( - totemrrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len) { @@ -1654,7 +1654,7 @@ error_exit: return (res); } -int totemrrp_iface_check (totemrrp_handle handle) +int totemrrp_iface_check (hdb_handle_t handle) { struct totemrrp_instance *instance; int res = 0; @@ -1674,7 +1674,7 @@ error_exit: } int totemrrp_ifaces_get ( - totemrrp_handle handle, + hdb_handle_t handle, char ***status, unsigned int *iface_count) { @@ -1701,7 +1701,7 @@ error_exit: } int totemrrp_ring_reenable ( - totemrrp_handle handle) + hdb_handle_t handle) { struct totemrrp_instance *instance; int res = 0; diff --git a/exec/totemrrp.h b/exec/totemrrp.h index b06653b9..20eed2f5 100644 --- a/exec/totemrrp.h +++ b/exec/totemrrp.h @@ -40,8 +40,6 @@ #include -typedef unsigned int totemrrp_handle; - #define TOTEMRRP_NOFLUSH 0 #define TOTEMRRP_FLUSH 1 @@ -54,8 +52,8 @@ typedef unsigned int totemrrp_handle; * Create an instance */ extern int totemrrp_initialize ( - poll_handle poll_handle, - totemrrp_handle *handle, + hdb_handle_t poll_handle, + hdb_handle_t *handle, struct totem_config *totem_config, void *context, @@ -78,43 +76,43 @@ extern int totemrrp_initialize ( extern int totemrrp_processor_count_set ( - totemrrp_handle handle, + hdb_handle_t handle, unsigned int processor_count); extern int totemrrp_token_send ( - totemrrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len); extern int totemrrp_mcast_noflush_send ( - totemrrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len); extern int totemrrp_mcast_flush_send ( - totemrrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, unsigned int iov_len); -extern int totemrrp_recv_flush (totemrrp_handle handle); +extern int totemrrp_recv_flush (hdb_handle_t handle); -extern int totemrrp_send_flush (totemrrp_handle handle); +extern int totemrrp_send_flush (hdb_handle_t handle); extern int totemrrp_token_target_set ( - totemrrp_handle handle, + hdb_handle_t handle, struct totem_ip_address *target, unsigned int iface_no); -extern int totemrrp_iface_check (totemrrp_handle handle); +extern int totemrrp_iface_check (hdb_handle_t handle); -extern int totemrrp_finalize (totemrrp_handle handle); +extern int totemrrp_finalize (hdb_handle_t handle); extern int totemrrp_ifaces_get ( - totemrrp_handle handle, + hdb_handle_t handle, char ***status, unsigned int *iface_count); extern int totemrrp_ring_reenable ( - totemrrp_handle handle); + hdb_handle_t handle); #endif /* TOTEMRRP_H_DEFINED */ diff --git a/exec/totemsrp.c b/exec/totemsrp.c index c5af4280..187ec581 100644 --- a/exec/totemsrp.c +++ b/exec/totemsrp.c @@ -443,7 +443,7 @@ struct totemsrp_instance { struct iovec totemsrp_iov_recv; - poll_handle totemsrp_poll_handle; + hdb_handle_t totemsrp_poll_handle; /* * Function called when new message received @@ -487,7 +487,7 @@ struct totemsrp_instance { struct timeval tv_old; - totemrrp_handle totemrrp_handle; + hdb_handle_t totemrrp_handle; struct totem_config *totem_config; @@ -666,8 +666,8 @@ unsigned int main_msgs_missing (void) * Exported interfaces */ int totemsrp_initialize ( - poll_handle poll_handle, - totemsrp_handle *handle, + hdb_handle_t poll_handle, + hdb_handle_t *handle, struct totem_config *totem_config, void (*deliver_fn) ( @@ -844,7 +844,7 @@ error_exit: } void totemsrp_finalize ( - totemsrp_handle handle) + hdb_handle_t handle) { struct totemsrp_instance *instance; unsigned int res; @@ -859,7 +859,7 @@ void totemsrp_finalize ( } int totemsrp_ifaces_get ( - totemsrp_handle handle, + hdb_handle_t handle, unsigned int nodeid, struct totem_ip_address *interfaces, char ***status, @@ -914,7 +914,7 @@ error_exit: } unsigned int totemsrp_my_nodeid_get ( - totemsrp_handle handle) + hdb_handle_t handle) { struct totemsrp_instance *instance; unsigned int res; @@ -932,7 +932,7 @@ unsigned int totemsrp_my_nodeid_get ( } int totemsrp_my_family_get ( - totemsrp_handle handle) + hdb_handle_t handle) { struct totemsrp_instance *instance; int res; @@ -951,7 +951,7 @@ int totemsrp_my_family_get ( int totemsrp_ring_reenable ( - totemsrp_handle handle) + hdb_handle_t handle) { struct totemsrp_instance *instance; int res; @@ -1981,7 +1981,7 @@ originated: return; } -int totemsrp_new_msg_signal (totemsrp_handle handle) +int totemsrp_new_msg_signal (hdb_handle_t handle) { struct totemsrp_instance *instance; unsigned int res; @@ -2001,7 +2001,7 @@ error_exit: } int totemsrp_mcast ( - totemsrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len, int guarantee) @@ -2088,7 +2088,7 @@ error_exit: /* * Determine if there is room to queue a new message */ -int totemsrp_avail (totemsrp_handle handle) +int totemsrp_avail (hdb_handle_t handle) { int avail; struct totemsrp_instance *instance; @@ -2968,7 +2968,7 @@ static void memb_ring_id_set_and_store ( } int totemsrp_callback_token_create ( - totemsrp_handle handle, + hdb_handle_t handle, void **handle_out, enum totem_callback_token_type type, int delete, @@ -3012,7 +3012,7 @@ error_exit: return (0); } -void totemsrp_callback_token_destroy (totemsrp_handle handle, void **handle_out) +void totemsrp_callback_token_destroy (hdb_handle_t handle, void **handle_out) { struct token_callback_instance *h; diff --git a/exec/totemsrp.h b/exec/totemsrp.h index aba82011..732b9923 100644 --- a/exec/totemsrp.h +++ b/exec/totemsrp.h @@ -38,8 +38,6 @@ #include #include -typedef unsigned int totemsrp_handle; - /* * Totem Single Ring Protocol * depends on poll abstraction, POSIX, IPV4 @@ -49,8 +47,8 @@ typedef unsigned int totemsrp_handle; * Create a protocol instance */ int totemsrp_initialize ( - poll_handle poll_handle, - totemsrp_handle *handle, + hdb_handle_t poll_handle, + hdb_handle_t *handle, struct totem_config *totem_config, void (*deliver_fn) ( @@ -65,13 +63,13 @@ int totemsrp_initialize ( unsigned int *joined_list, int joined_list_entries, struct memb_ring_id *ring_id)); -void totemsrp_finalize (totemsrp_handle handle); +void totemsrp_finalize (hdb_handle_t handle); /* * Multicast a message */ int totemsrp_mcast ( - totemsrp_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len, int priority); @@ -79,10 +77,10 @@ int totemsrp_mcast ( /* * Return number of available messages that can be queued */ -int totemsrp_avail (totemsrp_handle handle); +int totemsrp_avail (hdb_handle_t handle); int totemsrp_callback_token_create ( - totemsrp_handle handle, + hdb_handle_t handle, void **handle_out, enum totem_callback_token_type type, int delete, @@ -90,27 +88,27 @@ int totemsrp_callback_token_create ( void *data); void totemsrp_callback_token_destroy ( - totemsrp_handle handle, + hdb_handle_t handle, void **handle_out); -int totemsrp_new_msg_signal (totemsrp_handle handle); +int totemsrp_new_msg_signal (hdb_handle_t handle); extern void totemsrp_net_mtu_adjust (struct totem_config *totem_config); extern int totemsrp_ifaces_get ( - totemsrp_handle handle, + hdb_handle_t handle, unsigned int nodeid, struct totem_ip_address *interfaces, char ***status, unsigned int *iface_count); extern unsigned int totemsrp_my_nodeid_get ( - totemsrp_handle handle); + hdb_handle_t handle); extern int totemsrp_my_family_get ( - totemsrp_handle handle); + hdb_handle_t handle); extern int totemsrp_ring_reenable ( - totemsrp_handle handle); + hdb_handle_t handle); #endif /* TOTEMSRP_H_DEFINED */ diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c index dbf61295..bdf69a7c 100644 --- a/exec/vsf_quorum.c +++ b/exec/vsf_quorum.c @@ -254,9 +254,9 @@ static struct quorum_callin_functions callins = { static int quorum_exec_init_fn (struct corosync_api_v1 *api) { - unsigned int find_handle; - unsigned int quorum_handle = 0; - unsigned int q_handle; + hdb_handle_t find_handle; + hdb_handle_t quorum_handle = 0; + hdb_handle_t q_handle; char *quorum_module; int res; void *quorum_iface_p; diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c index 5445318f..7ff16ccb 100644 --- a/exec/vsf_ykd.c +++ b/exec/vsf_ykd.c @@ -108,7 +108,7 @@ struct state_received { struct ykd_state ykd_state; -static cs_tpg_handle ykd_group_handle; +static hdb_handle_t ykd_group_handle; static struct state_received state_received_confchg[YKD_PROCESSOR_COUNT_MAX]; diff --git a/include/corosync/confdb.h b/include/corosync/confdb.h index 0432e390..c1506e67 100644 --- a/include/corosync/confdb.h +++ b/include/corosync/confdb.h @@ -35,6 +35,8 @@ #define COROSYNC_CONFDB_H_DEFINED #include +#include + /** * @addtogroup confdb_corosync * @@ -58,8 +60,8 @@ typedef enum { typedef void (*confdb_key_change_notify_fn_t) ( confdb_handle_t handle, confdb_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, void *object_name, int object_name_len, void *key_name, @@ -69,14 +71,14 @@ typedef void (*confdb_key_change_notify_fn_t) ( typedef void (*confdb_object_create_notify_fn_t) ( confdb_handle_t handle, - unsigned int parent_object_handle, - unsigned int object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, uint8_t *name_pt, int name_len); typedef void (*confdb_object_delete_notify_fn_t) ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, uint8_t *name_pt, int name_len); @@ -137,7 +139,7 @@ cs_error_t confdb_dispatch ( */ cs_error_t confdb_track_changes ( confdb_handle_t handle, - unsigned int object_handle, + hdb_handle_t object_handle, unsigned int flags); cs_error_t confdb_stop_track_changes ( @@ -148,26 +150,26 @@ cs_error_t confdb_stop_track_changes ( */ cs_error_t confdb_object_create ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *object_name, int object_name_len, - unsigned int *object_handle); + hdb_handle_t *object_handle); cs_error_t confdb_object_destroy ( confdb_handle_t handle, - unsigned int object_handle); + hdb_handle_t object_handle); cs_error_t confdb_object_parent_get ( confdb_handle_t handle, - unsigned int object_handle, - unsigned int *parent_object_handle); + hdb_handle_t object_handle, + hdb_handle_t *parent_object_handle); /* * Manipulate keys */ cs_error_t confdb_key_create ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -175,7 +177,7 @@ cs_error_t confdb_key_create ( cs_error_t confdb_key_delete ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -186,7 +188,7 @@ cs_error_t confdb_key_delete ( */ cs_error_t confdb_key_get ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -194,7 +196,7 @@ cs_error_t confdb_key_get ( cs_error_t confdb_key_replace ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *old_value, @@ -204,14 +206,14 @@ cs_error_t confdb_key_replace ( cs_error_t confdb_key_increment ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value); cs_error_t confdb_key_decrement ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value); @@ -224,44 +226,44 @@ cs_error_t confdb_key_decrement ( */ cs_error_t confdb_object_find_start ( confdb_handle_t handle, - unsigned int parent_object_handle); + hdb_handle_t parent_object_handle); cs_error_t confdb_object_find ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *object_name, int object_name_len, - unsigned int *object_handle); + hdb_handle_t *object_handle); cs_error_t confdb_object_find_destroy( confdb_handle_t handle, - unsigned int parent_object_handle); + hdb_handle_t parent_object_handle); cs_error_t confdb_object_iter_start ( confdb_handle_t handle, - unsigned int parent_object_handle); + hdb_handle_t parent_object_handle); cs_error_t confdb_object_iter ( confdb_handle_t handle, - unsigned int parent_object_handle, - unsigned int *object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t *object_handle, void *object_name, int *object_name_len); cs_error_t confdb_object_iter_destroy( confdb_handle_t handle, - unsigned int parent_object_handle); + hdb_handle_t parent_object_handle); /* * Key iterator */ cs_error_t confdb_key_iter_start ( confdb_handle_t handle, - unsigned int object_handle); + hdb_handle_t object_handle); cs_error_t confdb_key_iter ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int *key_name_len, void *value, diff --git a/include/corosync/engine/coroapi.h b/include/corosync/engine/coroapi.h index d4f3bf4d..4b6810f6 100644 --- a/include/corosync/engine/coroapi.h +++ b/include/corosync/engine/coroapi.h @@ -38,11 +38,10 @@ #ifdef COROSYNC_BSD #include #endif +#include typedef void * corosync_timer_handle_t; -typedef unsigned int cs_tpg_handle; - struct corosync_tpg_group { void *group; int group_len; @@ -164,30 +163,37 @@ typedef enum { OBJDB_RELOAD_NOTIFY_FAILED } objdb_reload_notify_type_t; -typedef void (*object_key_change_notify_fn_t)(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, - void *object_name_pt, int object_name_len, - void *key_name_pt, int key_len, - void *key_value_pt, int key_value_len, - void *priv_data_pt); +typedef void (*object_key_change_notify_fn_t)( + object_change_type_t change_type, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, + void *object_name_pt, int object_name_len, + void *key_name_pt, int key_len, + void *key_value_pt, int key_value_len, + void *priv_data_pt); -typedef void (*object_create_notify_fn_t) (unsigned int parent_object_handle, - unsigned int object_handle, - uint8_t *name_pt, int name_len, - void *priv_data_pt); +typedef void (*object_create_notify_fn_t) ( + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, + uint8_t *name_pt, int name_len, + void *priv_data_pt); -typedef void (*object_destroy_notify_fn_t) (unsigned int parent_object_handle, - uint8_t *name_pt, int name_len, - void *priv_data_pt); -typedef void (*object_notify_callback_fn_t)(unsigned int object_handle, - void *key_name, int key_len, - void *value, int value_len, - object_change_type_t type, - void * priv_data_pt); +typedef void (*object_destroy_notify_fn_t) ( + hdb_handle_t parent_object_handle, + uint8_t *name_pt, int name_len, + void *priv_data_pt); -typedef void (*object_reload_notify_fn_t) (objdb_reload_notify_type_t, int flush, - void *priv_data_pt); +typedef void (*object_notify_callback_fn_t)( + hdb_handle_t object_handle, + void *key_name, int key_len, + void *value, int value_len, + object_change_type_t type, + void * priv_data_pt); + +typedef void (*object_reload_notify_fn_t) ( + objdb_reload_notify_type_t, + int flush, + void *priv_data_pt); #endif /* OBJECT_PARENT_HANDLE_DEFINED */ @@ -215,60 +221,60 @@ struct corosync_api_v1 { * Object and configuration APIs */ int (*object_create) ( - unsigned int parent_object_handle, - unsigned int *object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t *object_handle, void *object_name, unsigned int object_name_len); int (*object_priv_set) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *priv); int (*object_key_create) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *value, int value_len); int (*object_destroy) ( - unsigned int object_handle); + hdb_handle_t object_handle); int (*object_valid_set) ( - unsigned int object_handle, + hdb_handle_t object_handle, struct object_valid *object_valid_list, unsigned int object_valid_list_entries); int (*object_key_valid_set) ( - unsigned int object_handle, + hdb_handle_t object_handle, struct object_key_valid *object_key_valid_list, unsigned int object_key_valid_list_entries); int (*object_find_create) ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *object_name, int object_name_len, - unsigned int *object_find_handle); + hdb_handle_t *object_find_handle); int (*object_find_next) ( - unsigned int object_find_handle, - unsigned int *object_handle); + hdb_handle_t object_find_handle, + hdb_handle_t *object_handle); int (*object_find_destroy) ( - unsigned int object_find_handle); + hdb_handle_t object_find_handle); int (*object_key_get) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void **value, int *value_len); int (*object_priv_get) ( - unsigned int jobject_handle, + hdb_handle_t jobject_handle, void **priv); int (*object_key_replace) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *old_value, @@ -277,54 +283,54 @@ struct corosync_api_v1 { int new_value_len); int (*object_key_delete) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *value, int value_len); int (*object_iter_reset) ( - unsigned int parent_object_handle); + hdb_handle_t parent_object_handle); int (*object_iter) ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void **object_name, int *name_len, - unsigned int *object_handle); + hdb_handle_t *object_handle); int (*object_key_iter_reset) ( - unsigned int object_handle); + hdb_handle_t object_handle); int (*object_key_iter) ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void **key_name, int *key_len, void **value, int *value_len); int (*object_parent_get) ( - unsigned int object_handle, - unsigned int *parent_handle); + hdb_handle_t object_handle, + hdb_handle_t *parent_handle); int (*object_name_get) ( - unsigned int object_handle, + hdb_handle_t object_handle, char *object_name, int *object_name_len); int (*object_dump) ( - unsigned int object_handle, + hdb_handle_t object_handle, FILE *file); int (*object_key_iter_from) ( - unsigned int parent_object_handle, - unsigned int start_pos, + hdb_handle_t parent_object_handle, + hdb_handle_t start_pos, void **key_name, int *key_len, void **value, int *value_len); int (*object_track_start) ( - unsigned int object_handle, + hdb_handle_t object_handle, object_track_depth_t depth, object_key_change_notify_fn_t key_change_notify_fn, object_create_notify_fn_t object_create_notify_fn, @@ -345,13 +351,13 @@ struct corosync_api_v1 { char **error_string); int (*object_key_increment) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, unsigned int *value); int (*object_key_decrement) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, unsigned int *value); @@ -436,7 +442,7 @@ struct corosync_api_v1 { * wanting their own groups */ int (*tpg_init) ( - cs_tpg_handle *handle, + hdb_handle_t *handle, void (*deliver_fn) ( unsigned int nodeid, @@ -452,31 +458,31 @@ struct corosync_api_v1 { struct memb_ring_id *ring_id)); int (*tpg_exit) ( - cs_tpg_handle handle); + hdb_handle_t handle); int (*tpg_join) ( - cs_tpg_handle handle, + hdb_handle_t handle, struct corosync_tpg_group *groups, int gruop_cnt); int (*tpg_leave) ( - cs_tpg_handle handle, + hdb_handle_t handle, struct corosync_tpg_group *groups, int gruop_cnt); int (*tpg_joined_mcast) ( - cs_tpg_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len, int guarantee); int (*tpg_joined_send_ok) ( - cs_tpg_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len); int (*tpg_groups_mcast) ( - cs_tpg_handle handle, + hdb_handle_t handle, int guarantee, struct corosync_tpg_group *groups, int groups_cnt, @@ -484,7 +490,7 @@ struct corosync_api_v1 { int iov_len); int (*tpg_groups_send_ok) ( - cs_tpg_handle handle, + hdb_handle_t handle, struct corosync_tpg_group *groups, int groups_cnt, struct iovec *iovec, @@ -510,13 +516,13 @@ struct corosync_api_v1 { * Plugin loading and unloading */ int (*plugin_interface_reference) ( - unsigned int *handle, + hdb_handle_t *handle, char *iface_name, int version, void **interface, void *context); - int (*plugin_interface_release) (unsigned int handle); + int (*plugin_interface_release) (hdb_handle_t handle); /* * Service loading and unloading APIs diff --git a/include/corosync/engine/objdb.h b/include/corosync/engine/objdb.h index 507b741d..13c3213f 100644 --- a/include/corosync/engine/objdb.h +++ b/include/corosync/engine/objdb.h @@ -39,6 +39,7 @@ #define OBJECT_PARENT_HANDLE 0 #include +#include typedef enum { OBJECT_TRACK_DEPTH_ONE, @@ -58,18 +59,19 @@ typedef enum { } objdb_reload_notify_type_t; -typedef void (*object_key_change_notify_fn_t)(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, - void *object_name_pt, int object_name_len, - void *key_name_pt, int key_len, - void *key_value_pt, int key_value_len, - void *priv_data_pt); +typedef void (*object_key_change_notify_fn_t)( + object_change_type_t change_type, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, + void *object_name_pt, int object_name_len, + void *key_name_pt, int key_len, + void *key_value_pt, int key_value_len, +void *priv_data_pt); typedef void (*object_create_notify_fn_t) (unsigned int parent_object_handle, - unsigned int object_handle, - void *name_pt, int name_len, - void *priv_data_pt); +hdb_handle_t object_handle, +void *name_pt, int name_len, +void *priv_data_pt); typedef void (*object_destroy_notify_fn_t) (unsigned int parent_object_handle, void *name_pt, int name_len, @@ -93,61 +95,61 @@ struct objdb_iface_ver0 { int (*objdb_init) (void); int (*object_create) ( - unsigned int parent_object_handle, - unsigned int *object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t *object_handle, void *object_name, unsigned int object_name_len); int (*object_priv_set) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *priv); int (*object_key_create) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *value, int value_len); int (*object_destroy) ( - unsigned int object_handle); + hdb_handle_t object_handle); int (*object_valid_set) ( - unsigned int object_handle, + hdb_handle_t object_handle, struct object_valid *object_valid_list, unsigned int object_valid_list_entries); int (*object_key_valid_set) ( - unsigned int object_handle, + hdb_handle_t object_handle, struct object_key_valid *object_key_valid_list, unsigned int object_key_valid_list_entries); int (*object_find_create) ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *object_name, int object_name_len, - unsigned int *object_find_handle); + hdb_handle_t *object_find_handle); int (*object_find_next) ( - unsigned int object_find_handle, - unsigned int *object_handle); + hdb_handle_t object_find_handle, + hdb_handle_t *object_handle); int (*object_find_destroy) ( - unsigned int object_find_handle); + hdb_handle_t object_find_handle); int (*object_key_get) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void **value, int *value_len); int (*object_priv_get) ( - unsigned int jobject_handle, + hdb_handle_t jobject_handle, void **priv); int (*object_key_replace) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *old_value, @@ -156,54 +158,54 @@ struct objdb_iface_ver0 { int new_value_len); int (*object_key_delete) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, void *value, int value_len); int (*object_iter_reset) ( - unsigned int parent_object_handle); + hdb_handle_t parent_object_handle); int (*object_iter) ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void **object_name, int *name_len, - unsigned int *object_handle); + hdb_handle_t *object_handle); int (*object_key_iter_reset) ( - unsigned int object_handle); + hdb_handle_t object_handle); int (*object_key_iter) ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void **key_name, int *key_len, void **value, int *value_len); int (*object_parent_get) ( - unsigned int object_handle, - unsigned int *parent_handle); + hdb_handle_t object_handle, + hdb_handle_t *parent_handle); int (*object_name_get) ( - unsigned int object_handle, + hdb_handle_t object_handle, char *object_name, int *object_name_len); int (*object_dump) ( - unsigned int object_handle, + hdb_handle_t object_handle, FILE *file); int (*object_key_iter_from) ( - unsigned int parent_object_handle, - unsigned int start_pos, + hdb_handle_t parent_object_handle, + hdb_handle_t start_pos, void **key_name, int *key_len, void **value, int *value_len); int (*object_track_start) ( - unsigned int object_handle, + hdb_handle_t object_handle, object_track_depth_t depth, object_key_change_notify_fn_t key_change_notify_fn, object_create_notify_fn_t object_create_notify_fn, @@ -225,13 +227,13 @@ struct objdb_iface_ver0 { char **error_string); int (*object_key_increment) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, unsigned int *value); int (*object_key_decrement) ( - unsigned int object_handle, + hdb_handle_t object_handle, void *key_name, int key_len, unsigned int *value); diff --git a/include/corosync/hdb.h b/include/corosync/hdb.h index 2c429b90..6e7c323e 100644 --- a/include/corosync/hdb.h +++ b/include/corosync/hdb.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2006 MontaVista Software, Inc. - * Copyright (c) 2006-2008 Red Hat, Inc. + * Copyright (c) 2006-2009 Red Hat, Inc. * * All rights reserved. * @@ -41,6 +41,8 @@ #include #include +typedef unsigned long long hdb_handle_t; + enum HDB_HANDLE_STATE { HDB_HANDLE_STATE_EMPTY, HDB_HANDLE_STATE_PENDINGREMOVAL, @@ -81,7 +83,7 @@ static inline void hdb_destroy ( static inline int hdb_handle_create ( struct hdb_handle_database *handle_database, int instance_size, - unsigned int *handle_id_out) + hdb_handle_t *handle_id_out) { int handle; void *new_handles; @@ -129,7 +131,7 @@ static inline int hdb_handle_create ( static inline int hdb_handle_get ( struct hdb_handle_database *handle_database, - unsigned int handle, + hdb_handle_t handle, void **instance) { pthread_mutex_lock (&handle_database->mutex); @@ -155,7 +157,7 @@ static inline int hdb_handle_get ( static inline void hdb_handle_put ( struct hdb_handle_database *handle_database, - unsigned int handle) + hdb_handle_t handle) { pthread_mutex_lock (&handle_database->mutex); handle_database->handles[handle].ref_count -= 1; @@ -188,7 +190,7 @@ static inline void hdb_iterator_reset ( static inline int hdb_iterator_next ( struct hdb_handle_database *handle_database, void **instance, - unsigned int *handle) + hdb_handle_t *handle) { int res = -1; diff --git a/include/corosync/ipc_confdb.h b/include/corosync/ipc_confdb.h index d466af8e..d68088bb 100644 --- a/include/corosync/ipc_confdb.h +++ b/include/corosync/ipc_confdb.h @@ -84,48 +84,48 @@ enum res_confdb_types { struct req_lib_confdb_object_create { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); mar_name_t object_name __attribute__((aligned(8))); }; struct res_lib_confdb_object_create { mar_res_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); }; struct req_lib_confdb_object_destroy { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); }; struct req_lib_confdb_object_parent_get { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); }; struct res_lib_confdb_object_parent_get { mar_res_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); }; struct req_lib_confdb_key_create { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); mar_name_t key_name __attribute__((aligned(8))); mar_name_t value __attribute__((aligned(8))); }; struct req_lib_confdb_key_delete { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); mar_name_t key_name __attribute__((aligned(8))); mar_name_t value __attribute__((aligned(8))); }; struct req_lib_confdb_key_replace { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); mar_name_t key_name __attribute__((aligned(8))); mar_name_t old_value __attribute__((aligned(8))); mar_name_t new_value __attribute__((aligned(8))); @@ -133,34 +133,34 @@ struct req_lib_confdb_key_replace { struct req_lib_confdb_object_find { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); mar_name_t object_name __attribute__((aligned(8))); - mar_uint32_t find_handle __attribute__((aligned(8))); + mar_uint64_t find_handle __attribute__((aligned(8))); }; struct res_lib_confdb_object_find { mar_res_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); - mar_uint32_t find_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); + mar_uint64_t find_handle __attribute__((aligned(8))); }; struct req_lib_confdb_object_iter { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); - mar_uint32_t find_handle __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t find_handle __attribute__((aligned(8))); }; struct res_lib_confdb_object_iter { mar_res_header_t header __attribute__((aligned(8))); mar_name_t object_name __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); - mar_uint32_t find_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); + mar_uint64_t find_handle __attribute__((aligned(8))); }; struct req_lib_confdb_key_iter { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); - mar_uint32_t next_entry __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t next_entry __attribute__((aligned(8))); }; struct res_lib_confdb_key_iter { @@ -171,13 +171,13 @@ struct res_lib_confdb_key_iter { struct req_lib_confdb_key_get { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); mar_name_t key_name __attribute__((aligned(8))); }; struct req_lib_confdb_object_find_destroy { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t find_handle __attribute__((aligned(8))); + mar_uint64_t find_handle __attribute__((aligned(8))); }; struct res_lib_confdb_key_get { @@ -207,9 +207,9 @@ struct res_lib_confdb_reload { struct res_lib_confdb_key_change_callback { mar_res_header_t header __attribute__((aligned(8))); - mar_uint32_t change_type __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t change_type __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); mar_name_t object_name __attribute__((aligned(8))); mar_name_t key_name __attribute__((aligned(8))); mar_name_t key_value __attribute__((aligned(8))); @@ -217,20 +217,20 @@ struct res_lib_confdb_key_change_callback { struct res_lib_confdb_object_create_callback { mar_res_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); mar_name_t name __attribute__((aligned(8))); }; struct res_lib_confdb_object_destroy_callback { mar_res_header_t header __attribute__((aligned(8))); - mar_uint32_t parent_object_handle __attribute__((aligned(8))); + mar_uint64_t parent_object_handle __attribute__((aligned(8))); mar_name_t name __attribute__((aligned(8))); }; struct req_lib_confdb_object_track_start { mar_req_header_t header __attribute__((aligned(8))); - mar_uint32_t object_handle __attribute__((aligned(8))); + mar_uint64_t object_handle __attribute__((aligned(8))); mar_uint32_t flags __attribute__((aligned(8))); }; diff --git a/include/corosync/lcr/lcr_ifact.h b/include/corosync/lcr/lcr_ifact.h index 4bf35b9f..5454722d 100644 --- a/include/corosync/lcr/lcr_ifact.h +++ b/include/corosync/lcr/lcr_ifact.h @@ -31,14 +31,16 @@ #ifndef LCR_IFACT_H_DEFINED #define LCR_IFACT_H_DEFINED +#include + int lcr_ifact_reference ( - unsigned int *handle, + hdb_handle_t *handle, char *iface_name, int version, void **interface, void *context); int lcr_ifact_release ( - unsigned int handle); + hdb_handle_t handle); #endif /* LCR_IFACT_H_DEFINED */ diff --git a/include/corosync/totem/coropoll.h b/include/corosync/totem/coropoll.h index 4e10cf13..a2d089cc 100644 --- a/include/corosync/totem/coropoll.h +++ b/include/corosync/totem/coropoll.h @@ -34,62 +34,62 @@ #ifndef POLL_H_DEFINED #define POLL_H_DEFINED +#include #include typedef void * poll_timer_handle; -typedef unsigned int poll_handle; -poll_handle poll_create ( +hdb_handle_t poll_create ( void (*serialize_lock) (void), void (*serialize_unlock) (void)); -int poll_destroy (poll_handle poll_handle); +int poll_destroy (hdb_handle_t hdb_handle_t); int poll_dispatch_add ( - poll_handle handle, + hdb_handle_t handle, int fd, int events, void *data, - int (*dispatch_fn) (poll_handle handle, + int (*dispatch_fn) (hdb_handle_t handle, int fd, int revents, void *data)); int poll_dispatch_modify ( - poll_handle handle, + hdb_handle_t handle, int fd, int events, - int (*dispatch_fn) (poll_handle poll_handle, + int (*dispatch_fn) (hdb_handle_t hdb_handle_t, int fd, int revents, void *data)); int poll_dispatch_delete ( - poll_handle handle, + hdb_handle_t handle, int fd); int poll_timer_add ( - poll_handle handle, + hdb_handle_t handle, int msec_in_future, void *data, void (*timer_fn) (void *data), poll_timer_handle *timer_handle_out); int poll_timer_delete ( - poll_handle handle, + hdb_handle_t handle, poll_timer_handle timer_handle); int poll_run ( - poll_handle handle); + hdb_handle_t handle); int poll_stop ( - poll_handle handle); + hdb_handle_t handle); #ifdef COMPILE_OUT void poll_print_state ( - poll_handle handle, int fd); + hdb_handle_t handle, int fd); #endif #endif /* POLL_H_DEFINED */ diff --git a/include/corosync/totem/totempg.h b/include/corosync/totem/totempg.h index 78927a6e..b3f81808 100644 --- a/include/corosync/totem/totempg.h +++ b/include/corosync/totem/totempg.h @@ -39,8 +39,7 @@ #include #include "totem.h" #include "coropoll.h" - -typedef unsigned int totempg_groups_handle; +#include struct totempg_group { void *group; @@ -59,7 +58,7 @@ struct totempg_group { * Initialize the totem process groups abstraction */ extern int totempg_initialize ( - poll_handle poll_handle, + hdb_handle_t poll_handle, struct totem_config *totem_config ); @@ -77,7 +76,7 @@ extern void totempg_callback_token_destroy (void *handle); * Initialize a groups instance */ extern int totempg_groups_initialize ( - totempg_groups_handle *handle, + hdb_handle_t *handle, void (*deliver_fn) ( unsigned int nodeid, @@ -93,31 +92,31 @@ extern int totempg_groups_initialize ( struct memb_ring_id *ring_id)); extern int totempg_groups_finalize ( - totempg_groups_handle handle); + hdb_handle_t handle); extern int totempg_groups_join ( - totempg_groups_handle handle, + hdb_handle_t handle, struct totempg_group *groups, int gruop_cnt); extern int totempg_groups_leave ( - totempg_groups_handle handle, + hdb_handle_t handle, struct totempg_group *groups, int gruop_cnt); extern int totempg_groups_mcast_joined ( - totempg_groups_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len, int guarantee); extern int totempg_groups_send_ok_joined ( - totempg_groups_handle handle, + hdb_handle_t handle, struct iovec *iovec, int iov_len); extern int totempg_groups_mcast_groups ( - totempg_groups_handle handle, + hdb_handle_t handle, int guarantee, struct totempg_group *groups, int groups_cnt, @@ -125,7 +124,7 @@ extern int totempg_groups_mcast_groups ( int iov_len); extern int totempg_groups_send_ok_groups ( - totempg_groups_handle handle, + hdb_handle_t handle, struct totempg_group *groups, int groups_cnt, struct iovec *iovec, diff --git a/lcr/lcr_ifact.c b/lcr/lcr_ifact.c index 748ea040..62815cb5 100644 --- a/lcr/lcr_ifact.c +++ b/lcr/lcr_ifact.c @@ -38,6 +38,7 @@ #ifdef COROSYNC_SOLARIS #include #endif +#include #include #include #include @@ -46,14 +47,14 @@ struct lcr_component_instance { struct lcr_iface *ifaces; int iface_count; - unsigned int comp_handle; + hdb_handle_t comp_handle; void *dl_handle; int refcount; char library_name[256]; }; struct lcr_iface_instance { - unsigned int component_handle; + hdb_handle_t component_handle; void *context; void (*destructor) (void *context); }; @@ -112,7 +113,7 @@ static inline struct lcr_component_instance *lcr_comp_find ( { struct lcr_component_instance *instance; void *instance_p = NULL; - unsigned int component_handle = 0; + hdb_handle_t component_handle = 0; int i; /* @@ -143,7 +144,7 @@ static inline int lcr_lib_loaded ( { struct lcr_component_instance *instance; void *instance_p = NULL; - unsigned int component_handle = 0; + hdb_handle_t component_handle = 0; /* * Try to find interface in already loaded component @@ -420,7 +421,7 @@ found: static unsigned int lcr_initialized = 0; int lcr_ifact_reference ( - unsigned int *iface_handle, + hdb_handle_t *iface_handle, char *iface_name, int version, void **iface, @@ -486,7 +487,7 @@ found: return (0); } -int lcr_ifact_release (unsigned int handle) +int lcr_ifact_release (hdb_handle_t handle) { struct lcr_iface_instance *iface_instance; int res = 0; @@ -509,7 +510,7 @@ int lcr_ifact_release (unsigned int handle) void lcr_component_register (struct lcr_comp *comp) { struct lcr_component_instance *instance; - static unsigned int comp_handle; + static hdb_handle_t comp_handle; hdb_handle_create (&lcr_component_instance_database, sizeof (struct lcr_component_instance), diff --git a/lcr/test.c b/lcr/test.c index fd80b035..a5b7f45a 100644 --- a/lcr/test.c +++ b/lcr/test.c @@ -29,6 +29,7 @@ */ #include #include +#include #include struct iface { @@ -38,15 +39,15 @@ struct iface { }; int main (void) { - unsigned int a_ifact_handle_ver0; - unsigned int b_ifact_handle_ver0; + hdb_handle_t a_ifact_handle_ver0; + hdb_handle_t b_ifact_handle_ver0; struct iface *a_iface_ver0; struct iface *a_iface_ver1; void *a_iface_ver0_p; void *a_iface_ver1_p; - unsigned int a_ifact_handle_ver1; - unsigned int b_ifact_handle_ver1; + hdb_handle_t a_ifact_handle_ver1; + hdb_handle_t b_ifact_handle_ver1; struct iface *b_iface_ver0; struct iface *b_iface_ver1; void *b_iface_ver0_p; diff --git a/lib/confdb.c b/lib/confdb.c index 80521921..848f9666 100644 --- a/lib/confdb.c +++ b/lib/confdb.c @@ -56,9 +56,9 @@ each object_handle can have its own iterator */ struct iter_context { struct list_head list; - uint32_t parent_object_handle; - uint32_t find_handle; - uint32_t next_entry; + hdb_handle_t parent_object_handle; + hdb_handle_t find_handle; + hdb_handle_t next_entry; }; struct confdb_inst { @@ -85,7 +85,7 @@ static struct saHandleDatabase confdb_handle_t_db = { }; -static cs_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, hdb_handle_t find_handle); /* Safely tidy one iterator context list */ @@ -114,7 +114,7 @@ static void confdb_instance_destructor (void *instance) pthread_mutex_destroy (&confdb_inst->dispatch_mutex); } -static struct iter_context *find_iter_context(struct list_head *list, unsigned int object_handle) +static struct iter_context *find_iter_context(struct list_head *list, hdb_handle_t object_handle) { struct iter_context *context; struct list_head *iter; @@ -292,7 +292,6 @@ cs_error_t confdb_dispatch ( confdb_handle_t handle, cs_dispatch_flags_t dispatch_types) { - struct pollfd ufds; int timeout = -1; cs_error_t error; int cont = 1; /* always continue do loop except when set to 0 */ @@ -338,7 +337,6 @@ cs_error_t confdb_dispatch ( goto error_put; } - dispatch_avail = ufds.revents & POLLIN; if (dispatch_avail == 0 && dispatch_types == CONFDB_DISPATCH_ALL) { break; /* exit do while cont is 1 loop */ } else @@ -421,10 +419,10 @@ error_noput: cs_error_t confdb_object_create ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *object_name, int object_name_len, - unsigned int *object_handle) + hdb_handle_t *object_handle) { cs_error_t error; struct confdb_inst *confdb_inst; @@ -481,7 +479,7 @@ error_exit: cs_error_t confdb_object_destroy ( confdb_handle_t handle, - unsigned int object_handle) + hdb_handle_t object_handle) { cs_error_t error; struct confdb_inst *confdb_inst; @@ -533,8 +531,8 @@ error_exit: cs_error_t confdb_object_parent_get ( confdb_handle_t handle, - unsigned int object_handle, - unsigned int *parent_object_handle) + hdb_handle_t object_handle, + hdb_handle_t *parent_object_handle) { cs_error_t error; struct confdb_inst *confdb_inst; @@ -587,7 +585,7 @@ error_exit: static cs_error_t do_find_destroy( struct confdb_inst *confdb_inst, - unsigned int find_handle) + hdb_handle_t find_handle) { cs_error_t error; struct iovec iov; @@ -635,7 +633,7 @@ error_exit: cs_error_t confdb_object_find_destroy( confdb_handle_t handle, - unsigned int parent_object_handle) + hdb_handle_t parent_object_handle) { struct iter_context *context; cs_error_t error; @@ -659,7 +657,7 @@ cs_error_t confdb_object_find_destroy( cs_error_t confdb_object_iter_destroy( confdb_handle_t handle, - unsigned int parent_object_handle) + hdb_handle_t parent_object_handle) { struct iter_context *context; cs_error_t error; @@ -684,7 +682,7 @@ cs_error_t confdb_object_iter_destroy( cs_error_t confdb_key_create ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -746,7 +744,7 @@ error_exit: cs_error_t confdb_key_delete ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -808,7 +806,7 @@ error_exit: cs_error_t confdb_key_get ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -872,7 +870,7 @@ error_exit: cs_error_t confdb_key_increment ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value) @@ -934,7 +932,7 @@ error_exit: cs_error_t confdb_key_decrement ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value) @@ -996,7 +994,7 @@ error_exit: cs_error_t confdb_key_replace ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *old_value, @@ -1062,7 +1060,7 @@ error_exit: cs_error_t confdb_object_iter_start ( confdb_handle_t handle, - unsigned int object_handle) + hdb_handle_t object_handle) { struct confdb_inst *confdb_inst; cs_error_t error = CS_OK; @@ -1099,7 +1097,7 @@ ret: cs_error_t confdb_key_iter_start ( confdb_handle_t handle, - unsigned int object_handle) + hdb_handle_t object_handle) { struct confdb_inst *confdb_inst; cs_error_t error = CS_OK; @@ -1132,7 +1130,7 @@ ret: cs_error_t confdb_object_find_start ( confdb_handle_t handle, - unsigned int parent_object_handle) + hdb_handle_t parent_object_handle) { struct confdb_inst *confdb_inst; cs_error_t error = CS_OK; @@ -1168,10 +1166,10 @@ ret: cs_error_t confdb_object_find ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *object_name, int object_name_len, - unsigned int *object_handle) + hdb_handle_t *object_handle) { cs_error_t error; struct confdb_inst *confdb_inst; @@ -1241,8 +1239,8 @@ error_exit: cs_error_t confdb_object_iter ( confdb_handle_t handle, - unsigned int parent_object_handle, - unsigned int *object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t *object_handle, void *object_name, int *object_name_len) { @@ -1317,7 +1315,7 @@ error_exit: cs_error_t confdb_key_iter ( confdb_handle_t handle, - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int *key_name_len, void *value, @@ -1503,7 +1501,7 @@ error_exit: cs_error_t confdb_track_changes ( confdb_handle_t handle, - unsigned int object_handle, + hdb_handle_t object_handle, unsigned int flags) { cs_error_t error; diff --git a/lib/sa-confdb.c b/lib/sa-confdb.c index d350d705..48e372d3 100644 --- a/lib/sa-confdb.c +++ b/lib/sa-confdb.c @@ -60,7 +60,7 @@ static struct config_iface_ver0 *config_modules[128]; static int load_objdb() { - unsigned int objdb_handle; + hdb_handle_t objdb_handle; void *objdb_p; int res; @@ -88,8 +88,8 @@ static int load_config() char *config_iface; char *iface; int res; - unsigned int config_handle; - unsigned int config_version = 0; + hdb_handle_t config_handle; + hdb_handle_t config_version = 0; void *config_p; struct config_iface_ver0 *config; char *error_string; @@ -184,10 +184,10 @@ int confdb_sa_init (void) int confdb_sa_object_create ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *object_name, int object_name_len, - unsigned int *object_handle) + hdb_handle_t *object_handle) { return objdb->object_create(parent_object_handle, object_handle, @@ -195,20 +195,20 @@ int confdb_sa_object_create ( } int confdb_sa_object_destroy ( - unsigned int object_handle) + hdb_handle_t object_handle) { return objdb->object_destroy(object_handle); } int confdb_sa_object_parent_get ( - unsigned int object_handle, - unsigned int *parent_object_handle) + hdb_handle_t object_handle, + hdb_handle_t *parent_object_handle) { return objdb->object_parent_get(object_handle, parent_object_handle); } int confdb_sa_key_create ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -220,7 +220,7 @@ int confdb_sa_key_create ( } int confdb_sa_key_delete ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -232,7 +232,7 @@ int confdb_sa_key_delete ( } int confdb_sa_key_get ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, @@ -251,7 +251,7 @@ int confdb_sa_key_get ( } int confdb_sa_key_increment ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value) @@ -265,7 +265,7 @@ int confdb_sa_key_increment ( } int confdb_sa_key_decrement ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value) @@ -280,7 +280,7 @@ int confdb_sa_key_decrement ( int confdb_sa_key_replace ( - unsigned int parent_object_handle, + hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *old_value, @@ -322,9 +322,9 @@ int confdb_sa_reload ( } int confdb_sa_object_find ( - unsigned int parent_object_handle, - unsigned int *find_handle, - unsigned int *object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t *find_handle, + hdb_handle_t *object_handle, void *object_name, int *object_name_len, int copy_name) @@ -348,8 +348,8 @@ int confdb_sa_object_find ( } int confdb_sa_key_iter ( - unsigned int parent_object_handle, - unsigned int start_pos, + hdb_handle_t parent_object_handle, + hdb_handle_t start_pos, void *key_name, int *key_name_len, void *value, @@ -370,7 +370,7 @@ int confdb_sa_key_iter ( return res; } -int confdb_sa_find_destroy(unsigned int find_handle) +int confdb_sa_find_destroy(hdb_handle_t find_handle) { return objdb->object_find_destroy(find_handle); } diff --git a/lib/sa-confdb.h b/lib/sa-confdb.h index da81c069..67397b28 100644 --- a/lib/sa-confdb.h +++ b/lib/sa-confdb.h @@ -33,17 +33,17 @@ */ extern int confdb_sa_init(void); -extern int confdb_sa_object_create(unsigned int parent_object_handle, void *object_name, int object_name_len, unsigned int *object_handle); -extern int confdb_sa_object_destroy(unsigned int object_handle); -extern int confdb_sa_object_parent_get(unsigned int object_handle, unsigned int *parent_object_handle); -extern int confdb_sa_key_create(unsigned int parent_object_handle, void *key_name, int key_name_len, void *value, int value_len); -extern int confdb_sa_key_delete(unsigned int parent_object_handle, void *key_name, int key_name_len, void *value, int value_len); -extern int confdb_sa_key_get(unsigned int parent_object_handle, void *key_name, int key_name_len, void *value, int *value_len); -extern int confdb_sa_key_replace(unsigned int parent_object_handle, void *key_name, int key_name_len, void *old_value, int old_value_len, void *new_value, int new_value_len); -extern int confdb_sa_object_find(unsigned int parent_object_handle, unsigned int *find_handle, unsigned int *object_handle, void *object_name, int *object_name_len, int copy_name); -extern int confdb_sa_key_iter(unsigned int parent_object_handle, unsigned int start_pos, void *key_name, int *key_name_len, void *value, int *value_len); -extern int confdb_sa_key_increment(unsigned int parent_object_handle, void *key_name, int key_name_len, unsigned int *value); -extern int confdb_sa_key_decrement(unsigned int parent_object_handle, void *key_name, int key_name_len, unsigned int *value); -extern int confdb_sa_find_destroy(unsigned int find_handle); +extern int confdb_sa_object_create(hdb_handle_t parent_object_handle, void *object_name, int object_name_len, hdb_handle_t *object_handle); +extern int confdb_sa_object_destroy(hdb_handle_t object_handle); +extern int confdb_sa_object_parent_get(hdb_handle_t object_handle, hdb_handle_t *parent_object_handle); +extern int confdb_sa_key_create(hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, int value_len); +extern int confdb_sa_key_delete(hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, int value_len); +extern int confdb_sa_key_get(hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *value, int *value_len); +extern int confdb_sa_key_replace(hdb_handle_t parent_object_handle, void *key_name, int key_name_len, void *old_value, int old_value_len, void *new_value, int new_value_len); +extern int confdb_sa_object_find(hdb_handle_t parent_object_handle, hdb_handle_t *find_handle, hdb_handle_t *object_handle, void *object_name, int *object_name_len, int copy_name); +extern int confdb_sa_key_iter(hdb_handle_t parent_object_handle, hdb_handle_t start_pos, void *key_name, int *key_name_len, void *value, int *value_len); +extern int confdb_sa_key_increment(hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value); +extern int confdb_sa_key_decrement(hdb_handle_t parent_object_handle, void *key_name, int key_name_len, unsigned int *value); +extern int confdb_sa_find_destroy(hdb_handle_t find_handle); extern int confdb_sa_write(char *error_text); extern int confdb_sa_reload(int flush, char *error_text); diff --git a/services/cfg.c b/services/cfg.c index 9540aaa4..0bf0e598 100644 --- a/services/cfg.c +++ b/services/cfg.c @@ -912,8 +912,8 @@ static void message_handler_req_lib_cfg_tryshutdown ( return; } else { - unsigned int cfg_handle; - unsigned int find_handle; + hdb_handle_t cfg_handle; + hdb_handle_t find_handle; char *timeout_str; unsigned int shutdown_timeout = DEFAULT_SHUTDOWN_TIMEOUT; diff --git a/services/confdb.c b/services/confdb.c index 0c779dec..058e5ad2 100644 --- a/services/confdb.c +++ b/services/confdb.c @@ -82,21 +82,26 @@ static void message_handler_req_lib_confdb_reload (void *conn, void *message); static void message_handler_req_lib_confdb_track_start (void *conn, void *message); static void message_handler_req_lib_confdb_track_stop (void *conn, void *message); -static void confdb_notify_lib_of_key_change(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, - void *object_name_pt, int object_name_len, - void *key_name_pt, int key_name_len, - void *key_value_pt, int key_value_len, - void *priv_data_pt); +static void confdb_notify_lib_of_key_change( + object_change_type_t change_type, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, + void *object_name_pt, int object_name_len, + void *key_name_pt, int key_name_len, + void *key_value_pt, int key_value_len, + void *priv_data_pt); + +static void confdb_notify_lib_of_new_object( + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, + uint8_t *name_pt, int name_len, + void *priv_data_pt); + +static void confdb_notify_lib_of_destroyed_object( + hdb_handle_t parent_object_handle, + uint8_t *name_pt, int name_len, + void *priv_data_pt); -static void confdb_notify_lib_of_new_object(unsigned int parent_object_handle, - unsigned int object_handle, - uint8_t *name_pt, int name_len, - void *priv_data_pt); -static void confdb_notify_lib_of_destroyed_object(unsigned int parent_object_handle, - uint8_t *name_pt, int name_len, - void *priv_data_pt); /* * Library Handler Definition */ @@ -289,7 +294,7 @@ 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; + hdb_handle_t object_handle; int ret = CS_OK; if (api->object_create(req_lib_confdb_object_create->parent_object_handle, @@ -460,7 +465,7 @@ 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; + hdb_handle_t object_handle; int ret = CS_OK; if (api->object_parent_get(req_lib_confdb_object_parent_get->object_handle, @@ -613,8 +618,8 @@ static void message_handler_req_lib_confdb_reload (void *conn, void *message) } static void confdb_notify_lib_of_key_change(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, void *object_name_pt, int object_name_len, void *key_name_pt, int key_name_len, void *key_value_pt, int key_value_len, @@ -642,8 +647,8 @@ static void confdb_notify_lib_of_key_change(object_change_type_t change_type, api->ipc_dispatch_send(priv_data_pt, &res, sizeof(res)); } -static void confdb_notify_lib_of_new_object(unsigned int parent_object_handle, - unsigned int object_handle, +static void confdb_notify_lib_of_new_object(hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, uint8_t *name_pt, int name_len, void *priv_data_pt) { @@ -660,7 +665,7 @@ static void confdb_notify_lib_of_new_object(unsigned int parent_object_handle, api->ipc_dispatch_send(priv_data_pt, &res, sizeof(res)); } -static void confdb_notify_lib_of_destroyed_object(unsigned int parent_object_handle, +static void confdb_notify_lib_of_destroyed_object(hdb_handle_t parent_object_handle, uint8_t *name_pt, int name_len, void *priv_data_pt) { diff --git a/services/testquorum.c b/services/testquorum.c index 6372b6e3..2fe83145 100644 --- a/services/testquorum.c +++ b/services/testquorum.c @@ -101,8 +101,8 @@ __attribute__ ((constructor)) static void test_quorum_comp_register (void) { static quorum_set_quorate_fn_t set_quorum; static void key_change_notify(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, void *object_name_pt, int object_name_len, void *key_name_pt, int key_len, void *key_value_pt, int key_value_len, @@ -128,8 +128,8 @@ static void test_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t report) { - unsigned int find_handle; - unsigned int quorum_handle = 0; + hdb_handle_t find_handle; + hdb_handle_t quorum_handle = 0; set_quorum = report; diff --git a/services/votequorum.c b/services/votequorum.c index f40d9531..6f274af1 100644 --- a/services/votequorum.c +++ b/services/votequorum.c @@ -139,7 +139,7 @@ static struct list_head trackers_list; static unsigned int quorum_members[PROCESSOR_COUNT_MAX+1]; static int quorum_members_entries = 0; static struct memb_ring_id quorum_ringid; -static cs_tpg_handle group_handle; +static hdb_handle_t group_handle; #define max(a,b) (((a) > (b)) ? (a) : (b)) static struct cluster_node *find_node_by_nodeid(int nodeid); @@ -221,7 +221,7 @@ static int quorum_exec_send_nodeinfo(void); static int quorum_exec_send_reconfigure(int param, int nodeid, int value); static int quorum_exec_send_killnode(int nodeid, unsigned int reason); -static void add_votequorum_config_notification(unsigned int quorum_object_handle); +static void add_votequorum_config_notification(hdb_handle_t quorum_object_handle); /* @@ -516,8 +516,8 @@ static void read_quorum_config(unsigned int quorum_handle) static int votequorum_exec_init_fn (struct corosync_api_v1 *api) { - unsigned int object_handle; - unsigned int find_handle; + hdb_handle_t object_handle; + hdb_handle_t find_handle; ENTER(); @@ -1560,7 +1560,7 @@ static char *kill_reason(int reason) } } -static void reread_config(unsigned int object_handle) +static void reread_config(hdb_handle_t object_handle) { unsigned int old_votes; unsigned int old_expected; @@ -1585,8 +1585,8 @@ static void reread_config(unsigned int object_handle) } static void quorum_key_change_notify(object_change_type_t change_type, - unsigned int parent_object_handle, - unsigned int object_handle, + hdb_handle_t parent_object_handle, + hdb_handle_t object_handle, void *object_name_pt, int object_name_len, void *key_name_pt, int key_len, void *key_value_pt, int key_value_len, @@ -1620,8 +1620,8 @@ static void votequorum_objdb_reload_notify( if (type == OBJDB_RELOAD_NOTIFY_END || type == OBJDB_RELOAD_NOTIFY_FAILED) { - unsigned int find_handle; - unsigned int object_handle; + hdb_handle_t find_handle; + hdb_handle_t object_handle; corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle); if (corosync_api->object_find_next(find_handle, &object_handle) == 0) { @@ -1637,7 +1637,7 @@ static void votequorum_objdb_reload_notify( static void add_votequorum_config_notification( - unsigned int quorum_object_handle) + hdb_handle_t quorum_object_handle) { corosync_api->object_track_start(quorum_object_handle, diff --git a/test/testconfdb.c b/test/testconfdb.c index 25e1c746..dbbee413 100644 --- a/test/testconfdb.c +++ b/test/testconfdb.c @@ -56,7 +56,7 @@ confdb_callbacks_t callbacks = { /* Recursively dump the object tree */ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object_handle, int depth) { - unsigned int object_handle; + hdb_handle_t object_handle; char object_name[1024]; int object_name_len; char key_name[1024]; @@ -89,18 +89,18 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object } while ( (res = confdb_object_iter(handle, parent_object_handle, &object_handle, object_name, &object_name_len)) == CS_OK) { - unsigned int parent; + hdb_handle_t parent; res = confdb_object_parent_get(handle, object_handle, &parent); if (res != CS_OK) { - printf( "error getting parent for object %d: %d\n", object_handle, res); + printf( "error getting parent for object %lld: %d\n", object_handle, res); return; } for (i=0; i %s\n", name_pt); } static void tail_object_deleted(confdb_handle_t handle, - unsigned int parent_object_handle, - uint8_t *name_pt, - int name_len) + hdb_handle_t parent_object_handle, + uint8_t *name_pt, + int name_len) { name_pt[name_len] = '\0'; @@ -487,7 +487,7 @@ static void listen_for_object_changes(confdb_handle_t handle) static void track_object(confdb_handle_t handle, char * name_pt) { cs_error_t res; - uint32_t obj_handle; + hdb_handle_t obj_handle; res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle); @@ -519,7 +519,7 @@ static void stop_tracking(confdb_handle_t handle) static void delete_object(confdb_handle_t handle, char * name_pt) { cs_error_t res; - uint32_t obj_handle; + hdb_handle_t obj_handle; res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle); if (res == CS_OK) {