From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NY096-0001wr-R7 for qemu-devel@nongnu.org; Thu, 21 Jan 2010 11:44:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NY092-0001vC-B3 for qemu-devel@nongnu.org; Thu, 21 Jan 2010 11:44:36 -0500 Received: from [199.232.76.173] (port=36270 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NY092-0001v2-52 for qemu-devel@nongnu.org; Thu, 21 Jan 2010 11:44:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22271) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NY091-0007Rc-Lk for qemu-devel@nongnu.org; Thu, 21 Jan 2010 11:44:31 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 1/3] qdev: Add help for device properties References: <4B54B749.5080304@mail.berlios.de> <1264024715-23417-1-git-send-email-weil@mail.berlios.de> Date: Thu, 21 Jan 2010 17:44:26 +0100 In-Reply-To: (Markus Armbruster's message of "Thu, 21 Jan 2010 17:38:58 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: QEMU Developers Markus Armbruster writes: > Stefan Weil writes: > >> When called with property "?", a list of supported >> properties will be printed (instead of an error message). >> >> This is useful for command lines like >> qemu -device e1000,? >> and was already standard for other options like model=? >> >> Signed-off-by: Stefan Weil >> --- >> hw/qdev-properties.c | 15 +++++++++++++-- >> 1 files changed, 13 insertions(+), 2 deletions(-) >> >> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c >> index 277ff9e..8547ad2 100644 >> --- a/hw/qdev-properties.c >> +++ b/hw/qdev-properties.c >> @@ -544,8 +544,19 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value) >> >> prop = qdev_prop_find(dev, name); >> if (!prop) { >> - fprintf(stderr, "property \"%s.%s\" not found\n", >> - dev->info->name, name); >> + if (strcmp(name, "?") != 0) { >> + fprintf(stderr, "property \"%s.%s\" not found\n", >> + dev->info->name, name); >> + } else { >> + fprintf(stderr, "supported properties:\n"); >> + if (dev->info->props != NULL) { >> + Property *props = dev->info->props; >> + while (props->name) { >> + fprintf(stderr, "%s.%s\n", dev->info->name, props->name); >> + props++; >> + } >> + } >> + } >> return -1; >> } >> if (!prop->info->parse) { > > I like it. One question, though: why print DRIVER.PROPNAME instead of just PROPNAME? You could still put DRIVER into the heading, say "Properties of DRIVER:".