From nobody Mon Feb 9 05:45:41 2026 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 --- 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