From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3Pv8-0003zf-QP for qemu-devel@nongnu.org; Tue, 23 Dec 2014 08:54:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y3Pv2-00018h-Sk for qemu-devel@nongnu.org; Tue, 23 Dec 2014 08:54:42 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3Pv2-00014v-Kx for qemu-devel@nongnu.org; Tue, 23 Dec 2014 08:54:36 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Y3Puu-00043E-15 for qemu-devel@nongnu.org; Tue, 23 Dec 2014 13:54:28 +0000 From: Peter Maydell Date: Tue, 23 Dec 2014 13:54:01 +0000 Message-Id: <1419342867-15527-6-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1419342867-15527-1-git-send-email-peter.maydell@linaro.org> References: <1419342867-15527-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 05/31] vl.c: add HMP help to machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Marcel Apfelbaum The help is based on the actual machine properties exposing only the relevant options. Signed-off-by: Marcel Apfelbaum Reviewed-by: Alexander Graf Reviewed-by: Greg Bellows Message-id: 1418217570-15517-4-git-send-email-marcel.a@redhat.com Signed-off-by: Peter Maydell --- vl.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/vl.c b/vl.c index fa7a02c..bea9656 100644 --- a/vl.c +++ b/vl.c @@ -1423,6 +1423,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 */ @@ -3758,6 +3783,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.1