From patchwork Thu Aug 27 15:20:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 511329 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 5BF1414012C for ; Fri, 28 Aug 2015 01:21:08 +1000 (AEST) Received: from localhost ([::1]:43055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUyzB-0002wJ-Vj for incoming@patchwork.ozlabs.org; Thu, 27 Aug 2015 11:21:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUyyV-000299-57 for qemu-devel@nongnu.org; Thu, 27 Aug 2015 11:20:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUyyO-0002tD-QC for qemu-devel@nongnu.org; Thu, 27 Aug 2015 11:20:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUyyO-0002re-HB for qemu-devel@nongnu.org; Thu, 27 Aug 2015 11:20:16 -0400 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 (Postfix) with ESMTPS id A9C5E8EA4A for ; Thu, 27 Aug 2015 15:20:15 +0000 (UTC) Received: from thinkpad.redhat.com (vpn1-7-222.ams2.redhat.com [10.36.7.222]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7RFKDjc005709; Thu, 27 Aug 2015 11:20:14 -0400 From: Laurent Vivier To: Paolo Bonzini , qemu-devel@nongnu.org Date: Thu, 27 Aug 2015 17:20:13 +0200 Message-Id: <1440688813-9229-1-git-send-email-lvivier@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: armbru@redhat.com Subject: [Qemu-devel] [PATCH, RFC] Use help sub-sections to create sub-help options 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 As '-help' output is 400 lines long it is not easy to find information, but generally we know from which area we want the information. As subsections already exist in the help description, add some command options to only display the wanted subsection. As more is better, this patch adds 13 lines to the -help output: -help-standard display standard options -help-block display block options -help-usb display usb options -help-display display display options -help-machine display machine options -help-network display network options -help-character display character options -help-url display url options -help-bt display bt options -help-tpm display tpm options -help-kernel display kernel options -help-expert display expert options -help-object display object options Example: $ qemu-system-x86_64 -help-kernel Linux/Multiboot boot specific: -kernel bzImage use 'bzImage' as kernel image -append cmdline use 'cmdline' as kernel command line -initrd file use 'file' as initial ram disk -dtb file use 'file' as device tree image Signed-off-by: Laurent Vivier --- qemu-options.hx | 137 +++++++++++++++++++++++++++++++++++++++++++-- vl.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 302 insertions(+), 4 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 77f5853..091cc21 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -6,17 +6,122 @@ HXCOMM construct option structures, enums and help message for specified HXCOMM architectures. HXCOMM HXCOMM can be used for comments, discarded from both texi and C +#if !(defined(QEMU_HELP_DISABLE_STANDARD) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Standard options:) STEXI @table @option ETEXI DEF("help", 0, QEMU_OPTION_h, - "-h or -help display this help and exit\n", QEMU_ARCH_ALL) + "-h or -help display all help options and exit\n", QEMU_ARCH_ALL) STEXI @item -h @findex -h -Display help and exit +Display all help options and exit +ETEXI + +DEF("help-standard", 0, QEMU_OPTION_h_standard, + "-help-standard display standard options\n", QEMU_ARCH_ALL) +STEXI +@item -help-standard +@findex -help-standard +Display standard options +ETEXI + +DEF("help-block", 0, QEMU_OPTION_h_block, + "-help-block display block options\n", QEMU_ARCH_ALL) +STEXI +@item -help-block +@findex -help-block +Display block options +ETEXI + +DEF("help-usb", 0, QEMU_OPTION_h_usb, + "-help-usb display usb options\n", QEMU_ARCH_ALL) +STEXI +@item -help-usb +@findex -help-usb +Display usb options +ETEXI + +DEF("help-display", 0, QEMU_OPTION_h_display, + "-help-display display display options\n", QEMU_ARCH_ALL) +STEXI +@item -help-display +@findex -help-display +Display display options +ETEXI + +DEF("help-machine", 0, QEMU_OPTION_h_machine, + "-help-machine display machine options\n", QEMU_ARCH_ALL) +STEXI +@item -help-machine +@findex -help-machine +Display machine options +ETEXI + +DEF("help-network", 0, QEMU_OPTION_h_network, + "-help-network display network options\n", QEMU_ARCH_ALL) +STEXI +@item -help-network +@findex -help-network +Display network options +ETEXI + +DEF("help-character", 0, QEMU_OPTION_h_character, + "-help-character display character options\n", QEMU_ARCH_ALL) +STEXI +@item -help-character +@findex -help-character +Display character options +ETEXI + +DEF("help-url", 0, QEMU_OPTION_h_url, + "-help-url display url options\n", QEMU_ARCH_ALL) +STEXI +@item -help-url +@findex -help-url +Display url options +ETEXI + +DEF("help-bt", 0, QEMU_OPTION_h_bt, + "-help-bt display bt options\n", QEMU_ARCH_ALL) +STEXI +@item -help-bt +@findex -help-bt +Display bt options +ETEXI + +DEF("help-tpm", 0, QEMU_OPTION_h_tpm, + "-help-tpm display tpm options\n", QEMU_ARCH_ALL) +STEXI +@item -help-tpm +@findex -help-tpm +Display tpm options +ETEXI + +DEF("help-kernel", 0, QEMU_OPTION_h_kernel, + "-help-kernel display kernel options\n", QEMU_ARCH_ALL) +STEXI +@item -help-kernel +@findex -help-kernel +Display kernel options +ETEXI + +DEF("help-expert", 0, QEMU_OPTION_h_expert, + "-help-expert display expert options\n", QEMU_ARCH_ALL) +STEXI +@item -help-expert +@findex -help-expert +Display expert options +ETEXI + +DEF("help-object", 0, QEMU_OPTION_h_object, + "-help-object display object options\n", QEMU_ARCH_ALL) +STEXI +@item -help-object +@findex -help-object +Display object options ETEXI DEF("version", 0, QEMU_OPTION_version, @@ -410,7 +515,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_BLOCK) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Block device options:) STEXI @table @option @@ -798,7 +905,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_USB) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(USB options:) STEXI @table @option @@ -862,7 +971,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_DISPLAY) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Display options:) STEXI @table @option @@ -1329,7 +1440,9 @@ STEXI @end table ETEXI ARCHHEADING(, QEMU_ARCH_I386) +#endif +#if !(defined(QEMU_HELP_DISABLE_MACHINE) && defined(QEMU_OPTIONS_GENERATE_HELP)) ARCHHEADING(i386 target only:, QEMU_ARCH_I386) STEXI @table @option @@ -1441,7 +1554,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_NETWORK) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Network options:) STEXI @table @option @@ -1995,7 +2110,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_CHARACTER) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Character device options:) STEXI @@ -2273,7 +2390,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_URL) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Device URL Syntax:) STEXI @@ -2482,7 +2601,9 @@ ETEXI STEXI @end table ETEXI +#endif +#if !(defined(QEMU_HELP_DISABLE_BT) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Bluetooth(R) options:) STEXI @table @option @@ -2557,7 +2678,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_TPM) && defined(QEMU_OPTIONS_GENERATE_HELP)) #ifdef CONFIG_TPM DEFHEADING(TPM device options:) @@ -2632,7 +2755,9 @@ ETEXI DEFHEADING() #endif +#endif +#if !(defined(QEMU_HELP_DISABLE_KERNEL) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Linux/Multiboot boot specific:) STEXI @@ -2688,7 +2813,9 @@ STEXI @end table ETEXI DEFHEADING() +#endif +#if !(defined(QEMU_HELP_DISABLE_EXPERT) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Debug/Expert options:) STEXI @table @option @@ -3510,7 +3637,7 @@ DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate, " Output vmstate information in JSON format to file.\n" " Use the scripts/vmstate-static-checker.py file to\n" " check for possible regressions in migration code\n" - " by comparing two such vmstate dumps.", + " by comparing two such vmstate dumps.\n", QEMU_ARCH_ALL) STEXI @item -dump-vmstate @var{file} @@ -3518,7 +3645,9 @@ STEXI Dump json-encoded vmstate information for current machine type to file in @var{file} ETEXI +#endif +#if !(defined(QEMU_HELP_DISABLE_OBJECT) && defined(QEMU_OPTIONS_GENERATE_HELP)) DEFHEADING(Generic object creation) DEF("object", HAS_ARG, QEMU_OPTION_object, @@ -3571,7 +3700,7 @@ to the RNG daemon. @end table ETEXI - +#endif HXCOMM This is the last statement. Insert new options before this line! STEXI diff --git a/vl.c b/vl.c index 584ca88..65a815f 100644 --- a/vl.c +++ b/vl.c @@ -1931,6 +1931,136 @@ static void help(int exitcode) exit(exitcode); } +#define QEMU_HELP_DISABLE_BLOCK +#define QEMU_HELP_DISABLE_USB +#define QEMU_HELP_DISABLE_DISPLAY +#define QEMU_HELP_DISABLE_MACHINE +#define QEMU_HELP_DISABLE_NETWORK +#define QEMU_HELP_DISABLE_CHARACTER +#define QEMU_HELP_DISABLE_URL +#define QEMU_HELP_DISABLE_BT +#define QEMU_HELP_DISABLE_TPM +#define QEMU_HELP_DISABLE_KERNEL +#define QEMU_HELP_DISABLE_EXPERT +#define QEMU_HELP_DISABLE_OBJECT + +static void help_standard(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} + +#define QEMU_HELP_DISABLE_STANDARD +#undef QEMU_HELP_DISABLE_BLOCK +static void help_block(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_BLOCK +#undef QEMU_HELP_DISABLE_USB +static void help_usb(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_USB +#undef QEMU_HELP_DISABLE_DISPLAY +static void help_display(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_DISPLAY +#undef QEMU_HELP_DISABLE_MACHINE +static void help_machine(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_MACHINE +#undef QEMU_HELP_DISABLE_NETWORK +static void help_network(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_NETWORK +#undef QEMU_HELP_DISABLE_CHARACTER +static void help_character(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_CHARACTER +#undef QEMU_HELP_DISABLE_URL +static void help_url(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_URL +#undef QEMU_HELP_DISABLE_BT +static void help_bt(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_BT +#undef QEMU_HELP_DISABLE_TPM +static void help_tpm(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_TPM +#undef QEMU_HELP_DISABLE_KERNEL +static void help_kernel(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_KERNEL +#undef QEMU_HELP_DISABLE_EXPERT +static void help_expert(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#define QEMU_HELP_DISABLE_EXPERT +#undef QEMU_HELP_DISABLE_OBJECT +static void help_object(int exitcode) +{ +#define QEMU_OPTIONS_GENERATE_HELP +#include "qemu-options-wrapper.h" + exit(exitcode); +} +#undef QEMU_HELP_DISABLE_STANDARD +#undef QEMU_HELP_DISABLE_BLOCK +#undef QEMU_HELP_DISABLE_USB +#undef QEMU_HELP_DISABLE_DISPLAY +#undef QEMU_HELP_DISABLE_NETWORK +#undef QEMU_HELP_DISABLE_CHARACTER +#undef QEMU_HELP_DISABLE_URL +#undef QEMU_HELP_DISABLE_BT +#undef QEMU_HELP_DISABLE_TPM +#undef QEMU_HELP_DISABLE_KERNEL +#undef QEMU_HELP_DISABLE_EXPERT +#undef QEMU_HELP_DISABLE_OBJECT + + #define HAS_ARG 0x0001 typedef struct QEMUOption { @@ -3318,6 +3448,42 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_h: help(0); break; + case QEMU_OPTION_h_standard: + help_standard(0); + break; + case QEMU_OPTION_h_block: + help_block(0); + break; + case QEMU_OPTION_h_usb: + help_usb(0); + break; + case QEMU_OPTION_h_display: + help_display(0); + break; + case QEMU_OPTION_h_machine: + help_machine(0); + break; + case QEMU_OPTION_h_network: + help_network(0); + break; + case QEMU_OPTION_h_character: + help_character(0); + break; + case QEMU_OPTION_h_url: + help_url(0); + break; + case QEMU_OPTION_h_bt: + help_bt(0); + break; + case QEMU_OPTION_h_kernel: + help_kernel(0); + break; + case QEMU_OPTION_h_expert: + help_expert(0); + break; + case QEMU_OPTION_h_object: + help_object(0); + break; case QEMU_OPTION_version: version(); exit(0); @@ -3330,6 +3496,9 @@ int main(int argc, char **argv, char **envp) } break; #ifdef CONFIG_TPM + case QEMU_OPTION_h_tpm: + help_tpm(0); + break; case QEMU_OPTION_tpmdev: if (tpm_config_parse(qemu_find_opts("tpmdev"), optarg) < 0) { exit(1);