From patchwork Mon May 31 12:41:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 54088 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 7ABE2B7D48 for ; Mon, 31 May 2010 22:51:57 +1000 (EST) Received: from localhost ([127.0.0.1]:33776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJ4Sh-0001QT-3y for incoming@patchwork.ozlabs.org; Mon, 31 May 2010 08:51:23 -0400 Received: from [140.186.70.92] (port=41790 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJ4Hi-0006R5-5Q for qemu-devel@nongnu.org; Mon, 31 May 2010 08:40:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJ4Hg-0007KK-F8 for qemu-devel@nongnu.org; Mon, 31 May 2010 08:40:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24573) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJ4Hg-0007KE-91 for qemu-devel@nongnu.org; Mon, 31 May 2010 08:40:00 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4VCdxOV031773 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 31 May 2010 08:39:59 -0400 Received: from localhost (dhcp1-88.pnq.redhat.com [10.65.193.88]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4VCdvPX025494; Mon, 31 May 2010 08:39:58 -0400 From: Amit Shah To: qemu list Date: Mon, 31 May 2010 18:11:30 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Amit Shah , Juan Quintela , Markus Armbruster , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 4/5] qdev: Re-arrange code to have device properties shown from own function 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 Instead of printing out the device properties help messages from qdev_device_help(), split it off into a new function. This way, we have two separate function calls for device help and device properties help. This will be later used to show all the devices and all the properties associated with the device as part of a complete coverage for all devices and options associated with each of them. Signed-off-by: Amit Shah --- hw/qdev.c | 41 ++++++++++++++++++++++++----------------- 1 files changed, 24 insertions(+), 17 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 2cd205b..89ba986 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -151,27 +151,11 @@ static int set_property(const char *name, const char *value, void *opaque) return 0; } -int qdev_device_help(QemuOpts *opts) +static int show_device_props(const char *driver) { - const char *driver; DeviceInfo *info; Property *prop; - driver = qemu_opt_get(opts, "driver"); - if (driver && !strcmp(driver, "?")) { - for (info = device_info_list; info != NULL; info = info->next) { - if (info->no_user) { - continue; /* not available, don't show */ - } - qdev_print_devinfo(info); - } - return 1; - } - - if (!qemu_opt_get(opts, "?")) { - return 0; - } - info = qdev_find_info(NULL, driver); if (!info) { return 0; @@ -193,6 +177,29 @@ int qdev_device_help(QemuOpts *opts) return 1; } +int qdev_device_help(QemuOpts *opts) +{ + const char *driver; + DeviceInfo *info; + + driver = qemu_opt_get(opts, "driver"); + if (driver && !strcmp(driver, "?")) { + for (info = device_info_list; info != NULL; info = info->next) { + if (info->no_user) { + continue; /* not available, don't show */ + } + qdev_print_devinfo(info); + } + return 1; + } + + if (!qemu_opt_get(opts, "?")) { + return 0; + } + + return show_device_props(driver); +} + DeviceState *qdev_device_add(QemuOpts *opts) { const char *driver, *path, *id;