aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c152
1 files changed, 69 insertions, 83 deletions
diff --git a/monitor.c b/monitor.c
index 137d23fcc1..41900dad20 100644
--- a/monitor.c
+++ b/monitor.c
@@ -73,7 +73,7 @@
#include "qapi/qmp-event.h"
#include "qapi-event.h"
-/* for pic/irq_info */
+/* for hmp_info_irq/pic */
#if defined(TARGET_SPARC)
#include "hw/sparc/sun4m.h"
#endif
@@ -881,7 +881,7 @@ static void do_help_cmd(Monitor *mon, const QDict *qdict)
help_cmd(mon, qdict_get_try_str(qdict, "name"));
}
-static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
+static void hmp_trace_event(Monitor *mon, const QDict *qdict)
{
const char *tp_name = qdict_get_str(qdict, "name");
bool new_state = qdict_get_bool(qdict, "option");
@@ -889,13 +889,12 @@ static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
qmp_trace_event_set_state(tp_name, new_state, true, true, &local_err);
if (local_err) {
- qerror_report_err(local_err);
- error_free(local_err);
+ error_report_err(local_err);
}
}
#ifdef CONFIG_TRACE_SIMPLE
-static void do_trace_file(Monitor *mon, const QDict *qdict)
+static void hmp_trace_file(Monitor *mon, const QDict *qdict)
{
const char *op = qdict_get_try_str(qdict, "op");
const char *arg = qdict_get_try_str(qdict, "arg");
@@ -958,7 +957,7 @@ static void user_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,
}
}
-static void do_info_help(Monitor *mon, const QDict *qdict)
+static void hmp_info_help(Monitor *mon, const QDict *qdict)
{
help_cmd(mon, "info");
}
@@ -1027,7 +1026,7 @@ int monitor_get_cpu_index(void)
return cpu->cpu_index;
}
-static void do_info_registers(Monitor *mon, const QDict *qdict)
+static void hmp_info_registers(Monitor *mon, const QDict *qdict)
{
CPUState *cpu;
CPUArchState *env;
@@ -1036,18 +1035,18 @@ static void do_info_registers(Monitor *mon, const QDict *qdict)
cpu_dump_state(cpu, (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU);
}
-static void do_info_jit(Monitor *mon, const QDict *qdict)
+static void hmp_info_jit(Monitor *mon, const QDict *qdict)
{
dump_exec_info((FILE *)mon, monitor_fprintf);
dump_drift_info((FILE *)mon, monitor_fprintf);
}
-static void do_info_opcount(Monitor *mon, const QDict *qdict)
+static void hmp_info_opcount(Monitor *mon, const QDict *qdict)
{
dump_opcount_info((FILE *)mon, monitor_fprintf);
}
-static void do_info_history(Monitor *mon, const QDict *qdict)
+static void hmp_info_history(Monitor *mon, const QDict *qdict)
{
int i;
const char *str;
@@ -1064,7 +1063,7 @@ static void do_info_history(Monitor *mon, const QDict *qdict)
}
}
-static void do_info_cpu_stats(Monitor *mon, const QDict *qdict)
+static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
{
CPUState *cpu;
CPUArchState *env;
@@ -1074,7 +1073,7 @@ static void do_info_cpu_stats(Monitor *mon, const QDict *qdict)
cpu_dump_statistics(cpu, (FILE *)mon, &monitor_fprintf, 0);
}
-static void do_trace_print_events(Monitor *mon, const QDict *qdict)
+static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
{
TraceEventInfoList *events = qmp_trace_event_get_state("*", NULL);
TraceEventInfoList *elem;
@@ -1123,12 +1122,12 @@ static int client_migrate_info(Monitor *mon, const QDict *qdict,
return -1;
}
-static void do_logfile(Monitor *mon, const QDict *qdict)
+static void hmp_logfile(Monitor *mon, const QDict *qdict)
{
qemu_set_log_filename(qdict_get_str(qdict, "filename"));
}
-static void do_log(Monitor *mon, const QDict *qdict)
+static void hmp_log(Monitor *mon, const QDict *qdict)
{
int mask;
const char *items = qdict_get_str(qdict, "items");
@@ -1145,7 +1144,7 @@ static void do_log(Monitor *mon, const QDict *qdict)
qemu_set_log(mask);
}
-static void do_singlestep(Monitor *mon, const QDict *qdict)
+static void hmp_singlestep(Monitor *mon, const QDict *qdict)
{
const char *option = qdict_get_try_str(qdict, "option");
if (!option || !strcmp(option, "on")) {
@@ -1157,7 +1156,7 @@ static void do_singlestep(Monitor *mon, const QDict *qdict)
}
}
-static void do_gdbserver(Monitor *mon, const QDict *qdict)
+static void hmp_gdbserver(Monitor *mon, const QDict *qdict)
{
const char *device = qdict_get_try_str(qdict, "device");
if (!device)
@@ -1173,7 +1172,7 @@ static void do_gdbserver(Monitor *mon, const QDict *qdict)
}
}
-static void do_watchdog_action(Monitor *mon, const QDict *qdict)
+static void hmp_watchdog_action(Monitor *mon, const QDict *qdict)
{
const char *action = qdict_get_str(qdict, "action");
if (select_watchdog_action(action) == -1) {
@@ -1332,7 +1331,7 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
}
}
-static void do_memory_dump(Monitor *mon, const QDict *qdict)
+static void hmp_memory_dump(Monitor *mon, const QDict *qdict)
{
int count = qdict_get_int(qdict, "count");
int format = qdict_get_int(qdict, "format");
@@ -1342,7 +1341,7 @@ static void do_memory_dump(Monitor *mon, const QDict *qdict)
memory_dump(mon, count, format, size, addr, 0);
}
-static void do_physical_memory_dump(Monitor *mon, const QDict *qdict)
+static void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict)
{
int count = qdict_get_int(qdict, "count");
int format = qdict_get_int(qdict, "format");
@@ -1378,7 +1377,7 @@ static void do_print(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "\n");
}
-static void do_sum(Monitor *mon, const QDict *qdict)
+static void hmp_sum(Monitor *mon, const QDict *qdict)
{
uint32_t addr;
uint16_t sum;
@@ -1397,7 +1396,7 @@ static void do_sum(Monitor *mon, const QDict *qdict)
static int mouse_button_state;
-static void do_mouse_move(Monitor *mon, const QDict *qdict)
+static void hmp_mouse_move(Monitor *mon, const QDict *qdict)
{
int dx, dy, dz, button;
const char *dx_str = qdict_get_str(qdict, "dx_str");
@@ -1421,7 +1420,7 @@ static void do_mouse_move(Monitor *mon, const QDict *qdict)
qemu_input_event_sync();
}
-static void do_mouse_button(Monitor *mon, const QDict *qdict)
+static void hmp_mouse_button(Monitor *mon, const QDict *qdict)
{
static uint32_t bmap[INPUT_BUTTON_MAX] = {
[INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
@@ -1438,7 +1437,7 @@ static void do_mouse_button(Monitor *mon, const QDict *qdict)
mouse_button_state = button_state;
}
-static void do_ioport_read(Monitor *mon, const QDict *qdict)
+static void hmp_ioport_read(Monitor *mon, const QDict *qdict)
{
int size = qdict_get_int(qdict, "size");
int addr = qdict_get_int(qdict, "addr");
@@ -1472,7 +1471,7 @@ static void do_ioport_read(Monitor *mon, const QDict *qdict)
suffix, addr, size * 2, val);
}
-static void do_ioport_write(Monitor *mon, const QDict *qdict)
+static void hmp_ioport_write(Monitor *mon, const QDict *qdict)
{
int size = qdict_get_int(qdict, "size");
int addr = qdict_get_int(qdict, "addr");
@@ -1494,7 +1493,7 @@ static void do_ioport_write(Monitor *mon, const QDict *qdict)
}
}
-static void do_boot_set(Monitor *mon, const QDict *qdict)
+static void hmp_boot_set(Monitor *mon, const QDict *qdict)
{
Error *local_err = NULL;
const char *bootdevice = qdict_get_str(qdict, "bootdevice");
@@ -1658,7 +1657,7 @@ static void tlb_info_64(Monitor *mon, CPUArchState *env)
}
#endif
-static void tlb_info(Monitor *mon, const QDict *qdict)
+static void hmp_info_tlb(Monitor *mon, const QDict *qdict)
{
CPUArchState *env;
@@ -1881,7 +1880,7 @@ static void mem_info_64(Monitor *mon, CPUArchState *env)
}
#endif
-static void mem_info(Monitor *mon, const QDict *qdict)
+static void hmp_info_mem(Monitor *mon, const QDict *qdict)
{
CPUArchState *env;
@@ -1920,7 +1919,7 @@ static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
tlb->d, tlb->wt);
}
-static void tlb_info(Monitor *mon, const QDict *qdict)
+static void hmp_info_tlb(Monitor *mon, const QDict *qdict)
{
CPUArchState *env = mon_get_cpu();
int i;
@@ -1936,7 +1935,7 @@ static void tlb_info(Monitor *mon, const QDict *qdict)
#endif
#if defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_XTENSA)
-static void tlb_info(Monitor *mon, const QDict *qdict)
+static void hmp_info_tlb(Monitor *mon, const QDict *qdict)
{
CPUArchState *env1 = mon_get_cpu();
@@ -1944,12 +1943,12 @@ static void tlb_info(Monitor *mon, const QDict *qdict)
}
#endif
-static void do_info_mtree(Monitor *mon, const QDict *qdict)
+static void hmp_info_mtree(Monitor *mon, const QDict *qdict)
{
mtree_info((fprintf_function)monitor_printf, mon);
}
-static void do_info_numa(Monitor *mon, const QDict *qdict)
+static void hmp_info_numa(Monitor *mon, const QDict *qdict)
{
int i;
CPUState *cpu;
@@ -1977,7 +1976,7 @@ static void do_info_numa(Monitor *mon, const QDict *qdict)
int64_t qemu_time;
int64_t dev_time;
-static void do_info_profile(Monitor *mon, const QDict *qdict)
+static void hmp_info_profile(Monitor *mon, const QDict *qdict)
{
monitor_printf(mon, "async time %" PRId64 " (%0.3f)\n",
dev_time, dev_time / (double)get_ticks_per_sec());
@@ -1987,7 +1986,7 @@ static void do_info_profile(Monitor *mon, const QDict *qdict)
dev_time = 0;
}
#else
-static void do_info_profile(Monitor *mon, const QDict *qdict)
+static void hmp_info_profile(Monitor *mon, const QDict *qdict)
{
monitor_printf(mon, "Internal profiler not compiled\n");
}
@@ -1996,7 +1995,7 @@ static void do_info_profile(Monitor *mon, const QDict *qdict)
/* Capture support */
static QLIST_HEAD (capture_list_head, CaptureState) capture_head;
-static void do_info_capture(Monitor *mon, const QDict *qdict)
+static void hmp_info_capture(Monitor *mon, const QDict *qdict)
{
int i;
CaptureState *s;
@@ -2007,7 +2006,7 @@ static void do_info_capture(Monitor *mon, const QDict *qdict)
}
}
-static void do_stop_capture(Monitor *mon, const QDict *qdict)
+static void hmp_stopcapture(Monitor *mon, const QDict *qdict)
{
int i;
int n = qdict_get_int(qdict, "n");
@@ -2023,7 +2022,7 @@ static void do_stop_capture(Monitor *mon, const QDict *qdict)
}
}
-static void do_wav_capture(Monitor *mon, const QDict *qdict)
+static void hmp_wavcapture(Monitor *mon, const QDict *qdict)
{
const char *path = qdict_get_str(qdict, "path");
int has_freq = qdict_haskey(qdict, "freq");
@@ -2058,7 +2057,7 @@ static qemu_acl *find_acl(Monitor *mon, const char *name)
return acl;
}
-static void do_acl_show(Monitor *mon, const QDict *qdict)
+static void hmp_acl_show(Monitor *mon, const QDict *qdict)
{
const char *aclname = qdict_get_str(qdict, "aclname");
qemu_acl *acl = find_acl(mon, aclname);
@@ -2076,7 +2075,7 @@ static void do_acl_show(Monitor *mon, const QDict *qdict)
}
}
-static void do_acl_reset(Monitor *mon, const QDict *qdict)
+static void hmp_acl_reset(Monitor *mon, const QDict *qdict)
{
const char *aclname = qdict_get_str(qdict, "aclname");
qemu_acl *acl = find_acl(mon, aclname);
@@ -2087,7 +2086,7 @@ static void do_acl_reset(Monitor *mon, const QDict *qdict)
}
}
-static void do_acl_policy(Monitor *mon, const QDict *qdict)
+static void hmp_acl_policy(Monitor *mon, const QDict *qdict)
{
const char *aclname = qdict_get_str(qdict, "aclname");
const char *policy = qdict_get_str(qdict, "policy");
@@ -2107,7 +2106,7 @@ static void do_acl_policy(Monitor *mon, const QDict *qdict)
}
}
-static void do_acl_add(Monitor *mon, const QDict *qdict)
+static void hmp_acl_add(Monitor *mon, const QDict *qdict)
{
const char *aclname = qdict_get_str(qdict, "aclname");
const char *match = qdict_get_str(qdict, "match");
@@ -2138,7 +2137,7 @@ static void do_acl_add(Monitor *mon, const QDict *qdict)
}
}
-static void do_acl_remove(Monitor *mon, const QDict *qdict)
+static void hmp_acl_remove(Monitor *mon, const QDict *qdict)
{
const char *aclname = qdict_get_str(qdict, "aclname");
const char *match = qdict_get_str(qdict, "match");
@@ -2155,7 +2154,7 @@ static void do_acl_remove(Monitor *mon, const QDict *qdict)
}
#if defined(TARGET_I386)
-static void do_inject_mce(Monitor *mon, const QDict *qdict)
+static void hmp_mce(Monitor *mon, const QDict *qdict)
{
X86CPU *cpu;
CPUState *cs;
@@ -2233,7 +2232,7 @@ void qmp_closefd(const char *fdname, Error **errp)
error_set(errp, QERR_FD_NOT_FOUND, fdname);
}
-static void do_loadvm(Monitor *mon, const QDict *qdict)
+static void hmp_loadvm(Monitor *mon, const QDict *qdict)
{
int saved_vm_running = runstate_is_running();
const char *name = qdict_get_str(qdict, "name");
@@ -2571,20 +2570,7 @@ void monitor_fdset_dup_fd_remove(int dup_fd)
monitor_fdset_dup_fd_find_remove(dup_fd, true);
}
-int monitor_handle_fd_param(Monitor *mon, const char *fdname)
-{
- int fd;
- Error *local_err = NULL;
-
- fd = monitor_handle_fd_param2(mon, fdname, &local_err);
- if (local_err) {
- qerror_report_err(local_err);
- error_free(local_err);
- }
- return fd;
-}
-
-int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error **errp)
+int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp)
{
int fd;
Error *local_err = NULL;
@@ -2622,7 +2608,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show the network state",
- .mhandler.cmd = do_info_network,
+ .mhandler.cmd = hmp_info_network,
},
{
.name = "chardev",
@@ -2658,7 +2644,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show the cpu registers",
- .mhandler.cmd = do_info_registers,
+ .mhandler.cmd = hmp_info_registers,
},
{
.name = "cpus",
@@ -2672,7 +2658,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show the command line history",
- .mhandler.cmd = do_info_history,
+ .mhandler.cmd = hmp_info_history,
},
#if defined(TARGET_I386) || defined(TARGET_PPC) || defined(TARGET_MIPS) || \
defined(TARGET_LM32) || (defined(TARGET_SPARC) && !defined(TARGET_SPARC64))
@@ -2682,11 +2668,11 @@ static mon_cmd_t info_cmds[] = {
.params = "",
.help = "show the interrupts statistics (if available)",
#ifdef TARGET_SPARC
- .mhandler.cmd = sun4m_irq_info,
+ .mhandler.cmd = sun4m_hmp_info_irq,
#elif defined(TARGET_LM32)
- .mhandler.cmd = lm32_irq_info,
+ .mhandler.cmd = lm32_hmp_info_irq,
#else
- .mhandler.cmd = irq_info,
+ .mhandler.cmd = hmp_info_irq,
#endif
},
{
@@ -2695,11 +2681,11 @@ static mon_cmd_t info_cmds[] = {
.params = "",
.help = "show i8259 (PIC) state",
#ifdef TARGET_SPARC
- .mhandler.cmd = sun4m_pic_info,
+ .mhandler.cmd = sun4m_hmp_info_pic,
#elif defined(TARGET_LM32)
- .mhandler.cmd = lm32_do_pic_info,
+ .mhandler.cmd = lm32_hmp_info_pic,
#else
- .mhandler.cmd = pic_info,
+ .mhandler.cmd = hmp_info_pic,
#endif
},
#endif
@@ -2717,7 +2703,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show virtual to physical memory mappings",
- .mhandler.cmd = tlb_info,
+ .mhandler.cmd = hmp_info_tlb,
},
#endif
#if defined(TARGET_I386)
@@ -2726,7 +2712,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show the active virtual memory mappings",
- .mhandler.cmd = mem_info,
+ .mhandler.cmd = hmp_info_mem,
},
#endif
{
@@ -2734,21 +2720,21 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show memory tree",
- .mhandler.cmd = do_info_mtree,
+ .mhandler.cmd = hmp_info_mtree,
},
{
.name = "jit",
.args_type = "",
.params = "",
.help = "show dynamic compiler info",
- .mhandler.cmd = do_info_jit,
+ .mhandler.cmd = hmp_info_jit,
},
{
.name = "opcount",
.args_type = "",
.params = "",
.help = "show dynamic compiler opcode counters",
- .mhandler.cmd = do_info_opcount,
+ .mhandler.cmd = hmp_info_opcount,
},
{
.name = "kvm",
@@ -2762,42 +2748,42 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show NUMA information",
- .mhandler.cmd = do_info_numa,
+ .mhandler.cmd = hmp_info_numa,
},
{
.name = "usb",
.args_type = "",
.params = "",
.help = "show guest USB devices",
- .mhandler.cmd = usb_info,
+ .mhandler.cmd = hmp_info_usb,
},
{
.name = "usbhost",
.args_type = "",
.params = "",
.help = "show host USB devices",
- .mhandler.cmd = usb_host_info,
+ .mhandler.cmd = hmp_info_usbhost,
},
{
.name = "profile",
.args_type = "",
.params = "",
.help = "show profiling information",
- .mhandler.cmd = do_info_profile,
+ .mhandler.cmd = hmp_info_profile,
},
{
.name = "capture",
.args_type = "",
.params = "",
.help = "show capture information",
- .mhandler.cmd = do_info_capture,
+ .mhandler.cmd = hmp_info_capture,
},
{
.name = "snapshots",
.args_type = "",
.params = "",
.help = "show the currently saved VM snapshots",
- .mhandler.cmd = do_info_snapshots,
+ .mhandler.cmd = hmp_info_snapshots,
},
{
.name = "status",
@@ -2848,7 +2834,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show CPU statistics",
- .mhandler.cmd = do_info_cpu_stats,
+ .mhandler.cmd = hmp_info_cpustats,
},
#if defined(CONFIG_SLIRP)
{
@@ -2856,7 +2842,7 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show user network stack connection states",
- .mhandler.cmd = do_info_usernet,
+ .mhandler.cmd = hmp_info_usernet,
},
#endif
{
@@ -2892,28 +2878,28 @@ static mon_cmd_t info_cmds[] = {
.args_type = "",
.params = "",
.help = "show device tree",
- .mhandler.cmd = do_info_qtree,
+ .mhandler.cmd = hmp_info_qtree,
},
{
.name = "qdm",
.args_type = "",
.params = "",
.help = "show qdev device model list",
- .mhandler.cmd = do_info_qdm,
+ .mhandler.cmd = hmp_info_qdm,
},
{
.name = "roms",
.args_type = "",
.params = "",
.help = "show roms",
- .mhandler.cmd = do_info_roms,
+ .mhandler.cmd = hmp_info_roms,
},
{
.name = "trace-events",
.args_type = "",
.params = "",
.help = "show available trace-events & their state",
- .mhandler.cmd = do_trace_print_events,
+ .mhandler.cmd = hmp_info_trace_events,
},
{
.name = "tpm",