提交 2ba6edf0 编写于 作者: S Stefan Weil 提交者: Anthony Liguori

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: NStefan Weil <weil@mail.berlios.de>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 ee636500
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册