[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/3] qdev: Add help for device properties
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 1/3] qdev: Add help for device properties |
Date: |
Thu, 21 Jan 2010 17:44:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> Stefan Weil <address@hidden> 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 <address@hidden>
>> ---
>> 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:".
- Re: [Qemu-devel] [PATCH] Documentation: Add missing documentation for qdev related command line options, (continued)
- [Qemu-devel] Re: [PATCH] Documentation: Add missing documentation for qdev related command line options, Michael S. Tsirkin, 2010/01/19
- [Qemu-devel] [PATCH 1/3] qdev: Add help for device properties, Stefan Weil, 2010/01/20
- [Qemu-devel] [PATCH 2/3] qdev: Add help for property value, Stefan Weil, 2010/01/20
- [Qemu-devel] [PATCH 3/3] Documentation: Improve command line help for -device option, Stefan Weil, 2010/01/20
- Re: [Qemu-devel] [PATCH 2/3] qdev: Add help for property value, Markus Armbruster, 2010/01/21
- Re: [Qemu-devel] [PATCH 1/3] qdev: Add help for device properties, Markus Armbruster, 2010/01/21
- Re: [Qemu-devel] [PATCH 1/3] qdev: Add help for device properties,
Markus Armbruster <=
- Re: [Qemu-devel] [PATCH 1/3] qdev: Add help for device properties, Gerd Hoffmann, 2010/01/21
Re: [Qemu-devel] [PATCH] Documentation: Add missing documentation for qdev related command line options, Anthony Liguori, 2010/01/20