[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/12] char: add read functions for backend and fron
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 05/12] char: add read functions for backend and frontend |
Date: |
Mon, 1 Aug 2011 09:23:03 -0500 |
Instead of waiting for a callback to send data, allow for reading the backend
and frontend tx queues directly.
Signed-off-by: Anthony Liguori <address@hidden>
---
qemu-char.c | 10 ++++++++++
qemu-char.h | 2 ++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 2746652..0e4a30c 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -205,6 +205,11 @@ int qemu_chr_fe_write(CharDriverState *s, const uint8_t
*buf, int len)
return ret;
}
+int qemu_chr_fe_read(CharDriverState *s, uint8_t *buf, int len)
+{
+ return char_queue_read(&s->be_tx, buf, len);
+}
+
static void qemu_chr_flush_be_tx(CharDriverState *s)
{
uint8_t buf[MAX_CHAR_QUEUE_RING];
@@ -243,6 +248,11 @@ int qemu_chr_be_write(CharDriverState *s, uint8_t *buf,
int len)
return ret;
}
+int qemu_chr_be_read(CharDriverState *s, uint8_t *buf, int len)
+{
+ return char_queue_read(&s->fe_tx, buf, len);
+}
+
int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg)
{
if (!s->chr_ioctl)
diff --git a/qemu-char.h b/qemu-char.h
index 85735b5..a75bd1c 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -101,6 +101,7 @@ void qemu_chr_close(CharDriverState *chr);
void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len);
+int qemu_chr_fe_read(CharDriverState *s, uint8_t *buf, int len);
void qemu_chr_send_event(CharDriverState *s, int event);
void qemu_chr_add_handlers(CharDriverState *s,
IOCanReadHandler *fd_can_read,
@@ -111,6 +112,7 @@ int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg);
void qemu_chr_generic_open(CharDriverState *s);
int qemu_chr_be_can_write(CharDriverState *s);
int qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
+int qemu_chr_be_read(CharDriverState *s, uint8_t *buf, int len);
int qemu_chr_get_msgfd(CharDriverState *s);
void qemu_chr_accept_input(CharDriverState *s);
int qemu_chr_add_client(CharDriverState *s, int fd);
--
1.7.4.1
- Re: [Qemu-devel] [PATCH 01/12] char: rename qemu_chr_write() to qemu_chr_fe_write(), (continued)
[Qemu-devel] [PATCH 03/12] char: introduce tx queue to enable Unix style flow control, Anthony Liguori, 2011/08/01
[Qemu-devel] [PATCH 07/12] char: add backend edge notification interface, Anthony Liguori, 2011/08/01
[Qemu-devel] [PATCH 05/12] char: add read functions for backend and frontend,
Anthony Liguori <=
[Qemu-devel] [PATCH 06/12] char: add an edge event API for the front ends, Anthony Liguori, 2011/08/01
[Qemu-devel] [PATCH 09/12] char: rename qemu_chr_guest_open() -> qemu_chr_fe_open(), Anthony Liguori, 2011/08/01
[Qemu-devel] [PATCH 11/12] char: make all devices do qemu_chr_fe_open(), Anthony Liguori, 2011/08/01
[Qemu-devel] [PATCH 08/12] char: make monitor use new style interface, Anthony Liguori, 2011/08/01
[Qemu-devel] [PATCH 10/12] char: rename qemu_chr_guest_close() -> qemu_chr_fe_close(), Anthony Liguori, 2011/08/01
[Qemu-devel] [PATCH 12/12] char: enforce the use of qemu_chr_guest_open(), Anthony Liguori, 2011/08/01