This patch does below: - Make QEMUTimerList functions private (remove from APIs) - Comment out function QEMUTimerList timerlist_get_clock() in order to fix compile error
Signed-off-by: Xuebing Wang <xbi...@gmail.com> Reviewed-By: Alex Bligh <a...@alex.org.uk> --- include/qemu/timer.h | 94 ------------------------------------------------ qemu-timer.c | 97 ++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 87 insertions(+), 104 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 55cd3a7..8644913 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -250,100 +250,6 @@ bool qemu_clock_run_timers(QEMUClockType type); bool qemu_clock_run_all_timers(void); /* - * QEMUTimerList - */ - -/** - * timerlist_has_timers: - * @timer_list: the timer list to operate on - * - * Determine whether a timer list has active timers - * - * Note that this function should not be used when other threads also access - * the timer list. The return value may be outdated by the time it is acted - * upon. - * - * Returns: true if the timer list has timers. - */ -bool timerlist_has_timers(QEMUTimerList *timer_list); - -/** - * timerlist_new: - * @type: the clock type to associate with the timerlist - * @cb: the callback to call on notification - * @opaque: the opaque pointer to pass to the callback - * - * Create a new timerlist associated with the clock of - * type @type. - * - * Returns: a pointer to the QEMUTimerList created - */ -QEMUTimerList *timerlist_new(QEMUClockType type, - QEMUTimerListNotifyCB *cb, void *opaque); - -/** - * timerlist_free: - * @timer_list: the timer list to free - * - * Frees a timer_list. It must have no active timers. - */ -void timerlist_free(QEMUTimerList *timer_list); - -/** - * timerlist_expired: - * @timer_list: the timer list to operate on - * - * Determine whether a timer list has any timers which - * are expired. - * - * Returns: true if the timer list has timers which - * have expired. - */ -bool timerlist_expired(QEMUTimerList *timer_list); - -/** - * timerlist_deadline_ns: - * @timer_list: the timer list to operate on - * - * Determine the deadline for a timer_list, i.e. - * the number of nanoseconds until the first timer - * expires. Return -1 if there are no timers. - * - * Returns: the number of nanoseconds until the earliest - * timer expires -1 if none - */ -int64_t timerlist_deadline_ns(QEMUTimerList *timer_list); - -/** - * timerlist_get_clock: - * @timer_list: the timer list to operate on - * - * Determine the clock type associated with a timer list. - * - * Returns: the clock type associated with the - * timer list. - */ -QEMUClockType timerlist_get_clock(QEMUTimerList *timer_list); - -/** - * timerlist_run_timers: - * @timer_list: the timer list to use - * - * Call all expired timers associated with the timer list. - * - * Returns: true if any timer expired - */ -bool timerlist_run_timers(QEMUTimerList *timer_list); - -/** - * timerlist_notify: - * @timer_list: the timer list to use - * - * call the notifier callback associated with the timer list. - */ -void timerlist_notify(QEMUTimerList *timer_list); - -/* * QEMUTimerListGroup */ diff --git a/qemu-timer.c b/qemu-timer.c index 4929f8b..2db87ba 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -99,14 +99,37 @@ static bool timer_expired_ns(QEMUTimer *timer_head, int64_t current_time) * QEMUTimerList */ -bool timerlist_has_timers(QEMUTimerList *timer_list) +/** + * timerlist_has_timers: + * @timer_list: the timer list to operate on + * + * Determine whether a timer list has active timers + * + * Note that this function should not be used when other threads also access + * the timer list. The return value may be outdated by the time it is acted + * upon. + * + * Returns: true if the timer list has timers. + */ +static bool timerlist_has_timers(QEMUTimerList *timer_list) { return !!timer_list->active_timers; } -QEMUTimerList *timerlist_new(QEMUClockType type, - QEMUTimerListNotifyCB *cb, - void *opaque) +/** + * timerlist_new: + * @type: the clock type to associate with the timerlist + * @cb: the callback to call on notification + * @opaque: the opaque pointer to pass to the callback + * + * Create a new timerlist associated with the clock of + * type @type. + * + * Returns: a pointer to the QEMUTimerList created + */ +static QEMUTimerList *timerlist_new(QEMUClockType type, + QEMUTimerListNotifyCB *cb, + void *opaque) { QEMUTimerList *timer_list; QEMUClock *clock = qemu_clock_ptr(type); @@ -121,7 +144,13 @@ QEMUTimerList *timerlist_new(QEMUClockType type, return timer_list; } -void timerlist_free(QEMUTimerList *timer_list) +/** + * timerlist_free: + * @timer_list: the timer list to free + * + * Frees a timer_list. It must have no active timers. + */ +static void timerlist_free(QEMUTimerList *timer_list) { assert(!timerlist_has_timers(timer_list)); if (timer_list->clock) { @@ -131,7 +160,17 @@ void timerlist_free(QEMUTimerList *timer_list) g_free(timer_list); } -bool timerlist_expired(QEMUTimerList *timer_list) +/** + * timerlist_expired: + * @timer_list: the timer list to operate on + * + * Determine whether a timer list has any timers which + * are expired. + * + * Returns: true if the timer list has timers which + * have expired. + */ +static bool timerlist_expired(QEMUTimerList *timer_list) { int64_t expire_time; @@ -146,7 +185,18 @@ bool timerlist_expired(QEMUTimerList *timer_list) return expire_time < qemu_clock_get_ns(timer_list->clock->type); } -int64_t timerlist_deadline_ns(QEMUTimerList *timer_list) +/** + * timerlist_deadline_ns: + * @timer_list: the timer list to operate on + * + * Determine the deadline for a timer_list, i.e. + * the number of nanoseconds until the first timer + * expires. Return -1 if there are no timers. + * + * Returns: the number of nanoseconds until the earliest + * timer expires -1 if none + */ +static int64_t timerlist_deadline_ns(QEMUTimerList *timer_list) { int64_t delta; int64_t expire_time; @@ -176,12 +226,33 @@ int64_t timerlist_deadline_ns(QEMUTimerList *timer_list) return delta; } -QEMUClockType timerlist_get_clock(QEMUTimerList *timer_list) +#if 0 /* TODO: unused, consider to remove */ +/* Comment out in order to fix compile error as below: + ‘timerlist_get_clock’ defined but not used [-Werror=unused-function] */ +/** + * timerlist_get_clock: + * @timer_list: the timer list to operate on + * + * Determine the clock type associated with a timer list. + * + * Returns: the clock type associated with the + * timer list. + */ +static QEMUClockType timerlist_get_clock(QEMUTimerList *timer_list) { return timer_list->clock->type; } +#endif -bool timerlist_run_timers(QEMUTimerList *timer_list) +/** + * timerlist_run_timers: + * @timer_list: the timer list to use + * + * Call all expired timers associated with the timer list. + * + * Returns: true if any timer expired + */ +static bool timerlist_run_timers(QEMUTimerList *timer_list) { QEMUTimer *ts; int64_t current_time; @@ -221,7 +292,13 @@ out: return progress; } -void timerlist_notify(QEMUTimerList *timer_list) +/** + * timerlist_notify: + * @timer_list: the timer list to use + * + * call the notifier callback associated with the timer list. + */ +static void timerlist_notify(QEMUTimerList *timer_list) { if (timer_list->notify_cb) { timer_list->notify_cb(timer_list->notify_opaque); -- 1.7.9.5