[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/7] char: fd: Use new iohandler api
From: |
Amit Shah |
Subject: |
[Qemu-devel] [PATCH 5/7] char: fd: Use new iohandler api |
Date: |
Tue, 22 Feb 2011 15:48:34 +0530 |
Update the fd code to use the new iohandler api. The change is mostly
mechanical with a new iohandler function calling the older functions
depending on the value of the 'mask' field.
Signed-off-by: Amit Shah <address@hidden>
---
qemu-char.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 61f8358..d93820e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -572,7 +572,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);
+ remove_iohandler(s->fd_in);
qemu_chr_event(chr, CHR_EVENT_CLOSED);
return;
}
@@ -581,6 +581,22 @@ static void fd_chr_read(void *opaque)
}
}
+static int fd_iohandler(void *opaque, unsigned int mask)
+{
+ int ret;
+
+ ret = 0;
+ switch(mask) {
+ case IOH_MASK_CAN_READ:
+ ret = fd_chr_read_poll(opaque);
+ break;
+ case IOH_MASK_READ:
+ fd_chr_read(opaque);
+ break;
+ }
+ return ret;
+}
+
static void fd_chr_update_read_handler(CharDriverState *chr)
{
FDCharDriver *s = chr->opaque;
@@ -588,8 +604,8 @@ static void fd_chr_update_read_handler(CharDriverState *chr)
if (s->fd_in >= 0) {
if (display_type == DT_NOGRAPHIC && s->fd_in == 0) {
} else {
- qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll,
- fd_chr_read, NULL, chr);
+ assign_iohandler(s->fd_in, fd_iohandler,
+ IOH_MASK_CAN_READ|IOH_MASK_READ, chr);
}
}
}
@@ -601,7 +617,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);
+ remove_iohandler(s->fd_in);
}
}
--
1.7.4
- Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, (continued)
- Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, Avi Kivity, 2011/02/22
- Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, Amit Shah, 2011/02/22
- Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, Anthony Liguori, 2011/02/22
- Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, Avi Kivity, 2011/02/22
- Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, Anthony Liguori, 2011/02/22
- Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, Avi Kivity, 2011/02/23
[Qemu-devel] Re: [PATCH 2/7] iohandlers: Introduce a new API, Anthony Liguori, 2011/02/22
[Qemu-devel] [PATCH 3/7] char: tcp: Use new iohandler api, Amit Shah, 2011/02/22
[Qemu-devel] [PATCH 4/7] char: udp: Use new iohandler api, Amit Shah, 2011/02/22
[Qemu-devel] [PATCH 5/7] char: fd: Use new iohandler api,
Amit Shah <=
[Qemu-devel] [PATCH 6/7] char: stdio: Use new iohandler api, Amit Shah, 2011/02/22
[Qemu-devel] [PATCH 7/7] char: pty: Use new iohandler api, Amit Shah, 2011/02/22