All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Alessandro Ratti <alessandro@0x65c.net>
Cc: qemu-devel@nongnu.org,  peter.maydell@linaro.org,
	 berrange@redhat.com, mst@redhat.com,  pbonzini@redhat.com
Subject: Re: [PATCH v3 2/3] hw/qdev: Prefix bus type in qdev_get_printable_name() device paths
Date: Fri, 27 Mar 2026 14:56:08 +0100	[thread overview]
Message-ID: <87ldfd4brb.fsf@pond.sub.org> (raw)
In-Reply-To: <20260321100405.1525059-3-alessandro@0x65c.net> (Alessandro Ratti's message of "Sat, 21 Mar 2026 11:04:04 +0100")

Alessandro Ratti <alessandro@0x65c.net> writes:

> Raw get_dev_path() output (e.g. "0000:00:04.0", "/1") is ambiguous

"can be ambiguous" would be more precise.

> without knowing which bus produced it. Prefix the path with the bus
> type name so error messages become self-describing.
>
> Examples:
>   - PCIE device 0000:00:04.0
>   - virtio-pci-bus device 0000:00:03.0
>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
> ---
>  hw/core/qdev.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index c44616b4b8..904e710f8e 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -418,11 +418,13 @@ const char *qdev_get_printable_name(DeviceState *dev)
>      }
>      /*
>       * Fall back to a bus-specific device path, if the bus
> -     * provides one (e.g. PCI address "0000:00:04.0").
> +     * provides one (e.g. "PCI device 0000:00:04.0").
>       */
> -    const char *path = qdev_get_dev_path(dev);
> +    g_autofree char *path = qdev_get_dev_path(dev);
>      if (path) {
> -        return path;
> +        const char *bus_type = object_get_typename(OBJECT(dev->parent_bus));
> +        char *name = g_strdup_printf("%s device %s", bus_type, path);
> +        return name;
>      }
>  
>      return object_get_canonical_path(OBJECT(dev));

Reviewed-by: Markus Armbruster <armbru@redhat.com>



  reply	other threads:[~2026-03-27 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21 10:04 [PATCH v3 0/3] hw/qdev: Consolidate qdev_get_human_name() and qdev_get_printable_name() Alessandro Ratti
2026-03-21 10:04 ` [PATCH v3 1/3] hw/qdev: Clarify fallback order in qdev_get_printable_name() Alessandro Ratti
2026-03-27 13:56   ` Markus Armbruster
2026-03-21 10:04 ` [PATCH v3 2/3] hw/qdev: Prefix bus type in qdev_get_printable_name() device paths Alessandro Ratti
2026-03-27 13:56   ` Markus Armbruster [this message]
2026-03-21 10:04 ` [PATCH v3 3/3] hw/qdev: Consolidate qdev_get_printable_name() into qdev_get_human_name() Alessandro Ratti
2026-03-27 13:57   ` Markus Armbruster
2026-04-30  9:07 ` [PATCH v3 0/3] hw/qdev: Consolidate qdev_get_human_name() and qdev_get_printable_name() Paolo Bonzini

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=87ldfd4brb.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alessandro@0x65c.net \
    --cc=berrange@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.