From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710157148936410.3941697388592; Mon, 11 Mar 2024 04:39:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E730A1F72; Mon, 11 Mar 2024 07:39:07 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3EB6E1E9B; Mon, 11 Mar 2024 07:32:02 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 60A5B1C16; Mon, 11 Mar 2024 07:31:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AE2E11CEC for ; Mon, 11 Mar 2024 07:31:06 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-CpNZeT52NQmBl6m52uVsdA-1; Mon, 11 Mar 2024 07:31:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43E9B1C0513D for ; Mon, 11 Mar 2024 11:31:03 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id B187E112132A for ; Mon, 11 Mar 2024 11:31:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: CpNZeT52NQmBl6m52uVsdA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 01/23] vsh: Always assume that command groups are used Date: Mon, 11 Mar 2024 12:30:38 +0100 Message-ID: <70b642c6fb43a9da4d105723e7be74223668da6f.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: PRGI2MPWQBCM3W2GHD3DDUZOFEAOPBIP X-Message-ID-Hash: PRGI2MPWQBCM3W2GHD3DDUZOFEAOPBIP X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157150758100001 None of the clients use the 'command set' approach and other pieces of code such as the command validator already assume that command groups are in use. Remove the unused 'command set' stuff. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh.c | 2 +- tools/virt-admin.c | 2 +- tools/vsh.c | 38 +++++++------------------------------- tools/vsh.h | 2 +- 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 95ff63baeb..18cd279aba 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -878,7 +878,7 @@ main(int argc, char **argv) virFileActivateDirOverrideForProg(argv[0]); - if (!vshInit(ctl, cmdGroups, NULL)) + if (!vshInit(ctl, cmdGroups)) exit(EXIT_FAILURE); if (!virshParseArgv(ctl, argc, argv) || diff --git a/tools/virt-admin.c b/tools/virt-admin.c index aaf6edb9a9..f551b33c4b 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1594,7 +1594,7 @@ main(int argc, char **argv) virFileActivateDirOverrideForProg(argv[0]); - if (!vshInit(ctl, cmdGroups, NULL)) + if (!vshInit(ctl, cmdGroups)) exit(EXIT_FAILURE); if (!vshAdmParseArgv(ctl, argc, argv) || diff --git a/tools/vsh.c b/tools/vsh.c index 65deaa77e8..0c41e9cfe8 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -56,7 +56,6 @@ vshControl *autoCompleteOpaque; * and only relies on static data accessible from the user-side callback */ const vshCmdGrp *cmdGroups; -const vshCmdDef *cmdSet; double @@ -572,8 +571,8 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd,= uint64_t opts_required, return -1; } -static const vshCmdDef * -vshCmdDefSearchGrp(const char *cmdname) +const vshCmdDef * +vshCmddefSearch(const char *cmdname) { const vshCmdGrp *g; const vshCmdDef *c; @@ -588,28 +587,6 @@ vshCmdDefSearchGrp(const char *cmdname) return NULL; } -static const vshCmdDef * -vshCmdDefSearchSet(const char *cmdname) -{ - const vshCmdDef *s; - - for (s =3D cmdSet; s->name; s++) { - if (STREQ(s->name, cmdname)) - return s; - } - - return NULL; -} - -const vshCmdDef * -vshCmddefSearch(const char *cmdname) -{ - if (cmdGroups) - return vshCmdDefSearchGrp(cmdname); - else - return vshCmdDefSearchSet(cmdname); -} - const vshCmdGrp * vshCmdGrpSearch(const char *grpname) { @@ -3012,20 +2989,19 @@ vshInitDebug(vshControl *ctl) * Initialize global data */ bool -vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set) +vshInit(vshControl *ctl, const vshCmdGrp *groups) { if (!ctl->hooks) { vshError(ctl, "%s", _("client hooks cannot be NULL")); return false; } - if (!groups && !set) { - vshError(ctl, "%s", _("command groups and command set cannot both = be NULL")); + if (!groups) { + vshError(ctl, "%s", _("command groups must be non-NULL")); return false; } cmdGroups =3D groups; - cmdSet =3D set; if (vshInitDebug(ctl) < 0 || (ctl->imode && vshReadlineInit(ctl) < 0)) @@ -3037,8 +3013,8 @@ vshInit(vshControl *ctl, const vshCmdGrp *groups, con= st vshCmdDef *set) bool vshInitReload(vshControl *ctl) { - if (!cmdGroups && !cmdSet) { - vshError(ctl, "%s", _("command groups and command are both NULL ru= n vshInit before reloading")); + if (!cmdGroups) { + vshError(ctl, "%s", _("command groups is NULL run vshInit before r= eloading")); return false; } diff --git a/tools/vsh.h b/tools/vsh.h index 2a1be29b1c..17d7f08dc9 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -310,7 +310,7 @@ void vshPrint(vshControl *ctl, const char *format, ...) G_GNUC_PRINTF(2, 3); void vshPrintExtra(vshControl *ctl, const char *format, ...) G_GNUC_PRINTF(2, 3); -bool vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *se= t); +bool vshInit(vshControl *ctl, const vshCmdGrp *groups); bool vshInitReload(vshControl *ctl); void vshDeinit(vshControl *ctl); void vshDebug(vshControl *ctl, int level, const char *format, ...) --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17101570007481000.4124742004586; Mon, 11 Mar 2024 04:36:40 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id ABBB61F18; Mon, 11 Mar 2024 07:36:39 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 20E6D1E83; Mon, 11 Mar 2024 07:31:36 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id BE39B1A6E; Mon, 11 Mar 2024 07:31:06 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 095731A6E for ; Mon, 11 Mar 2024 07:31:06 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-K5Rfyj-5OxyxKooousHWsg-1; Mon, 11 Mar 2024 07:31:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AF4729AB3E1 for ; Mon, 11 Mar 2024 11:31:04 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98C19112131D for ; Mon, 11 Mar 2024 11:31:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: K5Rfyj-5OxyxKooousHWsg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 02/23] vsh: Don't translate error messages for 'self-test' Date: Mon, 11 Mar 2024 12:30:39 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: K7WUYLEK6OVNYRLWDNKKARUK3YTDDMFE X-Message-ID-Hash: K7WUYLEK6OVNYRLWDNKKARUK3YTDDMFE X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157002030100001 The command invoking the code is internal and meant for developers, there's no point in translating the errors. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 0c41e9cfe8..61e302f9c8 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -255,7 +255,8 @@ vshCmddefGetInfo(const vshCmdDef * cmd, const char *nam= e) return NULL; } -/* Check if the internal command definitions are correct */ +/* Check if the internal command definitions are correct. + * None of the errors are to be marked as translatable. */ static int vshCmddefCheckInternals(vshControl *ctl, const vshCmdDef *cmd, @@ -271,39 +272,39 @@ vshCmddefCheckInternals(vshControl *ctl, const vshCmdDef *alias; if (!cmd->alias) { - vshError(ctl, _("command '%1$s' has inconsistent alias"), cmd-= >name); + vshError(ctl, "command '%s' has inconsistent alias", cmd->name= ); return -1; } if (!(alias =3D vshCmddefSearch(cmd->alias))) { - vshError(ctl, _("command alias '%1$s' is pointing to a non-exi= stent command '%2$s'"), + vshError(ctl, "command alias '%s' is pointing to a non-existen= t command '%s'", cmd->name, cmd->alias); return -1; } if (alias->flags & VSH_CMD_FLAG_ALIAS) { - vshError(ctl, _("command alias '%1$s' is pointing to another c= ommand alias '%2$s'"), + vshError(ctl, "command alias '%s' is pointing to another comma= nd alias '%s'", cmd->name, cmd->alias); return -1; } if (cmd->handler) { - vshError(ctl, _("command '%1$s' has handler set"), cmd->name); + vshError(ctl, "command '%s' has handler set", cmd->name); return -1; } if (cmd->opts) { - vshError(ctl, _("command '%1$s' has options set"), cmd->name); + vshError(ctl, "command '%s' has options set", cmd->name); return -1; } if (cmd->info) { - vshError(ctl, _("command '%1$s' has info set"), cmd->name); + vshError(ctl, "command '%s' has info set", cmd->name); return -1; } if (cmd->flags & ~VSH_CMD_FLAG_ALIAS) { - vshError(ctl, _("command '%1$s' has multiple flags set"), cmd-= >name); + vshError(ctl, "command '%s' has multiple flags set", cmd->name= ); return -1; } @@ -313,7 +314,7 @@ vshCmddefCheckInternals(vshControl *ctl, /* Each command has to provide a non-empty help string. */ if (!(help =3D vshCmddefGetInfo(cmd, "help")) || !*help) { - vshError(ctl, _("command '%1$s' lacks help"), cmd->name); + vshError(ctl, "command '%s' lacks help", cmd->name); return -1; } @@ -324,7 +325,7 @@ vshCmddefCheckInternals(vshControl *ctl, const vshCmdOptDef *opt =3D &cmd->opts[i]; if (i > 63) { - vshError(ctl, _("command '%1$s' has too many options"), cmd->n= ame); + vshError(ctl, "command '%s' has too many options", cmd->name); return -1; /* too many options */ } @@ -336,7 +337,7 @@ vshCmddefCheckInternals(vshControl *ctl, switch (opt->type) { case VSH_OT_BOOL: if (opt->completer || opt->completer_flags) { - vshError(ctl, _("bool parameter '%1$s' of command '%2$s' h= as completer set"), + vshError(ctl, "bool parameter '%s' of command '%s' has com= pleter set", opt->name, cmd->name); return -1; } @@ -345,7 +346,7 @@ vshCmddefCheckInternals(vshControl *ctl, case VSH_OT_STRING: if (opt->flags & VSH_OFLAG_REQ) { - vshError(ctl, _("parameter '%1$s' of command '%2$s' misuse= d VSH_OFLAG_REQ"), + vshError(ctl, "parameter '%s' of command '%s' misused VSH_= OFLAG_REQ", opt->name, cmd->name); return -1; /* neither bool nor string options can be manda= tory */ } @@ -359,9 +360,9 @@ vshCmddefCheckInternals(vshControl *ctl, char *p; if (opt->flags || !opt->help) { - vshError(ctl, _("parameter '%1$s' of command '%2$s' has in= correct alias option"), + vshError(ctl, "parameter '%s' of command '%s' has incorrec= t alias option", opt->name, cmd->name); - return -1; /* alias options are tracked by the original na= me */ + return -1; } if ((p =3D strchr(opt->help, '=3D'))) name =3D g_strndup(opt->help, p - opt->help); @@ -375,46 +376,46 @@ vshCmddefCheckInternals(vshControl *ctl, if (p) { /* If alias comes with value, replacement must not be bool= */ if (cmd->opts[j].type =3D=3D VSH_OT_BOOL) { - vshError(ctl, _("alias '%1$s' of command '%2$s' has mi= smatched alias type"), + vshError(ctl, "alias '%s' of command '%s' has mismatch= ed alias type", opt->name, cmd->name); return -1; } } if (!cmd->opts[j].name) { - vshError(ctl, _("alias '%1$s' of command '%2$s' has missin= g alias option"), + vshError(ctl, "alias '%s' of command '%s' has missing alia= s option", opt->name, cmd->name); - return -1; /* alias option must map to a later option name= */ + return -1; } } break; case VSH_OT_ARGV: if (cmd->opts[i + 1].name) { - vshError(ctl, _("parameter '%1$s' of command '%2$s' must b= e listed last"), + vshError(ctl, "parameter '%s' of command '%s' must be list= ed last", opt->name, cmd->name); - return -1; /* argv option must be listed last */ + return -1; } break; case VSH_OT_DATA: if (!(opt->flags & VSH_OFLAG_REQ)) { - vshError(ctl, _("parameter '%1$s' of command '%2$s' must u= se VSH_OFLAG_REQ flag"), + vshError(ctl, "parameter '%s' of command '%s' must use VSH= _OFLAG_REQ flag", opt->name, cmd->name); - return -1; /* OT_DATA should always be required. */ + return -1; } if (seenOptionalOption) { - vshError(ctl, _("parameter '%1$s' of command '%2$s' must b= e listed before optional parameters"), + vshError(ctl, "parameter '%s' of command '%s' must be list= ed before optional parameters", opt->name, cmd->name); - return -1; /* mandatory options must be listed first */ + return -1; } break; case VSH_OT_INT: if (opt->flags & VSH_OFLAG_REQ) { if (seenOptionalOption) { - vshError(ctl, _("parameter '%1$s' of command '%2$s' mu= st be listed before optional parameters"), + vshError(ctl, "parameter '%s' of command '%s' must be = listed before optional parameters", opt->name, cmd->name); - return -1; /* mandatory options must be listed first = */ + return -1; } } else { seenOptionalOption =3D true; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710157316058449.7018538093348; Mon, 11 Mar 2024 04:41:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D545E1ECE; Mon, 11 Mar 2024 07:41:54 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 360591EA3; Mon, 11 Mar 2024 07:32:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D8EE21CEC; Mon, 11 Mar 2024 07:31:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 696D819C0 for ; Mon, 11 Mar 2024 07:31:07 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-400-dEeyrfCdOiCReRyOp2AA8Q-1; Mon, 11 Mar 2024 07:31:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 126CA800262 for ; Mon, 11 Mar 2024 11:31:05 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FAB9112132A for ; Mon, 11 Mar 2024 11:31:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: dEeyrfCdOiCReRyOp2AA8Q-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 03/23] vsh: Add VSH_OT_NONE option type to catch programming errors Date: Mon, 11 Mar 2024 12:30:40 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: WAHI64NXT3W3QUYZ4ROZA4C7OVPRHPRA X-Message-ID-Hash: WAHI64NXT3W3QUYZ4ROZA4C7OVPRHPRA X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157317263100003 Add a check that the default 0 assignment will not mean that an option is considered to be VSH_OT_BOOL. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 7 +++++++ tools/vsh.h | 1 + 2 files changed, 8 insertions(+) diff --git a/tools/vsh.c b/tools/vsh.c index 61e302f9c8..a3491695b9 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -335,6 +335,11 @@ vshCmddefCheckInternals(vshControl *ctl, virBufferStrcat(&complbuf, opt->name, ", ", NULL); switch (opt->type) { + case VSH_OT_NONE: + vshError(ctl, "invalid type 'NONE' of option '%s' of command '= %s'", + opt->name, cmd->name); + return -1; + case VSH_OT_BOOL: if (opt->completer || opt->completer_flags) { vshError(ctl, "bool parameter '%s' of command '%s' has com= pleter set", @@ -671,6 +676,7 @@ vshCmddefHelp(const vshCmdDef *def) } break; case VSH_OT_ALIAS: + case VSH_OT_NONE: /* aliases are intentionally undocumented */ continue; } @@ -713,6 +719,7 @@ vshCmddefHelp(const vshCmdDef *def) opt->name); break; case VSH_OT_ALIAS: + case VSH_OT_NONE: continue; } diff --git a/tools/vsh.h b/tools/vsh.h index 17d7f08dc9..2cc0a62d3f 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -85,6 +85,7 @@ typedef enum { * vshCmdOptType - command option type */ typedef enum { + VSH_OT_NONE =3D 0, /* cannary to catch programming errors */ VSH_OT_BOOL, /* optional boolean option */ VSH_OT_STRING, /* optional string option */ VSH_OT_INT, /* optional or mandatory int option */ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710157665627527.2561610401542; Mon, 11 Mar 2024 04:47:45 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8DD581EBA; Mon, 11 Mar 2024 07:47:44 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id F249C1DCC; Mon, 11 Mar 2024 07:33:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 65EB119C0; Mon, 11 Mar 2024 07:31:11 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DCA651A6E for ; Mon, 11 Mar 2024 07:31:09 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-L3C0LhzvNACJij33RMKFGA-1; Mon, 11 Mar 2024 07:31:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC8D1800266 for ; Mon, 11 Mar 2024 11:31:05 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66B47112131D for ; Mon, 11 Mar 2024 11:31:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: L3C0LhzvNACJij33RMKFGA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 04/23] vsh: Remove VSH_CMD_FLAG_ALIAS Date: Mon, 11 Mar 2024 12:30:41 +0100 Message-ID: <454baf8923785f1e222b08560949ba916b1e33d9.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: DN5LXMWKZB47FDOZEFZCOI4ZPLZ4G3E3 X-Message-ID-Hash: DN5LXMWKZB47FDOZEFZCOI4ZPLZ4G3E3 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157666823100001 It's obvious that a command is an alias when the 'alias' property is set, thus an extra flag is redundant. Remove it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-nodedev.c | 1 - tools/virsh.c | 2 +- tools/virt-admin.c | 9 +-------- tools/vsh.c | 21 ++++++++------------- tools/vsh.h | 3 +-- 5 files changed, 11 insertions(+), 25 deletions(-) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index c08de65a96..b5a88b194f 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -1415,7 +1415,6 @@ const vshCmdDef nodedevCmds[] =3D { .flags =3D 0 }, {.name =3D "nodedev-dettach", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "nodedev-detach" }, {.name =3D "nodedev-dumpxml", diff --git a/tools/virsh.c b/tools/virsh.c index 18cd279aba..0d860d0390 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -460,7 +460,7 @@ virshUsage(void) fprintf(stdout, _(" %1$s (help keyword '%2$s')\n"), grp->name, grp->keyword); for (cmd =3D grp->commands; cmd->name; cmd++) { - if (cmd->flags & VSH_CMD_FLAG_ALIAS || + if (cmd->alias || cmd->flags & VSH_CMD_FLAG_HIDDEN) continue; fprintf(stdout, diff --git a/tools/virt-admin.c b/tools/virt-admin.c index f551b33c4b..27bd123bfe 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1262,7 +1262,7 @@ vshAdmUsage(void) fprintf(stdout, _(" %1$s (help keyword '%2$s')\n"), grp->name, grp->keyword); for (cmd =3D grp->commands; cmd->name; cmd++) { - if (cmd->flags & VSH_CMD_FLAG_ALIAS || + if (cmd->alias || cmd->flags & VSH_CMD_FLAG_HIDDEN) continue; fprintf(stdout, @@ -1429,7 +1429,6 @@ static const vshCmdDef vshAdmCmds[] =3D { static const vshCmdDef monitoringCmds[] =3D { {.name =3D "srv-list", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "server-list" }, {.name =3D "server-list", @@ -1439,7 +1438,6 @@ static const vshCmdDef monitoringCmds[] =3D { .flags =3D 0 }, {.name =3D "srv-threadpool-info", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "server-threadpool-info" }, {.name =3D "server-threadpool-info", @@ -1449,7 +1447,6 @@ static const vshCmdDef monitoringCmds[] =3D { .flags =3D 0 }, {.name =3D "srv-clients-list", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "client-list" }, {.name =3D "client-list", @@ -1465,7 +1462,6 @@ static const vshCmdDef monitoringCmds[] =3D { .flags =3D 0 }, {.name =3D "srv-clients-info", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "server-clients-info" }, {.name =3D "server-clients-info", @@ -1479,7 +1475,6 @@ static const vshCmdDef monitoringCmds[] =3D { static const vshCmdDef managementCmds[] =3D { {.name =3D "srv-threadpool-set", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "server-threadpool-set" }, {.name =3D "server-threadpool-set", @@ -1495,7 +1490,6 @@ static const vshCmdDef managementCmds[] =3D { .flags =3D 0 }, {.name =3D "srv-clients-set", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "server-clients-set" }, {.name =3D "server-clients-set", @@ -1505,7 +1499,6 @@ static const vshCmdDef managementCmds[] =3D { .flags =3D 0 }, {.name =3D "srv-update-tls", - .flags =3D VSH_CMD_FLAG_ALIAS, .alias =3D "server-update-tls" }, {.name =3D "server-update-tls", diff --git a/tools/vsh.c b/tools/vsh.c index a3491695b9..08a08bb227 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -268,21 +268,16 @@ vshCmddefCheckInternals(vshControl *ctl, g_auto(virBuffer) complbuf =3D VIR_BUFFER_INITIALIZER; /* in order to perform the validation resolve the alias first */ - if (cmd->flags & VSH_CMD_FLAG_ALIAS) { + if (cmd->alias) { const vshCmdDef *alias; - if (!cmd->alias) { - vshError(ctl, "command '%s' has inconsistent alias", cmd->name= ); - return -1; - } - if (!(alias =3D vshCmddefSearch(cmd->alias))) { vshError(ctl, "command alias '%s' is pointing to a non-existen= t command '%s'", cmd->name, cmd->alias); return -1; } - if (alias->flags & VSH_CMD_FLAG_ALIAS) { + if (alias->alias) { vshError(ctl, "command alias '%s' is pointing to another comma= nd alias '%s'", cmd->name, cmd->alias); return -1; @@ -303,7 +298,7 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } - if (cmd->flags & ~VSH_CMD_FLAG_ALIAS) { + if (cmd->flags !=3D 0) { vshError(ctl, "command '%s' has multiple flags set", cmd->name= ); return -1; } @@ -615,7 +610,7 @@ vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp) grp->keyword); for (cmd =3D grp->commands; cmd->name; cmd++) { - if (cmd->flags & VSH_CMD_FLAG_ALIAS || + if (cmd->alias || cmd->flags & VSH_CMD_FLAG_HIDDEN) continue; vshPrint(ctl, " %-30s %s\n", cmd->name, @@ -1407,7 +1402,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) } /* aliases need to be resolved to the actual commands */ - if (cmd->flags & VSH_CMD_FLAG_ALIAS) { + if (cmd->alias) { VIR_FREE(tkdata); tkdata =3D g_strdup(cmd->alias); cmd =3D vshCmddefSearch(tkdata); @@ -2594,7 +2589,7 @@ vshReadlineCommandGenerator(void) for (cmd_list_index =3D 0; cmds[cmd_list_index].name; cmd_list_ind= ex++) { const char *name =3D cmds[cmd_list_index].name; - if (cmds[cmd_list_index].flags & VSH_CMD_FLAG_ALIAS || + if (cmds[cmd_list_index].alias || cmds[cmd_list_index].flags & VSH_CMD_FLAG_HIDDEN) continue; @@ -3095,7 +3090,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) grp->keyword); for (def =3D grp->commands; def->name; def++) { - if (def->flags & VSH_CMD_FLAG_ALIAS || + if (def->alias || def->flags & VSH_CMD_FLAG_HIDDEN) continue; vshPrint(ctl, " %-30s %s\n", def->name, @@ -3109,7 +3104,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) } if ((def =3D vshCmddefSearch(name))) { - if (def->flags & VSH_CMD_FLAG_ALIAS) + if (def->alias) def =3D vshCmddefSearch(def->alias); return vshCmddefHelp(def); } else if ((grp =3D vshCmdGrpSearch(name))) { diff --git a/tools/vsh.h b/tools/vsh.h index 2cc0a62d3f..a191b50c2d 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -162,8 +162,7 @@ struct _vshCmdOpt { */ enum { VSH_CMD_FLAG_NOCONNECT =3D (1 << 0), /* no prior connection needed */ - VSH_CMD_FLAG_ALIAS =3D (1 << 1), /* command is an alias */ - VSH_CMD_FLAG_HIDDEN =3D (1 << 2), /* command is hidden/internal */ + VSH_CMD_FLAG_HIDDEN =3D (1 << 1), /* command is hidden/internal */ }; /* --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710157415124919.953722179568; Mon, 11 Mar 2024 04:43:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 162F71F38; Mon, 11 Mar 2024 07:43:34 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6576C1EA9; Mon, 11 Mar 2024 07:32:45 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1BB111C16; Mon, 11 Mar 2024 07:31:09 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A7E951A6E for ; Mon, 11 Mar 2024 07:31:08 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-557--WdhmzORN2W7QLtTdbsMVw-1; Mon, 11 Mar 2024 07:31:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5382185A789 for ; Mon, 11 Mar 2024 11:31:06 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D5941121306 for ; Mon, 11 Mar 2024 11:31:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: -WdhmzORN2W7QLtTdbsMVw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 05/23] vshCmddefCheckInternals: Fix listing of missing completers for 'VSH_OT_ARGV' Date: Mon, 11 Mar 2024 12:30:42 +0100 Message-ID: <2a10eb98b7423ac66d9114459d61d5a2959991d8.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: FIDACVJFYIMRR5DHFJW2BZKMAEKEOSJW X-Message-ID-Hash: FIDACVJFYIMRR5DHFJW2BZKMAEKEOSJW X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157415777100001 Use a switch statement to cover all cases and check for missing completers for arguments declared as VSH_OT_ARGV. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 08a08bb227..6e558e56df 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -324,10 +324,24 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; /* too many options */ } - if (missingCompleters && - (opt->type =3D=3D VSH_OT_STRING || opt->type =3D=3D VSH_OT_DAT= A) && - !opt->completer) - virBufferStrcat(&complbuf, opt->name, ", ", NULL); + if (missingCompleters && !opt->completer) { + switch (opt->type) { + case VSH_OT_STRING: + case VSH_OT_DATA: + case VSH_OT_ARGV: + virBufferStrcat(&complbuf, opt->name, ", ", NULL); + break; + + case VSH_OT_BOOL: + /* only name is completed */ + case VSH_OT_INT: + /* no point in completing numbers */ + case VSH_OT_ALIAS: + /* alias is handled in the referenced command */ + case VSH_OT_NONE: + break; + } + } switch (opt->type) { case VSH_OT_NONE: --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710157527619820.3881284460394; Mon, 11 Mar 2024 04:45:27 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5E7B31F7E; Mon, 11 Mar 2024 07:45:26 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A42D11DD5; Mon, 11 Mar 2024 07:32:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AB7271D01; Mon, 11 Mar 2024 07:31:10 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 9E68919C0 for ; Mon, 11 Mar 2024 07:31:09 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-532-kF241-pTMRavF4Dcv-LabA-1; Mon, 11 Mar 2024 07:31:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE101101CC67 for ; Mon, 11 Mar 2024 11:31:07 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36966111DCF3 for ; Mon, 11 Mar 2024 11:31:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: kF241-pTMRavF4Dcv-LabA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 06/23] virsh: Remove uncommon redundant descriptions of virsh commands Date: Mon, 11 Mar 2024 12:30:43 +0100 Message-ID: <0c3cca3ef47c2f73651683ec13f4417fef404d0a.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: ARRJ7UDDOWLVFDE62JWZZH4VM3TEOQ5D X-Message-ID-Hash: ARRJ7UDDOWLVFDE62JWZZH4VM3TEOQ5D X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157528414100001 Some description of virsh commands referenced itself in a multi-line example of usage, which is pointless as virsh help already shows how to use the command: .data =3D N_("Get or set the current memory parameters for a guest" " domain.\n" " To get the memory parameters use following command: \n= \n" " virsh # memtune ") Change it to just state what the command does and leave the example for the help printer. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 20 ++++---------------- tools/virsh-host.c | 4 +--- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index d3e28f38f4..a90aefeb32 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1528,10 +1528,7 @@ static const vshCmdInfo info_blkiotune[] =3D { .data =3D N_("Get or set blkio parameters") }, {.name =3D "desc", - .data =3D N_("Get or set the current blkio parameters for a guest" - " domain.\n" - " To get the blkio parameters use following command: \n= \n" - " virsh # blkiotune ") + .data =3D N_("Get or set the current blkio parameters for a guest dom= ain.") }, {.name =3D NULL} }; @@ -9257,10 +9254,7 @@ static const vshCmdInfo info_memtune[] =3D { .data =3D N_("Get or set memory parameters") }, {.name =3D "desc", - .data =3D N_("Get or set the current memory parameters for a guest" - " domain.\n" - " To get the memory parameters use following command: \= n\n" - " virsh # memtune ") + .data =3D N_("Get or set the current memory parameters for a guest do= main.") }, {.name =3D NULL} }; @@ -9432,10 +9426,7 @@ static const vshCmdInfo info_perf[] =3D { .data =3D N_("Get or set perf event") }, {.name =3D "desc", - .data =3D N_("Get or set the current perf events for a guest" - " domain.\n" - " To get the perf events list use following command:= \n\n" - " virsh # perf ") + .data =3D N_("Get or set the current perf events for a guest domai= n.") }, {.name =3D NULL} }; @@ -9564,10 +9555,7 @@ static const vshCmdInfo info_numatune[] =3D { .data =3D N_("Get or set numa parameters") }, {.name =3D "desc", - .data =3D N_("Get or set the current numa parameters for a guest" - " domain.\n" - " To get the numa parameters use following command: \n\= n" - " virsh # numatune ") + .data =3D N_("Get or set the current numa parameters for a guest doma= in.") }, {.name =3D NULL} }; diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 90ff46c5c4..87443220bd 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1505,9 +1505,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_= UNUSED) static const vshCmdInfo info_node_memory_tune[] =3D { {"help", N_("Get or set node memory parameters")}, - {"desc", N_("Get or set node memory parameters\n" - " To get the memory parameters, use following command: = \n\n" - " virsh # node-memory-tune")}, + {"desc", N_("Get or set node memory parameters")}, {NULL, NULL} }; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171015783809478.48786043221617; Mon, 11 Mar 2024 04:50:38 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F1ED31919; Mon, 11 Mar 2024 07:50:36 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8CE011EDD; Mon, 11 Mar 2024 07:33:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6A3DD1A6E; Mon, 11 Mar 2024 07:31:11 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 621631CEC for ; Mon, 11 Mar 2024 07:31:10 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-uMUA_NKjNJuCdQbF5py_9g-1; Mon, 11 Mar 2024 07:31:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A55898007AD for ; Mon, 11 Mar 2024 11:31:08 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E8A5112131D for ; Mon, 11 Mar 2024 11:31:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: uMUA_NKjNJuCdQbF5py_9g-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 07/23] virt-admin: Drop trailing whitespaces from description of some commands Date: Mon, 11 Mar 2024 12:30:44 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: AT4BLYXBZO3FSRBLTL6A4D2EK33MBK3Q X-Message-ID-Hash: AT4BLYXBZO3FSRBLTL6A4D2EK33MBK3Q X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157839515100001 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virt-admin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 27bd123bfe..32e0c82f36 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -376,7 +376,7 @@ static const vshCmdInfo info_srv_threadpool_info[] =3D { .data =3D N_("get server workerpool parameters") }, {.name =3D "desc", - .data =3D N_("Retrieve threadpool attributes from a server. ") + .data =3D N_("Retrieve threadpool attributes from a server.") }, {.name =3D NULL} }; @@ -784,7 +784,7 @@ static const vshCmdInfo info_srv_clients_info[] =3D { .data =3D N_("get server's client-related configuration limits") }, {.name =3D "desc", - .data =3D N_("Retrieve server's client-related configuration limits ") + .data =3D N_("Retrieve server's client-related configuration limits") }, {.name =3D NULL} }; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710157934551480.96949782489844; Mon, 11 Mar 2024 04:52:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 88DCD1D37; Mon, 11 Mar 2024 07:52:13 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 835711EE7; Mon, 11 Mar 2024 07:33:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5D4161CEC; Mon, 11 Mar 2024 07:31:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 96E4C1A6E for ; Mon, 11 Mar 2024 07:31:11 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-GtbEpbQPOSiUZ3qhBfobng-1; Mon, 11 Mar 2024 07:31:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9691B1C5446F for ; Mon, 11 Mar 2024 11:31:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FF7E1121306 for ; Mon, 11 Mar 2024 11:31:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: GtbEpbQPOSiUZ3qhBfobng-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 08/23] virsh-domain: Don't explicitly break lines in help Date: Mon, 11 Mar 2024 12:30:45 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 33YW2OPSZKFR66I263NZ34M5K7CQJZRH X-Message-ID-Hash: 33YW2OPSZKFR66I263NZ34M5K7CQJZRH X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710157936157100001 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a90aefeb32..e2764efc4a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9565,7 +9565,7 @@ static const vshCmdOptDef opts_numatune[] =3D { {.name =3D "mode", .type =3D VSH_OT_STRING, .completer =3D virshDomainNumatuneModeCompleter, - .help =3D N_("NUMA mode, one of strict, preferred and interleave \n" + .help =3D N_("NUMA mode, one of strict, preferred and interleave " "or a number from the virDomainNumatuneMemMode enum") }, {.name =3D "nodeset", --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710158063475932.5604569490405; Mon, 11 Mar 2024 04:54:23 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 68CA91EBB; Mon, 11 Mar 2024 07:54:22 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 335FE1EEE; Mon, 11 Mar 2024 07:33:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1480B1A6E; Mon, 11 Mar 2024 07:31:13 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 826BA19C0 for ; Mon, 11 Mar 2024 07:31:12 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-CLAbKM-UMb6WkHt2APwbQg-1; Mon, 11 Mar 2024 07:31:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A2A48007A6 for ; Mon, 11 Mar 2024 11:31:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 022EB112131D for ; Mon, 11 Mar 2024 11:31:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: CLAbKM-UMb6WkHt2APwbQg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 09/23] vsh: Add '--dump-help' option for 'self-test' command Date: Mon, 11 Mar 2024 12:30:46 +0100 Message-ID: <3ef15560a6d632fcd896d0548f8f92932f95d23b.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: DFSUPFZQOXV3CUFX5DTW6BYZXYVVK3SC X-Message-ID-Hash: DFSUPFZQOXV3CUFX5DTW6BYZXYVVK3SC X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710158064381100001 The new option dumps the full help outputs for every command so that it's possible to conveniently check that subsequent refactors will not impact any of the external functionality. No man page entry is needed as the command is internal/undocumented. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/vsh.c b/tools/vsh.c index 6e558e56df..55921a0759 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -3312,6 +3312,10 @@ const vshCmdOptDef opts_selftest[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("output the list of options which are missing completers= ") }, + {.name =3D "dump-help", + .type =3D VSH_OT_BOOL, + .help =3D N_("output help for each command") + }, {.name =3D NULL} }; const vshCmdInfo info_selftest[] =3D { @@ -3330,9 +3334,14 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd) const vshCmdGrp *grp; const vshCmdDef *def; bool completers =3D vshCommandOptBool(cmd, "completers-missing"); + bool dumphelp =3D vshCommandOptBool(cmd, "dump-help"); for (grp =3D cmdGroups; grp->name; grp++) { for (def =3D grp->commands; def->name; def++) { + + if (dumphelp && !def->alias) + vshCmddefHelp(def); + if (vshCmddefCheckInternals(ctl, def, completers) < 0) return false; } --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171015907408171.85769955488388; Mon, 11 Mar 2024 05:11:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7449E1EC2; Mon, 11 Mar 2024 08:11:12 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BD9861F1C; Mon, 11 Mar 2024 07:35:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 586BF1E7A; Mon, 11 Mar 2024 07:31:34 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E226519C0 for ; Mon, 11 Mar 2024 07:31:15 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-557-MM7A5ZMnNimDvOAJ4hMKBg-1; Mon, 11 Mar 2024 07:31:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E7203C0E644 for ; Mon, 11 Mar 2024 11:31:12 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id E88A31121306 for ; Mon, 11 Mar 2024 11:31:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: MM7A5ZMnNimDvOAJ4hMKBg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 10/23] vsh: Refactor store of command help and description Date: Mon, 11 Mar 2024 12:30:47 +0100 Message-ID: <735d10d516fa20328613676129fcd2ce5d0fbed6.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: G7CXU4GK2L5V7LGF4BTW3J2AYBFMQ2ZA X-Message-ID-Hash: G7CXU4GK2L5V7LGF4BTW3J2AYBFMQ2ZA X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710159075607100001 Store the pointers to 'help' and 'description' information in the struct directly rather than in a key-value list. The generic approach never got any extra use. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-backup.c | 28 +- tools/virsh-checkpoint.c | 108 +-- tools/virsh-domain-event.c | 13 +- tools/virsh-domain-monitor.c | 189 ++--- tools/virsh-domain.c | 1479 +++++++++++----------------------- tools/virsh-host.c | 288 +++---- tools/virsh-interface.c | 186 ++--- tools/virsh-network.c | 275 ++----- tools/virsh-nodedev.c | 190 ++--- tools/virsh-nwfilter.c | 117 +-- tools/virsh-pool.c | 275 ++----- tools/virsh-secret.c | 91 +-- tools/virsh-snapshot.c | 130 +-- tools/virsh-volume.c | 210 ++--- tools/virsh.c | 18 +- tools/virt-admin.c | 214 ++--- tools/vsh.c | 113 +-- tools/vsh.h | 38 +- 18 files changed, 1238 insertions(+), 2724 deletions(-) diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c index 1bb2c63113..7a7834d7ff 100644 --- a/tools/virsh-backup.c +++ b/tools/virsh-backup.c @@ -24,15 +24,10 @@ /* * "backup-begin" command */ -static const vshCmdInfo info_backup_begin[] =3D { - {.name =3D "help", - .data =3D N_("Start a disk backup of a live domain") - }, - {.name =3D "desc", - .data =3D N_("Use XML to start a full or incremental disk backup of a= live " - "domain, optionally creating a checkpoint") - }, - {.name =3D NULL} +static const vshCmdInfo info_backup_begin =3D { + .help =3D N_("Start a disk backup of a live domain"), + .desc =3D N_("Use XML to start a full or incremental disk backup of a= live " + "domain, optionally creating a checkpoint"), }; static const vshCmdOptDef opts_backup_begin[] =3D { @@ -103,14 +98,9 @@ cmdBackupBegin(vshControl *ctl, /* * "backup-dumpxml" command */ -static const vshCmdInfo info_backup_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("Dump XML for an ongoing domain block backup job") - }, - {.name =3D "desc", - .data =3D N_("Backup Dump XML") - }, - {.name =3D NULL} +static const vshCmdInfo info_backup_dumpxml =3D { + .help =3D N_("Dump XML for an ongoing domain block backup job"), + .desc =3D N_("Backup Dump XML"), }; static const vshCmdOptDef opts_backup_dumpxml[] =3D { @@ -154,13 +144,13 @@ const vshCmdDef backupCmds[] =3D { {.name =3D "backup-begin", .handler =3D cmdBackupBegin, .opts =3D opts_backup_begin, - .info =3D info_backup_begin, + .info =3D &info_backup_begin, .flags =3D 0 }, {.name =3D "backup-dumpxml", .handler =3D cmdBackupDumpXML, .opts =3D opts_backup_dumpxml, - .info =3D info_backup_dumpxml, + .info =3D &info_backup_dumpxml, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 34bae34f9a..869c071700 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -71,15 +71,10 @@ virshCheckpointCreate(vshControl *ctl, /* * "checkpoint-create" command */ -static const vshCmdInfo info_checkpoint_create[] =3D { - {.name =3D "help", - .data =3D N_("Create a checkpoint from XML") - }, - {.name =3D "desc", - .data =3D N_("Create a checkpoint from XML for use in " - "future incremental backups") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_create =3D { + .help =3D N_("Create a checkpoint from XML"), + .desc =3D N_("Create a checkpoint from XML for use in " + "future incremental backups"), }; static const vshCmdOptDef opts_checkpoint_create[] =3D { @@ -183,15 +178,10 @@ virshParseCheckpointDiskspec(vshControl *ctl, return ret; } -static const vshCmdInfo info_checkpoint_create_as[] =3D { - {.name =3D "help", - .data =3D N_("Create a checkpoint from a set of args") - }, - {.name =3D "desc", - .data =3D N_("Create a checkpoint from arguments for use in " - "future incremental backups") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_create_as =3D { + .help =3D N_("Create a checkpoint from a set of args"), + .desc =3D N_("Create a checkpoint from arguments for use in " + "future incremental backups"), }; static const vshCmdOptDef opts_checkpoint_create_as[] =3D { @@ -309,14 +299,9 @@ virshLookupCheckpoint(vshControl *ctl, /* * "checkpoint-edit" command */ -static const vshCmdInfo info_checkpoint_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML for a checkpoint") - }, - {.name =3D "desc", - .data =3D N_("Edit the domain checkpoint XML for a named checkpoint") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_edit =3D { + .help =3D N_("edit XML for a checkpoint"), + .desc =3D N_("Edit the domain checkpoint XML for a named checkpoint"), }; static const vshCmdOptDef opts_checkpoint_edit[] =3D { @@ -425,14 +410,9 @@ virshGetCheckpointParent(vshControl *ctl, /* * "checkpoint-info" command */ -static const vshCmdInfo info_checkpoint_info[] =3D { - {.name =3D "help", - .data =3D N_("checkpoint information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about a checkpoint.") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_info =3D { + .help =3D N_("checkpoint information"), + .desc =3D N_("Returns basic information about a checkpoint."), }; static const vshCmdOptDef opts_checkpoint_info[] =3D { @@ -623,14 +603,9 @@ virshCheckpointListLookup(int id, /* * "checkpoint-list" command */ -static const vshCmdInfo info_checkpoint_list[] =3D { - {.name =3D "help", - .data =3D N_("List checkpoints for a domain") - }, - {.name =3D "desc", - .data =3D N_("Checkpoint List") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_list =3D { + .help =3D N_("List checkpoints for a domain"), + .desc =3D N_("Checkpoint List"), }; static const vshCmdOptDef opts_checkpoint_list[] =3D { @@ -825,14 +800,9 @@ cmdCheckpointList(vshControl *ctl, /* * "checkpoint-dumpxml" command */ -static const vshCmdInfo info_checkpoint_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("Dump XML for a domain checkpoint") - }, - {.name =3D "desc", - .data =3D N_("Checkpoint Dump XML") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_dumpxml =3D { + .help =3D N_("Dump XML for a domain checkpoint"), + .desc =3D N_("Checkpoint Dump XML"), }; static const vshCmdOptDef opts_checkpoint_dumpxml[] =3D { @@ -906,14 +876,9 @@ cmdCheckpointDumpXML(vshControl *ctl, /* * "checkpoint-parent" command */ -static const vshCmdInfo info_checkpoint_parent[] =3D { - {.name =3D "help", - .data =3D N_("Get the name of the parent of a checkpoint") - }, - {.name =3D "desc", - .data =3D N_("Extract the checkpoint's parent, if any") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_parent =3D { + .help =3D N_("Get the name of the parent of a checkpoint"), + .desc =3D N_("Extract the checkpoint's parent, if any"), }; static const vshCmdOptDef opts_checkpoint_parent[] =3D { @@ -959,14 +924,9 @@ cmdCheckpointParent(vshControl *ctl, /* * "checkpoint-delete" command */ -static const vshCmdInfo info_checkpoint_delete[] =3D { - {.name =3D "help", - .data =3D N_("Delete a domain checkpoint") - }, - {.name =3D "desc", - .data =3D N_("Checkpoint Delete") - }, - {.name =3D NULL} +static const vshCmdInfo info_checkpoint_delete =3D { + .help =3D N_("Delete a domain checkpoint"), + .desc =3D N_("Checkpoint Delete"), }; static const vshCmdOptDef opts_checkpoint_delete[] =3D { @@ -1034,49 +994,49 @@ const vshCmdDef checkpointCmds[] =3D { {.name =3D "checkpoint-create", .handler =3D cmdCheckpointCreate, .opts =3D opts_checkpoint_create, - .info =3D info_checkpoint_create, + .info =3D &info_checkpoint_create, .flags =3D 0 }, {.name =3D "checkpoint-create-as", .handler =3D cmdCheckpointCreateAs, .opts =3D opts_checkpoint_create_as, - .info =3D info_checkpoint_create_as, + .info =3D &info_checkpoint_create_as, .flags =3D 0 }, {.name =3D "checkpoint-delete", .handler =3D cmdCheckpointDelete, .opts =3D opts_checkpoint_delete, - .info =3D info_checkpoint_delete, + .info =3D &info_checkpoint_delete, .flags =3D 0 }, {.name =3D "checkpoint-dumpxml", .handler =3D cmdCheckpointDumpXML, .opts =3D opts_checkpoint_dumpxml, - .info =3D info_checkpoint_dumpxml, + .info =3D &info_checkpoint_dumpxml, .flags =3D 0 }, {.name =3D "checkpoint-edit", .handler =3D cmdCheckpointEdit, .opts =3D opts_checkpoint_edit, - .info =3D info_checkpoint_edit, + .info =3D &info_checkpoint_edit, .flags =3D 0 }, {.name =3D "checkpoint-info", .handler =3D cmdCheckpointInfo, .opts =3D opts_checkpoint_info, - .info =3D info_checkpoint_info, + .info =3D &info_checkpoint_info, .flags =3D 0 }, {.name =3D "checkpoint-list", .handler =3D cmdCheckpointList, .opts =3D opts_checkpoint_list, - .info =3D info_checkpoint_list, + .info =3D &info_checkpoint_list, .flags =3D 0 }, {.name =3D "checkpoint-parent", .handler =3D cmdCheckpointParent, .opts =3D opts_checkpoint_parent, - .info =3D info_checkpoint_parent, + .info =3D &info_checkpoint_parent, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c index 6887c195a0..2ff7f7b81c 100644 --- a/tools/virsh-domain-event.c +++ b/tools/virsh-domain-event.c @@ -859,14 +859,9 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_U= NUSED, } -static const vshCmdInfo info_event[] =3D { - {.name =3D "help", - .data =3D N_("Domain Events") - }, - {.name =3D "desc", - .data =3D N_("List event types, or wait for domain events to occur") - }, - {.name =3D NULL} +static const vshCmdInfo info_event =3D { + .help =3D N_("Domain Events"), + .desc =3D N_("List event types, or wait for domain events to occur"), }; static const vshCmdOptDef opts_event[] =3D { @@ -1017,7 +1012,7 @@ const vshCmdDef domEventCmds[] =3D { {.name =3D "event", .handler =3D cmdEvent, .opts =3D opts_event, - .info =3D info_event, + .info =3D &info_event, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index a2c56fc090..277eb71342 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -268,14 +268,9 @@ virshDomainStateReasonToString(int state, int reason) /* * "dommemstat" command */ -static const vshCmdInfo info_dommemstat[] =3D { - {.name =3D "help", - .data =3D N_("get memory statistics for a domain") - }, - {.name =3D "desc", - .data =3D N_("Get memory statistics for a running domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_dommemstat =3D { + .help =3D N_("get memory statistics for a domain"), + .desc =3D N_("Get memory statistics for a running domain."), }; static const vshCmdOptDef opts_dommemstat[] =3D { @@ -381,14 +376,9 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd) /* * "domblkinfo" command */ -static const vshCmdInfo info_domblkinfo[] =3D { - {.name =3D "help", - .data =3D N_("domain block device size information") - }, - {.name =3D "desc", - .data =3D N_("Get block device size info for a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domblkinfo =3D { + .help =3D N_("domain block device size information"), + .desc =3D N_("Get block device size info for a domain."), }; static const vshCmdOptDef opts_domblkinfo[] =3D { @@ -545,14 +535,9 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) /* * "domblklist" command */ -static const vshCmdInfo info_domblklist[] =3D { - {.name =3D "help", - .data =3D N_("list all domain blocks") - }, - {.name =3D "desc", - .data =3D N_("Get the summary of block devices for a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domblklist =3D { + .help =3D N_("list all domain blocks"), + .desc =3D N_("Get the summary of block devices for a domain."), }; static const vshCmdOptDef opts_domblklist[] =3D { @@ -666,10 +651,9 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) /* * "domiflist" command */ -static const vshCmdInfo info_domiflist[] =3D { - {"help", N_("list all domain virtual interfaces")}, - {"desc", N_("Get the summary of virtual interfaces for a domain.")}, - {NULL, NULL} +static const vshCmdInfo info_domiflist =3D { + .help =3D N_("list all domain virtual interfaces"), + .desc =3D N_("Get the summary of virtual interfaces for a domain."), }; static const vshCmdOptDef opts_domiflist[] =3D { @@ -745,14 +729,9 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd) /* * "domif-getlink" command */ -static const vshCmdInfo info_domif_getlink[] =3D { - {.name =3D "help", - .data =3D N_("get link state of a virtual interface") - }, - {.name =3D "desc", - .data =3D N_("Get link state of a domain's virtual interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domif_getlink =3D { + .help =3D N_("get link state of a virtual interface"), + .desc =3D N_("Get link state of a domain's virtual interface."), }; static const vshCmdOptDef opts_domif_getlink[] =3D { @@ -832,14 +811,9 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd) /* * "domcontrol" command */ -static const vshCmdInfo info_domcontrol[] =3D { - {.name =3D "help", - .data =3D N_("domain control interface state") - }, - {.name =3D "desc", - .data =3D N_("Returns state of a control interface to the domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domcontrol =3D { + .help =3D N_("domain control interface state"), + .desc =3D N_("Returns state of a control interface to the domain."), }; static const vshCmdOptDef opts_domcontrol[] =3D { @@ -879,15 +853,10 @@ cmdDomControl(vshControl *ctl, const vshCmd *cmd) /* * "domblkstat" command */ -static const vshCmdInfo info_domblkstat[] =3D { - {.name =3D "help", - .data =3D N_("get device block stats for a domain") - }, - {.name =3D "desc", - .data =3D N_("Get device block stats for a running domain. See man pa= ge or " - "use --human for explanation of fields") - }, - {.name =3D NULL} +static const vshCmdInfo info_domblkstat =3D { + .help =3D N_("get device block stats for a domain"), + .desc =3D N_("Get device block stats for a running domain. See man pa= ge or " + "use --human for explanation of fields"), }; static const vshCmdOptDef opts_domblkstat[] =3D { @@ -1060,14 +1029,9 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd) /* * "domifstat" command */ -static const vshCmdInfo info_domifstat[] =3D { - {.name =3D "help", - .data =3D N_("get network interface stats for a domain") - }, - {.name =3D "desc", - .data =3D N_("Get network interface stats for a running domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domifstat =3D { + .help =3D N_("get network interface stats for a domain"), + .desc =3D N_("Get network interface stats for a running domain."), }; static const vshCmdOptDef opts_domifstat[] =3D { @@ -1129,14 +1093,9 @@ cmdDomIfstat(vshControl *ctl, const vshCmd *cmd) /* * "domblkerror" command */ -static const vshCmdInfo info_domblkerror[] =3D { - {.name =3D "help", - .data =3D N_("Show errors on block devices") - }, - {.name =3D "desc", - .data =3D N_("Show block device errors") - }, - {.name =3D NULL} +static const vshCmdInfo info_domblkerror =3D { + .help =3D N_("Show errors on block devices"), + .desc =3D N_("Show block device errors"), }; static const vshCmdOptDef opts_domblkerror[] =3D { @@ -1190,14 +1149,9 @@ cmdDomBlkError(vshControl *ctl, const vshCmd *cmd) /* * "dominfo" command */ -static const vshCmdInfo info_dominfo[] =3D { - {.name =3D "help", - .data =3D N_("domain information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_dominfo =3D { + .help =3D N_("domain information"), + .desc =3D N_("Returns basic information about the domain."), }; static const vshCmdOptDef opts_dominfo[] =3D { @@ -1328,14 +1282,9 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) /* * "domstate" command */ -static const vshCmdInfo info_domstate[] =3D { - {.name =3D "help", - .data =3D N_("domain state") - }, - {.name =3D "desc", - .data =3D N_("Returns state about a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domstate =3D { + .help =3D N_("domain state"), + .desc =3D N_("Returns state about a domain."), }; static const vshCmdOptDef opts_domstate[] =3D { @@ -1375,14 +1324,9 @@ cmdDomstate(vshControl *ctl, const vshCmd *cmd) /* * "domtime" command */ -static const vshCmdInfo info_domtime[] =3D { - {.name =3D "help", - .data =3D N_("domain time") - }, - {.name =3D "desc", - .data =3D N_("Gets or sets the domain's system time") - }, - {.name =3D NULL} +static const vshCmdInfo info_domtime =3D { + .help =3D N_("domain time"), + .desc =3D N_("Gets or sets the domain's system time"), }; static const vshCmdOptDef opts_domtime[] =3D { @@ -1471,14 +1415,9 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd) /* * "list" command */ -static const vshCmdInfo info_list[] =3D { - {.name =3D "help", - .data =3D N_("list domains") - }, - {.name =3D "desc", - .data =3D N_("Returns list of domains.") - }, - {.name =3D NULL} +static const vshCmdInfo info_list =3D { + .help =3D N_("list domains"), + .desc =3D N_("Returns list of domains."), }; /* compare domains, pack NULLed ones at the end */ @@ -2011,14 +1950,9 @@ cmdList(vshControl *ctl, const vshCmd *cmd) /* * "domstats" command */ -static const vshCmdInfo info_domstats[] =3D { - {.name =3D "help", - .data =3D N_("get statistics about one or multiple domains") - }, - {.name =3D "desc", - .data =3D N_("Gets statistics about one or more (or all) domains") - }, - {.name =3D NULL} +static const vshCmdInfo info_domstats =3D { + .help =3D N_("get statistics about one or multiple domains"), + .desc =3D N_("Gets statistics about one or more (or all) domains"), }; static const vshCmdOptDef opts_domstats[] =3D { @@ -2269,10 +2203,9 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd) /* "domifaddr" command */ -static const vshCmdInfo info_domifaddr[] =3D { - {"help", N_("Get network interfaces' addresses for a running domain")}, - {"desc", N_("Get network interfaces' addresses for a running domain")}, - {NULL, NULL} +static const vshCmdInfo info_domifaddr =3D { + .help =3D N_("Get network interfaces' addresses for a running domain"), + .desc =3D N_("Get network interfaces' addresses for a running domain"), }; static const vshCmdOptDef opts_domifaddr[] =3D { @@ -2401,91 +2334,91 @@ const vshCmdDef domMonitoringCmds[] =3D { {.name =3D "domblkerror", .handler =3D cmdDomBlkError, .opts =3D opts_domblkerror, - .info =3D info_domblkerror, + .info =3D &info_domblkerror, .flags =3D 0 }, {.name =3D "domblkinfo", .handler =3D cmdDomblkinfo, .opts =3D opts_domblkinfo, - .info =3D info_domblkinfo, + .info =3D &info_domblkinfo, .flags =3D 0 }, {.name =3D "domblklist", .handler =3D cmdDomblklist, .opts =3D opts_domblklist, - .info =3D info_domblklist, + .info =3D &info_domblklist, .flags =3D 0 }, {.name =3D "domblkstat", .handler =3D cmdDomblkstat, .opts =3D opts_domblkstat, - .info =3D info_domblkstat, + .info =3D &info_domblkstat, .flags =3D 0 }, {.name =3D "domcontrol", .handler =3D cmdDomControl, .opts =3D opts_domcontrol, - .info =3D info_domcontrol, + .info =3D &info_domcontrol, .flags =3D 0 }, {.name =3D "domif-getlink", .handler =3D cmdDomIfGetLink, .opts =3D opts_domif_getlink, - .info =3D info_domif_getlink, + .info =3D &info_domif_getlink, .flags =3D 0 }, {.name =3D "domifaddr", .handler =3D cmdDomIfAddr, .opts =3D opts_domifaddr, - .info =3D info_domifaddr, + .info =3D &info_domifaddr, .flags =3D 0 }, {.name =3D "domiflist", .handler =3D cmdDomiflist, .opts =3D opts_domiflist, - .info =3D info_domiflist, + .info =3D &info_domiflist, .flags =3D 0 }, {.name =3D "domifstat", .handler =3D cmdDomIfstat, .opts =3D opts_domifstat, - .info =3D info_domifstat, + .info =3D &info_domifstat, .flags =3D 0 }, {.name =3D "dominfo", .handler =3D cmdDominfo, .opts =3D opts_dominfo, - .info =3D info_dominfo, + .info =3D &info_dominfo, .flags =3D 0 }, {.name =3D "dommemstat", .handler =3D cmdDomMemStat, .opts =3D opts_dommemstat, - .info =3D info_dommemstat, + .info =3D &info_dommemstat, .flags =3D 0 }, {.name =3D "domstate", .handler =3D cmdDomstate, .opts =3D opts_domstate, - .info =3D info_domstate, + .info =3D &info_domstate, .flags =3D 0 }, {.name =3D "domstats", .handler =3D cmdDomstats, .opts =3D opts_domstats, - .info =3D info_domstats, + .info =3D &info_domstats, .flags =3D 0 }, {.name =3D "domtime", .handler =3D cmdDomTime, .opts =3D opts_domtime, - .info =3D info_domtime, + .info =3D &info_domtime, .flags =3D 0 }, {.name =3D "list", .handler =3D cmdList, .opts =3D opts_list, - .info =3D info_list, + .info =3D &info_list, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e2764efc4a..6768a1f24e 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -341,14 +341,9 @@ virshNodeGetCPUCount(virConnectPtr conn) /* * "attach-device" command */ -static const vshCmdInfo info_attach_device[] =3D { - {.name =3D "help", - .data =3D N_("attach device from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Attach device from an XML .") - }, - {.name =3D NULL} +static const vshCmdInfo info_attach_device =3D { + .help =3D N_("attach device from an XML file"), + .desc =3D N_("Attach device from an XML ."), }; static const vshCmdOptDef opts_attach_device[] =3D { @@ -416,14 +411,9 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd) /* * "attach-disk" command */ -static const vshCmdInfo info_attach_disk[] =3D { - {.name =3D "help", - .data =3D N_("attach disk device") - }, - {.name =3D "desc", - .data =3D N_("Attach new disk device.") - }, - {.name =3D NULL} +static const vshCmdInfo info_attach_disk =3D { + .help =3D N_("attach disk device"), + .desc =3D N_("Attach new disk device."), }; static const vshCmdOptDef opts_attach_disk[] =3D { @@ -813,14 +803,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) /* * "attach-interface" command */ -static const vshCmdInfo info_attach_interface[] =3D { - {.name =3D "help", - .data =3D N_("attach network interface") - }, - {.name =3D "desc", - .data =3D N_("Attach new network interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_attach_interface =3D { + .help =3D N_("attach network interface"), + .desc =3D N_("Attach new network interface."), }; static const vshCmdOptDef opts_attach_interface[] =3D { @@ -1149,14 +1134,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cm= d) /* * "autostart" command */ -static const vshCmdInfo info_autostart[] =3D { - {.name =3D "help", - .data =3D N_("autostart a domain") - }, - {.name =3D "desc", - .data =3D N_("Configure a domain to be automatically started at boot.= ") - }, - {.name =3D NULL} +static const vshCmdInfo info_autostart =3D { + .help =3D N_("autostart a domain"), + .desc =3D N_("Configure a domain to be automatically started at boot."= ), }; static const vshCmdOptDef opts_autostart[] =3D { @@ -1199,14 +1179,9 @@ cmdAutostart(vshControl *ctl, const vshCmd *cmd) /* * "blkdeviotune" command */ -static const vshCmdInfo info_blkdeviotune[] =3D { - {.name =3D "help", - .data =3D N_("Set or query a block device I/O tuning parameters.") - }, - {.name =3D "desc", - .data =3D N_("Set or query disk I/O parameters such as block throttli= ng.") - }, - {.name =3D NULL} +static const vshCmdInfo info_blkdeviotune =3D { + .help =3D N_("Set or query a block device I/O tuning parameters."), + .desc =3D N_("Set or query disk I/O parameters such as block throttlin= g."), }; static const vshCmdOptDef opts_blkdeviotune[] =3D { @@ -1523,14 +1498,9 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) /* * "blkiotune" command */ -static const vshCmdInfo info_blkiotune[] =3D { - {.name =3D "help", - .data =3D N_("Get or set blkio parameters") - }, - {.name =3D "desc", - .data =3D N_("Get or set the current blkio parameters for a guest dom= ain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_blkiotune =3D { + .help =3D N_("Get or set blkio parameters"), + .desc =3D N_("Get or set the current blkio parameters for a guest doma= in."), }; static const vshCmdOptDef opts_blkiotune[] =3D { @@ -2002,14 +1972,9 @@ virshBlockJobWait(virshBlockJobWaitData *data) /* * "blockcommit" command */ -static const vshCmdInfo info_blockcommit[] =3D { - {.name =3D "help", - .data =3D N_("Start a block commit operation.") - }, - {.name =3D "desc", - .data =3D N_("Commit changes from a snapshot down to its backing imag= e.") - }, - {.name =3D NULL} +static const vshCmdInfo info_blockcommit =3D { + .help =3D N_("Start a block commit operation."), + .desc =3D N_("Commit changes from a snapshot down to its backing image= ."), }; static const vshCmdOptDef opts_blockcommit[] =3D { @@ -2226,14 +2191,9 @@ cmdBlockcommit(vshControl *ctl, const vshCmd *cmd) /* * "blockcopy" command */ -static const vshCmdInfo info_blockcopy[] =3D { - {.name =3D "help", - .data =3D N_("Start a block copy operation.") - }, - {.name =3D "desc", - .data =3D N_("Copy a disk backing image chain to dest.") - }, - {.name =3D NULL} +static const vshCmdInfo info_blockcopy =3D { + .help =3D N_("Start a block copy operation."), + .desc =3D N_("Copy a disk backing image chain to dest."), }; static const vshCmdOptDef opts_blockcopy[] =3D { @@ -2563,14 +2523,9 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) /* * "blockjob" command */ -static const vshCmdInfo info_blockjob[] =3D { - {.name =3D "help", - .data =3D N_("Manage active block operations") - }, - {.name =3D "desc", - .data =3D N_("Query, adjust speed, or cancel active block operations.= ") - }, - {.name =3D NULL} +static const vshCmdInfo info_blockjob =3D { + .help =3D N_("Manage active block operations"), + .desc =3D N_("Query, adjust speed, or cancel active block operations."= ), }; static const vshCmdOptDef opts_blockjob[] =3D { @@ -2779,14 +2734,9 @@ cmdBlockjob(vshControl *ctl, const vshCmd *cmd) /* * "blockpull" command */ -static const vshCmdInfo info_blockpull[] =3D { - {.name =3D "help", - .data =3D N_("Populate a disk from its backing image.") - }, - {.name =3D "desc", - .data =3D N_("Populate a disk from its backing image.") - }, - {.name =3D NULL} +static const vshCmdInfo info_blockpull =3D { + .help =3D N_("Populate a disk from its backing image."), + .desc =3D N_("Populate a disk from its backing image."), }; static const vshCmdOptDef opts_blockpull[] =3D { @@ -2926,14 +2876,9 @@ cmdBlockpull(vshControl *ctl, const vshCmd *cmd) /* * "blockresize" command */ -static const vshCmdInfo info_blockresize[] =3D { - {.name =3D "help", - .data =3D N_("Resize block device of domain.") - }, - {.name =3D "desc", - .data =3D N_("Resize block device of domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_blockresize =3D { + .help =3D N_("Resize block device of domain."), + .desc =3D N_("Resize block device of domain."), }; static const vshCmdOptDef opts_blockresize[] =3D { @@ -2997,14 +2942,9 @@ cmdBlockresize(vshControl *ctl, const vshCmd *cmd) /* * "console" command */ -static const vshCmdInfo info_console[] =3D { - {.name =3D "help", - .data =3D N_("connect to the guest console") - }, - {.name =3D "desc", - .data =3D N_("Connect the virtual serial console for the guest") - }, - {.name =3D NULL} +static const vshCmdInfo info_console =3D { + .help =3D N_("connect to the guest console"), + .desc =3D N_("Connect the virtual serial console for the guest"), }; static const vshCmdOptDef opts_console[] =3D { @@ -3092,15 +3032,10 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd) /* "domif-setlink" command */ -static const vshCmdInfo info_domif_setlink[] =3D { - {.name =3D "help", - .data =3D N_("set link state of a virtual interface") - }, - {.name =3D "desc", - .data =3D N_("Set link state of a domain's virtual interface. This co= mmand " - "wraps usage of update-device command.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domif_setlink =3D { + .help =3D N_("set link state of a virtual interface"), + .desc =3D N_("Set link state of a domain's virtual interface. This co= mmand " + "wraps usage of update-device command."), }; static const vshCmdOptDef opts_domif_setlink[] =3D { @@ -3244,14 +3179,9 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd) /* "domiftune" command */ -static const vshCmdInfo info_domiftune[] =3D { - {.name =3D "help", - .data =3D N_("get/set parameters of a virtual interface") - }, - {.name =3D "desc", - .data =3D N_("Get/set parameters of a domain's virtual interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domiftune =3D { + .help =3D N_("get/set parameters of a virtual interface"), + .desc =3D N_("Get/set parameters of a domain's virtual interface."), }; static const vshCmdOptDef opts_domiftune[] =3D { @@ -3440,14 +3370,9 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) /* * "suspend" command */ -static const vshCmdInfo info_suspend[] =3D { - {.name =3D "help", - .data =3D N_("suspend a domain") - }, - {.name =3D "desc", - .data =3D N_("Suspend a running domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_suspend =3D { + .help =3D N_("suspend a domain"), + .desc =3D N_("Suspend a running domain."), }; static const vshCmdOptDef opts_suspend[] =3D { @@ -3476,17 +3401,12 @@ cmdSuspend(vshControl *ctl, const vshCmd *cmd) /* * "dompmsuspend" command */ -static const vshCmdInfo info_dom_pm_suspend[] =3D { - {.name =3D "help", - .data =3D N_("suspend a domain gracefully using power management " - "functions") - }, - {.name =3D "desc", - .data =3D N_("Suspends a running domain using guest OS's power manage= ment. " +static const vshCmdInfo info_dom_pm_suspend =3D { + .help =3D N_("suspend a domain gracefully using power management " + "functions"), + .desc =3D N_("Suspends a running domain using guest OS's power manage= ment. " "(Note: This requires a guest agent configured and running= in " - "the guest OS).") - }, - {.name =3D NULL} + "the guest OS)."), }; static const vshCmdOptDef opts_dom_pm_suspend[] =3D { @@ -3546,15 +3466,10 @@ cmdDomPMSuspend(vshControl *ctl, const vshCmd *cmd) * "dompmwakeup" command */ -static const vshCmdInfo info_dom_pm_wakeup[] =3D { - {.name =3D "help", - .data =3D N_("wakeup a domain from pmsuspended state") - }, - {.name =3D "desc", - .data =3D N_("Wakeup a domain that was previously suspended " - "by power management.") - }, - {.name =3D NULL} +static const vshCmdInfo info_dom_pm_wakeup =3D { + .help =3D N_("wakeup a domain from pmsuspended state"), + .desc =3D N_("Wakeup a domain that was previously suspended " + "by power management."), }; static const vshCmdOptDef opts_dom_pm_wakeup[] =3D { @@ -3587,14 +3502,9 @@ cmdDomPMWakeup(vshControl *ctl, const vshCmd *cmd) /* * "undefine" command */ -static const vshCmdInfo info_undefine[] =3D { - {.name =3D "help", - .data =3D N_("undefine a domain") - }, - {.name =3D "desc", - .data =3D N_("Undefine an inactive domain, or convert persistent to t= ransient.") - }, - {.name =3D NULL} +static const vshCmdInfo info_undefine =3D { + .help =3D N_("undefine a domain"), + .desc =3D N_("Undefine an inactive domain, or convert persistent to tr= ansient."), }; static const vshCmdOptDef opts_undefine[] =3D { @@ -4016,16 +3926,11 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) /* * "start" command */ -static const vshCmdInfo info_start[] =3D { - {.name =3D "help", - .data =3D N_("start a (previously defined) inactive domain") - }, - {.name =3D "desc", - .data =3D N_("Start a domain, either from the last managedsave\n" +static const vshCmdInfo info_start =3D { + .help =3D N_("start a (previously defined) inactive domain"), + .desc =3D N_("Start a domain, either from the last managedsave\n" " state, or via a fresh boot if no managedsave state\n" - " is present.") - }, - {.name =3D NULL} + " is present."), }; static const vshCmdOptDef opts_start[] =3D { @@ -4182,14 +4087,9 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) /* * "save" command */ -static const vshCmdInfo info_save[] =3D { - {.name =3D "help", - .data =3D N_("save a domain state to a file") - }, - {.name =3D "desc", - .data =3D N_("Save the RAM state of a running domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_save =3D { + .help =3D N_("save a domain state to a file"), + .desc =3D N_("Save the RAM state of a running domain."), }; static const vshCmdOptDef opts_save[] =3D { @@ -4537,14 +4437,9 @@ cmdSave(vshControl *ctl, const vshCmd *cmd) /* * "save-image-dumpxml" command */ -static const vshCmdInfo info_save_image_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("saved state domain information in XML") - }, - {.name =3D "desc", - .data =3D N_("Dump XML of domain information for a saved state file t= o stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_save_image_dumpxml =3D { + .help =3D N_("saved state domain information in XML"), + .desc =3D N_("Dump XML of domain information for a saved state file to= stdout."), }; static const vshCmdOptDef opts_save_image_dumpxml[] =3D { @@ -4599,14 +4494,9 @@ cmdSaveImageDumpxml(vshControl *ctl, const vshCmd *c= md) /* * "save-image-define" command */ -static const vshCmdInfo info_save_image_define[] =3D { - {.name =3D "help", - .data =3D N_("redefine the XML for a domain's saved state file") - }, - {.name =3D "desc", - .data =3D N_("Replace the domain XML associated with a saved state fi= le") - }, - {.name =3D NULL} +static const vshCmdInfo info_save_image_define =3D { + .help =3D N_("redefine the XML for a domain's saved state file"), + .desc =3D N_("Replace the domain XML associated with a saved state fil= e"), }; static const vshCmdOptDef opts_save_image_define[] =3D { @@ -4667,14 +4557,9 @@ cmdSaveImageDefine(vshControl *ctl, const vshCmd *cm= d) /* * "save-image-edit" command */ -static const vshCmdInfo info_save_image_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML for a domain's saved state file") - }, - {.name =3D "desc", - .data =3D N_("Edit the domain XML associated with a saved state file") - }, - {.name =3D NULL} +static const vshCmdInfo info_save_image_edit =3D { + .help =3D N_("edit XML for a domain's saved state file"), + .desc =3D N_("Edit the domain XML associated with a saved state file"), }; static const vshCmdOptDef opts_save_image_edit[] =3D { @@ -4740,17 +4625,12 @@ cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd) /* * "managedsave" command */ -static const vshCmdInfo info_managedsave[] =3D { - {.name =3D "help", - .data =3D N_("managed save of a domain state") - }, - {.name =3D "desc", - .data =3D N_("Save and destroy a running domain, so it can be restart= ed from\n" +static const vshCmdInfo info_managedsave =3D { + .help =3D N_("managed save of a domain state"), + .desc =3D N_("Save and destroy a running domain, so it can be restart= ed from\n" " the same state at a later time. When the virsh 'star= t'\n" " command is next run for the domain, it will automatic= ally\n" - " be started from this saved state.") - }, - {.name =3D NULL} + " be started from this saved state."), }; static const vshCmdOptDef opts_managedsave[] =3D { @@ -4858,14 +4738,9 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd) /* * "managedsave-remove" command */ -static const vshCmdInfo info_managedsaveremove[] =3D { - {.name =3D "help", - .data =3D N_("Remove managed save of a domain") - }, - {.name =3D "desc", - .data =3D N_("Remove an existing managed save state file from a domai= n") - }, - {.name =3D NULL} +static const vshCmdInfo info_managedsaveremove =3D { + .help =3D N_("Remove managed save of a domain"), + .desc =3D N_("Remove an existing managed save state file from a domain= "), }; static const vshCmdOptDef opts_managedsaveremove[] =3D { @@ -4909,14 +4784,9 @@ cmdManagedSaveRemove(vshControl *ctl, const vshCmd *= cmd) /* * "managedsave-edit" command */ -static const vshCmdInfo info_managed_save_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML for a domain's managed save state file") - }, - {.name =3D "desc", - .data =3D N_("Edit the domain XML associated with the managed save st= ate file") - }, - {.name =3D NULL} +static const vshCmdInfo info_managed_save_edit =3D { + .help =3D N_("edit XML for a domain's managed save state file"), + .desc =3D N_("Edit the domain XML associated with the managed save sta= te file"), }; static const vshCmdOptDef opts_managed_save_edit[] =3D { @@ -4974,14 +4844,9 @@ cmdManagedSaveEdit(vshControl *ctl, const vshCmd *cm= d) /* * "managedsave-dumpxml" command */ -static const vshCmdInfo info_managed_save_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("Domain information of managed save state file in XML") - }, - {.name =3D "desc", - .data =3D N_("Dump XML of domain information for a managed save state = file to stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_managed_save_dumpxml =3D { + .help =3D N_("Domain information of managed save state file in XML"), + .desc =3D N_("Dump XML of domain information for a managed save state = file to stdout."), }; static const vshCmdOptDef opts_managed_save_dumpxml[] =3D { @@ -5030,14 +4895,9 @@ cmdManagedSaveDumpxml(vshControl *ctl, const vshCmd = *cmd) /* * "managedsave-define" command */ -static const vshCmdInfo info_managed_save_define[] =3D { - {.name =3D "help", - .data =3D N_("redefine the XML for a domain's managed save state file= ") - }, - {.name =3D "desc", - .data =3D N_("Replace the domain XML associated with a managed save s= tate file") - }, - {.name =3D NULL} +static const vshCmdInfo info_managed_save_define =3D { + .help =3D N_("redefine the XML for a domain's managed save state file"= ), + .desc =3D N_("Replace the domain XML associated with a managed save st= ate file"), }; static const vshCmdOptDef opts_managed_save_define[] =3D { @@ -5097,14 +4957,9 @@ cmdManagedSaveDefine(vshControl *ctl, const vshCmd *= cmd) /* * "schedinfo" command */ -static const vshCmdInfo info_schedinfo[] =3D { - {.name =3D "help", - .data =3D N_("show/set scheduler parameters") - }, - {.name =3D "desc", - .data =3D N_("Show/Set scheduler parameters.") - }, - {.name =3D NULL} +static const vshCmdInfo info_schedinfo =3D { + .help =3D N_("show/set scheduler parameters"), + .desc =3D N_("Show/Set scheduler parameters."), }; static const vshCmdOptDef opts_schedinfo[] =3D { @@ -5317,14 +5172,9 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) /* * "restore" command */ -static const vshCmdInfo info_restore[] =3D { - {.name =3D "help", - .data =3D N_("restore a domain from a saved state in a file") - }, - {.name =3D "desc", - .data =3D N_("Restore a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_restore =3D { + .help =3D N_("restore a domain from a saved state in a file"), + .desc =3D N_("Restore a domain."), }; static const vshCmdOptDef opts_restore[] =3D { @@ -5404,14 +5254,9 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) /* * "dump" command */ -static const vshCmdInfo info_dump[] =3D { - {.name =3D "help", - .data =3D N_("dump the core of a domain to a file for analysis") - }, - {.name =3D "desc", - .data =3D N_("Core dump a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_dump =3D { + .help =3D N_("dump the core of a domain to a file for analysis"), + .desc =3D N_("Core dump a domain."), }; static const vshCmdOptDef opts_dump[] =3D { @@ -5578,15 +5423,10 @@ cmdDump(vshControl *ctl, const vshCmd *cmd) return true; } -static const vshCmdInfo info_screenshot[] =3D { - {.name =3D "help", - .data =3D N_("take a screenshot of a current domain console and store= it " - "into a file") - }, - {.name =3D "desc", - .data =3D N_("screenshot of a current domain console") - }, - {.name =3D NULL} +static const vshCmdInfo info_screenshot =3D { + .help =3D N_("take a screenshot of a current domain console and store= it " + "into a file"), + .desc =3D N_("screenshot of a current domain console"), }; static const vshCmdOptDef opts_screenshot[] =3D { @@ -5713,14 +5553,9 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd) /* * "set-lifecycle-action" command */ -static const vshCmdInfo info_setLifecycleAction[] =3D { - {.name =3D "help", - .data =3D N_("change lifecycle actions") - }, - {.name =3D "desc", - .data =3D N_("Change lifecycle actions for the guest domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_setLifecycleAction =3D { + .help =3D N_("change lifecycle actions"), + .desc =3D N_("Change lifecycle actions for the guest domain."), }; static const vshCmdOptDef opts_setLifecycleAction[] =3D { @@ -5810,14 +5645,9 @@ cmdSetLifecycleAction(vshControl *ctl, const vshCmd = *cmd) /* * "set-user-password" command */ -static const vshCmdInfo info_set_user_password[] =3D { - {.name =3D "help", - .data =3D N_("set the user password inside the domain") - }, - {.name =3D "desc", - .data =3D N_("changes the password of the specified user inside the d= omain") - }, - {.name =3D NULL} +static const vshCmdInfo info_set_user_password =3D { + .help =3D N_("set the user password inside the domain"), + .desc =3D N_("changes the password of the specified user inside the do= main"), }; static const vshCmdOptDef opts_set_user_password[] =3D { @@ -5870,14 +5700,9 @@ cmdSetUserPassword(vshControl *ctl, const vshCmd *cm= d) /* * "resume" command */ -static const vshCmdInfo info_resume[] =3D { - {.name =3D "help", - .data =3D N_("resume a domain") - }, - {.name =3D "desc", - .data =3D N_("Resume a previously suspended domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_resume =3D { + .help =3D N_("resume a domain"), + .desc =3D N_("Resume a previously suspended domain."), }; static const vshCmdOptDef opts_resume[] =3D { @@ -5906,14 +5731,9 @@ cmdResume(vshControl *ctl, const vshCmd *cmd) /* * "shutdown" command */ -static const vshCmdInfo info_shutdown[] =3D { - {.name =3D "help", - .data =3D N_("gracefully shutdown a domain") - }, - {.name =3D "desc", - .data =3D N_("Run shutdown in the target domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_shutdown =3D { + .help =3D N_("gracefully shutdown a domain"), + .desc =3D N_("Run shutdown in the target domain."), }; static const vshCmdOptDef opts_shutdown[] =3D { @@ -5986,14 +5806,9 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd) /* * "reboot" command */ -static const vshCmdInfo info_reboot[] =3D { - {.name =3D "help", - .data =3D N_("reboot a domain") - }, - {.name =3D "desc", - .data =3D N_("Run a reboot command in the target domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_reboot =3D { + .help =3D N_("reboot a domain"), + .desc =3D N_("Run a reboot command in the target domain."), }; static const vshCmdOptDef opts_reboot[] =3D { @@ -6060,14 +5875,9 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) /* * "reset" command */ -static const vshCmdInfo info_reset[] =3D { - {.name =3D "help", - .data =3D N_("reset a domain") - }, - {.name =3D "desc", - .data =3D N_("Reset the target domain as if by power button") - }, - {.name =3D NULL} +static const vshCmdInfo info_reset =3D { + .help =3D N_("reset a domain"), + .desc =3D N_("Reset the target domain as if by power button"), }; static const vshCmdOptDef opts_reset[] =3D { @@ -6096,14 +5906,9 @@ cmdReset(vshControl *ctl, const vshCmd *cmd) /* * "domjobinfo" command */ -static const vshCmdInfo info_domjobinfo[] =3D { - {.name =3D "help", - .data =3D N_("domain job information") - }, - {.name =3D "desc", - .data =3D N_("Returns information about jobs running on a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domjobinfo =3D { + .help =3D N_("domain job information"), + .desc =3D N_("Returns information about jobs running on a domain."), }; static const vshCmdOptDef opts_domjobinfo[] =3D { @@ -6516,14 +6321,9 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) /* * "domjobabort" command */ -static const vshCmdInfo info_domjobabort[] =3D { - {.name =3D "help", - .data =3D N_("abort active domain job") - }, - {.name =3D "desc", - .data =3D N_("Aborts the currently running domain job") - }, - {.name =3D NULL} +static const vshCmdInfo info_domjobabort =3D { + .help =3D N_("abort active domain job"), + .desc =3D N_("Aborts the currently running domain job"), }; static const vshCmdOptDef opts_domjobabort[] =3D { @@ -6562,14 +6362,9 @@ cmdDomjobabort(vshControl *ctl, const vshCmd *cmd) /* * "vcpucount" command */ -static const vshCmdInfo info_vcpucount[] =3D { - {.name =3D "help", - .data =3D N_("domain vcpu counts") - }, - {.name =3D "desc", - .data =3D N_("Returns the number of virtual CPUs used by the domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vcpucount =3D { + .help =3D N_("domain vcpu counts"), + .desc =3D N_("Returns the number of virtual CPUs used by the domain."), }; static const vshCmdOptDef opts_vcpucount[] =3D { @@ -6747,14 +6542,9 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd) /* * "vcpuinfo" command */ -static const vshCmdInfo info_vcpuinfo[] =3D { - {.name =3D "help", - .data =3D N_("detailed domain vcpu information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the domain virtual CPUs= .") - }, - {.name =3D NULL} +static const vshCmdInfo info_vcpuinfo =3D { + .help =3D N_("detailed domain vcpu information"), + .desc =3D N_("Returns basic information about the domain virtual CPUs.= "), }; static const vshCmdOptDef opts_vcpuinfo[] =3D { @@ -6967,14 +6757,9 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd) /* * "vcpupin" command */ -static const vshCmdInfo info_vcpupin[] =3D { - {.name =3D "help", - .data =3D N_("control or query domain vcpu affinity") - }, - {.name =3D "desc", - .data =3D N_("Pin domain VCPUs to host physical CPUs.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vcpupin =3D { + .help =3D N_("control or query domain vcpu affinity"), + .desc =3D N_("Pin domain VCPUs to host physical CPUs."), }; static const vshCmdOptDef opts_vcpupin[] =3D { @@ -7185,14 +6970,9 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd) /* * "emulatorpin" command */ -static const vshCmdInfo info_emulatorpin[] =3D { - {.name =3D "help", - .data =3D N_("control or query domain emulator affinity") - }, - {.name =3D "desc", - .data =3D N_("Pin domain emulator threads to host physical CPUs.") - }, - {.name =3D NULL} +static const vshCmdInfo info_emulatorpin =3D { + .help =3D N_("control or query domain emulator affinity"), + .desc =3D N_("Pin domain emulator threads to host physical CPUs."), }; static const vshCmdOptDef opts_emulatorpin[] =3D { @@ -7285,14 +7065,9 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd) /* * "setvcpus" command */ -static const vshCmdInfo info_setvcpus[] =3D { - {.name =3D "help", - .data =3D N_("change number of virtual CPUs") - }, - {.name =3D "desc", - .data =3D N_("Change the number of virtual CPUs in the guest domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_setvcpus =3D { + .help =3D N_("change number of virtual CPUs"), + .desc =3D N_("Change the number of virtual CPUs in the guest domain."), }; static const vshCmdOptDef opts_setvcpus[] =3D { @@ -7377,15 +7152,10 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) /* * "guestvcpus" command */ -static const vshCmdInfo info_guestvcpus[] =3D { - {.name =3D "help", - .data =3D N_("query or modify state of vcpu in the guest (via agent)") - }, - {.name =3D "desc", - .data =3D N_("Use the guest agent to query or set cpu state from gues= t's " - "point of view") - }, - {.name =3D NULL} +static const vshCmdInfo info_guestvcpus =3D { + .help =3D N_("query or modify state of vcpu in the guest (via agent)"= ), + .desc =3D N_("Use the guest agent to query or set cpu state from gues= t's " + "point of view"), }; static const vshCmdOptDef opts_guestvcpus[] =3D { @@ -7461,14 +7231,9 @@ cmdGuestvcpus(vshControl *ctl, const vshCmd *cmd) /* * "setvcpu" command */ -static const vshCmdInfo info_setvcpu[] =3D { - {.name =3D "help", - .data =3D N_("attach/detach vcpu or groups of threads") - }, - {.name =3D "desc", - .data =3D N_("Add or remove vcpus") - }, - {.name =3D NULL} +static const vshCmdInfo info_setvcpu =3D { + .help =3D N_("attach/detach vcpu or groups of threads"), + .desc =3D N_("Add or remove vcpus"), }; static const vshCmdOptDef opts_setvcpu[] =3D { @@ -7539,15 +7304,10 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd) /* * "domblkthreshold" command */ -static const vshCmdInfo info_domblkthreshold[] =3D { - {.name =3D "help", - .data =3D N_("set the threshold for block-threshold event for a given= block " - "device or it's backing chain element") - }, - {.name =3D "desc", - .data =3D N_("set threshold for block-threshold event for a block dev= ice") - }, - {.name =3D NULL} +static const vshCmdInfo info_domblkthreshold =3D { + .help =3D N_("set the threshold for block-threshold event for a given= block " + "device or it's backing chain element"), + .desc =3D N_("set threshold for block-threshold event for a block dev= ice"), }; static const vshCmdOptDef opts_domblkthreshold[] =3D { @@ -7593,14 +7353,9 @@ cmdDomblkthreshold(vshControl *ctl, const vshCmd *cm= d) /* * "iothreadinfo" command */ -static const vshCmdInfo info_iothreadinfo[] =3D { - {.name =3D "help", - .data =3D N_("view domain IOThreads") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the domain IOThreads.") - }, - {.name =3D NULL} +static const vshCmdInfo info_iothreadinfo =3D { + .help =3D N_("view domain IOThreads"), + .desc =3D N_("Returns basic information about the domain IOThreads."), }; static const vshCmdOptDef opts_iothreadinfo[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), @@ -7678,14 +7433,9 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) /* * "iothreadpin" command */ -static const vshCmdInfo info_iothreadpin[] =3D { - {.name =3D "help", - .data =3D N_("control domain IOThread affinity") - }, - {.name =3D "desc", - .data =3D N_("Pin domain IOThreads to host physical CPUs.") - }, - {.name =3D NULL} +static const vshCmdInfo info_iothreadpin =3D { + .help =3D N_("control domain IOThread affinity"), + .desc =3D N_("Pin domain IOThreads to host physical CPUs."), }; static const vshCmdOptDef opts_iothreadpin[] =3D { @@ -7756,14 +7506,9 @@ cmdIOThreadPin(vshControl *ctl, const vshCmd *cmd) /* * "iothreadadd" command */ -static const vshCmdInfo info_iothreadadd[] =3D { - {.name =3D "help", - .data =3D N_("add an IOThread to the guest domain") - }, - {.name =3D "desc", - .data =3D N_("Add an IOThread to the guest domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_iothreadadd =3D { + .help =3D N_("add an IOThread to the guest domain"), + .desc =3D N_("Add an IOThread to the guest domain."), }; static const vshCmdOptDef opts_iothreadadd[] =3D { @@ -7817,14 +7562,9 @@ cmdIOThreadAdd(vshControl *ctl, const vshCmd *cmd) /* * "iothreadset" command */ -static const vshCmdInfo info_iothreadset[] =3D { - {.name =3D "help", - .data =3D N_("modifies an existing IOThread of the guest domain") - }, - {.name =3D "desc", - .data =3D N_("Modifies an existing IOThread of the guest domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_iothreadset =3D { + .help =3D N_("modifies an existing IOThread of the guest domain"), + .desc =3D N_("Modifies an existing IOThread of the guest domain."), }; static const vshCmdOptDef opts_iothreadset[] =3D { @@ -7938,14 +7678,9 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) /* * "iothreaddel" command */ -static const vshCmdInfo info_iothreaddel[] =3D { - {.name =3D "help", - .data =3D N_("delete an IOThread from the guest domain") - }, - {.name =3D "desc", - .data =3D N_("Delete an IOThread from the guest domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_iothreaddel =3D { + .help =3D N_("delete an IOThread from the guest domain"), + .desc =3D N_("Delete an IOThread from the guest domain."), }; static const vshCmdOptDef opts_iothreaddel[] =3D { @@ -7999,14 +7734,9 @@ cmdIOThreadDel(vshControl *ctl, const vshCmd *cmd) /* * "cpu-stats" command */ -static const vshCmdInfo info_cpu_stats[] =3D { - {.name =3D "help", - .data =3D N_("show domain cpu statistics") - }, - {.name =3D "desc", - .data =3D N_("Display per-CPU and total statistics about the domain's= CPUs") - }, - {.name =3D NULL} +static const vshCmdInfo info_cpu_stats =3D { + .help =3D N_("show domain cpu statistics"), + .desc =3D N_("Display per-CPU and total statistics about the domain's = CPUs"), }; static const vshCmdOptDef opts_cpu_stats[] =3D { @@ -8180,14 +7910,9 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) /* * "create" command */ -static const vshCmdInfo info_create[] =3D { - {.name =3D "help", - .data =3D N_("create a domain from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Create a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_create =3D { + .help =3D N_("create a domain from an XML file"), + .desc =3D N_("Create a domain."), }; static const vshCmdOptDef opts_create[] =3D { @@ -8305,14 +8030,9 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd) /* * "define" command */ -static const vshCmdInfo info_define[] =3D { - {.name =3D "help", - .data =3D N_("define (but don't start) a domain from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Define a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_define =3D { + .help =3D N_("define (but don't start) a domain from an XML file"), + .desc =3D N_("Define a domain."), }; static const vshCmdOptDef opts_define[] =3D { @@ -8360,14 +8080,9 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd) /* * "destroy" command */ -static const vshCmdInfo info_destroy[] =3D { - {.name =3D "help", - .data =3D N_("destroy (stop) a domain") - }, - {.name =3D "desc", - .data =3D N_("Forcefully stop a given domain, but leave its resources= intact.") - }, - {.name =3D NULL} +static const vshCmdInfo info_destroy =3D { + .help =3D N_("destroy (stop) a domain"), + .desc =3D N_("Forcefully stop a given domain, but leave its resources = intact."), }; static const vshCmdOptDef opts_destroy[] =3D { @@ -8416,15 +8131,10 @@ cmdDestroy(vshControl *ctl, const vshCmd *cmd) /* * "desc" command for managing domain description and title */ -static const vshCmdInfo info_desc[] =3D { - {.name =3D "help", - .data =3D N_("show or set domain's description or title") - }, - {.name =3D "desc", - .data =3D N_("Allows setting or modifying the description or title of= " - "a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_desc =3D { + .help =3D N_("show or set domain's description or title"), + .desc =3D N_("Allows setting or modifying the description or title of= " + "a domain."), }; static const vshCmdOptDef opts_desc[] =3D { @@ -8577,14 +8287,9 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) } -static const vshCmdInfo info_metadata[] =3D { - {.name =3D "help", - .data =3D N_("show or set domain's custom XML metadata") - }, - {.name =3D "desc", - .data =3D N_("Shows or modifies the XML metadata of a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_metadata =3D { + .help =3D N_("show or set domain's custom XML metadata"), + .desc =3D N_("Shows or modifies the XML metadata of a domain."), }; static const vshCmdOptDef opts_metadata[] =3D { @@ -8722,14 +8427,9 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd) /* * "inject-nmi" command */ -static const vshCmdInfo info_inject_nmi[] =3D { - {.name =3D "help", - .data =3D N_("Inject NMI to the guest") - }, - {.name =3D "desc", - .data =3D N_("Inject NMI to the guest domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_inject_nmi =3D { + .help =3D N_("Inject NMI to the guest"), + .desc =3D N_("Inject NMI to the guest domain."), }; static const vshCmdOptDef opts_inject_nmi[] =3D { @@ -8754,14 +8454,9 @@ cmdInjectNMI(vshControl *ctl, const vshCmd *cmd) /* * "send-key" command */ -static const vshCmdInfo info_send_key[] =3D { - {.name =3D "help", - .data =3D N_("Send keycodes to the guest") - }, - {.name =3D "desc", - .data =3D N_("Send keycodes (integers or symbolic names) to the guest= ") - }, - {.name =3D NULL} +static const vshCmdInfo info_send_key =3D { + .help =3D N_("Send keycodes to the guest"), + .desc =3D N_("Send keycodes (integers or symbolic names) to the guest"= ), }; static const vshCmdOptDef opts_send_key[] =3D { @@ -8854,14 +8549,9 @@ cmdSendKey(vshControl *ctl, const vshCmd *cmd) /* * "send-process-signal" command */ -static const vshCmdInfo info_send_process_signal[] =3D { - {.name =3D "help", - .data =3D N_("Send signals to processes") - }, - {.name =3D "desc", - .data =3D N_("Send signals to processes in the guest") - }, - {.name =3D NULL} +static const vshCmdInfo info_send_process_signal =3D { + .help =3D N_("Send signals to processes"), + .desc =3D N_("Send signals to processes in the guest"), }; static const vshCmdOptDef opts_send_process_signal[] =3D { @@ -8949,14 +8639,9 @@ cmdSendProcessSignal(vshControl *ctl, const vshCmd *= cmd) /* * "setmem" command */ -static const vshCmdInfo info_setmem[] =3D { - {.name =3D "help", - .data =3D N_("change memory allocation") - }, - {.name =3D "desc", - .data =3D N_("Change the current memory allocation in the guest domai= n.") - }, - {.name =3D NULL} +static const vshCmdInfo info_setmem =3D { + .help =3D N_("change memory allocation"), + .desc =3D N_("Change the current memory allocation in the guest domain= ."), }; static const vshCmdOptDef opts_setmem[] =3D { @@ -9023,14 +8708,9 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd) /* * "setmaxmem" command */ -static const vshCmdInfo info_setmaxmem[] =3D { - {.name =3D "help", - .data =3D N_("change maximum memory limit") - }, - {.name =3D "desc", - .data =3D N_("Change the maximum memory allocation limit in the guest= domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_setmaxmem =3D { + .help =3D N_("change maximum memory limit"), + .desc =3D N_("Change the maximum memory allocation limit in the guest = domain."), }; static const vshCmdOptDef opts_setmaxmem[] =3D { @@ -9095,14 +8775,9 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd) /* * "update-memory-device" command */ -static const vshCmdInfo info_update_memory_device[] =3D { - {.name =3D "help", - .data =3D N_("update memory device of a domain") - }, - {.name =3D "desc", - .data =3D N_("Update values of a memory device of a domain") - }, - {.name =3D NULL} +static const vshCmdInfo info_update_memory_device =3D { + .help =3D N_("update memory device of a domain"), + .desc =3D N_("Update values of a memory device of a domain"), }; static const vshCmdOptDef opts_update_memory_device[] =3D { @@ -9249,14 +8924,9 @@ cmdUpdateMemoryDevice(vshControl *ctl, const vshCmd = *cmd) /* * "memtune" command */ -static const vshCmdInfo info_memtune[] =3D { - {.name =3D "help", - .data =3D N_("Get or set memory parameters") - }, - {.name =3D "desc", - .data =3D N_("Get or set the current memory parameters for a guest do= main.") - }, - {.name =3D NULL} +static const vshCmdInfo info_memtune =3D { + .help =3D N_("Get or set memory parameters"), + .desc =3D N_("Get or set the current memory parameters for a guest dom= ain."), }; static const vshCmdOptDef opts_memtune[] =3D { @@ -9421,14 +9091,9 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd) /* * "perf" command */ -static const vshCmdInfo info_perf[] =3D { - {.name =3D "help", - .data =3D N_("Get or set perf event") - }, - {.name =3D "desc", - .data =3D N_("Get or set the current perf events for a guest domai= n.") - }, - {.name =3D NULL} +static const vshCmdInfo info_perf =3D { + .help =3D N_("Get or set perf event"), + .desc =3D N_("Get or set the current perf events for a guest domain."), }; static const vshCmdOptDef opts_perf[] =3D { @@ -9550,14 +9215,9 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd) /* * "numatune" command */ -static const vshCmdInfo info_numatune[] =3D { - {.name =3D "help", - .data =3D N_("Get or set numa parameters") - }, - {.name =3D "desc", - .data =3D N_("Get or set the current numa parameters for a guest doma= in.") - }, - {.name =3D NULL} +static const vshCmdInfo info_numatune =3D { + .help =3D N_("Get or set numa parameters"), + .desc =3D N_("Get or set the current numa parameters for a guest domai= n."), }; static const vshCmdOptDef opts_numatune[] =3D { @@ -9684,14 +9344,9 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd) /* * "domlaunchsecinfo" command */ -static const vshCmdInfo info_domlaunchsecinfo[] =3D { - {.name =3D "help", - .data =3D N_("Get domain launch security info") - }, - {.name =3D "desc", - .data =3D N_("Get the launch security parameters for a guest domain") - }, - {.name =3D NULL} +static const vshCmdInfo info_domlaunchsecinfo =3D { + .help =3D N_("Get domain launch security info"), + .desc =3D N_("Get the launch security parameters for a guest domain"), }; static const vshCmdOptDef opts_domlaunchsecinfo[] =3D { @@ -9731,14 +9386,9 @@ cmdDomLaunchSecInfo(vshControl * ctl, const vshCmd *= cmd) /* * "domsetlaunchsecstate" command */ -static const vshCmdInfo info_domsetlaunchsecstate[] =3D { - {.name =3D "help", - .data =3D N_("Set domain launch security state") - }, - {.name =3D "desc", - .data =3D N_("Set a secret in the guest domain's memory") - }, - {.name =3D NULL} +static const vshCmdInfo info_domsetlaunchsecstate =3D { + .help =3D N_("Set domain launch security state"), + .desc =3D N_("Set a secret in the guest domain's memory"), }; static const vshCmdOptDef opts_domsetlaunchsecstate[] =3D { @@ -9835,14 +9485,9 @@ cmdDomSetLaunchSecState(vshControl * ctl, const vshC= md * cmd) /* * "dom-fd-associate" command */ -static const vshCmdInfo info_dom_fd_associate[] =3D { - {.name =3D "help", - .data =3D N_("associate a FD with a domain") - }, - {.name =3D "desc", - .data =3D N_("associate a FD with a domain") - }, - {.name =3D NULL} +static const vshCmdInfo info_dom_fd_associate =3D { + .help =3D N_("associate a FD with a domain"), + .desc =3D N_("associate a FD with a domain"), }; static const vshCmdOptDef opts_dom_fd_associate[] =3D { @@ -9904,14 +9549,9 @@ cmdDomFdAssociate(vshControl *ctl, const vshCmd *cmd) /* * "qemu-monitor-command" command */ -static const vshCmdInfo info_qemu_monitor_command[] =3D { - {.name =3D "help", - .data =3D N_("QEMU Monitor Command") - }, - {.name =3D "desc", - .data =3D N_("QEMU Monitor Command") - }, - {.name =3D NULL} +static const vshCmdInfo info_qemu_monitor_command =3D { + .help =3D N_("QEMU Monitor Command"), + .desc =3D N_("QEMU Monitor Command"), }; static const vshCmdOptDef opts_qemu_monitor_command[] =3D { @@ -10156,14 +9796,9 @@ virshEventQemuPrint(virConnectPtr conn G_GNUC_UNUSE= D, vshEventDone(data->ctl); } -static const vshCmdInfo info_qemu_monitor_event[] =3D { - {.name =3D "help", - .data =3D N_("QEMU Monitor Events") - }, - {.name =3D "desc", - .data =3D N_("Listen for QEMU Monitor Events") - }, - {.name =3D NULL} +static const vshCmdInfo info_qemu_monitor_event =3D { + .help =3D N_("QEMU Monitor Events"), + .desc =3D N_("Listen for QEMU Monitor Events"), }; static const vshCmdOptDef opts_qemu_monitor_event[] =3D { @@ -10268,14 +9903,9 @@ cmdQemuMonitorEvent(vshControl *ctl, const vshCmd *= cmd) /* * "qemu-attach" command */ -static const vshCmdInfo info_qemu_attach[] =3D { - {.name =3D "help", - .data =3D N_("QEMU Attach") - }, - {.name =3D "desc", - .data =3D N_("QEMU Attach") - }, - {.name =3D NULL} +static const vshCmdInfo info_qemu_attach =3D { + .help =3D N_("QEMU Attach"), + .desc =3D N_("QEMU Attach"), }; static const vshCmdOptDef opts_qemu_attach[] =3D { @@ -10312,14 +9942,9 @@ cmdQemuAttach(vshControl *ctl, const vshCmd *cmd) /* * "qemu-agent-command" command */ -static const vshCmdInfo info_qemu_agent_command[] =3D { - {.name =3D "help", - .data =3D N_("QEMU Guest Agent Command") - }, - {.name =3D "desc", - .data =3D N_("Run an arbitrary qemu guest agent command; use at your = own risk") - }, - {.name =3D NULL} +static const vshCmdInfo info_qemu_agent_command =3D { + .help =3D N_("QEMU Guest Agent Command"), + .desc =3D N_("Run an arbitrary qemu guest agent command; use at your o= wn risk"), }; static const vshCmdOptDef opts_qemu_agent_command[] =3D { @@ -10426,14 +10051,9 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd = *cmd) /* * "lxc-enter-namespace" namespace */ -static const vshCmdInfo info_lxc_enter_namespace[] =3D { - {.name =3D "help", - .data =3D N_("LXC Guest Enter Namespace") - }, - {.name =3D "desc", - .data =3D N_("Run an arbitrary command in a lxc guest namespace; use = at your own risk") - }, - {.name =3D NULL} +static const vshCmdInfo info_lxc_enter_namespace =3D { + .help =3D N_("LXC Guest Enter Namespace"), + .desc =3D N_("Run an arbitrary command in a lxc guest namespace; use a= t your own risk"), }; static const vshCmdOptDef opts_lxc_enter_namespace[] =3D { @@ -10542,14 +10162,9 @@ cmdLxcEnterNamespace(vshControl *ctl, const vshCmd= *cmd) /* * "dumpxml" command */ -static const vshCmdInfo info_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("domain information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the domain information as an XML dump to stdout.= ") - }, - {.name =3D NULL} +static const vshCmdInfo info_dumpxml =3D { + .help =3D N_("domain information in XML"), + .desc =3D N_("Output the domain information as an XML dump to stdout."= ), }; static const vshCmdOptDef opts_dumpxml[] =3D { @@ -10620,14 +10235,9 @@ cmdDumpXML(vshControl *ctl, const vshCmd *cmd) /* * "domxml-from-native" command */ -static const vshCmdInfo info_domxmlfromnative[] =3D { - {.name =3D "help", - .data =3D N_("Convert native config to domain XML") - }, - {.name =3D "desc", - .data =3D N_("Convert native guest configuration format to domain XML= format.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domxmlfromnative =3D { + .help =3D N_("Convert native config to domain XML"), + .desc =3D N_("Convert native guest configuration format to domain XML = format."), }; static const vshCmdOptDef opts_domxmlfromnative[] =3D { @@ -10673,14 +10283,9 @@ cmdDomXMLFromNative(vshControl *ctl, const vshCmd = *cmd) /* * "domxml-to-native" command */ -static const vshCmdInfo info_domxmltonative[] =3D { - {.name =3D "help", - .data =3D N_("Convert domain XML to native config") - }, - {.name =3D "desc", - .data =3D N_("Convert domain XML config to a native guest configurati= on format.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domxmltonative =3D { + .help =3D N_("Convert domain XML to native config"), + .desc =3D N_("Convert domain XML config to a native guest configuratio= n format."), }; static const vshCmdOptDef opts_domxmltonative[] =3D { @@ -10745,14 +10350,9 @@ cmdDomXMLToNative(vshControl *ctl, const vshCmd *c= md) /* * "domname" command */ -static const vshCmdInfo info_domname[] =3D { - {.name =3D "help", - .data =3D N_("convert a domain id or UUID to domain name") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_domname =3D { + .help =3D N_("convert a domain id or UUID to domain name"), + .desc =3D "", }; static const vshCmdOptDef opts_domname[] =3D { @@ -10781,14 +10381,9 @@ cmdDomname(vshControl *ctl, const vshCmd *cmd) /* * "domrename" command */ -static const vshCmdInfo info_domrename[] =3D { - {.name =3D "help", - .data =3D N_("rename a domain") - }, - {.name =3D "desc", - .data =3D "Rename an inactive domain." - }, - {.name =3D NULL} +static const vshCmdInfo info_domrename =3D { + .help =3D N_("rename a domain"), + .desc =3D "Rename an inactive domain.", }; static const vshCmdOptDef opts_domrename[] =3D { @@ -10826,14 +10421,9 @@ cmdDomrename(vshControl *ctl, const vshCmd *cmd) /* * "domid" command */ -static const vshCmdInfo info_domid[] =3D { - {.name =3D "help", - .data =3D N_("convert a domain name or UUID to domain id") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_domid =3D { + .help =3D N_("convert a domain name or UUID to domain id"), + .desc =3D "", }; static const vshCmdOptDef opts_domid[] =3D { @@ -10863,14 +10453,9 @@ cmdDomid(vshControl *ctl, const vshCmd *cmd) /* * "domuuid" command */ -static const vshCmdInfo info_domuuid[] =3D { - {.name =3D "help", - .data =3D N_("convert a domain name or id to domain UUID") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_domuuid =3D { + .help =3D N_("convert a domain name or id to domain UUID"), + .desc =3D "", }; static const vshCmdOptDef opts_domuuid[] =3D { @@ -10899,14 +10484,9 @@ cmdDomuuid(vshControl *ctl, const vshCmd *cmd) /* * "migrate" command */ -static const vshCmdInfo info_migrate[] =3D { - {.name =3D "help", - .data =3D N_("migrate domain to another host") - }, - {.name =3D "desc", - .data =3D N_("Migrate domain to another host. Add --live for live mi= gration.") - }, - {.name =3D NULL} +static const vshCmdInfo info_migrate =3D { + .help =3D N_("migrate domain to another host"), + .desc =3D N_("Migrate domain to another host. Add --live for live mig= ration."), }; static const vshCmdOptDef opts_migrate[] =3D { @@ -11601,14 +11181,9 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd) /* * "migrate-setmaxdowntime" command */ -static const vshCmdInfo info_migrate_setmaxdowntime[] =3D { - {.name =3D "help", - .data =3D N_("set maximum tolerable downtime") - }, - {.name =3D "desc", - .data =3D N_("Set maximum tolerable downtime of a domain which is bei= ng live-migrated to another host.") - }, - {.name =3D NULL} +static const vshCmdInfo info_migrate_setmaxdowntime =3D { + .help =3D N_("set maximum tolerable downtime"), + .desc =3D N_("Set maximum tolerable downtime of a domain which is bein= g live-migrated to another host."), }; static const vshCmdOptDef opts_migrate_setmaxdowntime[] =3D { @@ -11645,14 +11220,9 @@ cmdMigrateSetMaxDowntime(vshControl *ctl, const vs= hCmd *cmd) /* * "migrate-getmaxdowntime" command */ -static const vshCmdInfo info_migrate_getmaxdowntime[] =3D { - {.name =3D "help", - .data =3D N_("get maximum tolerable downtime") - }, - {.name =3D "desc", - .data =3D N_("Get maximum tolerable downtime of a domain which is bei= ng live-migrated to another host.") - }, - {.name =3D NULL} +static const vshCmdInfo info_migrate_getmaxdowntime =3D { + .help =3D N_("get maximum tolerable downtime"), + .desc =3D N_("Get maximum tolerable downtime of a domain which is bein= g live-migrated to another host."), }; static const vshCmdOptDef opts_migrate_getmaxdowntime[] =3D { @@ -11680,15 +11250,10 @@ cmdMigrateGetMaxDowntime(vshControl *ctl, const v= shCmd *cmd) /* * "migrate-compcache" command */ -static const vshCmdInfo info_migrate_compcache[] =3D { - {.name =3D "help", - .data =3D N_("get/set compression cache size") - }, - {.name =3D "desc", - .data =3D N_("Get/set size of the cache (in bytes) used for compressi= ng " - "repeatedly transferred memory pages during live migration= .") - }, - {.name =3D NULL} +static const vshCmdInfo info_migrate_compcache =3D { + .help =3D N_("get/set compression cache size"), + .desc =3D N_("Get/set size of the cache (in bytes) used for compressi= ng " + "repeatedly transferred memory pages during live migration= ."), }; static const vshCmdOptDef opts_migrate_compcache[] =3D { @@ -11733,15 +11298,10 @@ cmdMigrateCompCache(vshControl *ctl, const vshCmd= *cmd) /* * "migrate-setspeed" command */ -static const vshCmdInfo info_migrate_setspeed[] =3D { - {.name =3D "help", - .data =3D N_("Set the maximum migration bandwidth") - }, - {.name =3D "desc", - .data =3D N_("Set the maximum migration bandwidth (in MiB/s) for a do= main " - "which is being migrated to another host.") - }, - {.name =3D NULL} +static const vshCmdInfo info_migrate_setspeed =3D { + .help =3D N_("Set the maximum migration bandwidth"), + .desc =3D N_("Set the maximum migration bandwidth (in MiB/s) for a do= main " + "which is being migrated to another host."), }; static const vshCmdOptDef opts_migrate_setspeed[] =3D { @@ -11783,14 +11343,9 @@ cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCm= d *cmd) /* * "migrate-getspeed" command */ -static const vshCmdInfo info_migrate_getspeed[] =3D { - {.name =3D "help", - .data =3D N_("Get the maximum migration bandwidth") - }, - {.name =3D "desc", - .data =3D N_("Get the maximum migration bandwidth (in MiB/s) for a do= main.") - }, - {.name =3D NULL} +static const vshCmdInfo info_migrate_getspeed =3D { + .help =3D N_("Get the maximum migration bandwidth"), + .desc =3D N_("Get the maximum migration bandwidth (in MiB/s) for a dom= ain."), }; static const vshCmdOptDef opts_migrate_getspeed[] =3D { @@ -11826,15 +11381,10 @@ cmdMigrateGetMaxSpeed(vshControl *ctl, const vshC= md *cmd) /* * "migrate-postcopy" command */ -static const vshCmdInfo info_migrate_postcopy[] =3D { - {.name =3D "help", - .data =3D N_("Switch running migration from pre-copy to post-copy") - }, - {.name =3D "desc", - .data =3D N_("Switch running migration from pre-copy to post-copy. " - "The migration must have been started with --postcopy opti= on.") - }, - {.name =3D NULL} +static const vshCmdInfo info_migrate_postcopy =3D { + .help =3D N_("Switch running migration from pre-copy to post-copy"), + .desc =3D N_("Switch running migration from pre-copy to post-copy. " + "The migration must have been started with --postcopy opti= on."), }; static const vshCmdOptDef opts_migrate_postcopy[] =3D { @@ -11859,15 +11409,10 @@ cmdMigratePostCopy(vshControl *ctl, const vshCmd = *cmd) /* * "domdisplay" command */ -static const vshCmdInfo info_domdisplay[] =3D { - {.name =3D "help", - .data =3D N_("domain display connection URI") - }, - {.name =3D "desc", - .data =3D N_("Output the IP address and port number " - "for the graphical display.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domdisplay =3D { + .help =3D N_("domain display connection URI"), + .desc =3D N_("Output the IP address and port number " + "for the graphical display."), }; static const vshCmdOptDef opts_domdisplay[] =3D { @@ -12112,14 +11657,9 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) /* * "vncdisplay" command */ -static const vshCmdInfo info_vncdisplay[] =3D { - {.name =3D "help", - .data =3D N_("vnc display") - }, - {.name =3D "desc", - .data =3D N_("Output the IP address and port number for the VNC displ= ay.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vncdisplay =3D { + .help =3D N_("vnc display"), + .desc =3D N_("Output the IP address and port number for the VNC displa= y."), }; static const vshCmdOptDef opts_vncdisplay[] =3D { @@ -12180,14 +11720,9 @@ cmdVNCDisplay(vshControl *ctl, const vshCmd *cmd) /* * "ttyconsole" command */ -static const vshCmdInfo info_ttyconsole[] =3D { - {.name =3D "help", - .data =3D N_("tty console") - }, - {.name =3D "desc", - .data =3D N_("Output the device for the TTY console.") - }, - {.name =3D NULL} +static const vshCmdInfo info_ttyconsole =3D { + .help =3D N_("tty console"), + .desc =3D N_("Output the device for the TTY console."), }; static const vshCmdOptDef opts_ttyconsole[] =3D { @@ -12215,14 +11750,9 @@ cmdTTYConsole(vshControl *ctl, const vshCmd *cmd) /* * "domhostname" command */ -static const vshCmdInfo info_domhostname[] =3D { - {.name =3D "help", - .data =3D N_("print the domain's hostname") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_domhostname =3D { + .help =3D N_("print the domain's hostname"), + .desc =3D "", }; static const vshCmdOptDef opts_domhostname[] =3D { @@ -12287,14 +11817,9 @@ cmdDomHostname(vshControl *ctl, const vshCmd *cmd) /* * "detach-device" command */ -static const vshCmdInfo info_detach_device[] =3D { - {.name =3D "help", - .data =3D N_("detach device from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Detach device from an XML ") - }, - {.name =3D NULL} +static const vshCmdInfo info_detach_device =3D { + .help =3D N_("detach device from an XML file"), + .desc =3D N_("Detach device from an XML "), }; static const vshCmdOptDef opts_detach_device[] =3D { @@ -12363,14 +11888,9 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd) /* * "detach-device-alias" command */ -static const vshCmdInfo info_detach_device_alias[] =3D { - {.name =3D "help", - .data =3D N_("detach device from an alias") - }, - {.name =3D "desc", - .data =3D N_("Detach device identified by the given alias from a doma= in") - }, - {.name =3D NULL} +static const vshCmdInfo info_detach_device_alias =3D { + .help =3D N_("detach device from an alias"), + .desc =3D N_("Detach device identified by the given alias from a domai= n"), }; static const vshCmdOptDef opts_detach_device_alias[] =3D { @@ -12424,14 +11944,9 @@ cmdDetachDeviceAlias(vshControl *ctl, const vshCmd= *cmd) /* * "update-device" command */ -static const vshCmdInfo info_update_device[] =3D { - {.name =3D "help", - .data =3D N_("update device from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Update device from an XML .") - }, - {.name =3D NULL} +static const vshCmdInfo info_update_device =3D { + .help =3D N_("update device from an XML file"), + .desc =3D N_("Update device from an XML ."), }; static const vshCmdOptDef opts_update_device[] =3D { @@ -12501,14 +12016,9 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd) /* * "detach-interface" command */ -static const vshCmdInfo info_detach_interface[] =3D { - {.name =3D "help", - .data =3D N_("detach network interface") - }, - {.name =3D "desc", - .data =3D N_("Detach network interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_detach_interface =3D { + .help =3D N_("detach network interface"), + .desc =3D N_("Detach network interface."), }; static const vshCmdOptDef opts_detach_interface[] =3D { @@ -12878,14 +12388,9 @@ virshUpdateDiskXML(xmlNodePtr disk_node, /* * "detach-disk" command */ -static const vshCmdInfo info_detach_disk[] =3D { - {.name =3D "help", - .data =3D N_("detach disk device") - }, - {.name =3D "desc", - .data =3D N_("Detach disk device.") - }, - {.name =3D NULL} +static const vshCmdInfo info_detach_disk =3D { + .help =3D N_("detach disk device"), + .desc =3D N_("Detach disk device."), }; static const vshCmdOptDef opts_detach_disk[] =3D { @@ -12980,14 +12485,9 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd) /* * "edit" command */ -static const vshCmdInfo info_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML configuration for a domain") - }, - {.name =3D "desc", - .data =3D N_("Edit the XML configuration for a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_edit =3D { + .help =3D N_("edit XML configuration for a domain"), + .desc =3D N_("Edit the XML configuration for a domain."), }; static const vshCmdOptDef opts_edit[] =3D { @@ -13048,14 +12548,9 @@ cmdEdit(vshControl *ctl, const vshCmd *cmd) /* * "change-media" command */ -static const vshCmdInfo info_change_media[] =3D { - {.name =3D "help", - .data =3D N_("Change media of CD or floppy drive") - }, - {.name =3D "desc", - .data =3D N_("Change media of CD or floppy drive.") - }, - {.name =3D NULL} +static const vshCmdInfo info_change_media =3D { + .help =3D N_("Change media of CD or floppy drive"), + .desc =3D N_("Change media of CD or floppy drive."), }; static const vshCmdOptDef opts_change_media[] =3D { @@ -13202,14 +12697,9 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd) return true; } -static const vshCmdInfo info_domfstrim[] =3D { - {.name =3D "help", - .data =3D N_("Invoke fstrim on domain's mounted filesystems.") - }, - {.name =3D "desc", - .data =3D N_("Invoke fstrim on domain's mounted filesystems.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domfstrim =3D { + .help =3D N_("Invoke fstrim on domain's mounted filesystems."), + .desc =3D N_("Invoke fstrim on domain's mounted filesystems."), }; static const vshCmdOptDef opts_domfstrim[] =3D { @@ -13251,14 +12741,9 @@ cmdDomFSTrim(vshControl *ctl, const vshCmd *cmd) return true; } -static const vshCmdInfo info_domfsfreeze[] =3D { - {.name =3D "help", - .data =3D N_("Freeze domain's mounted filesystems.") - }, - {.name =3D "desc", - .data =3D N_("Freeze domain's mounted filesystems.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domfsfreeze =3D { + .help =3D N_("Freeze domain's mounted filesystems."), + .desc =3D N_("Freeze domain's mounted filesystems."), }; static const vshCmdOptDef opts_domfsfreeze[] =3D { @@ -13296,14 +12781,9 @@ cmdDomFSFreeze(vshControl *ctl, const vshCmd *cmd) return true; } -static const vshCmdInfo info_domfsthaw[] =3D { - {.name =3D "help", - .data =3D N_("Thaw domain's mounted filesystems.") - }, - {.name =3D "desc", - .data =3D N_("Thaw domain's mounted filesystems.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domfsthaw =3D { + .help =3D N_("Thaw domain's mounted filesystems."), + .desc =3D N_("Thaw domain's mounted filesystems."), }; static const vshCmdOptDef opts_domfsthaw[] =3D { @@ -13341,14 +12821,9 @@ cmdDomFSThaw(vshControl *ctl, const vshCmd *cmd) return true; } -static const vshCmdInfo info_domfsinfo[] =3D { - {.name =3D "help", - .data =3D N_("Get information of domain's mounted filesystems.") - }, - {.name =3D "desc", - .data =3D N_("Get information of domain's mounted filesystems.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domfsinfo =3D { + .help =3D N_("Get information of domain's mounted filesystems."), + .desc =3D N_("Get information of domain's mounted filesystems."), }; static const vshCmdOptDef opts_domfsinfo[] =3D { @@ -13424,14 +12899,9 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd) /* * "guest-agent-timeout" command */ -static const vshCmdInfo info_guest_agent_timeout[] =3D { - {.name =3D "help", - .data =3D N_("Set the guest agent timeout") - }, - {.name =3D "desc", - .data =3D N_("Set the number of seconds to wait for a response from t= he guest agent.") - }, - {.name =3D NULL} +static const vshCmdInfo info_guest_agent_timeout =3D { + .help =3D N_("Set the guest agent timeout"), + .desc =3D N_("Set the number of seconds to wait for a response from th= e guest agent."), }; static const vshCmdOptDef opts_guest_agent_timeout[] =3D { @@ -13466,15 +12936,10 @@ cmdGuestAgentTimeout(vshControl *ctl, const vshCm= d *cmd) /* * "guestinfo" command */ -static const vshCmdInfo info_guestinfo[] =3D { - {.name =3D "help", - .data =3D N_("query information about the guest (via agent)") - }, - {.name =3D "desc", - .data =3D N_("Use the guest agent to query various information from g= uest's " - "point of view") - }, - {.name =3D NULL} +static const vshCmdInfo info_guestinfo =3D { + .help =3D N_("query information about the guest (via agent)"), + .desc =3D N_("Use the guest agent to query various information from g= uest's " + "point of view"), }; static const vshCmdOptDef opts_guestinfo[] =3D { @@ -13556,15 +13021,10 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) /* * "get-user-sshkeys" command */ -static const vshCmdInfo info_get_user_sshkeys[] =3D { - {.name =3D "help", - .data =3D N_("list authorized SSH keys for given user (via agent)") - }, - {.name =3D "desc", - .data =3D N_("Use the guest agent to query authorized SSH keys for gi= ven " - "user") - }, - {.name =3D NULL} +static const vshCmdInfo info_get_user_sshkeys =3D { + .help =3D N_("list authorized SSH keys for given user (via agent)"), + .desc =3D N_("Use the guest agent to query authorized SSH keys for gi= ven " + "user"), }; static const vshCmdOptDef opts_get_user_sshkeys[] =3D { @@ -13608,15 +13068,10 @@ cmdGetUserSSHKeys(vshControl *ctl, const vshCmd *= cmd) /* * "set-user-sshkeys" command */ -static const vshCmdInfo info_set_user_sshkeys[] =3D { - {.name =3D "help", - .data =3D N_("manipulate authorized SSH keys file for given user (via= agent)") - }, - {.name =3D "desc", - .data =3D N_("Append, reset or remove specified key from the authoriz= ed " - "keys file for given user") - }, - {.name =3D NULL} +static const vshCmdInfo info_set_user_sshkeys =3D { + .help =3D N_("manipulate authorized SSH keys file for given user (via = agent)"), + .desc =3D N_("Append, reset or remove specified key from the authorize= d " + "keys file for given user") }; static const vshCmdOptDef opts_set_user_sshkeys[] =3D { @@ -13706,17 +13161,12 @@ cmdSetUserSSHKeys(vshControl *ctl, const vshCmd *= cmd) /* * "domdirtyrate" command */ -static const vshCmdInfo info_domdirtyrate_calc[] =3D { - {.name =3D "help", - .data =3D N_("Calculate a vm's memory dirty rate") - }, - {.name =3D "desc", - .data =3D N_("Calculate memory dirty rate of a domain in order to " +static const vshCmdInfo info_domdirtyrate_calc =3D { + .help =3D N_("Calculate a vm's memory dirty rate"), + .desc =3D N_("Calculate memory dirty rate of a domain in order to " "decide whether it's proper to be migrated out or not.\n" "The calculated dirty rate information is available by " - "calling 'domstats --dirtyrate'.") - }, - {.name =3D NULL} + "calling 'domstats --dirtyrate'."), }; static const vshCmdOptDef opts_domdirtyrate_calc[] =3D { @@ -13792,14 +13242,9 @@ cmdDomDirtyRateCalc(vshControl *ctl, const vshCmd = *cmd) /** * "domdisplay-reload" command */ -static const vshCmdInfo info_domdisplay_reload[] =3D { - {.name =3D "help", - .data =3D N_("Reload domain's graphics display certificates") - }, - {.name =3D "desc", - .data =3D N_("Reload domain's graphics display certificates") - }, - {.name =3D NULL} +static const vshCmdInfo info_domdisplay_reload =3D { + .help =3D N_("Reload domain's graphics display certificates"), + .desc =3D N_("Reload domain's graphics display certificates"), }; static const vshCmdOptDef opts_domdisplay_reload[] =3D { @@ -13833,669 +13278,669 @@ const vshCmdDef domManagementCmds[] =3D { {.name =3D "attach-device", .handler =3D cmdAttachDevice, .opts =3D opts_attach_device, - .info =3D info_attach_device, + .info =3D &info_attach_device, .flags =3D 0 }, {.name =3D "attach-disk", .handler =3D cmdAttachDisk, .opts =3D opts_attach_disk, - .info =3D info_attach_disk, + .info =3D &info_attach_disk, .flags =3D 0 }, {.name =3D "attach-interface", .handler =3D cmdAttachInterface, .opts =3D opts_attach_interface, - .info =3D info_attach_interface, + .info =3D &info_attach_interface, .flags =3D 0 }, {.name =3D "autostart", .handler =3D cmdAutostart, .opts =3D opts_autostart, - .info =3D info_autostart, + .info =3D &info_autostart, .flags =3D 0 }, {.name =3D "blkdeviotune", .handler =3D cmdBlkdeviotune, .opts =3D opts_blkdeviotune, - .info =3D info_blkdeviotune, + .info =3D &info_blkdeviotune, .flags =3D 0 }, {.name =3D "blkiotune", .handler =3D cmdBlkiotune, .opts =3D opts_blkiotune, - .info =3D info_blkiotune, + .info =3D &info_blkiotune, .flags =3D 0 }, {.name =3D "blockcommit", .handler =3D cmdBlockcommit, .opts =3D opts_blockcommit, - .info =3D info_blockcommit, + .info =3D &info_blockcommit, .flags =3D 0 }, {.name =3D "blockcopy", .handler =3D cmdBlockcopy, .opts =3D opts_blockcopy, - .info =3D info_blockcopy, + .info =3D &info_blockcopy, .flags =3D 0 }, {.name =3D "blockjob", .handler =3D cmdBlockjob, .opts =3D opts_blockjob, - .info =3D info_blockjob, + .info =3D &info_blockjob, .flags =3D 0 }, {.name =3D "blockpull", .handler =3D cmdBlockpull, .opts =3D opts_blockpull, - .info =3D info_blockpull, + .info =3D &info_blockpull, .flags =3D 0 }, {.name =3D "blockresize", .handler =3D cmdBlockresize, .opts =3D opts_blockresize, - .info =3D info_blockresize, + .info =3D &info_blockresize, .flags =3D 0 }, {.name =3D "change-media", .handler =3D cmdChangeMedia, .opts =3D opts_change_media, - .info =3D info_change_media, + .info =3D &info_change_media, .flags =3D 0 }, #ifndef WIN32 {.name =3D "console", .handler =3D cmdConsole, .opts =3D opts_console, - .info =3D info_console, + .info =3D &info_console, .flags =3D 0 }, #endif {.name =3D "cpu-stats", .handler =3D cmdCPUStats, .opts =3D opts_cpu_stats, - .info =3D info_cpu_stats, + .info =3D &info_cpu_stats, .flags =3D 0 }, {.name =3D "create", .handler =3D cmdCreate, .opts =3D opts_create, - .info =3D info_create, + .info =3D &info_create, .flags =3D 0 }, {.name =3D "define", .handler =3D cmdDefine, .opts =3D opts_define, - .info =3D info_define, + .info =3D &info_define, .flags =3D 0 }, {.name =3D "desc", .handler =3D cmdDesc, .opts =3D opts_desc, - .info =3D info_desc, + .info =3D &info_desc, .flags =3D 0 }, {.name =3D "destroy", .handler =3D cmdDestroy, .opts =3D opts_destroy, - .info =3D info_destroy, + .info =3D &info_destroy, .flags =3D 0 }, {.name =3D "detach-device", .handler =3D cmdDetachDevice, .opts =3D opts_detach_device, - .info =3D info_detach_device, + .info =3D &info_detach_device, .flags =3D 0 }, {.name =3D "detach-device-alias", .handler =3D cmdDetachDeviceAlias, .opts =3D opts_detach_device_alias, - .info =3D info_detach_device_alias, + .info =3D &info_detach_device_alias, .flags =3D 0 }, {.name =3D "detach-disk", .handler =3D cmdDetachDisk, .opts =3D opts_detach_disk, - .info =3D info_detach_disk, + .info =3D &info_detach_disk, .flags =3D 0 }, {.name =3D "detach-interface", .handler =3D cmdDetachInterface, .opts =3D opts_detach_interface, - .info =3D info_detach_interface, + .info =3D &info_detach_interface, .flags =3D 0 }, {.name =3D "domdisplay", .handler =3D cmdDomDisplay, .opts =3D opts_domdisplay, - .info =3D info_domdisplay, + .info =3D &info_domdisplay, .flags =3D 0 }, {.name =3D "domfsfreeze", .handler =3D cmdDomFSFreeze, .opts =3D opts_domfsfreeze, - .info =3D info_domfsfreeze, + .info =3D &info_domfsfreeze, .flags =3D 0 }, {.name =3D "domfsthaw", .handler =3D cmdDomFSThaw, .opts =3D opts_domfsthaw, - .info =3D info_domfsthaw, + .info =3D &info_domfsthaw, .flags =3D 0 }, {.name =3D "domfsinfo", .handler =3D cmdDomFSInfo, .opts =3D opts_domfsinfo, - .info =3D info_domfsinfo, + .info =3D &info_domfsinfo, .flags =3D 0 }, {.name =3D "domfstrim", .handler =3D cmdDomFSTrim, .opts =3D opts_domfstrim, - .info =3D info_domfstrim, + .info =3D &info_domfstrim, .flags =3D 0 }, {.name =3D "domhostname", .handler =3D cmdDomHostname, .opts =3D opts_domhostname, - .info =3D info_domhostname, + .info =3D &info_domhostname, .flags =3D 0 }, {.name =3D "domid", .handler =3D cmdDomid, .opts =3D opts_domid, - .info =3D info_domid, + .info =3D &info_domid, .flags =3D 0 }, {.name =3D "domif-setlink", .handler =3D cmdDomIfSetLink, .opts =3D opts_domif_setlink, - .info =3D info_domif_setlink, + .info =3D &info_domif_setlink, .flags =3D 0 }, {.name =3D "domiftune", .handler =3D cmdDomIftune, .opts =3D opts_domiftune, - .info =3D info_domiftune, + .info =3D &info_domiftune, .flags =3D 0 }, {.name =3D "domjobabort", .handler =3D cmdDomjobabort, .opts =3D opts_domjobabort, - .info =3D info_domjobabort, + .info =3D &info_domjobabort, .flags =3D 0 }, {.name =3D "domjobinfo", .handler =3D cmdDomjobinfo, .opts =3D opts_domjobinfo, - .info =3D info_domjobinfo, + .info =3D &info_domjobinfo, .flags =3D 0 }, {.name =3D "domlaunchsecinfo", .handler =3D cmdDomLaunchSecInfo, .opts =3D opts_domlaunchsecinfo, - .info =3D info_domlaunchsecinfo, + .info =3D &info_domlaunchsecinfo, .flags =3D 0 }, {.name =3D "domsetlaunchsecstate", .handler =3D cmdDomSetLaunchSecState, .opts =3D opts_domsetlaunchsecstate, - .info =3D info_domsetlaunchsecstate, + .info =3D &info_domsetlaunchsecstate, .flags =3D 0 }, {.name =3D "domname", .handler =3D cmdDomname, .opts =3D opts_domname, - .info =3D info_domname, + .info =3D &info_domname, .flags =3D 0 }, {.name =3D "domrename", .handler =3D cmdDomrename, .opts =3D opts_domrename, - .info =3D info_domrename, + .info =3D &info_domrename, .flags =3D 0 }, {.name =3D "dompmsuspend", .handler =3D cmdDomPMSuspend, .opts =3D opts_dom_pm_suspend, - .info =3D info_dom_pm_suspend, + .info =3D &info_dom_pm_suspend, .flags =3D 0 }, {.name =3D "dompmwakeup", .handler =3D cmdDomPMWakeup, .opts =3D opts_dom_pm_wakeup, - .info =3D info_dom_pm_wakeup, + .info =3D &info_dom_pm_wakeup, .flags =3D 0 }, {.name =3D "domuuid", .handler =3D cmdDomuuid, .opts =3D opts_domuuid, - .info =3D info_domuuid, + .info =3D &info_domuuid, .flags =3D 0 }, {.name =3D "domxml-from-native", .handler =3D cmdDomXMLFromNative, .opts =3D opts_domxmlfromnative, - .info =3D info_domxmlfromnative, + .info =3D &info_domxmlfromnative, .flags =3D 0 }, {.name =3D "domxml-to-native", .handler =3D cmdDomXMLToNative, .opts =3D opts_domxmltonative, - .info =3D info_domxmltonative, + .info =3D &info_domxmltonative, .flags =3D 0 }, {.name =3D "dump", .handler =3D cmdDump, .opts =3D opts_dump, - .info =3D info_dump, + .info =3D &info_dump, .flags =3D 0 }, {.name =3D "dumpxml", .handler =3D cmdDumpXML, .opts =3D opts_dumpxml, - .info =3D info_dumpxml, + .info =3D &info_dumpxml, .flags =3D 0 }, {.name =3D "edit", .handler =3D cmdEdit, .opts =3D opts_edit, - .info =3D info_edit, + .info =3D &info_edit, .flags =3D 0 }, {.name =3D "get-user-sshkeys", .handler =3D cmdGetUserSSHKeys, .opts =3D opts_get_user_sshkeys, - .info =3D info_get_user_sshkeys, + .info =3D &info_get_user_sshkeys, .flags =3D 0 }, {.name =3D "inject-nmi", .handler =3D cmdInjectNMI, .opts =3D opts_inject_nmi, - .info =3D info_inject_nmi, + .info =3D &info_inject_nmi, .flags =3D 0 }, {.name =3D "iothreadinfo", .handler =3D cmdIOThreadInfo, .opts =3D opts_iothreadinfo, - .info =3D info_iothreadinfo, + .info =3D &info_iothreadinfo, .flags =3D 0 }, {.name =3D "iothreadpin", .handler =3D cmdIOThreadPin, .opts =3D opts_iothreadpin, - .info =3D info_iothreadpin, + .info =3D &info_iothreadpin, .flags =3D 0 }, {.name =3D "iothreadadd", .handler =3D cmdIOThreadAdd, .opts =3D opts_iothreadadd, - .info =3D info_iothreadadd, + .info =3D &info_iothreadadd, .flags =3D 0 }, {.name =3D "iothreadset", .handler =3D cmdIOThreadSet, .opts =3D opts_iothreadset, - .info =3D info_iothreadset, + .info =3D &info_iothreadset, .flags =3D 0 }, {.name =3D "iothreaddel", .handler =3D cmdIOThreadDel, .opts =3D opts_iothreaddel, - .info =3D info_iothreaddel, + .info =3D &info_iothreaddel, .flags =3D 0 }, {.name =3D "send-key", .handler =3D cmdSendKey, .opts =3D opts_send_key, - .info =3D info_send_key, + .info =3D &info_send_key, .flags =3D 0 }, {.name =3D "send-process-signal", .handler =3D cmdSendProcessSignal, .opts =3D opts_send_process_signal, - .info =3D info_send_process_signal, + .info =3D &info_send_process_signal, .flags =3D 0 }, {.name =3D "lxc-enter-namespace", .handler =3D cmdLxcEnterNamespace, .opts =3D opts_lxc_enter_namespace, - .info =3D info_lxc_enter_namespace, + .info =3D &info_lxc_enter_namespace, .flags =3D 0 }, {.name =3D "managedsave", .handler =3D cmdManagedSave, .opts =3D opts_managedsave, - .info =3D info_managedsave, + .info =3D &info_managedsave, .flags =3D 0 }, {.name =3D "managedsave-remove", .handler =3D cmdManagedSaveRemove, .opts =3D opts_managedsaveremove, - .info =3D info_managedsaveremove, + .info =3D &info_managedsaveremove, .flags =3D 0 }, {.name =3D "managedsave-edit", .handler =3D cmdManagedSaveEdit, .opts =3D opts_managed_save_edit, - .info =3D info_managed_save_edit, + .info =3D &info_managed_save_edit, .flags =3D 0 }, {.name =3D "managedsave-dumpxml", .handler =3D cmdManagedSaveDumpxml, .opts =3D opts_managed_save_dumpxml, - .info =3D info_managed_save_dumpxml, + .info =3D &info_managed_save_dumpxml, .flags =3D 0 }, {.name =3D "managedsave-define", .handler =3D cmdManagedSaveDefine, .opts =3D opts_managed_save_define, - .info =3D info_managed_save_define, + .info =3D &info_managed_save_define, .flags =3D 0 }, {.name =3D "memtune", .handler =3D cmdMemtune, .opts =3D opts_memtune, - .info =3D info_memtune, + .info =3D &info_memtune, .flags =3D 0 }, {.name =3D "perf", .handler =3D cmdPerf, .opts =3D opts_perf, - .info =3D info_perf, + .info =3D &info_perf, .flags =3D 0 }, {.name =3D "metadata", .handler =3D cmdMetadata, .opts =3D opts_metadata, - .info =3D info_metadata, + .info =3D &info_metadata, .flags =3D 0 }, {.name =3D "migrate", .handler =3D cmdMigrate, .opts =3D opts_migrate, - .info =3D info_migrate, + .info =3D &info_migrate, .flags =3D 0 }, {.name =3D "migrate-setmaxdowntime", .handler =3D cmdMigrateSetMaxDowntime, .opts =3D opts_migrate_setmaxdowntime, - .info =3D info_migrate_setmaxdowntime, + .info =3D &info_migrate_setmaxdowntime, .flags =3D 0 }, {.name =3D "migrate-getmaxdowntime", .handler =3D cmdMigrateGetMaxDowntime, .opts =3D opts_migrate_getmaxdowntime, - .info =3D info_migrate_getmaxdowntime, + .info =3D &info_migrate_getmaxdowntime, .flags =3D 0 }, {.name =3D "migrate-compcache", .handler =3D cmdMigrateCompCache, .opts =3D opts_migrate_compcache, - .info =3D info_migrate_compcache, + .info =3D &info_migrate_compcache, .flags =3D 0 }, {.name =3D "migrate-setspeed", .handler =3D cmdMigrateSetMaxSpeed, .opts =3D opts_migrate_setspeed, - .info =3D info_migrate_setspeed, + .info =3D &info_migrate_setspeed, .flags =3D 0 }, {.name =3D "migrate-getspeed", .handler =3D cmdMigrateGetMaxSpeed, .opts =3D opts_migrate_getspeed, - .info =3D info_migrate_getspeed, + .info =3D &info_migrate_getspeed, .flags =3D 0 }, {.name =3D "migrate-postcopy", .handler =3D cmdMigratePostCopy, .opts =3D opts_migrate_postcopy, - .info =3D info_migrate_postcopy, + .info =3D &info_migrate_postcopy, .flags =3D 0 }, {.name =3D "numatune", .handler =3D cmdNumatune, .opts =3D opts_numatune, - .info =3D info_numatune, + .info =3D &info_numatune, .flags =3D 0 }, {.name =3D "qemu-attach", .handler =3D cmdQemuAttach, .opts =3D opts_qemu_attach, - .info =3D info_qemu_attach, + .info =3D &info_qemu_attach, .flags =3D 0 }, {.name =3D "qemu-monitor-command", .handler =3D cmdQemuMonitorCommand, .opts =3D opts_qemu_monitor_command, - .info =3D info_qemu_monitor_command, + .info =3D &info_qemu_monitor_command, .flags =3D 0 }, {.name =3D "qemu-monitor-event", .handler =3D cmdQemuMonitorEvent, .opts =3D opts_qemu_monitor_event, - .info =3D info_qemu_monitor_event, + .info =3D &info_qemu_monitor_event, .flags =3D 0 }, {.name =3D "qemu-agent-command", .handler =3D cmdQemuAgentCommand, .opts =3D opts_qemu_agent_command, - .info =3D info_qemu_agent_command, + .info =3D &info_qemu_agent_command, .flags =3D 0 }, {.name =3D "guest-agent-timeout", .handler =3D cmdGuestAgentTimeout, .opts =3D opts_guest_agent_timeout, - .info =3D info_guest_agent_timeout, + .info =3D &info_guest_agent_timeout, .flags =3D 0 }, {.name =3D "reboot", .handler =3D cmdReboot, .opts =3D opts_reboot, - .info =3D info_reboot, + .info =3D &info_reboot, .flags =3D 0 }, {.name =3D "reset", .handler =3D cmdReset, .opts =3D opts_reset, - .info =3D info_reset, + .info =3D &info_reset, .flags =3D 0 }, {.name =3D "restore", .handler =3D cmdRestore, .opts =3D opts_restore, - .info =3D info_restore, + .info =3D &info_restore, .flags =3D 0 }, {.name =3D "resume", .handler =3D cmdResume, .opts =3D opts_resume, - .info =3D info_resume, + .info =3D &info_resume, .flags =3D 0 }, {.name =3D "save", .handler =3D cmdSave, .opts =3D opts_save, - .info =3D info_save, + .info =3D &info_save, .flags =3D 0 }, {.name =3D "save-image-define", .handler =3D cmdSaveImageDefine, .opts =3D opts_save_image_define, - .info =3D info_save_image_define, + .info =3D &info_save_image_define, .flags =3D 0 }, {.name =3D "save-image-dumpxml", .handler =3D cmdSaveImageDumpxml, .opts =3D opts_save_image_dumpxml, - .info =3D info_save_image_dumpxml, + .info =3D &info_save_image_dumpxml, .flags =3D 0 }, {.name =3D "save-image-edit", .handler =3D cmdSaveImageEdit, .opts =3D opts_save_image_edit, - .info =3D info_save_image_edit, + .info =3D &info_save_image_edit, .flags =3D 0 }, {.name =3D "schedinfo", .handler =3D cmdSchedinfo, .opts =3D opts_schedinfo, - .info =3D info_schedinfo, + .info =3D &info_schedinfo, .flags =3D 0 }, {.name =3D "screenshot", .handler =3D cmdScreenshot, .opts =3D opts_screenshot, - .info =3D info_screenshot, + .info =3D &info_screenshot, .flags =3D 0 }, {.name =3D "set-lifecycle-action", .handler =3D cmdSetLifecycleAction, .opts =3D opts_setLifecycleAction, - .info =3D info_setLifecycleAction, + .info =3D &info_setLifecycleAction, .flags =3D 0 }, {.name =3D "set-user-sshkeys", .handler =3D cmdSetUserSSHKeys, .opts =3D opts_set_user_sshkeys, - .info =3D info_set_user_sshkeys, + .info =3D &info_set_user_sshkeys, .flags =3D 0 }, {.name =3D "set-user-password", .handler =3D cmdSetUserPassword, .opts =3D opts_set_user_password, - .info =3D info_set_user_password, + .info =3D &info_set_user_password, .flags =3D 0 }, {.name =3D "setmaxmem", .handler =3D cmdSetmaxmem, .opts =3D opts_setmaxmem, - .info =3D info_setmaxmem, + .info =3D &info_setmaxmem, .flags =3D 0 }, {.name =3D "setmem", .handler =3D cmdSetmem, .opts =3D opts_setmem, - .info =3D info_setmem, + .info =3D &info_setmem, .flags =3D 0 }, {.name =3D "setvcpus", .handler =3D cmdSetvcpus, .opts =3D opts_setvcpus, - .info =3D info_setvcpus, + .info =3D &info_setvcpus, .flags =3D 0 }, {.name =3D "shutdown", .handler =3D cmdShutdown, .opts =3D opts_shutdown, - .info =3D info_shutdown, + .info =3D &info_shutdown, .flags =3D 0 }, {.name =3D "start", .handler =3D cmdStart, .opts =3D opts_start, - .info =3D info_start, + .info =3D &info_start, .flags =3D 0 }, {.name =3D "suspend", .handler =3D cmdSuspend, .opts =3D opts_suspend, - .info =3D info_suspend, + .info =3D &info_suspend, .flags =3D 0 }, {.name =3D "ttyconsole", .handler =3D cmdTTYConsole, .opts =3D opts_ttyconsole, - .info =3D info_ttyconsole, + .info =3D &info_ttyconsole, .flags =3D 0 }, {.name =3D "undefine", .handler =3D cmdUndefine, .opts =3D opts_undefine, - .info =3D info_undefine, + .info =3D &info_undefine, .flags =3D 0 }, {.name =3D "update-device", .handler =3D cmdUpdateDevice, .opts =3D opts_update_device, - .info =3D info_update_device, + .info =3D &info_update_device, .flags =3D 0 }, {.name =3D "update-memory-device", .handler =3D cmdUpdateMemoryDevice, .opts =3D opts_update_memory_device, - .info =3D info_update_memory_device, + .info =3D &info_update_memory_device, .flags =3D 0 }, {.name =3D "vcpucount", .handler =3D cmdVcpucount, .opts =3D opts_vcpucount, - .info =3D info_vcpucount, + .info =3D &info_vcpucount, .flags =3D 0 }, {.name =3D "vcpuinfo", .handler =3D cmdVcpuinfo, .opts =3D opts_vcpuinfo, - .info =3D info_vcpuinfo, + .info =3D &info_vcpuinfo, .flags =3D 0 }, {.name =3D "vcpupin", .handler =3D cmdVcpuPin, .opts =3D opts_vcpupin, - .info =3D info_vcpupin, + .info =3D &info_vcpupin, .flags =3D 0 }, {.name =3D "emulatorpin", .handler =3D cmdEmulatorPin, .opts =3D opts_emulatorpin, - .info =3D info_emulatorpin, + .info =3D &info_emulatorpin, .flags =3D 0 }, {.name =3D "vncdisplay", .handler =3D cmdVNCDisplay, .opts =3D opts_vncdisplay, - .info =3D info_vncdisplay, + .info =3D &info_vncdisplay, .flags =3D 0 }, {.name =3D "guestvcpus", .handler =3D cmdGuestvcpus, .opts =3D opts_guestvcpus, - .info =3D info_guestvcpus, + .info =3D &info_guestvcpus, .flags =3D 0 }, {.name =3D "setvcpu", .handler =3D cmdSetvcpu, .opts =3D opts_setvcpu, - .info =3D info_setvcpu, + .info =3D &info_setvcpu, .flags =3D 0 }, {.name =3D "domblkthreshold", .handler =3D cmdDomblkthreshold, .opts =3D opts_domblkthreshold, - .info =3D info_domblkthreshold, + .info =3D &info_domblkthreshold, .flags =3D 0 }, {.name =3D "guestinfo", .handler =3D cmdGuestInfo, .opts =3D opts_guestinfo, - .info =3D info_guestinfo, + .info =3D &info_guestinfo, .flags =3D 0 }, {.name =3D "domdirtyrate-calc", .handler =3D cmdDomDirtyRateCalc, .opts =3D opts_domdirtyrate_calc, - .info =3D info_domdirtyrate_calc, + .info =3D &info_domdirtyrate_calc, .flags =3D 0 }, {.name =3D "dom-fd-associate", .handler =3D cmdDomFdAssociate, .opts =3D opts_dom_fd_associate, - .info =3D info_dom_fd_associate, + .info =3D &info_dom_fd_associate, .flags =3D 0 }, {.name =3D "domdisplay-reload", .handler =3D cmdDomdisplayReload, .opts =3D opts_domdisplay_reload, - .info =3D info_domdisplay_reload, + .info =3D &info_domdisplay_reload, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 87443220bd..1a97f4926b 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -37,14 +37,9 @@ /* * "capabilities" command */ -static const vshCmdInfo info_capabilities[] =3D { - {.name =3D "help", - .data =3D N_("capabilities") - }, - {.name =3D "desc", - .data =3D N_("Returns capabilities of hypervisor/driver.") - }, - {.name =3D NULL} +static const vshCmdInfo info_capabilities =3D { + .help =3D N_("capabilities"), + .desc =3D N_("Returns capabilities of hypervisor/driver."), }; static const vshCmdOptDef opts_capabilities[] =3D { @@ -83,14 +78,9 @@ cmdCapabilities(vshControl *ctl, const vshCmd *cmd) /* * "domcapabilities" command */ -static const vshCmdInfo info_domcapabilities[] =3D { - {.name =3D "help", - .data =3D N_("domain capabilities") - }, - {.name =3D "desc", - .data =3D N_("Returns capabilities of emulator with respect to host a= nd libvirt.") - }, - {.name =3D NULL} +static const vshCmdInfo info_domcapabilities =3D { + .help =3D N_("domain capabilities"), + .desc =3D N_("Returns capabilities of emulator with respect to host an= d libvirt."), }; static const vshCmdOptDef opts_domcapabilities[] =3D { @@ -158,14 +148,9 @@ cmdDomCapabilities(vshControl *ctl, const vshCmd *cmd) /* * "freecell" command */ -static const vshCmdInfo info_freecell[] =3D { - {.name =3D "help", - .data =3D N_("NUMA free memory") - }, - {.name =3D "desc", - .data =3D N_("display available free memory for the NUMA cell.") - }, - {.name =3D NULL} +static const vshCmdInfo info_freecell =3D { + .help =3D N_("NUMA free memory"), + .desc =3D N_("display available free memory for the NUMA cell."), }; static const vshCmdOptDef opts_freecell[] =3D { @@ -271,14 +256,9 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd) /* * "freepages" command */ -static const vshCmdInfo info_freepages[] =3D { - {.name =3D "help", - .data =3D N_("NUMA free pages") - }, - {.name =3D "desc", - .data =3D N_("display available free pages for the NUMA cell.") - }, - {.name =3D NULL} +static const vshCmdInfo info_freepages =3D { + .help =3D N_("NUMA free pages"), + .desc =3D N_("display available free pages for the NUMA cell."), }; static const vshCmdOptDef opts_freepages[] =3D { @@ -481,14 +461,9 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) /* * "allocpages" command */ -static const vshCmdInfo info_allocpages[] =3D { - {.name =3D "help", - .data =3D N_("Manipulate pages pool size") - }, - {.name =3D "desc", - .data =3D N_("Allocate or free some pages in the pool for NUMA cell.") - }, - {.name =3D NULL} +static const vshCmdInfo info_allocpages =3D { + .help =3D N_("Manipulate pages pool size"), + .desc =3D N_("Allocate or free some pages in the pool for NUMA cell."), }; static const vshCmdOptDef opts_allocpages[] =3D { {.name =3D "pagesize", @@ -597,14 +572,9 @@ cmdAllocpages(vshControl *ctl, const vshCmd *cmd) /* * "maxvcpus" command */ -static const vshCmdInfo info_maxvcpus[] =3D { - {.name =3D "help", - .data =3D N_("connection vcpu maximum") - }, - {.name =3D "desc", - .data =3D N_("Show maximum number of virtual CPUs for guests on this = connection.") - }, - {.name =3D NULL} +static const vshCmdInfo info_maxvcpus =3D { + .help =3D N_("connection vcpu maximum"), + .desc =3D N_("Show maximum number of virtual CPUs for guests on this c= onnection."), }; static const vshCmdOptDef opts_maxvcpus[] =3D { @@ -650,14 +620,9 @@ cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd) /* * "nodeinfo" command */ -static const vshCmdInfo info_nodeinfo[] =3D { - {.name =3D "help", - .data =3D N_("node information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the node.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nodeinfo =3D { + .help =3D N_("node information"), + .desc =3D N_("Returns basic information about the node."), }; static bool @@ -686,15 +651,10 @@ cmdNodeinfo(vshControl *ctl, const vshCmd *cmd G_GNUC= _UNUSED) /* * "nodecpumap" command */ -static const vshCmdInfo info_node_cpumap[] =3D { - {.name =3D "help", - .data =3D N_("node cpu map") - }, - {.name =3D "desc", - .data =3D N_("Displays the node's total number of CPUs, the number of" - " online CPUs and the list of online CPUs.") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_cpumap =3D { + .help =3D N_("node cpu map"), + .desc =3D N_("Displays the node's total number of CPUs, the number of" + " online CPUs and the list of online CPUs."), }; static const vshCmdOptDef opts_node_cpumap[] =3D { @@ -742,14 +702,9 @@ cmdNodeCpuMap(vshControl *ctl, const vshCmd *cmd G_GNU= C_UNUSED) /* * "nodecpustats" command */ -static const vshCmdInfo info_nodecpustats[] =3D { - {.name =3D "help", - .data =3D N_("Prints cpu stats of the node.") - }, - {.name =3D "desc", - .data =3D N_("Returns cpu stats of the node, in nanoseconds.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nodecpustats =3D { + .help =3D N_("Prints cpu stats of the node."), + .desc =3D N_("Returns cpu stats of the node, in nanoseconds."), }; static const vshCmdOptDef opts_node_cpustats[] =3D { @@ -885,14 +840,9 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) /* * "nodememstats" command */ -static const vshCmdInfo info_nodememstats[] =3D { - {.name =3D "help", - .data =3D N_("Prints memory stats of the node.") - }, - {.name =3D "desc", - .data =3D N_("Returns memory stats of the node, in kilobytes.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nodememstats =3D { + .help =3D N_("Prints memory stats of the node."), + .desc =3D N_("Returns memory stats of the node, in kilobytes."), }; static const vshCmdOptDef opts_node_memstats[] =3D { @@ -943,14 +893,9 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd) /* * "nodesevinfo" command */ -static const vshCmdInfo info_nodesevinfo[] =3D { - {.name =3D "help", - .data =3D N_("node SEV information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic SEV information about the node.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nodesevinfo =3D { + .help =3D N_("node SEV information"), + .desc =3D N_("Returns basic SEV information about the node."), }; static bool @@ -989,15 +934,10 @@ VIR_ENUM_IMPL(virshNodeSuspendTarget, "disk", "hybrid"); -static const vshCmdInfo info_nodesuspend[] =3D { - {.name =3D "help", - .data =3D N_("suspend the host node for a given time duration") - }, - {.name =3D "desc", - .data =3D N_("Suspend the host node for a given time duration " - "and attempt to resume thereafter.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nodesuspend =3D { + .help =3D N_("suspend the host node for a given time duration"), + .desc =3D N_("Suspend the host node for a given time duration " + "and attempt to resume thereafter."), }; static const vshCmdOptDef opts_node_suspend[] =3D { @@ -1050,14 +990,9 @@ cmdNodeSuspend(vshControl *ctl, const vshCmd *cmd) /* * "sysinfo" command */ -static const vshCmdInfo info_sysinfo[] =3D { - {.name =3D "help", - .data =3D N_("print the hypervisor sysinfo") - }, - {.name =3D "desc", - .data =3D N_("output an XML string for the hypervisor sysinfo, if ava= ilable") - }, - {.name =3D NULL} +static const vshCmdInfo info_sysinfo =3D { + .help =3D N_("print the hypervisor sysinfo"), + .desc =3D N_("output an XML string for the hypervisor sysinfo, if avai= lable"), }; static bool @@ -1080,14 +1015,9 @@ cmdSysinfo(vshControl *ctl, const vshCmd *cmd G_GNUC= _UNUSED) /* * "hostname" command */ -static const vshCmdInfo info_hostname[] =3D { - {.name =3D "help", - .data =3D N_("print the hypervisor hostname") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_hostname =3D { + .help =3D N_("print the hypervisor hostname"), + .desc =3D "", }; static bool @@ -1110,14 +1040,9 @@ cmdHostname(vshControl *ctl, const vshCmd *cmd G_GNU= C_UNUSED) /* * "uri" command */ -static const vshCmdInfo info_uri[] =3D { - {.name =3D "help", - .data =3D N_("print the hypervisor canonical URI") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_uri =3D { + .help =3D N_("print the hypervisor canonical URI"), + .desc =3D "", }; static bool @@ -1218,14 +1143,9 @@ vshExtractCPUDefXMLs(vshControl *ctl, /* * "cpu-compare" command */ -static const vshCmdInfo info_cpu_compare[] =3D { - {.name =3D "help", - .data =3D N_("compare host CPU with a CPU described by an XML file") - }, - {.name =3D "desc", - .data =3D N_("compare CPU with host CPU") - }, - {.name =3D NULL} +static const vshCmdInfo info_cpu_compare =3D { + .help =3D N_("compare host CPU with a CPU described by an XML file"), + .desc =3D N_("compare CPU with host CPU"), }; static const vshCmdOptDef opts_cpu_compare[] =3D { @@ -1293,14 +1213,9 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) /* * "cpu-baseline" command */ -static const vshCmdInfo info_cpu_baseline[] =3D { - {.name =3D "help", - .data =3D N_("compute baseline CPU") - }, - {.name =3D "desc", - .data =3D N_("Compute baseline CPU for a set of given CPUs.") - }, - {.name =3D NULL} +static const vshCmdInfo info_cpu_baseline =3D { + .help =3D N_("compute baseline CPU"), + .desc =3D N_("Compute baseline CPU for a set of given CPUs."), }; static const vshCmdOptDef opts_cpu_baseline[] =3D { @@ -1347,14 +1262,9 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd) /* * "cpu-models" command */ -static const vshCmdInfo info_cpu_models[] =3D { - {.name =3D "help", - .data =3D N_("CPU models") - }, - {.name =3D "desc", - .data =3D N_("Get the CPU models for an arch.") - }, - {.name =3D NULL} +static const vshCmdInfo info_cpu_models =3D { + .help =3D N_("CPU models"), + .desc =3D N_("Get the CPU models for an arch."), }; static const vshCmdOptDef opts_cpu_models[] =3D { @@ -1401,14 +1311,9 @@ cmdCPUModelNames(vshControl *ctl, const vshCmd *cmd) /* * "version" command */ -static const vshCmdInfo info_version[] =3D { - {.name =3D "help", - .data =3D N_("show version") - }, - {.name =3D "desc", - .data =3D N_("Display the system version information.") - }, - {.name =3D NULL} +static const vshCmdInfo info_version =3D { + .help =3D N_("show version"), + .desc =3D N_("Display the system version information."), }; static const vshCmdOptDef opts_version[] =3D { @@ -1503,10 +1408,9 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC= _UNUSED) return true; } -static const vshCmdInfo info_node_memory_tune[] =3D { - {"help", N_("Get or set node memory parameters")}, - {"desc", N_("Get or set node memory parameters")}, - {NULL, NULL} +static const vshCmdInfo info_node_memory_tune =3D { + .help =3D N_("Get or set node memory parameters"), + .desc =3D N_("Get or set node memory parameters"), }; static const vshCmdOptDef opts_node_memory_tune[] =3D { @@ -1617,14 +1521,9 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd) /* * "hypervisor-cpu-compare" command */ -static const vshCmdInfo info_hypervisor_cpu_compare[] =3D { - {.name =3D "help", - .data =3D N_("compare a CPU with the CPU created by a hypervisor on t= he host") - }, - {.name =3D "desc", - .data =3D N_("compare CPU with hypervisor CPU") - }, - {.name =3D NULL} +static const vshCmdInfo info_hypervisor_cpu_compare =3D { + .help =3D N_("compare a CPU with the CPU created by a hypervisor on th= e host"), + .desc =3D N_("compare CPU with hypervisor CPU"), }; static const vshCmdOptDef opts_hypervisor_cpu_compare[] =3D { @@ -1724,15 +1623,10 @@ cmdHypervisorCPUCompare(vshControl *ctl, /* * "hypervisor-cpu-baseline" command */ -static const vshCmdInfo info_hypervisor_cpu_baseline[] =3D { - {.name =3D "help", - .data =3D N_("compute baseline CPU usable by a specific hypervisor") - }, - {.name =3D "desc", - .data =3D N_("Compute baseline CPU for a set of given CPUs. The resul= t " - "will be tailored to the specified hypervisor.") - }, - {.name =3D NULL} +static const vshCmdInfo info_hypervisor_cpu_baseline =3D { + .help =3D N_("compute baseline CPU usable by a specific hypervisor"), + .desc =3D N_("Compute baseline CPU for a set of given CPUs. The resul= t " + "will be tailored to the specified hypervisor."), }; static const vshCmdOptDef opts_hypervisor_cpu_baseline[] =3D { @@ -1831,133 +1725,133 @@ const vshCmdDef hostAndHypervisorCmds[] =3D { {.name =3D "allocpages", .handler =3D cmdAllocpages, .opts =3D opts_allocpages, - .info =3D info_allocpages, + .info =3D &info_allocpages, .flags =3D 0 }, {.name =3D "capabilities", .handler =3D cmdCapabilities, .opts =3D opts_capabilities, - .info =3D info_capabilities, + .info =3D &info_capabilities, .flags =3D 0 }, {.name =3D "cpu-baseline", .handler =3D cmdCPUBaseline, .opts =3D opts_cpu_baseline, - .info =3D info_cpu_baseline, + .info =3D &info_cpu_baseline, .flags =3D 0 }, {.name =3D "cpu-compare", .handler =3D cmdCPUCompare, .opts =3D opts_cpu_compare, - .info =3D info_cpu_compare, + .info =3D &info_cpu_compare, .flags =3D 0 }, {.name =3D "cpu-models", .handler =3D cmdCPUModelNames, .opts =3D opts_cpu_models, - .info =3D info_cpu_models, + .info =3D &info_cpu_models, .flags =3D 0 }, {.name =3D "domcapabilities", .handler =3D cmdDomCapabilities, .opts =3D opts_domcapabilities, - .info =3D info_domcapabilities, + .info =3D &info_domcapabilities, .flags =3D 0 }, {.name =3D "freecell", .handler =3D cmdFreecell, .opts =3D opts_freecell, - .info =3D info_freecell, + .info =3D &info_freecell, .flags =3D 0 }, {.name =3D "freepages", .handler =3D cmdFreepages, .opts =3D opts_freepages, - .info =3D info_freepages, + .info =3D &info_freepages, .flags =3D 0 }, {.name =3D "hostname", .handler =3D cmdHostname, .opts =3D NULL, - .info =3D info_hostname, + .info =3D &info_hostname, .flags =3D 0 }, {.name =3D "hypervisor-cpu-baseline", .handler =3D cmdHypervisorCPUBaseline, .opts =3D opts_hypervisor_cpu_baseline, - .info =3D info_hypervisor_cpu_baseline, + .info =3D &info_hypervisor_cpu_baseline, .flags =3D 0 }, {.name =3D "hypervisor-cpu-compare", .handler =3D cmdHypervisorCPUCompare, .opts =3D opts_hypervisor_cpu_compare, - .info =3D info_hypervisor_cpu_compare, + .info =3D &info_hypervisor_cpu_compare, .flags =3D 0 }, {.name =3D "maxvcpus", .handler =3D cmdMaxvcpus, .opts =3D opts_maxvcpus, - .info =3D info_maxvcpus, + .info =3D &info_maxvcpus, .flags =3D 0 }, {.name =3D "node-memory-tune", .handler =3D cmdNodeMemoryTune, .opts =3D opts_node_memory_tune, - .info =3D info_node_memory_tune, + .info =3D &info_node_memory_tune, .flags =3D 0 }, {.name =3D "nodecpumap", .handler =3D cmdNodeCpuMap, .opts =3D opts_node_cpumap, - .info =3D info_node_cpumap, + .info =3D &info_node_cpumap, .flags =3D 0 }, {.name =3D "nodecpustats", .handler =3D cmdNodeCpuStats, .opts =3D opts_node_cpustats, - .info =3D info_nodecpustats, + .info =3D &info_nodecpustats, .flags =3D 0 }, {.name =3D "nodeinfo", .handler =3D cmdNodeinfo, .opts =3D NULL, - .info =3D info_nodeinfo, + .info =3D &info_nodeinfo, .flags =3D 0 }, {.name =3D "nodememstats", .handler =3D cmdNodeMemStats, .opts =3D opts_node_memstats, - .info =3D info_nodememstats, + .info =3D &info_nodememstats, .flags =3D 0 }, {.name =3D "nodesevinfo", .handler =3D cmdNodeSEVInfo, .opts =3D NULL, - .info =3D info_nodesevinfo, + .info =3D &info_nodesevinfo, .flags =3D 0 }, {.name =3D "nodesuspend", .handler =3D cmdNodeSuspend, .opts =3D opts_node_suspend, - .info =3D info_nodesuspend, + .info =3D &info_nodesuspend, .flags =3D 0 }, {.name =3D "sysinfo", .handler =3D cmdSysinfo, .opts =3D NULL, - .info =3D info_sysinfo, + .info =3D &info_sysinfo, .flags =3D 0 }, {.name =3D "uri", .handler =3D cmdURI, .opts =3D NULL, - .info =3D info_uri, + .info =3D &info_uri, .flags =3D 0 }, {.name =3D "version", .handler =3D cmdVersion, .opts =3D opts_version, - .info =3D info_version, + .info =3D &info_version, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 09a3668438..5dde4f9d46 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -91,14 +91,9 @@ virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd= *cmd, /* * "iface-edit" command */ -static const vshCmdInfo info_interface_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML configuration for a physical host interface") - }, - {.name =3D "desc", - .data =3D N_("Edit the XML configuration for a physical host interfac= e.") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_edit =3D { + .help =3D N_("edit XML configuration for a physical host interface"), + .desc =3D N_("Edit the XML configuration for a physical host interface= ."), }; static const vshCmdOptDef opts_interface_edit[] =3D { @@ -314,14 +309,9 @@ virshInterfaceListCollect(vshControl *ctl, /* * "iface-list" command */ -static const vshCmdInfo info_interface_list[] =3D { - {.name =3D "help", - .data =3D N_("list physical host interfaces") - }, - {.name =3D "desc", - .data =3D N_("Returns list of physical host interfaces.") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_list =3D { + .help =3D N_("list physical host interfaces"), + .desc =3D N_("Returns list of physical host interfaces."), }; static const vshCmdOptDef opts_interface_list[] =3D { @@ -385,14 +375,9 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd G_= GNUC_UNUSED) /* * "iface-name" command */ -static const vshCmdInfo info_interface_name[] =3D { - {.name =3D "help", - .data =3D N_("convert an interface MAC address to interface name") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_name =3D { + .help =3D N_("convert an interface MAC address to interface name"), + .desc =3D "", }; static const vshCmdOptDef opts_interface_name[] =3D { @@ -421,14 +406,9 @@ cmdInterfaceName(vshControl *ctl, const vshCmd *cmd) /* * "iface-mac" command */ -static const vshCmdInfo info_interface_mac[] =3D { - {.name =3D "help", - .data =3D N_("convert an interface name to interface MAC address") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_mac =3D { + .help =3D N_("convert an interface name to interface MAC address"), + .desc =3D "", }; static const vshCmdOptDef opts_interface_mac[] =3D { @@ -457,14 +437,9 @@ cmdInterfaceMAC(vshControl *ctl, const vshCmd *cmd) /* * "iface-dumpxml" command */ -static const vshCmdInfo info_interface_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("interface information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the physical host interface information as an XM= L dump to stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_dumpxml =3D { + .help =3D N_("interface information in XML"), + .desc =3D N_("Output the physical host interface information as an XML= dump to stdout."), }; static const vshCmdOptDef opts_interface_dumpxml[] =3D { @@ -514,15 +489,10 @@ cmdInterfaceDumpXML(vshControl *ctl, const vshCmd *cm= d) /* * "iface-define" command */ -static const vshCmdInfo info_interface_define[] =3D { - {.name =3D "help", - .data =3D N_("define an inactive persistent physical host interface o= r " - "modify an existing persistent one from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Define or modify a persistent physical host interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_define =3D { + .help =3D N_("define an inactive persistent physical host interface o= r " + "modify an existing persistent one from an XML file"), + .desc =3D N_("Define or modify a persistent physical host interface."= ), }; static const vshCmdOptDef opts_interface_define[] =3D { @@ -565,14 +535,9 @@ cmdInterfaceDefine(vshControl *ctl, const vshCmd *cmd) /* * "iface-undefine" command */ -static const vshCmdInfo info_interface_undefine[] =3D { - {.name =3D "help", - .data =3D N_("undefine a physical host interface (remove it from conf= iguration)") - }, - {.name =3D "desc", - .data =3D N_("undefine an interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_undefine =3D { + .help =3D N_("undefine a physical host interface (remove it from confi= guration)"), + .desc =3D N_("undefine an interface."), }; static const vshCmdOptDef opts_interface_undefine[] =3D { @@ -601,14 +566,9 @@ cmdInterfaceUndefine(vshControl *ctl, const vshCmd *cm= d) /* * "iface-start" command */ -static const vshCmdInfo info_interface_start[] =3D { - {.name =3D "help", - .data =3D N_("start a physical host interface (enable it / \"if-up\")= ") - }, - {.name =3D "desc", - .data =3D N_("start a physical host interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_start =3D { + .help =3D N_("start a physical host interface (enable it / \"if-up\")"= ), + .desc =3D N_("start a physical host interface."), }; static const vshCmdOptDef opts_interface_start[] =3D { @@ -637,14 +597,9 @@ cmdInterfaceStart(vshControl *ctl, const vshCmd *cmd) /* * "iface-destroy" command */ -static const vshCmdInfo info_interface_destroy[] =3D { - {.name =3D "help", - .data =3D N_("destroy a physical host interface (disable it / \"if-do= wn\")") - }, - {.name =3D "desc", - .data =3D N_("forcefully stop a physical host interface.") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_destroy =3D { + .help =3D N_("destroy a physical host interface (disable it / \"if-dow= n\")"), + .desc =3D N_("forcefully stop a physical host interface."), }; static const vshCmdOptDef opts_interface_destroy[] =3D { @@ -673,16 +628,11 @@ cmdInterfaceDestroy(vshControl *ctl, const vshCmd *cm= d) /* * "iface-begin" command */ -static const vshCmdInfo info_interface_begin[] =3D { - {.name =3D "help", - .data =3D N_("create a snapshot of current interfaces settings, " +static const vshCmdInfo info_interface_begin =3D { + .help =3D N_("create a snapshot of current interfaces settings, " "which can be later committed (iface-commit) or " - "restored (iface-rollback)") - }, - {.name =3D "desc", - .data =3D N_("Create a restore point for interfaces settings") - }, - {.name =3D NULL} + "restored (iface-rollback)"), + .desc =3D N_("Create a restore point for interfaces settings"), }; static const vshCmdOptDef opts_interface_begin[] =3D { @@ -706,14 +656,9 @@ cmdInterfaceBegin(vshControl *ctl, const vshCmd *cmd G= _GNUC_UNUSED) /* * "iface-commit" command */ -static const vshCmdInfo info_interface_commit[] =3D { - {.name =3D "help", - .data =3D N_("commit changes made since iface-begin and free restore = point") - }, - {.name =3D "desc", - .data =3D N_("commit changes and free restore point") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_commit =3D { + .help =3D N_("commit changes made since iface-begin and free restore p= oint"), + .desc =3D N_("commit changes and free restore point"), }; static const vshCmdOptDef opts_interface_commit[] =3D { @@ -737,14 +682,9 @@ cmdInterfaceCommit(vshControl *ctl, const vshCmd *cmd = G_GNUC_UNUSED) /* * "iface-rollback" command */ -static const vshCmdInfo info_interface_rollback[] =3D { - {.name =3D "help", - .data =3D N_("rollback to previous saved configuration created via if= ace-begin") - }, - {.name =3D "desc", - .data =3D N_("rollback to previous restore point") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_rollback =3D { + .help =3D N_("rollback to previous saved configuration created via ifa= ce-begin"), + .desc =3D N_("rollback to previous restore point"), }; static const vshCmdOptDef opts_interface_rollback[] =3D { @@ -768,14 +708,9 @@ cmdInterfaceRollback(vshControl *ctl, const vshCmd *cm= d G_GNUC_UNUSED) /* * "iface-bridge" command */ -static const vshCmdInfo info_interface_bridge[] =3D { - {.name =3D "help", - .data =3D N_("create a bridge device and attach an existing network d= evice to it") - }, - {.name =3D "desc", - .data =3D N_("bridge an existing network device") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_bridge =3D { + .help =3D N_("create a bridge device and attach an existing network de= vice to it"), + .desc =3D N_("bridge an existing network device"), }; static const vshCmdOptDef opts_interface_bridge[] =3D { @@ -1000,14 +935,9 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd) /* * "iface-unbridge" command */ -static const vshCmdInfo info_interface_unbridge[] =3D { - {.name =3D "help", - .data =3D N_("undefine a bridge device after detaching its device(s)") - }, - {.name =3D "desc", - .data =3D N_("unbridge a network device") - }, - {.name =3D NULL} +static const vshCmdInfo info_interface_unbridge =3D { + .help =3D N_("undefine a bridge device after detaching its device(s)"), + .desc =3D N_("unbridge a network device"), }; static const vshCmdOptDef opts_interface_unbridge[] =3D { @@ -1196,85 +1126,85 @@ const vshCmdDef ifaceCmds[] =3D { {.name =3D "iface-begin", .handler =3D cmdInterfaceBegin, .opts =3D opts_interface_begin, - .info =3D info_interface_begin, + .info =3D &info_interface_begin, .flags =3D 0 }, {.name =3D "iface-bridge", .handler =3D cmdInterfaceBridge, .opts =3D opts_interface_bridge, - .info =3D info_interface_bridge, + .info =3D &info_interface_bridge, .flags =3D 0 }, {.name =3D "iface-commit", .handler =3D cmdInterfaceCommit, .opts =3D opts_interface_commit, - .info =3D info_interface_commit, + .info =3D &info_interface_commit, .flags =3D 0 }, {.name =3D "iface-define", .handler =3D cmdInterfaceDefine, .opts =3D opts_interface_define, - .info =3D info_interface_define, + .info =3D &info_interface_define, .flags =3D 0 }, {.name =3D "iface-destroy", .handler =3D cmdInterfaceDestroy, .opts =3D opts_interface_destroy, - .info =3D info_interface_destroy, + .info =3D &info_interface_destroy, .flags =3D 0 }, {.name =3D "iface-dumpxml", .handler =3D cmdInterfaceDumpXML, .opts =3D opts_interface_dumpxml, - .info =3D info_interface_dumpxml, + .info =3D &info_interface_dumpxml, .flags =3D 0 }, {.name =3D "iface-edit", .handler =3D cmdInterfaceEdit, .opts =3D opts_interface_edit, - .info =3D info_interface_edit, + .info =3D &info_interface_edit, .flags =3D 0 }, {.name =3D "iface-list", .handler =3D cmdInterfaceList, .opts =3D opts_interface_list, - .info =3D info_interface_list, + .info =3D &info_interface_list, .flags =3D 0 }, {.name =3D "iface-mac", .handler =3D cmdInterfaceMAC, .opts =3D opts_interface_mac, - .info =3D info_interface_mac, + .info =3D &info_interface_mac, .flags =3D 0 }, {.name =3D "iface-name", .handler =3D cmdInterfaceName, .opts =3D opts_interface_name, - .info =3D info_interface_name, + .info =3D &info_interface_name, .flags =3D 0 }, {.name =3D "iface-rollback", .handler =3D cmdInterfaceRollback, .opts =3D opts_interface_rollback, - .info =3D info_interface_rollback, + .info =3D &info_interface_rollback, .flags =3D 0 }, {.name =3D "iface-start", .handler =3D cmdInterfaceStart, .opts =3D opts_interface_start, - .info =3D info_interface_start, + .info =3D &info_interface_start, .flags =3D 0 }, {.name =3D "iface-unbridge", .handler =3D cmdInterfaceUnbridge, .opts =3D opts_interface_unbridge, - .info =3D info_interface_unbridge, + .info =3D &info_interface_unbridge, .flags =3D 0 }, {.name =3D "iface-undefine", .handler =3D cmdInterfaceUndefine, .opts =3D opts_interface_undefine, - .info =3D info_interface_undefine, + .info =3D &info_interface_undefine, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 68c7543863..6f4a66b659 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -134,14 +134,9 @@ virshCommandOptNetworkPort(vshControl *ctl, const vshC= md *cmd, /* * "net-autostart" command */ -static const vshCmdInfo info_network_autostart[] =3D { - {.name =3D "help", - .data =3D N_("autostart a network") - }, - {.name =3D "desc", - .data =3D N_("Configure a network to be automatically started at boot= .") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_autostart =3D { + .help =3D N_("autostart a network"), + .desc =3D N_("Configure a network to be automatically started at boot.= "), }; static const vshCmdOptDef opts_network_autostart[] =3D { @@ -184,14 +179,9 @@ cmdNetworkAutostart(vshControl *ctl, const vshCmd *cmd) /* * "net-create" command */ -static const vshCmdInfo info_network_create[] =3D { - {.name =3D "help", - .data =3D N_("create a network from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Create a network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_create =3D { + .help =3D N_("create a network from an XML file"), + .desc =3D N_("Create a network."), }; static const vshCmdOptDef opts_network_create[] =3D { @@ -239,15 +229,10 @@ cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd) /* * "net-define" command */ -static const vshCmdInfo info_network_define[] =3D { - {.name =3D "help", - .data =3D N_("define an inactive persistent virtual network or modify= " - "an existing persistent one from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Define or modify a persistent virtual network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_define =3D { + .help =3D N_("define an inactive persistent virtual network or modify= " + "an existing persistent one from an XML file"), + .desc =3D N_("Define or modify a persistent virtual network."), }; static const vshCmdOptDef opts_network_define[] =3D { @@ -295,14 +280,9 @@ cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd) /* * "net-destroy" command */ -static const vshCmdInfo info_network_destroy[] =3D { - {.name =3D "help", - .data =3D N_("destroy (stop) a network") - }, - {.name =3D "desc", - .data =3D N_("Forcefully stop a given network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_destroy =3D { + .help =3D N_("destroy (stop) a network"), + .desc =3D N_("Forcefully stop a given network."), }; static const vshCmdOptDef opts_network_destroy[] =3D { @@ -333,14 +313,9 @@ cmdNetworkDestroy(vshControl *ctl, const vshCmd *cmd) /* * "net-desc" command */ -static const vshCmdInfo info_network_desc[] =3D { - {.name =3D "help", - .data =3D N_("show or set network's description or title") - }, - {.name =3D "desc", - .data =3D N_("Allows setting or modifying the description or title of= a network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_desc =3D { + .help =3D N_("show or set network's description or title"), + .desc =3D N_("Allows setting or modifying the description or title of = a network."), }; static const vshCmdOptDef opts_network_desc[] =3D { @@ -536,14 +511,9 @@ cmdNetworkDesc(vshControl *ctl, const vshCmd *cmd) /* * "net-metadata" command */ -static const vshCmdInfo info_network_metadata[] =3D { - {.name =3D "help", - .data =3D N_("show or set network's custom XML metadata") - }, - {.name =3D "desc", - .data =3D N_("Shows or modifies the XML metadata of a network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_metadata =3D { + .help =3D N_("show or set network's custom XML metadata"), + .desc =3D N_("Shows or modifies the XML metadata of a network."), }; static const vshCmdOptDef opts_network_metadata[] =3D { @@ -679,14 +649,9 @@ cmdNetworkMetadata(vshControl *ctl, const vshCmd *cmd) /* * "net-dumpxml" command */ -static const vshCmdInfo info_network_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("network information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the network information as an XML dump to stdout= .") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_dumpxml =3D { + .help =3D N_("network information in XML"), + .desc =3D N_("Output the network information as an XML dump to stdout.= "), }; static const vshCmdOptDef opts_network_dumpxml[] =3D { @@ -735,14 +700,9 @@ cmdNetworkDumpXML(vshControl *ctl, const vshCmd *cmd) /* * "net-info" command */ -static const vshCmdInfo info_network_info[] =3D { - {.name =3D "help", - .data =3D N_("network information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the network") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_info =3D { + .help =3D N_("network information"), + .desc =3D N_("Returns basic information about the network"), }; static const vshCmdOptDef opts_network_info[] =3D { @@ -1010,14 +970,9 @@ virshNetworkListCollect(vshControl *ctl, /* * "net-list" command */ -static const vshCmdInfo info_network_list[] =3D { - {.name =3D "help", - .data =3D N_("list networks") - }, - {.name =3D "desc", - .data =3D N_("Returns list of networks.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_list =3D { + .help =3D N_("list networks"), + .desc =3D N_("Returns list of networks."), }; static const vshCmdOptDef opts_network_list[] =3D { @@ -1182,14 +1137,9 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd G_= GNUC_UNUSED) /* * "net-name" command */ -static const vshCmdInfo info_network_name[] =3D { - {.name =3D "help", - .data =3D N_("convert a network UUID to network name") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_network_name =3D { + .help =3D N_("convert a network UUID to network name"), + .desc =3D "", }; static const vshCmdOptDef opts_network_name[] =3D { @@ -1218,14 +1168,9 @@ cmdNetworkName(vshControl *ctl, const vshCmd *cmd) /* * "net-start" command */ -static const vshCmdInfo info_network_start[] =3D { - {.name =3D "help", - .data =3D N_("start a (previously defined) inactive network") - }, - {.name =3D "desc", - .data =3D N_("Start a network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_start =3D { + .help =3D N_("start a (previously defined) inactive network"), + .desc =3D N_("Start a network."), }; static const vshCmdOptDef opts_network_start[] =3D { @@ -1255,14 +1200,9 @@ cmdNetworkStart(vshControl *ctl, const vshCmd *cmd) /* * "net-undefine" command */ -static const vshCmdInfo info_network_undefine[] =3D { - {.name =3D "help", - .data =3D N_("undefine a persistent network") - }, - {.name =3D "desc", - .data =3D N_("Undefine the configuration for a persistent network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_undefine =3D { + .help =3D N_("undefine a persistent network"), + .desc =3D N_("Undefine the configuration for a persistent network."), }; static const vshCmdOptDef opts_network_undefine[] =3D { @@ -1293,14 +1233,9 @@ cmdNetworkUndefine(vshControl *ctl, const vshCmd *cm= d) /* * "net-update" command */ -static const vshCmdInfo info_network_update[] =3D { - {.name =3D "help", - .data =3D N_("update parts of an existing network's configuration") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_network_update =3D { + .help =3D N_("update parts of an existing network's configuration"), + .desc =3D "", }; static const vshCmdOptDef opts_network_update[] =3D { @@ -1453,14 +1388,9 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd) /* * "net-uuid" command */ -static const vshCmdInfo info_network_uuid[] =3D { - {.name =3D "help", - .data =3D N_("convert a network name to network UUID") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_network_uuid =3D { + .help =3D N_("convert a network name to network UUID"), + .desc =3D "", }; static const vshCmdOptDef opts_network_uuid[] =3D { @@ -1489,14 +1419,9 @@ cmdNetworkUuid(vshControl *ctl, const vshCmd *cmd) /* * "net-edit" command */ -static const vshCmdInfo info_network_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML configuration for a network") - }, - {.name =3D "desc", - .data =3D N_("Edit the XML configuration for a network.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_edit =3D { + .help =3D N_("edit XML configuration for a network"), + .desc =3D N_("Edit the XML configuration for a network."), }; static const vshCmdOptDef opts_network_edit[] =3D { @@ -1667,14 +1592,9 @@ virshNetworkEventCallback virshNetworkEventCallbacks= [] =3D { }; G_STATIC_ASSERT(VIR_NETWORK_EVENT_ID_LAST =3D=3D G_N_ELEMENTS(virshNetwork= EventCallbacks)); -static const vshCmdInfo info_network_event[] =3D { - {.name =3D "help", - .data =3D N_("Network Events") - }, - {.name =3D "desc", - .data =3D N_("List event types, or wait for network events to occur") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_event =3D { + .help =3D N_("Network Events"), + .desc =3D N_("List event types, or wait for network events to occur"), }; static const vshCmdOptDef opts_network_event[] =3D { @@ -1782,14 +1702,9 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd) /* * "net-dhcp-leases" command */ -static const vshCmdInfo info_network_dhcp_leases[] =3D { - {.name =3D "help", - .data =3D N_("print lease info for a given network") - }, - {.name =3D "desc", - .data =3D N_("Print lease info for a given network") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_dhcp_leases =3D { + .help =3D N_("print lease info for a given network"), + .desc =3D N_("Print lease info for a given network"), }; static const vshCmdOptDef opts_network_dhcp_leases[] =3D { @@ -1897,14 +1812,9 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *= cmd) /* * "net-port-create" command */ -static const vshCmdInfo info_network_port_create[] =3D { - {.name =3D "help", - .data =3D N_("create a network port from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Create a network port.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_port_create =3D { + .help =3D N_("create a network port from an XML file"), + .desc =3D N_("Create a network port."), }; static const vshCmdOptDef opts_network_port_create[] =3D { @@ -1964,14 +1874,9 @@ cmdNetworkPortCreate(vshControl *ctl, const vshCmd *= cmd) /* * "net-port-dumpxml" command */ -static const vshCmdInfo info_network_port_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("network port information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the network port information as an XML dump to s= tdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_port_dumpxml =3D { + .help =3D N_("network port information in XML"), + .desc =3D N_("Output the network port information as an XML dump to st= dout."), }; static const vshCmdOptDef opts_network_port_dumpxml[] =3D { @@ -2025,14 +1930,9 @@ cmdNetworkPortDumpXML(vshControl *ctl, const vshCmd = *cmd) /* * "net-port-delete" command */ -static const vshCmdInfo info_network_port_delete[] =3D { - {.name =3D "help", - .data =3D N_("delete the specified network port") - }, - {.name =3D "desc", - .data =3D N_("Delete the specified network port.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_port_delete =3D { + .help =3D N_("delete the specified network port"), + .desc =3D N_("Delete the specified network port."), }; static const vshCmdOptDef opts_network_port_delete[] =3D { @@ -2155,14 +2055,9 @@ virshNetworkPortListCollect(vshControl *ctl, /* * "net-list" command */ -static const vshCmdInfo info_network_port_list[] =3D { - {.name =3D "help", - .data =3D N_("list network ports") - }, - {.name =3D "desc", - .data =3D N_("Returns list of network ports.") - }, - {.name =3D NULL} +static const vshCmdInfo info_network_port_list =3D { + .help =3D N_("list network ports"), + .desc =3D N_("Returns list of network ports."), }; static const vshCmdOptDef opts_network_port_list[] =3D { @@ -2237,127 +2132,127 @@ const vshCmdDef networkCmds[] =3D { {.name =3D "net-autostart", .handler =3D cmdNetworkAutostart, .opts =3D opts_network_autostart, - .info =3D info_network_autostart, + .info =3D &info_network_autostart, .flags =3D 0 }, {.name =3D "net-create", .handler =3D cmdNetworkCreate, .opts =3D opts_network_create, - .info =3D info_network_create, + .info =3D &info_network_create, .flags =3D 0 }, {.name =3D "net-define", .handler =3D cmdNetworkDefine, .opts =3D opts_network_define, - .info =3D info_network_define, + .info =3D &info_network_define, .flags =3D 0 }, {.name =3D "net-desc", .handler =3D cmdNetworkDesc, .opts =3D opts_network_desc, - .info =3D info_network_desc, + .info =3D &info_network_desc, .flags =3D 0 }, {.name =3D "net-destroy", .handler =3D cmdNetworkDestroy, .opts =3D opts_network_destroy, - .info =3D info_network_destroy, + .info =3D &info_network_destroy, .flags =3D 0 }, {.name =3D "net-dhcp-leases", .handler =3D cmdNetworkDHCPLeases, .opts =3D opts_network_dhcp_leases, - .info =3D info_network_dhcp_leases, + .info =3D &info_network_dhcp_leases, .flags =3D 0, }, {.name =3D "net-dumpxml", .handler =3D cmdNetworkDumpXML, .opts =3D opts_network_dumpxml, - .info =3D info_network_dumpxml, + .info =3D &info_network_dumpxml, .flags =3D 0 }, {.name =3D "net-edit", .handler =3D cmdNetworkEdit, .opts =3D opts_network_edit, - .info =3D info_network_edit, + .info =3D &info_network_edit, .flags =3D 0 }, {.name =3D "net-event", .handler =3D cmdNetworkEvent, .opts =3D opts_network_event, - .info =3D info_network_event, + .info =3D &info_network_event, .flags =3D 0 }, {.name =3D "net-info", .handler =3D cmdNetworkInfo, .opts =3D opts_network_info, - .info =3D info_network_info, + .info =3D &info_network_info, .flags =3D 0 }, {.name =3D "net-list", .handler =3D cmdNetworkList, .opts =3D opts_network_list, - .info =3D info_network_list, + .info =3D &info_network_list, .flags =3D 0 }, {.name =3D "net-metadata", .handler =3D cmdNetworkMetadata, .opts =3D opts_network_metadata, - .info =3D info_network_metadata, + .info =3D &info_network_metadata, .flags =3D 0 }, {.name =3D "net-name", .handler =3D cmdNetworkName, .opts =3D opts_network_name, - .info =3D info_network_name, + .info =3D &info_network_name, .flags =3D 0 }, {.name =3D "net-start", .handler =3D cmdNetworkStart, .opts =3D opts_network_start, - .info =3D info_network_start, + .info =3D &info_network_start, .flags =3D 0 }, {.name =3D "net-undefine", .handler =3D cmdNetworkUndefine, .opts =3D opts_network_undefine, - .info =3D info_network_undefine, + .info =3D &info_network_undefine, .flags =3D 0 }, {.name =3D "net-update", .handler =3D cmdNetworkUpdate, .opts =3D opts_network_update, - .info =3D info_network_update, + .info =3D &info_network_update, .flags =3D 0 }, {.name =3D "net-uuid", .handler =3D cmdNetworkUuid, .opts =3D opts_network_uuid, - .info =3D info_network_uuid, + .info =3D &info_network_uuid, .flags =3D 0 }, {.name =3D "net-port-list", .handler =3D cmdNetworkPortList, .opts =3D opts_network_port_list, - .info =3D info_network_port_list, + .info =3D &info_network_port_list, .flags =3D 0 }, {.name =3D "net-port-create", .handler =3D cmdNetworkPortCreate, .opts =3D opts_network_port_create, - .info =3D info_network_port_create, + .info =3D &info_network_port_create, .flags =3D 0 }, {.name =3D "net-port-dumpxml", .handler =3D cmdNetworkPortDumpXML, .opts =3D opts_network_port_dumpxml, - .info =3D info_network_port_dumpxml, + .info =3D &info_network_port_dumpxml, .flags =3D 0 }, {.name =3D "net-port-delete", .handler =3D cmdNetworkPortDelete, .opts =3D opts_network_port_delete, - .info =3D info_network_port_delete, + .info =3D &info_network_port_delete, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index b5a88b194f..c0fb319fa7 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -34,17 +34,12 @@ /* * "nodedev-create" command */ -static const vshCmdInfo info_node_device_create[] =3D { - {.name =3D "help", - .data =3D N_("create a device defined " - "by an XML file on the node") - }, - {.name =3D "desc", - .data =3D N_("Create a device on the node. Note that this " +static const vshCmdInfo info_node_device_create =3D { + .help =3D N_("create a device defined " + "by an XML file on the node"), + .desc =3D N_("Create a device on the node. Note that this " "command creates devices on the physical host " - "that can then be assigned to a virtual machine.") - }, - {.name =3D NULL} + "that can then be assigned to a virtual machine."), }; static const vshCmdOptDef opts_node_device_create[] =3D { @@ -89,15 +84,10 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd) /* * "nodedev-destroy" command */ -static const vshCmdInfo info_node_device_destroy[] =3D { - {.name =3D "help", - .data =3D N_("destroy (stop) a device on the node") - }, - {.name =3D "desc", - .data =3D N_("Destroy a device on the node. Note that this " - "command destroys devices on the physical host") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_destroy =3D { + .help =3D N_("destroy (stop) a device on the node"), + .desc =3D N_("Destroy a device on the node. Note that this " + "command destroys devices on the physical host"), }; static const vshCmdOptDef opts_node_device_destroy[] =3D { @@ -362,14 +352,9 @@ virshNodeDeviceListCollect(vshControl *ctl, /* * "nodedev-list" command */ -static const vshCmdInfo info_node_list_devices[] =3D { - {.name =3D "help", - .data =3D N_("enumerate devices on this host") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_node_list_devices =3D { + .help =3D N_("enumerate devices on this host"), + .desc =3D "", }; static const vshCmdOptDef opts_node_list_devices[] =3D { @@ -577,14 +562,9 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd = G_GNUC_UNUSED) /* * "nodedev-dumpxml" command */ -static const vshCmdInfo info_node_device_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("node device details in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the node device details as an XML dump to stdout= .") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_dumpxml =3D { + .help =3D N_("node device details in XML"), + .desc =3D N_("Output the node device details as an XML dump to stdout.= "), }; @@ -645,14 +625,9 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cm= d) /* * "nodedev-detach" command */ -static const vshCmdInfo info_node_device_detach[] =3D { - {.name =3D "help", - .data =3D N_("detach node device from its device driver") - }, - {.name =3D "desc", - .data =3D N_("Detach node device from its device driver before assign= ing to a domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_detach =3D { + .help =3D N_("detach node device from its device driver"), + .desc =3D N_("Detach node device from its device driver before assigni= ng to a domain."), }; @@ -712,14 +687,9 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd) /* * "nodedev-reattach" command */ -static const vshCmdInfo info_node_device_reattach[] =3D { - {.name =3D "help", - .data =3D N_("reattach node device to its device driver") - }, - {.name =3D "desc", - .data =3D N_("Reattach node device to its device driver once released= by the domain.") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_reattach =3D { + .help =3D N_("reattach node device to its device driver"), + .desc =3D N_("Reattach node device to its device driver once released = by the domain."), }; @@ -762,14 +732,9 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *c= md) /* * "nodedev-reset" command */ -static const vshCmdInfo info_node_device_reset[] =3D { - {.name =3D "help", - .data =3D N_("reset node device") - }, - {.name =3D "desc", - .data =3D N_("Reset node device before or after assigning to a domain= .") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_reset =3D { + .help =3D N_("reset node device"), + .desc =3D N_("Reset node device before or after assigning to a domain.= "), }; @@ -906,14 +871,9 @@ virshNodeDeviceEventCallback virshNodeDeviceEventCallb= acks[] =3D { G_STATIC_ASSERT(VIR_NODE_DEVICE_EVENT_ID_LAST =3D=3D G_N_ELEMENTS(virshNod= eDeviceEventCallbacks)); -static const vshCmdInfo info_node_device_event[] =3D { - {.name =3D "help", - .data =3D N_("Node Device Events") - }, - {.name =3D "desc", - .data =3D N_("List event types, or wait for node device events to occ= ur") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_event =3D { + .help =3D N_("Node Device Events"), + .desc =3D N_("List event types, or wait for node device events to occu= r"), }; static const vshCmdOptDef opts_node_device_event[] =3D { @@ -1034,14 +994,9 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) /* * "nodedev-undefine" command */ -static const vshCmdInfo info_node_device_undefine[] =3D { - {.name =3D "help", - .data =3D N_("Undefine an inactive node device") - }, - {.name =3D "desc", - .data =3D N_("Undefines the configuration for an inactive node device= ") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_undefine =3D { + .help =3D N_("Undefine an inactive node device"), + .desc =3D N_("Undefines the configuration for an inactive node device"= ), }; static const vshCmdOptDef opts_node_device_undefine[] =3D { @@ -1081,16 +1036,11 @@ cmdNodeDeviceUndefine(vshControl *ctl, const vshCmd= *cmd G_GNUC_UNUSED) /* * "nodedev-define" command */ -static const vshCmdInfo info_node_device_define[] =3D { - {.name =3D "help", - .data =3D N_("Define or modify a device by an xml file on a node") - }, - {.name =3D "desc", - .data =3D N_("Defines or modifies a persistent device on the node tha= t " +static const vshCmdInfo info_node_device_define =3D { + .help =3D N_("Define or modify a device by an xml file on a node"), + .desc =3D N_("Defines or modifies a persistent device on the node tha= t " "can be assigned to a domain. The device must be started " - "before it can be assigned to a domain.") - }, - {.name =3D NULL} + "before it can be assigned to a domain."), }; static const vshCmdOptDef opts_node_device_define[] =3D { @@ -1135,14 +1085,9 @@ cmdNodeDeviceDefine(vshControl *ctl, const vshCmd *c= md G_GNUC_UNUSED) /* * "nodedev-start" command */ -static const vshCmdInfo info_node_device_start[] =3D { - {.name =3D "help", - .data =3D N_("Start an inactive node device") - }, - {.name =3D "desc", - .data =3D N_("Starts an inactive node device that was previously defi= ned") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_start =3D { + .help =3D N_("Start an inactive node device"), + .desc =3D N_("Starts an inactive node device that was previously defin= ed"), }; static const vshCmdOptDef opts_node_device_start[] =3D { @@ -1185,14 +1130,9 @@ cmdNodeDeviceStart(vshControl *ctl, const vshCmd *cm= d) /* * "nodedev-autostart" command */ -static const vshCmdInfo info_node_device_autostart[] =3D { - {.name =3D "help", - .data =3D N_("autostart a defined node device") - }, - {.name =3D "desc", - .data =3D N_("Configure a node device to be automatically started at = boot.") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_autostart =3D { + .help =3D N_("autostart a defined node device"), + .desc =3D N_("Configure a node device to be automatically started at b= oot."), }; static const vshCmdOptDef opts_node_device_autostart[] =3D { @@ -1246,14 +1186,9 @@ cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd= *cmd) /* * "nodedev-info" command */ -static const vshCmdInfo info_node_device_info[] =3D { - {.name =3D "help", - .data =3D N_("node device information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the node device") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_info =3D { + .help =3D N_("node device information"), + .desc =3D N_("Returns basic information about the node device"), }; @@ -1302,14 +1237,9 @@ cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd) /* * "nodedev-update" command */ -static const vshCmdInfo info_node_device_update[] =3D { - {.name =3D "help", - .data =3D N_("Update a active and/or inactive node device") - }, - {.name =3D "desc", - .data =3D N_("Updates the configuration of a node device") - }, - {.name =3D NULL} +static const vshCmdInfo info_node_device_update =3D { + .help =3D N_("Update a active and/or inactive node device"), + .desc =3D N_("Updates the configuration of a node device"), }; static const vshCmdOptDef opts_node_device_update[] =3D { @@ -1399,19 +1329,19 @@ const vshCmdDef nodedevCmds[] =3D { {.name =3D "nodedev-create", .handler =3D cmdNodeDeviceCreate, .opts =3D opts_node_device_create, - .info =3D info_node_device_create, + .info =3D &info_node_device_create, .flags =3D 0 }, {.name =3D "nodedev-destroy", .handler =3D cmdNodeDeviceDestroy, .opts =3D opts_node_device_destroy, - .info =3D info_node_device_destroy, + .info =3D &info_node_device_destroy, .flags =3D 0 }, {.name =3D "nodedev-detach", .handler =3D cmdNodeDeviceDetach, .opts =3D opts_node_device_detach, - .info =3D info_node_device_detach, + .info =3D &info_node_device_detach, .flags =3D 0 }, {.name =3D "nodedev-dettach", @@ -1420,67 +1350,67 @@ const vshCmdDef nodedevCmds[] =3D { {.name =3D "nodedev-dumpxml", .handler =3D cmdNodeDeviceDumpXML, .opts =3D opts_node_device_dumpxml, - .info =3D info_node_device_dumpxml, + .info =3D &info_node_device_dumpxml, .flags =3D 0 }, {.name =3D "nodedev-list", .handler =3D cmdNodeListDevices, .opts =3D opts_node_list_devices, - .info =3D info_node_list_devices, + .info =3D &info_node_list_devices, .flags =3D 0 }, {.name =3D "nodedev-reattach", .handler =3D cmdNodeDeviceReAttach, .opts =3D opts_node_device_reattach, - .info =3D info_node_device_reattach, + .info =3D &info_node_device_reattach, .flags =3D 0 }, {.name =3D "nodedev-reset", .handler =3D cmdNodeDeviceReset, .opts =3D opts_node_device_reset, - .info =3D info_node_device_reset, + .info =3D &info_node_device_reset, .flags =3D 0 }, {.name =3D "nodedev-event", .handler =3D cmdNodeDeviceEvent, .opts =3D opts_node_device_event, - .info =3D info_node_device_event, + .info =3D &info_node_device_event, .flags =3D 0 }, {.name =3D "nodedev-define", .handler =3D cmdNodeDeviceDefine, .opts =3D opts_node_device_define, - .info =3D info_node_device_define, + .info =3D &info_node_device_define, .flags =3D 0 }, {.name =3D "nodedev-undefine", .handler =3D cmdNodeDeviceUndefine, .opts =3D opts_node_device_undefine, - .info =3D info_node_device_undefine, + .info =3D &info_node_device_undefine, .flags =3D 0 }, {.name =3D "nodedev-start", .handler =3D cmdNodeDeviceStart, .opts =3D opts_node_device_start, - .info =3D info_node_device_start, + .info =3D &info_node_device_start, .flags =3D 0 }, {.name =3D "nodedev-autostart", .handler =3D cmdNodeDeviceAutostart, .opts =3D opts_node_device_autostart, - .info =3D info_node_device_autostart, + .info =3D &info_node_device_autostart, .flags =3D 0 }, {.name =3D "nodedev-info", .handler =3D cmdNodeDeviceInfo, .opts =3D opts_node_device_info, - .info =3D info_node_device_info, + .info =3D &info_node_device_info, .flags =3D 0 }, {.name =3D "nodedev-update", .handler =3D cmdNodeDeviceUpdate, .opts =3D opts_node_device_update, - .info =3D info_node_device_update, + .info =3D &info_node_device_update, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index fa52d020e4..7a578f3f7c 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -69,14 +69,9 @@ virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd = *cmd, /* * "nwfilter-define" command */ -static const vshCmdInfo info_nwfilter_define[] =3D { - {.name =3D "help", - .data =3D N_("define or update a network filter from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Define a new network filter or update an existing one.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_define =3D { + .help =3D N_("define or update a network filter from an XML file"), + .desc =3D N_("Define a new network filter or update an existing one."), }; static const vshCmdOptDef opts_nwfilter_define[] =3D { @@ -126,14 +121,9 @@ cmdNWFilterDefine(vshControl *ctl, const vshCmd *cmd) /* * "nwfilter-undefine" command */ -static const vshCmdInfo info_nwfilter_undefine[] =3D { - {.name =3D "help", - .data =3D N_("undefine a network filter") - }, - {.name =3D "desc", - .data =3D N_("Undefine a given network filter.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_undefine =3D { + .help =3D N_("undefine a network filter"), + .desc =3D N_("Undefine a given network filter."), }; static const vshCmdOptDef opts_nwfilter_undefine[] =3D { @@ -169,14 +159,9 @@ cmdNWFilterUndefine(vshControl *ctl, const vshCmd *cmd) /* * "nwfilter-dumpxml" command */ -static const vshCmdInfo info_nwfilter_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("network filter information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the network filter information as an XML dump to= stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_dumpxml =3D { + .help =3D N_("network filter information in XML"), + .desc =3D N_("Output the network filter information as an XML dump to = stdout."), }; static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { @@ -351,14 +336,9 @@ virshNWFilterListCollect(vshControl *ctl, /* * "nwfilter-list" command */ -static const vshCmdInfo info_nwfilter_list[] =3D { - {.name =3D "help", - .data =3D N_("list network filters") - }, - {.name =3D "desc", - .data =3D N_("Returns list of network filters.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_list =3D { + .help =3D N_("list network filters"), + .desc =3D N_("Returns list of network filters."), }; static const vshCmdOptDef opts_nwfilter_list[] =3D { @@ -403,14 +383,9 @@ cmdNWFilterList(vshControl *ctl, const vshCmd *cmd G_G= NUC_UNUSED) /* * "nwfilter-edit" command */ -static const vshCmdInfo info_nwfilter_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML configuration for a network filter") - }, - {.name =3D "desc", - .data =3D N_("Edit the XML configuration for a network filter.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_edit =3D { + .help =3D N_("edit XML configuration for a network filter"), + .desc =3D N_("Edit the XML configuration for a network filter."), }; static const vshCmdOptDef opts_nwfilter_edit[] =3D { @@ -493,14 +468,9 @@ virshCommandOptNWFilterBindingBy(vshControl *ctl, /* * "nwfilter-binding-create" command */ -static const vshCmdInfo info_nwfilter_binding_create[] =3D { - {.name =3D "help", - .data =3D N_("create a network filter binding from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Create a new network filter binding.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_binding_create =3D { + .help =3D N_("create a network filter binding from an XML file"), + .desc =3D N_("Create a new network filter binding."), }; static const vshCmdOptDef opts_nwfilter_binding_create[] =3D { @@ -548,14 +518,9 @@ cmdNWFilterBindingCreate(vshControl *ctl, const vshCmd= *cmd) /* * "nwfilter-binding-delete" command */ -static const vshCmdInfo info_nwfilter_binding_delete[] =3D { - {.name =3D "help", - .data =3D N_("delete a network filter binding") - }, - {.name =3D "desc", - .data =3D N_("Delete a given network filter binding.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_binding_delete =3D { + .help =3D N_("delete a network filter binding"), + .desc =3D N_("Delete a given network filter binding."), }; static const vshCmdOptDef opts_nwfilter_binding_delete[] =3D { @@ -593,14 +558,9 @@ cmdNWFilterBindingDelete(vshControl *ctl, const vshCmd= *cmd) /* * "nwfilter-binding-dumpxml" command */ -static const vshCmdInfo info_nwfilter_binding_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("network filter information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the network filter information as an XML dump to= stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_binding_dumpxml =3D { + .help =3D N_("network filter information in XML"), + .desc =3D N_("Output the network filter information as an XML dump to = stdout."), }; static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] =3D { @@ -726,14 +686,9 @@ virshNWFilterBindingListCollect(vshControl *ctl, /* * "nwfilter-binding-list" command */ -static const vshCmdInfo info_nwfilter_binding_list[] =3D { - {.name =3D "help", - .data =3D N_("list network filter bindings") - }, - {.name =3D "desc", - .data =3D N_("Returns list of network filter bindings.") - }, - {.name =3D NULL} +static const vshCmdInfo info_nwfilter_binding_list =3D { + .help =3D N_("list network filter bindings"), + .desc =3D N_("Returns list of network filter bindings."), }; static const vshCmdOptDef opts_nwfilter_binding_list[] =3D { @@ -778,55 +733,55 @@ const vshCmdDef nwfilterCmds[] =3D { {.name =3D "nwfilter-define", .handler =3D cmdNWFilterDefine, .opts =3D opts_nwfilter_define, - .info =3D info_nwfilter_define, + .info =3D &info_nwfilter_define, .flags =3D 0 }, {.name =3D "nwfilter-dumpxml", .handler =3D cmdNWFilterDumpXML, .opts =3D opts_nwfilter_dumpxml, - .info =3D info_nwfilter_dumpxml, + .info =3D &info_nwfilter_dumpxml, .flags =3D 0 }, {.name =3D "nwfilter-edit", .handler =3D cmdNWFilterEdit, .opts =3D opts_nwfilter_edit, - .info =3D info_nwfilter_edit, + .info =3D &info_nwfilter_edit, .flags =3D 0 }, {.name =3D "nwfilter-list", .handler =3D cmdNWFilterList, .opts =3D opts_nwfilter_list, - .info =3D info_nwfilter_list, + .info =3D &info_nwfilter_list, .flags =3D 0 }, {.name =3D "nwfilter-undefine", .handler =3D cmdNWFilterUndefine, .opts =3D opts_nwfilter_undefine, - .info =3D info_nwfilter_undefine, + .info =3D &info_nwfilter_undefine, .flags =3D 0 }, {.name =3D "nwfilter-binding-create", .handler =3D cmdNWFilterBindingCreate, .opts =3D opts_nwfilter_binding_create, - .info =3D info_nwfilter_binding_create, + .info =3D &info_nwfilter_binding_create, .flags =3D 0 }, {.name =3D "nwfilter-binding-delete", .handler =3D cmdNWFilterBindingDelete, .opts =3D opts_nwfilter_binding_delete, - .info =3D info_nwfilter_binding_delete, + .info =3D &info_nwfilter_binding_delete, .flags =3D 0 }, {.name =3D "nwfilter-binding-dumpxml", .handler =3D cmdNWFilterBindingDumpXML, .opts =3D opts_nwfilter_binding_dumpxml, - .info =3D info_nwfilter_binding_dumpxml, + .info =3D &info_nwfilter_binding_dumpxml, .flags =3D 0 }, {.name =3D "nwfilter-binding-list", .handler =3D cmdNWFilterBindingList, .opts =3D opts_nwfilter_binding_list, - .info =3D info_nwfilter_binding_list, + .info =3D &info_nwfilter_binding_list, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 8a583a8e1b..a7b82de9be 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -196,14 +196,9 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *c= md, const char *optname, /* * "pool-autostart" command */ -static const vshCmdInfo info_pool_autostart[] =3D { - {.name =3D "help", - .data =3D N_("autostart a pool") - }, - {.name =3D "desc", - .data =3D N_("Configure a pool to be automatically started at boot.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_autostart =3D { + .help =3D N_("autostart a pool"), + .desc =3D N_("Configure a pool to be automatically started at boot."), }; static const vshCmdOptDef opts_pool_autostart[] =3D { @@ -247,14 +242,9 @@ cmdPoolAutostart(vshControl *ctl, const vshCmd *cmd) /* * "pool-create" command */ -static const vshCmdInfo info_pool_create[] =3D { - {.name =3D "help", - .data =3D N_("create a pool from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Create a pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_create =3D { + .help =3D N_("create a pool from an XML file"), + .desc =3D N_("Create a pool."), }; static const vshCmdOptDef opts_pool_create[] =3D { @@ -437,14 +427,9 @@ virshBuildPoolXML(vshControl *ctl, /* * "pool-create-as" command */ -static const vshCmdInfo info_pool_create_as[] =3D { - {.name =3D "help", - .data =3D N_("create a pool from a set of args") - }, - {.name =3D "desc", - .data =3D N_("Create a pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_create_as =3D { + .help =3D N_("create a pool from a set of args"), + .desc =3D N_("Create a pool."), }; static const vshCmdOptDef opts_pool_create_as[] =3D { @@ -503,15 +488,10 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd) /* * "pool-define" command */ -static const vshCmdInfo info_pool_define[] =3D { - {.name =3D "help", - .data =3D N_("define an inactive persistent storage pool or modify " - "an existing persistent one from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Define or modify a persistent storage pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_define =3D { + .help =3D N_("define an inactive persistent storage pool or modify " + "an existing persistent one from an XML file"), + .desc =3D N_("Define or modify a persistent storage pool."), }; static const vshCmdOptDef opts_pool_define[] =3D { @@ -554,14 +534,9 @@ cmdPoolDefine(vshControl *ctl, const vshCmd *cmd) /* * "pool-define-as" command */ -static const vshCmdInfo info_pool_define_as[] =3D { - {.name =3D "help", - .data =3D N_("define a pool from a set of args") - }, - {.name =3D "desc", - .data =3D N_("Define a pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_define_as =3D { + .help =3D N_("define a pool from a set of args"), + .desc =3D N_("Define a pool."), }; static bool @@ -593,14 +568,9 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd) /* * "pool-build" command */ -static const vshCmdInfo info_pool_build[] =3D { - {.name =3D "help", - .data =3D N_("build a pool") - }, - {.name =3D "desc", - .data =3D N_("Build a given pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_build =3D { + .help =3D N_("build a pool"), + .desc =3D N_("Build a given pool."), }; static const vshCmdOptDef opts_pool_build[] =3D { @@ -641,14 +611,9 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd) /* * "pool-destroy" command */ -static const vshCmdInfo info_pool_destroy[] =3D { - {.name =3D "help", - .data =3D N_("destroy (stop) a pool") - }, - {.name =3D "desc", - .data =3D N_("Forcefully stop a given pool. Raw data in the pool is u= ntouched") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_destroy =3D { + .help =3D N_("destroy (stop) a pool"), + .desc =3D N_("Forcefully stop a given pool. Raw data in the pool is un= touched"), }; static const vshCmdOptDef opts_pool_destroy[] =3D { @@ -680,14 +645,9 @@ cmdPoolDestroy(vshControl *ctl, const vshCmd *cmd) /* * "pool-delete" command */ -static const vshCmdInfo info_pool_delete[] =3D { - {.name =3D "help", - .data =3D N_("delete a pool") - }, - {.name =3D "desc", - .data =3D N_("Delete a given pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_delete =3D { + .help =3D N_("delete a pool"), + .desc =3D N_("Delete a given pool."), }; static const vshCmdOptDef opts_pool_delete[] =3D { @@ -719,14 +679,9 @@ cmdPoolDelete(vshControl *ctl, const vshCmd *cmd) /* * "pool-refresh" command */ -static const vshCmdInfo info_pool_refresh[] =3D { - {.name =3D "help", - .data =3D N_("refresh a pool") - }, - {.name =3D "desc", - .data =3D N_("Refresh a given pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_refresh =3D { + .help =3D N_("refresh a pool"), + .desc =3D N_("Refresh a given pool."), }; static const vshCmdOptDef opts_pool_refresh[] =3D { @@ -758,14 +713,9 @@ cmdPoolRefresh(vshControl *ctl, const vshCmd *cmd) /* * "pool-dumpxml" command */ -static const vshCmdInfo info_pool_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("pool information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the pool information as an XML dump to stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_dumpxml =3D { + .help =3D N_("pool information in XML"), + .desc =3D N_("Output the pool information as an XML dump to stdout."), }; static const vshCmdOptDef opts_pool_dumpxml[] =3D { @@ -1051,14 +1001,9 @@ virshStoragePoolStateToString(int state) /* * "pool-list" command */ -static const vshCmdInfo info_pool_list[] =3D { - {.name =3D "help", - .data =3D N_("list pools") - }, - {.name =3D "desc", - .data =3D N_("Returns list of pools.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_list =3D { + .help =3D N_("list pools"), + .desc =3D N_("Returns list of pools."), }; static const vshCmdOptDef opts_pool_list[] =3D { @@ -1401,14 +1346,9 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNU= C_UNUSED) /* * "find-storage-pool-sources-as" command */ -static const vshCmdInfo info_find_storage_pool_sources_as[] =3D { - {.name =3D "help", - .data =3D N_("find potential storage pool sources") - }, - {.name =3D "desc", - .data =3D N_("Returns XML document.") - }, - {.name =3D NULL} +static const vshCmdInfo info_find_storage_pool_sources_as =3D { + .help =3D N_("find potential storage pool sources"), + .desc =3D N_("Returns XML document."), }; static const vshCmdOptDef opts_find_storage_pool_sources_as[] =3D { @@ -1489,14 +1429,9 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vsh= Cmd * cmd G_GNUC_UNUSED) /* * "find-storage-pool-sources" command */ -static const vshCmdInfo info_find_storage_pool_sources[] =3D { - {.name =3D "help", - .data =3D N_("discover potential storage pool sources") - }, - {.name =3D "desc", - .data =3D N_("Returns XML document.") - }, - {.name =3D NULL} +static const vshCmdInfo info_find_storage_pool_sources =3D { + .help =3D N_("discover potential storage pool sources"), + .desc =3D N_("Returns XML document."), }; static const vshCmdOptDef opts_find_storage_pool_sources[] =3D { @@ -1546,14 +1481,9 @@ cmdPoolDiscoverSources(vshControl * ctl, const vshCm= d * cmd G_GNUC_UNUSED) /* * "pool-info" command */ -static const vshCmdInfo info_pool_info[] =3D { - {.name =3D "help", - .data =3D N_("storage pool information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the storage pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_info =3D { + .help =3D N_("storage pool information"), + .desc =3D N_("Returns basic information about the storage pool."), }; static const vshCmdOptDef opts_pool_info[] =3D { @@ -1636,14 +1566,9 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd) /* * "pool-name" command */ -static const vshCmdInfo info_pool_name[] =3D { - {.name =3D "help", - .data =3D N_("convert a pool UUID to pool name") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_name =3D { + .help =3D N_("convert a pool UUID to pool name"), + .desc =3D "", }; static const vshCmdOptDef opts_pool_name[] =3D { @@ -1667,14 +1592,9 @@ cmdPoolName(vshControl *ctl, const vshCmd *cmd) /* * "pool-start" command */ -static const vshCmdInfo info_pool_start[] =3D { - {.name =3D "help", - .data =3D N_("start a (previously defined) inactive pool") - }, - {.name =3D "desc", - .data =3D N_("Start a pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_start =3D { + .help =3D N_("start a (previously defined) inactive pool"), + .desc =3D N_("Start a pool."), }; static const vshCmdOptDef opts_pool_start[] =3D { @@ -1727,14 +1647,9 @@ cmdPoolStart(vshControl *ctl, const vshCmd *cmd) /* * "pool-undefine" command */ -static const vshCmdInfo info_pool_undefine[] =3D { - {.name =3D "help", - .data =3D N_("undefine an inactive pool") - }, - {.name =3D "desc", - .data =3D N_("Undefine the configuration for an inactive pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_undefine =3D { + .help =3D N_("undefine an inactive pool"), + .desc =3D N_("Undefine the configuration for an inactive pool."), }; static const vshCmdOptDef opts_pool_undefine[] =3D { @@ -1766,14 +1681,9 @@ cmdPoolUndefine(vshControl *ctl, const vshCmd *cmd) /* * "pool-uuid" command */ -static const vshCmdInfo info_pool_uuid[] =3D { - {.name =3D "help", - .data =3D N_("convert a pool name to pool UUID") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_uuid =3D { + .help =3D N_("convert a pool name to pool UUID"), + .desc =3D "", }; static const vshCmdOptDef opts_pool_uuid[] =3D { @@ -1802,14 +1712,9 @@ cmdPoolUuid(vshControl *ctl, const vshCmd *cmd) /* * "pool-edit" command */ -static const vshCmdInfo info_pool_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML configuration for a storage pool") - }, - {.name =3D "desc", - .data =3D N_("Edit the XML configuration for a storage pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_edit =3D { + .help =3D N_("edit XML configuration for a storage pool"), + .desc =3D N_("Edit the XML configuration for a storage pool."), }; static const vshCmdOptDef opts_pool_edit[] =3D { @@ -1965,14 +1870,9 @@ virshPoolEventCallback virshPoolEventCallbacks[] =3D= { G_STATIC_ASSERT(VIR_STORAGE_POOL_EVENT_ID_LAST =3D=3D G_N_ELEMENTS(virshPo= olEventCallbacks)); -static const vshCmdInfo info_pool_event[] =3D { - {.name =3D "help", - .data =3D N_("Storage Pool Events") - }, - {.name =3D "desc", - .data =3D N_("List event types, or wait for storage pool events to oc= cur") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_event =3D { + .help =3D N_("Storage Pool Events"), + .desc =3D N_("List event types, or wait for storage pool events to occ= ur"), }; static const vshCmdOptDef opts_pool_event[] =3D { @@ -2085,14 +1985,9 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd) /* * "pool-capabilities" command */ -static const vshCmdInfo info_pool_capabilities[] =3D { - {.name =3D "help", - .data =3D N_("storage pool capabilities") - }, - {.name =3D "desc", - .data =3D N_("Returns capabilities of storage pool support.") - }, - {.name =3D NULL} +static const vshCmdInfo info_pool_capabilities =3D { + .help =3D N_("storage pool capabilities"), + .desc =3D N_("Returns capabilities of storage pool support."), }; static const vshCmdOptDef opts_pool_capabilities[] =3D { @@ -2122,127 +2017,127 @@ const vshCmdDef storagePoolCmds[] =3D { {.name =3D "find-storage-pool-sources-as", .handler =3D cmdPoolDiscoverSourcesAs, .opts =3D opts_find_storage_pool_sources_as, - .info =3D info_find_storage_pool_sources_as, + .info =3D &info_find_storage_pool_sources_as, .flags =3D 0 }, {.name =3D "find-storage-pool-sources", .handler =3D cmdPoolDiscoverSources, .opts =3D opts_find_storage_pool_sources, - .info =3D info_find_storage_pool_sources, + .info =3D &info_find_storage_pool_sources, .flags =3D 0 }, {.name =3D "pool-autostart", .handler =3D cmdPoolAutostart, .opts =3D opts_pool_autostart, - .info =3D info_pool_autostart, + .info =3D &info_pool_autostart, .flags =3D 0 }, {.name =3D "pool-build", .handler =3D cmdPoolBuild, .opts =3D opts_pool_build, - .info =3D info_pool_build, + .info =3D &info_pool_build, .flags =3D 0 }, {.name =3D "pool-create-as", .handler =3D cmdPoolCreateAs, .opts =3D opts_pool_create_as, - .info =3D info_pool_create_as, + .info =3D &info_pool_create_as, .flags =3D 0 }, {.name =3D "pool-create", .handler =3D cmdPoolCreate, .opts =3D opts_pool_create, - .info =3D info_pool_create, + .info =3D &info_pool_create, .flags =3D 0 }, {.name =3D "pool-define-as", .handler =3D cmdPoolDefineAs, .opts =3D opts_pool_define_as, - .info =3D info_pool_define_as, + .info =3D &info_pool_define_as, .flags =3D 0 }, {.name =3D "pool-define", .handler =3D cmdPoolDefine, .opts =3D opts_pool_define, - .info =3D info_pool_define, + .info =3D &info_pool_define, .flags =3D 0 }, {.name =3D "pool-delete", .handler =3D cmdPoolDelete, .opts =3D opts_pool_delete, - .info =3D info_pool_delete, + .info =3D &info_pool_delete, .flags =3D 0 }, {.name =3D "pool-destroy", .handler =3D cmdPoolDestroy, .opts =3D opts_pool_destroy, - .info =3D info_pool_destroy, + .info =3D &info_pool_destroy, .flags =3D 0 }, {.name =3D "pool-dumpxml", .handler =3D cmdPoolDumpXML, .opts =3D opts_pool_dumpxml, - .info =3D info_pool_dumpxml, + .info =3D &info_pool_dumpxml, .flags =3D 0 }, {.name =3D "pool-edit", .handler =3D cmdPoolEdit, .opts =3D opts_pool_edit, - .info =3D info_pool_edit, + .info =3D &info_pool_edit, .flags =3D 0 }, {.name =3D "pool-info", .handler =3D cmdPoolInfo, .opts =3D opts_pool_info, - .info =3D info_pool_info, + .info =3D &info_pool_info, .flags =3D 0 }, {.name =3D "pool-list", .handler =3D cmdPoolList, .opts =3D opts_pool_list, - .info =3D info_pool_list, + .info =3D &info_pool_list, .flags =3D 0 }, {.name =3D "pool-name", .handler =3D cmdPoolName, .opts =3D opts_pool_name, - .info =3D info_pool_name, + .info =3D &info_pool_name, .flags =3D 0 }, {.name =3D "pool-refresh", .handler =3D cmdPoolRefresh, .opts =3D opts_pool_refresh, - .info =3D info_pool_refresh, + .info =3D &info_pool_refresh, .flags =3D 0 }, {.name =3D "pool-start", .handler =3D cmdPoolStart, .opts =3D opts_pool_start, - .info =3D info_pool_start, + .info =3D &info_pool_start, .flags =3D 0 }, {.name =3D "pool-undefine", .handler =3D cmdPoolUndefine, .opts =3D opts_pool_undefine, - .info =3D info_pool_undefine, + .info =3D &info_pool_undefine, .flags =3D 0 }, {.name =3D "pool-uuid", .handler =3D cmdPoolUuid, .opts =3D opts_pool_uuid, - .info =3D info_pool_uuid, + .info =3D &info_pool_uuid, .flags =3D 0 }, {.name =3D "pool-event", .handler =3D cmdPoolEvent, .opts =3D opts_pool_event, - .info =3D info_pool_event, + .info =3D &info_pool_event, .flags =3D 0 }, {.name =3D "pool-capabilities", .handler =3D cmdPoolCapabilities, .opts =3D opts_pool_capabilities, - .info =3D info_pool_capabilities, + .info =3D &info_pool_capabilities, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index e54712ba78..a88980ef9e 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -61,14 +61,9 @@ virshCommandOptSecret(vshControl *ctl, const vshCmd *cmd= , const char **name) /* * "secret-define" command */ -static const vshCmdInfo info_secret_define[] =3D { - {.name =3D "help", - .data =3D N_("define or modify a secret from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Define or modify a secret.") - }, - {.name =3D NULL} +static const vshCmdInfo info_secret_define =3D { + .help =3D N_("define or modify a secret from an XML file"), + .desc =3D N_("Define or modify a secret."), }; static const vshCmdOptDef opts_secret_define[] =3D { @@ -121,14 +116,9 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd) /* * "secret-dumpxml" command */ -static const vshCmdInfo info_secret_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("secret attributes in XML") - }, - {.name =3D "desc", - .data =3D N_("Output attributes of a secret as an XML dump to stdout.= ") - }, - {.name =3D NULL} +static const vshCmdInfo info_secret_dumpxml =3D { + .help =3D N_("secret attributes in XML"), + .desc =3D N_("Output attributes of a secret as an XML dump to stdout."= ), }; static const vshCmdOptDef opts_secret_dumpxml[] =3D { @@ -181,14 +171,9 @@ cmdSecretDumpXML(vshControl *ctl, const vshCmd *cmd) /* * "secret-set-value" command */ -static const vshCmdInfo info_secret_set_value[] =3D { - {.name =3D "help", - .data =3D N_("set a secret value") - }, - {.name =3D "desc", - .data =3D N_("Set a secret value.") - }, - {.name =3D NULL} +static const vshCmdInfo info_secret_set_value =3D { + .help =3D N_("set a secret value"), + .desc =3D N_("Set a secret value."), }; static const vshCmdOptDef opts_secret_set_value[] =3D { @@ -297,14 +282,9 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) /* * "secret-get-value" command */ -static const vshCmdInfo info_secret_get_value[] =3D { - {.name =3D "help", - .data =3D N_("Output a secret value") - }, - {.name =3D "desc", - .data =3D N_("Output a secret value to stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_secret_get_value =3D { + .help =3D N_("Output a secret value"), + .desc =3D N_("Output a secret value to stdout."), }; static const vshCmdOptDef opts_secret_get_value[] =3D { @@ -355,14 +335,9 @@ cmdSecretGetValue(vshControl *ctl, const vshCmd *cmd) /* * "secret-undefine" command */ -static const vshCmdInfo info_secret_undefine[] =3D { - {.name =3D "help", - .data =3D N_("undefine a secret") - }, - {.name =3D "desc", - .data =3D N_("Undefine a secret.") - }, - {.name =3D NULL} +static const vshCmdInfo info_secret_undefine =3D { + .help =3D N_("undefine a secret"), + .desc =3D N_("Undefine a secret."), }; static const vshCmdOptDef opts_secret_undefine[] =3D { @@ -539,14 +514,9 @@ virshSecretListCollect(vshControl *ctl, /* * "secret-list" command */ -static const vshCmdInfo info_secret_list[] =3D { - {.name =3D "help", - .data =3D N_("list secrets") - }, - {.name =3D "desc", - .data =3D N_("Returns a list of secrets") - }, - {.name =3D NULL} +static const vshCmdInfo info_secret_list =3D { + .help =3D N_("list secrets"), + .desc =3D N_("Returns a list of secrets"), }; static const vshCmdOptDef opts_secret_list[] =3D { @@ -732,14 +702,9 @@ virshSecretEventCallback virshSecretEventCallbacks[] = =3D { }; G_STATIC_ASSERT(VIR_SECRET_EVENT_ID_LAST =3D=3D G_N_ELEMENTS(virshSecretEv= entCallbacks)); -static const vshCmdInfo info_secret_event[] =3D { - {.name =3D "help", - .data =3D N_("Secret Events") - }, - {.name =3D "desc", - .data =3D N_("List event types, or wait for secret events to occur") - }, - {.name =3D NULL} +static const vshCmdInfo info_secret_event =3D { + .help =3D N_("Secret Events"), + .desc =3D N_("List event types, or wait for secret events to occur"), }; static const vshCmdOptDef opts_secret_event[] =3D { @@ -852,43 +817,43 @@ const vshCmdDef secretCmds[] =3D { {.name =3D "secret-define", .handler =3D cmdSecretDefine, .opts =3D opts_secret_define, - .info =3D info_secret_define, + .info =3D &info_secret_define, .flags =3D 0 }, {.name =3D "secret-dumpxml", .handler =3D cmdSecretDumpXML, .opts =3D opts_secret_dumpxml, - .info =3D info_secret_dumpxml, + .info =3D &info_secret_dumpxml, .flags =3D 0 }, {.name =3D "secret-event", .handler =3D cmdSecretEvent, .opts =3D opts_secret_event, - .info =3D info_secret_event, + .info =3D &info_secret_event, .flags =3D 0 }, {.name =3D "secret-get-value", .handler =3D cmdSecretGetValue, .opts =3D opts_secret_get_value, - .info =3D info_secret_get_value, + .info =3D &info_secret_get_value, .flags =3D 0 }, {.name =3D "secret-list", .handler =3D cmdSecretList, .opts =3D opts_secret_list, - .info =3D info_secret_list, + .info =3D &info_secret_list, .flags =3D 0 }, {.name =3D "secret-set-value", .handler =3D cmdSecretSetValue, .opts =3D opts_secret_set_value, - .info =3D info_secret_set_value, + .info =3D &info_secret_set_value, .flags =3D 0 }, {.name =3D "secret-undefine", .handler =3D cmdSecretUndefine, .opts =3D opts_secret_undefine, - .info =3D info_secret_undefine, + .info =3D &info_secret_undefine, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 2049872322..31ab27b112 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -100,14 +100,9 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom,= const char *buffer, /* * "snapshot-create" command */ -static const vshCmdInfo info_snapshot_create[] =3D { - {.name =3D "help", - .data =3D N_("Create a snapshot from XML") - }, - {.name =3D "desc", - .data =3D N_("Create a snapshot (disk and RAM) from XML") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_create =3D { + .help =3D N_("Create a snapshot from XML"), + .desc =3D N_("Create a snapshot (disk and RAM) from XML"), }; static const vshCmdOptDef opts_snapshot_create[] =3D { @@ -309,14 +304,9 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBuffer = *buf, const char *str) return ret; } -static const vshCmdInfo info_snapshot_create_as[] =3D { - {.name =3D "help", - .data =3D N_("Create a snapshot from a set of args") - }, - {.name =3D "desc", - .data =3D N_("Create a snapshot (disk and RAM) from arguments") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_create_as =3D { + .help =3D N_("Create a snapshot from a set of args"), + .desc =3D N_("Create a snapshot (disk and RAM) from arguments"), }; static const vshCmdOptDef opts_snapshot_create_as[] =3D { @@ -486,14 +476,9 @@ virshLookupSnapshot(vshControl *ctl, const vshCmd *cmd, /* * "snapshot-edit" command */ -static const vshCmdInfo info_snapshot_edit[] =3D { - {.name =3D "help", - .data =3D N_("edit XML for a snapshot") - }, - {.name =3D "desc", - .data =3D N_("Edit the domain snapshot XML for a named snapshot") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_edit =3D { + .help =3D N_("edit XML for a snapshot"), + .desc =3D N_("Edit the domain snapshot XML for a named snapshot"), }; static const vshCmdOptDef opts_snapshot_edit[] =3D { @@ -596,14 +581,9 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) /* * "snapshot-current" command */ -static const vshCmdInfo info_snapshot_current[] =3D { - {.name =3D "help", - .data =3D N_("Get or set the current snapshot") - }, - {.name =3D "desc", - .data =3D N_("Get or set the current snapshot") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_current =3D { + .help =3D N_("Get or set the current snapshot"), + .desc =3D N_("Get or set the current snapshot"), }; static const vshCmdOptDef opts_snapshot_current[] =3D { @@ -808,14 +788,9 @@ virshSnapshotFilter(vshControl *ctl, virDomainSnapshot= Ptr snapshot, /* * "snapshot-info" command */ -static const vshCmdInfo info_snapshot_info[] =3D { - {.name =3D "help", - .data =3D N_("snapshot information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about a snapshot.") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_info =3D { + .help =3D N_("snapshot information"), + .desc =3D N_("Returns basic information about a snapshot."), }; static const vshCmdOptDef opts_snapshot_info[] =3D { @@ -1342,14 +1317,9 @@ virshSnapshotListLookup(int id, bool parent, void *o= paque) /* * "snapshot-list" command */ -static const vshCmdInfo info_snapshot_list[] =3D { - {.name =3D "help", - .data =3D N_("List snapshots for a domain") - }, - {.name =3D "desc", - .data =3D N_("Snapshot List") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_list =3D { + .help =3D N_("List snapshots for a domain"), + .desc =3D N_("Snapshot List"), }; static const vshCmdOptDef opts_snapshot_list[] =3D { @@ -1589,14 +1559,9 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) /* * "snapshot-dumpxml" command */ -static const vshCmdInfo info_snapshot_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("Dump XML for a domain snapshot") - }, - {.name =3D "desc", - .data =3D N_("Snapshot Dump XML") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_dumpxml =3D { + .help =3D N_("Dump XML for a domain snapshot"), + .desc =3D N_("Snapshot Dump XML"), }; static const vshCmdOptDef opts_snapshot_dumpxml[] =3D { @@ -1659,14 +1624,9 @@ cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *cm= d) /* * "snapshot-parent" command */ -static const vshCmdInfo info_snapshot_parent[] =3D { - {.name =3D "help", - .data =3D N_("Get the name of the parent of a snapshot") - }, - {.name =3D "desc", - .data =3D N_("Extract the snapshot's parent, if any") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_parent =3D { + .help =3D N_("Get the name of the parent of a snapshot"), + .desc =3D N_("Extract the snapshot's parent, if any"), }; static const vshCmdOptDef opts_snapshot_parent[] =3D { @@ -1711,14 +1671,9 @@ cmdSnapshotParent(vshControl *ctl, const vshCmd *cmd) /* * "snapshot-revert" command */ -static const vshCmdInfo info_snapshot_revert[] =3D { - {.name =3D "help", - .data =3D N_("Revert a domain to a snapshot") - }, - {.name =3D "desc", - .data =3D N_("Revert domain to snapshot") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_revert =3D { + .help =3D N_("Revert a domain to a snapshot"), + .desc =3D N_("Revert domain to snapshot"), }; static const vshCmdOptDef opts_snapshot_revert[] =3D { @@ -1797,14 +1752,9 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCm= d *cmd) /* * "snapshot-delete" command */ -static const vshCmdInfo info_snapshot_delete[] =3D { - {.name =3D "help", - .data =3D N_("Delete a domain snapshot") - }, - {.name =3D "desc", - .data =3D N_("Snapshot Delete") - }, - {.name =3D NULL} +static const vshCmdInfo info_snapshot_delete =3D { + .help =3D N_("Delete a domain snapshot"), + .desc =3D N_("Snapshot Delete"), }; static const vshCmdOptDef opts_snapshot_delete[] =3D { @@ -1872,61 +1822,61 @@ const vshCmdDef snapshotCmds[] =3D { {.name =3D "snapshot-create", .handler =3D cmdSnapshotCreate, .opts =3D opts_snapshot_create, - .info =3D info_snapshot_create, + .info =3D &info_snapshot_create, .flags =3D 0 }, {.name =3D "snapshot-create-as", .handler =3D cmdSnapshotCreateAs, .opts =3D opts_snapshot_create_as, - .info =3D info_snapshot_create_as, + .info =3D &info_snapshot_create_as, .flags =3D 0 }, {.name =3D "snapshot-current", .handler =3D cmdSnapshotCurrent, .opts =3D opts_snapshot_current, - .info =3D info_snapshot_current, + .info =3D &info_snapshot_current, .flags =3D 0 }, {.name =3D "snapshot-delete", .handler =3D cmdSnapshotDelete, .opts =3D opts_snapshot_delete, - .info =3D info_snapshot_delete, + .info =3D &info_snapshot_delete, .flags =3D 0 }, {.name =3D "snapshot-dumpxml", .handler =3D cmdSnapshotDumpXML, .opts =3D opts_snapshot_dumpxml, - .info =3D info_snapshot_dumpxml, + .info =3D &info_snapshot_dumpxml, .flags =3D 0 }, {.name =3D "snapshot-edit", .handler =3D cmdSnapshotEdit, .opts =3D opts_snapshot_edit, - .info =3D info_snapshot_edit, + .info =3D &info_snapshot_edit, .flags =3D 0 }, {.name =3D "snapshot-info", .handler =3D cmdSnapshotInfo, .opts =3D opts_snapshot_info, - .info =3D info_snapshot_info, + .info =3D &info_snapshot_info, .flags =3D 0 }, {.name =3D "snapshot-list", .handler =3D cmdSnapshotList, .opts =3D opts_snapshot_list, - .info =3D info_snapshot_list, + .info =3D &info_snapshot_list, .flags =3D 0 }, {.name =3D "snapshot-parent", .handler =3D cmdSnapshotParent, .opts =3D opts_snapshot_parent, - .info =3D info_snapshot_parent, + .info =3D &info_snapshot_parent, .flags =3D 0 }, {.name =3D "snapshot-revert", .handler =3D cmdDomainSnapshotRevert, .opts =3D opts_snapshot_revert, - .info =3D info_snapshot_revert, + .info =3D &info_snapshot_revert, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 329ca3a66c..0cb7262b67 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -164,14 +164,9 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *cm= d, /* * "vol-create-as" command */ -static const vshCmdInfo info_vol_create_as[] =3D { - {.name =3D "help", - .data =3D N_("create a volume from a set of args") - }, - {.name =3D "desc", - .data =3D N_("Create a vol.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_create_as =3D { + .help =3D N_("create a volume from a set of args"), + .desc =3D N_("Create a vol."), }; static const vshCmdOptDef opts_vol_create_as[] =3D { @@ -363,14 +358,9 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) /* * "vol-create" command */ -static const vshCmdInfo info_vol_create[] =3D { - {.name =3D "help", - .data =3D N_("create a vol from an XML file") - }, - {.name =3D "desc", - .data =3D N_("Create a vol.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_create =3D { + .help =3D N_("create a vol from an XML file"), + .desc =3D N_("Create a vol."), }; static const vshCmdOptDef opts_vol_create[] =3D { @@ -426,14 +416,9 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd) /* * "vol-create-from" command */ -static const vshCmdInfo info_vol_create_from[] =3D { - {.name =3D "help", - .data =3D N_("create a vol, using another volume as input") - }, - {.name =3D "desc", - .data =3D N_("Create a vol from an existing volume.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_create_from =3D { + .help =3D N_("create a vol, using another volume as input"), + .desc =3D N_("Create a vol from an existing volume."), }; static const vshCmdOptDef opts_vol_create_from[] =3D { @@ -526,14 +511,9 @@ virshMakeCloneXML(const char *origxml, const char *new= name) /* * "vol-clone" command */ -static const vshCmdInfo info_vol_clone[] =3D { - {.name =3D "help", - .data =3D N_("clone a volume.") - }, - {.name =3D "desc", - .data =3D N_("Clone an existing volume within the parent pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_clone =3D { + .help =3D N_("clone a volume."), + .desc =3D N_("Clone an existing volume within the parent pool."), }; static const vshCmdOptDef opts_vol_clone[] =3D { @@ -616,14 +596,9 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd) /* * "vol-upload" command */ -static const vshCmdInfo info_vol_upload[] =3D { - {.name =3D "help", - .data =3D N_("upload file contents to a volume") - }, - {.name =3D "desc", - .data =3D N_("Upload file contents to a volume") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_upload =3D { + .help =3D N_("upload file contents to a volume"), + .desc =3D N_("Upload file contents to a volume"), }; static const vshCmdOptDef opts_vol_upload[] =3D { @@ -729,14 +704,9 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) /* * "vol-download" command */ -static const vshCmdInfo info_vol_download[] =3D { - {.name =3D "help", - .data =3D N_("download volume contents to a file") - }, - {.name =3D "desc", - .data =3D N_("Download volume contents to a file") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_download =3D { + .help =3D N_("download volume contents to a file"), + .desc =3D N_("Download volume contents to a file"), }; static const vshCmdOptDef opts_vol_download[] =3D { @@ -845,14 +815,9 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd) /* * "vol-delete" command */ -static const vshCmdInfo info_vol_delete[] =3D { - {.name =3D "help", - .data =3D N_("delete a vol") - }, - {.name =3D "desc", - .data =3D N_("Delete a given vol.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_delete =3D { + .help =3D N_("delete a vol"), + .desc =3D N_("Delete a given vol."), }; static const vshCmdOptDef opts_vol_delete[] =3D { @@ -894,14 +859,9 @@ cmdVolDelete(vshControl *ctl, const vshCmd *cmd) /* * "vol-wipe" command */ -static const vshCmdInfo info_vol_wipe[] =3D { - {.name =3D "help", - .data =3D N_("wipe a vol") - }, - {.name =3D "desc", - .data =3D N_("Ensure data previously on a volume is not accessible to= future reads") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_wipe =3D { + .help =3D N_("wipe a vol"), + .desc =3D N_("Ensure data previously on a volume is not accessible to = future reads"), }; static const vshCmdOptDef opts_vol_wipe[] =3D { @@ -978,14 +938,9 @@ virshVolumeTypeToString(int type) /* * "vol-info" command */ -static const vshCmdInfo info_vol_info[] =3D { - {.name =3D "help", - .data =3D N_("storage vol information") - }, - {.name =3D "desc", - .data =3D N_("Returns basic information about the storage vol.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_info =3D { + .help =3D N_("storage vol information"), + .desc =3D N_("Returns basic information about the storage vol."), }; static const vshCmdOptDef opts_vol_info[] =3D { @@ -1058,16 +1013,11 @@ cmdVolInfo(vshControl *ctl, const vshCmd *cmd) /* * "vol-resize" command */ -static const vshCmdInfo info_vol_resize[] =3D { - {.name =3D "help", - .data =3D N_("resize a vol") - }, - {.name =3D "desc", - .data =3D N_("Resizes a storage volume. This is safe only for storage= " +static const vshCmdInfo info_vol_resize =3D { + .help =3D N_("resize a vol"), + .desc =3D N_("Resizes a storage volume. This is safe only for storage= " "volumes not in use by an active guest.\n" - "See blockresize for live resizing.") - }, - {.name =3D NULL} + "See blockresize for live resizing."), }; static const vshCmdOptDef opts_vol_resize[] =3D { @@ -1153,14 +1103,9 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) /* * "vol-dumpxml" command */ -static const vshCmdInfo info_vol_dumpxml[] =3D { - {.name =3D "help", - .data =3D N_("vol information in XML") - }, - {.name =3D "desc", - .data =3D N_("Output the vol information as an XML dump to stdout.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_dumpxml =3D { + .help =3D N_("vol information in XML"), + .desc =3D N_("Output the vol information as an XML dump to stdout."), }; static const vshCmdOptDef opts_vol_dumpxml[] =3D { @@ -1327,14 +1272,9 @@ virshStorageVolListCollect(vshControl *ctl, /* * "vol-list" command */ -static const vshCmdInfo info_vol_list[] =3D { - {.name =3D "help", - .data =3D N_("list vols") - }, - {.name =3D "desc", - .data =3D N_("Returns list of vols by pool.") - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_list =3D { + .help =3D N_("list vols"), + .desc =3D N_("Returns list of vols by pool."), }; static const vshCmdOptDef opts_vol_list[] =3D { @@ -1485,14 +1425,9 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd G_GNUC= _UNUSED) /* * "vol-name" command */ -static const vshCmdInfo info_vol_name[] =3D { - {.name =3D "help", - .data =3D N_("returns the volume name for a given volume key or path") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_name =3D { + .help =3D N_("returns the volume name for a given volume key or path"), + .desc =3D "", }; static const vshCmdOptDef opts_vol_name[] =3D { @@ -1516,14 +1451,9 @@ cmdVolName(vshControl *ctl, const vshCmd *cmd) /* * "vol-pool" command */ -static const vshCmdInfo info_vol_pool[] =3D { - {.name =3D "help", - .data =3D N_("returns the storage pool for a given volume key or path= ") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_pool =3D { + .help =3D N_("returns the storage pool for a given volume key or path"= ), + .desc =3D "", }; static const vshCmdOptDef opts_vol_pool[] =3D { @@ -1571,14 +1501,9 @@ cmdVolPool(vshControl *ctl, const vshCmd *cmd) /* * "vol-key" command */ -static const vshCmdInfo info_vol_key[] =3D { - {.name =3D "help", - .data =3D N_("returns the volume key for a given volume name or path") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_key =3D { + .help =3D N_("returns the volume key for a given volume name or path"), + .desc =3D "", }; static const vshCmdOptDef opts_vol_key[] =3D { @@ -1602,14 +1527,9 @@ cmdVolKey(vshControl *ctl, const vshCmd *cmd) /* * "vol-path" command */ -static const vshCmdInfo info_vol_path[] =3D { - {.name =3D "help", - .data =3D N_("returns the volume path for a given volume name or key") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_vol_path =3D { + .help =3D N_("returns the volume path for a given volume name or key"), + .desc =3D "", }; static const vshCmdOptDef opts_vol_path[] =3D { @@ -1639,97 +1559,97 @@ const vshCmdDef storageVolCmds[] =3D { {.name =3D "vol-clone", .handler =3D cmdVolClone, .opts =3D opts_vol_clone, - .info =3D info_vol_clone, + .info =3D &info_vol_clone, .flags =3D 0 }, {.name =3D "vol-create-as", .handler =3D cmdVolCreateAs, .opts =3D opts_vol_create_as, - .info =3D info_vol_create_as, + .info =3D &info_vol_create_as, .flags =3D 0 }, {.name =3D "vol-create", .handler =3D cmdVolCreate, .opts =3D opts_vol_create, - .info =3D info_vol_create, + .info =3D &info_vol_create, .flags =3D 0 }, {.name =3D "vol-create-from", .handler =3D cmdVolCreateFrom, .opts =3D opts_vol_create_from, - .info =3D info_vol_create_from, + .info =3D &info_vol_create_from, .flags =3D 0 }, {.name =3D "vol-delete", .handler =3D cmdVolDelete, .opts =3D opts_vol_delete, - .info =3D info_vol_delete, + .info =3D &info_vol_delete, .flags =3D 0 }, {.name =3D "vol-download", .handler =3D cmdVolDownload, .opts =3D opts_vol_download, - .info =3D info_vol_download, + .info =3D &info_vol_download, .flags =3D 0 }, {.name =3D "vol-dumpxml", .handler =3D cmdVolDumpXML, .opts =3D opts_vol_dumpxml, - .info =3D info_vol_dumpxml, + .info =3D &info_vol_dumpxml, .flags =3D 0 }, {.name =3D "vol-info", .handler =3D cmdVolInfo, .opts =3D opts_vol_info, - .info =3D info_vol_info, + .info =3D &info_vol_info, .flags =3D 0 }, {.name =3D "vol-key", .handler =3D cmdVolKey, .opts =3D opts_vol_key, - .info =3D info_vol_key, + .info =3D &info_vol_key, .flags =3D 0 }, {.name =3D "vol-list", .handler =3D cmdVolList, .opts =3D opts_vol_list, - .info =3D info_vol_list, + .info =3D &info_vol_list, .flags =3D 0 }, {.name =3D "vol-name", .handler =3D cmdVolName, .opts =3D opts_vol_name, - .info =3D info_vol_name, + .info =3D &info_vol_name, .flags =3D 0 }, {.name =3D "vol-path", .handler =3D cmdVolPath, .opts =3D opts_vol_path, - .info =3D info_vol_path, + .info =3D &info_vol_path, .flags =3D 0 }, {.name =3D "vol-pool", .handler =3D cmdVolPool, .opts =3D opts_vol_pool, - .info =3D info_vol_pool, + .info =3D &info_vol_pool, .flags =3D 0 }, {.name =3D "vol-resize", .handler =3D cmdVolResize, .opts =3D opts_vol_resize, - .info =3D info_vol_resize, + .info =3D &info_vol_resize, .flags =3D 0 }, {.name =3D "vol-upload", .handler =3D cmdVolUpload, .opts =3D opts_vol_upload, - .info =3D info_vol_upload, + .info =3D &info_vol_upload, .flags =3D 0 }, {.name =3D "vol-wipe", .handler =3D cmdVolWipe, .opts =3D opts_vol_wipe, - .info =3D info_vol_wipe, + .info =3D &info_vol_wipe, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/virsh.c b/tools/virsh.c index 0d860d0390..5b38881066 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -256,15 +256,10 @@ static const vshCmdOptDef opts_connect[] =3D { {.name =3D NULL} }; -static const vshCmdInfo info_connect[] =3D { - {.name =3D "help", - .data =3D N_("(re)connect to hypervisor") - }, - {.name =3D "desc", - .data =3D N_("Connect to local hypervisor. This is built-in " - "command after shell start up.") - }, - {.name =3D NULL} +static const vshCmdInfo info_connect =3D { + .help =3D N_("(re)connect to hypervisor"), + .desc =3D N_("Connect to local hypervisor. This is built-in " + "command after shell start up."), }; static bool @@ -464,8 +459,7 @@ virshUsage(void) cmd->flags & VSH_CMD_FLAG_HIDDEN) continue; fprintf(stdout, - " %-30s %s\n", cmd->name, - _(vshCmddefGetInfo(cmd, "help"))); + " %-30s %s\n", cmd->name, _(cmd->info->help)); } fprintf(stdout, "\n"); } @@ -795,7 +789,7 @@ static const vshCmdDef virshCmds[] =3D { {.name =3D "connect", .handler =3D cmdConnect, .opts =3D opts_connect, - .info =3D info_connect, + .info =3D &info_connect, .flags =3D VSH_CMD_FLAG_NOCONNECT }, {.name =3D NULL} diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 32e0c82f36..114ec2e8e7 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -167,14 +167,9 @@ vshAdmReconnect(vshControl *ctl) * 'uri' command */ -static const vshCmdInfo info_uri[] =3D { - {.name =3D "help", - .data =3D N_("print the admin server URI") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +static const vshCmdInfo info_uri =3D { + .help =3D N_("print the admin server URI"), + .desc =3D "", }; static bool @@ -198,14 +193,9 @@ cmdURI(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSE= D) * "version" command */ -static const vshCmdInfo info_version[] =3D { - {.name =3D "help", - .data =3D N_("show version") - }, - {.name =3D "desc", - .data =3D N_("Display the system and also the daemon version informat= ion.") - }, - {.name =3D NULL} +static const vshCmdInfo info_version =3D { + .help =3D N_("show version"), + .desc =3D N_("Display the system and also the daemon version informati= on."), }; static bool @@ -270,14 +260,9 @@ static const vshCmdOptDef opts_connect[] =3D { {.name =3D NULL} }; -static const vshCmdInfo info_connect[] =3D { - {.name =3D "help", - .data =3D N_("connect to daemon's admin server") - }, - {.name =3D "desc", - .data =3D N_("Connect to a daemon's administrating server.") - }, - {.name =3D NULL} +static const vshCmdInfo info_connect =3D { + .help =3D N_("connect to daemon's admin server"), + .desc =3D N_("Connect to a daemon's administrating server."), }; static bool @@ -308,14 +293,9 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd) * ------------------- */ -static const vshCmdInfo info_srv_list[] =3D { - {.name =3D "help", - .data =3D N_("list available servers on a daemon") - }, - {.name =3D "desc", - .data =3D N_("List all manageable servers on a daemon.") - }, - {.name =3D NULL} +static const vshCmdInfo info_srv_list =3D { + .help =3D N_("list available servers on a daemon"), + .desc =3D N_("List all manageable servers on a daemon."), }; static bool @@ -371,14 +351,9 @@ cmdSrvList(vshControl *ctl, const vshCmd *cmd G_GNUC_U= NUSED) * ------------------------------ */ -static const vshCmdInfo info_srv_threadpool_info[] =3D { - {.name =3D "help", - .data =3D N_("get server workerpool parameters") - }, - {.name =3D "desc", - .data =3D N_("Retrieve threadpool attributes from a server.") - }, - {.name =3D NULL} +static const vshCmdInfo info_srv_threadpool_info =3D { + .help =3D N_("get server workerpool parameters"), + .desc =3D N_("Retrieve threadpool attributes from a server."), }; static const vshCmdOptDef opts_srv_threadpool_info[] =3D { @@ -432,15 +407,10 @@ cmdSrvThreadpoolInfo(vshControl *ctl, const vshCmd *c= md) * ----------------------------- */ -static const vshCmdInfo info_srv_threadpool_set[] =3D { - {.name =3D "help", - .data =3D N_("set server workerpool parameters") - }, - {.name =3D "desc", - .data =3D N_("Tune threadpool attributes on a server. See OPTIONS for= " - "currently supported attributes.") - }, - {.name =3D NULL} +static const vshCmdInfo info_srv_threadpool_set =3D { + .help =3D N_("set server workerpool parameters"), + .desc =3D N_("Tune threadpool attributes on a server. See OPTIONS for= " + "currently supported attributes."), }; static const vshCmdOptDef opts_srv_threadpool_set[] =3D { @@ -539,14 +509,9 @@ cmdSrvThreadpoolSet(vshControl *ctl, const vshCmd *cmd) * --------------------------- */ -static const vshCmdInfo info_srv_clients_list[] =3D { - {.name =3D "help", - .data =3D N_("list clients connected to ") - }, - {.name =3D "desc", - .data =3D N_("List all manageable clients connected to .") - }, - {.name =3D NULL} +static const vshCmdInfo info_srv_clients_list =3D { + .help =3D N_("list clients connected to "), + .desc =3D N_("List all manageable clients connected to ."), }; static const vshCmdOptDef opts_srv_clients_list[] =3D { @@ -626,14 +591,9 @@ cmdSrvClientsList(vshControl *ctl, const vshCmd *cmd) * ------------------- */ -static const vshCmdInfo info_client_info[] =3D { - {.name =3D "help", - .data =3D N_("retrieve client's identity info from server") - }, - {.name =3D "desc", - .data =3D N_("Retrieve identity details about from ") - }, - {.name =3D NULL} +static const vshCmdInfo info_client_info =3D { + .help =3D N_("retrieve client's identity info from server"), + .desc =3D N_("Retrieve identity details about from "), }; static const vshCmdOptDef opts_client_info[] =3D { @@ -712,15 +672,10 @@ cmdClientInfo(vshControl *ctl, const vshCmd *cmd) * ------------------------- */ -static const vshCmdInfo info_client_disconnect[] =3D { - {.name =3D "help", - .data =3D N_("force disconnect a client from the given server") - }, - {.name =3D "desc", - .data =3D N_("Force close a specific client's connection to the given= " - "server.") - }, - {.name =3D NULL} +static const vshCmdInfo info_client_disconnect =3D { + .help =3D N_("force disconnect a client from the given server"), + .desc =3D N_("Force close a specific client's connection to the given= " + "server."), }; static const vshCmdOptDef opts_client_disconnect[] =3D { @@ -779,14 +734,9 @@ cmdClientDisconnect(vshControl *ctl, const vshCmd *cmd) * --------------------------- */ -static const vshCmdInfo info_srv_clients_info[] =3D { - {.name =3D "help", - .data =3D N_("get server's client-related configuration limits") - }, - {.name =3D "desc", - .data =3D N_("Retrieve server's client-related configuration limits") - }, - {.name =3D NULL} +static const vshCmdInfo info_srv_clients_info =3D { + .help =3D N_("get server's client-related configuration limits"), + .desc =3D N_("Retrieve server's client-related configuration limits"), }; static const vshCmdOptDef opts_srv_clients_info[] =3D { @@ -837,15 +787,10 @@ cmdSrvClientsInfo(vshControl *ctl, const vshCmd *cmd) * -------------------------- */ -static const vshCmdInfo info_srv_clients_set[] =3D { - {.name =3D "help", - .data =3D N_("set server's client-related configuration limits") - }, - {.name =3D "desc", - .data =3D N_("Tune server's client-related configuration limits. " - "See OPTIONS for currently supported attributes.") - }, - {.name =3D NULL} +static const vshCmdInfo info_srv_clients_set =3D { + .help =3D N_("set server's client-related configuration limits"), + .desc =3D N_("Tune server's client-related configuration limits. " + "See OPTIONS for currently supported attributes."), }; static const vshCmdOptDef opts_srv_clients_set[] =3D { @@ -938,16 +883,11 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) * Command server-update-tls * -------------------------- */ -static const vshCmdInfo info_srv_update_tls_file[] =3D { - {.name =3D "help", - .data =3D N_("notify server to update TLS related files online.") - }, - {.name =3D "desc", - .data =3D N_("notify server to update the CA cert, " +static const vshCmdInfo info_srv_update_tls_file =3D { + .help =3D N_("notify server to update TLS related files online."), + .desc =3D N_("notify server to update the CA cert, " "CA CRL, server cert / key without restarts. " - "See OPTIONS for currently supported attributes.") - }, - {.name =3D NULL} + "See OPTIONS for currently supported attributes."), }; static const vshCmdOptDef opts_srv_update_tls_file[] =3D { @@ -992,17 +932,12 @@ cmdSrvUpdateTlsFiles(vshControl *ctl, const vshCmd *c= md) * Command daemon-log-filters * -------------------------- */ -static const vshCmdInfo info_daemon_log_filters[] =3D { - {.name =3D "help", - .data =3D N_("fetch or set the currently defined set of logging filte= rs on " - "daemon") - }, - {.name =3D "desc", - .data =3D N_("Depending on whether run with or without options, the c= ommand " +static const vshCmdInfo info_daemon_log_filters =3D { + .help =3D N_("fetch or set the currently defined set of logging filte= rs on " + "daemon"), + .desc =3D N_("Depending on whether run with or without options, the c= ommand " "fetches or redefines the existing active set of filters o= n " - "daemon.") - }, - {.name =3D NULL} + "daemon."), }; static const vshCmdOptDef opts_daemon_log_filters[] =3D { @@ -1045,17 +980,12 @@ cmdDaemonLogFilters(vshControl *ctl, const vshCmd *c= md) * Command daemon-log-outputs * -------------------------- */ -static const vshCmdInfo info_daemon_log_outputs[] =3D { - {.name =3D "help", - .data =3D N_("fetch or set the currently defined set of logging outpu= ts on " - "daemon") - }, - {.name =3D "desc", - .data =3D N_("Depending on whether run with or without options, the c= ommand " +static const vshCmdInfo info_daemon_log_outputs =3D { + .help =3D N_("fetch or set the currently defined set of logging outpu= ts on " + "daemon"), + .desc =3D N_("Depending on whether run with or without options, the c= ommand " "fetches or redefines the existing active set of outputs o= n " - "daemon.") - }, - {.name =3D NULL} + "daemon."), }; static const vshCmdOptDef opts_daemon_timeout[] =3D { @@ -1087,14 +1017,9 @@ cmdDaemonTimeout(vshControl *ctl, const vshCmd *cmd) * Command daemon-timeout * -------------------------- */ -static const vshCmdInfo info_daemon_timeout[] =3D { - {.name =3D "help", - .data =3D N_("set the auto shutdown timeout of the daemon") - }, - {.name =3D "desc", - .data =3D N_("set the auto shutdown timeout of the daemon") - }, - {.name =3D NULL} +static const vshCmdInfo info_daemon_timeout =3D { + .help =3D N_("set the auto shutdown timeout of the daemon"), + .desc =3D N_("set the auto shutdown timeout of the daemon"), }; static const vshCmdOptDef opts_daemon_log_outputs[] =3D { @@ -1266,8 +1191,7 @@ vshAdmUsage(void) cmd->flags & VSH_CMD_FLAG_HIDDEN) continue; fprintf(stdout, - " %-30s %s\n", cmd->name, - _(vshCmddefGetInfo(cmd, "help"))); + " %-30s %s\n", cmd->name, _(cmd->info->help)); } fprintf(stdout, "\n"); } @@ -1409,19 +1333,19 @@ static const vshCmdDef vshAdmCmds[] =3D { {.name =3D "uri", .handler =3D cmdURI, .opts =3D NULL, - .info =3D info_uri, + .info =3D &info_uri, .flags =3D 0 }, {.name =3D "version", .handler =3D cmdVersion, .opts =3D NULL, - .info =3D info_version, + .info =3D &info_version, .flags =3D 0 }, {.name =3D "connect", .handler =3D cmdConnect, .opts =3D opts_connect, - .info =3D info_connect, + .info =3D &info_connect, .flags =3D VSH_CMD_FLAG_NOCONNECT }, {.name =3D NULL} @@ -1434,7 +1358,7 @@ static const vshCmdDef monitoringCmds[] =3D { {.name =3D "server-list", .handler =3D cmdSrvList, .opts =3D NULL, - .info =3D info_srv_list, + .info =3D &info_srv_list, .flags =3D 0 }, {.name =3D "srv-threadpool-info", @@ -1443,7 +1367,7 @@ static const vshCmdDef monitoringCmds[] =3D { {.name =3D "server-threadpool-info", .handler =3D cmdSrvThreadpoolInfo, .opts =3D opts_srv_threadpool_info, - .info =3D info_srv_threadpool_info, + .info =3D &info_srv_threadpool_info, .flags =3D 0 }, {.name =3D "srv-clients-list", @@ -1452,13 +1376,13 @@ static const vshCmdDef monitoringCmds[] =3D { {.name =3D "client-list", .handler =3D cmdSrvClientsList, .opts =3D opts_srv_clients_list, - .info =3D info_srv_clients_list, + .info =3D &info_srv_clients_list, .flags =3D 0 }, {.name =3D "client-info", .handler =3D cmdClientInfo, .opts =3D opts_client_info, - .info =3D info_client_info, + .info =3D &info_client_info, .flags =3D 0 }, {.name =3D "srv-clients-info", @@ -1467,7 +1391,7 @@ static const vshCmdDef monitoringCmds[] =3D { {.name =3D "server-clients-info", .handler =3D cmdSrvClientsInfo, .opts =3D opts_srv_clients_info, - .info =3D info_srv_clients_info, + .info =3D &info_srv_clients_info, .flags =3D 0 }, {.name =3D NULL} @@ -1480,13 +1404,13 @@ static const vshCmdDef managementCmds[] =3D { {.name =3D "server-threadpool-set", .handler =3D cmdSrvThreadpoolSet, .opts =3D opts_srv_threadpool_set, - .info =3D info_srv_threadpool_set, + .info =3D &info_srv_threadpool_set, .flags =3D 0 }, {.name =3D "client-disconnect", .handler =3D cmdClientDisconnect, .opts =3D opts_client_disconnect, - .info =3D info_client_disconnect, + .info =3D &info_client_disconnect, .flags =3D 0 }, {.name =3D "srv-clients-set", @@ -1495,7 +1419,7 @@ static const vshCmdDef managementCmds[] =3D { {.name =3D "server-clients-set", .handler =3D cmdSrvClientsSet, .opts =3D opts_srv_clients_set, - .info =3D info_srv_clients_set, + .info =3D &info_srv_clients_set, .flags =3D 0 }, {.name =3D "srv-update-tls", @@ -1504,25 +1428,25 @@ static const vshCmdDef managementCmds[] =3D { {.name =3D "server-update-tls", .handler =3D cmdSrvUpdateTlsFiles, .opts =3D opts_srv_update_tls_file, - .info =3D info_srv_update_tls_file, + .info =3D &info_srv_update_tls_file, .flags =3D 0 }, {.name =3D "daemon-log-filters", .handler =3D cmdDaemonLogFilters, .opts =3D opts_daemon_log_filters, - .info =3D info_daemon_log_filters, + .info =3D &info_daemon_log_filters, .flags =3D 0 }, {.name =3D "daemon-log-outputs", .handler =3D cmdDaemonLogOutputs, .opts =3D opts_daemon_log_outputs, - .info =3D info_daemon_log_outputs, + .info =3D &info_daemon_log_outputs, .flags =3D 0 }, {.name =3D "daemon-timeout", .handler =3D cmdDaemonTimeout, .opts =3D opts_daemon_timeout, - .info =3D info_daemon_timeout, + .info =3D &info_daemon_timeout, .flags =3D 0 }, {.name =3D NULL} diff --git a/tools/vsh.c b/tools/vsh.c index 55921a0759..688161beda 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -239,22 +239,6 @@ vshReportError(vshControl *ctl) */ static int disconnected; /* we may have been disconnected */ -/* --------------- - * Utils for work with command definition - * --------------- - */ -const char * -vshCmddefGetInfo(const vshCmdDef * cmd, const char *name) -{ - const vshCmdInfo *info; - - for (info =3D cmd->info; info && info->name; info++) { - if (STREQ(info->name, name)) - return info->data; - } - return NULL; -} - /* Check if the internal command definitions are correct. * None of the errors are to be marked as translatable. */ static int @@ -263,7 +247,6 @@ vshCmddefCheckInternals(vshControl *ctl, bool missingCompleters) { size_t i; - const char *help =3D NULL; bool seenOptionalOption =3D false; g_auto(virBuffer) complbuf =3D VIR_BUFFER_INITIALIZER; @@ -308,7 +291,7 @@ vshCmddefCheckInternals(vshControl *ctl, } /* Each command has to provide a non-empty help string. */ - if (!(help =3D vshCmddefGetInfo(cmd, "help")) || !*help) { + if (!cmd->info || !cmd->info->help || !*cmd->info->help) { vshError(ctl, "command '%s' lacks help", cmd->name); return -1; } @@ -627,8 +610,7 @@ vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp) if (cmd->alias || cmd->flags & VSH_CMD_FLAG_HIDDEN) continue; - vshPrint(ctl, " %-30s %s\n", cmd->name, - _(vshCmddefGetInfo(cmd, "help"))); + vshPrint(ctl, " %-30s %s\n", cmd->name, _(cmd->info->help)); } return true; @@ -637,13 +619,11 @@ vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp) static bool vshCmddefHelp(const vshCmdDef *def) { - const char *desc =3D NULL; char buf[256]; bool shortopt =3D false; /* true if 'arg' works instead of '--opt arg'= */ fputs(_(" NAME\n"), stdout); - fprintf(stdout, " %s - %s\n", def->name, - _(vshCmddefGetInfo(def, "help"))); + fprintf(stdout, " %s - %s\n", def->name, _(def->info->help)); fputs(_("\n SYNOPSIS\n"), stdout); fprintf(stdout, " %s", def->name); @@ -695,11 +675,10 @@ vshCmddefHelp(const vshCmdDef *def) } fputc('\n', stdout); - desc =3D vshCmddefGetInfo(def, "desc"); - if (desc && *desc) { + if (def->info->desc && *def->info->desc) { /* Print the description only if it's not empty. */ fputs(_("\n DESCRIPTION\n"), stdout); - fprintf(stdout, " %s\n", _(desc)); + fprintf(stdout, " %s\n", _(def->info->desc)); } if (def->opts && def->opts->name) { @@ -3078,15 +3057,10 @@ const vshCmdOptDef opts_help[] =3D { {.name =3D NULL} }; -const vshCmdInfo info_help[] =3D { - {.name =3D "help", - .data =3D N_("print help") - }, - {.name =3D "desc", - .data =3D N_("Prints global help, command specific help, or help for = a\n" - " group of related commands") - }, - {.name =3D NULL} +const vshCmdInfo info_help =3D { + .help =3D N_("print help"), + .desc =3D N_("Prints global help, command specific help, or help for = a\n" + " group of related commands"), }; bool @@ -3107,8 +3081,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) if (def->alias || def->flags & VSH_CMD_FLAG_HIDDEN) continue; - vshPrint(ctl, " %-30s %s\n", def->name, - _(vshCmddefGetInfo(def, "help"))); + vshPrint(ctl, " %-30s %s\n", def->name, _(def->info->he= lp)); } vshPrint(ctl, "\n"); @@ -3137,14 +3110,9 @@ const vshCmdOptDef opts_cd[] =3D { {.name =3D NULL} }; -const vshCmdInfo info_cd[] =3D { - {.name =3D "help", - .data =3D N_("change the current directory") - }, - {.name =3D "desc", - .data =3D N_("Change the current directory.") - }, - {.name =3D NULL} +const vshCmdInfo info_cd =3D { + .help =3D N_("change the current directory"), + .desc =3D N_("Change the current directory."), }; bool @@ -3204,14 +3172,9 @@ const vshCmdOptDef opts_echo[] =3D { {.name =3D NULL} }; -const vshCmdInfo info_echo[] =3D { - {.name =3D "help", - .data =3D N_("echo arguments. Used for internal testing.") - }, - {.name =3D "desc", - .data =3D N_("Echo back arguments, possibly with quoting. Used for in= ternal testing.") - }, - {.name =3D NULL} +const vshCmdInfo info_echo =3D { + .help =3D N_("echo arguments. Used for internal testing."), + .desc =3D N_("Echo back arguments, possibly with quoting. Used for int= ernal testing."), }; /* Exists mainly for debugging virsh, but also handy for adding back @@ -3266,14 +3229,9 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd) return true; } -const vshCmdInfo info_pwd[] =3D { - {.name =3D "help", - .data =3D N_("print the current directory") - }, - {.name =3D "desc", - .data =3D N_("Print the current directory.") - }, - {.name =3D NULL} +const vshCmdInfo info_pwd =3D { + .help =3D N_("print the current directory"), + .desc =3D N_("Print the current directory."), }; bool @@ -3286,14 +3244,9 @@ cmdPwd(vshControl *ctl, const vshCmd *cmd G_GNUC_UNU= SED) return true; } -const vshCmdInfo info_quit[] =3D { - {.name =3D "help", - .data =3D N_("quit this interactive terminal") - }, - {.name =3D "desc", - .data =3D "" - }, - {.name =3D NULL} +const vshCmdInfo info_quit =3D { + .help =3D N_("quit this interactive terminal"), + .desc =3D "", }; bool @@ -3318,14 +3271,9 @@ const vshCmdOptDef opts_selftest[] =3D { }, {.name =3D NULL} }; -const vshCmdInfo info_selftest[] =3D { - {.name =3D "help", - .data =3D N_("internal command for testing virt shells") - }, - {.name =3D "desc", - .data =3D N_("internal use only") - }, - {.name =3D NULL} +const vshCmdInfo info_selftest =3D { + .help =3D N_("internal command for testing virt shells"), + .desc =3D N_("internal use only"), }; bool @@ -3363,14 +3311,9 @@ const vshCmdOptDef opts_complete[] =3D { {.name =3D NULL} }; -const vshCmdInfo info_complete[] =3D { - {.name =3D "help", - .data =3D N_("internal command for autocompletion") - }, - {.name =3D "desc", - .data =3D N_("internal use only") - }, - {.name =3D NULL} +const vshCmdInfo info_complete =3D { + .help =3D N_("internal command for autocompletion"), + .desc =3D N_("internal use only"), }; diff --git a/tools/vsh.h b/tools/vsh.h index a191b50c2d..c8015b8dd7 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -119,15 +119,12 @@ typedef char **(*vshCompleter)(vshControl *ctl, unsigned int flags); /* - * vshCmdInfo -- name/value pair for information about command - * - * Commands should have at least the following names: * "help" - short description of command * "desc" - description of command, or empty string */ struct _vshCmdInfo { - const char *name; /* name of information, or NULL for list e= nd */ - const char *data; /* non-NULL information */ + const char *help; /* short description of command */ + const char *desc; /* description of command */ }; /* @@ -248,7 +245,6 @@ void vshOutputLogFile(vshControl *ctl, int log_level, c= onst char *format, G_GNUC_PRINTF(3, 0); void vshCloseLogFile(vshControl *ctl); -const char *vshCmddefGetInfo(const vshCmdDef *cmd, const char *info); const vshCmdDef *vshCmddefSearch(const char *cmdname); const vshCmdGrp *vshCmdGrpSearch(const char *grpname); bool vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp); @@ -374,17 +370,17 @@ int vshEventWait(vshControl *ctl); /* generic commands */ extern const vshCmdOptDef opts_help[]; -extern const vshCmdInfo info_help[]; +extern const vshCmdInfo info_help; extern const vshCmdOptDef opts_cd[]; -extern const vshCmdInfo info_cd[]; +extern const vshCmdInfo info_cd; extern const vshCmdOptDef opts_echo[]; -extern const vshCmdInfo info_echo[]; -extern const vshCmdInfo info_pwd[]; -extern const vshCmdInfo info_quit[]; +extern const vshCmdInfo info_echo; +extern const vshCmdInfo info_pwd; +extern const vshCmdInfo info_quit; extern const vshCmdOptDef opts_selftest[]; -extern const vshCmdInfo info_selftest[]; +extern const vshCmdInfo info_selftest; extern const vshCmdOptDef opts_complete[]; -extern const vshCmdInfo info_complete[]; +extern const vshCmdInfo info_complete; bool cmdHelp(vshControl *ctl, const vshCmd *cmd); bool cmdCd(vshControl *ctl, const vshCmd *cmd); @@ -399,7 +395,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "cd", \ .handler =3D cmdCd, \ .opts =3D opts_cd, \ - .info =3D info_cd, \ + .info =3D &info_cd, \ .flags =3D VSH_CMD_FLAG_NOCONNECT \ } @@ -408,7 +404,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "echo", \ .handler =3D cmdEcho, \ .opts =3D opts_echo, \ - .info =3D info_echo, \ + .info =3D &info_echo, \ .flags =3D VSH_CMD_FLAG_NOCONNECT \ } @@ -417,7 +413,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "exit", \ .handler =3D cmdQuit, \ .opts =3D NULL, \ - .info =3D info_quit, \ + .info =3D &info_quit, \ .flags =3D VSH_CMD_FLAG_NOCONNECT \ } @@ -426,7 +422,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "help", \ .handler =3D cmdHelp, \ .opts =3D opts_help, \ - .info =3D info_help, \ + .info =3D &info_help, \ .flags =3D VSH_CMD_FLAG_NOCONNECT \ } @@ -435,7 +431,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "pwd", \ .handler =3D cmdPwd, \ .opts =3D NULL, \ - .info =3D info_pwd, \ + .info =3D &info_pwd, \ .flags =3D VSH_CMD_FLAG_NOCONNECT \ } @@ -444,7 +440,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "quit", \ .handler =3D cmdQuit, \ .opts =3D NULL, \ - .info =3D info_quit, \ + .info =3D &info_quit, \ .flags =3D VSH_CMD_FLAG_NOCONNECT \ } @@ -453,7 +449,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "self-test", \ .handler =3D cmdSelfTest, \ .opts =3D opts_selftest, \ - .info =3D info_selftest, \ + .info =3D &info_selftest, \ .flags =3D VSH_CMD_FLAG_NOCONNECT | VSH_CMD_FLAG_HIDDEN, \ } @@ -462,7 +458,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); .name =3D "complete", \ .handler =3D cmdComplete, \ .opts =3D opts_complete, \ - .info =3D info_complete, \ + .info =3D &info_complete, \ .flags =3D VSH_CMD_FLAG_NOCONNECT | VSH_CMD_FLAG_HIDDEN, \ } --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710158191566195.1958939206902; Mon, 11 Mar 2024 04:56:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5451211C; Mon, 11 Mar 2024 07:56:30 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 925351DD1; Mon, 11 Mar 2024 07:34:06 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D31B919C0; Mon, 11 Mar 2024 07:31:15 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 52D951A6E for ; Mon, 11 Mar 2024 07:31:15 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-Td3bbCjNNiOVvlVpUrOE8A-1; Mon, 11 Mar 2024 07:31:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 73959185A784 for ; Mon, 11 Mar 2024 11:31:13 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id E03E2111E3F3 for ; Mon, 11 Mar 2024 11:31:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Td3bbCjNNiOVvlVpUrOE8A-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 11/23] vshCmddefHelp: Refactor printing of help (list of arguments) Date: Mon, 11 Mar 2024 12:30:48 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: VLSV3CHV37H4HYH2SCNQ235R3GXXA4ZH X-Message-ID-Hash: VLSV3CHV37H4HYH2SCNQ235R3GXXA4ZH X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710158192906100001 Extract flag check to a separate variable and replace ternary operators by normal conditions and directly output the text rather than using extra variable to improve readability. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 688161beda..add50fe670 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -630,47 +630,63 @@ vshCmddefHelp(const vshCmdDef *def) if (def->opts) { const vshCmdOptDef *opt; for (opt =3D def->opts; opt->name; opt++) { - const char *fmt =3D "%s"; + bool required_option =3D opt->flags & VSH_OFLAG_REQ; + switch (opt->type) { case VSH_OT_BOOL: - fmt =3D "[--%s]"; + fprintf(stdout, " [--%s]", opt->name); break; + case VSH_OT_INT: - /* xgettext:c-format */ - fmt =3D ((opt->flags & VSH_OFLAG_REQ) ? "<%s>" - : _("[--%1$s ]")); + if (required_option) { + fprintf(stdout, " <%s>", opt->name); + } else { + fprintf(stdout, _(" [--%1$s ]"), opt->name); + } + if (!(opt->flags & VSH_OFLAG_REQ_OPT)) shortopt =3D true; break; + case VSH_OT_STRING: - /* xgettext:c-format */ - fmt =3D _("[--%1$s ]"); + fprintf(stdout, _(" [--%1$s ]"), opt->name); + if (!(opt->flags & VSH_OFLAG_REQ_OPT)) shortopt =3D true; break; + case VSH_OT_DATA: - fmt =3D ((opt->flags & VSH_OFLAG_REQ) ? "<%s>" : "[<%s>]"); + if (required_option) { + fprintf(stdout, " <%s>", opt->name); + } else { + fprintf(stdout, " [<%s>]", opt->name); + } + if (!(opt->flags & VSH_OFLAG_REQ_OPT)) shortopt =3D true; break; + case VSH_OT_ARGV: - /* xgettext:c-format */ if (shortopt) { - fmt =3D (opt->flags & VSH_OFLAG_REQ) - ? _("{[--%1$s] }...") - : _("[[--%1$s] ]..."); + if (required_option) { + fprintf(stdout, _(" {[--%1$s] }..."), opt-= >name); + } else { + fprintf(stdout, _(" [[--%1$s] ]..."), opt-= >name); + } } else { - fmt =3D (opt->flags & VSH_OFLAG_REQ) ? _("<%1$s>...") - : _("[<%1$s>]..."); + if (required_option) { + fprintf(stdout, " <%s>...", opt->name); + } else { + fprintf(stdout, " [<%s>]...", opt->name); + } } break; + case VSH_OT_ALIAS: case VSH_OT_NONE: /* aliases are intentionally undocumented */ continue; } - fputc(' ', stdout); - fprintf(stdout, fmt, opt->name); } } fputc('\n', stdout); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710158285588485.1733939879372; Mon, 11 Mar 2024 04:58:05 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 814921DFC; Mon, 11 Mar 2024 07:58:04 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8F0771EFC; Mon, 11 Mar 2024 07:34:19 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4D8B91CF3; Mon, 11 Mar 2024 07:31:17 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1B1671CEC for ; Mon, 11 Mar 2024 07:31:16 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-vdt-zJI4MmiygjDs2GvrmQ-1; Mon, 11 Mar 2024 07:31:14 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B1A73C0E640 for ; Mon, 11 Mar 2024 11:31:14 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id C854D112131D for ; Mon, 11 Mar 2024 11:31:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: vdt-zJI4MmiygjDs2GvrmQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 12/23] vshCmddefHelp: Refactor printing of help (argument description) Date: Mon, 11 Mar 2024 12:30:49 +0100 Message-ID: <0da3c93d28e5bd2d12e13fe56d997fdfbe658ee1.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: ATOZZWR2FMP7TR2KLJDSB5666NEZDBIP X-Message-ID-Hash: ATOZZWR2FMP7TR2KLJDSB5666NEZDBIP X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710158287273100001 Extract flag check to a separate variable and replace ternary operators by normal conditions and use allocated buffer instead of a static one to improve readability. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index add50fe670..af5a576932 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -619,7 +619,6 @@ vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp) static bool vshCmddefHelp(const vshCmdDef *def) { - char buf[256]; bool shortopt =3D false; /* true if 'arg' works instead of '--opt arg'= */ fputs(_(" NAME\n"), stdout); @@ -701,33 +700,44 @@ vshCmddefHelp(const vshCmdDef *def) const vshCmdOptDef *opt; fputs(_("\n OPTIONS\n"), stdout); for (opt =3D def->opts; opt->name; opt++) { + bool required_option =3D opt->flags & VSH_OFLAG_REQ; + g_autofree char *optstr =3D NULL; + switch (opt->type) { case VSH_OT_BOOL: - g_snprintf(buf, sizeof(buf), "--%s", opt->name); + optstr =3D g_strdup_printf("--%s", opt->name); break; + case VSH_OT_INT: - g_snprintf(buf, sizeof(buf), - (opt->flags & VSH_OFLAG_REQ) ? _("[--%1$s] ") - : _("--%1$s "), opt->name); + if (required_option) { + optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); + } else { + optstr =3D g_strdup_printf(_("--%1$s "), opt->= name); + } break; + case VSH_OT_STRING: - g_snprintf(buf, sizeof(buf), _("--%1$s "), opt->na= me); + optstr =3D g_strdup_printf(_("--%1$s "), opt->name= ); break; + case VSH_OT_DATA: - g_snprintf(buf, sizeof(buf), _("[--%1$s] "), - opt->name); + optstr =3D g_strdup_printf(_("[--%1$s] "), opt->na= me); break; + case VSH_OT_ARGV: - g_snprintf(buf, sizeof(buf), - shortopt ? _("[--%1$s] ") : _("<%1$s>"), - opt->name); + if (shortopt) { + optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); + } else { + optstr =3D g_strdup_printf("<%s>", opt->name); + } break; + case VSH_OT_ALIAS: case VSH_OT_NONE: continue; } - fprintf(stdout, " %-15s %s\n", buf, _(opt->help)); + fprintf(stdout, " %-15s %s\n", optstr, _(opt->help)); } } fputc('\n', stdout); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710158387097634.7203430689059; Mon, 11 Mar 2024 04:59:47 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 117091E83; Mon, 11 Mar 2024 07:59:46 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C1B2F1EC6; Mon, 11 Mar 2024 07:34:30 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1D7121D1E; Mon, 11 Mar 2024 07:31:19 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4E3B41CEC for ; Mon, 11 Mar 2024 07:31:17 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-RE69Ol8HPA2C4bSZheZarg-1; Mon, 11 Mar 2024 07:31:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4401E811E81 for ; Mon, 11 Mar 2024 11:31:15 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFB991121306 for ; Mon, 11 Mar 2024 11:31:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: RE69Ol8HPA2C4bSZheZarg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 13/23] vshCmddefGetOption: Improve readability Date: Mon, 11 Mar 2024 12:30:50 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: OTAYERWP7IJIOZWAG3JDGM5GN33KLTQS X-Message-ID-Hash: OTAYERWP7IJIOZWAG3JDGM5GN33KLTQS X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710158387713100001 Declare one argument per line, separate disticnt conditions by newline, move some checks earlier. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 69 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index af5a576932..de68f93a1f 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -468,9 +468,14 @@ static vshCmdOptDef helpopt =3D { .type =3D VSH_OT_BOOL, .help =3D N_("print help for this function") }; + static const vshCmdOptDef * -vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name, - uint64_t *opts_seen, size_t *opt_index, char **optstr, +vshCmddefGetOption(vshControl *ctl, + const vshCmdDef *cmd, + const char *name, + uint64_t *opts_seen, + size_t *opt_index, + char **optstr, bool report) { size_t i; @@ -482,39 +487,43 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *= cmd, const char *name, for (i =3D 0; cmd->opts && cmd->opts[i].name; i++) { const vshCmdOptDef *opt =3D &cmd->opts[i]; - if (STREQ(opt->name, name)) { - if (opt->type =3D=3D VSH_OT_ALIAS) { - char *value; - - /* Two types of replacements: - opt->help =3D "string": straight replacement of name - opt->help =3D "string=3Dvalue": treat boolean flag as - alias of option and its default value */ - alias =3D g_strdup(opt->help); - name =3D alias; - if ((value =3D strchr(name, '=3D'))) { - *value =3D '\0'; - if (*optstr) { - if (report) - vshError(ctl, _("invalid '=3D' after option --= %1$s"), - opt->name); - return NULL; - } - *optstr =3D g_strdup(value + 1); + if (STRNEQ(opt->name, name)) + continue; + + if (opt->type =3D=3D VSH_OT_ALIAS) { + char *value; + + /* Two types of replacements: + opt->help =3D "string": straight replacement of name + opt->help =3D "string=3Dvalue": treat boolean flag as + alias of option and its default value */ + alias =3D g_strdup(opt->help); + name =3D alias; + if ((value =3D strchr(name, '=3D'))) { + *value =3D '\0'; + if (*optstr) { + if (report) + vshError(ctl, _("invalid '=3D' after option --%1$s= "), + opt->name); + return NULL; } - continue; + *optstr =3D g_strdup(value + 1); } - if ((*opts_seen & (1ULL << i)) && opt->type !=3D VSH_OT_ARGV) { - if (report) - vshError(ctl, _("option --%1$s already seen"), name); - return NULL; - } - *opts_seen |=3D 1ULL << i; - *opt_index =3D i; - return opt; + continue; } + + if ((*opts_seen & (1ULL << i)) && opt->type !=3D VSH_OT_ARGV) { + if (report) + vshError(ctl, _("option --%1$s already seen"), name); + return NULL; + } + + *opts_seen |=3D 1ULL << i; + *opt_index =3D i; + return opt; } + /* The 'help' command ignores extra options */ if (STRNEQ(cmd->name, "help") && report) { vshError(ctl, _("command '%1$s' doesn't support option --%2$s"), cmd->name, name); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710158504211856.7257316368872; Mon, 11 Mar 2024 05:01:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2A6971F57; Mon, 11 Mar 2024 08:01:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1EC8F1F05; Mon, 11 Mar 2024 07:34:46 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2F18F1D01; Mon, 11 Mar 2024 07:31:20 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DE6441C16 for ; Mon, 11 Mar 2024 07:31:17 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-iLMfuILoMPq1NWBw0CD7aQ-1; Mon, 11 Mar 2024 07:31:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B9B68007A6 for ; Mon, 11 Mar 2024 11:31:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 985671121337 for ; Mon, 11 Mar 2024 11:31:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: iLMfuILoMPq1NWBw0CD7aQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 14/23] virsh: Inline only use of VIRSH_COMMON_OPT_DOMAIN_OT_ARGV macro Date: Mon, 11 Mar 2024 12:30:51 +0100 Message-ID: <58932001c46d4cd4d7c83febe002a7311901e6b5.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: OIC6B4QBFANCOLWPX3QWJPYA6W7DVDAS X-Message-ID-Hash: OIC6B4QBFANCOLWPX3QWJPYA6W7DVDAS X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710158504498100001 There's just one command taking a list of domains as argument, thus declare it inline. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 6 +++++- tools/virsh.h | 12 ------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 277eb71342..7a25318bbd 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -2048,7 +2048,11 @@ static const vshCmdOptDef opts_domstats[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("report only stats that are accessible instantly"), }, - VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("list of domains to get stats for")= , 0), + {.name =3D "domain", + .type =3D VSH_OT_ARGV, + .help =3D N_("list of domains to get stats for"), + .completer =3D virshDomainNameCompleter, + }, {.name =3D NULL} }; diff --git a/tools/virsh.h b/tools/virsh.h index 6acefa7f9d..877b290e3a 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -119,18 +119,6 @@ VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), \ oflags, cflags) -#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \ - {.name =3D "domain", \ - .type =3D VSH_OT_ARGV, \ - .flags =3D VSH_OFLAG_NONE, \ - .help =3D _helpstr, \ - .completer =3D virshDomainNameCompleter, \ - .completer_flags =3D cflags, \ - } - -#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \ - VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("domain name, id or uuid"), cflags) - typedef struct _virshControl virshControl; typedef struct _virshCtrlData virshCtrlData; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710159518668296.41162460930184; Mon, 11 Mar 2024 05:18:38 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6298A1F0E; Mon, 11 Mar 2024 08:18:37 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DA66B1E2F; Mon, 11 Mar 2024 07:35:31 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 42C311D01; Mon, 11 Mar 2024 07:31:44 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 87F411CF3 for ; Mon, 11 Mar 2024 07:31:19 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-502-keZu5oUWOyKtnmP7bfVDvA-1; Mon, 11 Mar 2024 07:31:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43B518007A7 for ; Mon, 11 Mar 2024 11:31:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 825041121337 for ; Mon, 11 Mar 2024 11:31:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: keZu5oUWOyKtnmP7bfVDvA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 15/23] vsh: Annotate 'required' and 'positional' arguments explicitly Date: Mon, 11 Mar 2024 12:30:52 +0100 Message-ID: <68f2e466f459c0e2d70ca8ab3e57d314eeb7b63d.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: VWNVJJGLMCUFKUZ44KHWYQVLZZDJCSRQ X-Message-ID-Hash: VWNVJJGLMCUFKUZ44KHWYQVLZZDJCSRQ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710159519234100001 Add 'positional' and 'required' fields to vshCmdOptDef, which will explicitly track the two properties of arguments. To ensure that we have proper coverage, add checks to vshCmddefCheckInternals validating the state of the above flags by infering it from existing data. This conversion will allow us: - remove VSH_OT_DATA in favor of VSH_OT_STRING - use VSH_OT_INT when required both as positional and non-positional - properly annotate which VSH_OT_ARGV are positional and which are not (currently inferred by whether an previous positional option exists) Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 5 ++ tools/virsh-domain.c | 118 +++++++++++++++++++++++++++++++++++ tools/virsh-host.c | 10 +++ tools/virsh-interface.c | 12 ++++ tools/virsh-network.c | 16 ++++- tools/virsh-nodedev.c | 20 ++++++ tools/virsh-nwfilter.c | 10 +++ tools/virsh-pool.c | 8 +++ tools/virsh-secret.c | 8 +++ tools/virsh-snapshot.c | 2 + tools/virsh-volume.c | 12 ++++ tools/virsh.h | 16 +++-- tools/virt-admin.c | 22 +++++++ tools/vsh.c | 32 +++++++++- tools/vsh.h | 2 + 15 files changed, 286 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 7a25318bbd..573451c678 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -738,6 +738,8 @@ static const vshCmdOptDef opts_domif_getlink[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device (MAC Address)") @@ -1038,6 +1040,8 @@ static const vshCmdOptDef opts_domifstat[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "interface", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device specified by name or MAC Address") @@ -2050,6 +2054,7 @@ static const vshCmdOptDef opts_domstats[] =3D { }, {.name =3D "domain", .type =3D VSH_OT_ARGV, + .positional =3D true, .help =3D N_("list of domains to get stats for"), .completer =3D virshDomainNameCompleter, }, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 6768a1f24e..7a63757131 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -420,11 +420,15 @@ static const vshCmdOptDef opts_attach_disk[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "source", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK, .help =3D N_("source of disk device or name of network disk") }, {.name =3D "target", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("target of disk device") @@ -812,11 +816,15 @@ static const vshCmdOptDef opts_attach_interface[] =3D= { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network interface type") }, {.name =3D "source", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("source of network interface") }, @@ -1188,6 +1196,8 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("block device") @@ -1981,6 +1991,8 @@ static const vshCmdOptDef opts_blockcommit[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of disk") @@ -2200,6 +2212,8 @@ static const vshCmdOptDef opts_blockcopy[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of source disk") @@ -2532,6 +2546,8 @@ static const vshCmdOptDef opts_blockjob[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of disk") @@ -2743,6 +2759,8 @@ static const vshCmdOptDef opts_blockpull[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of disk") @@ -2885,6 +2903,8 @@ static const vshCmdOptDef opts_blockresize[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("Fully-qualified path of block device") @@ -3042,12 +3062,16 @@ static const vshCmdOptDef opts_domif_setlink[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device (MAC Address)") }, {.name =3D "state", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceStateCompleter, .help =3D N_("new state of the device") @@ -3188,6 +3212,8 @@ static const vshCmdOptDef opts_domiftune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device (MAC Address)") @@ -3413,6 +3439,8 @@ static const vshCmdOptDef opts_dom_pm_suspend[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_RUNNING), {.name =3D "target", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshNodeSuspendTargetCompleter, .help =3D N_("mem(Suspend-to-RAM), " @@ -4096,6 +4124,8 @@ static const vshCmdOptDef opts_save[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "file", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("where to save the data") }, @@ -4445,6 +4475,8 @@ static const vshCmdInfo info_save_image_dumpxml =3D { static const vshCmdOptDef opts_save_image_dumpxml[] =3D { {.name =3D "file", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to read") }, @@ -4502,11 +4534,15 @@ static const vshCmdInfo info_save_image_define =3D { static const vshCmdOptDef opts_save_image_define[] =3D { {.name =3D "file", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to modify") }, {.name =3D "xml", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated XML for the target") @@ -4565,6 +4601,8 @@ static const vshCmdInfo info_save_image_edit =3D { static const vshCmdOptDef opts_save_image_edit[] =3D { {.name =3D "file", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to edit") }, @@ -4904,6 +4942,8 @@ static const vshCmdOptDef opts_managed_save_define[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE), {.name =3D "xml", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated XML for the target") @@ -5180,6 +5220,8 @@ static const vshCmdInfo info_restore =3D { static const vshCmdOptDef opts_restore[] =3D { {.name =3D "file", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("the state to restore") }, @@ -5263,6 +5305,8 @@ static const vshCmdOptDef opts_dump[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "file", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("where to dump the core") }, @@ -5562,12 +5606,16 @@ static const vshCmdOptDef opts_setLifecycleAction[]= =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainLifecycleCompleter, .help =3D N_("lifecycle type to modify") }, {.name =3D "action", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainLifecycleActionCompleter, .help =3D N_("lifecycle action to set") @@ -5654,11 +5702,15 @@ static const vshCmdOptDef opts_set_user_password[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("the username") }, {.name =3D "password", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("the new password") @@ -7074,6 +7126,8 @@ static const vshCmdOptDef opts_setvcpus[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "count", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("number of virtual CPUs") }, @@ -7240,6 +7294,8 @@ static const vshCmdOptDef opts_setvcpu[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "vcpulist", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainVcpulistCompleter, .help =3D N_("ids of vcpus to manipulate") @@ -7314,12 +7370,16 @@ static const vshCmdOptDef opts_domblkthreshold[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "dev", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("device to set threshold for") }, {.name =3D "threshold", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("threshold as a scaled number (by default bytes)") }, @@ -7442,12 +7502,16 @@ static const vshCmdOptDef opts_iothreadpin[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "iothread", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("IOThread ID number") }, {.name =3D "cpulist", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainCpulistCompleter, .help =3D N_("host cpu number(s) to set") @@ -7515,6 +7579,8 @@ static const vshCmdOptDef opts_iothreadadd[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "id", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("iothread for the new IOThread") }, @@ -7571,6 +7637,8 @@ static const vshCmdOptDef opts_iothreadset[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "id", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("iothread id of existing IOThread") @@ -7687,6 +7755,8 @@ static const vshCmdOptDef opts_iothreaddel[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "id", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("iothread_id for the IOThread to delete") @@ -8296,6 +8366,8 @@ static const vshCmdOptDef opts_metadata[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "uri", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("URI of the namespace") }, @@ -8474,6 +8546,7 @@ static const vshCmdOptDef opts_send_key[] =3D { }, {.name =3D "keycode", .type =3D VSH_OT_ARGV, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshKeycodeNameCompleter, .help =3D N_("the key code") @@ -8558,12 +8631,16 @@ static const vshCmdOptDef opts_send_process_signal[= ] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "pid", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("the process ID") }, {.name =3D "signame", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainSignalCompleter, .help =3D N_("the signal number or name") @@ -8652,6 +8729,8 @@ static const vshCmdOptDef opts_setmem[] =3D { }, {.name =3D "size", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("new memory size, as scaled integer (default KiB)") }, @@ -8721,6 +8800,8 @@ static const vshCmdOptDef opts_setmaxmem[] =3D { }, {.name =3D "size", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("new maximum memory size, as scaled integer (default KiB= )") }, @@ -9494,12 +9575,16 @@ static const vshCmdOptDef opts_dom_fd_associate[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "name", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("name of the FD group") }, {.name =3D "pass-fds", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("file descriptors N,M,... to associate") @@ -9576,6 +9661,7 @@ static const vshCmdOptDef opts_qemu_monitor_command[]= =3D { }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("command") }, @@ -9911,6 +9997,8 @@ static const vshCmdInfo info_qemu_attach =3D { static const vshCmdOptDef opts_qemu_attach[] =3D { {.name =3D "pid", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("pid") @@ -9968,6 +10056,7 @@ static const vshCmdOptDef opts_qemu_agent_command[] = =3D { }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("command") }, @@ -10064,6 +10153,7 @@ static const vshCmdOptDef opts_lxc_enter_namespace[= ] =3D { }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("command to run") }, @@ -10243,11 +10333,15 @@ static const vshCmdInfo info_domxmlfromnative =3D= { static const vshCmdOptDef opts_domxmlfromnative[] =3D { {.name =3D "format", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("source config data format") }, {.name =3D "config", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("config data file to import from") @@ -10291,6 +10385,8 @@ static const vshCmdInfo info_domxmltonative =3D { static const vshCmdOptDef opts_domxmltonative[] =3D { {.name =3D "format", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("target config data type format") }, @@ -10358,6 +10454,8 @@ static const vshCmdInfo info_domname =3D { static const vshCmdOptDef opts_domname[] =3D { {.name =3D "domain", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainUUIDCompleter, .help =3D N_("domain id or uuid") @@ -10391,6 +10489,8 @@ static const vshCmdOptDef opts_domrename[] =3D { VIR_CONNECT_LIST_DOMAINS_INACTIVE), {.name =3D "new-name", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("new domain name") @@ -10493,6 +10593,8 @@ static const vshCmdOptDef opts_migrate[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "desturi", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("connection URI of the destination host as seen from the= client(normal migration) or source(p2p migration)") @@ -11190,6 +11292,8 @@ static const vshCmdOptDef opts_migrate_setmaxdownti= me[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "downtime", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("maximum tolerable downtime (in milliseconds) for migrat= ion") }, @@ -11308,6 +11412,8 @@ static const vshCmdOptDef opts_migrate_setspeed[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "bandwidth", .type =3D VSH_OT_INT, + .required =3D true, + .positional =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("migration bandwidth limit in MiB/s") }, @@ -11897,6 +12003,8 @@ static const vshCmdOptDef opts_detach_device_alias[= ] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "alias", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDeviceAliasCompleter, .help =3D N_("device alias") @@ -12025,6 +12133,8 @@ static const vshCmdOptDef opts_detach_interface[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network interface type") }, @@ -12397,6 +12507,8 @@ static const vshCmdOptDef opts_detach_disk[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "target", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("target of disk device") @@ -12557,6 +12669,8 @@ static const vshCmdOptDef opts_change_media[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "path", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("Fully-qualified path or target of disk device") @@ -13031,6 +13145,8 @@ static const vshCmdOptDef opts_get_user_sshkeys[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("user to list authorized keys for"), }, @@ -13078,6 +13194,8 @@ static const vshCmdOptDef opts_set_user_sshkeys[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("user to set authorized keys for"), }, diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 1a97f4926b..368e656550 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -468,12 +468,16 @@ static const vshCmdInfo info_allocpages =3D { static const vshCmdOptDef opts_allocpages[] =3D { {.name =3D "pagesize", .type =3D VSH_OT_INT, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshAllocpagesPagesizeCompleter, .help =3D N_("page size (in kibibytes)") }, {.name =3D "pagecount", .type =3D VSH_OT_INT, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("page count") }, @@ -943,6 +947,8 @@ static const vshCmdInfo info_nodesuspend =3D { static const vshCmdOptDef opts_node_suspend[] =3D { {.name =3D "target", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshNodeSuspendTargetCompleter, .help =3D N_("mem(Suspend-to-RAM), disk(Suspend-to-Disk), " @@ -950,6 +956,8 @@ static const vshCmdOptDef opts_node_suspend[] =3D { }, {.name =3D "duration", .type =3D VSH_OT_INT, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("Suspend duration in seconds, at least 60") }, @@ -1270,6 +1278,8 @@ static const vshCmdInfo info_cpu_models =3D { static const vshCmdOptDef opts_cpu_models[] =3D { {.name =3D "arch", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .completer =3D virshArchCompleter, .flags =3D VSH_OFLAG_REQ, .help =3D N_("architecture") diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 5dde4f9d46..52dce97462 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -21,6 +21,8 @@ #define VIRSH_COMMON_OPT_INTERFACE(cflags) \ {.name =3D "interface", \ .type =3D VSH_OT_DATA, \ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .help =3D N_("interface name or MAC address"), \ .completer =3D virshInterfaceNameCompleter, \ @@ -383,6 +385,8 @@ static const vshCmdInfo info_interface_name =3D { static const vshCmdOptDef opts_interface_name[] =3D { {.name =3D "interface", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshInterfaceMacCompleter, .help =3D N_("interface mac") @@ -414,6 +418,8 @@ static const vshCmdInfo info_interface_mac =3D { static const vshCmdOptDef opts_interface_mac[] =3D { {.name =3D "interface", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshInterfaceNameCompleter, .help =3D N_("interface name") @@ -716,12 +722,16 @@ static const vshCmdInfo info_interface_bridge =3D { static const vshCmdOptDef opts_interface_bridge[] =3D { {.name =3D "interface", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshInterfaceNameCompleter, .help =3D N_("existing interface name") }, {.name =3D "bridge", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("new bridge device name") }, @@ -943,6 +953,8 @@ static const vshCmdInfo info_interface_unbridge =3D { static const vshCmdOptDef opts_interface_unbridge[] =3D { {.name =3D "bridge", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("current bridge device name") }, diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 6f4a66b659..b9db3e061d 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -32,7 +32,9 @@ #define VIRSH_COMMON_OPT_NETWORK(_helpstr, cflags) \ {.name =3D "network", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_DATA,\ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshNetworkNameCompleter, \ @@ -56,6 +58,8 @@ #define VIRSH_COMMON_OPT_NETWORK_PORT(cflags) \ {.name =3D "port", \ .type =3D VSH_OT_DATA, \ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .help =3D N_("port UUID"), \ .completer =3D virshNetworkPortUUIDCompleter, \ @@ -520,6 +524,8 @@ static const vshCmdOptDef opts_network_metadata[] =3D { VIRSH_COMMON_OPT_NETWORK_FULL(0), {.name =3D "uri", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("URI of the namespace") }, @@ -1145,6 +1151,8 @@ static const vshCmdInfo info_network_name =3D { static const vshCmdOptDef opts_network_name[] =3D { {.name =3D "network", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshNetworkUUIDCompleter, .help =3D N_("network uuid") @@ -1242,18 +1250,24 @@ static const vshCmdOptDef opts_network_update[] =3D= { VIRSH_COMMON_OPT_NETWORK_FULL(0), {.name =3D "command", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshNetworkUpdateCommandCompleter, .help =3D N_("type of update (add-first, add-last (add), delete, or m= odify)") }, {.name =3D "section", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshNetworkUpdateSectionCompleter, .help =3D N_("which section of network configuration to update") }, {.name =3D "xml", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("name of file containing xml (or, if it starts with '<',= the complete " diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index c0fb319fa7..0081e3cbb7 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -97,6 +97,8 @@ static const vshCmdOptDef opts_node_device_destroy[] =3D { }, {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, @@ -571,6 +573,8 @@ static const vshCmdInfo info_node_device_dumpxml =3D { static const vshCmdOptDef opts_node_device_dumpxml[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, @@ -634,6 +638,8 @@ static const vshCmdInfo info_node_device_detach =3D { static const vshCmdOptDef opts_node_device_detach[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device key"), .completer =3D virshNodeDeviceNameCompleter, @@ -696,6 +702,8 @@ static const vshCmdInfo info_node_device_reattach =3D { static const vshCmdOptDef opts_node_device_reattach[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device key"), .completer =3D virshNodeDeviceNameCompleter, @@ -741,6 +749,8 @@ static const vshCmdInfo info_node_device_reset =3D { static const vshCmdOptDef opts_node_device_reset[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device key"), .completer =3D virshNodeDeviceNameCompleter, @@ -1002,6 +1012,8 @@ static const vshCmdInfo info_node_device_undefine =3D= { static const vshCmdOptDef opts_node_device_undefine[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, @@ -1093,6 +1105,8 @@ static const vshCmdInfo info_node_device_start =3D { static const vshCmdOptDef opts_node_device_start[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name"), .completer =3D virshNodeDeviceNameCompleter, @@ -1138,6 +1152,8 @@ static const vshCmdInfo info_node_device_autostart = =3D { static const vshCmdOptDef opts_node_device_autostart[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, @@ -1195,6 +1211,8 @@ static const vshCmdInfo info_node_device_info =3D { static const vshCmdOptDef opts_node_device_info[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, @@ -1245,6 +1263,8 @@ static const vshCmdInfo info_node_device_update =3D { static const vshCmdOptDef opts_node_device_update[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 7a578f3f7c..993539d368 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -129,6 +129,8 @@ static const vshCmdInfo info_nwfilter_undefine =3D { static const vshCmdOptDef opts_nwfilter_undefine[] =3D { {.name =3D "nwfilter", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter name or uuid"), .completer =3D virshNWFilterNameCompleter, @@ -167,6 +169,8 @@ static const vshCmdInfo info_nwfilter_dumpxml =3D { static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { {.name =3D "nwfilter", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter name or uuid"), .completer =3D virshNWFilterNameCompleter, @@ -391,6 +395,8 @@ static const vshCmdInfo info_nwfilter_edit =3D { static const vshCmdOptDef opts_nwfilter_edit[] =3D { {.name =3D "nwfilter", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter name or uuid"), .completer =3D virshNWFilterNameCompleter, @@ -526,6 +532,8 @@ static const vshCmdInfo info_nwfilter_binding_delete = =3D { static const vshCmdOptDef opts_nwfilter_binding_delete[] =3D { {.name =3D "binding", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter binding port dev"), .completer =3D virshNWFilterBindingNameCompleter, @@ -566,6 +574,8 @@ static const vshCmdInfo info_nwfilter_binding_dumpxml = =3D { static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] =3D { {.name =3D "binding", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter binding portdev"), .completer =3D virshNWFilterBindingNameCompleter, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index a7b82de9be..4606990836 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -58,12 +58,16 @@ #define VIRSH_COMMON_OPT_POOL_X_AS \ {.name =3D "name", \ .type =3D VSH_OT_DATA, \ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .completer =3D virshCompleteEmpty, \ .help =3D N_("name of the pool") \ }, \ {.name =3D "type", \ .type =3D VSH_OT_DATA, \ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .completer =3D virshPoolTypeCompleter, \ .help =3D N_("type of the pool") \ @@ -1354,6 +1358,8 @@ static const vshCmdInfo info_find_storage_pool_source= s_as =3D { static const vshCmdOptDef opts_find_storage_pool_sources_as[] =3D { {.name =3D "type", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshPoolTypeCompleter, .help =3D N_("type of storage pool sources to find") @@ -1437,6 +1443,8 @@ static const vshCmdInfo info_find_storage_pool_source= s =3D { static const vshCmdOptDef opts_find_storage_pool_sources[] =3D { {.name =3D "type", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshPoolTypeCompleter, .help =3D N_("type of storage pool sources to discover") diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index a88980ef9e..d7e60de4ca 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -124,6 +124,8 @@ static const vshCmdInfo info_secret_dumpxml =3D { static const vshCmdOptDef opts_secret_dumpxml[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, @@ -179,6 +181,8 @@ static const vshCmdInfo info_secret_set_value =3D { static const vshCmdOptDef opts_secret_set_value[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, @@ -290,6 +294,8 @@ static const vshCmdInfo info_secret_get_value =3D { static const vshCmdOptDef opts_secret_get_value[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, @@ -343,6 +349,8 @@ static const vshCmdInfo info_secret_undefine =3D { static const vshCmdOptDef opts_secret_undefine[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 31ab27b112..9ad33c4252 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1568,6 +1568,8 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] =3D= { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("snapshot name"), .completer =3D virshSnapshotNameCompleter, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 0cb7262b67..ecf89345c3 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -57,6 +57,8 @@ #define VIRSH_COMMON_OPT_VOL_NAME(_helpstr) \ {.name =3D "vol", \ .type =3D VSH_OT_DATA, \ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshStorageVolNameCompleter, \ @@ -65,6 +67,8 @@ #define VIRSH_COMMON_OPT_VOL_KEY(_helpstr) \ {.name =3D "vol", \ .type =3D VSH_OT_DATA, \ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshStorageVolKeyCompleter, \ @@ -173,12 +177,16 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { VIRSH_COMMON_OPT_POOL_NAME, {.name =3D "name", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("name of the volume") }, {.name =3D "capacity", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("size of the vol, as scaled integer (default bytes)") @@ -520,6 +528,8 @@ static const vshCmdOptDef opts_vol_clone[] =3D { VIRSH_COMMON_OPT_VOL_FULL, {.name =3D "newname", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("clone name") @@ -1024,6 +1034,8 @@ static const vshCmdOptDef opts_vol_resize[] =3D { VIRSH_COMMON_OPT_VOL_FULL, {.name =3D "capacity", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("new capacity for the vol, as scaled integer (default by= tes)") diff --git a/tools/virsh.h b/tools/virsh.h index 877b290e3a..3e8d998a5d 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -57,7 +57,9 @@ */ #define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \ {.name =3D "pool", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_DATA,\ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshStoragePoolNameCompleter, \ @@ -66,7 +68,9 @@ #define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ {.name =3D "domain", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_DATA,\ + .positional =3D true, \ + .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshDomainNameCompleter, \ @@ -98,10 +102,12 @@ #define VIRSH_COMMON_OPT_FILE(_helpstr) \ VIRSH_COMMON_OPT_FILE_FULL(_helpstr, true) -#define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required) \ +#define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required_) \ {.name =3D "file", \ - .type =3D required ? VSH_OT_DATA : VSH_OT_STRING, \ - .flags =3D required ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \ + .type =3D required_ ? VSH_OT_DATA : VSH_OT_STRING, \ + .required =3D required_, \ + .positional =3D required_, \ + .flags =3D required_ ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \ .completer =3D virshCompletePathLocalExisting, \ .help =3D _helpstr \ } diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 114ec2e8e7..d266d824cb 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -359,6 +359,8 @@ static const vshCmdInfo info_srv_threadpool_info =3D { static const vshCmdOptDef opts_srv_threadpool_info[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to retrieve threadpool attributes from."), @@ -416,6 +418,8 @@ static const vshCmdInfo info_srv_threadpool_set =3D { static const vshCmdOptDef opts_srv_threadpool_set[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to alter threadpool attributes on."), @@ -517,6 +521,8 @@ static const vshCmdInfo info_srv_clients_list =3D { static const vshCmdOptDef opts_srv_clients_list[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("server which to list connected clients from"), @@ -599,12 +605,16 @@ static const vshCmdInfo info_client_info =3D { static const vshCmdOptDef opts_client_info[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("server to which is connected to"), }, {.name =3D "client", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("client which to retrieve identity information for"), }, @@ -681,12 +691,16 @@ static const vshCmdInfo info_client_disconnect =3D { static const vshCmdOptDef opts_client_disconnect[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("server which the client is currently connected to"), }, {.name =3D "client", .type =3D VSH_OT_INT, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("client which to disconnect, specified by ID"), }, @@ -742,6 +756,8 @@ static const vshCmdInfo info_srv_clients_info =3D { static const vshCmdOptDef opts_srv_clients_info[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to retrieve the client limits from."), @@ -796,6 +812,8 @@ static const vshCmdInfo info_srv_clients_set =3D { static const vshCmdOptDef opts_srv_clients_set[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to alter the client-related configuration limits= on."), @@ -893,6 +911,8 @@ static const vshCmdInfo info_srv_update_tls_file =3D { static const vshCmdOptDef opts_srv_update_tls_file[] =3D { {.name =3D "server", .type =3D VSH_OT_DATA, + .positional =3D true, + .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("Available servers on a daemon. " "Currently only supports 'libvirtd' or 'virtproxyd'.") @@ -991,6 +1011,8 @@ static const vshCmdInfo info_daemon_log_outputs =3D { static const vshCmdOptDef opts_daemon_timeout[] =3D { {.name =3D "timeout", .type =3D VSH_OT_INT, + .positional =3D true, + .required =3D true, .help =3D N_("number of seconds the daemon will run without any activ= e connection"), .flags =3D VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT }, diff --git a/tools/vsh.c b/tools/vsh.c index de68f93a1f..9745c122fe 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -248,6 +248,7 @@ vshCmddefCheckInternals(vshControl *ctl, { size_t i; bool seenOptionalOption =3D false; + bool seenPositionalOption =3D false; g_auto(virBuffer) complbuf =3D VIR_BUFFER_INITIALIZER; /* in order to perform the validation resolve the alias first */ @@ -301,6 +302,8 @@ vshCmddefCheckInternals(vshControl *ctl, for (i =3D 0; cmd->opts[i].name; i++) { const vshCmdOptDef *opt =3D &cmd->opts[i]; + bool isPositional =3D false; + bool isRequired =3D false; if (i > 63) { vshError(ctl, "command '%s' has too many options", cmd->name); @@ -385,12 +388,17 @@ vshCmddefCheckInternals(vshControl *ctl, } } break; + case VSH_OT_ARGV: if (cmd->opts[i + 1].name) { vshError(ctl, "parameter '%s' of command '%s' must be list= ed last", opt->name, cmd->name); return -1; } + + isRequired =3D opt->flags & VSH_OFLAG_REQ; + /* ARGV argument is positional if there are no positional opti= ons */ + isPositional =3D !seenPositionalOption; break; case VSH_OT_DATA: @@ -400,6 +408,10 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } + isRequired =3D true; + isPositional =3D true; + seenPositionalOption =3D true; + if (seenOptionalOption) { vshError(ctl, "parameter '%s' of command '%s' must be list= ed before optional parameters", opt->name, cmd->name); @@ -414,12 +426,28 @@ vshCmddefCheckInternals(vshControl *ctl, opt->name, cmd->name); return -1; } + seenPositionalOption =3D true; + isPositional =3D true; + isRequired =3D true; } else { - seenOptionalOption =3D true; + isPositional =3D false; + isRequired =3D false; } break; } + + if (opt->required !=3D isRequired) { + vshError(ctl, "parameter '%s' of command '%s' 'required' state= mismatch", + opt->name, cmd->name); + return -1; + } + + if (opt->positional !=3D isPositional) { + vshError(ctl, "parameter '%s' of command '%s' 'positional' sta= te mismatch", + opt->name, cmd->name); + return -1; + } } virBufferTrim(&complbuf, ", "); @@ -3202,6 +3230,7 @@ const vshCmdOptDef opts_echo[] =3D { }, {.name =3D "string", .type =3D VSH_OT_ARGV, + .positional =3D true, .help =3D N_("arguments to echo") }, {.name =3D NULL} @@ -3340,6 +3369,7 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd) const vshCmdOptDef opts_complete[] =3D { {.name =3D "string", .type =3D VSH_OT_ARGV, + .positional =3D true, .flags =3D VSH_OFLAG_EMPTY_OK, .help =3D N_("partial string to autocomplete") }, diff --git a/tools/vsh.h b/tools/vsh.h index c8015b8dd7..d2591e93a6 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -133,6 +133,8 @@ struct _vshCmdInfo { struct _vshCmdOptDef { const char *name; /* the name of option, or NULL for list en= d */ vshCmdOptType type; /* option type */ + bool required; /* option is required */ + bool positional; /* option is a positional option (not requ= iring '--optionname') */ unsigned int flags; /* flags */ const char *help; /* non-NULL help string; or for VSH_OT_ALI= AS * the name of a later public option */ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710158639057963.218898869729; Mon, 11 Mar 2024 05:03:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 046BE1E7A; Mon, 11 Mar 2024 08:03:57 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C53461F0F; Mon, 11 Mar 2024 07:34:58 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 567881D4B; Mon, 11 Mar 2024 07:31:23 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id F25A51D1E for ; Mon, 11 Mar 2024 07:31:19 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-BrMiBUKQMei4mqsmNcSFJQ-1; Mon, 11 Mar 2024 07:31:18 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C20A8007A4 for ; Mon, 11 Mar 2024 11:31:18 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98738112131D for ; Mon, 11 Mar 2024 11:31:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: BrMiBUKQMei4mqsmNcSFJQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 16/23] vsh: Fix broken assumption that required VSH_OT_INT must be positional Date: Mon, 11 Mar 2024 12:30:53 +0100 Message-ID: <4c572ef2c6c1843feee4a599688d3ac5f546de00.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: LREQ4OKXSHFNOLVGICNLKGKMO34LWKYM X-Message-ID-Hash: LREQ4OKXSHFNOLVGICNLKGKMO34LWKYM X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710158641100100001 In at least one case we've wanted a mandatory argument which requires the explicit flag. Fix the assumption before converting everything over to the new flags. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virt-admin.c | 1 - tools/vsh.c | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/virt-admin.c b/tools/virt-admin.c index d266d824cb..2e8895956d 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1011,7 +1011,6 @@ static const vshCmdInfo info_daemon_log_outputs =3D { static const vshCmdOptDef opts_daemon_timeout[] =3D { {.name =3D "timeout", .type =3D VSH_OT_INT, - .positional =3D true, .required =3D true, .help =3D N_("number of seconds the daemon will run without any activ= e connection"), .flags =3D VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT diff --git a/tools/vsh.c b/tools/vsh.c index 9745c122fe..7091cf093c 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -426,9 +426,14 @@ vshCmddefCheckInternals(vshControl *ctl, opt->name, cmd->name); return -1; } - seenPositionalOption =3D true; - isPositional =3D true; + isRequired =3D true; + + /* allow INT arguments which are required and non-position= al */ + if (!(opt->flags & VSH_OFLAG_REQ_OPT)) { + seenPositionalOption =3D true; + isPositional =3D true; + } } else { isPositional =3D false; isRequired =3D false; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171015969243895.57571767602587; Mon, 11 Mar 2024 05:21:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 139871D4B; Mon, 11 Mar 2024 08:21:31 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3C4CB1F39; Mon, 11 Mar 2024 07:35:45 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D74171E90; Mon, 11 Mar 2024 07:31:56 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BDFEC1D44 for ; Mon, 11 Mar 2024 07:31:21 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-292-KK1ZsH8rMOeAwUklfDf9EA-1; Mon, 11 Mar 2024 07:31:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1373E3C0E644 for ; Mon, 11 Mar 2024 11:31:19 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80A09112131D for ; Mon, 11 Mar 2024 11:31:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: KK1ZsH8rMOeAwUklfDf9EA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 17/23] vsh: Require that positional non-argv arguments are required Date: Mon, 11 Mar 2024 12:30:54 +0100 Message-ID: <0c02aa03f53e3860f2f97e62ec6bc17d7b22d360.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: VVBK3IKQRS37RF5AI7JUWEKPHSEQTCFY X-Message-ID-Hash: VVBK3IKQRS37RF5AI7JUWEKPHSEQTCFY X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710159693959100001 This is logically enforced by existing checks, thus we can formalize it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/vsh.c b/tools/vsh.c index 7091cf093c..301fa9d747 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -329,6 +329,13 @@ vshCmddefCheckInternals(vshControl *ctl, } } + /* require that positional non-argv options are required */ + if (opt->positional && !opt->required && opt->type !=3D VSH_OT_ARG= V) { + vshError(ctl, "positional argument '%s' of command '%s' must b= e required", + opt->name, cmd->name); + return -1; + } + switch (opt->type) { case VSH_OT_NONE: vshError(ctl, "invalid type 'NONE' of option '%s' of command '= %s'", --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710159783024724.5475871794497; Mon, 11 Mar 2024 05:23:03 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EC2741F24; Mon, 11 Mar 2024 08:23:01 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5AFD51F3D; Mon, 11 Mar 2024 07:35:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9711C1E97; Mon, 11 Mar 2024 07:32:00 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0E42C1D6A for ; Mon, 11 Mar 2024 07:31:22 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-V6UG6sAYP82oc6-q1f_Vzw-1; Mon, 11 Mar 2024 07:31:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0723287984B for ; Mon, 11 Mar 2024 11:31:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7379A1121306 for ; Mon, 11 Mar 2024 11:31:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: V6UG6sAYP82oc6-q1f_Vzw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 18/23] vshCmddefCheckInternals: Remove refactoring safety checks Date: Mon, 11 Mar 2024 12:30:55 +0100 Message-ID: <8b1106712600160e7a2c860507b87021c60cb3c4.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 5YF5NLSPQRY7Q2VGOOTEBF3PB4KLJBLU X-Message-ID-Hash: 5YF5NLSPQRY7Q2VGOOTEBF3PB4KLJBLU X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710159784176100001 Now that the code was refactored and proved identical, remove the checks so that they don't impede further refactors. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 301fa9d747..3245e64f5e 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -248,7 +248,6 @@ vshCmddefCheckInternals(vshControl *ctl, { size_t i; bool seenOptionalOption =3D false; - bool seenPositionalOption =3D false; g_auto(virBuffer) complbuf =3D VIR_BUFFER_INITIALIZER; /* in order to perform the validation resolve the alias first */ @@ -302,8 +301,6 @@ vshCmddefCheckInternals(vshControl *ctl, for (i =3D 0; cmd->opts[i].name; i++) { const vshCmdOptDef *opt =3D &cmd->opts[i]; - bool isPositional =3D false; - bool isRequired =3D false; if (i > 63) { vshError(ctl, "command '%s' has too many options", cmd->name); @@ -402,10 +399,6 @@ vshCmddefCheckInternals(vshControl *ctl, opt->name, cmd->name); return -1; } - - isRequired =3D opt->flags & VSH_OFLAG_REQ; - /* ARGV argument is positional if there are no positional opti= ons */ - isPositional =3D !seenPositionalOption; break; case VSH_OT_DATA: @@ -415,10 +408,6 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } - isRequired =3D true; - isPositional =3D true; - seenPositionalOption =3D true; - if (seenOptionalOption) { vshError(ctl, "parameter '%s' of command '%s' must be list= ed before optional parameters", opt->name, cmd->name); @@ -433,33 +422,10 @@ vshCmddefCheckInternals(vshControl *ctl, opt->name, cmd->name); return -1; } - - isRequired =3D true; - - /* allow INT arguments which are required and non-position= al */ - if (!(opt->flags & VSH_OFLAG_REQ_OPT)) { - seenPositionalOption =3D true; - isPositional =3D true; - } - } else { - isPositional =3D false; - isRequired =3D false; } break; } - - if (opt->required !=3D isRequired) { - vshError(ctl, "parameter '%s' of command '%s' 'required' state= mismatch", - opt->name, cmd->name); - return -1; - } - - if (opt->positional !=3D isPositional) { - vshError(ctl, "parameter '%s' of command '%s' 'positional' sta= te mismatch", - opt->name, cmd->name); - return -1; - } } virBufferTrim(&complbuf, ", "); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710159878426647.020675356105; Mon, 11 Mar 2024 05:24:38 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 558041ED3; Mon, 11 Mar 2024 08:24:37 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9430A1E4C; Mon, 11 Mar 2024 07:36:08 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 43F261DF3; Mon, 11 Mar 2024 07:32:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2B9C51DC9 for ; Mon, 11 Mar 2024 07:31:24 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-ZT2qQHM4P1WUfyifGAeUiw-1; Mon, 11 Mar 2024 07:31:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E43C73802265 for ; Mon, 11 Mar 2024 11:31:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C1D5112131D for ; Mon, 11 Mar 2024 11:31:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: ZT2qQHM4P1WUfyifGAeUiw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 19/23] vshCmdGrpHelp: Refactor formatting of help for VSH_OT_ARGV Date: Mon, 11 Mar 2024 12:30:56 +0100 Message-ID: <98a4fe3b0a575a034f59de385cb49ff0e952423e.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: H6XINM4RGWFLVFO2A6NS3UO2Z7UPO6FG X-Message-ID-Hash: H6XINM4RGWFLVFO2A6NS3UO2Z7UPO6FG X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710159878634100001 Use the new properties rather than infer the states. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 3245e64f5e..521f222910 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -634,8 +634,6 @@ vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp) static bool vshCmddefHelp(const vshCmdDef *def) { - bool shortopt =3D false; /* true if 'arg' works instead of '--opt arg'= */ - fputs(_(" NAME\n"), stdout); fprintf(stdout, " %s - %s\n", def->name, _(def->info->help)); @@ -657,16 +655,10 @@ vshCmddefHelp(const vshCmdDef *def) } else { fprintf(stdout, _(" [--%1$s ]"), opt->name); } - - if (!(opt->flags & VSH_OFLAG_REQ_OPT)) - shortopt =3D true; break; case VSH_OT_STRING: fprintf(stdout, _(" [--%1$s ]"), opt->name); - - if (!(opt->flags & VSH_OFLAG_REQ_OPT)) - shortopt =3D true; break; case VSH_OT_DATA: @@ -675,23 +667,20 @@ vshCmddefHelp(const vshCmdDef *def) } else { fprintf(stdout, " [<%s>]", opt->name); } - - if (!(opt->flags & VSH_OFLAG_REQ_OPT)) - shortopt =3D true; break; case VSH_OT_ARGV: - if (shortopt) { - if (required_option) { - fprintf(stdout, _(" {[--%1$s] }..."), opt-= >name); + if (opt->positional) { + if (opt->required) { + fprintf(stdout, " <%s>...", opt->name); } else { - fprintf(stdout, _(" [[--%1$s] ]..."), opt-= >name); + fprintf(stdout, " [<%s>]...", opt->name); } } else { - if (required_option) { - fprintf(stdout, " <%s>...", opt->name); + if (opt->required) { + fprintf(stdout, _(" {[--%1$s] }..."), opt-= >name); } else { - fprintf(stdout, " [<%s>]...", opt->name); + fprintf(stdout, _(" [[--%1$s] ]..."), opt-= >name); } } break; @@ -740,10 +729,10 @@ vshCmddefHelp(const vshCmdDef *def) break; case VSH_OT_ARGV: - if (shortopt) { - optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); - } else { + if (opt->positional) { optstr =3D g_strdup_printf("<%s>", opt->name); + } else { + optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); } break; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710234865331745.1936355994568; Tue, 12 Mar 2024 02:14:25 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E2CC41EF3; Tue, 12 Mar 2024 05:14:23 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7D2871D85; Tue, 12 Mar 2024 05:13:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 98E181EA0; Mon, 11 Mar 2024 07:32:03 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B2DDB1DB7 for ; Mon, 11 Mar 2024 07:31:23 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-527-XGeS_GQzPPyY9LhOvg5jJg-1; Mon, 11 Mar 2024 07:31:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E35AB80026D for ; Mon, 11 Mar 2024 11:31:21 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 447B41121306 for ; Mon, 11 Mar 2024 11:31:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: XGeS_GQzPPyY9LhOvg5jJg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 20/23] vshCmddefHelp: Refactor and fix printing of help for _STRING/_INT arguments Date: Mon, 11 Mar 2024 12:30:57 +0100 Message-ID: <0492c2ad37fdeef97df7b82f4f628b338cfa787f.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Hits: administrivia X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header Message-ID-Hash: GN2V5FYSXOS4OJVJCUUJUMGPHKRWV4WO X-Message-ID-Hash: GN2V5FYSXOS4OJVJCUUJUMGPHKRWV4WO X-Mailman-Approved-At: Tue, 12 Mar 2024 09:13:35 -0400 X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710234866398100001 Use the new flags to do the decisions which will also fix the case when an _INT option is required but non-positional. This fixes the help for the 'timeout' argument of 'daemon-timeout' virt-admin command: SYNOPSIS - daemon-timeout + daemon-timeout --timeout [...] OPTIONS - [--timeout] number of seconds the daemon will run without = any active connection + --timeout number of seconds the daemon will run without an= y active connection Resolves: https://issues.redhat.com/browse/RHEL-25993 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 521f222910..c7257586e3 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -642,31 +642,33 @@ vshCmddefHelp(const vshCmdDef *def) if (def->opts) { const vshCmdOptDef *opt; for (opt =3D def->opts; opt->name; opt++) { - bool required_option =3D opt->flags & VSH_OFLAG_REQ; switch (opt->type) { case VSH_OT_BOOL: fprintf(stdout, " [--%s]", opt->name); break; + case VSH_OT_STRING: + case VSH_OT_DATA: case VSH_OT_INT: - if (required_option) { - fprintf(stdout, " <%s>", opt->name); + if (opt->required) { + fprintf(stdout, " "); } else { - fprintf(stdout, _(" [--%1$s ]"), opt->name); + fprintf(stdout, " ["); } - break; - case VSH_OT_STRING: - fprintf(stdout, _(" [--%1$s ]"), opt->name); - break; - - case VSH_OT_DATA: - if (required_option) { - fprintf(stdout, " <%s>", opt->name); + if (opt->positional) { + fprintf(stdout, "<%s>", opt->name); } else { - fprintf(stdout, " [<%s>]", opt->name); + if (opt->type =3D=3D VSH_OT_INT) { + fprintf(stdout, _("--%1$s "), opt->name); + } else { + fprintf(stdout, _("--%1$s "), opt->name); + } } + + if (!opt->required) + fprintf(stdout, "]"); break; case VSH_OT_ARGV: @@ -704,7 +706,6 @@ vshCmddefHelp(const vshCmdDef *def) const vshCmdOptDef *opt; fputs(_("\n OPTIONS\n"), stdout); for (opt =3D def->opts; opt->name; opt++) { - bool required_option =3D opt->flags & VSH_OFLAG_REQ; g_autofree char *optstr =3D NULL; switch (opt->type) { @@ -713,7 +714,7 @@ vshCmddefHelp(const vshCmdDef *def) break; case VSH_OT_INT: - if (required_option) { + if (opt->positional) { optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); } else { optstr =3D g_strdup_printf(_("--%1$s "), opt->= name); @@ -721,11 +722,12 @@ vshCmddefHelp(const vshCmdDef *def) break; case VSH_OT_STRING: - optstr =3D g_strdup_printf(_("--%1$s "), opt->name= ); - break; - case VSH_OT_DATA: - optstr =3D g_strdup_printf(_("[--%1$s] "), opt->na= me); + if (opt->positional) { + optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); + } else { + optstr =3D g_strdup_printf(_("--%1$s "), opt->= name); + } break; case VSH_OT_ARGV: --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710160176967595.9983669565778; Mon, 11 Mar 2024 05:29:36 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B104C1EDB; Mon, 11 Mar 2024 08:29:35 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 29B241F4A; Mon, 11 Mar 2024 07:36:30 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 218DA1E56; Mon, 11 Mar 2024 07:32:26 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 02AB41DDE for ; Mon, 11 Mar 2024 07:31:24 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-Eh86dItwMNeZtNP1kmmjvA-1; Mon, 11 Mar 2024 07:31:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CC53D380226B for ; Mon, 11 Mar 2024 11:31:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 448631121306 for ; Mon, 11 Mar 2024 11:31:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Eh86dItwMNeZtNP1kmmjvA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 21/23] vsh: Replace VSH_OT_DATA by VSH_OT_STRING Date: Mon, 11 Mar 2024 12:30:58 +0100 Message-ID: <44fdf5c4863abfcaf90b734dc904c8c2cdce4b10.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: YQSTCU32BMBA5RUAIJDATPRTUKBVZDEF X-Message-ID-Hash: YQSTCU32BMBA5RUAIJDATPRTUKBVZDEF X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710160178056100001 Use the new 'positional' field to do decisions rather than have a special type for positional strings. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 4 +- tools/virsh-domain.c | 94 ++++++++++++++++++------------------ tools/virsh-host.c | 4 +- tools/virsh-interface.c | 12 ++--- tools/virsh-network.c | 14 +++--- tools/virsh-nodedev.c | 20 ++++---- tools/virsh-nwfilter.c | 10 ++-- tools/virsh-pool.c | 8 +-- tools/virsh-secret.c | 8 +-- tools/virsh-snapshot.c | 2 +- tools/virsh-volume.c | 12 ++--- tools/virsh.h | 6 +-- tools/virt-admin.c | 18 +++---- tools/vsh.c | 33 +++---------- tools/vsh.h | 1 - 15 files changed, 112 insertions(+), 134 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 573451c678..568ff770a1 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -737,7 +737,7 @@ static const vshCmdInfo info_domif_getlink =3D { static const vshCmdOptDef opts_domif_getlink[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1039,7 +1039,7 @@ static const vshCmdInfo info_domifstat =3D { static const vshCmdOptDef opts_domifstat[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 7a63757131..1dbef9a7a6 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -419,14 +419,14 @@ static const vshCmdInfo info_attach_disk =3D { static const vshCmdOptDef opts_attach_disk[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "source", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK, .help =3D N_("source of disk device or name of network disk") }, {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -815,14 +815,14 @@ static const vshCmdInfo info_attach_interface =3D { static const vshCmdOptDef opts_attach_interface[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network interface type") }, {.name =3D "source", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1195,7 +1195,7 @@ static const vshCmdInfo info_blkdeviotune =3D { static const vshCmdOptDef opts_blkdeviotune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1990,7 +1990,7 @@ static const vshCmdInfo info_blockcommit =3D { static const vshCmdOptDef opts_blockcommit[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2211,7 +2211,7 @@ static const vshCmdInfo info_blockcopy =3D { static const vshCmdOptDef opts_blockcopy[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2545,7 +2545,7 @@ static const vshCmdInfo info_blockjob =3D { static const vshCmdOptDef opts_blockjob[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2758,7 +2758,7 @@ static const vshCmdInfo info_blockpull =3D { static const vshCmdOptDef opts_blockpull[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2902,7 +2902,7 @@ static const vshCmdInfo info_blockresize =3D { static const vshCmdOptDef opts_blockresize[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3061,7 +3061,7 @@ static const vshCmdInfo info_domif_setlink =3D { static const vshCmdOptDef opts_domif_setlink[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3069,7 +3069,7 @@ static const vshCmdOptDef opts_domif_setlink[] =3D { .help =3D N_("interface device (MAC Address)") }, {.name =3D "state", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3211,7 +3211,7 @@ static const vshCmdInfo info_domiftune =3D { static const vshCmdOptDef opts_domiftune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3438,7 +3438,7 @@ static const vshCmdInfo info_dom_pm_suspend =3D { static const vshCmdOptDef opts_dom_pm_suspend[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_RUNNING), {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4123,7 +4123,7 @@ static const vshCmdInfo info_save =3D { static const vshCmdOptDef opts_save[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4474,7 +4474,7 @@ static const vshCmdInfo info_save_image_dumpxml =3D { static const vshCmdOptDef opts_save_image_dumpxml[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4533,14 +4533,14 @@ static const vshCmdInfo info_save_image_define =3D { static const vshCmdOptDef opts_save_image_define[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to modify") }, {.name =3D "xml", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4600,7 +4600,7 @@ static const vshCmdInfo info_save_image_edit =3D { static const vshCmdOptDef opts_save_image_edit[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4941,7 +4941,7 @@ static const vshCmdInfo info_managed_save_define =3D { static const vshCmdOptDef opts_managed_save_define[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE), {.name =3D "xml", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5219,7 +5219,7 @@ static const vshCmdInfo info_restore =3D { static const vshCmdOptDef opts_restore[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5304,7 +5304,7 @@ static const vshCmdInfo info_dump =3D { static const vshCmdOptDef opts_dump[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5605,7 +5605,7 @@ static const vshCmdInfo info_setLifecycleAction =3D { static const vshCmdOptDef opts_setLifecycleAction[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5613,7 +5613,7 @@ static const vshCmdOptDef opts_setLifecycleAction[] = =3D { .help =3D N_("lifecycle type to modify") }, {.name =3D "action", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5701,14 +5701,14 @@ static const vshCmdInfo info_set_user_password =3D { static const vshCmdOptDef opts_set_user_password[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("the username") }, {.name =3D "password", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -7293,7 +7293,7 @@ static const vshCmdInfo info_setvcpu =3D { static const vshCmdOptDef opts_setvcpu[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "vcpulist", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -7369,7 +7369,7 @@ static const vshCmdInfo info_domblkthreshold =3D { static const vshCmdOptDef opts_domblkthreshold[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "dev", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -7509,7 +7509,7 @@ static const vshCmdOptDef opts_iothreadpin[] =3D { .help =3D N_("IOThread ID number") }, {.name =3D "cpulist", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -8365,7 +8365,7 @@ static const vshCmdInfo info_metadata =3D { static const vshCmdOptDef opts_metadata[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "uri", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -8630,7 +8630,7 @@ static const vshCmdInfo info_send_process_signal =3D { static const vshCmdOptDef opts_send_process_signal[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "pid", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -8638,7 +8638,7 @@ static const vshCmdOptDef opts_send_process_signal[] = =3D { .help =3D N_("the process ID") }, {.name =3D "signame", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -9574,7 +9574,7 @@ static const vshCmdInfo info_dom_fd_associate =3D { static const vshCmdOptDef opts_dom_fd_associate[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "name", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -9582,7 +9582,7 @@ static const vshCmdOptDef opts_dom_fd_associate[] =3D= { .help =3D N_("name of the FD group") }, {.name =3D "pass-fds", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -9996,7 +9996,7 @@ static const vshCmdInfo info_qemu_attach =3D { static const vshCmdOptDef opts_qemu_attach[] =3D { {.name =3D "pid", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10332,14 +10332,14 @@ static const vshCmdInfo info_domxmlfromnative =3D= { static const vshCmdOptDef opts_domxmlfromnative[] =3D { {.name =3D "format", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("source config data format") }, {.name =3D "config", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10384,7 +10384,7 @@ static const vshCmdInfo info_domxmltonative =3D { static const vshCmdOptDef opts_domxmltonative[] =3D { {.name =3D "format", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10453,7 +10453,7 @@ static const vshCmdInfo info_domname =3D { static const vshCmdOptDef opts_domname[] =3D { {.name =3D "domain", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10488,7 +10488,7 @@ static const vshCmdOptDef opts_domrename[] =3D { VIRSH_COMMON_OPT_DOMAIN(N_("domain name or uuid"), VIR_CONNECT_LIST_DOMAINS_INACTIVE), {.name =3D "new-name", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10592,7 +10592,7 @@ static const vshCmdInfo info_migrate =3D { static const vshCmdOptDef opts_migrate[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "desturi", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12002,7 +12002,7 @@ static const vshCmdInfo info_detach_device_alias = =3D { static const vshCmdOptDef opts_detach_device_alias[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "alias", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12132,7 +12132,7 @@ static const vshCmdInfo info_detach_interface =3D { static const vshCmdOptDef opts_detach_interface[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12506,7 +12506,7 @@ static const vshCmdInfo info_detach_disk =3D { static const vshCmdOptDef opts_detach_disk[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12668,7 +12668,7 @@ static const vshCmdInfo info_change_media =3D { static const vshCmdOptDef opts_change_media[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -13144,7 +13144,7 @@ static const vshCmdInfo info_get_user_sshkeys =3D { static const vshCmdOptDef opts_get_user_sshkeys[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -13193,7 +13193,7 @@ static const vshCmdInfo info_set_user_sshkeys =3D { static const vshCmdOptDef opts_set_user_sshkeys[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 368e656550..97de6f8bed 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -946,7 +946,7 @@ static const vshCmdInfo info_nodesuspend =3D { static const vshCmdOptDef opts_node_suspend[] =3D { {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1277,7 +1277,7 @@ static const vshCmdInfo info_cpu_models =3D { static const vshCmdOptDef opts_cpu_models[] =3D { {.name =3D "arch", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .completer =3D virshArchCompleter, diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 52dce97462..109378ca71 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -20,7 +20,7 @@ #define VIRSH_COMMON_OPT_INTERFACE(cflags) \ {.name =3D "interface", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -384,7 +384,7 @@ static const vshCmdInfo info_interface_name =3D { static const vshCmdOptDef opts_interface_name[] =3D { {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -417,7 +417,7 @@ static const vshCmdInfo info_interface_mac =3D { static const vshCmdOptDef opts_interface_mac[] =3D { {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -721,7 +721,7 @@ static const vshCmdInfo info_interface_bridge =3D { static const vshCmdOptDef opts_interface_bridge[] =3D { {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -729,7 +729,7 @@ static const vshCmdOptDef opts_interface_bridge[] =3D { .help =3D N_("existing interface name") }, {.name =3D "bridge", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -952,7 +952,7 @@ static const vshCmdInfo info_interface_unbridge =3D { static const vshCmdOptDef opts_interface_unbridge[] =3D { {.name =3D "bridge", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-network.c b/tools/virsh-network.c index b9db3e061d..edbcebd682 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -32,7 +32,7 @@ #define VIRSH_COMMON_OPT_NETWORK(_helpstr, cflags) \ {.name =3D "network", \ - .type =3D VSH_OT_DATA,\ + .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -57,7 +57,7 @@ #define VIRSH_COMMON_OPT_NETWORK_PORT(cflags) \ {.name =3D "port", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -523,7 +523,7 @@ static const vshCmdInfo info_network_metadata =3D { static const vshCmdOptDef opts_network_metadata[] =3D { VIRSH_COMMON_OPT_NETWORK_FULL(0), {.name =3D "uri", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1150,7 +1150,7 @@ static const vshCmdInfo info_network_name =3D { static const vshCmdOptDef opts_network_name[] =3D { {.name =3D "network", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1249,7 +1249,7 @@ static const vshCmdInfo info_network_update =3D { static const vshCmdOptDef opts_network_update[] =3D { VIRSH_COMMON_OPT_NETWORK_FULL(0), {.name =3D "command", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1257,7 +1257,7 @@ static const vshCmdOptDef opts_network_update[] =3D { .help =3D N_("type of update (add-first, add-last (add), delete, or m= odify)") }, {.name =3D "section", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1265,7 +1265,7 @@ static const vshCmdOptDef opts_network_update[] =3D { .help =3D N_("which section of network configuration to update") }, {.name =3D "xml", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 0081e3cbb7..7d63581436 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -96,7 +96,7 @@ static const vshCmdOptDef opts_node_device_destroy[] =3D { .help =3D "device" }, {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -572,7 +572,7 @@ static const vshCmdInfo info_node_device_dumpxml =3D { static const vshCmdOptDef opts_node_device_dumpxml[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -637,7 +637,7 @@ static const vshCmdInfo info_node_device_detach =3D { static const vshCmdOptDef opts_node_device_detach[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -701,7 +701,7 @@ static const vshCmdInfo info_node_device_reattach =3D { static const vshCmdOptDef opts_node_device_reattach[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -748,7 +748,7 @@ static const vshCmdInfo info_node_device_reset =3D { static const vshCmdOptDef opts_node_device_reset[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1011,7 +1011,7 @@ static const vshCmdInfo info_node_device_undefine =3D= { static const vshCmdOptDef opts_node_device_undefine[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1104,7 +1104,7 @@ static const vshCmdInfo info_node_device_start =3D { static const vshCmdOptDef opts_node_device_start[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1151,7 +1151,7 @@ static const vshCmdInfo info_node_device_autostart = =3D { static const vshCmdOptDef opts_node_device_autostart[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1210,7 +1210,7 @@ static const vshCmdInfo info_node_device_info =3D { static const vshCmdOptDef opts_node_device_info[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1262,7 +1262,7 @@ static const vshCmdInfo info_node_device_update =3D { static const vshCmdOptDef opts_node_device_update[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 993539d368..faa8e98130 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -128,7 +128,7 @@ static const vshCmdInfo info_nwfilter_undefine =3D { static const vshCmdOptDef opts_nwfilter_undefine[] =3D { {.name =3D "nwfilter", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -168,7 +168,7 @@ static const vshCmdInfo info_nwfilter_dumpxml =3D { static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { {.name =3D "nwfilter", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -394,7 +394,7 @@ static const vshCmdInfo info_nwfilter_edit =3D { static const vshCmdOptDef opts_nwfilter_edit[] =3D { {.name =3D "nwfilter", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -531,7 +531,7 @@ static const vshCmdInfo info_nwfilter_binding_delete = =3D { static const vshCmdOptDef opts_nwfilter_binding_delete[] =3D { {.name =3D "binding", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -573,7 +573,7 @@ static const vshCmdInfo info_nwfilter_binding_dumpxml = =3D { static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] =3D { {.name =3D "binding", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 4606990836..8557e0d5e0 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -57,7 +57,7 @@ #define VIRSH_COMMON_OPT_POOL_X_AS \ {.name =3D "name", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -65,7 +65,7 @@ .help =3D N_("name of the pool") \ }, \ {.name =3D "type", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -1357,7 +1357,7 @@ static const vshCmdInfo info_find_storage_pool_source= s_as =3D { static const vshCmdOptDef opts_find_storage_pool_sources_as[] =3D { {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1442,7 +1442,7 @@ static const vshCmdInfo info_find_storage_pool_source= s =3D { static const vshCmdOptDef opts_find_storage_pool_sources[] =3D { {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index d7e60de4ca..0d0db9877b 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -123,7 +123,7 @@ static const vshCmdInfo info_secret_dumpxml =3D { static const vshCmdOptDef opts_secret_dumpxml[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -180,7 +180,7 @@ static const vshCmdInfo info_secret_set_value =3D { static const vshCmdOptDef opts_secret_set_value[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -293,7 +293,7 @@ static const vshCmdInfo info_secret_get_value =3D { static const vshCmdOptDef opts_secret_get_value[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -348,7 +348,7 @@ static const vshCmdInfo info_secret_undefine =3D { static const vshCmdOptDef opts_secret_undefine[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 9ad33c4252..9658fdefcd 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1567,7 +1567,7 @@ static const vshCmdInfo info_snapshot_dumpxml =3D { static const vshCmdOptDef opts_snapshot_dumpxml[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index ecf89345c3..90a450ad14 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -56,7 +56,7 @@ #define VIRSH_COMMON_OPT_VOL_NAME(_helpstr) \ {.name =3D "vol", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -66,7 +66,7 @@ #define VIRSH_COMMON_OPT_VOL_KEY(_helpstr) \ {.name =3D "vol", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -176,7 +176,7 @@ static const vshCmdInfo info_vol_create_as =3D { static const vshCmdOptDef opts_vol_create_as[] =3D { VIRSH_COMMON_OPT_POOL_NAME, {.name =3D "name", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -184,7 +184,7 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { .help =3D N_("name of the volume") }, {.name =3D "capacity", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -527,7 +527,7 @@ static const vshCmdInfo info_vol_clone =3D { static const vshCmdOptDef opts_vol_clone[] =3D { VIRSH_COMMON_OPT_VOL_FULL, {.name =3D "newname", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1033,7 +1033,7 @@ static const vshCmdInfo info_vol_resize =3D { static const vshCmdOptDef opts_vol_resize[] =3D { VIRSH_COMMON_OPT_VOL_FULL, {.name =3D "capacity", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/virsh.h b/tools/virsh.h index 3e8d998a5d..b009ed5854 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -57,7 +57,7 @@ */ #define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \ {.name =3D "pool", \ - .type =3D VSH_OT_DATA,\ + .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -68,7 +68,7 @@ #define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ {.name =3D "domain", \ - .type =3D VSH_OT_DATA,\ + .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -104,7 +104,7 @@ #define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required_) \ {.name =3D "file", \ - .type =3D required_ ? VSH_OT_DATA : VSH_OT_STRING, \ + .type =3D VSH_OT_STRING, \ .required =3D required_, \ .positional =3D required_, \ .flags =3D required_ ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \ diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 2e8895956d..d119116124 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -358,7 +358,7 @@ static const vshCmdInfo info_srv_threadpool_info =3D { static const vshCmdOptDef opts_srv_threadpool_info[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -417,7 +417,7 @@ static const vshCmdInfo info_srv_threadpool_set =3D { static const vshCmdOptDef opts_srv_threadpool_set[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -520,7 +520,7 @@ static const vshCmdInfo info_srv_clients_list =3D { static const vshCmdOptDef opts_srv_clients_list[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -604,7 +604,7 @@ static const vshCmdInfo info_client_info =3D { static const vshCmdOptDef opts_client_info[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -612,7 +612,7 @@ static const vshCmdOptDef opts_client_info[] =3D { .help =3D N_("server to which is connected to"), }, {.name =3D "client", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -690,7 +690,7 @@ static const vshCmdInfo info_client_disconnect =3D { static const vshCmdOptDef opts_client_disconnect[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -755,7 +755,7 @@ static const vshCmdInfo info_srv_clients_info =3D { static const vshCmdOptDef opts_srv_clients_info[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -811,7 +811,7 @@ static const vshCmdInfo info_srv_clients_set =3D { static const vshCmdOptDef opts_srv_clients_set[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -910,7 +910,7 @@ static const vshCmdInfo info_srv_update_tls_file =3D { static const vshCmdOptDef opts_srv_update_tls_file[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, diff --git a/tools/vsh.c b/tools/vsh.c index c7257586e3..7e8fbf8050 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -310,7 +310,6 @@ vshCmddefCheckInternals(vshControl *ctl, if (missingCompleters && !opt->completer) { switch (opt->type) { case VSH_OT_STRING: - case VSH_OT_DATA: case VSH_OT_ARGV: virBufferStrcat(&complbuf, opt->name, ", ", NULL); break; @@ -346,16 +345,12 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } - G_GNUC_FALLTHROUGH; - - case VSH_OT_STRING: if (opt->flags & VSH_OFLAG_REQ) { vshError(ctl, "parameter '%s' of command '%s' misused VSH_= OFLAG_REQ", opt->name, cmd->name); - return -1; /* neither bool nor string options can be manda= tory */ + return -1; /* bool can't be mandatory */ } - seenOptionalOption =3D true; break; case VSH_OT_ALIAS: { @@ -401,29 +396,15 @@ vshCmddefCheckInternals(vshControl *ctl, } break; - case VSH_OT_DATA: - if (!(opt->flags & VSH_OFLAG_REQ)) { - vshError(ctl, "parameter '%s' of command '%s' must use VSH= _OFLAG_REQ flag", - opt->name, cmd->name); - return -1; - } - - if (seenOptionalOption) { + case VSH_OT_INT: + case VSH_OT_STRING: + if (opt->positional && seenOptionalOption) { vshError(ctl, "parameter '%s' of command '%s' must be list= ed before optional parameters", opt->name, cmd->name); return -1; } - break; - - case VSH_OT_INT: - if (opt->flags & VSH_OFLAG_REQ) { - if (seenOptionalOption) { - vshError(ctl, "parameter '%s' of command '%s' must be = listed before optional parameters", - opt->name, cmd->name); - return -1; - } - } + seenOptionalOption =3D !opt->required; break; } } @@ -575,7 +556,7 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd,= uint64_t opts_required, const vshCmdOptDef *opt =3D &def->opts[i]; vshError(ctl, - opt->type =3D=3D VSH_OT_DATA || opt->type =3D=3D VSH_= OT_ARGV ? + opt->positional ? _("command '%1$s' requires <%2$s> option") : _("command '%1$s' requires --%2$s option"), def->name, opt->name); @@ -649,7 +630,6 @@ vshCmddefHelp(const vshCmdDef *def) break; case VSH_OT_STRING: - case VSH_OT_DATA: case VSH_OT_INT: if (opt->required) { fprintf(stdout, " "); @@ -722,7 +702,6 @@ vshCmddefHelp(const vshCmdDef *def) break; case VSH_OT_STRING: - case VSH_OT_DATA: if (opt->positional) { optstr =3D g_strdup_printf(_("[--%1$s] "), opt= ->name); } else { diff --git a/tools/vsh.h b/tools/vsh.h index d2591e93a6..73b908a5f2 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -89,7 +89,6 @@ typedef enum { VSH_OT_BOOL, /* optional boolean option */ VSH_OT_STRING, /* optional string option */ VSH_OT_INT, /* optional or mandatory int option */ - VSH_OT_DATA, /* string data (as non-option) */ VSH_OT_ARGV, /* remaining arguments */ VSH_OT_ALIAS, /* alternate spelling for a later argument */ } vshCmdOptType; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171016055635214.650507404252835; Mon, 11 Mar 2024 05:35:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CF1981DDE; Mon, 11 Mar 2024 08:35:54 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7A3731F10; Mon, 11 Mar 2024 07:36:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EF22B1DF2; Mon, 11 Mar 2024 07:32:30 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D05E31DF7 for ; Mon, 11 Mar 2024 07:31:25 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-SkCyeGOhOHCjLtJpIdtM5g-1; Mon, 11 Mar 2024 07:31:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B38B2185A781 for ; Mon, 11 Mar 2024 11:31:23 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C1D9112131D for ; Mon, 11 Mar 2024 11:31:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: SkCyeGOhOHCjLtJpIdtM5g-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 22/23] vsh: remove VSH_OFLAG_REQ Date: Mon, 11 Mar 2024 12:30:59 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: NV6IB764ZMIZ2MDTRVZGH6FEA7VTQE3V X-Message-ID-Hash: NV6IB764ZMIZ2MDTRVZGH6FEA7VTQE3V X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710160557724100001 The flag was replaced by the 'required' field in the option definition. Remove last few uses and all assignments. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 2 -- tools/virsh-domain.c | 62 +----------------------------------- tools/virsh-host.c | 5 --- tools/virsh-interface.c | 6 ---- tools/virsh-network.c | 7 ---- tools/virsh-nodedev.c | 10 ------ tools/virsh-nwfilter.c | 5 --- tools/virsh-pool.c | 4 --- tools/virsh-secret.c | 4 --- tools/virsh-snapshot.c | 1 - tools/virsh-volume.c | 6 ---- tools/virsh.h | 3 -- tools/virt-admin.c | 12 +------ tools/vsh.c | 8 ++--- tools/vsh.h | 1 - 15 files changed, 6 insertions(+), 130 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 568ff770a1..6c2499fb9f 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -740,7 +740,6 @@ static const vshCmdOptDef opts_domif_getlink[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device (MAC Address)") }, @@ -1042,7 +1041,6 @@ static const vshCmdOptDef opts_domifstat[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device specified by name or MAC Address") }, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1dbef9a7a6..7c2613c85b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -422,14 +422,13 @@ static const vshCmdOptDef opts_attach_disk[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK, + .flags =3D VSH_OFLAG_EMPTY_OK, .help =3D N_("source of disk device or name of network disk") }, {.name =3D "target", .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("target of disk device") }, @@ -818,14 +817,12 @@ static const vshCmdOptDef opts_attach_interface[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("network interface type") }, {.name =3D "source", .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("source of network interface") }, {.name =3D "target", @@ -1198,7 +1195,6 @@ static const vshCmdOptDef opts_blkdeviotune[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("block device") }, @@ -1993,7 +1989,6 @@ static const vshCmdOptDef opts_blockcommit[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of disk") }, @@ -2214,7 +2209,6 @@ static const vshCmdOptDef opts_blockcopy[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of source disk") }, @@ -2548,7 +2542,6 @@ static const vshCmdOptDef opts_blockjob[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of disk") }, @@ -2761,7 +2754,6 @@ static const vshCmdOptDef opts_blockpull[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("fully-qualified path of disk") }, @@ -2905,7 +2897,6 @@ static const vshCmdOptDef opts_blockresize[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("Fully-qualified path of block device") }, @@ -3064,7 +3055,6 @@ static const vshCmdOptDef opts_domif_setlink[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device (MAC Address)") }, @@ -3072,7 +3062,6 @@ static const vshCmdOptDef opts_domif_setlink[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceStateCompleter, .help =3D N_("new state of the device") }, @@ -3214,7 +3203,6 @@ static const vshCmdOptDef opts_domiftune[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainInterfaceCompleter, .help =3D N_("interface device (MAC Address)") }, @@ -3441,7 +3429,6 @@ static const vshCmdOptDef opts_dom_pm_suspend[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshNodeSuspendTargetCompleter, .help =3D N_("mem(Suspend-to-RAM), " "disk(Suspend-to-Disk), " @@ -4126,7 +4113,6 @@ static const vshCmdOptDef opts_save[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("where to save the data") }, {.name =3D "bypass-cache", @@ -4477,7 +4463,6 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to read") }, {.name =3D "security-info", @@ -4536,14 +4521,12 @@ static const vshCmdOptDef opts_save_image_define[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to modify") }, {.name =3D "xml", .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated XML for the target") }, @@ -4603,7 +4586,6 @@ static const vshCmdOptDef opts_save_image_edit[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to edit") }, {.name =3D "running", @@ -4944,7 +4926,6 @@ static const vshCmdOptDef opts_managed_save_define[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("filename containing updated XML for the target") }, @@ -5222,7 +5203,6 @@ static const vshCmdOptDef opts_restore[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("the state to restore") }, {.name =3D "bypass-cache", @@ -5307,7 +5287,6 @@ static const vshCmdOptDef opts_dump[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("where to dump the core") }, VIRSH_COMMON_OPT_LIVE(N_("perform a live core dump if supported")), @@ -5608,7 +5587,6 @@ static const vshCmdOptDef opts_setLifecycleAction[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainLifecycleCompleter, .help =3D N_("lifecycle type to modify") }, @@ -5616,7 +5594,6 @@ static const vshCmdOptDef opts_setLifecycleAction[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainLifecycleActionCompleter, .help =3D N_("lifecycle action to set") }, @@ -5704,14 +5681,12 @@ static const vshCmdOptDef opts_set_user_password[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("the username") }, {.name =3D "password", .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("the new password") }, @@ -7128,7 +7103,6 @@ static const vshCmdOptDef opts_setvcpus[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("number of virtual CPUs") }, {.name =3D "maximum", @@ -7296,7 +7270,6 @@ static const vshCmdOptDef opts_setvcpu[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainVcpulistCompleter, .help =3D N_("ids of vcpus to manipulate") }, @@ -7372,7 +7345,6 @@ static const vshCmdOptDef opts_domblkthreshold[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("device to set threshold for") }, @@ -7380,7 +7352,6 @@ static const vshCmdOptDef opts_domblkthreshold[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("threshold as a scaled number (by default bytes)") }, {.name =3D NULL} @@ -7504,7 +7475,6 @@ static const vshCmdOptDef opts_iothreadpin[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("IOThread ID number") }, @@ -7512,7 +7482,6 @@ static const vshCmdOptDef opts_iothreadpin[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainCpulistCompleter, .help =3D N_("host cpu number(s) to set") }, @@ -7581,7 +7550,6 @@ static const vshCmdOptDef opts_iothreadadd[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("iothread for the new IOThread") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, @@ -7639,7 +7607,6 @@ static const vshCmdOptDef opts_iothreadset[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("iothread id of existing IOThread") }, @@ -7757,7 +7724,6 @@ static const vshCmdOptDef opts_iothreaddel[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainIOThreadIdCompleter, .help =3D N_("iothread_id for the IOThread to delete") }, @@ -8368,7 +8334,6 @@ static const vshCmdOptDef opts_metadata[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("URI of the namespace") }, VIRSH_COMMON_OPT_LIVE(N_("modify/get running state")), @@ -8547,7 +8512,6 @@ static const vshCmdOptDef opts_send_key[] =3D { {.name =3D "keycode", .type =3D VSH_OT_ARGV, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshKeycodeNameCompleter, .help =3D N_("the key code") }, @@ -8633,7 +8597,6 @@ static const vshCmdOptDef opts_send_process_signal[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("the process ID") }, @@ -8641,7 +8604,6 @@ static const vshCmdOptDef opts_send_process_signal[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainSignalCompleter, .help =3D N_("the signal number or name") }, @@ -8731,7 +8693,6 @@ static const vshCmdOptDef opts_setmem[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("new memory size, as scaled integer (default KiB)") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, @@ -8802,7 +8763,6 @@ static const vshCmdOptDef opts_setmaxmem[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("new maximum memory size, as scaled integer (default KiB= )") }, VIRSH_COMMON_OPT_DOMAIN_CONFIG, @@ -9577,7 +9537,6 @@ static const vshCmdOptDef opts_dom_fd_associate[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("name of the FD group") }, @@ -9585,7 +9544,6 @@ static const vshCmdOptDef opts_dom_fd_associate[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("file descriptors N,M,... to associate") }, @@ -9662,7 +9620,6 @@ static const vshCmdOptDef opts_qemu_monitor_command[]= =3D { {.name =3D "cmd", .type =3D VSH_OT_ARGV, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("command") }, {.name =3D NULL} @@ -9999,7 +9956,6 @@ static const vshCmdOptDef opts_qemu_attach[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("pid") }, @@ -10057,7 +10013,6 @@ static const vshCmdOptDef opts_qemu_agent_command[]= =3D { {.name =3D "cmd", .type =3D VSH_OT_ARGV, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("command") }, {.name =3D NULL} @@ -10154,7 +10109,6 @@ static const vshCmdOptDef opts_lxc_enter_namespace[= ] =3D { {.name =3D "cmd", .type =3D VSH_OT_ARGV, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("command to run") }, {.name =3D NULL} @@ -10335,14 +10289,12 @@ static const vshCmdOptDef opts_domxmlfromnative[]= =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("source config data format") }, {.name =3D "config", .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("config data file to import from") }, @@ -10387,7 +10339,6 @@ static const vshCmdOptDef opts_domxmltonative[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("target config data type format") }, VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(VSH_OFLAG_REQ_OPT, 0), @@ -10456,7 +10407,6 @@ static const vshCmdOptDef opts_domname[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainUUIDCompleter, .help =3D N_("domain id or uuid") }, @@ -10491,7 +10441,6 @@ static const vshCmdOptDef opts_domrename[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("new domain name") }, @@ -10595,7 +10544,6 @@ static const vshCmdOptDef opts_migrate[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("connection URI of the destination host as seen from the= client(normal migration) or source(p2p migration)") }, @@ -11294,7 +11242,6 @@ static const vshCmdOptDef opts_migrate_setmaxdownti= me[] =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("maximum tolerable downtime (in milliseconds) for migrat= ion") }, {.name =3D NULL} @@ -11414,7 +11361,6 @@ static const vshCmdOptDef opts_migrate_setspeed[] = =3D { .type =3D VSH_OT_INT, .required =3D true, .positional =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("migration bandwidth limit in MiB/s") }, {.name =3D "postcopy", @@ -12005,7 +11951,6 @@ static const vshCmdOptDef opts_detach_device_alias[= ] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDeviceAliasCompleter, .help =3D N_("device alias") }, @@ -12135,7 +12080,6 @@ static const vshCmdOptDef opts_detach_interface[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("network interface type") }, {.name =3D "mac", @@ -12509,7 +12453,6 @@ static const vshCmdOptDef opts_detach_disk[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("target of disk device") }, @@ -12671,7 +12614,6 @@ static const vshCmdOptDef opts_change_media[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshDomainDiskTargetCompleter, .help =3D N_("Fully-qualified path or target of disk device") }, @@ -13147,7 +13089,6 @@ static const vshCmdOptDef opts_get_user_sshkeys[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("user to list authorized keys for"), }, {.name =3D NULL} @@ -13196,7 +13137,6 @@ static const vshCmdOptDef opts_set_user_sshkeys[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("user to set authorized keys for"), }, {.name =3D "file", diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 97de6f8bed..ffb993de79 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -470,7 +470,6 @@ static const vshCmdOptDef opts_allocpages[] =3D { .type =3D VSH_OT_INT, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshAllocpagesPagesizeCompleter, .help =3D N_("page size (in kibibytes)") }, @@ -478,7 +477,6 @@ static const vshCmdOptDef opts_allocpages[] =3D { .type =3D VSH_OT_INT, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("page count") }, {.name =3D "cellno", @@ -949,7 +947,6 @@ static const vshCmdOptDef opts_node_suspend[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshNodeSuspendTargetCompleter, .help =3D N_("mem(Suspend-to-RAM), disk(Suspend-to-Disk), " "hybrid(Hybrid-Suspend)") @@ -958,7 +955,6 @@ static const vshCmdOptDef opts_node_suspend[] =3D { .type =3D VSH_OT_INT, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("Suspend duration in seconds, at least 60") }, {.name =3D NULL} @@ -1281,7 +1277,6 @@ static const vshCmdOptDef opts_cpu_models[] =3D { .positional =3D true, .required =3D true, .completer =3D virshArchCompleter, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("architecture") }, {.name =3D NULL} diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 109378ca71..1b1344c17c 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -23,7 +23,6 @@ .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .help =3D N_("interface name or MAC address"), \ .completer =3D virshInterfaceNameCompleter, \ .completer_flags =3D cflags, \ @@ -387,7 +386,6 @@ static const vshCmdOptDef opts_interface_name[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshInterfaceMacCompleter, .help =3D N_("interface mac") }, @@ -420,7 +418,6 @@ static const vshCmdOptDef opts_interface_mac[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshInterfaceNameCompleter, .help =3D N_("interface name") }, @@ -724,7 +721,6 @@ static const vshCmdOptDef opts_interface_bridge[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshInterfaceNameCompleter, .help =3D N_("existing interface name") }, @@ -732,7 +728,6 @@ static const vshCmdOptDef opts_interface_bridge[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("new bridge device name") }, {.name =3D "no-stp", @@ -955,7 +950,6 @@ static const vshCmdOptDef opts_interface_unbridge[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("current bridge device name") }, {.name =3D "no-start", diff --git a/tools/virsh-network.c b/tools/virsh-network.c index edbcebd682..376de46cf4 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -35,7 +35,6 @@ .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshNetworkNameCompleter, \ .completer_flags =3D cflags, \ @@ -60,7 +59,6 @@ .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .help =3D N_("port UUID"), \ .completer =3D virshNetworkPortUUIDCompleter, \ .completer_flags =3D cflags, \ @@ -526,7 +524,6 @@ static const vshCmdOptDef opts_network_metadata[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("URI of the namespace") }, VIRSH_COMMON_OPT_LIVE(N_("modify/get running state")), @@ -1153,7 +1150,6 @@ static const vshCmdOptDef opts_network_name[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshNetworkUUIDCompleter, .help =3D N_("network uuid") }, @@ -1252,7 +1248,6 @@ static const vshCmdOptDef opts_network_update[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshNetworkUpdateCommandCompleter, .help =3D N_("type of update (add-first, add-last (add), delete, or m= odify)") }, @@ -1260,7 +1255,6 @@ static const vshCmdOptDef opts_network_update[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshNetworkUpdateSectionCompleter, .help =3D N_("which section of network configuration to update") }, @@ -1268,7 +1262,6 @@ static const vshCmdOptDef opts_network_update[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompletePathLocalExisting, .help =3D N_("name of file containing xml (or, if it starts with '<',= the complete " "xml element itself) to add/modify, or to be matched for s= earch") diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 7d63581436..90cfc187e5 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -99,7 +99,6 @@ static const vshCmdOptDef opts_node_device_destroy[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -575,7 +574,6 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -640,7 +638,6 @@ static const vshCmdOptDef opts_node_device_detach[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device key"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -704,7 +701,6 @@ static const vshCmdOptDef opts_node_device_reattach[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device key"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -751,7 +747,6 @@ static const vshCmdOptDef opts_node_device_reset[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device key"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -1014,7 +1009,6 @@ static const vshCmdOptDef opts_node_device_undefine[]= =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -1107,7 +1101,6 @@ static const vshCmdOptDef opts_node_device_start[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -1154,7 +1147,6 @@ static const vshCmdOptDef opts_node_device_autostart[= ] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -1213,7 +1205,6 @@ static const vshCmdOptDef opts_node_device_info[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, }, @@ -1265,7 +1256,6 @@ static const vshCmdOptDef opts_node_device_update[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), .completer =3D virshNodeDeviceNameCompleter, }, diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index faa8e98130..f54d2a0ae5 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -131,7 +131,6 @@ static const vshCmdOptDef opts_nwfilter_undefine[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter name or uuid"), .completer =3D virshNWFilterNameCompleter, }, @@ -171,7 +170,6 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter name or uuid"), .completer =3D virshNWFilterNameCompleter, }, @@ -397,7 +395,6 @@ static const vshCmdOptDef opts_nwfilter_edit[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter name or uuid"), .completer =3D virshNWFilterNameCompleter, }, @@ -534,7 +531,6 @@ static const vshCmdOptDef opts_nwfilter_binding_delete[= ] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter binding port dev"), .completer =3D virshNWFilterBindingNameCompleter, }, @@ -576,7 +572,6 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml= [] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("network filter binding portdev"), .completer =3D virshNWFilterBindingNameCompleter, }, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 8557e0d5e0..67cc1b94cf 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -60,7 +60,6 @@ .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .completer =3D virshCompleteEmpty, \ .help =3D N_("name of the pool") \ }, \ @@ -68,7 +67,6 @@ .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .completer =3D virshPoolTypeCompleter, \ .help =3D N_("type of the pool") \ }, \ @@ -1360,7 +1358,6 @@ static const vshCmdOptDef opts_find_storage_pool_sour= ces_as[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshPoolTypeCompleter, .help =3D N_("type of storage pool sources to find") }, @@ -1445,7 +1442,6 @@ static const vshCmdOptDef opts_find_storage_pool_sour= ces[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshPoolTypeCompleter, .help =3D N_("type of storage pool sources to discover") }, diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 0d0db9877b..7e10afa765 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -126,7 +126,6 @@ static const vshCmdOptDef opts_secret_dumpxml[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, }, @@ -183,7 +182,6 @@ static const vshCmdOptDef opts_secret_set_value[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, }, @@ -296,7 +294,6 @@ static const vshCmdOptDef opts_secret_get_value[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, }, @@ -351,7 +348,6 @@ static const vshCmdOptDef opts_secret_undefine[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("secret UUID"), .completer =3D virshSecretUUIDCompleter, }, diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 9658fdefcd..899bae7e9a 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1570,7 +1570,6 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("snapshot name"), .completer =3D virshSnapshotNameCompleter, }, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 90a450ad14..8794126f21 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -59,7 +59,6 @@ .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshStorageVolNameCompleter, \ } @@ -69,7 +68,6 @@ .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshStorageVolKeyCompleter, \ } @@ -179,7 +177,6 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("name of the volume") }, @@ -187,7 +184,6 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("size of the vol, as scaled integer (default bytes)") }, @@ -530,7 +526,6 @@ static const vshCmdOptDef opts_vol_clone[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("clone name") }, @@ -1036,7 +1031,6 @@ static const vshCmdOptDef opts_vol_resize[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D virshCompleteEmpty, .help =3D N_("new capacity for the vol, as scaled integer (default by= tes)") }, diff --git a/tools/virsh.h b/tools/virsh.h index b009ed5854..73c0b826a5 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -60,7 +60,6 @@ .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshStoragePoolNameCompleter, \ .completer_flags =3D cflags, \ @@ -71,7 +70,6 @@ .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ - .flags =3D VSH_OFLAG_REQ, \ .help =3D _helpstr, \ .completer =3D virshDomainNameCompleter, \ .completer_flags =3D cflags, \ @@ -107,7 +105,6 @@ .type =3D VSH_OT_STRING, \ .required =3D required_, \ .positional =3D required_, \ - .flags =3D required_ ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \ .completer =3D virshCompletePathLocalExisting, \ .help =3D _helpstr \ } diff --git a/tools/virt-admin.c b/tools/virt-admin.c index d119116124..37bc6fe4f0 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -361,7 +361,6 @@ static const vshCmdOptDef opts_srv_threadpool_info[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to retrieve threadpool attributes from."), }, @@ -420,7 +419,6 @@ static const vshCmdOptDef opts_srv_threadpool_set[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to alter threadpool attributes on."), }, @@ -523,7 +521,6 @@ static const vshCmdOptDef opts_srv_clients_list[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("server which to list connected clients from"), }, @@ -607,7 +604,6 @@ static const vshCmdOptDef opts_client_info[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("server to which is connected to"), }, @@ -615,7 +611,6 @@ static const vshCmdOptDef opts_client_info[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("client which to retrieve identity information for"), }, {.name =3D NULL} @@ -693,7 +688,6 @@ static const vshCmdOptDef opts_client_disconnect[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("server which the client is currently connected to"), }, @@ -701,7 +695,6 @@ static const vshCmdOptDef opts_client_disconnect[] =3D { .type =3D VSH_OT_INT, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("client which to disconnect, specified by ID"), }, {.name =3D NULL} @@ -758,7 +751,6 @@ static const vshCmdOptDef opts_srv_clients_info[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to retrieve the client limits from."), }, @@ -814,7 +806,6 @@ static const vshCmdOptDef opts_srv_clients_set[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .completer =3D vshAdmServerCompleter, .help =3D N_("Server to alter the client-related configuration limits= on."), }, @@ -913,7 +904,6 @@ static const vshCmdOptDef opts_srv_update_tls_file[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, - .flags =3D VSH_OFLAG_REQ, .help =3D N_("Available servers on a daemon. " "Currently only supports 'libvirtd' or 'virtproxyd'.") }, @@ -1013,7 +1003,7 @@ static const vshCmdOptDef opts_daemon_timeout[] =3D { .type =3D VSH_OT_INT, .required =3D true, .help =3D N_("number of seconds the daemon will run without any activ= e connection"), - .flags =3D VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT + .flags =3D VSH_OFLAG_REQ_OPT }, {.name =3D NULL} }; diff --git a/tools/vsh.c b/tools/vsh.c index 7e8fbf8050..85296c35c7 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -345,8 +345,8 @@ vshCmddefCheckInternals(vshControl *ctl, return -1; } - if (opt->flags & VSH_OFLAG_REQ) { - vshError(ctl, "parameter '%s' of command '%s' misused VSH_= OFLAG_REQ", + if (opt->required) { + vshError(ctl, "parameter '%s' of command '%s' misused 'req= uired' flag", opt->name, cmd->name); return -1; /* bool can't be mandatory */ } @@ -445,7 +445,7 @@ vshCmddefOptParse(const vshCmdDef *cmd, if (!(opt->flags & VSH_OFLAG_REQ_OPT)) *opts_need_arg |=3D 1ULL << i; - if (opt->flags & VSH_OFLAG_REQ) + if (opt->required) *opts_required |=3D 1ULL << i; } } @@ -800,7 +800,7 @@ vshCommandOpt(const vshCmd *cmd, const char *name, vshC= mdOpt **opt, if (!cmd->skipChecks) assert(valid && (!needData || valid->type !=3D VSH_OT_BOOL)); - if (valid && valid->flags & VSH_OFLAG_REQ) + if (valid && valid->required) ret =3D -1; /* See if option is present on command line. */ diff --git a/tools/vsh.h b/tools/vsh.h index 73b908a5f2..5f3e610dd7 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -98,7 +98,6 @@ typedef enum { */ enum { VSH_OFLAG_NONE =3D 0, /* without flags */ - VSH_OFLAG_REQ =3D (1 << 0), /* option required */ VSH_OFLAG_EMPTY_OK =3D (1 << 1), /* empty string option allowed */ VSH_OFLAG_REQ_OPT =3D (1 << 2), /* --optionname required */ }; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 18:51:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710160760263862.2422957425042; Mon, 11 Mar 2024 05:39:20 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E677317F6; Mon, 11 Mar 2024 08:39:18 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1E74A1F60; Mon, 11 Mar 2024 07:36:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AA3D31EAB; Mon, 11 Mar 2024 07:32:45 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C4A801E08 for ; Mon, 11 Mar 2024 07:31:26 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-104-U_fn7VDXOGO83n3MpxrKDQ-1; Mon, 11 Mar 2024 07:31:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9117E1C0512C for ; Mon, 11 Mar 2024 11:31:24 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 147D91121306 for ; Mon, 11 Mar 2024 11:31:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: U_fn7VDXOGO83n3MpxrKDQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 23/23] vsh: Automatically calculate VSH_OFLAG_REQ_OPT Date: Mon, 11 Mar 2024 12:31:00 +0100 Message-ID: <7c2439f21b99e6c0d23b8545f1c89a5c33ad743f.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: U36D4ZJGZCQXTYJBLUJR5MBRIEVH3K77 X-Message-ID-Hash: U36D4ZJGZCQXTYJBLUJR5MBRIEVH3K77 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710160760579100001 The command line parser automatically requires the option name for any optional arguments, but for required non-positional ones special handling needs to be done. This patch makes the VSH_OFLAG_REQ_OPT flag completely redundant as it can be calculated. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-backup.c | 1 - tools/virsh-checkpoint.c | 1 - tools/virsh-domain-monitor.c | 1 - tools/virsh-domain.c | 16 +--------------- tools/virsh-host.c | 2 -- tools/virsh-interface.c | 1 - tools/virsh-network.c | 2 -- tools/virsh-nodedev.c | 1 - tools/virsh-nwfilter.c | 2 -- tools/virsh-pool.c | 1 - tools/virsh-secret.c | 2 -- tools/virsh-snapshot.c | 2 -- tools/virsh-volume.c | 1 - tools/virt-admin.c | 1 - tools/vsh.c | 6 +++++- tools/vsh.h | 1 - 16 files changed, 6 insertions(+), 35 deletions(-) diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c index 7a7834d7ff..f8b11355a1 100644 --- a/tools/virsh-backup.c +++ b/tools/virsh-backup.c @@ -107,7 +107,6 @@ static const vshCmdOptDef opts_backup_dumpxml[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 869c071700..ef086fd1a5 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -826,7 +826,6 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] =3D= { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 6c2499fb9f..ff2872d497 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -277,7 +277,6 @@ static const vshCmdOptDef opts_dommemstat[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "period", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("period in seconds to set collection") }, VIRSH_COMMON_OPT_CONFIG(N_("affect next boot")), diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 7c2613c85b..65c67ff038 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -3436,7 +3436,6 @@ static const vshCmdOptDef opts_dom_pm_suspend[] =3D { }, {.name =3D "duration", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("duration in seconds") }, {.name =3D NULL} @@ -4471,7 +4470,6 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -4877,7 +4875,6 @@ static const vshCmdOptDef opts_managed_save_dumpxml[]= =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -4987,12 +4984,10 @@ static const vshCmdOptDef opts_schedinfo[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "weight", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("weight for XEN_CREDIT") }, {.name =3D "cap", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("cap for XEN_CREDIT") }, VIRSH_COMMON_OPT_CURRENT(N_("get/set current scheduler info")), @@ -8500,13 +8495,11 @@ static const vshCmdOptDef opts_send_key[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "codeset", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCodesetNameCompleter, .help =3D N_("the codeset of keycodes, default:linux") }, {.name =3D "holdtime", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("the time (in milliseconds) how long the keys will be he= ld") }, {.name =3D "keycode", @@ -9436,12 +9429,10 @@ static const vshCmdOptDef opts_domsetlaunchsecstate= [] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "secrethdr", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("path to file containing the secret header"), }, {.name =3D "secret", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("path to file containing the secret"), }, {.name =3D "set-address", @@ -9613,7 +9604,6 @@ static const vshCmdOptDef opts_qemu_monitor_command[]= =3D { }, {.name =3D "pass-fds", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("pass file descriptors N,M,... along with the command") }, @@ -9995,7 +9985,6 @@ static const vshCmdOptDef opts_qemu_agent_command[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "timeout", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("timeout seconds. must be positive.") }, {.name =3D "async", @@ -10231,7 +10220,6 @@ static const vshCmdOptDef opts_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -10341,7 +10329,7 @@ static const vshCmdOptDef opts_domxmltonative[] =3D= { .required =3D true, .help =3D N_("target config data type format") }, - VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(VSH_OFLAG_REQ_OPT, 0), + VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(0, 0), {.name =3D "xml", .type =3D VSH_OT_STRING, .completer =3D virshCompletePathLocalExisting, @@ -11311,7 +11299,6 @@ static const vshCmdOptDef opts_migrate_compcache[] = =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "size", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("requested size of the cache (in bytes) used for compres= sion") }, {.name =3D NULL} @@ -12964,7 +12951,6 @@ static const vshCmdOptDef opts_guest_agent_timeout[= ] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "timeout", .type =3D VSH_OT_INT, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("timeout seconds.") }, {.name =3D NULL} diff --git a/tools/virsh-host.c b/tools/virsh-host.c index ffb993de79..94b1879d5f 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -45,7 +45,6 @@ static const vshCmdInfo info_capabilities =3D { static const vshCmdOptDef opts_capabilities[] =3D { {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -104,7 +103,6 @@ static const vshCmdOptDef opts_domcapabilities[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 1b1344c17c..6f79dc4ba5 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -453,7 +453,6 @@ static const vshCmdOptDef opts_interface_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 376de46cf4..e38ecff443 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -665,7 +665,6 @@ static const vshCmdOptDef opts_network_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -1891,7 +1890,6 @@ static const vshCmdOptDef opts_network_port_dumpxml[]= =3D { VIRSH_COMMON_OPT_NETWORK_PORT(0), {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 90cfc187e5..23b1d45c92 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -583,7 +583,6 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index f54d2a0ae5..69473b4935 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -175,7 +175,6 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -577,7 +576,6 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml= [] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 67cc1b94cf..7bbdd7d661 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -729,7 +729,6 @@ static const vshCmdOptDef opts_pool_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 7e10afa765..f99e17f2e8 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -131,7 +131,6 @@ static const vshCmdOptDef opts_secret_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -187,7 +186,6 @@ static const vshCmdOptDef opts_secret_set_value[] =3D { }, {.name =3D "file", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompletePathLocalExisting, .help =3D N_("read secret from file"), }, diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 899bae7e9a..80a8c9e754 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -356,7 +356,6 @@ static const vshCmdOptDef opts_snapshot_create_as[] =3D= { }, {.name =3D "memspec", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .help =3D N_("memory attributes: [file=3D]name[,snapshot=3Dtype]") }, {.name =3D "diskspec", @@ -1579,7 +1578,6 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] =3D= { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 8794126f21..104a4a081c 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1119,7 +1119,6 @@ static const vshCmdOptDef opts_vol_dumpxml[] =3D { VIRSH_COMMON_OPT_POOL_OPTIONAL, {.name =3D "xpath", .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 37bc6fe4f0..c3b3cc8ccd 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1003,7 +1003,6 @@ static const vshCmdOptDef opts_daemon_timeout[] =3D { .type =3D VSH_OT_INT, .required =3D true, .help =3D N_("number of seconds the daemon will run without any activ= e connection"), - .flags =3D VSH_OFLAG_REQ_OPT }, {.name =3D NULL} }; diff --git a/tools/vsh.c b/tools/vsh.c index 85296c35c7..c88c13fbe0 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -442,7 +442,11 @@ vshCmddefOptParse(const vshCmdDef *cmd, if (opt->type =3D=3D VSH_OT_ALIAS) continue; /* skip the alias option */ - if (!(opt->flags & VSH_OFLAG_REQ_OPT)) + /* The command line parser requires the argument name for optional= or + * non-positional arguments automatically, but if we need to do it + * explicitly for required non-positional arguments. + * This bitmap needs to be set on te negation of the above */ + if (!(opt->required && !opt->positional)) *opts_need_arg |=3D 1ULL << i; if (opt->required) diff --git a/tools/vsh.h b/tools/vsh.h index 5f3e610dd7..4b7fea8ba0 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -99,7 +99,6 @@ typedef enum { enum { VSH_OFLAG_NONE =3D 0, /* without flags */ VSH_OFLAG_EMPTY_OK =3D (1 << 1), /* empty string option allowed */ - VSH_OFLAG_REQ_OPT =3D (1 << 2), /* --optionname required */ }; /* forward declarations */ --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org