On 22/10/2016 11:52, Marc-André Lureau wrote: > Hi, > > This is a followup of the series "[PATCH 0/9] Fix mux regression > (commit 949055a2)". Paolo suggested a new API for qemu_chr_fe_* taking > a new CharBackend* structure as argument, and modifying properties to > hold such structure. I followed his advise in the series, and it turns > out to bring some nice clean-up benefits. I continue a bit the > cleaning, and there is 3 structures after this series: CharBackend (to > hold backend users), CharDriverState (instance of char), CharDriver > (the char "class"), it would be easy to come up with better naming, > and I would rather name CharBackend->CharFrontend, but Paolo prefered > the former. I started investigating switching to QOM object, that will > be for a later series as this one is large enough.
Uhm, wow. :) I definitely want to merge patches 1 to 30 in QEMU 2.8. I'll include them in my next pull request. Paolo > While doing this work, I found a few issues that are at the beginning > of this series. > > Marc-André Lureau (38): > rng: remove unused included header > char: remove use-after-free on win-stdio > ringbuf: fix chr_write return value > sun4uv: fix serial initialization regression > malta: replace chr init by CHR_EVENT_OPENED handler > char: remove init callback > xilinx: fix buffer overflow on realize > mux: split mux_chr_update_read_handler() > char: introduce CharBackend > char: start converting mux driver to use CharBackend > char: replace PROP_CHR with CharBackend > char: remaining switch to CharBackend in frontend > char: rename some frontend functions > colo: claim in find_and_check_chardev > char: use qemu_chr_fe* functions with CharBackend argument > char: fold qemu_chr_set_handlers in qemu_chr_fe_set_handlers > vhost-user: only initialize queue 0 CharBackend > char: replace qemu_chr_claim/release with qemu_chr_fe_init/deinit > char: make some qemu_chr_fe skip if no driver > tests: start chardev unit tests > char: move front end handlers in CharBackend > char: rename chr_close/chr_free > char: remove explicit_fe_open, use a set_handlers argument > char: move fe_open in CharBackend > char: remove unused CHR_EVENT_FOCUS > char: use an enum for CHR_EVENT > char: remove unused qemu_chr_fe_event > char: replace avail_connections > char: use common error path in qmp_chardev_add > char: remove explicit_be_open from CharDriverState > char: use a const CharDriver > char: use a static array for backends > char: move callbacks in CharDriver > char: fold single-user functions in caller > char: introduce generic qemu_chr_get_kind() > char: use a feature bit for replay > char: allocate CharDriverState as a single object > bt: use qemu_chr_alloc() > > backends/baum.c | 44 +- > backends/msmouse.c | 39 +- > backends/rng-egd.c | 29 +- > backends/testdev.c | 35 +- > gdbstub.c | 39 +- > hmp.c | 2 +- > hw/alpha/dp264.c | 2 +- > hw/arm/fsl-imx25.c | 2 +- > hw/arm/fsl-imx31.c | 2 +- > hw/arm/fsl-imx6.c | 2 +- > hw/arm/omap2.c | 16 +- > hw/arm/pxa2xx.c | 19 +- > hw/arm/strongarm.c | 22 +- > hw/bt/hci-csr.c | 46 +- > hw/char/bcm2835_aux.c | 18 +- > hw/char/cadence_uart.c | 30 +- > hw/char/debugcon.c | 8 +- > hw/char/digic-uart.c | 13 +- > hw/char/escc.c | 22 +- > hw/char/etraxfs_ser.c | 12 +- > hw/char/exynos4210_uart.c | 15 +- > hw/char/grlib_apbuart.c | 17 +- > hw/char/imx_serial.c | 29 +- > hw/char/ipoctal232.c | 23 +- > hw/char/lm32_juart.c | 15 +- > hw/char/lm32_uart.c | 17 +- > hw/char/mcf_uart.c | 20 +- > hw/char/milkymist-uart.c | 13 +- > hw/char/omap_uart.c | 4 +- > hw/char/parallel.c | 46 +- > hw/char/pl011.c | 19 +- > hw/char/sclpconsole-lm.c | 13 +- > hw/char/sclpconsole.c | 12 +- > hw/char/serial-isa.c | 7 +- > hw/char/serial.c | 36 +- > hw/char/sh_serial.c | 16 +- > hw/char/spapr_vty.c | 12 +- > hw/char/stm32f2xx_usart.c | 22 +- > hw/char/virtio-console.c | 29 +- > hw/char/xen_console.c | 43 +- > hw/char/xilinx_uartlite.c | 16 +- > hw/core/qdev-properties-system.c | 80 +- > hw/i386/pc.c | 2 +- > hw/ipmi/ipmi_bmc_extern.c | 9 +- > hw/isa/pc87312.c | 4 +- > hw/mips/mips_fulong2e.c | 2 +- > hw/mips/mips_malta.c | 44 +- > hw/mips/mips_r4k.c | 2 +- > hw/misc/ivshmem.c | 23 +- > hw/sparc64/sun4u.c | 2 +- > hw/ssi/xilinx_spips.c | 2 +- > hw/usb/ccid-card-passthru.c | 21 +- > hw/usb/dev-serial.c | 31 +- > hw/usb/redirect.c | 22 +- > hw/virtio/vhost-user.c | 4 +- > hw/xtensa/xtfpga.c | 2 +- > monitor.c | 31 +- > net/colo-compare.c | 59 +- > net/filter-mirror.c | 64 +- > net/slirp.c | 25 +- > net/vhost-user.c | 49 +- > qemu-char.c | 1445 > +++++++++++++++++++++---------------- > qtest.c | 29 +- > spice-qemu-char.c | 102 +-- > tests/test-char.c | 253 +++++++ > tests/vhost-user-test.c | 27 +- > ui/console.c | 56 +- > ui/gtk.c | 28 +- > vl.c | 13 +- > tests/Makefile.include | 4 + > include/hw/char/bcm2835_aux.h | 2 +- > include/hw/char/cadence_uart.h | 2 +- > include/hw/char/digic-uart.h | 3 +- > include/hw/char/imx_serial.h | 3 +- > include/hw/char/serial.h | 6 +- > include/hw/char/stm32f2xx_usart.h | 2 +- > include/hw/qdev-properties.h | 2 +- > include/sysemu/char.h | 290 ++++---- > include/ui/gtk.h | 3 + > 79 files changed, 2064 insertions(+), 1510 deletions(-) > create mode 100644 tests/test-char.c >