[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/14] Remove qemu_set_fd_handler2()
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 12/14] Remove qemu_set_fd_handler2() |
Date: |
Wed, 10 Mar 2010 11:03:26 +0100 |
Now that there are no more poll_read users, we can remove it. Convert all
users to qemu_set_fd_handler().
Signed-off-by: Juan Quintela <address@hidden>
---
aio.c | 2 +-
migration-exec.c | 6 +++---
migration-fd.c | 4 ++--
migration-tcp.c | 10 +++++-----
migration-unix.c | 10 +++++-----
migration.c | 8 ++++----
qemu-aio.h | 4 ++--
qemu-char.c | 12 ++++++------
qemu-char.h | 5 -----
qemu-tool.c | 9 ++++-----
vl.c | 24 ++++++------------------
vnc-auth-sasl.c | 2 +-
vnc-auth-vencrypt.c | 2 +-
vnc.c | 12 ++++++------
14 files changed, 46 insertions(+), 64 deletions(-)
diff --git a/aio.c b/aio.c
index f164a47..16105b3 100644
--- a/aio.c
+++ b/aio.c
@@ -93,7 +93,7 @@ int qemu_aio_set_fd_handler(int fd,
node->opaque = opaque;
}
- qemu_set_fd_handler2(fd, NULL, io_read, io_write, opaque);
+ qemu_set_fd_handler(fd, io_read, io_write, opaque);
return 0;
}
diff --git a/migration-exec.c b/migration-exec.c
index 5435827..c971145 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -125,7 +125,7 @@ static void exec_accept_incoming_migration(void *opaque)
vm_start();
err:
- qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(qemu_stdio_fd(f), NULL, NULL, NULL);
qemu_fclose(f);
}
@@ -140,8 +140,8 @@ int exec_start_incoming_migration(const char *command)
return -errno;
}
- qemu_set_fd_handler2(qemu_stdio_fd(f), NULL,
- exec_accept_incoming_migration, NULL, f);
+ qemu_set_fd_handler(qemu_stdio_fd(f),
+ exec_accept_incoming_migration, NULL, f);
return 0;
}
diff --git a/migration-fd.c b/migration-fd.c
index 0abd372..93e1c4e 100644
--- a/migration-fd.c
+++ b/migration-fd.c
@@ -118,7 +118,7 @@ static void fd_accept_incoming_migration(void *opaque)
vm_start();
err:
- qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(qemu_stdio_fd(f), NULL, NULL, NULL);
qemu_fclose(f);
}
@@ -136,7 +136,7 @@ int fd_start_incoming_migration(const char *infd)
return -errno;
}
- qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL, f);
+ qemu_set_fd_handler(fd, fd_accept_incoming_migration, NULL, f);
return 0;
}
diff --git a/migration-tcp.c b/migration-tcp.c
index 95ce722..80ebbc5 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -66,7 +66,7 @@ static void tcp_wait_for_connect(void *opaque)
return;
}
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
if (val == 0)
migrate_fd_connect(s);
@@ -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_handler(s->fd, NULL, tcp_wait_for_connect, s);
} while (ret == -EINTR);
if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) {
@@ -176,7 +176,7 @@ static void tcp_accept_incoming_migration(void *opaque)
out_fopen:
qemu_fclose(f);
out:
- qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s, NULL, NULL, NULL);
close(s);
close(c);
}
@@ -205,8 +205,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_handler(s, tcp_accept_incoming_migration, NULL,
+ (void *)(unsigned long)s);
return 0;
diff --git a/migration-unix.c b/migration-unix.c
index 49de1b9..891b3a7 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -65,7 +65,7 @@ static void unix_wait_for_connect(void *opaque)
return;
}
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
if (val == 0)
migrate_fd_connect(s);
@@ -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_handler(s->fd, NULL, unix_wait_for_connect, s);
} while (ret == -EINTR);
if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) {
@@ -182,7 +182,7 @@ static void unix_accept_incoming_migration(void *opaque)
out_fopen:
qemu_fclose(f);
out:
- qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s, NULL, NULL, NULL);
close(s);
close(c);
}
@@ -214,8 +214,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_handler(sock, unix_accept_incoming_migration, NULL,
+ (void *)(unsigned long)sock);
return 0;
diff --git a/migration.c b/migration.c
index 05f6cc5..2da715c 100644
--- a/migration.c
+++ b/migration.c
@@ -292,7 +292,7 @@ void migrate_fd_error(FdMigrationState *s)
void migrate_fd_cleanup(FdMigrationState *s)
{
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
if (s->file) {
DPRINTF("closing file\n");
@@ -315,7 +315,7 @@ void migrate_fd_put_notify(void *opaque)
{
FdMigrationState *s = opaque;
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
qemu_file_put_notify(s->file);
}
@@ -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_handler(s->fd, NULL, migrate_fd_put_notify, s);
return ret;
}
@@ -449,6 +449,6 @@ int migrate_fd_close(void *opaque)
{
FdMigrationState *s = opaque;
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
return s->close(s);
}
diff --git a/qemu-aio.h b/qemu-aio.h
index 3bdd749..0630cbe 100644
--- a/qemu-aio.h
+++ b/qemu-aio.h
@@ -43,11 +43,11 @@ void qemu_aio_wait(void);
int qemu_aio_process_queue(void);
/* Register a file descriptor and associated callbacks. Behaves very similarly
- * to qemu_set_fd_handler2. Unlike qemu_set_fd_handler2, these callbacks will
+ * to qemu_set_fd_handler. Unlike qemu_set_fd_handler, these callbacks will
* be invoked when using either qemu_aio_wait() or qemu_aio_flush().
*
* Code that invokes AIO completion functions should rely on this function
- * instead of qemu_set_fd_handler[2].
+ * instead of qemu_set_fd_handler.
*/
int qemu_aio_set_fd_handler(int fd,
IOHandler *io_read,
diff --git a/qemu-char.c b/qemu-char.c
index 9098d79..3635f4e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -554,7 +554,7 @@ static void fd_chr_read(void *opaque)
size = read(s->fd_in, buf, len);
if (size == 0) {
/* FD has been closed. Remove it from the active list. */
- qemu_set_fd_handler2(s->fd_in, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd_in, NULL, NULL, NULL);
qemu_chr_event(chr, CHR_EVENT_CLOSED);
return;
}
@@ -582,7 +582,7 @@ static void fd_chr_close(struct CharDriverState *chr)
if (s->fd_in >= 0) {
if (display_type == DT_NOGRAPHIC && s->fd_in == 0) {
} else {
- qemu_set_fd_handler2(s->fd_in, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd_in, NULL, NULL, NULL);
}
}
@@ -674,7 +674,7 @@ static void stdio_read(void *opaque)
size = read(0, buf, 1);
if (size == 0) {
/* stdin has been closed. Remove it from the active list. */
- qemu_set_fd_handler2(0, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(0, NULL, NULL, NULL);
qemu_chr_event(chr, CHR_EVENT_CLOSED);
return;
}
@@ -730,7 +730,7 @@ static void qemu_chr_close_stdio(struct CharDriverState
*chr)
{
term_exit();
stdio_nb_clients--;
- qemu_set_fd_handler2(0, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(0, NULL, NULL, NULL);
fd_chr_close(chr);
}
@@ -883,7 +883,7 @@ static void pty_chr_state(CharDriverState *chr, int
connected)
PtyCharDriver *s = chr->opaque;
if (!connected) {
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
s->connected = 0;
s->polling = 0;
/* (re-)connect poll interval for idle guests: once per second.
@@ -919,7 +919,7 @@ static void pty_chr_close(struct CharDriverState *chr)
{
PtyCharDriver *s = chr->opaque;
- qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+ qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
close(s->fd);
qemu_del_timer(s->timer);
qemu_free_timer(s->timer);
diff --git a/qemu-char.h b/qemu-char.h
index 3a9427b..3bad12d 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -97,11 +97,6 @@ extern int term_escape_char;
/* async I/O support */
-int qemu_set_fd_handler2(int fd,
- IOCanReadHandler *fd_read_poll,
- IOHandler *fd_read,
- IOHandler *fd_write,
- void *opaque);
int qemu_set_fd_handler(int fd,
IOHandler *fd_read,
IOHandler *fd_write,
diff --git a/qemu-tool.c b/qemu-tool.c
index 45e6df9..873763e 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -90,11 +90,10 @@ void qemu_bh_delete(QEMUBH *bh)
qemu_free(bh);
}
-int qemu_set_fd_handler2(int fd,
- IOCanReadHandler *fd_read_poll,
- IOHandler *fd_read,
- IOHandler *fd_write,
- void *opaque)
+int qemu_set_fd_handler(int fd,
+ IOHandler *fd_read,
+ IOHandler *fd_write,
+ void *opaque)
{
return 0;
}
diff --git a/vl.c b/vl.c
index c2ae185..a961710 100644
--- a/vl.c
+++ b/vl.c
@@ -2604,13 +2604,10 @@ static QTAILQ_HEAD(, IOHandlerRecord) io_handlers =
QTAILQ_HEAD_INITIALIZER(io_handlers);
-/* XXX: fd_read_poll should be suppressed, but an API change is
- necessary in the character devices to suppress fd_can_read(). */
-int qemu_set_fd_handler2(int fd,
- IOCanReadHandler *fd_read_poll,
- IOHandler *fd_read,
- IOHandler *fd_write,
- void *opaque)
+int qemu_set_fd_handler(int fd,
+ IOHandler *fd_read,
+ IOHandler *fd_write,
+ void *opaque)
{
IOHandlerRecord *ioh;
@@ -2630,7 +2627,6 @@ int qemu_set_fd_handler2(int fd,
QTAILQ_INSERT_TAIL(&io_handlers, ioh, next);
found:
ioh->fd = fd;
- ioh->fd_read_poll = fd_read_poll;
ioh->fd_read = fd_read;
ioh->fd_write = fd_write;
ioh->opaque = opaque;
@@ -2639,14 +2635,6 @@ int qemu_set_fd_handler2(int fd,
return 0;
}
-int qemu_set_fd_handler(int fd,
- IOHandler *fd_read,
- IOHandler *fd_write,
- void *opaque)
-{
- return qemu_set_fd_handler2(fd, NULL, fd_read, fd_write, opaque);
-}
-
#ifdef _WIN32
/***********************************************************/
/* Polling handling */
@@ -3252,8 +3240,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_handler(fds[0], qemu_event_read, NULL,
+ (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..1e4f77f 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_handler(vs->csock, vnc_client_read, NULL, vs);
}
return ret;
diff --git a/vnc-auth-vencrypt.c b/vnc-auth-vencrypt.c
index 07c1691..a5d2b44 100644
--- a/vnc-auth-vencrypt.c
+++ b/vnc-auth-vencrypt.c
@@ -93,7 +93,7 @@ static int vnc_start_vencrypt_handshake(struct VncState *vs) {
VNC_DEBUG("Handshake done, switching to TLS data mode\n");
vs->tls.wiremode = VNC_WIREMODE_TLS;
- 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/vnc.c b/vnc.c
index 01353a9..2cfb0eb 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1076,7 +1076,7 @@ static void vnc_disconnect_start(VncState *vs)
{
if (vs->csock == -1)
return;
- 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;
}
@@ -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_handler(vs->csock, vnc_client_read, NULL, vs);
}
return ret;
@@ -1356,7 +1356,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);
@@ -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_handler(vs->csock, vnc_client_read, NULL, vs);
vnc_client_cache_addr(vs);
vnc_qmp_event(vs, QEVENT_VNC_CONNECTED);
@@ -2475,7 +2475,7 @@ void vnc_display_close(DisplayState *ds)
vs->display = NULL;
}
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;
}
@@ -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_handler(vs->lsock, vnc_listen_read, NULL, vs);
}
--
1.6.6.1
- [Qemu-devel] [PATCH 04/14] bt: remove bt_host_read_poll(), (continued)
- [Qemu-devel] [PATCH 04/14] bt: remove bt_host_read_poll(), Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 05/14] Handle deleted IOHandlers in a single pass, Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 07/14] qemu-char:stdio insert poll call into read one, Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 08/14] qemu-char:tcp insert poll call into read one, Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 06/14] tap: insert tap_can_send() into tap_send(), Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 09/14] qemu-char:fd insert poll call into read one, Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 10/14] qemu-char:pty insert poll call into read one, Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 11/14] qemu-char:udp insert poll call into read one, Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 13/14] Remove now unused fd_read_poll and all its only left user, Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 14/14] Add qemu_remove_fd_handler(), Juan Quintela, 2010/03/10
- [Qemu-devel] [PATCH 12/14] Remove qemu_set_fd_handler2(),
Juan Quintela <=