@@ -273,8 +273,8 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct pollhlp *hlp, int mask)
if (conf.verbose) {
dolog ("POLLOUT %d %d\n", i, pfds[i].fd);
}
- err = qemu_set_fd_handler (pfds[i].fd, NULL,
- alsa_poll_handler, hlp);
+ err = qemu_set_fd_write_handler (pfds[i].fd, alsa_poll_handler,
+ hlp);
}
if (conf.verbose) {
dolog ("Set handler events=%#x index=%d fd=%d err=%d\n",
@@ -146,7 +146,7 @@ static int oss_poll_out (HWVoiceOut *hw)
{
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
- return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);
+ return qemu_set_fd_write_handler (oss->fd, oss_helper_poll_out, NULL);
}
static int oss_poll_in (HWVoiceIn *hw)
@@ -123,7 +123,7 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon,
ret = -(s->get_error(s));
if (ret == -EINPROGRESS || ret == -EWOULDBLOCK)
- qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s);
+ qemu_set_fd_write_handler(s->fd, tcp_wait_for_connect, s);
} while (ret == -EINTR);
if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) {
@@ -118,7 +118,7 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon,
ret = -(s->get_error(s));
if (ret == -EINPROGRESS || ret == -EWOULDBLOCK)
- qemu_set_fd_handler2(s->fd, NULL, NULL, unix_wait_for_connect, s);
+ qemu_set_fd_write_handler(s->fd, unix_wait_for_connect, s);
} while (ret == -EINTR);
if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) {
@@ -332,7 +332,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
ret = -(s->get_error(s));
if (ret == -EAGAIN)
- qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
+ qemu_set_fd_write_handler(s->fd, migrate_fd_put_notify, s);
return ret;
}
@@ -316,7 +316,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan,
if (is_connected) {
net_socket_connect(s);
} else {
- qemu_set_fd_handler(s->fd, NULL, net_socket_connect, s);
+ qemu_set_fd_write_handler(s->fd, net_socket_connect, s);
}
return s;
}
@@ -110,6 +110,8 @@ int qemu_set_fd_handler(int fd,
int qemu_set_fd_read_handler(int fd,
IOHandler *fd_read,
void *opaque);
-
+int qemu_set_fd_write_handler(int fd,
+ IOHandler *fd_read,
+ void *opaque);
#endif
@@ -940,7 +940,7 @@ static int usb_host_open(USBHostDevice *dev, int bus_num,
prod_name);
/* USB devio uses 'write' flag to check for async completions */
- qemu_set_fd_handler(dev->fd, NULL, async_complete, dev);
+ qemu_set_fd_write_handler(dev->fd, async_complete, dev);
usb_device_attach(&dev->dev);
return 0;
@@ -2665,6 +2665,17 @@ int qemu_set_fd_read_handler(int fd,
return qemu_set_fd_handler2(fd, NULL, fd_read, NULL, opaque);
}
+int qemu_set_fd_write_handler(int fd,
+ IOHandler *fd_write,
+ void *opaque)
+{
+ if(fd_write == NULL) {
+ fprintf(stderr, "qemu_set_fd_write_handler: NULL write handler\n");
+ exit(1);
+ }
+ return qemu_set_fd_handler2(fd, NULL, NULL, fd_write, opaque);
+}
+
#ifdef _WIN32
/***********************************************************/
/* Polling handling */
@@ -73,7 +73,7 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs) {
if (!gnutls_record_get_direction(vs->tls.session))
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);
+ qemu_set_fd_write_handler(vs->csock, vnc_tls_handshake_io, vs);
return 0;
}
VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret));
Patch consist: s/qemu_set_fd_handler(fd, NULL, write, o)/ qemu_set_fd_write_handler(fd, write, o)/ s/qemu_set_fd_handler2(fd, NULL, NULL, write, o)/ qemu_set_fd_write_handler(fd, write, o)/ Signed-off-by: Juan Quintela <quintela@redhat.com> --- audio/alsaaudio.c | 4 ++-- audio/ossaudio.c | 2 +- migration-tcp.c | 2 +- migration-unix.c | 2 +- migration.c | 2 +- net/socket.c | 2 +- qemu-char.h | 4 +++- usb-linux.c | 2 +- vl.c | 11 +++++++++++ vnc-auth-vencrypt.c | 2 +- 10 files changed, 23 insertions(+), 10 deletions(-)