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