Monitor: Make mon_set_cpu() public

Also rename it to monitor_set_cpu().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Luiz Capitulino 2011-10-06 14:02:57 -03:00
parent 791e7c820e
commit b025c8b4ab
2 changed files with 6 additions and 6 deletions

View File

@ -514,7 +514,6 @@ static int do_qmp_capabilities(Monitor *mon, const QDict *params,
return 0; return 0;
} }
static int mon_set_cpu(int cpu_index);
static void handle_user_command(Monitor *mon, const char *cmdline); static void handle_user_command(Monitor *mon, const char *cmdline);
static int do_hmp_passthrough(Monitor *mon, const QDict *params, static int do_hmp_passthrough(Monitor *mon, const QDict *params,
@ -532,7 +531,7 @@ static int do_hmp_passthrough(Monitor *mon, const QDict *params,
cur_mon = &hmp; cur_mon = &hmp;
if (qdict_haskey(params, "cpu-index")) { if (qdict_haskey(params, "cpu-index")) {
ret = mon_set_cpu(qdict_get_int(params, "cpu-index")); ret = monitor_set_cpu(qdict_get_int(params, "cpu-index"));
if (ret < 0) { if (ret < 0) {
cur_mon = old_mon; cur_mon = old_mon;
qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU number"); qerror_report(QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU number");
@ -772,8 +771,8 @@ CommandInfoList *qmp_query_commands(Error **errp)
return cmd_list; return cmd_list;
} }
/* get the current CPU defined by the user */ /* set the current CPU defined by the user */
static int mon_set_cpu(int cpu_index) int monitor_set_cpu(int cpu_index)
{ {
CPUState *env; CPUState *env;
@ -789,7 +788,7 @@ static int mon_set_cpu(int cpu_index)
static CPUState *mon_get_cpu(void) static CPUState *mon_get_cpu(void)
{ {
if (!cur_mon->mon_cpu) { if (!cur_mon->mon_cpu) {
mon_set_cpu(0); monitor_set_cpu(0);
} }
cpu_synchronize_state(cur_mon->mon_cpu); cpu_synchronize_state(cur_mon->mon_cpu);
return cur_mon->mon_cpu; return cur_mon->mon_cpu;
@ -901,7 +900,7 @@ static void do_info_cpus(Monitor *mon, QObject **ret_data)
static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data) static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
{ {
int index = qdict_get_int(qdict, "index"); int index = qdict_get_int(qdict, "index");
if (mon_set_cpu(index) < 0) { if (monitor_set_cpu(index) < 0) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "index", qerror_report(QERR_INVALID_PARAMETER_VALUE, "index",
"a CPU number"); "a CPU number");
return -1; return -1;

View File

@ -57,6 +57,7 @@ void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
void monitor_print_filename(Monitor *mon, const char *filename); void monitor_print_filename(Monitor *mon, const char *filename);
void monitor_flush(Monitor *mon); void monitor_flush(Monitor *mon);
int monitor_set_cpu(int cpu_index);
typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);