diff options
author | Philippe Mathieu-Daudé | 2019-12-18 18:20:09 +0100 |
---|---|---|
committer | Paolo Bonzini | 2020-01-08 11:15:35 +0100 |
commit | 083b266f69f36195aef22cb224f86b99ca0d6feb (patch) | |
tree | 03ca4c942976a8eddf418f6e3703c198af1db000 /net | |
parent | chardev: use QEMUChrEvent instead of int (diff) | |
download | qemu-083b266f69f36195aef22cb224f86b99ca0d6feb.tar.gz qemu-083b266f69f36195aef22cb224f86b99ca0d6feb.tar.xz qemu-083b266f69f36195aef22cb224f86b99ca0d6feb.zip |
chardev: Use QEMUChrEvent enum in IOEventHandler typedef
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é <philmd@redhat.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20191218172009.8868-15-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/filter-mirror.c | 2 | ||||
-rw-r--r-- | net/vhost-user.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/net/filter-mirror.c b/net/filter-mirror.c index 8d36009c53..d83e815545 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 c54c9c7d4c..17532daaf3 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]; |