From e8bfc790b95f5665ecb241ddf7b92e9bf67607d0 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 31 Mar 2010 13:24:18 -0300 Subject: [PATCH 03/66] qdev: Add help for device properties RH-Author: Markus Armbruster Message-id: <1270041921-28969-4-git-send-email-armbru@redhat.com> Patchwork-id: 8205 O-Subject: [PATCH 03/66] qdev: Add help for device properties Bugzilla: 579470 RH-Acked-by: Kevin Wolf RH-Acked-by: Juan Quintela RH-Acked-by: Luiz Capitulino 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 Signed-off-by: Anthony Liguori (cherry picked from commit 08350cf06a4aa1b703ff6968688fab9fd8e90fcc) --- hw/qdev.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) Signed-off-by: Eduardo Habkost --- hw/qdev.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index a9f5c02..af16fb6 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -158,6 +158,7 @@ int qdev_device_help(QemuOpts *opts) const char *driver; DeviceInfo *info; char msg[256]; + Property *prop; driver = qemu_opt_get(opts, "driver"); if (driver && !strcmp(driver, "?")) { @@ -168,7 +169,19 @@ int qdev_device_help(QemuOpts *opts) 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) -- 1.7.0.3