summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2026-08-24 16:24:51 +0100
committerAlex Bennée <alex.bennee@linaro.org>2026-08-28 11:40:02 +0100
commit6b375e13b2db9c9ef5ec10d214cd764b9411dc20 (patch)
treec1029fd5af1532d5d8881b8738981f199e1a09c5 /backends
parent172cc8e4c5b398e983e6abbbb574f64a66a6c2fb (diff)
downloadqemu-6b375e13b2db9c9ef5ec10d214cd764b9411dc20.tar.gz
qemu-6b375e13b2db9c9ef5ec10d214cd764b9411dc20.zip
char-fe: implement qemu_chr_fe_backend_name
A number of chardev users where calling qemu_chr_fe_get_driver() which is discouraged as it blocks backend hotswap. As the pattern is common and need for the string is transitory add a helper and keep qemu_chr_fe_get_driver() for those that really need the funkiness of poking around the backend setup. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260824-fixes-for-11-2-v2-4-352c6b890402@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Diffstat (limited to 'backends')
-rw-r--r--backends/cryptodev-vhost-user.c8
-rw-r--r--backends/rng-egd.c8
-rw-r--r--backends/vhost-user.c8
3 files changed, 3 insertions, 21 deletions
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index cc478d9902..3334e280a2 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -373,13 +373,7 @@ cryptodev_vhost_user_get_chardev(Object *obj, Error **errp)
{
CryptoDevBackendVhostUser *s =
CRYPTODEV_BACKEND_VHOST_USER(obj);
- Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
-
- if (chr && chr->label) {
- return g_strdup(chr->label);
- }
-
- return NULL;
+ return qemu_chr_fe_backend_name(&s->chr);
}
static void cryptodev_vhost_user_finalize(Object *obj)
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index 1d92bd71cf..c2207f40c5 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -126,13 +126,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
static char *rng_egd_get_chardev(Object *obj, Error **errp)
{
RngEgd *s = RNG_EGD(obj);
- Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
-
- if (chr && chr->label) {
- return g_strdup(chr->label);
- }
-
- return NULL;
+ return qemu_chr_fe_backend_name(&s->chr);
}
static void rng_egd_finalize(Object *obj)
diff --git a/backends/vhost-user.c b/backends/vhost-user.c
index 380d825023..46dadb7480 100644
--- a/backends/vhost-user.c
+++ b/backends/vhost-user.c
@@ -152,13 +152,7 @@ static void set_chardev(Object *obj, const char *value, Error **errp)
static char *get_chardev(Object *obj, Error **errp)
{
VhostUserBackend *b = VHOST_USER_BACKEND(obj);
- Chardev *chr = qemu_chr_fe_get_driver(&b->chr);
-
- if (chr && chr->label) {
- return g_strdup(chr->label);
- }
-
- return NULL;
+ return qemu_chr_fe_backend_name(&b->chr);
}
static void vhost_user_backend_class_init(ObjectClass *oc, const void *data)