Patch consist: s/qemu_set_fd_handler(fd, read, NULL, o)/ qemu_set_fd_read_handler(fd, read, o)/
s/qemu_set_fd_handler2(fd, NULL, read, NULL, o)/ qemu_set_fd_read_handler(fd, read, o)/ Signed-off-by: Juan Quintela <quint...@redhat.com> --- audio/alsaaudio.c | 4 ++-- audio/ossaudio.c | 2 +- bt-vhci.c | 2 +- hw/baum.c | 2 +- hw/xen_backend.c | 6 +++--- migration-exec.c | 6 +++--- migration-fd.c | 4 ++-- migration-tcp.c | 4 ++-- migration-unix.c | 4 ++-- net/socket.c | 6 +++--- net/vde.c | 2 +- qemu-char.c | 4 ++-- qemu-char.h | 4 ++++ vl.c | 15 +++++++++++++-- vnc-auth-sasl.c | 2 +- vnc-auth-vencrypt.c | 2 +- vnc.c | 6 +++--- 17 files changed, 45 insertions(+), 30 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 4259d9c..2455ee4 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -266,8 +266,8 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct pollhlp *hlp, int mask) for (i = 0; i < count; ++i) { if (pfds[i].events & POLLIN) { - err = qemu_set_fd_handler (pfds[i].fd, alsa_poll_handler, - NULL, hlp); + err = qemu_set_fd_read_handler (pfds[i].fd, alsa_poll_handler, + hlp); } if (pfds[i].events & POLLOUT) { if (conf.verbose) { diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 97e0f1b..4c91a46 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -153,7 +153,7 @@ static int oss_poll_in (HWVoiceIn *hw) { OSSVoiceIn *oss = (OSSVoiceIn *) hw; - return qemu_set_fd_handler (oss->fd, oss_helper_poll_in, NULL, NULL); + return qemu_set_fd_read_handler (oss->fd, oss_helper_poll_in, NULL); } static int oss_write (SWVoiceOut *sw, void *buf, int len) diff --git a/bt-vhci.c b/bt-vhci.c index 679c5e0..2352f1f 100644 --- a/bt-vhci.c +++ b/bt-vhci.c @@ -164,5 +164,5 @@ void bt_vhci_init(struct HCIInfo *info) s->info->evt_recv = vhci_out_hci_packet_event; s->info->acl_recv = vhci_out_hci_packet_acl; - qemu_set_fd_handler(s->fd, vhci_read, NULL, s); + qemu_set_fd_read_handler(s->fd, vhci_read, s); } diff --git a/hw/baum.c b/hw/baum.c index 18633f4..c856939 100644 --- a/hw/baum.c +++ b/hw/baum.c @@ -612,7 +612,7 @@ CharDriverState *chr_baum_init(QemuOpts *opts) goto fail; } - qemu_set_fd_handler(baum->brlapi_fd, baum_chr_read, NULL, baum); + qemu_set_fd_read_handler(baum->brlapi_fd, baum_chr_read, baum); qemu_chr_generic_open(chr); diff --git a/hw/xen_backend.c b/hw/xen_backend.c index 2eec0c6..a86e92f 100644 --- a/hw/xen_backend.c +++ b/hw/xen_backend.c @@ -624,7 +624,7 @@ int xen_be_init(void) return -1; } - if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0) + if (qemu_set_fd_read_handler(xs_fileno(xenstore), xenstore_update, NULL) < 0) goto err; xen_xc = xc_interface_open(); @@ -658,8 +658,8 @@ int xen_be_bind_evtchn(struct XenDevice *xendev) return -1; } xen_be_printf(xendev, 2, "bind evtchn port %d\n", xendev->local_port); - qemu_set_fd_handler(xc_evtchn_fd(xendev->evtchndev), - xen_be_evtchn_event, NULL, xendev); + qemu_set_fd_read_handler(xc_evtchn_fd(xendev->evtchndev), + xen_be_evtchn_event, xendev); return 0; } diff --git a/migration-exec.c b/migration-exec.c index 7e2ac0e..76518a6 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -140,9 +140,9 @@ int exec_start_incoming_migration(const char *command) return -errno; } - qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, - exec_accept_incoming_migration, NULL, - (void *)(unsigned long)f); + qemu_set_fd_read_handler(qemu_stdio_fd(f), + exec_accept_incoming_migration, + (void *)(unsigned long)f); return 0; } diff --git a/migration-fd.c b/migration-fd.c index 056ac3e..8a4c2b8 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -136,8 +136,8 @@ int fd_start_incoming_migration(const char *infd) return -errno; } - qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL, - (void *)(unsigned long)f); + qemu_set_fd_read_handler(fd, fd_accept_incoming_migration, + (void *)(unsigned long)f); return 0; } diff --git a/migration-tcp.c b/migration-tcp.c index d542804..66f126f 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -206,8 +206,8 @@ int tcp_start_incoming_migration(const char *host_port) if (listen(s, 1) == -1) goto err; - qemu_set_fd_handler2(s, NULL, tcp_accept_incoming_migration, NULL, - (void *)(unsigned long)s); + qemu_set_fd_read_handler(s, tcp_accept_incoming_migration, + (void *)(unsigned long)s); return 0; diff --git a/migration-unix.c b/migration-unix.c index 44427f8..fe9a820 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -213,8 +213,8 @@ int unix_start_incoming_migration(const char *path) goto err; } - qemu_set_fd_handler2(sock, NULL, unix_accept_incoming_migration, NULL, - (void *)(unsigned long)sock); + qemu_set_fd_read_handler(sock, unix_accept_incoming_migration, + (void *)(unsigned long)sock); return 0; diff --git a/net/socket.c b/net/socket.c index b7a21f8..5772202 100644 --- a/net/socket.c +++ b/net/socket.c @@ -276,7 +276,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, s->fd = fd; - qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s); + qemu_set_fd_read_handler(s->fd, net_socket_send_dgram, s); /* mcast: save bound address as dst */ if (is_connected) s->dgram_dst=saddr; @@ -287,7 +287,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, static void net_socket_connect(void *opaque) { NetSocketState *s = opaque; - qemu_set_fd_handler(s->fd, net_socket_send, NULL, s); + qemu_set_fd_read_handler(s->fd, net_socket_send, s); } static NetClientInfo net_socket_info = { @@ -411,7 +411,7 @@ static int net_socket_listen_init(VLANState *vlan, s->model = qemu_strdup(model); s->name = name ? qemu_strdup(name) : NULL; s->fd = fd; - qemu_set_fd_handler(fd, net_socket_accept, NULL, s); + qemu_set_fd_read_handler(fd, net_socket_accept, s); return 0; } diff --git a/net/vde.c b/net/vde.c index fc75e8f..a99dcdf 100644 --- a/net/vde.c +++ b/net/vde.c @@ -106,7 +106,7 @@ static int net_vde_init(VLANState *vlan, const char *model, s->vde = vde; - qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s); + qemu_set_fd_read_handler(vde_datafd(s->vde), vde_to_qemu, s); return 0; } diff --git a/qemu-char.c b/qemu-char.c index a87e4e7..43d0758 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2048,7 +2048,7 @@ static void tcp_chr_read(void *opaque) /* connection closed */ s->connected = 0; if (s->listen_fd >= 0) { - qemu_set_fd_handler(s->listen_fd, tcp_chr_accept, NULL, chr); + qemu_set_fd_read_handler(s->listen_fd, tcp_chr_accept, chr); } qemu_clear_fd_handler(s->fd); closesocket(s->fd); @@ -2208,7 +2208,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) if (is_listen) { s->listen_fd = fd; - qemu_set_fd_handler(s->listen_fd, tcp_chr_accept, NULL, chr); + qemu_set_fd_read_handler(s->listen_fd, tcp_chr_accept, chr); if (is_telnet) s->do_telnetopt = 1; diff --git a/qemu-char.h b/qemu-char.h index 23305a8..70e4bf9 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -107,5 +107,9 @@ int qemu_set_fd_handler(int fd, IOHandler *fd_read, IOHandler *fd_write, void *opaque); +int qemu_set_fd_read_handler(int fd, + IOHandler *fd_read, + void *opaque); + #endif diff --git a/vl.c b/vl.c index 2d364bb..c855167 100644 --- a/vl.c +++ b/vl.c @@ -2654,6 +2654,17 @@ int qemu_set_fd_handler(int fd, return qemu_set_fd_handler2(fd, NULL, fd_read, fd_write, opaque); } +int qemu_set_fd_read_handler(int fd, + IOHandler *fd_read, + void *opaque) +{ + if(fd_read == NULL) { + fprintf(stderr, "qemu_set_fd_read_handler: NULL read handler\n"); + exit(1); + } + return qemu_set_fd_handler2(fd, NULL, fd_read, NULL, opaque); +} + #ifdef _WIN32 /***********************************************************/ /* Polling handling */ @@ -3259,8 +3270,8 @@ static int qemu_event_init(void) if (err < 0) goto fail; - qemu_set_fd_handler2(fds[0], NULL, qemu_event_read, NULL, - (void *)(unsigned long)fds[0]); + qemu_set_fd_read_handler(fds[0], qemu_event_read, + (void *)(unsigned long)fds[0]); io_thread_fd = fds[1]; return 0; diff --git a/vnc-auth-sasl.c b/vnc-auth-sasl.c index acaac0c..5b2dd47 100644 --- a/vnc-auth-sasl.c +++ b/vnc-auth-sasl.c @@ -83,7 +83,7 @@ long vnc_client_write_sasl(VncState *vs) * SASL encoded output */ if (vs->output.offset == 0) { - qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); + qemu_set_fd_read_handler(vs->csock, vnc_client_read, vs); } return ret; diff --git a/vnc-auth-vencrypt.c b/vnc-auth-vencrypt.c index 07c1691..2999c2d 100644 --- a/vnc-auth-vencrypt.c +++ b/vnc-auth-vencrypt.c @@ -71,7 +71,7 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs) { if (!gnutls_error_is_fatal(ret)) { VNC_DEBUG("Handshake interrupted (blocking)\n"); if (!gnutls_record_get_direction(vs->tls.session)) - qemu_set_fd_handler(vs->csock, vnc_tls_handshake_io, NULL, vs); + qemu_set_fd_read_handler(vs->csock, vnc_tls_handshake_io, vs); else qemu_set_fd_handler(vs->csock, NULL, vnc_tls_handshake_io, vs); return 0; diff --git a/vnc.c b/vnc.c index d15a984..2634dc8 100644 --- a/vnc.c +++ b/vnc.c @@ -1218,7 +1218,7 @@ static long vnc_client_write_plain(VncState *vs) vs->output.offset -= ret; if (vs->output.offset == 0) { - qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); + qemu_set_fd_read_handler(vs->csock, vnc_client_read, vs); } return ret; @@ -2389,7 +2389,7 @@ static void vnc_connect(VncDisplay *vd, int csock) VNC_DEBUG("New client on socket %d\n", csock); dcl->idle = 0; socket_set_nonblock(vs->csock); - qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); + qemu_set_fd_read_handler(vs->csock, vnc_client_read, vs); vnc_client_cache_addr(vs); vnc_qmp_event(vs, QEVENT_VNC_CONNECTED); @@ -2730,5 +2730,5 @@ int vnc_display_open(DisplayState *ds, const char *display) vs->display = dpy; } } - return qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_read, NULL, vs); + return qemu_set_fd_read_handler(vs->lsock, vnc_listen_read, vs); } -- 1.6.6.1