From patchwork Mon Dec 6 18:23:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 74447 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8BA09B708B for ; Tue, 7 Dec 2010 05:44:34 +1100 (EST) Received: from localhost ([127.0.0.1]:41725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPg34-0004Z7-H1 for incoming@patchwork.ozlabs.org; Mon, 06 Dec 2010 13:44:30 -0500 Received: from [140.186.70.92] (port=35918 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPfjr-00039o-CH for qemu-devel@nongnu.org; Mon, 06 Dec 2010 13:24:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPfjq-0004Ak-7B for qemu-devel@nongnu.org; Mon, 06 Dec 2010 13:24:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59440) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPfjp-0004Ad-QH for qemu-devel@nongnu.org; Mon, 06 Dec 2010 13:24:38 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB6IOaEX007998 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Dec 2010 13:24:36 -0500 Received: from localhost ([10.3.113.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oB6IOZ5d030040; Mon, 6 Dec 2010 13:24:36 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 6 Dec 2010 16:23:58 -0200 Message-Id: <1291659852-23028-12-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1291659852-23028-1-git-send-email-lcapitulino@redhat.com> References: <1291659852-23028-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 11/25] Monitor: Convert do_pci_info_print() into do_pci_info() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/pci.c | 7 ++++++- hw/pci.h | 2 +- monitor.c | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 08c36ec..ba204bf 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -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) diff --git a/hw/pci.h b/hw/pci.h index b87c6c0..22509dc 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -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); diff --git a/monitor.c b/monitor.c index 2164853..1fbe78b 100644 --- a/monitor.c +++ b/monitor.c @@ -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) {