chardev: use QEMUChrEvent instead of int

This uses the QEMUChrEvent enum everywhere except in IOEventHandler.
The IOEventHandler change needs to happen at once for all front ends and
is done with Coccinelle in the next patch.

(Extracted from a patch by Philippe Mathieu-Daudé).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-01-08 11:14:29 +01:00
parent 71f8d3b0e6
commit 2fa9044a4f
4 changed files with 8 additions and 8 deletions

View File

@ -117,7 +117,7 @@ static void mux_print_help(Chardev *chr)
}
}
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)
{
CharBackend *be = d->backends[mux_nr];
@ -126,7 +126,7 @@ static void mux_chr_send_event(MuxChardev *d, int mux_nr, int event)
}
}
static void mux_chr_be_event(Chardev *chr, int event)
static void mux_chr_be_event(Chardev *chr, QEMUChrEvent event)
{
MuxChardev *d = MUX_CHARDEV(chr);
@ -232,7 +232,7 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
}
}
void mux_chr_send_all_event(Chardev *chr, int event)
void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event)
{
MuxChardev *d = MUX_CHARDEV(chr);
int i;

View File

@ -48,7 +48,7 @@ static Object *get_chardevs_root(void)
return container_get(object_get_root(), "/chardevs");
}
static void chr_be_event(Chardev *s, int event)
static void chr_be_event(Chardev *s, QEMUChrEvent event)
{
CharBackend *be = s->be;
@ -59,7 +59,7 @@ static void chr_be_event(Chardev *s, int event)
be->chr_event(be->opaque, event);
}
void qemu_chr_be_event(Chardev *s, int event)
void qemu_chr_be_event(Chardev *s, QEMUChrEvent event)
{
/* Keep track if the char device is open */
switch (event) {

View File

@ -56,6 +56,6 @@ typedef struct MuxChardev {
object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
void mux_set_focus(Chardev *chr, int focus);
void mux_chr_send_all_event(Chardev *chr, int event);
void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event);
#endif /* CHAR_MUX_H */

View File

@ -210,7 +210,7 @@ void qemu_chr_be_update_read_handlers(Chardev *s,
*
* Send an event from the back end to the front end.
*/
void qemu_chr_be_event(Chardev *s, int event);
void qemu_chr_be_event(Chardev *s, QEMUChrEvent event);
int qemu_chr_add_client(Chardev *s, int fd);
Chardev *qemu_chr_find(const char *name);
@ -273,7 +273,7 @@ typedef struct ChardevClass {
void (*chr_accept_input)(Chardev *chr);
void (*chr_set_echo)(Chardev *chr, bool echo);
void (*chr_set_fe_open)(Chardev *chr, int fe_open);
void (*chr_be_event)(Chardev *s, int event);
void (*chr_be_event)(Chardev *s, QEMUChrEvent event);
/* Return 0 if succeeded, 1 if failed */
int (*chr_machine_done)(Chardev *chr);
} ChardevClass;