[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree" |
Date: |
Thu, 12 Apr 2018 11:15:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
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
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Dr. David Alan Gilbert, 2018/04/11
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree",
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Igor Mammedov, 2018/04/16
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Paolo Bonzini, 2018/04/16
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Igor Mammedov, 2018/04/16
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Paolo Bonzini, 2018/04/16
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Igor Mammedov, 2018/04/17
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Paolo Bonzini, 2018/04/17
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Markus Armbruster, 2018/04/18
- Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Paolo Bonzini, 2018/04/18
Re: [Qemu-devel] [PATCH qemu] RFC: memory/hmp: Print owners/parents in "info mtree", Alexey Kardashevskiy, 2018/04/18