Add an AioContext pointer to QEMUTimerList so it knows what to notify on a timer change.
Signed-off-by: Alex Bligh <a...@alex.org.uk> --- async.c | 1 + include/qemu/timer.h | 3 +++ qemu-timer.c | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/async.c b/async.c index 8acbd4c..d3ed868 100644 --- a/async.c +++ b/async.c @@ -222,6 +222,7 @@ AioContext *aio_context_new(void) */ assert(rt_clock); ctx->tl = qemu_new_timerlist(rt_clock); + qemu_timerlist_set_ctx(ctx->tl, ctx); return ctx; } diff --git a/include/qemu/timer.h b/include/qemu/timer.h index e627033..3eb9fb7 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -17,6 +17,7 @@ typedef struct QEMUClock QEMUClock; typedef struct QEMUTimerList QEMUTimerList; +typedef struct AioContext AioContext; typedef void QEMUTimerCB(void *opaque); /* The real time clock should be used only for stuff which does not @@ -52,6 +53,8 @@ int64_t qemu_timerlist_deadline(QEMUTimerList *tl); int64_t qemu_timerlist_deadline_ns(QEMUTimerList *tl); QEMUClock *qemu_timerlist_get_clock(QEMUTimerList *tl); QEMUTimerList *qemu_clock_get_default_timerlist(QEMUClock *clock); +AioContext *qemu_timerlist_get_ctx(QEMUTimerList *tl); +void qemu_timerlist_set_ctx(QEMUTimerList *tl, AioContext * ctx); int qemu_timeout_ns_to_ms(int64_t ns); int qemu_poll_ns(GPollFD *fds, uint nfds, int64_t timeout); void qemu_clock_enable(QEMUClock *clock, bool enabled); diff --git a/qemu-timer.c b/qemu-timer.c index 211c379..9d992d6 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -29,6 +29,7 @@ #include "hw/hw.h" #include "qemu/timer.h" +#include "block/aio.h" #ifdef CONFIG_POSIX #include <pthread.h> #endif @@ -70,6 +71,7 @@ struct QEMUTimerList { QEMUClock *clock; QEMUTimer *active_timers; QLIST_ENTRY(QEMUTimerList) list; + AioContext *ctx; }; struct QEMUTimer { @@ -379,6 +381,16 @@ QEMUTimerList *qemu_clock_get_default_timerlist(QEMUClock *clock) return clock->default_timerlist; } +AioContext *qemu_timerlist_get_ctx(QEMUTimerList *tl) +{ + return tl->ctx; +} + +void qemu_timerlist_set_ctx(QEMUTimerList *tl, AioContext * ctx) +{ + tl->ctx = ctx; +} + /* Transition function to convert a nanosecond timeout to ms * This is used where a system does not support ppoll */ -- 1.7.9.5