Re: [PATCH] char: rename CharBackend->CharFrontend

BALATON Zoltan <[email protected]> Tue, 21 Oct 2025 15:25:05 +0200 (CEST)
Newsgroups dev.linux.lists.virtio-fs,org.nongnu.qemu-arm,org.nongnu.qemu-devel,org.nongnu.qemu-riscv,org.nongnu.qemu-rust,org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On Tue, 21 Oct 2025, [email protected] wrote:
> From: Marc-AndrĂ© Lureau <[email protected]>
>
> The actual backend is "Chardev", CharBackend is the frontend side of it,
> let's rename it for readability.
>
> Signed-off-by: Marc-AndrĂ© Lureau <[email protected]>
> ---
> chardev/chardev-internal.h           |  12 +-
> include/chardev/char-fe.h            |  67 +++++----
> include/chardev/char.h               |   4 +-
> include/hw/char/avr_usart.h          |   2 +-
> include/hw/char/bcm2835_aux.h        |   2 +-
> include/hw/char/cadence_uart.h       |   2 +-
> include/hw/char/cmsdk-apb-uart.h     |   2 +-
> include/hw/char/digic-uart.h         |   2 +-
> include/hw/char/escc.h               |   2 +-
> include/hw/char/goldfish_tty.h       |   2 +-
> include/hw/char/ibex_uart.h          |   2 +-
> include/hw/char/imx_serial.h         |   2 +-
> include/hw/char/max78000_uart.h      |   2 +-
> include/hw/char/nrf51_uart.h         |   2 +-
> include/hw/char/parallel.h           |   2 +-
> include/hw/char/pl011.h              |   2 +-
> include/hw/char/renesas_sci.h        |   2 +-
> include/hw/char/riscv_htif.h         |   2 +-
> include/hw/char/serial.h             |   2 +-
> include/hw/char/shakti_uart.h        |   2 +-
> include/hw/char/sifive_uart.h        |   2 +-
> include/hw/char/stm32f2xx_usart.h    |   2 +-
> include/hw/char/stm32l4x5_usart.h    |   2 +-
> include/hw/misc/ivshmem-flat.h       |   2 +-
> include/hw/qdev-properties-system.h  |   2 +-
> include/hw/virtio/vhost-user-base.h  |   2 +-
> include/hw/virtio/vhost-user-blk.h   |   2 +-
> include/hw/virtio/vhost-user-fs.h    |   2 +-
> include/hw/virtio/vhost-user-scmi.h  |   2 +-
> include/hw/virtio/vhost-user-vsock.h |   2 +-
> include/hw/virtio/vhost-user.h       |   8 +-
> include/hw/virtio/virtio-gpu.h       |   2 +-
> include/hw/virtio/virtio-scsi.h      |   2 +-
> include/system/qtest.h               |   4 +-
> include/system/vhost-user-backend.h  |   2 +-
> monitor/monitor-internal.h           |   2 +-
> backends/cryptodev-vhost-user.c      |   2 +-
> backends/rng-egd.c                   |   2 +-
> backends/tpm/tpm_emulator.c          |   4 +-
> chardev/char-fe.c                    | 142 +++++++++----------
> chardev/char-hub.c                   |  18 +--
> chardev/char-mux.c                   |  40 +++---
> chardev/char.c                       |   8 +-
> gdbstub/system.c                     |   2 +-
> hw/arm/strongarm.c                   |   2 +-
> hw/char/debugcon.c                   |   2 +-
> hw/char/exynos4210_uart.c            |   2 +-
> hw/char/grlib_apbuart.c              |   2 +-
> hw/char/ipoctal232.c                 |   2 +-
> hw/char/mcf_uart.c                   |   2 +-
> hw/char/sclpconsole-lm.c             |   2 +-
> hw/char/sclpconsole.c                |   2 +-
> hw/char/sh_serial.c                  |   2 +-
> hw/char/spapr_vty.c                  |   2 +-
> hw/char/terminal3270.c               |   2 +-
> hw/char/virtio-console.c             |   2 +-
> hw/char/xen_console.c                |   2 +-
> hw/char/xilinx_uartlite.c            |   2 +-
> hw/core/qdev-properties-system.c     |  16 +--
> hw/ipmi/ipmi_bmc_extern.c            |   2 +-
> hw/mips/boston.c                     |   2 +-
> hw/mips/malta.c                      |   2 +-
> hw/misc/ivshmem-pci.c                |   2 +-
> hw/ppc/spapr_rtas.c                  |   2 +-
> hw/riscv/riscv_hart.c                |   2 +-
> hw/usb/ccid-card-passthru.c          |   2 +-
> hw/usb/dev-serial.c                  |   2 +-
> hw/usb/redirect.c                    |   2 +-
> hw/virtio/vhost-stub.c               |   2 +-
> hw/virtio/vhost-user.c               |  20 +--
> net/colo-compare.c                   |  10 +-
> net/filter-mirror.c                  |   4 +-
> net/passt.c                          |   2 +-
> net/slirp.c                          |   2 +-
> net/vhost-user.c                     |   2 +-
> semihosting/console.c                |   6 +-
> system/qtest.c                       |  20 +--
> target/hppa/sys_helper.c             |   2 +-
> target/xtensa/xtensa-semi.c          |   2 +-
> tests/qtest/vhost-user-test.c        |  16 +--
> tests/unit/test-char.c               | 198 +++++++++++++--------------
> tests/unit/test-yank.c               |  12 +-
> rust/bindings/src/lib.rs             |   4 +-
> rust/chardev/src/bindings.rs         |   6 +-
> rust/chardev/src/chardev.rs          |  26 ++--
> rust/hw/char/pl011/src/device.rs     |  12 +-
> rust/hw/core/src/qdev.rs             |   2 +-
> 87 files changed, 392 insertions(+), 393 deletions(-)
>
> diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h
> index 9752dd75f7..8ea10414ab 100644
> --- a/chardev/chardev-internal.h
> +++ b/chardev/chardev-internal.h
> @@ -37,9 +37,9 @@
> struct MuxChardev {
>     Chardev parent;
>     /* Linked frontends */
> -    CharBackend *backends[MAX_MUX];
> -    /* Linked backend */
> -    CharBackend chr;
> +    CharFrontend *frontends[MAX_MUX];
> +    /* frontend of the underlying muxed chardev */
> +    CharFrontend chr;
>     unsigned long mux_bitset;
>     int focus;
>     bool term_got_escape;
> @@ -64,8 +64,8 @@ typedef struct HubCharBackend HubCharBackend;
>  * `hub->backends` array
>  */
> struct HubCharBackend {
> -    HubChardev   *hub;
> -    CharBackend  be;
> +    HubChardev *hub;
> +    CharFrontend fe;
>     unsigned int be_ind;
> };
>
> @@ -108,7 +108,7 @@ DECLARE_INSTANCE_CHECKER(HubChardev, HUB_CHARDEV,
> #define CHARDEV_IS_HUB(chr)                                \
>     object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_HUB)
>
> -bool mux_chr_attach_frontend(MuxChardev *d, CharBackend *b,
> +bool mux_chr_attach_frontend(MuxChardev *d, CharFrontend *c,
>                              unsigned int *tag, Error **errp);
> bool mux_chr_detach_frontend(MuxChardev *d, unsigned int tag);
> void mux_set_focus(Chardev *chr, unsigned int focus);
> diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
> index 8ef05b3dd0..cb28692f38 100644
> --- a/include/chardev/char-fe.h
> +++ b/include/chardev/char-fe.h
> @@ -8,12 +8,12 @@ typedef void IOEventHandler(void *opaque, QEMUChrEvent event);
> typedef int BackendChangeHandler(void *opaque);
>
> /**
> - * struct CharBackend - back end as seen by front end
> + * struct CharFrontend - back end as seen by front end

I stopped here, haven't read the rest of the patch but the above comment 
seems to become inconsistent. Which is the front end and back end now?

Regards,
BALATON Zoltan