From 083b266f69f36195aef22cb224f86b99ca0d6feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 18 Dec 2019 18:20:09 +0100 Subject: chardev: Use QEMUChrEvent enum in IOEventHandler typedef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Chardev events are listed in the QEMUChrEvent enum. By using the enum in the IOEventHandler typedef we: - make the IOEventHandler type more explicit (this handler process out-of-band information, while the IOReadHandler is in-band), - help static code analyzers. This patch was produced with the following spatch script: @match@ expression backend, opaque, context, set_open; identifier fd_can_read, fd_read, fd_event, be_change; @@ qemu_chr_fe_set_handlers(backend, fd_can_read, fd_read, fd_event, be_change, opaque, context, set_open); @depends on match@ identifier opaque, event; identifier match.fd_event; @@ static -void fd_event(void *opaque, int event) +void fd_event(void *opaque, QEMUChrEvent event) { ... } Then the typedef was modified manually in include/chardev/char-fe.h. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Corey Minyard Acked-by: Cornelia Huck Reviewed-by: Marc-André Lureau Message-Id: <20191218172009.8868-15-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- net/filter-mirror.c | 2 +- net/vhost-user.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/net/filter-mirror.c b/net/filter-mirror.c index 8d36009..d83e815 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -132,7 +132,7 @@ static void redirector_chr_read(void *opaque, const uint8_t *buf, int size) } } -static void redirector_chr_event(void *opaque, int event) +static void redirector_chr_event(void *opaque, QEMUChrEvent event) { NetFilterState *nf = opaque; MirrorState *s = FILTER_REDIRECTOR(nf); diff --git a/net/vhost-user.c b/net/vhost-user.c index c54c9c7..17532da 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -218,7 +218,7 @@ static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond, return TRUE; } -static void net_vhost_user_event(void *opaque, int event); +static void net_vhost_user_event(void *opaque, QEMUChrEvent event); static void chr_closed_bh(void *opaque) { @@ -249,7 +249,7 @@ static void chr_closed_bh(void *opaque) } } -static void net_vhost_user_event(void *opaque, int event) +static void net_vhost_user_event(void *opaque, QEMUChrEvent event) { const char *name = opaque; NetClientState *ncs[MAX_QUEUE_NUM]; -- cgit v1.1