From: Alex Bligh <alex@alex.org.uk>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Alex Bligh <alex@alex.org.uk>,
Jan Kiszka <jan.kiszka@siemens.com>,
liu ping fan <qemulist@gmail.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>,
rth@twiddle.net
Subject: [Qemu-devel] [PATCHv13 01/31] aio / timers: Rename qemu_timer_* functions
Date: Wed, 21 Aug 2013 16:02:39 +0100 [thread overview]
Message-ID: <1377097389-27335-2-git-send-email-alex@alex.org.uk> (raw)
In-Reply-To: <1377097389-27335-1-git-send-email-alex@alex.org.uk>
Rename four functions in preparation for new API.
Rename qemu_timer_expired to timer_expired
Rename qemu_timer_expire_time_ns to timer_expire_time_ns
Rename qemu_timer_pending to timer_pending
Rename qemu_timer_expired_ns to timer_expired_ns
Signed-off-by: Alex Bligh <alex@alex.org.uk>
---
backends/baum.c | 6 +++---
hw/input/tsc2005.c | 2 +-
hw/input/tsc210x.c | 2 +-
hw/mips/cputimer.c | 4 ++--
hw/openrisc/cputimer.c | 2 +-
hw/timer/mc146818rtc.c | 6 +++---
hw/usb/redirect.c | 4 ++--
include/qemu/timer.h | 6 +++---
qemu-timer.c | 20 ++++++++++----------
savevm.c | 2 +-
10 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/backends/baum.c b/backends/baum.c
index 62aa784..b08e1d5 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -314,9 +314,9 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
return 0; \
if (*cur++ != ESC) { \
DPRINTF("Broken packet %#2x, tossing\n", req); \
- if (qemu_timer_pending(baum->cellCount_timer)) { \
- qemu_del_timer(baum->cellCount_timer); \
- baum_cellCount_timer_cb(baum); \
+ if (timer_pending(baum->cellCount_timer)) { \
+ qemu_del_timer(baum->cellCount_timer); \
+ baum_cellCount_timer_cb(baum); \
} \
return (cur - 2 - buf); \
} \
diff --git a/hw/input/tsc2005.c b/hw/input/tsc2005.c
index a771cd5..ebd1b7e 100644
--- a/hw/input/tsc2005.c
+++ b/hw/input/tsc2005.c
@@ -513,7 +513,7 @@ static int tsc2005_load(QEMUFile *f, void *opaque, int version_id)
for (i = 0; i < 8; i ++)
s->tr[i] = qemu_get_be32(f);
- s->busy = qemu_timer_pending(s->timer);
+ s->busy = timer_pending(s->timer);
tsc2005_pin_update(s);
return 0;
diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c
index 9b854e7..0067f98 100644
--- a/hw/input/tsc210x.c
+++ b/hw/input/tsc210x.c
@@ -1093,7 +1093,7 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
for (i = 0; i < 0x14; i ++)
qemu_get_be16s(f, &s->filter_data[i]);
- s->busy = qemu_timer_pending(s->timer);
+ s->busy = timer_pending(s->timer);
qemu_set_irq(s->pint, !s->irq);
qemu_set_irq(s->davint, !s->dav);
diff --git a/hw/mips/cputimer.c b/hw/mips/cputimer.c
index e0266bf..739bbac 100644
--- a/hw/mips/cputimer.c
+++ b/hw/mips/cputimer.c
@@ -72,8 +72,8 @@ uint32_t cpu_mips_get_count (CPUMIPSState *env)
uint64_t now;
now = qemu_get_clock_ns(vm_clock);
- if (qemu_timer_pending(env->timer)
- && qemu_timer_expired(env->timer, now)) {
+ if (timer_pending(env->timer)
+ && timer_expired(env->timer, now)) {
/* The timer has already expired. */
cpu_mips_timer_expire(env);
}
diff --git a/hw/openrisc/cputimer.c b/hw/openrisc/cputimer.c
index 4144b34..9a09f5c 100644
--- a/hw/openrisc/cputimer.c
+++ b/hw/openrisc/cputimer.c
@@ -72,7 +72,7 @@ static void openrisc_timer_cb(void *opaque)
OpenRISCCPU *cpu = opaque;
if ((cpu->env.ttmr & TTMR_IE) &&
- qemu_timer_expired(cpu->env.timer, qemu_get_clock_ns(vm_clock))) {
+ timer_expired(cpu->env.timer, qemu_get_clock_ns(vm_clock))) {
CPUState *cs = CPU(cpu);
cpu->env.ttmr |= TTMR_IP;
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 3c3baac..d12f6e7 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -252,7 +252,7 @@ static void check_update_timer(RTCState *s)
* the alarm time. */
next_update_time = s->next_alarm_time;
}
- if (next_update_time != qemu_timer_expire_time_ns(s->update_timer)) {
+ if (next_update_time != timer_expire_time_ns(s->update_timer)) {
qemu_mod_timer(s->update_timer, next_update_time);
}
}
@@ -587,8 +587,8 @@ static int update_in_progress(RTCState *s)
if (!rtc_running(s)) {
return 0;
}
- if (qemu_timer_pending(s->update_timer)) {
- int64_t next_update_time = qemu_timer_expire_time_ns(s->update_timer);
+ if (timer_pending(s->update_timer)) {
+ int64_t next_update_time = timer_expire_time_ns(s->update_timer);
/* Latch UIP until the timer expires. */
if (qemu_get_clock_ns(rtc_clock) >= (next_update_time - UIP_HOLD_LENGTH)) {
s->cmos_data[RTC_REG_A] |= REG_A_UIP;
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index e3b9f32..8fee3d3 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1493,7 +1493,7 @@ static void usbredir_device_connect(void *priv,
USBRedirDevice *dev = priv;
const char *speed;
- if (qemu_timer_pending(dev->attach_timer) || dev->dev.attached) {
+ if (timer_pending(dev->attach_timer) || dev->dev.attached) {
ERROR("Received device connect while already connected\n");
return;
}
@@ -1588,7 +1588,7 @@ static void usbredir_interface_info(void *priv,
* If we receive interface info after the device has already been
* connected (ie on a set_config), re-check interface dependent things.
*/
- if (qemu_timer_pending(dev->attach_timer) || dev->dev.attached) {
+ if (timer_pending(dev->attach_timer) || dev->dev.attached) {
usbredir_check_bulk_receiving(dev);
if (usbredir_check_filter(dev)) {
ERROR("Device no longer matches filter after interface info "
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 9dd206c..a9afdb3 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -49,9 +49,9 @@ void qemu_free_timer(QEMUTimer *ts);
void qemu_del_timer(QEMUTimer *ts);
void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time);
void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
-bool qemu_timer_pending(QEMUTimer *ts);
-bool qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time);
-uint64_t qemu_timer_expire_time_ns(QEMUTimer *ts);
+bool timer_pending(QEMUTimer *ts);
+bool timer_expired(QEMUTimer *timer_head, int64_t current_time);
+uint64_t timer_expire_time_ns(QEMUTimer *ts);
void qemu_run_timers(QEMUClock *clock);
void qemu_run_all_timers(void);
diff --git a/qemu-timer.c b/qemu-timer.c
index b2d95e2..682c50f 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -80,7 +80,7 @@ struct qemu_alarm_timer {
static struct qemu_alarm_timer *alarm_timer;
-static bool qemu_timer_expired_ns(QEMUTimer *timer_head, int64_t current_time)
+static bool timer_expired_ns(QEMUTimer *timer_head, int64_t current_time)
{
return timer_head && (timer_head->expire_time <= current_time);
}
@@ -301,7 +301,7 @@ void qemu_del_timer(QEMUTimer *ts)
QEMUTimer **pt, *t;
/* NOTE: this code must be signal safe because
- qemu_timer_expired() can be called from a signal. */
+ timer_expired() can be called from a signal. */
pt = &ts->clock->active_timers;
for(;;) {
t = *pt;
@@ -325,11 +325,11 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
/* add the timer in the sorted list */
/* NOTE: this code must be signal safe because
- qemu_timer_expired() can be called from a signal. */
+ timer_expired() can be called from a signal. */
pt = &ts->clock->active_timers;
for(;;) {
t = *pt;
- if (!qemu_timer_expired_ns(t, expire_time)) {
+ if (!timer_expired_ns(t, expire_time)) {
break;
}
pt = &t->next;
@@ -356,7 +356,7 @@ void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
qemu_mod_timer_ns(ts, expire_time * ts->scale);
}
-bool qemu_timer_pending(QEMUTimer *ts)
+bool timer_pending(QEMUTimer *ts)
{
QEMUTimer *t;
for (t = ts->clock->active_timers; t != NULL; t = t->next) {
@@ -367,9 +367,9 @@ bool qemu_timer_pending(QEMUTimer *ts)
return false;
}
-bool qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time)
+bool timer_expired(QEMUTimer *timer_head, int64_t current_time)
{
- return qemu_timer_expired_ns(timer_head, current_time * timer_head->scale);
+ return timer_expired_ns(timer_head, current_time * timer_head->scale);
}
void qemu_run_timers(QEMUClock *clock)
@@ -383,7 +383,7 @@ void qemu_run_timers(QEMUClock *clock)
current_time = qemu_get_clock_ns(clock);
for(;;) {
ts = clock->active_timers;
- if (!qemu_timer_expired_ns(ts, current_time)) {
+ if (!timer_expired_ns(ts, current_time)) {
break;
}
/* remove timer from the list before calling the callback */
@@ -439,9 +439,9 @@ void init_clocks(void)
}
}
-uint64_t qemu_timer_expire_time_ns(QEMUTimer *ts)
+uint64_t timer_expire_time_ns(QEMUTimer *ts)
{
- return qemu_timer_pending(ts) ? ts->expire_time : -1;
+ return timer_pending(ts) ? ts->expire_time : -1;
}
void qemu_run_all_timers(void)
diff --git a/savevm.c b/savevm.c
index 03fc4d9..38c3093 100644
--- a/savevm.c
+++ b/savevm.c
@@ -983,7 +983,7 @@ void qemu_put_timer(QEMUFile *f, QEMUTimer *ts)
{
uint64_t expire_time;
- expire_time = qemu_timer_expire_time_ns(ts);
+ expire_time = timer_expire_time_ns(ts);
qemu_put_be64(f, expire_time);
}
--
1.7.9.5
next prev parent reply other threads:[~2013-08-21 15:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-21 15:02 [Qemu-devel] [PATCHv13 00/31] aio / timers: Add AioContext timers and use ppoll Alex Bligh
2013-08-21 15:02 ` Alex Bligh [this message]
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 02/31] aio / timers: Rename qemu_new_clock and expose clock types Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 03/31] aio / timers: add qemu-timer.c utility functions Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 04/31] aio / timers: Consistent treatment of disabled clocks for deadlines Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 05/31] aio / timers: add ppoll support with qemu_poll_ns Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 06/31] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 07/31] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 08/31] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 09/31] aio / timers: Untangle include files Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 10/31] aio / timers: Add QEMUTimerListGroup and helper functions Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 11/31] aio / timers: Add QEMUTimerListGroup to AioContext Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 12/31] aio / timers: Add a notify callback to QEMUTimerList Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 14/31] aio / timers: Add aio_timer_init & aio_timer_new wrappers Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 15/31] aio / timers: Convert aio_poll to use AioContext timers' deadline Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 16/31] aio / timers: Convert mainloop to use timeout Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 17/31] aio / timers: On timer modification, qemu_notify or aio_notify Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 18/31] aio / timers: Introduce new API timer_new and friends Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 19/31] aio / timers: Use all timerlists in icount warp calculations Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 20/31] aio / timers: Add documentation and new format calls Alex Bligh
2013-08-21 15:02 ` [Qemu-devel] [PATCHv13 21/31] aio / timers: Remove alarm timers Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 22/31] aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 23/31] aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 24/31] aio / timers: Rearrange timer.h & make legacy functions call non-legacy Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 25/31] aio / timers: Remove main_loop_timerlist Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 26/31] aio / timers: Convert rtc_clock to be a QEMUClockType Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 27/31] aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 28/31] aio / timers: Add test harness for AioContext timers Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 29/31] aio / timers: Add scripts/switch-timer-api Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 30/31] aio / timers: Switch entire codebase to the new timer API Alex Bligh
2013-08-21 15:03 ` [Qemu-devel] [PATCHv13 31/31] aio / timers: Remove legacy interface Alex Bligh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1377097389-27335-2-git-send-email-alex@alex.org.uk \
--to=alex@alex.org.uk \
--cc=aliguori@us.ibm.com \
--cc=jan.kiszka@siemens.com \
--cc=kwolf@redhat.com \
--cc=morita.kazutaka@lab.ntt.co.jp \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.com \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).