Skip to content

Commit

Permalink
chardev: add Chardev.gcontext field
Browse files Browse the repository at this point in the history
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>
Message-Id: <1505975754-21555-3-git-send-email-peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
xzpeter authored and bonzini committed Sep 22, 2017
1 parent 07241c2 commit 95eeeba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions chardev/char.c
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions include/chardev/char.h
Expand Up @@ -55,6 +55,7 @@ struct Chardev {
int logfd;
int be_open;
GSource *gsource;
GMainContext *gcontext;
DECLARE_BITMAP(features, QEMU_CHAR_FEATURE_LAST);
};

Expand Down

0 comments on commit 95eeeba

Please sign in to comment.