提交 922910ce 编写于 作者: S Stefan Weil 提交者: Anthony Liguori

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