aio / timers: Rename qemu_timer_* functions

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>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Alex Bligh 2013-08-21 16:02:39 +01:00 committed by Stefan Hajnoczi
parent 04d542c8b8
commit e93379b039
10 changed files with 27 additions and 27 deletions

View File

@ -314,7 +314,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
return 0; \ return 0; \
if (*cur++ != ESC) { \ if (*cur++ != ESC) { \
DPRINTF("Broken packet %#2x, tossing\n", req); \ DPRINTF("Broken packet %#2x, tossing\n", req); \
if (qemu_timer_pending(baum->cellCount_timer)) { \ if (timer_pending(baum->cellCount_timer)) { \
qemu_del_timer(baum->cellCount_timer); \ qemu_del_timer(baum->cellCount_timer); \
baum_cellCount_timer_cb(baum); \ baum_cellCount_timer_cb(baum); \
} \ } \

View File

@ -513,7 +513,7 @@ static int tsc2005_load(QEMUFile *f, void *opaque, int version_id)
for (i = 0; i < 8; i ++) for (i = 0; i < 8; i ++)
s->tr[i] = qemu_get_be32(f); s->tr[i] = qemu_get_be32(f);
s->busy = qemu_timer_pending(s->timer); s->busy = timer_pending(s->timer);
tsc2005_pin_update(s); tsc2005_pin_update(s);
return 0; return 0;

View File

@ -1093,7 +1093,7 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
for (i = 0; i < 0x14; i ++) for (i = 0; i < 0x14; i ++)
qemu_get_be16s(f, &s->filter_data[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->pint, !s->irq);
qemu_set_irq(s->davint, !s->dav); qemu_set_irq(s->davint, !s->dav);

View File

@ -72,8 +72,8 @@ uint32_t cpu_mips_get_count (CPUMIPSState *env)
uint64_t now; uint64_t now;
now = qemu_get_clock_ns(vm_clock); now = qemu_get_clock_ns(vm_clock);
if (qemu_timer_pending(env->timer) if (timer_pending(env->timer)
&& qemu_timer_expired(env->timer, now)) { && timer_expired(env->timer, now)) {
/* The timer has already expired. */ /* The timer has already expired. */
cpu_mips_timer_expire(env); cpu_mips_timer_expire(env);
} }

View File

@ -72,7 +72,7 @@ static void openrisc_timer_cb(void *opaque)
OpenRISCCPU *cpu = opaque; OpenRISCCPU *cpu = opaque;
if ((cpu->env.ttmr & TTMR_IE) && 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); CPUState *cs = CPU(cpu);
cpu->env.ttmr |= TTMR_IP; cpu->env.ttmr |= TTMR_IP;

View File

@ -252,7 +252,7 @@ static void check_update_timer(RTCState *s)
* the alarm time. */ * the alarm time. */
next_update_time = s->next_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); qemu_mod_timer(s->update_timer, next_update_time);
} }
} }
@ -587,8 +587,8 @@ static int update_in_progress(RTCState *s)
if (!rtc_running(s)) { if (!rtc_running(s)) {
return 0; return 0;
} }
if (qemu_timer_pending(s->update_timer)) { if (timer_pending(s->update_timer)) {
int64_t next_update_time = qemu_timer_expire_time_ns(s->update_timer); int64_t next_update_time = timer_expire_time_ns(s->update_timer);
/* Latch UIP until the timer expires. */ /* Latch UIP until the timer expires. */
if (qemu_get_clock_ns(rtc_clock) >= (next_update_time - UIP_HOLD_LENGTH)) { if (qemu_get_clock_ns(rtc_clock) >= (next_update_time - UIP_HOLD_LENGTH)) {
s->cmos_data[RTC_REG_A] |= REG_A_UIP; s->cmos_data[RTC_REG_A] |= REG_A_UIP;

View File

@ -1493,7 +1493,7 @@ static void usbredir_device_connect(void *priv,
USBRedirDevice *dev = priv; USBRedirDevice *dev = priv;
const char *speed; 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"); ERROR("Received device connect while already connected\n");
return; return;
} }
@ -1588,7 +1588,7 @@ static void usbredir_interface_info(void *priv,
* If we receive interface info after the device has already been * If we receive interface info after the device has already been
* connected (ie on a set_config), re-check interface dependent things. * 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); usbredir_check_bulk_receiving(dev);
if (usbredir_check_filter(dev)) { if (usbredir_check_filter(dev)) {
ERROR("Device no longer matches filter after interface info " ERROR("Device no longer matches filter after interface info "

View File

@ -49,9 +49,9 @@ void qemu_free_timer(QEMUTimer *ts);
void qemu_del_timer(QEMUTimer *ts); void qemu_del_timer(QEMUTimer *ts);
void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time); void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time);
void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time); void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
bool qemu_timer_pending(QEMUTimer *ts); bool timer_pending(QEMUTimer *ts);
bool qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time); bool timer_expired(QEMUTimer *timer_head, int64_t current_time);
uint64_t qemu_timer_expire_time_ns(QEMUTimer *ts); uint64_t timer_expire_time_ns(QEMUTimer *ts);
void qemu_run_timers(QEMUClock *clock); void qemu_run_timers(QEMUClock *clock);
void qemu_run_all_timers(void); void qemu_run_all_timers(void);

View File

@ -80,7 +80,7 @@ struct qemu_alarm_timer {
static struct qemu_alarm_timer *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); return timer_head && (timer_head->expire_time <= current_time);
} }
@ -301,7 +301,7 @@ void qemu_del_timer(QEMUTimer *ts)
QEMUTimer **pt, *t; QEMUTimer **pt, *t;
/* NOTE: this code must be signal safe because /* 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; pt = &ts->clock->active_timers;
for(;;) { for(;;) {
t = *pt; t = *pt;
@ -325,11 +325,11 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
/* add the timer in the sorted list */ /* add the timer in the sorted list */
/* NOTE: this code must be signal safe because /* 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; pt = &ts->clock->active_timers;
for(;;) { for(;;) {
t = *pt; t = *pt;
if (!qemu_timer_expired_ns(t, expire_time)) { if (!timer_expired_ns(t, expire_time)) {
break; break;
} }
pt = &t->next; 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); qemu_mod_timer_ns(ts, expire_time * ts->scale);
} }
bool qemu_timer_pending(QEMUTimer *ts) bool timer_pending(QEMUTimer *ts)
{ {
QEMUTimer *t; QEMUTimer *t;
for (t = ts->clock->active_timers; t != NULL; t = t->next) { for (t = ts->clock->active_timers; t != NULL; t = t->next) {
@ -367,9 +367,9 @@ bool qemu_timer_pending(QEMUTimer *ts)
return false; 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) void qemu_run_timers(QEMUClock *clock)
@ -383,7 +383,7 @@ void qemu_run_timers(QEMUClock *clock)
current_time = qemu_get_clock_ns(clock); current_time = qemu_get_clock_ns(clock);
for(;;) { for(;;) {
ts = clock->active_timers; ts = clock->active_timers;
if (!qemu_timer_expired_ns(ts, current_time)) { if (!timer_expired_ns(ts, current_time)) {
break; break;
} }
/* remove timer from the list before calling the callback */ /* 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) void qemu_run_all_timers(void)

View File

@ -983,7 +983,7 @@ void qemu_put_timer(QEMUFile *f, QEMUTimer *ts)
{ {
uint64_t expire_time; 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); qemu_put_be64(f, expire_time);
} }