After merging in master (to get some needed fixes) convert the new udpu code to use libqb.
Signed-off-by: Angus Salkeld <[email protected]> --- exec/Makefile.am | 2 +- exec/totemudpu.c | 34 ++++++++++++++++++++-------------- exec/totemudpu.h | 3 ++- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/exec/Makefile.am b/exec/Makefile.am index 9447286..658b1df 100644 --- a/exec/Makefile.am +++ b/exec/Makefile.am @@ -68,7 +68,7 @@ SHARED_LIBS_SO = $(SHARED_LIBS:%.so.$(SONAME)=%.so) SHARED_LIBS_SO_TWO = $(SHARED_LIBS:%.so.$(SONAME)=%.so.$(SOMAJOR)) noinst_HEADERS = apidef.h crypto.h mainconfig.h main.h \ - quorum.h service.h sync.h timer.h tlist.h \ + quorum.h service.h sync.h timer.h \ totemconfig.h totemmrp.h totemnet.h totemudp.h \ totemudpu.h totemiba.h totemrrp.h totemsrp.h util.h \ vsf.h schedwrk.h evil.h syncv2.h fsm.h diff --git a/exec/totemudpu.c b/exec/totemudpu.c index 3fad618..eab79e8 100644 --- a/exec/totemudpu.c +++ b/exec/totemudpu.c @@ -57,11 +57,12 @@ #include <sys/poll.h> #include <limits.h> +#include <qb/qbloop.h> + #include <corosync/sq.h> #include <corosync/list.h> #include <corosync/hdb.h> #include <corosync/swab.h> -#include <corosync/totem/coropoll.h> #define LOGSYS_UTILS_ONLY 1 #include <corosync/engine/logsys.h> #include "totemudpu.h" @@ -114,7 +115,7 @@ struct totemudpu_instance { unsigned int totemudpu_private_key_len; - hdb_handle_t totemudpu_poll_handle; + qb_loop_t *totemudpu_poll_handle; struct totem_interface *totem_interface; @@ -182,7 +183,7 @@ struct totemudpu_instance { int firstrun; - poll_timer_handle timer_netif_check_timeout; + qb_loop_timer_handle timer_netif_check_timeout; unsigned int my_memb_entries; @@ -1050,7 +1051,7 @@ int totemudpu_finalize ( if (instance->token_socket > 0) { close (instance->token_socket); - poll_dispatch_delete (instance->totemudpu_poll_handle, + qb_loop_poll_del (instance->totemudpu_poll_handle, instance->token_socket); } @@ -1058,7 +1059,6 @@ int totemudpu_finalize ( } static int net_deliver_fn ( - hdb_handle_t handle, int fd, int revents, void *data) @@ -1190,7 +1190,8 @@ static void timer_function_netif_check_timeout ( instance->netif_bind_state == BIND_STATE_REGULAR && interface_up == 1)) { - poll_timer_add (instance->totemudpu_poll_handle, + qb_loop_timer_add (instance->totemudpu_poll_handle, + QB_LOOP_MED, instance->totem_config->downcheck_timeout, (void *)instance, timer_function_netif_check_timeout, @@ -1204,7 +1205,7 @@ static void timer_function_netif_check_timeout ( if (instance->token_socket > 0) { close (instance->token_socket); - poll_dispatch_delete (instance->totemudpu_poll_handle, + qb_loop_poll_del (instance->totemudpu_poll_handle, instance->token_socket); } @@ -1218,7 +1219,8 @@ static void timer_function_netif_check_timeout ( /* * Add a timer to retry building interfaces and request memb_gather_enter */ - poll_timer_add (instance->totemudpu_poll_handle, + qb_loop_timer_add (instance->totemudpu_poll_handle, + QB_LOOP_MED, instance->totem_config->downcheck_timeout, (void *)instance, timer_function_netif_check_timeout, @@ -1237,8 +1239,9 @@ static void timer_function_netif_check_timeout ( bind_address, &instance->totem_interface->boundto); - poll_dispatch_add ( + qb_loop_poll_add ( instance->totemudpu_poll_handle, + QB_LOOP_MED, instance->token_socket, POLLIN, instance, net_deliver_fn); @@ -1259,7 +1262,8 @@ static void timer_function_netif_check_timeout ( * Add a timer to check for interface going down in single membership */ if (instance->my_memb_entries == 1) { - poll_timer_add (instance->totemudpu_poll_handle, + qb_loop_timer_add (instance->totemudpu_poll_handle, + QB_LOOP_MED, instance->totem_config->downcheck_timeout, (void *)instance, timer_function_netif_check_timeout, @@ -1414,7 +1418,7 @@ static int totemudpu_build_sockets ( * Create an instance */ int totemudpu_initialize ( - hdb_handle_t poll_handle, + qb_loop_t *poll_handle, void **udpu_context, struct totem_config *totem_config, int interface_no, @@ -1487,7 +1491,8 @@ int totemudpu_initialize ( * RRP layer isn't ready to receive message because it hasn't * initialized yet. Add short timer to check the interfaces. */ - poll_timer_add (instance->totemudpu_poll_handle, + qb_loop_timer_add (instance->totemudpu_poll_handle, + QB_LOOP_MED, 100, (void *)instance, timer_function_netif_check_timeout, @@ -1505,10 +1510,11 @@ int totemudpu_processor_count_set ( int res = 0; instance->my_memb_entries = processor_count; - poll_timer_delete (instance->totemudpu_poll_handle, + qb_loop_timer_del (instance->totemudpu_poll_handle, instance->timer_netif_check_timeout); if (processor_count == 1) { - poll_timer_add (instance->totemudpu_poll_handle, + qb_loop_timer_add (instance->totemudpu_poll_handle, + QB_LOOP_MED, instance->totem_config->downcheck_timeout, (void *)instance, timer_function_netif_check_timeout, diff --git a/exec/totemudpu.h b/exec/totemudpu.h index 2dcad24..b638022 100644 --- a/exec/totemudpu.h +++ b/exec/totemudpu.h @@ -38,6 +38,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <corosync/hdb.h> +#include <qb/qbloop.h> #include <corosync/totem/totem.h> @@ -45,7 +46,7 @@ * Create an instance */ extern int totemudpu_initialize ( - hdb_handle_t poll_handle, + qb_loop_t *poll_handle, void **udpu_context, struct totem_config *totem_config, int interface_no, -- 1.7.3.1 _______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
