mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Convert daemon/virsh over to use primary event APIs, rather than impl
The daemon code calls virEventAddHandleImpl directly instead of calling the wrapper virEventAddHandle. * tools/console.c, daemon/libvirtd.c, daemon/mdns.c: Convert to use primary event APIs
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "libvirtd.h"
|
||||
#include "mdns.h"
|
||||
#include "event.h"
|
||||
#include "src/util/event.h"
|
||||
#include "memory.h"
|
||||
|
||||
#define AVAHI_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
|
||||
@@ -257,10 +258,10 @@ static AvahiWatch *libvirtd_mdns_watch_new(const AvahiPoll *api ATTRIBUTE_UNUSED
|
||||
|
||||
AVAHI_DEBUG("New handle %p FD %d Event %d", w, w->fd, event);
|
||||
hEvents = virPollEventToEventHandleType(event);
|
||||
if ((w->watch = virEventAddHandleImpl(fd, hEvents,
|
||||
libvirtd_mdns_watch_dispatch,
|
||||
w,
|
||||
libvirtd_mdns_watch_dofree)) < 0) {
|
||||
if ((w->watch = virEventAddHandle(fd, hEvents,
|
||||
libvirtd_mdns_watch_dispatch,
|
||||
w,
|
||||
libvirtd_mdns_watch_dofree)) < 0) {
|
||||
VIR_FREE(w);
|
||||
return NULL;
|
||||
}
|
||||
@@ -271,7 +272,7 @@ static AvahiWatch *libvirtd_mdns_watch_new(const AvahiPoll *api ATTRIBUTE_UNUSED
|
||||
static void libvirtd_mdns_watch_update(AvahiWatch *w, AvahiWatchEvent event)
|
||||
{
|
||||
AVAHI_DEBUG("Update handle %p FD %d Event %d", w, w->fd, event);
|
||||
virEventUpdateHandleImpl(w->watch, event);
|
||||
virEventUpdateHandle(w->watch, event);
|
||||
}
|
||||
|
||||
static AvahiWatchEvent libvirtd_mdns_watch_get_events(AvahiWatch *w)
|
||||
@@ -283,14 +284,14 @@ static AvahiWatchEvent libvirtd_mdns_watch_get_events(AvahiWatch *w)
|
||||
static void libvirtd_mdns_watch_free(AvahiWatch *w)
|
||||
{
|
||||
AVAHI_DEBUG("Free handle %p %d", w, w->fd);
|
||||
virEventRemoveHandleImpl(w->watch);
|
||||
virEventRemoveHandle(w->watch);
|
||||
}
|
||||
|
||||
static void libvirtd_mdns_timeout_dispatch(int timer ATTRIBUTE_UNUSED, void *opaque)
|
||||
{
|
||||
AvahiTimeout *t = (AvahiTimeout*)opaque;
|
||||
AVAHI_DEBUG("Dispatch timeout %p %d", t, timer);
|
||||
virEventUpdateTimeoutImpl(t->timer, -1);
|
||||
virEventUpdateTimeout(t->timer, -1);
|
||||
t->callback(t, t->userdata);
|
||||
}
|
||||
|
||||
@@ -329,10 +330,10 @@ static AvahiTimeout *libvirtd_mdns_timeout_new(const AvahiPoll *api ATTRIBUTE_UN
|
||||
timeout = -1;
|
||||
}
|
||||
|
||||
t->timer = virEventAddTimeoutImpl(timeout,
|
||||
libvirtd_mdns_timeout_dispatch,
|
||||
t,
|
||||
libvirtd_mdns_timeout_dofree);
|
||||
t->timer = virEventAddTimeout(timeout,
|
||||
libvirtd_mdns_timeout_dispatch,
|
||||
t,
|
||||
libvirtd_mdns_timeout_dofree);
|
||||
t->callback = cb;
|
||||
t->userdata = userdata;
|
||||
|
||||
@@ -364,13 +365,13 @@ static void libvirtd_mdns_timeout_update(AvahiTimeout *t, const struct timeval *
|
||||
timeout = -1;
|
||||
}
|
||||
|
||||
virEventUpdateTimeoutImpl(t->timer, timeout);
|
||||
virEventUpdateTimeout(t->timer, timeout);
|
||||
}
|
||||
|
||||
static void libvirtd_mdns_timeout_free(AvahiTimeout *t)
|
||||
{
|
||||
AVAHI_DEBUG("Free timeout %p", t);
|
||||
virEventRemoveTimeoutImpl(t->timer);
|
||||
virEventRemoveTimeout(t->timer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user