From 9ac3788b0be368e2826a8e9adadc1ada87d89273 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 6 Dec 2018 00:37:33 +0400 Subject: char: add a QEMU_CHAR_FEATURE_GCONTEXT flag QEMU_CHAR_FEATURE_GCONTEXT declares the character device can switch GMainContext. Assert we don't switch context when the character device doesn't provide this feature. Character device users must not violate this restriction. In particular, user configurations that violate them must be rejected. Existing frontend that rely on context switching would now assert() if the backend doesn't allow it (instead of silently producing undesired events in the default context). Following patches improve the situation by reporting an error earlier instead, on the frontend side. Signed-off-by: Marc-André Lureau Message-Id: <20181205203737.9011-4-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- include/chardev/char.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/chardev/char.h') diff --git a/include/chardev/char.h b/include/chardev/char.h index 7becd8c80c..014566c3de 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -47,6 +47,9 @@ typedef enum { QEMU_CHAR_FEATURE_FD_PASS, /* Whether replay or record mode is enabled */ QEMU_CHAR_FEATURE_REPLAY, + /* Whether the gcontext can be changed after calling + * qemu_chr_be_update_read_handlers() */ + QEMU_CHAR_FEATURE_GCONTEXT, QEMU_CHAR_FEATURE_LAST, } ChardevFeature; -- cgit v1.2.3-55-g7522