mirror of
https://github.com/libvirt/libvirt.git
synced 2026-08-10 04:58:12 -05: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:
+16
-15
@@ -44,6 +44,7 @@
|
||||
# include "virterror_internal.h"
|
||||
|
||||
# include "daemon/event.h"
|
||||
# include "src/util/event.h"
|
||||
|
||||
/* ie Ctrl-] as per telnet */
|
||||
# define CTRL_CLOSE_BRACKET '\35'
|
||||
@@ -93,9 +94,9 @@ virConsoleShutdown(virConsolePtr con)
|
||||
con->quit = true;
|
||||
virStreamEventRemoveCallback(con->st);
|
||||
if (con->stdinWatch != -1)
|
||||
virEventRemoveHandleImpl(con->stdinWatch);
|
||||
virEventRemoveHandle(con->stdinWatch);
|
||||
if (con->stdinWatch != -1)
|
||||
virEventRemoveHandleImpl(con->stdoutWatch);
|
||||
virEventRemoveHandle(con->stdoutWatch);
|
||||
con->stdinWatch = -1;
|
||||
con->stdoutWatch = -1;
|
||||
}
|
||||
@@ -134,8 +135,8 @@ virConsoleEventOnStream(virStreamPtr st,
|
||||
}
|
||||
con->streamToTerminal.offset += got;
|
||||
if (con->streamToTerminal.offset)
|
||||
virEventUpdateHandleImpl(con->stdoutWatch,
|
||||
VIR_EVENT_HANDLE_WRITABLE);
|
||||
virEventUpdateHandle(con->stdoutWatch,
|
||||
VIR_EVENT_HANDLE_WRITABLE);
|
||||
}
|
||||
|
||||
if (events & VIR_STREAM_EVENT_WRITABLE &&
|
||||
@@ -266,7 +267,7 @@ virConsoleEventOnStdout(int watch ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
if (!con->streamToTerminal.offset)
|
||||
virEventUpdateHandleImpl(con->stdoutWatch, 0);
|
||||
virEventUpdateHandle(con->stdoutWatch, 0);
|
||||
|
||||
if (events & VIR_EVENT_HANDLE_ERROR ||
|
||||
events & VIR_EVENT_HANDLE_HANGUP) {
|
||||
@@ -331,16 +332,16 @@ int vshRunConsole(virDomainPtr dom, const char *devname)
|
||||
if (virDomainOpenConsole(dom, devname, con->st, 0) < 0)
|
||||
goto cleanup;
|
||||
|
||||
con->stdinWatch = virEventAddHandleImpl(STDIN_FILENO,
|
||||
VIR_EVENT_HANDLE_READABLE,
|
||||
virConsoleEventOnStdin,
|
||||
con,
|
||||
NULL);
|
||||
con->stdoutWatch = virEventAddHandleImpl(STDOUT_FILENO,
|
||||
0,
|
||||
virConsoleEventOnStdout,
|
||||
con,
|
||||
NULL);
|
||||
con->stdinWatch = virEventAddHandle(STDIN_FILENO,
|
||||
VIR_EVENT_HANDLE_READABLE,
|
||||
virConsoleEventOnStdin,
|
||||
con,
|
||||
NULL);
|
||||
con->stdoutWatch = virEventAddHandle(STDOUT_FILENO,
|
||||
0,
|
||||
virConsoleEventOnStdout,
|
||||
con,
|
||||
NULL);
|
||||
|
||||
virStreamEventAddCallback(con->st,
|
||||
VIR_STREAM_EVENT_READABLE,
|
||||
|
||||
Reference in New Issue
Block a user