qemu-arm
[Top][All Lists]
Advanced

[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: Richard Henderson
Subject: Re: [RFC PATCH v2 14/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef
Date: Wed, 18 Dec 2019 10:44:23 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

On 12/18/19 7:20 AM, Philippe Mathieu-Daudé 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

My guess is that the only change that must be done at the same time as the
spatch is the typedef in char-fe.h.

In particular,

> -static void mux_chr_send_event(MuxChardev *d, int mux_nr, int event)
> +static void mux_chr_send_event(MuxChardev *d, int mux_nr, QEMUChrEvent event)

this doesn't appear to be required -- int will implicitly convert to enum when
performing the call, and it can't be related to the typedef.

Yes, we do want to propagate the type up the call stack, but it would be nice
to see the spatch results on their own.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]