From: Marcel Apfelbaum <marcel.a@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, greg.bellows@linaro.org, agraf@suse.de,
mst@redhat.com
Subject: [Qemu-devel] [PATCH 3/3] vl.c: add HMP help to machine
Date: Wed, 10 Dec 2014 15:19:30 +0200 [thread overview]
Message-ID: <1418217570-15517-4-git-send-email-marcel.a@redhat.com> (raw)
In-Reply-To: <1418217570-15517-1-git-send-email-marcel.a@redhat.com>
The help is based on the actual machine properties
exposing only the relevant options.
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
---
vl.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/vl.c b/vl.c
index f9757c3..fd54b44 100644
--- a/vl.c
+++ b/vl.c
@@ -1469,6 +1469,31 @@ MachineInfoList *qmp_query_machines(Error **errp)
return mach_list;
}
+static int machine_help_func(QemuOpts *opts, MachineState *machine)
+{
+ ObjectProperty *prop;
+
+ if (!qemu_opt_has_help_opt(opts)) {
+ return 0;
+ }
+
+ QTAILQ_FOREACH(prop, &OBJECT(machine)->properties, node) {
+ if (!prop->set) {
+ continue;
+ }
+
+ error_printf("%s.%s=%s", MACHINE_GET_CLASS(machine)->name,
+ prop->name, prop->type);
+ if (prop->description) {
+ error_printf(" (%s)\n", prop->description);
+ } else {
+ error_printf("\n");
+ }
+ }
+
+ return 1;
+}
+
/***********************************************************/
/* main execution loop */
@@ -3767,6 +3792,9 @@ int main(int argc, char **argv, char **envp)
current_machine = MACHINE(object_new(object_class_get_name(
OBJECT_CLASS(machine_class))));
+ if (machine_help_func(qemu_get_machine_opts(), current_machine)) {
+ exit(0);
+ }
object_property_add_child(object_get_root(), "machine",
OBJECT(current_machine), &error_abort);
cpu_exec_init_all();
--
1.9.3
next prev parent reply other threads:[~2014-12-10 14:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 13:19 [Qemu-devel] [PATCH 0/3] machine: dynamic options per machine type Marcel Apfelbaum
2014-12-10 13:19 ` [Qemu-devel] [PATCH 1/3] machine: remove qemu_machine_opts global list Marcel Apfelbaum
2014-12-10 22:59 ` Greg Bellows
2014-12-11 5:05 ` Marcel Apfelbaum
2014-12-11 14:57 ` Greg Bellows
2014-12-15 15:13 ` Alexander Graf
2014-12-15 15:20 ` Paolo Bonzini
2014-12-10 13:19 ` [Qemu-devel] [PATCH 2/3] vl.c: simplified machine_set_property Marcel Apfelbaum
2014-12-11 17:49 ` Greg Bellows
2014-12-10 13:19 ` Marcel Apfelbaum [this message]
2014-12-15 15:16 ` [Qemu-devel] [PATCH 3/3] vl.c: add HMP help to machine Alexander Graf
2014-12-15 15:20 ` Daniel P. Berrange
2014-12-15 19:24 ` Marcel Apfelbaum
2014-12-15 15:14 ` [Qemu-devel] [PATCH 0/3] machine: dynamic options per machine type Alexander Graf
2014-12-15 17:24 ` Peter Maydell
2014-12-15 17:33 ` Alexander Graf
2014-12-15 17:55 ` Greg Bellows
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418217570-15517-4-git-send-email-marcel.a@redhat.com \
--to=marcel.a@redhat.com \
--cc=agraf@suse.de \
--cc=greg.bellows@linaro.org \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).