[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 29/32] chardev: new qemu_chr_be_update_read_handlers(
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 29/32] chardev: new qemu_chr_be_update_read_handlers() |
Date: |
Fri, 22 Sep 2017 01:16:37 +0200 |
From: Peter Xu <address@hidden>
Add a wrapper for the chr_update_read_handler().
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
chardev/char-fe.c | 7 ++-----
chardev/char.c | 10 ++++++++++
include/chardev/char.h | 10 ++++++++++
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index f3af6ae..ee6d596 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -253,7 +253,6 @@ void qemu_chr_fe_set_handlers(CharBackend *b,
bool set_open)
{
Chardev *s;
- ChardevClass *cc;
int fe_open;
s = b->chr;
@@ -261,7 +260,6 @@ void qemu_chr_fe_set_handlers(CharBackend *b,
return;
}
- cc = CHARDEV_GET_CLASS(s);
if (!opaque && !fd_can_read && !fd_read && !fd_event) {
fe_open = 0;
remove_fd_in_watch(s);
@@ -273,9 +271,8 @@ void qemu_chr_fe_set_handlers(CharBackend *b,
b->chr_event = fd_event;
b->chr_be_change = be_change;
b->opaque = opaque;
- if (cc->chr_update_read_handler) {
- cc->chr_update_read_handler(s, context);
- }
+
+ qemu_chr_be_update_read_handlers(s, context);
if (set_open) {
qemu_chr_fe_set_open(b, fe_open);
diff --git a/chardev/char.c b/chardev/char.c
index b6fd5eb..e090dd5 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -180,6 +180,16 @@ void qemu_chr_be_write(Chardev *s, uint8_t *buf, int len)
}
}
+void qemu_chr_be_update_read_handlers(Chardev *s,
+ GMainContext *context)
+{
+ ChardevClass *cc = CHARDEV_GET_CLASS(s);
+
+ if (cc->chr_update_read_handler) {
+ cc->chr_update_read_handler(s, context);
+ }
+}
+
int qemu_chr_add_client(Chardev *s, int fd)
{
return CHARDEV_GET_CLASS(s)->chr_add_client ?
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 66dde46..2068ea4 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -169,6 +169,16 @@ void qemu_chr_be_write(Chardev *s, uint8_t *buf, int len);
void qemu_chr_be_write_impl(Chardev *s, uint8_t *buf, int len);
/**
+ * @qemu_chr_be_update_read_handlers:
+ *
+ * Invoked when frontend read handlers are setup
+ *
+ * @context the gcontext that will be used to attach the watch sources
+ */
+void qemu_chr_be_update_read_handlers(Chardev *s,
+ GMainContext *context);
+
+/**
* @qemu_chr_be_event:
*
* Send an event from the back end to the front end.
--
1.8.3.1
- [Qemu-devel] [PULL 16/32] memory: Move address_space_update_ioeventfds, (continued)
- [Qemu-devel] [PULL 16/32] memory: Move address_space_update_ioeventfds, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 17/32] memory: Share FlatView's and dispatch trees between address spaces, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 18/32] memory: Do not allocate FlatView in address_space_init, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 21/32] memory: Create FlatView directly, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 23/32] memory: seek FlatView sharing candidates among children subregions, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 20/32] memory: Get rid of address_space_init_shareable, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 22/32] memory: trace FlatView creation and destruction, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 19/32] memory: Rework "info mtree" to print flat views and dispatch trees, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 24/32] memory: Share special empty FlatView, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 25/32] scsi, file-posix: add support for persistent reservation management, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 29/32] chardev: new qemu_chr_be_update_read_handlers(),
Paolo Bonzini <=
- [Qemu-devel] [PULL 28/32] scsi: add persistent reservation manager using qemu-pr-helper, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 30/32] chardev: add Chardev.gcontext field, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 27/32] scsi: add multipath support to qemu-pr-helper, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 26/32] scsi: build qemu-pr-helper, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 31/32] chardev: use per-dev context for io_add_watch_poll, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 32/32] chardev: remove context in chr_update_read_handler, Paolo Bonzini, 2017/09/21