From patchwork Wed Dec 10 13:19:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 419671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3853914009B for ; Thu, 11 Dec 2014 01:22:28 +1100 (AEDT) Received: from localhost ([::1]:45986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xyi9q-00050F-6Q for incoming@patchwork.ozlabs.org; Wed, 10 Dec 2014 09:22:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xyi7h-0002aE-Pw for qemu-devel@nongnu.org; Wed, 10 Dec 2014 09:20:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xyi7a-0005Wp-2f for qemu-devel@nongnu.org; Wed, 10 Dec 2014 09:20:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xyi7Z-0005Vo-Rr for qemu-devel@nongnu.org; Wed, 10 Dec 2014 09:20:06 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBAEJeoO011250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Dec 2014 09:20:01 -0500 Received: from localhost.localdomain.com (vpn1-7-58.ams2.redhat.com [10.36.7.58]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBADKNRP011622; Wed, 10 Dec 2014 08:20:30 -0500 From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Wed, 10 Dec 2014 15:19:30 +0200 Message-Id: <1418217570-15517-4-git-send-email-marcel.a@redhat.com> In-Reply-To: <1418217570-15517-1-git-send-email-marcel.a@redhat.com> References: <1418217570-15517-1-git-send-email-marcel.a@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The help is based on the actual machine properties exposing only the relevant options. Signed-off-by: Marcel Apfelbaum --- 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();