aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2010-01-20 22:58:33 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-26 15:42:01 -0600
commit2ba6edf0dd740166632df80caa85992b20791a68 (patch)
tree4d3463b8970f64117385903e767d9e1b42831b60
parentee636500d6eab44b83f09cb730b67226b70423b1 (diff)
qdev: Add help for device properties
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 <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/qdev-properties.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 277ff9e780..8547ad27d4 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) {