Patch consist: s/qemu_set_fd_handler2(fd, poll, read, NULL, o)/ qemu_set_fd_poll_handler(fd, poll, read, o)/
Signed-off-by: Juan Quintela <quint...@redhat.com> --- qemu-char.c | 18 +++++++++--------- qemu-char.h | 4 ++++ vl.c | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 43d0758..4822209 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -576,8 +576,8 @@ static void fd_chr_update_read_handler(CharDriverState *chr) if (s->fd_in >= 0) { if (display_type == DT_NOGRAPHIC && s->fd_in == 0) { } else { - qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll, - fd_chr_read, NULL, chr); + qemu_set_fd_poll_handler(s->fd_in, fd_chr_read_poll, + fd_chr_read, chr); } } } @@ -757,7 +757,7 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts) return NULL; chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; - qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); + qemu_set_fd_poll_handler(0, stdio_read_poll, stdio_read, chr); stdio_nb_clients++; term_init(opts); @@ -885,8 +885,8 @@ static void pty_chr_update_read_handler(CharDriverState *chr) { PtyCharDriver *s = chr->opaque; - qemu_set_fd_handler2(s->fd, pty_chr_read_poll, - pty_chr_read, NULL, chr); + qemu_set_fd_poll_handler(s->fd, pty_chr_read_poll, + pty_chr_read, chr); s->polling = 1; /* * Short timeout here: just need wait long enougth that qemu makes @@ -1831,8 +1831,8 @@ static void udp_chr_update_read_handler(CharDriverState *chr) NetCharDriver *s = chr->opaque; if (s->fd >= 0) { - qemu_set_fd_handler2(s->fd, udp_chr_read_poll, - udp_chr_read, NULL, chr); + qemu_set_fd_poll_handler(s->fd, udp_chr_read_poll, + udp_chr_read, chr); } } @@ -2072,8 +2072,8 @@ static void tcp_chr_connect(void *opaque) TCPCharDriver *s = chr->opaque; s->connected = 1; - qemu_set_fd_handler2(s->fd, tcp_chr_read_poll, - tcp_chr_read, NULL, chr); + qemu_set_fd_poll_handler(s->fd, tcp_chr_read_poll, + tcp_chr_read, chr); qemu_chr_generic_open(chr); } diff --git a/qemu-char.h b/qemu-char.h index 8d7da54..ffc6cb6 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -113,5 +113,9 @@ int qemu_set_fd_read_handler(int fd, int qemu_set_fd_write_handler(int fd, IOHandler *fd_read, void *opaque); +int qemu_set_fd_poll_handler(int fd, + IOCanRWHandler *fd_read_poll, + IOHandler *fd_read, + void *opaque); #endif diff --git a/vl.c b/vl.c index c061732..2cb35dc 100644 --- a/vl.c +++ b/vl.c @@ -2684,6 +2684,22 @@ int qemu_set_fd_write_handler(int fd, return qemu_set_fd_handler2(fd, NULL, NULL, fd_write, opaque); } +int qemu_set_fd_poll_handler(int fd, + IOCanRWHandler *fd_read_poll, + IOHandler *fd_read, + void *opaque) +{ + if(fd_read_poll == NULL) { + fprintf(stderr, "qemu_set_fd_poll_handler: NULL poll handler\n"); + exit(1); + } + if(fd_read == NULL) { + fprintf(stderr, "qemu_set_fd_poll_handler: NULL read handler\n"); + exit(1); + } + return qemu_set_fd_handler2(fd, fd_read_poll, fd_read, NULL, opaque); +} + #ifdef _WIN32 /***********************************************************/ /* Polling handling */ -- 1.6.6.1