aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-17 15:43:58 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-07 15:49:08 +0200
commit3e0fad3aa5f9f36566ac2815a54288d214e58689 (patch)
treef2714d8506fe29bcaaaa4edabe341ee8befddc34 /net
parentdeaeb3f71d1fdf199d5b949e8575303486e3dec8 (diff)
slirp: pass opaque to all callbacks
This is friendlier for FFI bindings. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'net')
-rw-r--r--net/slirp.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/net/slirp.c b/net/slirp.c
index a85e42ff43..7a16d8d615 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -161,44 +161,51 @@ static NetClientInfo net_slirp_info = {
.cleanup = net_slirp_cleanup,
};
-static void net_slirp_guest_error(const char *msg)
+static void net_slirp_guest_error(const char *msg, void *opaque)
{
qemu_log_mask(LOG_GUEST_ERROR, "%s", msg);
}
-static int64_t net_slirp_clock_get_ns(void)
+static int64_t net_slirp_clock_get_ns(void *opaque)
{
return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
}
-static void *net_slirp_timer_new(SlirpTimerCb cb, void *opaque)
+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, opaque);
+ cb, cb_opaque);
}
-static void net_slirp_timer_free(void *timer)
+static void net_slirp_timer_free(void *timer, void *opaque)
{
timer_del(timer);
timer_free(timer);
}
-static void net_slirp_timer_mod(void *timer, int64_t expire_timer)
+static void net_slirp_timer_mod(void *timer, int64_t expire_timer,
+ void *opaque)
{
timer_mod(timer, expire_timer);
}
-static void net_slirp_register_poll_fd(int fd)
+static void net_slirp_register_poll_fd(int fd, void *opaque)
{
qemu_fd_register(fd);
}
-static void net_slirp_unregister_poll_fd(int fd)
+static void net_slirp_unregister_poll_fd(int fd, void *opaque)
{
/* no qemu_fd_unregister */
}
+static void net_slirp_notify(void *opaque)
+{
+ qemu_notify_event();
+}
+
static const SlirpCb slirp_cb = {
.send_packet = net_slirp_send_packet,
.guest_error = net_slirp_guest_error,
@@ -208,7 +215,7 @@ static const SlirpCb slirp_cb = {
.timer_mod = net_slirp_timer_mod,
.register_poll_fd = net_slirp_register_poll_fd,
.unregister_poll_fd = net_slirp_unregister_poll_fd,
- .notify = qemu_notify_event,
+ .notify = net_slirp_notify,
};
static int slirp_poll_to_gio(int events)