[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 4/7] char: Add framework for a 'write unblocked'
From: |
Amit Shah |
Subject: |
[Qemu-devel] [PATCH v8 4/7] char: Add framework for a 'write unblocked' callback |
Date: |
Wed, 1 Dec 2010 15:24:26 +0530 |
The char layer can let users know that the driver will block on further
input. For users interested in not blocking, they can assign a function
pointer that will be called back when the driver becomes writable. This
patch just adds the function pointers to the CharDriverState structure,
future patches will enable the nonblocking and callback functionality.
Signed-off-by: Amit Shah <address@hidden>
---
qemu-char.c | 3 +++
qemu-char.h | 5 +++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 483a5fd..c16c2d7 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -202,11 +202,14 @@ void qemu_chr_add_handlers(CharDriverState *s,
}
s->chr_can_read = handlers->fd_can_read;
s->chr_read = handlers->fd_read;
+ s->chr_write_unblocked = handlers->fd_write_unblocked;
s->chr_event = handlers->fd_event;
s->handler_opaque = opaque;
if (s->chr_update_read_handler)
s->chr_update_read_handler(s);
+ s->write_blocked = false;
+
/* We're connecting to an already opened device, so let's make sure we
also get the open event */
if (s->opened) {
diff --git a/qemu-char.h b/qemu-char.h
index 62d395e..f9cbcc6 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -59,6 +59,9 @@ struct CharDriverState {
IOEventHandler *chr_event;
IOCanReadHandler *chr_can_read;
IOReadHandler *chr_read;
+ IOHandler *chr_write_unblocked;
+ void (*update_fd_handlers)(struct CharDriverState *chr,
+ bool poll_out);
void *handler_opaque;
void (*chr_send_event)(struct CharDriverState *chr, int event);
void (*chr_close)(struct CharDriverState *chr);
@@ -68,6 +71,8 @@ struct CharDriverState {
char *label;
char *filename;
int opened;
+ /* Are we in a blocked state? */
+ bool write_blocked;
QTAILQ_ENTRY(CharDriverState) next;
};
--
1.7.3.2
- [Qemu-devel] [PATCH v8 0/7] char: non-blocking writes, virtio-console flow control, Amit Shah, 2010/12/01
- [Qemu-devel] [PATCH v8 1/7] virtio-console: Factor out common init between console and generic ports, Amit Shah, 2010/12/01
- [Qemu-devel] [PATCH v8 2/7] char: Add a QemuChrHandlers struct to initialise chardev handlers, Amit Shah, 2010/12/01
- [Qemu-devel] [PATCH v8 3/7] char: Introduce char_set/remove_fd_handlers(), Amit Shah, 2010/12/01
- [Qemu-devel] [PATCH v8 4/7] char: Add framework for a 'write unblocked' callback,
Amit Shah <=
- [Qemu-devel] [PATCH v8 5/7] char: Update send_all() to handle nonblocking chardev write requests, Amit Shah, 2010/12/01
- [Qemu-devel] [PATCH v8 6/7] char: Equip the unix/tcp backend to handle nonblocking writes, Amit Shah, 2010/12/01
- [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Amit Shah, 2010/12/01
- Re: [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Paul Brook, 2010/12/01
- Re: [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Amit Shah, 2010/12/01
- Re: [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Paul Brook, 2010/12/01
- Re: [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Amit Shah, 2010/12/01
- Re: [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Paul Brook, 2010/12/01
- Re: [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Amit Shah, 2010/12/02
- Re: [Qemu-devel] [PATCH v8 7/7] virtio-console: Enable port throttling when chardev is slow to consume data, Paul Brook, 2010/12/02