[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] chardev: add Chardev.gcontext field
From: |
Peter Xu |
Subject: |
[Qemu-devel] [PATCH 2/4] chardev: add Chardev.gcontext field |
Date: |
Thu, 21 Sep 2017 14:13:32 +0800 |
It caches the gcontext that is used to poll the chardev IO. Before this
patch, we only passed it in via chr_update_read_handlers(). However
that may not be enough if the char backend is disconnected and
reconnected afterward. There are chardev codes that still assumed the
context be NULL (which is the main context). Will fix that up in
following up patches.
Signed-off-by: Peter Xu <address@hidden>
---
chardev/char.c | 1 +
include/chardev/char.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/chardev/char.c b/chardev/char.c
index e090dd5..89eabea 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -185,6 +185,7 @@ void qemu_chr_be_update_read_handlers(Chardev *s,
{
ChardevClass *cc = CHARDEV_GET_CLASS(s);
+ s->gcontext = context;
if (cc->chr_update_read_handler) {
cc->chr_update_read_handler(s, context);
}
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 2068ea4..84fb773 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -55,6 +55,7 @@ struct Chardev {
int logfd;
int be_open;
GSource *gsource;
+ GMainContext *gcontext;
DECLARE_BITMAP(features, QEMU_CHAR_FEATURE_LAST);
};
--
2.7.4
- [Qemu-devel] [PATCH 0/4] chardev: support non-default gcontext, Peter Xu, 2017/09/21
- [Qemu-devel] [PATCH 1/4] chardev: new qemu_chr_be_update_read_handlers(), Peter Xu, 2017/09/21
- [Qemu-devel] [PATCH 2/4] chardev: add Chardev.gcontext field,
Peter Xu <=
- [Qemu-devel] [PATCH 3/4] chardev: use per-dev context for io_add_watch_poll, Peter Xu, 2017/09/21
- [Qemu-devel] [PATCH 4/4] chardev: remove context in chr_update_read_handler, Peter Xu, 2017/09/21
- Re: [Qemu-devel] [PATCH 0/4] chardev: support non-default gcontext, no-reply, 2017/09/21
- Re: [Qemu-devel] [PATCH 0/4] chardev: support non-default gcontext, no-reply, 2017/09/21