qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, qemu-devel@nongnu.org
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree"
Date: Thu, 12 Apr 2018 11:15:04 +0200	[thread overview]
Message-ID: <bc4100f4-0a01-a526-c6ce-c2602a96e28a@redhat.com> (raw)
In-Reply-To: <20180329032149.44685-1-aik@ozlabs.ru>

On 29/03/2018 05:21, Alexey Kardashevskiy wrote:
> +    DeviceState *dev = (DeviceState *) object_dynamic_cast(obj, TYPE_DEVICE);
> +    const char *id = object_property_print(obj, "id", true, NULL);

I learnt now about commit e1ff3c67e8544f41f1bea76ba76385faee0d2bb7 and I
find it a mistake.  The "id" is available through
object_get_canonical_path_component.  Can you change the "id" assignment
to use object_get_canonical_path_component instead?

> +    const char *name = object_property_print(obj, "name", true, NULL);

Who defines a name property?

> +    mon_printf(f, " %s:{", label);
> +    if (dev) {
> +        mon_printf(f, "dev");
> +        if (dev->id) {
> +            mon_printf(f, " id=%s", dev->id);
> +        }
> +    } else {
> +        mon_printf(f, "obj");

> +    }
> +    if (name) {
> +        mon_printf(f, " name=%s ", name);
> +    }
> +    if (id) {
> +        mon_printf(f, " id=%s ", id);
> +    }
> +    if (dev && (!name && !id && !dev->id)) {
> +        mon_printf(f, " path=%s", dev->canonical_path);

Why not print the path for the !dev case?  I think we can just have

    mon_prinf(f, " %s:{%s", label, dev ? "dev" : "obj");
    if (dev ? dev->id : id) {
        mon_printf(f, " id=%s", dev ? dev->id : id);
    } else {
        canonical_path = object_get_canonical_path(...)
        mon_printf(f, " path=%s", canonical_path);
        g_free(canonical_path);
    }

Thanks,

Paolo

  parent reply	other threads:[~2018-04-12  9:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29  3:21 [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree" Alexey Kardashevskiy
2018-04-11 18:57 ` Dr. David Alan Gilbert
2018-04-12  9:15 ` Paolo Bonzini [this message]
2018-04-16 13:20   ` Igor Mammedov
2018-04-16 13:30     ` Paolo Bonzini
2018-04-16 14:27       ` Igor Mammedov
2018-04-16 15:29         ` Paolo Bonzini
2018-04-17 12:18           ` Igor Mammedov
2018-04-17 16:31             ` Paolo Bonzini
2018-04-18  6:32               ` Markus Armbruster
2018-04-18  9:23                 ` Paolo Bonzini
2018-04-19  2:41   ` Alexey Kardashevskiy
2018-04-19 10:33     ` Paolo Bonzini
2018-04-20  6:31       ` Alexey Kardashevskiy

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=bc4100f4-0a01-a526-c6ce-c2602a96e28a@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --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 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).