Revision c227f099 monitor.c
b/monitor.c | ||
---|---|---|
67 | 67 |
* |
68 | 68 |
*/ |
69 | 69 |
|
70 |
typedef struct mon_cmd { |
|
70 |
typedef struct mon_cmd_t {
|
|
71 | 71 |
const char *name; |
72 | 72 |
const char *args_type; |
73 | 73 |
void *handler; |
74 | 74 |
const char *params; |
75 | 75 |
const char *help; |
76 |
} a_mon_cmd;
|
|
76 |
} mon_cmd_t;
|
|
77 | 77 |
|
78 | 78 |
/* file descriptors passed via SCM_RIGHTS */ |
79 |
typedef struct mon_fd a_mon_fd;
|
|
80 |
struct mon_fd { |
|
79 |
typedef struct mon_fd_t mon_fd_t;
|
|
80 |
struct mon_fd_t {
|
|
81 | 81 |
char *name; |
82 | 82 |
int fd; |
83 |
QLIST_ENTRY(mon_fd) next; |
|
83 |
QLIST_ENTRY(mon_fd_t) next;
|
|
84 | 84 |
}; |
85 | 85 |
|
86 | 86 |
struct Monitor { |
... | ... | |
95 | 95 |
CPUState *mon_cpu; |
96 | 96 |
BlockDriverCompletionFunc *password_completion_cb; |
97 | 97 |
void *password_opaque; |
98 |
QLIST_HEAD(,mon_fd) fds; |
|
98 |
QLIST_HEAD(,mon_fd_t) fds;
|
|
99 | 99 |
QLIST_ENTRY(Monitor) entry; |
100 | 100 |
}; |
101 | 101 |
|
102 | 102 |
static QLIST_HEAD(mon_list, Monitor) mon_list; |
103 | 103 |
|
104 |
static const a_mon_cmd mon_cmds[];
|
|
105 |
static const a_mon_cmd info_cmds[];
|
|
104 |
static const mon_cmd_t mon_cmds[];
|
|
105 |
static const mon_cmd_t info_cmds[];
|
|
106 | 106 |
|
107 | 107 |
Monitor *cur_mon = NULL; |
108 | 108 |
|
... | ... | |
229 | 229 |
return 0; |
230 | 230 |
} |
231 | 231 |
|
232 |
static void help_cmd_dump(Monitor *mon, const a_mon_cmd *cmds,
|
|
232 |
static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
|
|
233 | 233 |
const char *prefix, const char *name) |
234 | 234 |
{ |
235 |
const a_mon_cmd *cmd;
|
|
235 |
const mon_cmd_t *cmd;
|
|
236 | 236 |
|
237 | 237 |
for(cmd = cmds; cmd->name != NULL; cmd++) { |
238 | 238 |
if (!name || !strcmp(name, cmd->name)) |
... | ... | |
280 | 280 |
|
281 | 281 |
static void do_info(Monitor *mon, const QDict *qdict) |
282 | 282 |
{ |
283 |
const a_mon_cmd *cmd;
|
|
283 |
const mon_cmd_t *cmd;
|
|
284 | 284 |
const char *item = qdict_get_try_str(qdict, "item"); |
285 | 285 |
void (*handler)(Monitor *); |
286 | 286 |
|
... | ... | |
666 | 666 |
} |
667 | 667 |
|
668 | 668 |
static void memory_dump(Monitor *mon, int count, int format, int wsize, |
669 |
a_target_phys_addr addr, int is_physical)
|
|
669 |
target_phys_addr_t addr, int is_physical)
|
|
670 | 670 |
{ |
671 | 671 |
CPUState *env; |
672 | 672 |
int nb_per_line, l, line_size, i, max_digits, len; |
... | ... | |
805 | 805 |
int count = qdict_get_int(qdict, "count"); |
806 | 806 |
int format = qdict_get_int(qdict, "format"); |
807 | 807 |
int size = qdict_get_int(qdict, "size"); |
808 |
a_target_phys_addr addr = qdict_get_int(qdict, "addr");
|
|
808 |
target_phys_addr_t addr = qdict_get_int(qdict, "addr");
|
|
809 | 809 |
|
810 | 810 |
memory_dump(mon, count, format, size, addr, 1); |
811 | 811 |
} |
... | ... | |
813 | 813 |
static void do_print(Monitor *mon, const QDict *qdict) |
814 | 814 |
{ |
815 | 815 |
int format = qdict_get_int(qdict, "format"); |
816 |
a_target_phys_addr val = qdict_get_int(qdict, "val");
|
|
816 |
target_phys_addr_t val = qdict_get_int(qdict, "val");
|
|
817 | 817 |
|
818 | 818 |
#if TARGET_PHYS_ADDR_BITS == 32 |
819 | 819 |
switch(format) { |
... | ... | |
895 | 895 |
uint8_t buf[1024]; |
896 | 896 |
uint32_t size = qdict_get_int(qdict, "size"); |
897 | 897 |
const char *filename = qdict_get_str(qdict, "filename"); |
898 |
a_target_phys_addr addr = qdict_get_int(qdict, "val");
|
|
898 |
target_phys_addr_t addr = qdict_get_int(qdict, "val");
|
|
899 | 899 |
|
900 | 900 |
f = fopen(filename, "wb"); |
901 | 901 |
if (!f) { |
... | ... | |
1565 | 1565 |
static void do_balloon(Monitor *mon, const QDict *qdict) |
1566 | 1566 |
{ |
1567 | 1567 |
int value = qdict_get_int(qdict, "value"); |
1568 |
a_ram_addr target = value;
|
|
1568 |
ram_addr_t target = value;
|
|
1569 | 1569 |
qemu_balloon(target << 20); |
1570 | 1570 |
} |
1571 | 1571 |
|
1572 | 1572 |
static void do_info_balloon(Monitor *mon) |
1573 | 1573 |
{ |
1574 |
a_ram_addr actual;
|
|
1574 |
ram_addr_t actual;
|
|
1575 | 1575 |
|
1576 | 1576 |
actual = qemu_balloon_status(); |
1577 | 1577 |
if (kvm_enabled() && !kvm_has_sync_mmu()) |
... | ... | |
1711 | 1711 |
static void do_getfd(Monitor *mon, const QDict *qdict) |
1712 | 1712 |
{ |
1713 | 1713 |
const char *fdname = qdict_get_str(qdict, "fdname"); |
1714 |
a_mon_fd *monfd;
|
|
1714 |
mon_fd_t *monfd;
|
|
1715 | 1715 |
int fd; |
1716 | 1716 |
|
1717 | 1717 |
fd = qemu_chr_get_msgfd(mon->chr); |
... | ... | |
1742 | 1742 |
return; |
1743 | 1743 |
} |
1744 | 1744 |
|
1745 |
monfd = qemu_mallocz(sizeof(a_mon_fd));
|
|
1745 |
monfd = qemu_mallocz(sizeof(mon_fd_t));
|
|
1746 | 1746 |
monfd->name = qemu_strdup(fdname); |
1747 | 1747 |
monfd->fd = fd; |
1748 | 1748 |
|
... | ... | |
1752 | 1752 |
static void do_closefd(Monitor *mon, const QDict *qdict) |
1753 | 1753 |
{ |
1754 | 1754 |
const char *fdname = qdict_get_str(qdict, "fdname"); |
1755 |
a_mon_fd *monfd;
|
|
1755 |
mon_fd_t *monfd;
|
|
1756 | 1756 |
|
1757 | 1757 |
QLIST_FOREACH(monfd, &mon->fds, next) { |
1758 | 1758 |
if (strcmp(monfd->name, fdname) != 0) { |
... | ... | |
1783 | 1783 |
|
1784 | 1784 |
int monitor_get_fd(Monitor *mon, const char *fdname) |
1785 | 1785 |
{ |
1786 |
a_mon_fd *monfd;
|
|
1786 |
mon_fd_t *monfd;
|
|
1787 | 1787 |
|
1788 | 1788 |
QLIST_FOREACH(monfd, &mon->fds, next) { |
1789 | 1789 |
int fd; |
... | ... | |
1805 | 1805 |
return -1; |
1806 | 1806 |
} |
1807 | 1807 |
|
1808 |
static const a_mon_cmd mon_cmds[] = {
|
|
1808 |
static const mon_cmd_t mon_cmds[] = {
|
|
1809 | 1809 |
#include "qemu-monitor.h" |
1810 | 1810 |
{ NULL, NULL, }, |
1811 | 1811 |
}; |
1812 | 1812 |
|
1813 | 1813 |
/* Please update qemu-monitor.hx when adding or changing commands */ |
1814 |
static const a_mon_cmd info_cmds[] = {
|
|
1814 |
static const mon_cmd_t info_cmds[] = {
|
|
1815 | 1815 |
{ "version", "", do_info_version, |
1816 | 1816 |
"", "show the version of QEMU" }, |
1817 | 1817 |
{ "network", "", do_info_network, |
... | ... | |
2585 | 2585 |
|
2586 | 2586 |
#define MAX_ARGS 16 |
2587 | 2587 |
|
2588 |
static const a_mon_cmd *monitor_parse_command(Monitor *mon,
|
|
2588 |
static const mon_cmd_t *monitor_parse_command(Monitor *mon,
|
|
2589 | 2589 |
const char *cmdline, |
2590 | 2590 |
QDict *qdict) |
2591 | 2591 |
{ |
2592 | 2592 |
const char *p, *typestr; |
2593 | 2593 |
int c; |
2594 |
const a_mon_cmd *cmd;
|
|
2594 |
const mon_cmd_t *cmd;
|
|
2595 | 2595 |
char cmdname[256]; |
2596 | 2596 |
char buf[1024]; |
2597 | 2597 |
char *key; |
... | ... | |
2826 | 2826 |
static void monitor_handle_command(Monitor *mon, const char *cmdline) |
2827 | 2827 |
{ |
2828 | 2828 |
QDict *qdict; |
2829 |
const a_mon_cmd *cmd;
|
|
2829 |
const mon_cmd_t *cmd;
|
|
2830 | 2830 |
|
2831 | 2831 |
qdict = qdict_new(); |
2832 | 2832 |
|
... | ... | |
2971 | 2971 |
char *args[MAX_ARGS]; |
2972 | 2972 |
int nb_args, i, len; |
2973 | 2973 |
const char *ptype, *str; |
2974 |
const a_mon_cmd *cmd;
|
|
2974 |
const mon_cmd_t *cmd;
|
|
2975 | 2975 |
const KeyDef *key; |
2976 | 2976 |
|
2977 | 2977 |
parse_cmdline(cmdline, &nb_args, args); |
Also available in: Unified diff