[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH] xl: constify cmd_table entries


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 27 Apr 2021 17:11:04 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Julien Grall <julien@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 27 Apr 2021 16:11:32 +0000
  • 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
  • Ironport-sdr: wJOM4cQgGs07JbsFRbISyax5rQ3QfbhgkmK58glV7BBREzKJ1rT7efqQJxXjT8871WQj1O2+us thT0yC0HFahD6109raqj4sknp+GnfV/0IUF0DFZ3Op3zYBiUZtQbCtvWXl9+I69WURDNWeu5BJ trfjZwVzBykZPM4QV+Rv+p3prMaK976yUXr34zFS4O8A74KgtZLsuvoilK9P1EH7403j1iaJtY vyoX0C3hqnGquaR1yxeKoYQmdvGrh95GOIqFbXd0m9Hhkt4wlCpLkzUDfSMJkphvwCn2XcSpTq 75c=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

and cmdtable_len.

The entries in cmd_table don't need to be modified once xl is running.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 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 = 0;
     char *cmd = 0;
-    struct cmd_spec *cspec;
+    const struct cmd_spec *cspec;
     int ret;
     void *config_data = 0;
     int config_len = 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;
 
     if (!command || !strcmp(command, "help")) {
         printf("Usage xl [-vfNtT] <subcommand> [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);
 
 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);
 
 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 @@
 
 #include "xl.h"
 
-struct cmd_spec cmd_table[] = {
+const struct cmd_spec cmd_table[] = {
     { "create",
       &main_create, 1, 1,
       "Create a domain from config file <filename>",
@@ -631,12 +631,12 @@ struct cmd_spec cmd_table[] = {
     },
 };
 
-int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);
+const int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);
 
 /* 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 = NULL;
+    const struct cmd_spec *cmd = NULL;
     size_t len;
     int i, count = 0;
 
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.