aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev-properties.c
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2010-01-20 22:58:34 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-26 15:42:01 -0600
commit922910ce42d15bdb7c2347436b1b5798b5401de4 (patch)
tree83b3ec6cdee14b1cc51f01997271489985d3084c /hw/qdev-properties.c
parent2ba6edf0dd740166632df80caa85992b20791a68 (diff)
qdev: Add help for property value
When called with property value "?", a help text will be printed (instead of an error message). This is useful for command lines like qemu -device e1000,mac=? and is already standard for other command line options. A better help text could be provided by extending the Property structure with a desc field. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev-properties.c')
-rw-r--r--hw/qdev-properties.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 8547ad27d4..f5ca05fe87 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -565,8 +565,13 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
return -1;
}
if (prop->info->parse(dev, prop, value) != 0) {
- fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
- dev->info->name, name, value);
+ if (strcmp(value, "?") != 0) {
+ fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
+ dev->info->name, name, value);
+ } else {
+ fprintf(stderr, "%s.%s=%s\n",
+ dev->info->name, name, prop->info->name);
+ }
return -1;
}
return 0;