[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/7] timer: move QEMUTimerListGroup function to be b
From: |
Xuebing Wang |
Subject: |
[Qemu-devel] [PATCH 4/7] timer: move QEMUTimerListGroup function to be below QEMUClockType |
Date: |
Tue, 25 Feb 2014 21:36:51 +0800 |
Signed-off-by: Xuebing Wang <address@hidden>
---
qemu-timer.c | 86 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 45 insertions(+), 41 deletions(-)
diff --git a/qemu-timer.c b/qemu-timer.c
index 471150c..6f13a76 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -456,6 +456,51 @@ bool qemu_clock_run_all_timers(void)
return progress;
}
+/*
+ * QEMUTimerListGroup
+ */
+
+void timerlistgroup_init(QEMUTimerListGroup *tlg,
+ QEMUTimerListNotifyCB *cb, void *opaque)
+{
+ QEMUClockType type;
+ for (type = 0; type < QEMU_CLOCK_MAX; type++) {
+ tlg->tl[type] = timerlist_new(type, cb, opaque);
+ }
+}
+
+void timerlistgroup_deinit(QEMUTimerListGroup *tlg)
+{
+ QEMUClockType type;
+ for (type = 0; type < QEMU_CLOCK_MAX; type++) {
+ timerlist_free(tlg->tl[type]);
+ }
+}
+
+bool timerlistgroup_run_timers(QEMUTimerListGroup *tlg)
+{
+ QEMUClockType type;
+ bool progress = false;
+ for (type = 0; type < QEMU_CLOCK_MAX; type++) {
+ progress |= timerlist_run_timers(tlg->tl[type]);
+ }
+ return progress;
+}
+
+int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg)
+{
+ int64_t deadline = -1;
+ QEMUClockType type;
+ for (type = 0; type < QEMU_CLOCK_MAX; type++) {
+ if (qemu_clock_use_for_deadline(tlg->tl[type]->clock->type)) {
+ deadline = qemu_soonest_timeout(deadline,
+ timerlist_deadline_ns(
+ tlg->tl[type]));
+ }
+ }
+ return deadline;
+}
+
/* Transition function to convert a nanosecond timeout to ms
* This is used where a system does not support ppoll
*/
@@ -630,47 +675,6 @@ bool timer_expired(QEMUTimer *timer_head, int64_t
current_time)
return timer_expired_ns(timer_head, current_time * timer_head->scale);
}
-void timerlistgroup_init(QEMUTimerListGroup *tlg,
- QEMUTimerListNotifyCB *cb, void *opaque)
-{
- QEMUClockType type;
- for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- tlg->tl[type] = timerlist_new(type, cb, opaque);
- }
-}
-
-void timerlistgroup_deinit(QEMUTimerListGroup *tlg)
-{
- QEMUClockType type;
- for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- timerlist_free(tlg->tl[type]);
- }
-}
-
-bool timerlistgroup_run_timers(QEMUTimerListGroup *tlg)
-{
- QEMUClockType type;
- bool progress = false;
- for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- progress |= timerlist_run_timers(tlg->tl[type]);
- }
- return progress;
-}
-
-int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg)
-{
- int64_t deadline = -1;
- QEMUClockType type;
- for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- if (qemu_clock_use_for_deadline(tlg->tl[type]->clock->type)) {
- deadline = qemu_soonest_timeout(deadline,
- timerlist_deadline_ns(
- tlg->tl[type]));
- }
- }
- return deadline;
-}
-
void init_clocks(void)
{
QEMUClockType type;
--
1.7.9.5
- [Qemu-devel] [PATCH 0/7] timer: move APIs together according to their category, Xuebing Wang, 2014/02/25
- [Qemu-devel] [PATCH 1/7] timer: move QEMUTimerList functions together, Xuebing Wang, 2014/02/25
- [Qemu-devel] [PATCH 2/7] timer: make QEMUTimerLi st functions private (remove from APIs), Xuebing Wang, 2014/02/25
- [Qemu-devel] [PATCH 3/7] timer: move QEMUClockType related functions together, Xuebing Wang, 2014/02/25
- [Qemu-devel] [PATCH 4/7] timer: move QEMUTimerListGroup function to be below QEMUClockType,
Xuebing Wang <=
- [Qemu-devel] [PATCH 5/7] timer: move QEMUTimer related functions together, Xuebing Wang, 2014/02/25
- [Qemu-devel] [PATCH 6/7] timer: move general utility functions together, Xuebing Wang, 2014/02/25
- [Qemu-devel] [PATCH 7/7] timer: clean unnecessary #include and use minimal required #include, Xuebing Wang, 2014/02/25
- Re: [Qemu-devel] [PATCH 0/7] timer: move APIs together according to their category, Alex Bligh, 2014/02/25
- Re: [Qemu-devel] [PATCH 0/7] timer: move APIs together according to their category, Alex Bligh, 2014/02/27