[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 14/14] chardev: Use QEMUChrEvent enum in IOEventHandle
From: |
Cornelia Huck |
Subject: |
Re: [RFC PATCH v2 14/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef |
Date: |
Thu, 19 Dec 2019 13:15:26 +0100 |
On Wed, 18 Dec 2019 18:20:09 +0100
Philippe Mathieu-Daudé <address@hidden> wrote:
> 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 following files were manually modified:
>
> - include/chardev/char-fe.h
> - include/chardev/char.h
> - include/chardev/char-mux.h
> - chardev/char.c
> - chardev/char-mux.c
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
(...)
> diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
> index 2aab04fd4b..f7aba12565 100644
> --- a/hw/char/terminal3270.c
> +++ b/hw/char/terminal3270.c
> @@ -142,7 +142,7 @@ static void terminal_read(void *opaque, const uint8_t
> *buf, int size)
> }
> }
>
> -static void chr_event(void *opaque, int event)
> +static void chr_event(void *opaque, QEMUChrEvent event)
> {
> Terminal3270 *t = opaque;
> CcwDevice *ccw_dev = CCW_DEVICE(t);
Acked-by: Cornelia Huck <address@hidden>