Update the stdio code to use the new iohandler api. The change is mostly mechanical with a new iohandler function calling the older functions depending on the value of the 'mask' field.
Signed-off-by: Amit Shah <amit.s...@redhat.com> --- qemu-char.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index d93820e..ade28ba 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -717,7 +717,7 @@ static void stdio_read(void *opaque) size = read(0, buf, 1); if (size == 0) { /* stdin has been closed. Remove it from the active list. */ - qemu_set_fd_handler2(0, NULL, NULL, NULL, NULL); + remove_iohandler(0); qemu_chr_event(chr, CHR_EVENT_CLOSED); return; } @@ -730,6 +730,22 @@ static void stdio_read(void *opaque) } } +static int stdio_iohandler(void *opaque, unsigned int mask) +{ + int ret; + + ret = 0; + switch(mask) { + case IOH_MASK_CAN_READ: + ret = stdio_read_poll(opaque); + break; + case IOH_MASK_READ: + stdio_read(opaque); + break; + } + return ret; +} + /* init terminal so that we can grab keys */ static struct termios oldtty; static int old_fd0_flags; @@ -767,7 +783,7 @@ static void qemu_chr_close_stdio(struct CharDriverState *chr) { term_exit(); stdio_nb_clients--; - qemu_set_fd_handler2(0, NULL, NULL, NULL, NULL); + remove_iohandler(0); fd_chr_close(chr); } @@ -787,7 +803,7 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts) chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; - qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); + assign_iohandler(0, stdio_iohandler, IOH_MASK_CAN_READ|IOH_MASK_READ, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC); -- 1.7.4