From nobody Thu Apr 25 00:49:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1619539909; cv=none; d=zohomail.com; s=zohoarc; b=R4b6NqvwI3/lY8HLk75CUR8ItMghG3O6NgGAHMyqPm39bm3eEFN2V4+2B/9Kx4AcU0KJA4Blnssk8uyjbNWadpGrORSM3UHjFXHGTIn4VDAMtj8pqFYCzNDQApI5/2y8A3K3Q5ynZUvN0XiVeeHk3lCR6rmb4+k3omXbsVH+djY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619539909; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=PkesnmHwC3F3lIFrRUKw0IP+iFbU5W+iVPP2KJ2w0CM=; b=OKoU5A6Zx8njCvzzhxmJ+TxUD3nw7+hv5cmt1w8erdppIUEUeesP0FnTLwfnwHRwBH/TcaMsXY3DAzpLYcnD4oCzjBfwrZ5THXW1WmHH2XzPDnJtOGMe0aHj9fPlb9MOToHTSrYHMvpoykPtwmGCCADgvJ34rKdx0egWRj35okk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1619539909127851.4491243733729; Tue, 27 Apr 2021 09:11:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118693.224930 (Exim 4.92) (envelope-from ) id 1lbQJ5-0008AH-9p; Tue, 27 Apr 2021 16:11:27 +0000 Received: by outflank-mailman (output) from mailman id 118693.224930; Tue, 27 Apr 2021 16:11:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbQJ5-0008AA-5z; Tue, 27 Apr 2021 16:11:27 +0000 Received: by outflank-mailman (input) for mailman id 118693; Tue, 27 Apr 2021 16:11:25 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbQJ3-0008A4-Nm for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 16:11:25 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ab5810a2-e339-46eb-a73a-fbde90406247; Tue, 27 Apr 2021 16:11:25 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ab5810a2-e339-46eb-a73a-fbde90406247 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1619539884; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=k8R0nO84vdjD7WiYzhu/0REIsxIMiDXT7mDSGYyyDyw=; b=Tt0yjHBidmNF+pUGsCYZTYl+Ly/FundHJzf4zPv+QXwtzKYNBATJTuAZ BrKarJEdt3PXX/+a6hitnM7OxdU1zXd3yBrPyL5iHKX4id0GqoBsdeyRZ 9cKK5vSVeW8gWbgeNqRqCg1aegj5EHling9Pj/koDA/JKCFEgmHOgF8yW s=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: wJOM4cQgGs07JbsFRbISyax5rQ3QfbhgkmK58glV7BBREzKJ1rT7efqQJxXjT8871WQj1O2+us thT0yC0HFahD6109raqj4sknp+GnfV/0IUF0DFZ3Op3zYBiUZtQbCtvWXl9+I69WURDNWeu5BJ trfjZwVzBykZPM4QV+Rv+p3prMaK976yUXr34zFS4O8A74KgtZLsuvoilK9P1EH7403j1iaJtY vyoX0C3hqnGquaR1yxeKoYQmdvGrh95GOIqFbXd0m9Hhkt4wlCpLkzUDfSMJkphvwCn2XcSpTq 75c= X-SBRS: 5.1 X-MesageID: 44029925 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:rq5bZaM1Uz6MisBcT7b155DYdL4zR+YMi2QD/0p6RQVJNumRkM 6zlPoWvCWE7Ao5cltIo7y9EYOHRm7R8oMwxIEXM6urUgWOghrOEKhJ64z+zzr8XxDv7+I179 YaT4FSAMD9ZGIbse/U+w+9euxL/PCm9+SSif7a3zNRS2hRGsRdxiNYLireLUFsXglBAvMCZe Chz+5KvSCpd3hSTunTPAhnY8H5q9fGlI3rbHc9bnZN1CC0gTyl87L8GRSDty1uMQ9n+6so8m TOjmXCiZmLjvChxhfQk0/V4phG8eGB9vJ/BdeBgsVQFzP0igzAXupccoCF1QpZnMifrHIR1P jFuVMJItl64XK5RBDSnTLdny3blAsIx1Cn41mCmnfnqdH+X1sBerN8rJMcdADY5UomtMx916 wO33vxjesuMS/9 X-IronPort-AV: E=Sophos;i="5.82,254,1613451600"; d="scan'208";a="44029925" From: Anthony PERARD To: CC: Julien Grall , Anthony PERARD , Ian Jackson , Wei Liu Subject: [XEN PATCH] xl: constify cmd_table entries Date: Tue, 27 Apr 2021 17:11:04 +0100 Message-ID: <20210427161105.91731-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) Content-Type: text/plain; charset="utf-8" and cmdtable_len. The entries in cmd_table don't need to be modified once xl is running. Signed-off-by: Anthony PERARD Reviewed-by: Julien Grall --- tools/xl/xl.c | 4 ++-- tools/xl/xl.h | 6 +++--- tools/xl/xl_cmdtable.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 3a8929580212..4107d10fd469 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -362,7 +362,7 @@ int main(int argc, char **argv) { int opt =3D 0; char *cmd =3D 0; - struct cmd_spec *cspec; + const struct cmd_spec *cspec; int ret; void *config_data =3D 0; int config_len =3D 0; @@ -462,7 +462,7 @@ int child_report(xlchildnum child) void help(const char *command) { int i; - struct cmd_spec *cmd; + const struct cmd_spec *cmd; =20 if (!command || !strcmp(command, "help")) { printf("Usage xl [-vfNtT] [args]\n\n"); diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 137a29077c1e..e5a106dfbc82 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -218,10 +218,10 @@ int main_qemu_monitor_command(int argc, char **argv); void help(const char *command); =20 extern const char *common_domname; -extern struct cmd_spec cmd_table[]; -extern int cmdtable_len; +extern const struct cmd_spec cmd_table[]; +extern const int cmdtable_len; /* Look up a command in the table, allowing unambiguous truncation */ -struct cmd_spec *cmdtable_lookup(const char *s); +const struct cmd_spec *cmdtable_lookup(const char *s); =20 extern libxl_ctx *ctx; extern xentoollog_logger_stdiostream *logger; diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 07f54daabec3..84e2067e278b 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -18,7 +18,7 @@ =20 #include "xl.h" =20 -struct cmd_spec cmd_table[] =3D { +const struct cmd_spec cmd_table[] =3D { { "create", &main_create, 1, 1, "Create a domain from config file ", @@ -631,12 +631,12 @@ struct cmd_spec cmd_table[] =3D { }, }; =20 -int cmdtable_len =3D sizeof(cmd_table)/sizeof(struct cmd_spec); +const int cmdtable_len =3D sizeof(cmd_table)/sizeof(struct cmd_spec); =20 /* Look up a command in the table, allowing unambiguous truncation */ -struct cmd_spec *cmdtable_lookup(const char *s) +const struct cmd_spec *cmdtable_lookup(const char *s) { - struct cmd_spec *cmd =3D NULL; + const struct cmd_spec *cmd =3D NULL; size_t len; int i, count =3D 0; =20 --=20 Anthony PERARD