aboutsummaryrefslogtreecommitdiff
path: root/include/chardev
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-02-13 14:18:13 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-02-13 14:23:39 +0100
commit4ad6f6cb149b03ab9399a63208918cde09248294 (patch)
tree7bb7be7dc3fbdd36e7f93e8d9f3ed4858a71eda3 /include/chardev
parent211ef6c4b6297a6275015c16b76bc72de35c56c3 (diff)
char: allow specifying a GMainContext at opening time
This will be needed by vhost-user-test, when each test switches to its own GMainLoop and GMainContext. Otherwise, for a reconnecting socket the initial connection will happen on the default GMainContext, and no one will be listening on it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20190202110834.24880-1-pbonzini@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'include/chardev')
-rw-r--r--include/chardev/char.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 014566c3de..c0b57f7685 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -73,6 +73,7 @@ struct Chardev {
/**
* qemu_chr_new_from_opts:
* @opts: see qemu-config.c for a list of valid options
+ * @context: the #GMainContext to be used at initialization time
*
* Create a new character backend from a QemuOpts list.
*
@@ -81,6 +82,7 @@ struct Chardev {
* or left untouched in case of help option
*/
Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
+ GMainContext *context,
Error **errp);
/**
@@ -106,25 +108,29 @@ ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts,
* qemu_chr_new:
* @label: the name of the backend
* @filename: the URI
+ * @context: the #GMainContext to be used at initialization time
*
* Create a new character backend from a URI.
* Do not implicitly initialize a monitor if the chardev is muxed.
*
* Returns: a new character backend
*/
-Chardev *qemu_chr_new(const char *label, const char *filename);
+Chardev *qemu_chr_new(const char *label, const char *filename,
+ GMainContext *context);
/**
* qemu_chr_new_mux_mon:
* @label: the name of the backend
* @filename: the URI
+ * @context: the #GMainContext to be used at initialization time
*
* Create a new character backend from a URI.
* Implicitly initialize a monitor if the chardev is muxed.
*
* Returns: a new character backend
*/
-Chardev *qemu_chr_new_mux_mon(const char *label, const char *filename);
+Chardev *qemu_chr_new_mux_mon(const char *label, const char *filename,
+ GMainContext *context);
/**
* qemu_chr_change:
@@ -146,6 +152,7 @@ void qemu_chr_cleanup(void);
* @label: the name of the backend
* @filename: the URI
* @permit_mux_mon: if chardev is muxed, initialize a monitor
+ * @context: the #GMainContext to be used at initialization time
*
* Create a new character backend from a URI.
* Character device communications are not written
@@ -154,7 +161,7 @@ void qemu_chr_cleanup(void);
* Returns: a new character backend
*/
Chardev *qemu_chr_new_noreplay(const char *label, const char *filename,
- bool permit_mux_mon);
+ bool permit_mux_mon, GMainContext *context);
/**
* qemu_chr_be_can_write:
@@ -272,7 +279,8 @@ typedef struct ChardevClass {
} ChardevClass;
Chardev *qemu_chardev_new(const char *id, const char *typename,
- ChardevBackend *backend, Error **errp);
+ ChardevBackend *backend, GMainContext *context,
+ Error **errp);
extern int term_escape_char;