From patchwork Mon Mar 3 01:43:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xuebing Wang X-Patchwork-Id: 325660 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1E7A42C00C6 for ; Mon, 3 Mar 2014 12:45:10 +1100 (EST) Received: from localhost ([::1]:37250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKHwJ-0008Fv-FB for incoming@patchwork.ozlabs.org; Sun, 02 Mar 2014 20:45:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKHvi-00084Y-KM for qemu-devel@nongnu.org; Sun, 02 Mar 2014 20:44:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKHvc-0005Dn-O9 for qemu-devel@nongnu.org; Sun, 02 Mar 2014 20:44:30 -0500 Received: from mail-pb0-x22d.google.com ([2607:f8b0:400e:c01::22d]:54250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKHvc-0005Dd-AF for qemu-devel@nongnu.org; Sun, 02 Mar 2014 20:44:24 -0500 Received: by mail-pb0-f45.google.com with SMTP id uo5so2375028pbc.18 for ; Sun, 02 Mar 2014 17:44:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=5pnzB+Y1na1aEPOPY+pwPkyMLghTP3iJEZby5TB2brM=; b=fnw+cUk3zUMymshyiYAmsdGsAyse/nBUbgD8I958cYRfXeqr/6LrhUIjg+XeLblgoJ 1nkAXDxTjTnvZEd6SBO0akg8VSBUx6OAvURBrOfNexCejwXBmeJA+IBGBhPLcLSIKoTO 2EwIHtZyzWkhfzNJKuANhu+SYBi+27PKXhX2HFQjnsqdq3eCWQOitP38wmlwSmqAPaYR tkv2KFY/WLNZBMKwJwnWCxwKCOJSKEZETCKwvqA8p4RrIH3zmFxFrfSantQW0gVoZxd/ 1t+ubTTFx+zexYDOspXWiiiNo6ho+Jalz8q2F/v3ofv22ooiVB4/ymjTACKmRezELKFh bnnA== X-Received: by 10.68.245.162 with SMTP id xp2mr16719044pbc.69.1393811063123; Sun, 02 Mar 2014 17:44:23 -0800 (PST) Received: from localhost.localdomain ([216.131.71.80]) by mx.google.com with ESMTPSA id iq10sm29844515pbc.14.2014.03.02.17.44.18 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Mar 2014 17:44:22 -0800 (PST) From: Xuebing Wang To: qemu-devel@nongnu.org, pbonzini@redhat.com, stefanha@redhat.com Date: Mon, 3 Mar 2014 09:43:35 +0800 Message-Id: <1393811020-24881-3-git-send-email-xbing6@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393811020-24881-1-git-send-email-xbing6@gmail.com> References: <1393811020-24881-1-git-send-email-xbing6@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::22d Cc: xbing6@gmail.com Subject: [Qemu-devel] =?utf-8?q?_=5BPULL_2/7=5D_timer=3A_make_QEMUTimerLis?= =?utf-8?q?t_functions_private_=28remove_from_APIs=29?= X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Reviewed-By: Alex Bligh --- 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);