@@ -1276,9 +1276,12 @@ static void pci_device_print(Monitor *mon, QDict *device)
}
}
-void do_pci_info_print(Monitor *mon, const QObject *data)
+void do_pci_info(Monitor *mon)
{
QListEntry *bus, *dev;
+ QObject *data;
+
+ qmp_query_pci(NULL, &data);
QLIST_FOREACH_ENTRY(qobject_to_qlist(data), bus) {
QDict *qdict = qobject_to_qdict(qlist_entry_obj(bus));
@@ -1286,6 +1289,8 @@ void do_pci_info_print(Monitor *mon, const QObject *data)
pci_device_print(mon, qobject_to_qdict(qlist_entry_obj(dev)));
}
}
+
+ qobject_decref(data);
}
static QObject *pci_get_dev_class(const PCIDevice *dev)
@@ -253,7 +253,7 @@ int pci_parse_devaddr(const char *addr, int *domp, int *busp,
int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp,
unsigned *slotp);
-void do_pci_info_print(Monitor *mon, const QObject *data);
+void do_pci_info(Monitor *mon);
void qmp_query_pci(Monitor *mon, QObject **ret_data);
void pci_bridge_update_mappings(PCIBus *b);
@@ -2458,8 +2458,7 @@ static const mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show PCI info",
- .user_print = do_pci_info_print,
- .mhandler.info_new = qmp_query_pci,
+ .mhandler.info = do_pci_info,
},
#if defined(TARGET_I386) || defined(TARGET_SH4)
{
The new handler directly calls qmp_query_pci() to gather data and then prints it. This change allows us to drop the user_print callback. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- hw/pci.c | 7 ++++++- hw/pci.h | 2 +- monitor.c | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-)