qdev: Add help for device properties
Option "-device DRIVER,?" and monitor command "device_add DRIVER,?"
print the supported properties instead of creating a device. The
former also terminates the program.
This is commit 2ba6edf0
(just reverted) done right.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
5137b6accd
commit
08350cf06a
15
hw/qdev.c
15
hw/qdev.c
|
@ -158,6 +158,7 @@ int qdev_device_help(QemuOpts *opts)
|
||||||
const char *driver;
|
const char *driver;
|
||||||
DeviceInfo *info;
|
DeviceInfo *info;
|
||||||
char msg[256];
|
char msg[256];
|
||||||
|
Property *prop;
|
||||||
|
|
||||||
driver = qemu_opt_get(opts, "driver");
|
driver = qemu_opt_get(opts, "driver");
|
||||||
if (driver && !strcmp(driver, "?")) {
|
if (driver && !strcmp(driver, "?")) {
|
||||||
|
@ -168,7 +169,19 @@ int qdev_device_help(QemuOpts *opts)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
if (!qemu_opt_get(opts, "?")) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
info = qdev_find_info(NULL, driver);
|
||||||
|
if (!info) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (prop = info->props; prop && prop->name; prop++) {
|
||||||
|
qemu_error("%s.%s\n", info->name, prop->name);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceState *qdev_device_add(QemuOpts *opts)
|
DeviceState *qdev_device_add(QemuOpts *opts)
|
||||||
|
|
Loading…
Reference in a new issue