qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"Zhenwei Pi" <pizhenwei@bytedance.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Amit Shah" <amit@kernel.org>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
	"Clément Chigot" <chigot@adacore.com>,
	"Frederic Konrad" <konrad.frederic@yahoo.fr>,
	"Alberto Garcia" <berto@igalia.com>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Jason Herne" <jjherne@linux.ibm.com>,
	"Yoshinori Sato" <yoshinori.sato@nifty.com>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Collin L. Walling" <walling@linux.ibm.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Anthony PERARD" <anthony@xenproject.org>,
	"Paul Durrant" <paul@xen.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Helge Deller" <deller@gmx.de>, "Corey Minyard" <minyard@acm.org>,
	"Paul Burton" <paulburton@kernel.org>,
	"Aleksandar Rikalo" <arikalo@gmail.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Weiwei Li" <liwei1518@gmail.com>,
	"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Michael Rolnik" <mrolnik@gmail.com>,
	"Antony Pavlov" <antonynpavlov@gmail.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Vijai Kumar K" <vijai@behindbytes.com>,
	"Samuel Tardieu" <sam@rfc1149.net>,
	"Gustavo Romero" <gustavo.romero@linaro.org>,
	"Raphael Norwitz" <raphael@enfabrica.net>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"reviewer:vhost-user-scmi" <mzamazal@redhat.com>,
	"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
	"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Dr. David Alan Gilbert" <dave@treblig.org>,
	"Zhang Chen" <zhangckid@gmail.com>,
	"Li Zhijian" <lizhijian@fujitsu.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Lukas Straub" <lukasstraub2@web.de>,
	"open list:Sharp SL-5500 Co..." <qemu-arm@nongnu.org>,
	"open list:S390 SCLP-backed..." <qemu-s390x@nongnu.org>,
	"open list:sPAPR (pseries)" <qemu-ppc@nongnu.org>,
	"open list:X86 Xen CPUs" <xen-devel@lists.xenproject.org>,
	"open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>,
	"open list:virtiofs" <virtio-fs@lists.linux.dev>,
	"open list:Rust-related patc..." <qemu-rust@nongnu.org>
Subject: Re: [PATCH v2] char: rename CharBackend->CharFrontend
Date: Wed, 22 Oct 2025 10:09:40 +0200	[thread overview]
Message-ID: <36b8e200-10ab-48b0-beda-9ca2c42f2b48@linaro.org> (raw)
In-Reply-To: <20251022074612.1258413-1-marcandre.lureau@redhat.com>

On 22/10/25 09:46, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> The actual backend is "Chardev", CharBackend is the frontend side of
> it (whatever talks to the backend), let's rename it for readability.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   chardev/chardev-internal.h           |  12 +-
>   include/chardev/char-fe.h            |  67 +++++----
>   include/chardev/char.h               |   4 +-
...

> 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;
> diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
> index 8ef05b3dd0..7901856f95 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 - Chardev as seen by front end
>    * @fe_is_open: the front end is ready for IO
>    *
>    * The actual backend is Chardev
>    */
> -struct CharBackend {
> +struct CharFrontend {
>       Chardev *chr;
>       IOEventHandler *chr_event;
>       IOCanReadHandler *chr_can_read;
> @@ -27,53 +27,52 @@ struct CharBackend {
>   /**
>    * qemu_chr_fe_init:
>    *
> - * Initializes a front end for the given CharBackend and
> - * Chardev. Call qemu_chr_fe_deinit() to remove the association and
> - * release the driver.
> + * Initializes the frontend @c for the given Chardev backend @s. Call
> + * qemu_chr_fe_deinit() to remove the association and release the backend.
>    *
>    * Returns: false on error.
>    */
> -bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp);
> +bool qemu_chr_fe_init(CharFrontend *c, Chardev *s, Error **errp);

IMO even clearer for this API would be to use:

   bool qemu_chr_fe_init(CharFrontend *fe, Chardev *be, Error **errp);

and update documentation accordingly.

>   
>   /**
>    * qemu_chr_fe_deinit:
> - * @b: a CharBackend
> + * @c: a CharFrontend
>    * @del: if true, delete the chardev backend
>   *
> - * Dissociate the CharBackend from the Chardev.
> + * Dissociate the CharFrontend from the Chardev.
>    *
>    * Safe to call without associated Chardev.
>    */
> -void qemu_chr_fe_deinit(CharBackend *b, bool del);
> +void qemu_chr_fe_deinit(CharFrontend *c, bool del);
>   
>   /**
>    * qemu_chr_fe_get_driver:
>    *
> - * Returns: the driver associated with a CharBackend or NULL if no
> + * Returns: the driver associated with a CharFrontend or NULL if no
>    * associated Chardev.
>    * Note: avoid this function as the driver should never be accessed directly,
>    *       especially by the frontends that support chardevice hotswap.
>    *       Consider qemu_chr_fe_backend_connected() to check for driver existence
>    */
> -Chardev *qemu_chr_fe_get_driver(CharBackend *be);
> +Chardev *qemu_chr_fe_get_driver(CharFrontend *c);
>   
>   /**
>    * qemu_chr_fe_backend_connected:
>    *
> - * Returns: true if there is a chardevice associated with @be.
> + * Returns: true if there is a backend associated with @c.
>    */
> -bool qemu_chr_fe_backend_connected(CharBackend *be);
> +bool qemu_chr_fe_backend_connected(CharFrontend *c);

LGTM otherwise!


  reply	other threads:[~2025-10-22  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  7:46 [PATCH v2] char: rename CharBackend->CharFrontend marcandre.lureau
2025-10-22  8:09 ` Philippe Mathieu-Daudé [this message]
2025-10-22 12:49 ` Paolo Bonzini
2025-10-23  4:52 ` Akihiko Odaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36b8e200-10ab-48b0-beda-9ca2c42f2b48@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=alistair@alistair23.me \
    --cc=amit@kernel.org \
    --cc=anthony@xenproject.org \
    --cc=antonynpavlov@gmail.com \
    --cc=arei.gonglei@huawei.com \
    --cc=arikalo@gmail.com \
    --cc=armbru@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=berto@igalia.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=chigot@adacore.com \
    --cc=dave@treblig.org \
    --cc=dbarboza@ventanamicro.com \
    --cc=deller@gmx.de \
    --cc=dmitry.osipenko@collabora.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=gustavo.romero@linaro.org \
    --cc=harshpb@linux.ibm.com \
    --cc=huth@tuxfamily.org \
    --cc=i.mitsyanko@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=jjherne@linux.ibm.com \
    --cc=joel@jms.id.au \
    --cc=konrad.frederic@yahoo.fr \
    --cc=liwei1518@gmail.com \
    --cc=lizhijian@fujitsu.com \
    --cc=lukasstraub2@web.de \
    --cc=lvivier@redhat.com \
    --cc=magnus.damm@gmail.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=minyard@acm.org \
    --cc=mrolnik@gmail.com \
    --cc=mst@redhat.com \
    --cc=mzamazal@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=palmer@dabbelt.com \
    --cc=pasic@linux.ibm.com \
    --cc=paul@xen.org \
    --cc=paulburton@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pizhenwei@bytedance.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-rust@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=raphael@enfabrica.net \
    --cc=richard.henderson@linaro.org \
    --cc=sam@rfc1149.net \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=sgarzare@redhat.com \
    --cc=sstabellini@kernel.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=vijai@behindbytes.com \
    --cc=virtio-fs@lists.linux.dev \
    --cc=walling@linux.ibm.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yoshinori.sato@nifty.com \
    --cc=zhangckid@gmail.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).