aboutsummaryrefslogtreecommitdiff
path: root/include/chardev
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-04 17:01:14 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-05 16:15:33 +0400
commitbf7b1eab252bc56b6bbb12a8909eae738435d6ae (patch)
tree222018b52c4b0846f202cd81d3b3a8800f7fb824 /include/chardev
parent30f80be34ba6142dc7ba2015b98d661a9529b7c5 (diff)
downloadqemu-bf7b1eab252bc56b6bbb12a8909eae738435d6ae.zip
qemu-bf7b1eab252bc56b6bbb12a8909eae738435d6ae.tar.gz
qemu-bf7b1eab252bc56b6bbb12a8909eae738435d6ae.tar.bz2
chardev: mark explicitly first argument as poisoned
Since commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2 "char: convert from GIOChannel to QIOChannel", the first argument to the watch callback can actually be a QIOChannel, which is not a GIOChannel (but a QEMU Object). Even though we never used that pointer, change the callback type to warn the users. Possibly a better fix later, we may want to store the callback and call it from intermediary functions. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'include/chardev')
-rw-r--r--include/chardev/char-fe.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
index a553843..867ef1b 100644
--- a/include/chardev/char-fe.h
+++ b/include/chardev/char-fe.h
@@ -174,6 +174,9 @@ void qemu_chr_fe_set_open(CharBackend *be, int fe_open);
void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
+
+typedef gboolean (*FEWatchFunc)(void *do_not_use, GIOCondition condition, void *data);
+
/**
* qemu_chr_fe_add_watch:
* @cond: the condition to poll for
@@ -188,10 +191,13 @@ void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...)
* Note that you are responsible to update the front-end sources if
* you are switching the main context with qemu_chr_fe_set_handlers().
*
+ * Warning: DO NOT use the first callback argument (it may be either
+ * a GIOChannel or a QIOChannel, depending on the underlying chardev)
+ *
* Returns: the source tag
*/
guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond,
- GIOFunc func, void *user_data);
+ FEWatchFunc func, void *user_data);
/**
* qemu_chr_fe_write: