Parcourir la source

libqb: make timer api a wrapper around qb_loop timers.

- change timeout value to nano seconds
- fix timer handles (don't alloc on stack)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Angus Salkeld il y a 15 ans
Parent
commit
f717bc60e1

+ 1 - 4
README.devmap

@@ -289,10 +289,7 @@ exec/sync.{c|h}
 	The synchronization service implementation.
 
 exec/timer.{c|h}
-	Threaded based timer service.
-
-exec/tlist.h
-	Timer list used to expire timers.
+	Threaded based timer service (deprecated - use qb_loop_timer).
 
 exec/totemconfig.{c.h}
 	The totem configuration configurator from data parsed with aisparser

+ 1 - 1
cts/agents/cpg_test_agent.c

@@ -327,7 +327,7 @@ static void send_some_more_messages_later (void)
 	qb_loop_timer_add (
 		ta_poll_handle_get(),
 		QB_LOOP_MED,
-		300, NULL,
+		300*QB_TIME_NS_IN_MSEC, NULL,
 		send_some_more_messages,
 		&more_messages_timer_handle);
 }

+ 4 - 4
exec/Makefile.am

@@ -68,10 +68,10 @@ 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 tsafe.h \
-			  quorum.h service.h sync.h timer.h tlist.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
+			  quorum.h service.h sync.h timer.h totemconfig.h \
+			  totemmrp.h totemnet.h totemudp.h totemiba.h totemrrp.h \
+			  totemudpu.h totemsrp.h util.h vsf.h wthread.h schedwrk.h \
+			  evil.h syncv2.h fsm.h
 
 EXTRA_DIST		= $(LCRSO_SRC)
 

+ 5 - 2
exec/apidef.c

@@ -37,13 +37,16 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <qb/qbutil.h>
+#include <qb/qbloop.h>
+#include <qb/qbipcs.h>
+
 #include <corosync/corotypes.h>
 #include <corosync/lcr/lcr_ifact.h>
 #include <corosync/totem/totempg.h>
 #include <corosync/totem/totemip.h>
 #include <corosync/totem/totem.h>
 #include <corosync/engine/logsys.h>
-#include <qb/qbipcs.h>
 #include "util.h"
 #include "timer.h"
 #include "sync.h"
@@ -96,7 +99,7 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = {
 	.timer_add_duration = corosync_timer_add_duration,
 	.timer_add_absolute = corosync_timer_add_absolute,
 	.timer_delete = corosync_timer_delete,
-	.timer_time_get = corosync_timer_time_get,
+	.timer_time_get = cs_timer_time_get,
 	.timer_expire_time_get = corosync_timer_expire_time_get,
 	.ipc_source_set = message_source_set,
 	.ipc_source_is_local = message_source_is_local,

+ 8 - 8
exec/ipc_glue.c

@@ -522,24 +522,24 @@ static int32_t cs_ipcs_msg_process(qb_ipcs_connection_t *c,
 
 static int32_t cs_ipcs_job_add(enum qb_loop_priority p,	void *data, qb_loop_job_dispatch_fn fn)
 {
-	return qb_loop_job_add(corosync_poll_handle_get(), p, data, fn);
+	return qb_loop_job_add(cs_poll_handle_get(), p, data, fn);
 }
 
 static int32_t cs_ipcs_dispatch_add(enum qb_loop_priority p, int32_t fd, int32_t events,
 	void *data, qb_ipcs_dispatch_fn_t fn)
 {
-	return qb_loop_poll_add(corosync_poll_handle_get(), p, fd, events, data, fn);
+	return qb_loop_poll_add(cs_poll_handle_get(), p, fd, events, data, fn);
 }
 
 static int32_t cs_ipcs_dispatch_mod(enum qb_loop_priority p, int32_t fd, int32_t events,
 	void *data, qb_ipcs_dispatch_fn_t fn)
 {
-	return qb_loop_poll_mod(corosync_poll_handle_get(), p, fd, events, data, fn);
+	return qb_loop_poll_mod(cs_poll_handle_get(), p, fd, events, data, fn);
 }
 
 static int32_t cs_ipcs_dispatch_del(int32_t fd)
 {
-	return qb_loop_poll_del(corosync_poll_handle_get(), fd);
+	return qb_loop_poll_del(cs_poll_handle_get(), fd);
 }
 
 static void cs_ipcs_low_fds_event(int32_t not_enough, int32_t fds_available)
@@ -560,11 +560,11 @@ int32_t cs_ipcs_q_level_get(void)
 	return ipc_fc_totem_queue_level;
 }
 
+static qb_loop_timer_handle ipcs_check_for_flow_control_timer;
 static void cs_ipcs_check_for_flow_control(void)
 {
 	int32_t i;
 	int32_t fc_enabled;
-	qb_loop_timer_handle tm;
 
 	for (i = 0; i < SERVICE_HANDLER_MAXIMUM_COUNT; i++) {
 		if (ais_service[i] == NULL) {
@@ -585,8 +585,8 @@ static void cs_ipcs_check_for_flow_control(void)
 		if (fc_enabled) {
 			qb_ipcs_request_rate_limit(ipcs_mapper[i].inst, QB_IPCS_RATE_OFF);
 
-			qb_loop_timer_add(corosync_poll_handle_get(), QB_LOOP_MED, 1,
-			       NULL, corosync_recheck_the_q_level, &tm);
+			qb_loop_timer_add(cs_poll_handle_get(), QB_LOOP_MED, 1*QB_TIME_NS_IN_MSEC,
+			       NULL, corosync_recheck_the_q_level, &ipcs_check_for_flow_control_timer);
 		} else if (ipc_fc_totem_queue_level == TOTEM_Q_LEVEL_LOW) {
 			qb_ipcs_request_rate_limit(ipcs_mapper[i].inst, QB_IPCS_RATE_FAST);
 		} else if (ipc_fc_totem_queue_level == TOTEM_Q_LEVEL_GOOD) {
@@ -710,7 +710,7 @@ void cs_ipcs_init(void)
 
 	api = apidef_get ();
 
-	qb_loop_poll_low_fds_event_set(corosync_poll_handle_get(), cs_ipcs_low_fds_event);
+	qb_loop_poll_low_fds_event_set(cs_poll_handle_get(), cs_ipcs_low_fds_event);
 
 	ipc_subsys_id = _logsys_subsys_create ("IPC");
 	if (ipc_subsys_id < 0) {

+ 3 - 9
exec/main.c

@@ -969,14 +969,13 @@ int main_mcast (
 	return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee));
 }
 
+static qb_loop_timer_handle recheck_the_q_level_timer;
 void corosync_recheck_the_q_level(void *data)
 {
-	qb_loop_timer_handle tm;
-
 	totempg_check_q_level(corosync_group_handle);
 	if (cs_ipcs_q_level_get() == TOTEM_Q_LEVEL_CRITICAL) {
-		qb_loop_timer_add(corosync_poll_handle_get(), QB_LOOP_MED, 1,
-			NULL, corosync_recheck_the_q_level, &tm);
+		qb_loop_timer_add(cs_poll_handle_get(), QB_LOOP_MED, 1*QB_TIME_NS_IN_MSEC,
+			NULL, corosync_recheck_the_q_level, &recheck_the_q_level_timer);
 	}
 }
 
@@ -1530,11 +1529,6 @@ int main (int argc, char **argv, char **envp)
 	/* callthis after our fork() */
 	tsafe_init (envp);
 
-	corosync_timer_init (
-		serialize_lock,
-		serialize_unlock,
-		sched_priority);
-
 	corosync_poll_handle = qb_loop_create ();
 
 	/*

+ 32 - 237
exec/timer.c

@@ -35,267 +35,62 @@
 
 #include <config.h>
 
-#include <pthread.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#include <sys/poll.h>
-#include <sys/uio.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <sched.h>
-#include <time.h>
-
-#include <corosync/swab.h>
-#include <corosync/corotypes.h>
-#include <corosync/list.h>
-#include <corosync/lcr/lcr_ifact.h>
-#include <qb/qbloop.h>
-#include <corosync/totem/totempg.h>
-#include <corosync/engine/objdb.h>
-#include <corosync/engine/config.h>
-#define LOG_SERVICE LOG_SERVICE_IPC
-#include <corosync/engine/logsys.h>
-
-#include "poll.h"
-#include "totemsrp.h"
-#include "mainconfig.h"
-#include "totemconfig.h"
-#include "main.h"
-#include "sync.h"
-#include "tlist.h"
-#include "util.h"
 #include "timer.h"
-
-#define SERVER_BACKLOG 5
-
-static pthread_mutex_t timer_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static pthread_t expiry_thread;
-
-static struct timerlist timers_timerlist;
-
-static int sched_priority = 0;
-
-static void (*timer_serialize_lock_fn) (void);
-
-static void (*timer_serialize_unlock_fn) (void);
-
-static void *prioritized_timer_thread (void *data);
-
-extern void pthread_exit(void *) __attribute__((noreturn));
-
-/*
- * This thread runs at the highest priority to run system wide timers
- */
-static void *prioritized_timer_thread (void *data)
-{
-	int fds;
-	unsigned long long timeout;
-
-#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
-	if (sched_priority != 0) {
-		struct sched_param sched_param;
-
-		sched_param.sched_priority = sched_priority;
-		pthread_setschedparam (expiry_thread, SCHED_RR, &sched_param);
-	}
-#endif
-
-	pthread_mutex_unlock (&timer_mutex);
-	for (;;) {
-		timer_serialize_lock_fn ();
-		timeout = timerlist_msec_duration_to_expire (&timers_timerlist);
-		if (timeout != -1 && timeout > 0xFFFFFFFF) {
-			timeout = 0xFFFFFFFE;
-		}
-		timer_serialize_unlock_fn ();
-		fds = poll (NULL, 0, timeout);
-		if (fds < 0 && errno == EINTR) {
-			continue;
-		}
-		if (fds < 0) {
-			return NULL;
-		}
-		pthread_mutex_lock (&timer_mutex);
-		timer_serialize_lock_fn ();
-
-		timerlist_expire (&timers_timerlist);
-
-		timer_serialize_unlock_fn ();
-		pthread_mutex_unlock (&timer_mutex);
-	}
-}
-
-static void sigusr1_handler (int num) {
-#ifdef COROSYNC_SOLARIS
-	/* Rearm the signal facility */
-        signal (num, sigusr1_handler);
-#endif
-}
-
-int corosync_timer_init (
-        void (*serialize_lock_fn) (void),
-        void (*serialize_unlock_fn) (void),
-	int sched_priority_in)
-{
-	int res;
-	pthread_attr_t thread_attr;
-
-	timer_serialize_lock_fn = serialize_lock_fn;
-	timer_serialize_unlock_fn = serialize_unlock_fn;
-	sched_priority = sched_priority_in;
-
-	timerlist_init (&timers_timerlist);
-
-	signal (SIGUSR1, sigusr1_handler);
-
-	pthread_mutex_lock (&timer_mutex);
-	pthread_attr_init (&thread_attr);
-	pthread_attr_setstacksize (&thread_attr, 100000);
-	pthread_attr_setdetachstate (&thread_attr, PTHREAD_CREATE_DETACHED);
-	res = pthread_create (&expiry_thread, &thread_attr,
-		prioritized_timer_thread, NULL);
-	pthread_attr_destroy (&thread_attr);
-
-	return (res);
-}
+#include "main.h"
+#include <qb/qbdefs.h>
+#include <qb/qbutil.h>
 
 int corosync_timer_add_absolute (
-	unsigned long long nanosec_from_epoch,
-	void *data,
-	void (*timer_fn) (void *data),
-	timer_handle *handle)
+		unsigned long long nanosec_from_epoch,
+		void *data,
+		void (*timer_fn) (void *data),
+		corosync_timer_handle_t *handle)
 {
-	int res;
-	int unlock;
-
-	if (pthread_equal (pthread_self(), expiry_thread) != 0) {
-		unlock = 0;
-	} else {
-		unlock = 1;
-		pthread_mutex_lock (&timer_mutex);
-	}
-
-	res = timerlist_add_absolute (
-		&timers_timerlist,
-		timer_fn,
-		data,
-		nanosec_from_epoch,
-		handle);
-
-	if (unlock) {
-		pthread_mutex_unlock (&timer_mutex);
-	}
-
-	pthread_kill (expiry_thread, SIGUSR1);
-
-	return (res);
+	uint64_t expire_time = nanosec_from_epoch - qb_util_nano_current_get();
+	return qb_loop_timer_add(cs_poll_handle_get(),
+				QB_LOOP_MED,
+				 expire_time,
+				 data,
+				 timer_fn,
+				 handle);
 }
 
 int corosync_timer_add_duration (
 	unsigned long long nanosec_duration,
 	void *data,
 	void (*timer_fn) (void *data),
-	timer_handle *handle)
+	corosync_timer_handle_t *handle)
 {
-	int res;
-	int unlock;
-
-	if (pthread_equal (pthread_self(), expiry_thread) != 0) {
-		unlock = 0;
-	} else {
-		unlock = 1;
-		pthread_mutex_lock (&timer_mutex);
-	}
-
-	res = timerlist_add_duration (
-		&timers_timerlist,
-		timer_fn,
-		data,
-		nanosec_duration,
-		handle);
-
-	if (unlock) {
-		pthread_mutex_unlock (&timer_mutex);
-	}
-
-	pthread_kill (expiry_thread, SIGUSR1);
-
-	return (res);
+	return qb_loop_timer_add(cs_poll_handle_get(),
+				QB_LOOP_MED,
+				 nanosec_duration,
+				 data,
+				 timer_fn,
+				 handle);
 }
 
 void corosync_timer_delete (
-	timer_handle th)
-{
-	int unlock;
-
-	if (th == 0) {
-		return;
-	}
-
-	if (pthread_equal (pthread_self(), expiry_thread) != 0) {
-		unlock = 0;
-	} else {
-		unlock = 1;
-		pthread_mutex_lock (&timer_mutex);
-	}
-
-	timerlist_del (&timers_timerlist, th);
-
-	if (unlock) {
-		pthread_mutex_unlock (&timer_mutex);
-	}
-}
-
-void corosync_timer_lock (void)
+	corosync_timer_handle_t th)
 {
-	pthread_mutex_lock (&timer_mutex);
-}
-
-void corosync_timer_unlock (void)
-{
-	pthread_mutex_unlock (&timer_mutex);
-}
-
-unsigned long long corosync_timer_time_get (void)
-{
-	return (timerlist_nano_from_epoch());
+	qb_loop_timer_del(cs_poll_handle_get(), th);
 }
 
 unsigned long long corosync_timer_expire_time_get (
-	timer_handle th)
+	corosync_timer_handle_t th)
 {
-	int unlock;
-	unsigned long long expire;
+	uint64_t expire;
 
 	if (th == 0) {
 		return (0);
 	}
 
-	if (pthread_equal (pthread_self(), expiry_thread) != 0) {
-		unlock = 0;
-	} else {
-		unlock = 1;
-		pthread_mutex_lock (&timer_mutex);
-	}
-
-	expire = timerlist_expire_time (&timers_timerlist, th);
-
-	if (unlock) {
-		pthread_mutex_unlock (&timer_mutex);
-	}
+	expire = qb_loop_timer_expire_time_get(cs_poll_handle_get(), th);
 
 	return (expire);
 }
+
+unsigned long long cs_timer_time_get (void)
+{
+	return qb_util_nano_from_epoch_get();
+}
+

+ 9 - 16
exec/timer.h

@@ -35,35 +35,28 @@
 #ifndef TIMER_H_DEFINED
 #define TIMER_H_DEFINED
 
-typedef void * corosync_timer_handle;
+#include <stdint.h>
+#include <time.h>
+#include <qb/qbloop.h>
 
-extern int corosync_timer_init (
-        void (*serialize_lock) (void),
-        void (*serialize_unlock) (void),
-	int sched_priority);
+typedef qb_loop_timer_handle corosync_timer_handle_t;
 
 extern int corosync_timer_add_duration (
 	unsigned long long nanosec_duration,
 	void *data,
 	void (*timer_fn) (void *data),
-	corosync_timer_handle *handle);
+	corosync_timer_handle_t *handle);
 
 extern int corosync_timer_add_absolute (
 	unsigned long long nanoseconds_from_epoch,
 	void *data,
 	void (*timer_fn) (void *data),
-	corosync_timer_handle *handle);
+	corosync_timer_handle_t *handle);
 
-extern void corosync_timer_delete (corosync_timer_handle handle);
+extern void corosync_timer_delete (corosync_timer_handle_t handle);
 
-extern void corosync_timer_delete_data (corosync_timer_handle handle);
+extern unsigned long long corosync_timer_expire_time_get (corosync_timer_handle_t handle);
 
-extern void corosync_timer_lock (void);
-
-extern void corosync_timer_unlock (void);
-
-extern unsigned long long corosync_timer_time_get (void);
-
-extern unsigned long long corosync_timer_expire_time_get (corosync_timer_handle handle);
+extern unsigned long long cs_timer_time_get (void);
 
 #endif /* TIMER_H_DEFINED */

+ 0 - 318
exec/tlist.h

@@ -1,318 +0,0 @@
-/*
- * Copyright (c) 2003-2004 MontaVista Software, Inc.
- * Copyright (c) 2006-2007, 2009 Red Hat, Inc.
- *
- * All rights reserved.
- *
- * Author: Steven Dake (sdake@redhat.com)
- *
- * This software licensed under BSD license, the text of which follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * - Neither the name of the MontaVista Software, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived from this
- *   software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TLIST_H_DEFINED
-#define TLIST_H_DEFINED
-
-#include <sys/time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/param.h>
-#include <unistd.h>
-
-#include <corosync/list.h>
-
-#ifndef HZ
-	#define HZ 100  /* 10ms */
-#endif
-
-#ifndef TIMER_HANDLE
-typedef void * timer_handle;
-#define TIMER_HANDLE
-#endif
-
-#define TIMERLIST_MS_IN_SEC   1000ULL
-#define TIMERLIST_US_IN_SEC   1000000ULL
-#define TIMERLIST_NS_IN_SEC   1000000000ULL
-#define TIMERLIST_US_IN_MSEC  1000ULL
-#define TIMERLIST_NS_IN_MSEC  1000000ULL
-#define TIMERLIST_NS_IN_USEC  1000ULL
-
-struct timerlist {
-	struct list_head timer_head;
-	struct list_head *timer_iter;
-};
-
-struct timerlist_timer {
-	struct list_head list;
-	unsigned long long expire_time;
-	int is_absolute_timer;
-	void (*timer_fn)(void *data);
-	void *data;
-	timer_handle handle_addr;
-};
-
-static inline void timerlist_init (struct timerlist *timerlist)
-{
-	list_init (&timerlist->timer_head);
-}
-
-static inline unsigned long long timerlist_nano_from_epoch (void)
-{
-	unsigned long long nano_from_epoch;
-	struct timeval time_from_epoch;
-	gettimeofday (&time_from_epoch, 0);
-
-	nano_from_epoch = ((time_from_epoch.tv_sec * TIMERLIST_NS_IN_SEC) +
-		(time_from_epoch.tv_usec * TIMERLIST_NS_IN_USEC));
-
-	return (nano_from_epoch);
-}
-
-#if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0
-static inline unsigned long long timerlist_nano_current_get (void)
-{
-	unsigned long long nano_monotonic;
-	struct timespec ts;
-
-	clock_gettime (CLOCK_MONOTONIC, &ts);
-
-	nano_monotonic = (ts.tv_sec * TIMERLIST_NS_IN_SEC) + (unsigned long long )ts.tv_nsec;
-	return (nano_monotonic);
-}
-
-static inline unsigned long long timerlist_nano_monotonic_hz (void) {
-	unsigned long long nano_monotonic_hz;
-	struct timespec ts;
-
-	clock_getres (CLOCK_MONOTONIC, &ts);
-
-	nano_monotonic_hz = TIMERLIST_NS_IN_SEC / ((ts.tv_sec * TIMERLIST_NS_IN_SEC) + ts.tv_nsec);
-
-	return (nano_monotonic_hz);
-}
-#else
-#warning "Your system doesn't support monotonic timer. gettimeofday will be used"
-static inline unsigned long long timerlist_nano_current_get (void)
-{
-	return (timerlist_nano_from_epoch ());
-}
-
-static inline unsigned long long timerlist_nano_monotonic_hz (void) {
-	return HZ;
-}
-#endif
-
-static inline void timerlist_add (struct timerlist *timerlist, struct timerlist_timer *timer)
-{
-	struct list_head *timer_list = 0;
-	struct timerlist_timer *timer_from_list;
-	int found;
-
-	for (found = 0, timer_list = timerlist->timer_head.next;
-		timer_list != &timerlist->timer_head;
-		timer_list = timer_list->next) {
-
-		timer_from_list = list_entry (timer_list,
-			struct timerlist_timer, list);
-
-		if (timer_from_list->expire_time > timer->expire_time) {
-			list_add (&timer->list, timer_list->prev);
-			found = 1;
-			break; /* for timer iteration */
-		}
-	}
-	if (found == 0) {
-		list_add (&timer->list, timerlist->timer_head.prev);
-	}
-}
-
-static inline int timerlist_add_absolute (struct timerlist *timerlist,
-	void (*timer_fn) (void *data),
-	void *data,
-	unsigned long long nano_from_epoch,
-	timer_handle *handle)
-{
-	struct timerlist_timer *timer;
-
-	timer = (struct timerlist_timer *)malloc (sizeof (struct timerlist_timer));
-	if (timer == 0) {
-		errno = ENOMEM;
-		return (-1);
-	}
-
-	timer->expire_time = nano_from_epoch;
-	timer->is_absolute_timer = 1;
-	timer->data = data;
-	timer->timer_fn = timer_fn;
-	timer->handle_addr = handle;
-	timerlist_add (timerlist, timer);
-
-	*handle = timer;
-	return (0);
-}
-
-static inline int timerlist_add_duration (struct timerlist *timerlist,
-	void (*timer_fn) (void *data),
-	void *data,
-	unsigned long long nano_duration,
-	timer_handle *handle)
-{
-	struct timerlist_timer *timer;
-
-	timer = (struct timerlist_timer *)malloc (sizeof (struct timerlist_timer));
-	if (timer == 0) {
-		errno = ENOMEM;
-		return (-1);
-	}
-
-	timer->expire_time = timerlist_nano_current_get () + nano_duration;
-	timer->is_absolute_timer = 0;
-	timer->data = data;
-	timer->timer_fn = timer_fn;
-	timer->handle_addr = handle;
-	timerlist_add (timerlist, timer);
-
-	*handle = timer;
-	return (0);
-}
-
-static inline void timerlist_del (struct timerlist *timerlist,
-				  timer_handle _timer_handle)
-{
-	struct timerlist_timer *timer = (struct timerlist_timer *)_timer_handle;
-
-	memset (timer->handle_addr, 0, sizeof (struct timerlist_timer *));
-	/*
-	 * If the next timer after the currently expiring timer because
-	 * timerlist_del is called from a timer handler, get to the next
-	 * timer
-	 */
-	if (timerlist->timer_iter == &timer->list) {
-		timerlist->timer_iter = timerlist->timer_iter->next;
-	}
-	list_del (&timer->list);
-	list_init (&timer->list);
-	free (timer);
-}
-
-static inline unsigned long long timerlist_expire_time (struct timerlist *timerlist, timer_handle _timer_handle)
-{
-	struct timerlist_timer *timer = (struct timerlist_timer *)_timer_handle;
-
-	return (timer->expire_time);
-}
-
-static inline void timerlist_pre_dispatch (struct timerlist *timerlist, timer_handle _timer_handle)
-{
-	struct timerlist_timer *timer = (struct timerlist_timer *)_timer_handle;
-
-	memset (timer->handle_addr, 0, sizeof (struct timerlist_timer *));
-	list_del (&timer->list);
-	list_init (&timer->list);
-}
-
-static inline void timerlist_post_dispatch (struct timerlist *timerlist, timer_handle _timer_handle)
-{
-	struct timerlist_timer *timer = (struct timerlist_timer *)_timer_handle;
-
-	free (timer);
-}
-
-/**
- * returns the number of msec until the next timer will expire for use with poll
- */
-static inline unsigned long long timerlist_msec_duration_to_expire (struct timerlist *timerlist)
-{
-	struct timerlist_timer *timer_from_list;
-	volatile unsigned long long current_time;
-	volatile unsigned long long msec_duration_to_expire;
-
-	/*
-	 * empty list, no expire
-	 */
-	if (timerlist->timer_head.next == &timerlist->timer_head) {
-		return (-1);
-	}
-
-	timer_from_list = list_entry (timerlist->timer_head.next,
-		struct timerlist_timer, list);
-
-	if (timer_from_list->is_absolute_timer) {
-		current_time = timerlist_nano_from_epoch ();
-	} else {
-		current_time = timerlist_nano_current_get ();
-	}
-
-	/*
-	 * timer at head of list is expired, zero msecs required
-	 */
-	if (timer_from_list->expire_time < current_time) {
-		return (0);
-	}
-
-	msec_duration_to_expire = ((timer_from_list->expire_time - current_time) / TIMERLIST_NS_IN_MSEC) +
-		(1000 / HZ);
-	return (msec_duration_to_expire);
-}
-
-/**
- * Expires any timers that should be expired
- */
-static inline void timerlist_expire (struct timerlist *timerlist)
-{
-	struct timerlist_timer *timer_from_list;
-	unsigned long long current_time_from_epoch;
-	unsigned long long current_monotonic_time;
-	unsigned long long current_time;
-
-	current_monotonic_time = timerlist_nano_current_get ();
-	current_time_from_epoch = current_time = timerlist_nano_from_epoch ();
-
-	for (timerlist->timer_iter = timerlist->timer_head.next;
-		timerlist->timer_iter != &timerlist->timer_head;) {
-
-		timer_from_list = list_entry (timerlist->timer_iter,
-			struct timerlist_timer, list);
-
-		current_time = (timer_from_list->is_absolute_timer ? current_time_from_epoch : current_monotonic_time);
-
-		if (timer_from_list->expire_time < current_time) {
-			timerlist->timer_iter = timerlist->timer_iter->next;
-
-			timerlist_pre_dispatch (timerlist, timer_from_list);
-
-			timer_from_list->timer_fn (timer_from_list->data);
-
-			timerlist_post_dispatch (timerlist, timer_from_list);
-		} else {
-			break; /* for timer iteration */
-		}
-	}
-	timerlist->timer_iter = 0;
-}
-#endif /* TLIST_H_DEFINED */

+ 1 - 1
exec/totemconfig.c

@@ -50,6 +50,7 @@
 
 #include <corosync/swab.h>
 #include <corosync/list.h>
+#include <qb/qbdefs.h>
 #include <corosync/totem/totem.h>
 #include <corosync/engine/objdb.h>
 #include <corosync/engine/config.h>
@@ -64,7 +65,6 @@
 
 #include "util.h"
 #include "totemconfig.h"
-#include "tlist.h" /* for HZ */
 
 #define TOKEN_RETRANSMITS_BEFORE_LOSS_CONST	4
 #define TOKEN_TIMEOUT				1000

+ 1 - 1
exec/totemiba.c

@@ -1317,7 +1317,7 @@ int totemiba_initialize (
 
 	qb_loop_timer_add (instance->totemiba_poll_handle,
 		QB_LOOP_MED,
-		100,
+		100*QB_TIME_NS_IN_NSEC,
 		(void *)instance,
 		timer_function_netif_check_timeout,
 		&instance->timer_netif_check_timeout);

+ 8 - 7
exec/totemrrp.c

@@ -62,6 +62,7 @@
 #include <corosync/list.h>
 #include <corosync/hdb.h>
 #include <corosync/swab.h>
+#include <qb/qbdefs.h>
 #include <qb/qbloop.h>
 #define LOGSYS_UTILS_ONLY 1
 #include <corosync/engine/logsys.h>
@@ -633,7 +634,7 @@ static void timer_function_test_ring_timeout (void *context)
 			&msg, sizeof (struct message_header));
 		qb_loop_timer_add (rrp_instance->poll_handle,
 			QB_LOOP_MED,
-			rrp_instance->totem_config->rrp_autorecovery_check_timeout,
+			rrp_instance->totem_config->rrp_autorecovery_check_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)deliver_fn_context,
 			timer_function_test_ring_timeout,
 			&rrp_instance->timer_active_test_ring_timeout[iface_no]);
@@ -841,7 +842,7 @@ static void passive_timer_expired_token_start (
         qb_loop_timer_add (
 		passive_instance->rrp_instance->poll_handle,
 		QB_LOOP_MED,
-		passive_instance->rrp_instance->totem_config->rrp_token_expired_timeout,
+		passive_instance->rrp_instance->totem_config->rrp_token_expired_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)passive_instance,
 		timer_function_passive_token_expired,
 		&passive_instance->timer_expired_token);
@@ -862,7 +863,7 @@ static void passive_timer_problem_decrementer_start (
         qb_loop_timer_add (
 		QB_LOOP_MED,
 		passive_instance->rrp_instance->poll_handle,
-		passive_instance->rrp_instance->totem_config->rrp_problem_count_timeout,
+		passive_instance->rrp_instance->totem_config->rrp_problem_count_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)passive_instance,
 		timer_function_passive_problem_decrementer,
 		&passive_instance->timer_problem_decrementer);
@@ -967,7 +968,7 @@ static void passive_monitor (
 			passive_instance->faulty[i] = 1;
 			qb_loop_timer_add (rrp_instance->poll_handle,
 				QB_LOOP_MED,
-				rrp_instance->totem_config->rrp_autorecovery_check_timeout,
+				rrp_instance->totem_config->rrp_autorecovery_check_timeout*QB_TIME_NS_IN_MSEC,
 				rrp_instance->deliver_fn_context[i],
 				timer_function_test_ring_timeout,
 				&rrp_instance->timer_active_test_ring_timeout[i]);
@@ -1326,7 +1327,7 @@ static void timer_function_active_token_expired (void *context)
 			active_instance->faulty[i] = 1;
 			qb_loop_timer_add (rrp_instance->poll_handle,
 				QB_LOOP_MED,
-				rrp_instance->totem_config->rrp_autorecovery_check_timeout,
+				rrp_instance->totem_config->rrp_autorecovery_check_timeout*QB_TIME_NS_IN_MSEC,
 				rrp_instance->deliver_fn_context[i],
 				timer_function_test_ring_timeout,
 				&rrp_instance->timer_active_test_ring_timeout[i]);
@@ -1356,7 +1357,7 @@ static void active_timer_expired_token_start (
         qb_loop_timer_add (
 		active_instance->rrp_instance->poll_handle,
 		QB_LOOP_MED,
-		active_instance->rrp_instance->totem_config->rrp_token_expired_timeout,
+		active_instance->rrp_instance->totem_config->rrp_token_expired_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)active_instance,
 		timer_function_active_token_expired,
 		&active_instance->timer_expired_token);
@@ -1376,7 +1377,7 @@ static void active_timer_problem_decrementer_start (
         qb_loop_timer_add (
 		active_instance->rrp_instance->poll_handle,
 		QB_LOOP_MED,
-		active_instance->rrp_instance->totem_config->rrp_problem_count_timeout,
+		active_instance->rrp_instance->totem_config->rrp_problem_count_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)active_instance,
 		timer_function_active_problem_decrementer,
 		&active_instance->timer_problem_decrementer);

+ 21 - 19
exec/totemsrp.c

@@ -74,12 +74,16 @@
 #include <sys/poll.h>
 #include <limits.h>
 
+#include <qb/qbdefs.h>
+#include <qb/qbutil.h>
+#include <qb/qbloop.h>
+
 #include <corosync/swab.h>
 #include <corosync/cs_queue.h>
 #include <corosync/sq.h>
 #include <corosync/list.h>
 #include <corosync/hdb.h>
-#include <qb/qbloop.h>
+
 #define LOGSYS_UTILS_ONLY 1
 #include <corosync/engine/logsys.h>
 
@@ -89,8 +93,6 @@
 #include "wthread.h"
 
 #include "crypto.h"
-#include "tlist.h"
-#include "util.h"
 
 #define LOCALHOST_IP				inet_addr("127.0.0.1")
 #define QUEUE_RTR_ITEMS_SIZE_MAX		16384 /* allow 16384 retransmit items */
@@ -702,8 +704,8 @@ static int pause_flush (struct totemsrp_instance *instance)
 	uint64_t timestamp_msec;
 	int res = 0;
 
-        now_msec = (timerlist_nano_current_get () / TIMERLIST_NS_IN_MSEC);
-        timestamp_msec = instance->pause_timestamp / TIMERLIST_NS_IN_MSEC;
+        now_msec = (qb_util_nano_current_get () / QB_TIME_NS_IN_MSEC);
+        timestamp_msec = instance->pause_timestamp / QB_TIME_NS_IN_MSEC;
 
 	if ((now_msec - timestamp_msec) > (instance->totem_config->token_timeout / 2)) {
 		log_printf (instance->totemsrp_log_level_notice,
@@ -722,9 +724,9 @@ static int token_event_stats_collector (enum totem_callback_token_type type, con
 {
 	struct totemsrp_instance *instance = (struct totemsrp_instance *)void_instance;
 	uint32_t time_now;
-	unsigned long long nano_secs = timerlist_nano_current_get ();
+	unsigned long long nano_secs = qb_util_nano_current_get ();
 
-	time_now = (nano_secs / TIMERLIST_NS_IN_MSEC);
+	time_now = (nano_secs / QB_TIME_NS_IN_MSEC);
 
 	if (type == TOTEM_CALLBACK_TOKEN_RECEIVED) {
 		/* incr latest token the index */
@@ -1387,7 +1389,7 @@ static void reset_token_retransmit_timeout (struct totemsrp_instance *instance)
 		instance->timer_orf_token_retransmit_timeout);
 	qb_loop_timer_add (instance->totemsrp_poll_handle,
 		QB_LOOP_MED,
-		instance->totem_config->token_retransmit_timeout,
+		instance->totem_config->token_retransmit_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)instance,
 		timer_function_token_retransmit_timeout,
 		&instance->timer_orf_token_retransmit_timeout);
@@ -1399,7 +1401,7 @@ static void start_merge_detect_timeout (struct totemsrp_instance *instance)
 	if (instance->my_merge_detect_timeout_outstanding == 0) {
 		qb_loop_timer_add (instance->totemsrp_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->merge_timeout,
+			instance->totem_config->merge_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			timer_function_merge_detect_timeout,
 			&instance->timer_merge_detect_timeout);
@@ -1453,7 +1455,7 @@ static void reset_pause_timeout (struct totemsrp_instance *instance)
 	qb_loop_timer_del (instance->totemsrp_poll_handle, instance->timer_pause_timeout);
 	qb_loop_timer_add (instance->totemsrp_poll_handle,
 		QB_LOOP_MED,
-		instance->totem_config->token_timeout / 5,
+		instance->totem_config->token_timeout * QB_TIME_NS_IN_MSEC / 5,
 		(void *)instance,
 		timer_function_pause_timeout,
 		&instance->timer_pause_timeout);
@@ -1463,7 +1465,7 @@ static void reset_token_timeout (struct totemsrp_instance *instance) {
 	qb_loop_timer_del (instance->totemsrp_poll_handle, instance->timer_orf_token_timeout);
 	qb_loop_timer_add (instance->totemsrp_poll_handle,
 		QB_LOOP_MED,
-		instance->totem_config->token_timeout,
+		instance->totem_config->token_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)instance,
 		timer_function_orf_token_timeout,
 		&instance->timer_orf_token_timeout);
@@ -1473,7 +1475,7 @@ static void reset_heartbeat_timeout (struct totemsrp_instance *instance) {
         qb_loop_timer_del (instance->totemsrp_poll_handle, instance->timer_heartbeat_timeout);
         qb_loop_timer_add (instance->totemsrp_poll_handle,
 		QB_LOOP_MED,
-                instance->heartbeat_timeout,
+                instance->heartbeat_timeout*QB_TIME_NS_IN_MSEC,
                 (void *)instance,
                 timer_function_heartbeat_timeout,
                 &instance->timer_heartbeat_timeout);
@@ -1497,7 +1499,7 @@ static void start_token_hold_retransmit_timeout (struct totemsrp_instance *insta
 {
 	qb_loop_timer_add (instance->totemsrp_poll_handle,
 		QB_LOOP_MED,
-		instance->totem_config->token_hold_timeout,
+		instance->totem_config->token_hold_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)instance,
 		timer_function_token_hold_retransmit_timeout,
 		&instance->timer_orf_token_hold_retransmit_timeout);
@@ -1547,7 +1549,7 @@ static void timer_function_pause_timeout (void *data)
 {
 	struct totemsrp_instance *instance = data;
 
-	instance->pause_timestamp = timerlist_nano_current_get ();
+	instance->pause_timestamp = qb_util_nano_current_get ();
 	reset_pause_timeout (instance);
 }
 
@@ -1625,7 +1627,7 @@ static void memb_timer_function_state_gather (void *data)
 
 		qb_loop_timer_add (instance->totemsrp_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->join_timeout,
+			instance->totem_config->join_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			memb_timer_function_state_gather,
 			&instance->memb_timer_state_gather_join_timeout);
@@ -1875,7 +1877,7 @@ static void memb_state_gather_enter (
 
 	qb_loop_timer_add (instance->totemsrp_poll_handle,
 		QB_LOOP_MED,
-		instance->totem_config->join_timeout,
+		instance->totem_config->join_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)instance,
 		memb_timer_function_state_gather,
 		&instance->memb_timer_state_gather_join_timeout);
@@ -1888,7 +1890,7 @@ static void memb_state_gather_enter (
 
 	qb_loop_timer_add (instance->totemsrp_poll_handle,
 		QB_LOOP_MED,
-		instance->totem_config->consensus_timeout,
+		instance->totem_config->consensus_timeout*QB_TIME_NS_IN_MSEC,
 		(void *)instance,
 		memb_timer_function_gather_consensus_timeout,
 		&instance->memb_timer_state_gather_consensus_timeout);
@@ -3400,7 +3402,7 @@ static int message_handler_orf_token (
 	unsigned long long tv_current;
 	unsigned long long tv_diff;
 
-	tv_current = timerlist_nano_current_get ();
+	tv_current = qb_util_nano_current_get ();
 	tv_diff = tv_current - tv_old;
 	tv_old = tv_current;
 
@@ -3635,7 +3637,7 @@ printf ("token seq %d\n", token->seq);
 			token_send (instance, token, forward_token);
 
 #ifdef GIVEINFO
-			tv_current = timerlist_nano_current_get ();
+			tv_current = qb_util_nano_current_get ();
 			tv_diff = tv_current - tv_old;
 			tv_old = tv_current;
 			log_printf (instance->totemsrp_log_level_debug,

+ 6 - 5
exec/totemudp.c

@@ -62,6 +62,7 @@
 #include <corosync/swab.h>
 #include <corosync/list.h>
 #include <corosync/hdb.h>
+#include <qb/qbdefs.h>
 #include <qb/qbloop.h>
 #define LOGSYS_UTILS_ONLY 1
 #include <corosync/engine/logsys.h>
@@ -1291,7 +1292,7 @@ static void timer_function_netif_check_timeout (
 
 		qb_loop_timer_add (instance->totemudp_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->downcheck_timeout,
+			instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			timer_function_netif_check_timeout,
 			&instance->timer_netif_check_timeout);
@@ -1328,7 +1329,7 @@ static void timer_function_netif_check_timeout (
 		 */
 		qb_loop_timer_add (instance->totemudp_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->downcheck_timeout,
+			instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			timer_function_netif_check_timeout,
 			&instance->timer_netif_check_timeout);
@@ -1379,7 +1380,7 @@ static void timer_function_netif_check_timeout (
 		if (instance->my_memb_entries == 1) {
 			qb_loop_timer_add (instance->totemudp_poll_handle,
 				QB_LOOP_MED,
-				instance->totem_config->downcheck_timeout,
+				instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 				(void *)instance,
 				timer_function_netif_check_timeout,
 				&instance->timer_netif_check_timeout);
@@ -1830,7 +1831,7 @@ int totemudp_initialize (
 	 */
 	qb_loop_timer_add (instance->totemudp_poll_handle,
 		QB_LOOP_MED,
-		100,
+		100*QB_TIME_NS_IN_MSEC,
 		(void *)instance,
 		timer_function_netif_check_timeout,
 		&instance->timer_netif_check_timeout);
@@ -1862,7 +1863,7 @@ int totemudp_processor_count_set (
 	if (processor_count == 1) {
 		qb_loop_timer_add (instance->totemudp_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->downcheck_timeout,
+			instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			timer_function_netif_check_timeout,
 			&instance->timer_netif_check_timeout);

+ 6 - 5
exec/totemudpu.c

@@ -57,6 +57,7 @@
 #include <sys/poll.h>
 #include <limits.h>
 
+#include <qb/qbdefs.h>
 #include <qb/qbloop.h>
 
 #include <corosync/sq.h>
@@ -1185,7 +1186,7 @@ static void timer_function_netif_check_timeout (
 
 		qb_loop_timer_add (instance->totemudpu_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->downcheck_timeout,
+			instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			timer_function_netif_check_timeout,
 			&instance->timer_netif_check_timeout);
@@ -1214,7 +1215,7 @@ static void timer_function_netif_check_timeout (
 		 */
 		qb_loop_timer_add (instance->totemudpu_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->downcheck_timeout,
+			instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			timer_function_netif_check_timeout,
 			&instance->timer_netif_check_timeout);
@@ -1256,7 +1257,7 @@ static void timer_function_netif_check_timeout (
 		if (instance->my_memb_entries == 1) {
 			qb_loop_timer_add (instance->totemudpu_poll_handle,
 				QB_LOOP_MED,
-				instance->totem_config->downcheck_timeout,
+				instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 				(void *)instance,
 				timer_function_netif_check_timeout,
 				&instance->timer_netif_check_timeout);
@@ -1460,7 +1461,7 @@ int totemudpu_initialize (
 	 */
 	qb_loop_timer_add (instance->totemudpu_poll_handle,
 		QB_LOOP_MED,
-		100,
+		100*QB_TIME_NS_IN_MSEC,
 		(void *)instance,
 		timer_function_netif_check_timeout,
 		&instance->timer_netif_check_timeout);
@@ -1492,7 +1493,7 @@ int totemudpu_processor_count_set (
 	if (processor_count == 1) {
 		qb_loop_timer_add (instance->totemudpu_poll_handle,
 			QB_LOOP_MED,
-			instance->totem_config->downcheck_timeout,
+			instance->totem_config->downcheck_timeout*QB_TIME_NS_IN_MSEC,
 			(void *)instance,
 			timer_function_netif_check_timeout,
 			&instance->timer_netif_check_timeout);

+ 1 - 1
include/corosync/engine/coroapi.h

@@ -57,7 +57,7 @@ static inline void swab_mar_message_source_t (mar_message_source_t *to_swab)
 	 */
 	to_swab->conn = NULL;
 }
-typedef void * corosync_timer_handle_t;
+typedef qb_loop_timer_handle corosync_timer_handle_t;
 
 struct corosync_tpg_group {
 	const void *group;

+ 1 - 0
lib/votequorum.c

@@ -45,6 +45,7 @@
 #include <sys/socket.h>
 #include <errno.h>
 
+#include <qb/qbdefs.h>
 #include <qb/qbipcc.h>
 
 #include <corosync/corotypes.h>

+ 3 - 4
services/pload.c

@@ -53,6 +53,7 @@
 #include <assert.h>
 
 #include <qb/qblist.h>
+#include <qb/qbutil.h>
 #include <qb/qbipc_common.h>
 
 #include <corosync/swab.h>
@@ -65,8 +66,6 @@
 #include <corosync/list.h>
 #include <corosync/engine/logsys.h>
 
-#include "../exec/tlist.h"
-
 LOGSYS_DECLARE_SUBSYS ("PLOAD");
 
 enum pload_exec_message_req_types {
@@ -362,11 +361,11 @@ static void message_handler_req_exec_pload_mcast (
 
 	last_msg_no = pload_mcast->msg_code;
 	if (msgs_delivered == 0) {
-		tv1 = timerlist_nano_current_get ();
+		tv1 = qb_util_nano_current_get ();
 	}
 	msgs_delivered += 1;
 	if (msgs_delivered == msgs_wanted) {
-		tv2 = timerlist_nano_current_get ();
+		tv2 = qb_util_nano_current_get ();
 		tv_elapsed = tv2 - tv1;
 		sprintf (log_buffer, "%5d Writes %d bytes per write %7.3f seconds runtime, %9.3f TP/S, %9.3f MB/S.\n",
 			msgs_delivered,

+ 7 - 7
services/votequorum.c

@@ -55,8 +55,11 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <corosync/corotypes.h>
 #include <qb/qbipc_common.h>
+#include <qb/qbdefs.h>
+#include <qb/qbutil.h>
+
+#include <corosync/corotypes.h>
 #include <corosync/corodefs.h>
 #include <corosync/cfg.h>
 #include <corosync/list.h>
@@ -66,9 +69,6 @@
 #include <corosync/engine/coroapi.h>
 #include <corosync/engine/quorum.h>
 #include <corosync/ipc_votequorum.h>
-#include <corosync/list.h>
-
-#include "../exec/tlist.h"
 
 #define VOTEQUORUM_MAJOR_VERSION 7
 #define VOTEQUORUM_MINOR_VERSION 0
@@ -1322,8 +1322,8 @@ static void quorum_device_timer_fn(void *arg)
 	if (!quorum_device || quorum_device->state == NODESTATE_DEAD)
 		return;
 
-	if ( (quorum_device->last_hello / TIMERLIST_NS_IN_SEC) + quorumdev_poll/1000 <
-		(timerlist_nano_current_get () / TIMERLIST_NS_IN_SEC)) {
+	if ( (quorum_device->last_hello / QB_TIME_NS_IN_SEC) + quorumdev_poll/1000 <
+		(qb_util_nano_current_get () / QB_TIME_NS_IN_SEC)) {
 
 		quorum_device->state = NODESTATE_DEAD;
 		log_printf(LOGSYS_LEVEL_INFO, "lost contact with quorum device\n");
@@ -1406,7 +1406,7 @@ static void message_handler_req_lib_votequorum_qdisk_poll (void *conn,
 
 	if (quorum_device) {
 		if (req_lib_votequorum_qdisk_poll->state) {
-			quorum_device->last_hello = timerlist_nano_current_get ();
+			quorum_device->last_hello = qb_util_nano_current_get ();
 			if (quorum_device->state == NODESTATE_DEAD) {
 				quorum_device->state = NODESTATE_MEMBER;
 				recalculate_quorum(0, 0);