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>
This commit is contained in:
parent
2ba6edf0dd
commit
922910ce42
|
@ -565,8 +565,13 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (prop->info->parse(dev, prop, value) != 0) {
|
if (prop->info->parse(dev, prop, value) != 0) {
|
||||||
fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
|
if (strcmp(value, "?") != 0) {
|
||||||
dev->info->name, name, value);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue