[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/27] net: slirp: introduce a wrapper struct for QemuTimer
From: |
Paolo Bonzini |
Subject: |
[PULL 17/27] net: slirp: introduce a wrapper struct for QemuTimer |
Date: |
Thu, 12 May 2022 19:24:55 +0200 |
This struct will be extended in the next few patches to support the
new slirp_handle_timer() call. For that we need to store an additional
"int" for each SLIRP timer, in addition to the cb_opaque.
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Marc-André Lureau <malureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
net/slirp.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/net/slirp.c b/net/slirp.c
index bc5e9e4f77..f1e25d741f 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -184,23 +184,32 @@ static int64_t net_slirp_clock_get_ns(void *opaque)
return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
}
+struct SlirpTimer {
+ QEMUTimer timer;
+}
+
static void *net_slirp_timer_new(SlirpTimerCb cb,
void *cb_opaque, void *opaque)
{
- return timer_new_full(NULL, QEMU_CLOCK_VIRTUAL,
- SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL,
- cb, cb_opaque);
+ SlirpTimer *t = g_new(SlirpTimer, 1);
+ timer_init_full(&t->timer, NULL, QEMU_CLOCK_VIRTUAL,
+ SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL,
+ cb, cb_opaque);
+ return t;
}
static void net_slirp_timer_free(void *timer, void *opaque)
{
- timer_free(timer);
+ SlirpTimer *t = timer;
+ timer_del(&t->timer);
+ g_free(t);
}
static void net_slirp_timer_mod(void *timer, int64_t expire_timer,
void *opaque)
{
- timer_mod(timer, expire_timer);
+ SlirpTimer *t = timer;
+ timer_mod(&t->timer, expire_timer);
}
static void net_slirp_register_poll_fd(int fd, void *opaque)
--
2.36.0
- [PULL 00/27] Misc patches for 2022-05-12, Paolo Bonzini, 2022/05/12
- [PULL 02/27] pc-bios/optionrom: compile with -Wno-array-bounds, Paolo Bonzini, 2022/05/12
- [PULL 03/27] target/i386: do not consult nonexistent host leaves, Paolo Bonzini, 2022/05/12
- [PULL 01/27] pc-bios/optionrom: detect -fno-pie, Paolo Bonzini, 2022/05/12
- [PULL 05/27] meson: Make mremap() detecting works correctly, Paolo Bonzini, 2022/05/12
- [PULL 11/27] machine: use QAPI struct for boot configuration, Paolo Bonzini, 2022/05/12
- [PULL 12/27] machine: add boot compound property, Paolo Bonzini, 2022/05/12
- [PULL 16/27] slirp: bump submodule past 4.7 release, Paolo Bonzini, 2022/05/12
- [PULL 06/27] hw/xen/xen_pt: Confine igd-passthrough-isa-bridge to XEN, Paolo Bonzini, 2022/05/12
- [PULL 14/27] machine: make memory-backend a link property, Paolo Bonzini, 2022/05/12
- [PULL 17/27] net: slirp: introduce a wrapper struct for QemuTimer,
Paolo Bonzini <=
- [PULL 18/27] net: slirp: switch to slirp_new, Paolo Bonzini, 2022/05/12
- [PULL 20/27] net: slirp: allow CFI with libslirp >= 4.7, Paolo Bonzini, 2022/05/12
- [PULL 21/27] coroutine-lock: qemu_co_queue_next is a coroutine-only qemu_co_enter_next, Paolo Bonzini, 2022/05/12
- [PULL 22/27] coroutine-lock: introduce qemu_co_queue_enter_all, Paolo Bonzini, 2022/05/12
- [PULL 08/27] tests/qtest/libqos/pci: Introduce pio_limit, Paolo Bonzini, 2022/05/12
- [PULL 04/27] checkpatch: fix g_malloc check, Paolo Bonzini, 2022/05/12
- [PULL 07/27] hw/xen/xen_pt: Resolve igd_passthrough_isa_bridge_create() indirection, Paolo Bonzini, 2022/05/12
- [PULL 09/27] tests/qtest/libqos: Skip hotplug tests if pci root bus is not hotpluggable, Paolo Bonzini, 2022/05/12
- [PULL 10/27] tests/qtest/libqos: Add generic pci host bridge in arm-virt machine, Paolo Bonzini, 2022/05/12
- [PULL 13/27] machine: add mem compound property, Paolo Bonzini, 2022/05/12