mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
qdev-monitor: print help to stdout
qdev_device_help() is used from command line "-device help", or from HMP "device_add". If used from command line, print help to stdout (it is only printed on explicit demand). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
b8e5671a8c
commit
a95db58f21
3 changed files with 37 additions and 18 deletions
|
@ -104,22 +104,31 @@ static bool qdev_class_has_alias(DeviceClass *dc)
|
|||
return (qdev_class_get_alias(dc) != NULL);
|
||||
}
|
||||
|
||||
static void out_printf(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
monitor_vfprintf(stdout, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void qdev_print_devinfo(DeviceClass *dc)
|
||||
{
|
||||
error_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc)));
|
||||
out_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc)));
|
||||
if (dc->bus_type) {
|
||||
error_printf(", bus %s", dc->bus_type);
|
||||
out_printf(", bus %s", dc->bus_type);
|
||||
}
|
||||
if (qdev_class_has_alias(dc)) {
|
||||
error_printf(", alias \"%s\"", qdev_class_get_alias(dc));
|
||||
out_printf(", alias \"%s\"", qdev_class_get_alias(dc));
|
||||
}
|
||||
if (dc->desc) {
|
||||
error_printf(", desc \"%s\"", dc->desc);
|
||||
out_printf(", desc \"%s\"", dc->desc);
|
||||
}
|
||||
if (!dc->user_creatable) {
|
||||
error_printf(", no-user");
|
||||
out_printf(", no-user");
|
||||
}
|
||||
error_printf("\n");
|
||||
out_printf("\n");
|
||||
}
|
||||
|
||||
static void qdev_print_devinfos(bool show_no_user)
|
||||
|
@ -155,8 +164,7 @@ static void qdev_print_devinfos(bool show_no_user)
|
|||
continue;
|
||||
}
|
||||
if (!cat_printed) {
|
||||
error_printf("%s%s devices:\n", i ? "\n" : "",
|
||||
cat_name[i]);
|
||||
out_printf("%s%s devices:\n", i ? "\n" : "", cat_name[i]);
|
||||
cat_printed = true;
|
||||
}
|
||||
qdev_print_devinfo(dc);
|
||||
|
@ -278,13 +286,11 @@ int qdev_device_help(QemuOpts *opts)
|
|||
}
|
||||
|
||||
for (prop = prop_list; prop; prop = prop->next) {
|
||||
error_printf("%s.%s=%s", driver,
|
||||
prop->value->name,
|
||||
prop->value->type);
|
||||
out_printf("%s.%s=%s", driver, prop->value->name, prop->value->type);
|
||||
if (prop->value->has_description) {
|
||||
error_printf(" (%s)\n", prop->value->description);
|
||||
out_printf(" (%s)\n", prop->value->description);
|
||||
} else {
|
||||
error_printf("\n");
|
||||
out_printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue