Commit 8662d656ea4a4abddcd49553382ed117b11b927b

Authored by blueswir1
1 parent 7a786a46

Make monitor command tables const

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5399 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 22 additions and 22 deletions
monitor.c
... ... @@ -66,8 +66,8 @@ typedef struct term_cmd_t {
66 66 static CharDriverState *monitor_hd[MAX_MON];
67 67 static int hide_banner;
68 68  
69   -static term_cmd_t term_cmds[];
70   -static term_cmd_t info_cmds[];
  69 +static const term_cmd_t term_cmds[];
  70 +static const term_cmd_t info_cmds[];
71 71  
72 72 static uint8_t term_outbuf[1024];
73 73 static int term_outbuf_index;
... ... @@ -175,9 +175,9 @@ static int compare_cmd(const char *name, const char *list)
175 175 return 0;
176 176 }
177 177  
178   -static void help_cmd1(term_cmd_t *cmds, const char *prefix, const char *name)
  178 +static void help_cmd1(const term_cmd_t *cmds, const char *prefix, const char *name)
179 179 {
180   - term_cmd_t *cmd;
  180 + const term_cmd_t *cmd;
181 181  
182 182 for(cmd = cmds; cmd->name != NULL; cmd++) {
183 183 if (!name || !strcmp(name, cmd->name))
... ... @@ -192,7 +192,7 @@ static void help_cmd(const char *name)
192 192 } else {
193 193 help_cmd1(term_cmds, "", name);
194 194 if (name && !strcmp(name, "log")) {
195   - CPULogItem *item;
  195 + const CPULogItem *item;
196 196 term_printf("Log items (comma separated):\n");
197 197 term_printf("%-10s %s\n", "none", "remove all logs");
198 198 for(item = cpu_log_items; item->mask != 0; item++) {
... ... @@ -221,7 +221,7 @@ static void do_commit(const char *device)
221 221  
222 222 static void do_info(const char *item)
223 223 {
224   - term_cmd_t *cmd;
  224 + const term_cmd_t *cmd;
225 225 void (*handler)(void);
226 226  
227 227 if (!item)
... ... @@ -1378,7 +1378,7 @@ static void do_inject_nmi(int cpu_index)
1378 1378 }
1379 1379 #endif
1380 1380  
1381   -static term_cmd_t term_cmds[] = {
  1381 +static const term_cmd_t term_cmds[] = {
1382 1382 { "help|?", "s?", do_help,
1383 1383 "[cmd]", "show the help" },
1384 1384 { "commit", "s", do_commit,
... ... @@ -1460,7 +1460,7 @@ static term_cmd_t term_cmds[] = {
1460 1460 { NULL, NULL, },
1461 1461 };
1462 1462  
1463   -static term_cmd_t info_cmds[] = {
  1463 +static const term_cmd_t info_cmds[] = {
1464 1464 { "version", "", do_info_version,
1465 1465 "", "show the version of qemu" },
1466 1466 { "network", "", do_info_network,
... ... @@ -1533,12 +1533,12 @@ static jmp_buf expr_env;
1533 1533 typedef struct MonitorDef {
1534 1534 const char *name;
1535 1535 int offset;
1536   - target_long (*get_value)(struct MonitorDef *md, int val);
  1536 + target_long (*get_value)(const struct MonitorDef *md, int val);
1537 1537 int type;
1538 1538 } MonitorDef;
1539 1539  
1540 1540 #if defined(TARGET_I386)
1541   -static target_long monitor_get_pc (struct MonitorDef *md, int val)
  1541 +static target_long monitor_get_pc (const struct MonitorDef *md, int val)
1542 1542 {
1543 1543 CPUState *env = mon_get_cpu();
1544 1544 if (!env)
... ... @@ -1548,7 +1548,7 @@ static target_long monitor_get_pc (struct MonitorDef *md, int val)
1548 1548 #endif
1549 1549  
1550 1550 #if defined(TARGET_PPC)
1551   -static target_long monitor_get_ccr (struct MonitorDef *md, int val)
  1551 +static target_long monitor_get_ccr (const struct MonitorDef *md, int val)
1552 1552 {
1553 1553 CPUState *env = mon_get_cpu();
1554 1554 unsigned int u;
... ... @@ -1564,7 +1564,7 @@ static target_long monitor_get_ccr (struct MonitorDef *md, int val)
1564 1564 return u;
1565 1565 }
1566 1566  
1567   -static target_long monitor_get_msr (struct MonitorDef *md, int val)
  1567 +static target_long monitor_get_msr (const struct MonitorDef *md, int val)
1568 1568 {
1569 1569 CPUState *env = mon_get_cpu();
1570 1570 if (!env)
... ... @@ -1572,7 +1572,7 @@ static target_long monitor_get_msr (struct MonitorDef *md, int val)
1572 1572 return env->msr;
1573 1573 }
1574 1574  
1575   -static target_long monitor_get_xer (struct MonitorDef *md, int val)
  1575 +static target_long monitor_get_xer (const struct MonitorDef *md, int val)
1576 1576 {
1577 1577 CPUState *env = mon_get_cpu();
1578 1578 if (!env)
... ... @@ -1580,7 +1580,7 @@ static target_long monitor_get_xer (struct MonitorDef *md, int val)
1580 1580 return ppc_load_xer(env);
1581 1581 }
1582 1582  
1583   -static target_long monitor_get_decr (struct MonitorDef *md, int val)
  1583 +static target_long monitor_get_decr (const struct MonitorDef *md, int val)
1584 1584 {
1585 1585 CPUState *env = mon_get_cpu();
1586 1586 if (!env)
... ... @@ -1588,7 +1588,7 @@ static target_long monitor_get_decr (struct MonitorDef *md, int val)
1588 1588 return cpu_ppc_load_decr(env);
1589 1589 }
1590 1590  
1591   -static target_long monitor_get_tbu (struct MonitorDef *md, int val)
  1591 +static target_long monitor_get_tbu (const struct MonitorDef *md, int val)
1592 1592 {
1593 1593 CPUState *env = mon_get_cpu();
1594 1594 if (!env)
... ... @@ -1596,7 +1596,7 @@ static target_long monitor_get_tbu (struct MonitorDef *md, int val)
1596 1596 return cpu_ppc_load_tbu(env);
1597 1597 }
1598 1598  
1599   -static target_long monitor_get_tbl (struct MonitorDef *md, int val)
  1599 +static target_long monitor_get_tbl (const struct MonitorDef *md, int val)
1600 1600 {
1601 1601 CPUState *env = mon_get_cpu();
1602 1602 if (!env)
... ... @@ -1607,7 +1607,7 @@ static target_long monitor_get_tbl (struct MonitorDef *md, int val)
1607 1607  
1608 1608 #if defined(TARGET_SPARC)
1609 1609 #ifndef TARGET_SPARC64
1610   -static target_long monitor_get_psr (struct MonitorDef *md, int val)
  1610 +static target_long monitor_get_psr (const struct MonitorDef *md, int val)
1611 1611 {
1612 1612 CPUState *env = mon_get_cpu();
1613 1613 if (!env)
... ... @@ -1616,7 +1616,7 @@ static target_long monitor_get_psr (struct MonitorDef *md, int val)
1616 1616 }
1617 1617 #endif
1618 1618  
1619   -static target_long monitor_get_reg(struct MonitorDef *md, int val)
  1619 +static target_long monitor_get_reg(const struct MonitorDef *md, int val)
1620 1620 {
1621 1621 CPUState *env = mon_get_cpu();
1622 1622 if (!env)
... ... @@ -1625,7 +1625,7 @@ static target_long monitor_get_reg(struct MonitorDef *md, int val)
1625 1625 }
1626 1626 #endif
1627 1627  
1628   -static MonitorDef monitor_defs[] = {
  1628 +static const MonitorDef monitor_defs[] = {
1629 1629 #ifdef TARGET_I386
1630 1630  
1631 1631 #define SEG(name, seg) \
... ... @@ -1876,7 +1876,7 @@ static void expr_error(const char *fmt)
1876 1876 /* return 0 if OK, -1 if not found, -2 if no CPU defined */
1877 1877 static int get_monitor_def(target_long *pval, const char *name)
1878 1878 {
1879   - MonitorDef *md;
  1879 + const MonitorDef *md;
1880 1880 void *ptr;
1881 1881  
1882 1882 for(md = monitor_defs; md->name != NULL; md++) {
... ... @@ -2170,7 +2170,7 @@ static void monitor_handle_command(const char *cmdline)
2170 2170 const char *p, *pstart, *typestr;
2171 2171 char *q;
2172 2172 int c, nb_args, len, i, has_arg;
2173   - term_cmd_t *cmd;
  2173 + const term_cmd_t *cmd;
2174 2174 char cmdname[256];
2175 2175 char buf[1024];
2176 2176 void *str_allocated[MAX_ARGS];
... ... @@ -2607,7 +2607,7 @@ void readline_find_completion(const char *cmdline)
2607 2607 char *args[MAX_ARGS];
2608 2608 int nb_args, i, len;
2609 2609 const char *ptype, *str;
2610   - term_cmd_t *cmd;
  2610 + const term_cmd_t *cmd;
2611 2611 const KeyDef *key;
2612 2612  
2613 2613 parse_cmdline(cmdline, &nb_args, args);
... ...