qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH qemu v2 1/2] memory/hmp: Print owners/parents in


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH qemu v2 1/2] memory/hmp: Print owners/parents in "info mtree"
Date: Mon, 30 Apr 2018 11:53:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 30/04/2018 08:25, Alexey Kardashevskiy wrote:
> +    DeviceState *dev = (DeviceState *) object_dynamic_cast(obj, TYPE_DEVICE);
> +    const char *id = object_property_print(obj, "id", true, NULL);

The only objects that have an "id" property are memdevs.  If you want to
special case their printing too, it's probably a good idea (that is,
print one of "dev id=ID"/"memdev id=ID"/"obj path=PATH").

Otherwise, I can also queue this patch as is, but I'd remove the "id"
property handling because I'm going to submit a small series to remove
the "id" property altogether.

Let me know what you prefer!

Thanks,

Paolo

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]