char: move front end handlers in CharBackend
commita4afa548fc6dd9842ed86639b4d37d4d1c4ad480
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Sat, 22 Oct 2016 09:53:01 +0000 (22 12:53 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 24 Oct 2016 13:46:10 +0000 (24 15:46 +0200)
tree94f8e8304a29960fa03001cd3d57b75c600becd8
parentea3af47d75335d9247dfa33554ddd935957f77cd
char: move front end handlers in CharBackend

Since the hanlders are associated with a CharBackend, rather than the
CharDriverState, it is more appropriate to store in CharBackend. This
avoids the handler copy dance in qemu_chr_fe_set_handlers() then
mux_chr_update_read_handler(), by storing the CharBackend pointer
directly.

Also a mux CharDriver should go through mux->backends[focused], since
chr->be will stay NULL. Before that, it was possible to call
chr->handler by mistake with surprising results, for ex through
qemu_chr_be_can_write(), which would result in calling the last set
handler front end, not the one with focus.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161022095318.17775-22-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/bt/hci-csr.c
include/sysemu/char.h
qemu-char.c
ui/console.c