From patchwork Fri Jul 23 16:47:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Di Ciurcio Filho X-Patchwork-Id: 59822 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 7A5251007D1 for ; Sat, 24 Jul 2010 02:49:19 +1000 (EST) Received: from localhost ([127.0.0.1]:39177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcLQy-0005bF-KS for incoming@patchwork.ozlabs.org; Fri, 23 Jul 2010 12:49:16 -0400 Received: from [140.186.70.92] (port=45482 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcLPi-0005Y1-Mw for qemu-devel@nongnu.org; Fri, 23 Jul 2010 12:47:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OcLPh-0002rR-FL for qemu-devel@nongnu.org; Fri, 23 Jul 2010 12:47:58 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:47258) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OcLPh-0002rH-Cb for qemu-devel@nongnu.org; Fri, 23 Jul 2010 12:47:57 -0400 Received: by yxn35 with SMTP id 35so3515745yxn.4 for ; Fri, 23 Jul 2010 09:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=NRZpdZeLdFYCX/Pc6jEj08GH6iPuqV9Wl+6fF72iQD4=; b=S2YGKXZ4AqdBGvn6YOTRNOo112KXDcczUzkDjewVCHgJTbpQFIg5Eioxa/SNn54uX1 23QLqoxg/Lgtsb25WbFJAYL7uDHJLkGRFQRjJT7Uay2HT95JPK/n61+ZzgxULmfOR3G/ qpMzmTwGlDg9uGBFZK2eRq01xBoVBHDxj/3GA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=KX96w8KuRUSdY101s3j1Pi3nf4oTXBsCgh3c15h9FI2OJtkb2N3cCwlHwWp60g55J1 75YpaJxboxg3nCwU0gF4D/Ln4NW91uNsKA/TL0gxcWEj7JmiOcSJGwrbPhssEKXA+1Hi Tii50ekvInn7HYVJ+Lh/HA8VY1qDsQOnJVbBg= Received: by 10.151.13.3 with SMTP id q3mr6085969ybi.30.1279903676514; Fri, 23 Jul 2010 09:47:56 -0700 (PDT) Received: from localhost.localdomain (curitiba.ic.unicamp.br [143.106.7.130]) by mx.google.com with ESMTPS id e7sm767506ybe.16.2010.07.23.09.47.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 23 Jul 2010 09:47:55 -0700 (PDT) From: Miguel Di Ciurcio Filho To: qemu-devel@nongnu.org Date: Fri, 23 Jul 2010 13:47:40 -0300 Message-Id: <1279903660-9607-4-git-send-email-miguel.filho@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1279903660-9607-1-git-send-email-miguel.filho@gmail.com> References: <1279903660-9607-1-git-send-email-miguel.filho@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: armbru@redhat.com, lcapitulino@redhat.com, Miguel Di Ciurcio Filho , avi@redhat.com Subject: [Qemu-devel] [PATCH v4 3/3] monitor: Convert 'info qdm' to QMP 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 --- hw/qdev.c | 31 +++++++++++++++++++++++++++---- hw/qdev.h | 2 +- monitor.c | 3 ++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 14985f5..ea9633c 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -780,13 +780,36 @@ void do_info_qtree(Monitor *mon) qbus_print(mon, main_system_bus, 0); } -void do_info_qdm(Monitor *mon) +static void qdm_list_iter(QObject *obj, void *opaque) { - DeviceInfo *info; - for (info = device_info_list; info != NULL; info = info->next) { - qdev_print_devinfo(info); + Monitor *mon = opaque; + QDict *dev = qobject_to_qdict(obj); + + monitor_printf(mon, "name \"%s\", bus %s", qdict_get_str(dev, "name"), + qdict_get_str(dev, "bus")); + + if (qdict_haskey(dev, "alias")) { + monitor_printf(mon, ", alias \"%s\"", qdict_get_str(dev, "alias")); } + + if (qdict_haskey(dev, "description")) { + monitor_printf(mon, ", desc \"%s\"", qdict_get_str(dev, "description")); + } + + if (!qdict_get_bool(dev, "creatable")) { + monitor_printf(mon, ", no-user"); + } + + monitor_printf(mon, "\n"); +} + +void do_info_qdm_print(Monitor *mon, const QObject *ret_data) +{ + QList *devs; + + devs = qobject_to_qlist(ret_data); + qlist_iter(devs, qdm_list_iter, mon); } static const char *qdev_property_type_to_string(int type) diff --git a/hw/qdev.h b/hw/qdev.h index 8c6fa06..04d8501 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -184,7 +184,7 @@ void qbus_free(BusState *bus); /*** monitor commands ***/ void do_info_qtree(Monitor *mon); -void do_info_qdm(Monitor *mon); +void do_info_qdm_print(Monitor *mon, const QObject *ret_data); void do_available_devices(Monitor *mon, QObject **ret_data); int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data); int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data); diff --git a/monitor.c b/monitor.c index 384d5fc..1322416 100644 --- a/monitor.c +++ b/monitor.c @@ -2573,7 +2573,8 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show qdev device model list", - .mhandler.info = do_info_qdm, + .user_print = do_info_qdm_print, + .mhandler.info_new = do_available_devices, }, { .name = "roms",