qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Juan Quintela" <quintela@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	peterx@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/4] chardev: add Chardev.gcontext field
Date: Thu, 21 Sep 2017 14:35:52 +0800	[thread overview]
Message-ID: <1505975754-21555-3-git-send-email-peterx@redhat.com> (raw)
In-Reply-To: <1505975754-21555-1-git-send-email-peterx@redhat.com>

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 <peterx@redhat.com>
---
 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

  parent reply	other threads:[~2017-09-21  6:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21  6:35 [Qemu-devel] [PATCH v2 0/4] chardev: support non-default gcontext Peter Xu
2017-09-21  6:35 ` [Qemu-devel] [PATCH v2 1/4] chardev: new qemu_chr_be_update_read_handlers() Peter Xu
2017-09-21  6:35 ` Peter Xu [this message]
2017-09-21  6:35 ` [Qemu-devel] [PATCH v2 3/4] chardev: use per-dev context for io_add_watch_poll Peter Xu
2017-09-21 14:11   ` Paolo Bonzini
2017-09-22  9:18     ` Peter Xu
2017-09-21  6:35 ` [Qemu-devel] [PATCH v2 4/4] chardev: remove context in chr_update_read_handler Peter Xu
2017-09-21 12:05 ` [Qemu-devel] [PATCH v2 0/4] chardev: support non-default gcontext Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505975754-21555-3-git-send-email-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).