aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-06-04 14:45:18 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2015-06-12 13:26:21 +0100
commit82e1cc4bf91a2e1c3b62297b10b0ab1d93adfc45 (patch)
treef7c9e240735dca99283f304f2843329d188adb71
parenta90a7425cf592a3afeff3eaf32f543b83050ee5c (diff)
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>
-rw-r--r--blockdev-nbd.c4
-rw-r--r--main-loop.c3
-rw-r--r--migration/exec.c6
-rw-r--r--migration/fd.c4
-rw-r--r--migration/rdma.c7
-rw-r--r--migration/tcp.c6
-rw-r--r--migration/unix.c6
-rw-r--r--net/l2tpv3.c8
-rw-r--r--net/netmap.c8
-rw-r--r--net/socket.c8
-rw-r--r--net/tap.c8
-rw-r--r--ui/vnc-auth-sasl.c2
-rw-r--r--ui/vnc-auth-vencrypt.c2
-rw-r--r--ui/vnc-ws.c6
-rw-r--r--ui/vnc.c27
-rw-r--r--util/qemu-sockets.c8
16 files changed, 53 insertions, 60 deletions
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index 85cda4cfa7..0d9df47ce4 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -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;
}
diff --git a/main-loop.c b/main-loop.c
index 981bcb5f8e..82875a4dfd 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -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;
}
diff --git a/migration/exec.c b/migration/exec.c
index 479024752f..8406d2bbde 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -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);
}
diff --git a/migration/fd.c b/migration/fd.c
index 129da9910b..3e4bed0e06 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -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);
}
diff --git a/migration/rdma.c b/migration/rdma.c
index 77e34441dc..171c23fc3c 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -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);
diff --git a/migration/tcp.c b/migration/tcp.c
index 91c9cf381e..ae891728ef 100644
--- a/migration/tcp.c
+++ b/migration/tcp.c
@@ -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);
}
diff --git a/migration/unix.c b/migration/unix.c
index 1cdadfbc83..b591813eb9 100644
--- a/migration/unix.c
+++ b/migration/unix.c
@@ -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);
}
diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 99d80b6bff..356dae2b72 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -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)
diff --git a/net/netmap.c b/net/netmap.c
index 19d054287d..508b82947d 100644
--- a/net/netmap.c
+++ b/net/netmap.c
@@ -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. */
diff --git a/net/socket.c b/net/socket.c
index 7055d1e9fa..c752696cbb 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -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)
diff --git a/net/tap.c b/net/tap.c
index 0d184cfa01..aa8b3f5c8c 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -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)
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 2ddd2591f9..62a5fc4bf1 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -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;
diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c
index 03ea48a69c..8fc965b4ad 100644
--- a/ui/vnc-auth-vencrypt.c
+++ b/ui/vnc-auth-vencrypt.c
@@ -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);
diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
index 38a1b8b646..8c18268054 100644
--- a/ui/vnc-ws.c
+++ b/ui/vnc-ws.c
@@ -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;
diff --git a/ui/vnc.c b/ui/vnc.c
index 0c6b5e3553..69b605c709 100644
--- a/ui/vnc.c
+++ b/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 */
}
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index f9ad34e40c..4026314435 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -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 */