qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC v4 05/13] query-device-slots: Collapse similar entries


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC v4 05/13] query-device-slots: Collapse similar entries
Date: Mon, 14 Aug 2017 18:57:40 -0300

Use slot_list_collapse() on the final list returned by
query-device-slots.  This way we combine similar entries from
different buses.

For example, a machine with multiple IDE buses with no devices
would return a single entry like this:

  {
    "available":true,
    "count":10,
    "device-types":["ide-device"],
    "hotpluggable":false,
    "opts":[
      {"option":"unit","values":[[0,1]]},
      {"option":"bus","values":["ide.4","ide.3","ide.5","ide.0","ide.1"]}
    ],
    "opts-complete":true
  }

Signed-off-by: Eduardo Habkost <address@hidden>
---
 qdev-monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qdev-monitor.c b/qdev-monitor.c
index 785f4af..edc6e34 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -673,7 +673,8 @@ DeviceSlotInfoList *qmp_query_device_slots(Error **errp)
     SlotListState s = { .next = &s.result };
 
     object_child_foreach_recursive(qdev_get_machine(), enumerate_bus, &s);
-    return s.result;
+
+    return slot_list_collapse(s.result);
 }
 
 
-- 
2.9.4




reply via email to

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