From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Amit Shah Date: Mon, 31 May 2010 18:11:30 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 4/5] qdev: Re-arrange code to have device properties shown from own function List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Amit Shah , Juan Quintela , Markus Armbruster , Gerd Hoffmann 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; -- 1.7.0.1