Change qemu_set_fd_handler2(..., NULL, ...) to qemu_set_fd_handler
Done with following Coccinelle semantic patch, plus manual cosmetic changes in net/*.c. @@ expression E1, E2, E3, E4; @@ - qemu_set_fd_handler2(E1, NULL, E2, E3, E4); + qemu_set_fd_handler(E1, E2, E3, E4); Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1433400324-7358-8-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
a90a7425cf
commit
82e1cc4bf9
@ -43,7 +43,7 @@ void qmp_nbd_server_start(SocketAddress *addr, Error **errp)
|
||||
|
||||
server_fd = socket_listen(addr, errp);
|
||||
if (server_fd != -1) {
|
||||
qemu_set_fd_handler2(server_fd, NULL, nbd_accept, NULL, NULL);
|
||||
qemu_set_fd_handler(server_fd, nbd_accept, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ void qmp_nbd_server_stop(Error **errp)
|
||||
}
|
||||
|
||||
if (server_fd != -1) {
|
||||
qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(server_fd, NULL, NULL, NULL);
|
||||
close(server_fd);
|
||||
server_fd = -1;
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ static int qemu_signal_init(void)
|
||||
|
||||
fcntl_setfl(sigfd, O_NONBLOCK);
|
||||
|
||||
qemu_set_fd_handler2(sigfd, NULL, sigfd_handler, NULL,
|
||||
(void *)(intptr_t)sigfd);
|
||||
qemu_set_fd_handler(sigfd, sigfd_handler, NULL, (void *)(intptr_t)sigfd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ static void exec_accept_incoming_migration(void *opaque)
|
||||
{
|
||||
QEMUFile *f = opaque;
|
||||
|
||||
qemu_set_fd_handler2(qemu_get_fd(f), NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(qemu_get_fd(f), NULL, NULL, NULL);
|
||||
process_incoming_migration(f);
|
||||
}
|
||||
|
||||
@ -64,6 +64,6 @@ void exec_start_incoming_migration(const char *command, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_set_fd_handler2(qemu_get_fd(f), NULL,
|
||||
exec_accept_incoming_migration, NULL, f);
|
||||
qemu_set_fd_handler(qemu_get_fd(f), exec_accept_incoming_migration, NULL,
|
||||
f);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ static void fd_accept_incoming_migration(void *opaque)
|
||||
{
|
||||
QEMUFile *f = opaque;
|
||||
|
||||
qemu_set_fd_handler2(qemu_get_fd(f), NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(qemu_get_fd(f), NULL, NULL, NULL);
|
||||
process_incoming_migration(f);
|
||||
}
|
||||
|
||||
@ -84,5 +84,5 @@ void fd_start_incoming_migration(const char *infd, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL, f);
|
||||
qemu_set_fd_handler(fd, fd_accept_incoming_migration, NULL, f);
|
||||
}
|
||||
|
@ -2834,7 +2834,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)
|
||||
}
|
||||
}
|
||||
|
||||
qemu_set_fd_handler2(rdma->channel->fd, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL);
|
||||
|
||||
ret = rdma_accept(rdma->cm_id, &conn_param);
|
||||
if (ret) {
|
||||
@ -3331,9 +3331,8 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
|
||||
|
||||
trace_rdma_start_incoming_migration_after_rdma_listen();
|
||||
|
||||
qemu_set_fd_handler2(rdma->channel->fd, NULL,
|
||||
rdma_accept_incoming_migration, NULL,
|
||||
(void *)(intptr_t) rdma);
|
||||
qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
|
||||
NULL, (void *)(intptr_t)rdma);
|
||||
return;
|
||||
err:
|
||||
error_propagate(errp, local_err);
|
||||
|
@ -65,7 +65,7 @@ static void tcp_accept_incoming_migration(void *opaque)
|
||||
c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen);
|
||||
err = socket_error();
|
||||
} while (c < 0 && err == EINTR);
|
||||
qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(s, NULL, NULL, NULL);
|
||||
closesocket(s);
|
||||
|
||||
DPRINTF("accepted migration\n");
|
||||
@ -98,6 +98,6 @@ void tcp_start_incoming_migration(const char *host_port, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_set_fd_handler2(s, NULL, tcp_accept_incoming_migration, NULL,
|
||||
(void *)(intptr_t)s);
|
||||
qemu_set_fd_handler(s, tcp_accept_incoming_migration, NULL,
|
||||
(void *)(intptr_t)s);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ static void unix_accept_incoming_migration(void *opaque)
|
||||
c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen);
|
||||
err = errno;
|
||||
} while (c < 0 && err == EINTR);
|
||||
qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(s, NULL, NULL, NULL);
|
||||
close(s);
|
||||
|
||||
DPRINTF("accepted migration\n");
|
||||
@ -98,6 +98,6 @@ void unix_start_incoming_migration(const char *path, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_set_fd_handler2(s, NULL, unix_accept_incoming_migration, NULL,
|
||||
(void *)(intptr_t)s);
|
||||
qemu_set_fd_handler(s, unix_accept_incoming_migration, NULL,
|
||||
(void *)(intptr_t)s);
|
||||
}
|
||||
|
@ -138,10 +138,10 @@ static void l2tpv3_writable(void *opaque);
|
||||
|
||||
static void l2tpv3_update_fd_handler(NetL2TPV3State *s)
|
||||
{
|
||||
qemu_set_fd_handler2(s->fd, NULL,
|
||||
s->read_poll ? net_l2tpv3_send : NULL,
|
||||
s->write_poll ? l2tpv3_writable : NULL,
|
||||
s);
|
||||
qemu_set_fd_handler(s->fd,
|
||||
s->read_poll ? net_l2tpv3_send : NULL,
|
||||
s->write_poll ? l2tpv3_writable : NULL,
|
||||
s);
|
||||
}
|
||||
|
||||
static void l2tpv3_read_poll(NetL2TPV3State *s, bool enable)
|
||||
|
@ -138,10 +138,10 @@ static void netmap_writable(void *opaque);
|
||||
/* Set the event-loop handlers for the netmap backend. */
|
||||
static void netmap_update_fd_handler(NetmapState *s)
|
||||
{
|
||||
qemu_set_fd_handler2(s->me.fd, NULL,
|
||||
s->read_poll ? netmap_send : NULL,
|
||||
s->write_poll ? netmap_writable : NULL,
|
||||
s);
|
||||
qemu_set_fd_handler(s->me.fd,
|
||||
s->read_poll ? netmap_send : NULL,
|
||||
s->write_poll ? netmap_writable : NULL,
|
||||
s);
|
||||
}
|
||||
|
||||
/* Update the read handler. */
|
||||
|
@ -53,10 +53,10 @@ static void net_socket_writable(void *opaque);
|
||||
|
||||
static void net_socket_update_fd_handler(NetSocketState *s)
|
||||
{
|
||||
qemu_set_fd_handler2(s->fd, NULL,
|
||||
s->read_poll ? s->send_fn : NULL,
|
||||
s->write_poll ? net_socket_writable : NULL,
|
||||
s);
|
||||
qemu_set_fd_handler(s->fd,
|
||||
s->read_poll ? s->send_fn : NULL,
|
||||
s->write_poll ? net_socket_writable : NULL,
|
||||
s);
|
||||
}
|
||||
|
||||
static void net_socket_read_poll(NetSocketState *s, bool enable)
|
||||
|
@ -67,10 +67,10 @@ static void tap_writable(void *opaque);
|
||||
|
||||
static void tap_update_fd_handler(TAPState *s)
|
||||
{
|
||||
qemu_set_fd_handler2(s->fd, NULL,
|
||||
s->read_poll && s->enabled ? tap_send : NULL,
|
||||
s->write_poll && s->enabled ? tap_writable : NULL,
|
||||
s);
|
||||
qemu_set_fd_handler(s->fd,
|
||||
s->read_poll && s->enabled ? tap_send : NULL,
|
||||
s->write_poll && s->enabled ? tap_writable : NULL,
|
||||
s);
|
||||
}
|
||||
|
||||
static void tap_read_poll(TAPState *s, bool enable)
|
||||
|
@ -86,7 +86,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_handler(vs->csock, vnc_client_read, NULL, vs);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -94,7 +94,7 @@ static int vnc_start_vencrypt_handshake(VncState *vs)
|
||||
}
|
||||
|
||||
VNC_DEBUG("Handshake done, switching to TLS data mode\n");
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs);
|
||||
qemu_set_fd_handler(vs->csock, vnc_client_read, vnc_client_write, vs);
|
||||
|
||||
start_auth_vencrypt_subauth(vs);
|
||||
|
||||
|
@ -56,7 +56,7 @@ static int vncws_start_tls_handshake(VncState *vs)
|
||||
}
|
||||
|
||||
VNC_DEBUG("Handshake done, switching to TLS data mode\n");
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vncws_handshake_read, NULL, vs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -98,7 +98,7 @@ void vncws_handshake_read(void *opaque)
|
||||
handshake_end = (uint8_t *)g_strstr_len((char *)vs->ws_input.buffer,
|
||||
vs->ws_input.offset, WS_HANDSHAKE_END);
|
||||
if (handshake_end) {
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs);
|
||||
vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset);
|
||||
buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer +
|
||||
strlen(WS_HANDSHAKE_END));
|
||||
@ -176,7 +176,7 @@ long vnc_client_write_ws(VncState *vs)
|
||||
buffer_advance(&vs->ws_output, ret);
|
||||
|
||||
if (vs->ws_output.offset == 0) {
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
27
ui/vnc.c
27
ui/vnc.c
@ -1213,7 +1213,7 @@ static void vnc_disconnect_start(VncState *vs)
|
||||
if (vs->csock == -1)
|
||||
return;
|
||||
vnc_set_share_mode(vs, VNC_SHARE_MODE_DISCONNECTED);
|
||||
qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(vs->csock, NULL, NULL, NULL);
|
||||
closesocket(vs->csock);
|
||||
vs->csock = -1;
|
||||
}
|
||||
@ -1387,7 +1387,7 @@ static long vnc_client_write_plain(VncState *vs)
|
||||
buffer_advance(&vs->output, ret);
|
||||
|
||||
if (vs->output.offset == 0) {
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1434,7 +1434,7 @@ void vnc_client_write(void *opaque)
|
||||
) {
|
||||
vnc_client_write_locked(opaque);
|
||||
} else if (vs->csock != -1) {
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs);
|
||||
}
|
||||
vnc_unlock_output(vs);
|
||||
}
|
||||
@ -1581,7 +1581,7 @@ void vnc_write(VncState *vs, const void *data, size_t len)
|
||||
buffer_reserve(&vs->output, len);
|
||||
|
||||
if (vs->csock != -1 && buffer_empty(&vs->output)) {
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs);
|
||||
qemu_set_fd_handler(vs->csock, vnc_client_read, vnc_client_write, vs);
|
||||
}
|
||||
|
||||
buffer_append(&vs->output, data, len);
|
||||
@ -3022,18 +3022,16 @@ static void vnc_connect(VncDisplay *vd, int csock,
|
||||
vs->websocket = 1;
|
||||
#ifdef CONFIG_VNC_TLS
|
||||
if (vd->ws_tls) {
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vncws_tls_handshake_io,
|
||||
NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vncws_tls_handshake_io, NULL, vs);
|
||||
} else
|
||||
#endif /* CONFIG_VNC_TLS */
|
||||
{
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vncws_handshake_read,
|
||||
NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vncws_handshake_read, NULL, vs);
|
||||
}
|
||||
} else
|
||||
#endif /* CONFIG_VNC_WS */
|
||||
{
|
||||
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs);
|
||||
}
|
||||
|
||||
vnc_client_cache_addr(vs);
|
||||
@ -3182,14 +3180,14 @@ static void vnc_display_close(VncDisplay *vs)
|
||||
vs->enabled = false;
|
||||
vs->is_unix = false;
|
||||
if (vs->lsock != -1) {
|
||||
qemu_set_fd_handler2(vs->lsock, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(vs->lsock, NULL, NULL, NULL);
|
||||
close(vs->lsock);
|
||||
vs->lsock = -1;
|
||||
}
|
||||
#ifdef CONFIG_VNC_WS
|
||||
vs->ws_enabled = false;
|
||||
if (vs->lwebsock != -1) {
|
||||
qemu_set_fd_handler2(vs->lwebsock, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(vs->lwebsock, NULL, NULL, NULL);
|
||||
close(vs->lwebsock);
|
||||
vs->lwebsock = -1;
|
||||
}
|
||||
@ -3707,12 +3705,11 @@ void vnc_display_open(const char *id, Error **errp)
|
||||
#endif /* CONFIG_VNC_WS */
|
||||
}
|
||||
vs->enabled = true;
|
||||
qemu_set_fd_handler2(vs->lsock, NULL,
|
||||
vnc_listen_regular_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->lsock, vnc_listen_regular_read, NULL, vs);
|
||||
#ifdef CONFIG_VNC_WS
|
||||
if (vs->ws_enabled) {
|
||||
qemu_set_fd_handler2(vs->lwebsock, NULL,
|
||||
vnc_listen_websocket_read, NULL, vs);
|
||||
qemu_set_fd_handler(vs->lwebsock, vnc_listen_websocket_read,
|
||||
NULL, vs);
|
||||
}
|
||||
#endif /* CONFIG_VNC_WS */
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ static void wait_for_connect(void *opaque)
|
||||
bool in_progress;
|
||||
Error *err = NULL;
|
||||
|
||||
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
|
||||
qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
|
||||
|
||||
do {
|
||||
rc = qemu_getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &val, &valsize);
|
||||
@ -316,8 +316,7 @@ static int inet_connect_addr(struct addrinfo *addr, bool *in_progress,
|
||||
|
||||
if (connect_state != NULL && QEMU_SOCKET_RC_INPROGRESS(rc)) {
|
||||
connect_state->fd = sock;
|
||||
qemu_set_fd_handler2(sock, NULL, NULL, wait_for_connect,
|
||||
connect_state);
|
||||
qemu_set_fd_handler(sock, NULL, wait_for_connect, connect_state);
|
||||
*in_progress = true;
|
||||
} else if (rc < 0) {
|
||||
error_setg_errno(errp, errno, "Failed to connect socket");
|
||||
@ -796,8 +795,7 @@ int unix_connect_opts(QemuOpts *opts, Error **errp,
|
||||
|
||||
if (connect_state != NULL && QEMU_SOCKET_RC_INPROGRESS(rc)) {
|
||||
connect_state->fd = sock;
|
||||
qemu_set_fd_handler2(sock, NULL, NULL, wait_for_connect,
|
||||
connect_state);
|
||||
qemu_set_fd_handler(sock, NULL, wait_for_connect, connect_state);
|
||||
return sock;
|
||||
} else if (rc >= 0) {
|
||||
/* non blocking socket immediate success, call callback */
|
||||
|
Loading…
Reference in New Issue
Block a user