提交 0461d5a6 编写于 作者: L Luiz Capitulino

RunState: Rename enum values as generated by the QAPI

Next commit will convert the query-status command to use the
RunState type as generated by the QAPI.

In order to "transparently" replace the current enum by the QAPI
one, we have to make some changes to some enum values.

As the changes are simple renames, I'll do them in one shot. The
changes are:

 - Rename the prefix from RSTATE_ to RUN_STATE_
 - RUN_STATE_SAVEVM to RUN_STATE_SAVE_VM
 - RUN_STATE_IN_MIGRATE to RUN_STATE_INMIGRATE
 - RUN_STATE_PANICKED to RUN_STATE_INTERNAL_ERROR
 - RUN_STATE_POST_MIGRATE to RUN_STATE_POSTMIGRATE
 - RUN_STATE_PRE_LAUNCH to RUN_STATE_PRELAUNCH
 - RUN_STATE_PRE_MIGRATE to RUN_STATE_PREMIGRATE
 - RUN_STATE_RESTORE to RUN_STATE_RESTORE_VM
 - RUN_STATE_PRE_MIGRATE to RUN_STATE_FINISH_MIGRATE
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 c4d11e38
...@@ -2385,7 +2385,7 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state) ...@@ -2385,7 +2385,7 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state)
return; return;
} }
switch (state) { switch (state) {
case RSTATE_DEBUG: case RUN_STATE_DEBUG:
if (env->watchpoint_hit) { if (env->watchpoint_hit) {
switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) { switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) {
case BP_MEM_READ: case BP_MEM_READ:
...@@ -2408,25 +2408,25 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state) ...@@ -2408,25 +2408,25 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state)
tb_flush(env); tb_flush(env);
ret = GDB_SIGNAL_TRAP; ret = GDB_SIGNAL_TRAP;
break; break;
case RSTATE_PAUSED: case RUN_STATE_PAUSED:
ret = GDB_SIGNAL_INT; ret = GDB_SIGNAL_INT;
break; break;
case RSTATE_SHUTDOWN: case RUN_STATE_SHUTDOWN:
ret = GDB_SIGNAL_QUIT; ret = GDB_SIGNAL_QUIT;
break; break;
case RSTATE_IO_ERROR: case RUN_STATE_IO_ERROR:
ret = GDB_SIGNAL_IO; ret = GDB_SIGNAL_IO;
break; break;
case RSTATE_WATCHDOG: case RUN_STATE_WATCHDOG:
ret = GDB_SIGNAL_ALRM; ret = GDB_SIGNAL_ALRM;
break; break;
case RSTATE_PANICKED: case RUN_STATE_INTERNAL_ERROR:
ret = GDB_SIGNAL_ABRT; ret = GDB_SIGNAL_ABRT;
break; break;
case RSTATE_SAVEVM: case RUN_STATE_SAVE_VM:
case RSTATE_RESTORE: case RUN_STATE_RESTORE_VM:
return; return;
case RSTATE_PRE_MIGRATE: case RUN_STATE_FINISH_MIGRATE:
ret = GDB_SIGNAL_XCPU; ret = GDB_SIGNAL_XCPU;
break; break;
default: default:
...@@ -2463,7 +2463,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) ...@@ -2463,7 +2463,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
gdb_current_syscall_cb = cb; gdb_current_syscall_cb = cb;
s->state = RS_SYSCALL; s->state = RS_SYSCALL;
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
vm_stop(RSTATE_DEBUG); vm_stop(RUN_STATE_DEBUG);
#endif #endif
s->state = RS_IDLE; s->state = RS_IDLE;
va_start(va, fmt); va_start(va, fmt);
...@@ -2537,7 +2537,7 @@ static void gdb_read_byte(GDBState *s, int ch) ...@@ -2537,7 +2537,7 @@ static void gdb_read_byte(GDBState *s, int ch)
if (runstate_is_running()) { if (runstate_is_running()) {
/* when the CPU is running, we cannot do anything except stop /* when the CPU is running, we cannot do anything except stop
it when receiving a char */ it when receiving a char */
vm_stop(RSTATE_PAUSED); vm_stop(RUN_STATE_PAUSED);
} else } else
#endif #endif
{ {
...@@ -2799,7 +2799,7 @@ static void gdb_chr_event(void *opaque, int event) ...@@ -2799,7 +2799,7 @@ static void gdb_chr_event(void *opaque, int event)
{ {
switch (event) { switch (event) {
case CHR_EVENT_OPENED: case CHR_EVENT_OPENED:
vm_stop(RSTATE_PAUSED); vm_stop(RUN_STATE_PAUSED);
gdb_has_xml = 0; gdb_has_xml = 0;
break; break;
default: default:
...@@ -2840,7 +2840,7 @@ static int gdb_monitor_write(CharDriverState *chr, const uint8_t *buf, int len) ...@@ -2840,7 +2840,7 @@ static int gdb_monitor_write(CharDriverState *chr, const uint8_t *buf, int len)
static void gdb_sigterm_handler(int signal) static void gdb_sigterm_handler(int signal)
{ {
if (runstate_is_running()) { if (runstate_is_running()) {
vm_stop(RSTATE_PAUSED); vm_stop(RUN_STATE_PAUSED);
} }
} }
#endif #endif
......
...@@ -527,7 +527,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op) ...@@ -527,7 +527,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
s->bus->dma->ops->set_unit(s->bus->dma, s->unit); s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
s->bus->error_status = op; s->bus->error_status = op;
bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read); bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
vm_stop(RSTATE_IO_ERROR); vm_stop(RUN_STATE_IO_ERROR);
} else { } else {
if (op & BM_STATUS_DMA_RETRY) { if (op & BM_STATUS_DMA_RETRY) {
dma_buf_commit(s, 0); dma_buf_commit(s, 0);
......
...@@ -227,7 +227,7 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type) ...@@ -227,7 +227,7 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type)
r->status |= SCSI_REQ_STATUS_RETRY | type; r->status |= SCSI_REQ_STATUS_RETRY | type;
bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read); bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
vm_stop(RSTATE_IO_ERROR); vm_stop(RUN_STATE_IO_ERROR);
} else { } else {
switch (error) { switch (error) {
case ENOMEM: case ENOMEM:
......
...@@ -77,7 +77,7 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, ...@@ -77,7 +77,7 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
req->next = s->rq; req->next = s->rq;
s->rq = req; s->rq = req;
bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read); bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
vm_stop(RSTATE_IO_ERROR); vm_stop(RUN_STATE_IO_ERROR);
} else { } else {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
bdrv_acct_done(s->bs, &req->acct); bdrv_acct_done(s->bs, &req->acct);
......
...@@ -132,7 +132,7 @@ void watchdog_perform_action(void) ...@@ -132,7 +132,7 @@ void watchdog_perform_action(void)
case WDT_PAUSE: /* same as 'stop' command in monitor */ case WDT_PAUSE: /* same as 'stop' command in monitor */
watchdog_mon_event("pause"); watchdog_mon_event("pause");
vm_stop(RSTATE_WATCHDOG); vm_stop(RUN_STATE_WATCHDOG);
break; break;
case WDT_DEBUG: case WDT_DEBUG:
......
...@@ -1014,7 +1014,7 @@ int kvm_cpu_exec(CPUState *env) ...@@ -1014,7 +1014,7 @@ int kvm_cpu_exec(CPUState *env)
if (ret < 0) { if (ret < 0) {
cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE); cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE);
vm_stop(RSTATE_PANICKED); vm_stop(RUN_STATE_INTERNAL_ERROR);
} }
env->exit_request = 0; env->exit_request = 0;
......
...@@ -73,7 +73,7 @@ void process_incoming_migration(QEMUFile *f) ...@@ -73,7 +73,7 @@ void process_incoming_migration(QEMUFile *f)
if (autostart) { if (autostart) {
vm_start(); vm_start();
} else { } else {
runstate_set(RSTATE_PRE_LAUNCH); runstate_set(RUN_STATE_PRELAUNCH);
} }
} }
...@@ -375,7 +375,7 @@ void migrate_fd_put_ready(void *opaque) ...@@ -375,7 +375,7 @@ void migrate_fd_put_ready(void *opaque)
int old_vm_running = runstate_is_running(); int old_vm_running = runstate_is_running();
DPRINTF("done iterating\n"); DPRINTF("done iterating\n");
vm_stop(RSTATE_PRE_MIGRATE); vm_stop(RUN_STATE_FINISH_MIGRATE);
if ((qemu_savevm_state_complete(s->mon, s->file)) < 0) { if ((qemu_savevm_state_complete(s->mon, s->file)) < 0) {
if (old_vm_running) { if (old_vm_running) {
...@@ -392,7 +392,7 @@ void migrate_fd_put_ready(void *opaque) ...@@ -392,7 +392,7 @@ void migrate_fd_put_ready(void *opaque)
state = MIG_STATE_ERROR; state = MIG_STATE_ERROR;
} }
if (state == MIG_STATE_COMPLETED) { if (state == MIG_STATE_COMPLETED) {
runstate_set(RSTATE_POST_MIGRATE); runstate_set(RUN_STATE_POSTMIGRATE);
} }
s->state = state; s->state = state;
notifier_list_notify(&migration_state_notifiers, NULL); notifier_list_notify(&migration_state_notifiers, NULL);
......
...@@ -1248,7 +1248,7 @@ static void do_singlestep(Monitor *mon, const QDict *qdict) ...@@ -1248,7 +1248,7 @@ static void do_singlestep(Monitor *mon, const QDict *qdict)
*/ */
static int do_stop(Monitor *mon, const QDict *qdict, QObject **ret_data) static int do_stop(Monitor *mon, const QDict *qdict, QObject **ret_data)
{ {
vm_stop(RSTATE_PAUSED); vm_stop(RUN_STATE_PAUSED);
return 0; return 0;
} }
...@@ -1266,11 +1266,11 @@ static int do_cont(Monitor *mon, const QDict *qdict, QObject **ret_data) ...@@ -1266,11 +1266,11 @@ static int do_cont(Monitor *mon, const QDict *qdict, QObject **ret_data)
{ {
struct bdrv_iterate_context context = { mon, 0 }; struct bdrv_iterate_context context = { mon, 0 };
if (runstate_check(RSTATE_IN_MIGRATE)) { if (runstate_check(RUN_STATE_INMIGRATE)) {
qerror_report(QERR_MIGRATION_EXPECTED); qerror_report(QERR_MIGRATION_EXPECTED);
return -1; return -1;
} else if (runstate_check(RSTATE_PANICKED) || } else if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
runstate_check(RSTATE_SHUTDOWN)) { runstate_check(RUN_STATE_SHUTDOWN)) {
qerror_report(QERR_RESET_REQUIRED); qerror_report(QERR_RESET_REQUIRED);
return -1; return -1;
} }
...@@ -2773,7 +2773,7 @@ static void do_loadvm(Monitor *mon, const QDict *qdict) ...@@ -2773,7 +2773,7 @@ static void do_loadvm(Monitor *mon, const QDict *qdict)
int saved_vm_running = runstate_is_running(); int saved_vm_running = runstate_is_running();
const char *name = qdict_get_str(qdict, "name"); const char *name = qdict_get_str(qdict, "name");
vm_stop(RSTATE_RESTORE); vm_stop(RUN_STATE_RESTORE_VM);
if (load_vmstate(name) == 0 && saved_vm_running) { if (load_vmstate(name) == 0 && saved_vm_running) {
vm_start(); vm_start();
......
...@@ -1603,7 +1603,7 @@ static int qemu_savevm_state(Monitor *mon, QEMUFile *f) ...@@ -1603,7 +1603,7 @@ static int qemu_savevm_state(Monitor *mon, QEMUFile *f)
int ret; int ret;
saved_vm_running = runstate_is_running(); saved_vm_running = runstate_is_running();
vm_stop(RSTATE_SAVEVM); vm_stop(RUN_STATE_SAVE_VM);
if (qemu_savevm_state_blocked(mon)) { if (qemu_savevm_state_blocked(mon)) {
ret = -EINVAL; ret = -EINVAL;
...@@ -1932,7 +1932,7 @@ void do_savevm(Monitor *mon, const QDict *qdict) ...@@ -1932,7 +1932,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
} }
saved_vm_running = runstate_is_running(); saved_vm_running = runstate_is_running();
vm_stop(RSTATE_SAVEVM); vm_stop(RUN_STATE_SAVE_VM);
memset(sn, 0, sizeof(*sn)); memset(sn, 0, sizeof(*sn));
......
...@@ -11,20 +11,20 @@ ...@@ -11,20 +11,20 @@
/* vl.c */ /* vl.c */
typedef enum { typedef enum {
RSTATE_DEBUG, /* qemu is running under gdb */ RUN_STATE_DEBUG, /* qemu is running under gdb */
RSTATE_IN_MIGRATE, /* paused waiting for an incoming migration */ RUN_STATE_INMIGRATE, /* paused waiting for an incoming migration */
RSTATE_PANICKED, /* paused due to an internal error */ RUN_STATE_INTERNAL_ERROR, /* paused due to an internal error */
RSTATE_IO_ERROR, /* paused due to an I/O error */ RUN_STATE_IO_ERROR, /* paused due to an I/O error */
RSTATE_PAUSED, /* paused by the user (ie. the 'stop' command) */ RUN_STATE_PAUSED, /* paused by the user (ie. the 'stop' command) */
RSTATE_POST_MIGRATE, /* paused following a successful migration */ RUN_STATE_POSTMIGRATE, /* paused following a successful migration */
RSTATE_PRE_LAUNCH, /* qemu was started with -S and haven't started */ RUN_STATE_PRELAUNCH, /* qemu was started with -S and haven't started */
RSTATE_PRE_MIGRATE, /* paused preparing to finish migrate */ RUN_STATE_FINISH_MIGRATE, /* paused preparing to finish migrate */
RSTATE_RESTORE, /* paused restoring the VM state */ RUN_STATE_RESTORE_VM, /* paused restoring the VM state */
RSTATE_RUNNING, /* qemu is running */ RUN_STATE_RUNNING, /* qemu is running */
RSTATE_SAVEVM, /* paused saving VM state */ RUN_STATE_SAVE_VM, /* paused saving VM state */
RSTATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */ RUN_STATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */
RSTATE_WATCHDOG, /* watchdog fired and qemu is configured to pause */ RUN_STATE_WATCHDOG, /* watchdog fired and qemu is configured to pause */
RSTATE_MAX RUN_STATE_MAX
} RunState; } RunState;
extern const char *bios_name; extern const char *bios_name;
......
...@@ -323,7 +323,7 @@ static int default_driver_check(QemuOpts *opts, void *opaque) ...@@ -323,7 +323,7 @@ static int default_driver_check(QemuOpts *opts, void *opaque)
/***********************************************************/ /***********************************************************/
/* QEMU state */ /* QEMU state */
static RunState current_run_state = RSTATE_PRE_LAUNCH; static RunState current_run_state = RUN_STATE_PRELAUNCH;
typedef struct { typedef struct {
RunState from; RunState from;
...@@ -332,63 +332,63 @@ typedef struct { ...@@ -332,63 +332,63 @@ typedef struct {
static const RunStateTransition runstate_transitions_def[] = { static const RunStateTransition runstate_transitions_def[] = {
/* from -> to */ /* from -> to */
{ RSTATE_DEBUG, RSTATE_RUNNING }, { RUN_STATE_DEBUG, RUN_STATE_RUNNING },
{ RSTATE_IN_MIGRATE, RSTATE_RUNNING }, { RUN_STATE_INMIGRATE, RUN_STATE_RUNNING },
{ RSTATE_IN_MIGRATE, RSTATE_PRE_LAUNCH }, { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH },
{ RSTATE_PANICKED, RSTATE_PAUSED }, { RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED },
{ RSTATE_IO_ERROR, RSTATE_RUNNING }, { RUN_STATE_IO_ERROR, RUN_STATE_RUNNING },
{ RSTATE_PAUSED, RSTATE_RUNNING }, { RUN_STATE_PAUSED, RUN_STATE_RUNNING },
{ RSTATE_POST_MIGRATE, RSTATE_RUNNING }, { RUN_STATE_POSTMIGRATE, RUN_STATE_RUNNING },
{ RSTATE_PRE_LAUNCH, RSTATE_RUNNING }, { RUN_STATE_PRELAUNCH, RUN_STATE_RUNNING },
{ RSTATE_PRE_LAUNCH, RSTATE_IN_MIGRATE }, { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
{ RSTATE_PRE_LAUNCH, RSTATE_POST_MIGRATE }, { RUN_STATE_PRELAUNCH, RUN_STATE_POSTMIGRATE },
{ RSTATE_PRE_MIGRATE, RSTATE_RUNNING }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_RUNNING },
{ RSTATE_PRE_MIGRATE, RSTATE_POST_MIGRATE }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_POSTMIGRATE },
{ RSTATE_RESTORE, RSTATE_RUNNING }, { RUN_STATE_RESTORE_VM, RUN_STATE_RUNNING },
{ RSTATE_RUNNING, RSTATE_DEBUG }, { RUN_STATE_RUNNING, RUN_STATE_DEBUG },
{ RSTATE_RUNNING, RSTATE_PANICKED }, { RUN_STATE_RUNNING, RUN_STATE_INTERNAL_ERROR },
{ RSTATE_RUNNING, RSTATE_IO_ERROR }, { RUN_STATE_RUNNING, RUN_STATE_IO_ERROR },
{ RSTATE_RUNNING, RSTATE_PAUSED }, { RUN_STATE_RUNNING, RUN_STATE_PAUSED },
{ RSTATE_RUNNING, RSTATE_PRE_MIGRATE }, { RUN_STATE_RUNNING, RUN_STATE_FINISH_MIGRATE },
{ RSTATE_RUNNING, RSTATE_RESTORE }, { RUN_STATE_RUNNING, RUN_STATE_RESTORE_VM },
{ RSTATE_RUNNING, RSTATE_SAVEVM }, { RUN_STATE_RUNNING, RUN_STATE_SAVE_VM },
{ RSTATE_RUNNING, RSTATE_SHUTDOWN }, { RUN_STATE_RUNNING, RUN_STATE_SHUTDOWN },
{ RSTATE_RUNNING, RSTATE_WATCHDOG }, { RUN_STATE_RUNNING, RUN_STATE_WATCHDOG },
{ RSTATE_SAVEVM, RSTATE_RUNNING }, { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING },
{ RSTATE_SHUTDOWN, RSTATE_PAUSED }, { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED },
{ RSTATE_WATCHDOG, RSTATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING },
{ RSTATE_MAX, RSTATE_MAX }, { RUN_STATE_MAX, RUN_STATE_MAX },
}; };
static bool runstate_valid_transitions[RSTATE_MAX][RSTATE_MAX]; static bool runstate_valid_transitions[RUN_STATE_MAX][RUN_STATE_MAX];
static const char *const runstate_name_tbl[RSTATE_MAX] = { static const char *const runstate_name_tbl[RUN_STATE_MAX] = {
[RSTATE_DEBUG] = "debug", [RUN_STATE_DEBUG] = "debug",
[RSTATE_IN_MIGRATE] = "incoming-migration", [RUN_STATE_INMIGRATE] = "incoming-migration",
[RSTATE_PANICKED] = "internal-error", [RUN_STATE_INTERNAL_ERROR] = "internal-error",
[RSTATE_IO_ERROR] = "io-error", [RUN_STATE_IO_ERROR] = "io-error",
[RSTATE_PAUSED] = "paused", [RUN_STATE_PAUSED] = "paused",
[RSTATE_POST_MIGRATE] = "post-migrate", [RUN_STATE_POSTMIGRATE] = "post-migrate",
[RSTATE_PRE_LAUNCH] = "prelaunch", [RUN_STATE_PRELAUNCH] = "prelaunch",
[RSTATE_PRE_MIGRATE] = "finish-migrate", [RUN_STATE_FINISH_MIGRATE] = "finish-migrate",
[RSTATE_RESTORE] = "restore-vm", [RUN_STATE_RESTORE_VM] = "restore-vm",
[RSTATE_RUNNING] = "running", [RUN_STATE_RUNNING] = "running",
[RSTATE_SAVEVM] = "save-vm", [RUN_STATE_SAVE_VM] = "save-vm",
[RSTATE_SHUTDOWN] = "shutdown", [RUN_STATE_SHUTDOWN] = "shutdown",
[RSTATE_WATCHDOG] = "watchdog", [RUN_STATE_WATCHDOG] = "watchdog",
}; };
bool runstate_check(RunState state) bool runstate_check(RunState state)
...@@ -402,7 +402,7 @@ void runstate_init(void) ...@@ -402,7 +402,7 @@ void runstate_init(void)
memset(&runstate_valid_transitions, 0, sizeof(runstate_valid_transitions)); memset(&runstate_valid_transitions, 0, sizeof(runstate_valid_transitions));
for (p = &runstate_transitions_def[0]; p->from != RSTATE_MAX; p++) { for (p = &runstate_transitions_def[0]; p->from != RUN_STATE_MAX; p++) {
runstate_valid_transitions[p->from][p->to] = true; runstate_valid_transitions[p->from][p->to] = true;
} }
} }
...@@ -410,7 +410,7 @@ void runstate_init(void) ...@@ -410,7 +410,7 @@ void runstate_init(void)
/* This function will abort() on invalid state transitions */ /* This function will abort() on invalid state transitions */
void runstate_set(RunState new_state) void runstate_set(RunState new_state)
{ {
if (new_state >= RSTATE_MAX || if (new_state >= RUN_STATE_MAX ||
!runstate_valid_transitions[current_run_state][new_state]) { !runstate_valid_transitions[current_run_state][new_state]) {
fprintf(stderr, "invalid runstate transition\n"); fprintf(stderr, "invalid runstate transition\n");
abort(); abort();
...@@ -421,13 +421,13 @@ void runstate_set(RunState new_state) ...@@ -421,13 +421,13 @@ void runstate_set(RunState new_state)
const char *runstate_as_string(void) const char *runstate_as_string(void)
{ {
assert(current_run_state < RSTATE_MAX); assert(current_run_state < RUN_STATE_MAX);
return runstate_name_tbl[current_run_state]; return runstate_name_tbl[current_run_state];
} }
int runstate_is_running(void) int runstate_is_running(void)
{ {
return runstate_check(RSTATE_RUNNING); return runstate_check(RUN_STATE_RUNNING);
} }
/***********************************************************/ /***********************************************************/
...@@ -1268,8 +1268,8 @@ void vm_start(void) ...@@ -1268,8 +1268,8 @@ void vm_start(void)
{ {
if (!runstate_is_running()) { if (!runstate_is_running()) {
cpu_enable_ticks(); cpu_enable_ticks();
runstate_set(RSTATE_RUNNING); runstate_set(RUN_STATE_RUNNING);
vm_state_notify(1, RSTATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING);
resume_all_vcpus(); resume_all_vcpus();
monitor_protocol_event(QEVENT_RESUME, NULL); monitor_protocol_event(QEVENT_RESUME, NULL);
} }
...@@ -1290,7 +1290,7 @@ static int shutdown_requested, shutdown_signal = -1; ...@@ -1290,7 +1290,7 @@ static int shutdown_requested, shutdown_signal = -1;
static pid_t shutdown_pid; static pid_t shutdown_pid;
static int powerdown_requested; static int powerdown_requested;
static int debug_requested; static int debug_requested;
static RunState vmstop_requested = RSTATE_MAX; static RunState vmstop_requested = RUN_STATE_MAX;
int qemu_shutdown_requested_get(void) int qemu_shutdown_requested_get(void)
{ {
...@@ -1346,12 +1346,12 @@ static int qemu_debug_requested(void) ...@@ -1346,12 +1346,12 @@ static int qemu_debug_requested(void)
return r; return r;
} }
/* We use RSTATE_MAX but any invalid value will do */ /* We use RUN_STATE_MAX but any invalid value will do */
static bool qemu_vmstop_requested(RunState *r) static bool qemu_vmstop_requested(RunState *r)
{ {
if (vmstop_requested < RSTATE_MAX) { if (vmstop_requested < RUN_STATE_MAX) {
*r = vmstop_requested; *r = vmstop_requested;
vmstop_requested = RSTATE_MAX; vmstop_requested = RUN_STATE_MAX;
return true; return true;
} }
...@@ -1583,13 +1583,13 @@ static void main_loop(void) ...@@ -1583,13 +1583,13 @@ static void main_loop(void)
#endif #endif
if (qemu_debug_requested()) { if (qemu_debug_requested()) {
vm_stop(RSTATE_DEBUG); vm_stop(RUN_STATE_DEBUG);
} }
if (qemu_shutdown_requested()) { if (qemu_shutdown_requested()) {
qemu_kill_report(); qemu_kill_report();
monitor_protocol_event(QEVENT_SHUTDOWN, NULL); monitor_protocol_event(QEVENT_SHUTDOWN, NULL);
if (no_shutdown) { if (no_shutdown) {
vm_stop(RSTATE_SHUTDOWN); vm_stop(RUN_STATE_SHUTDOWN);
} else } else
break; break;
} }
...@@ -1598,9 +1598,9 @@ static void main_loop(void) ...@@ -1598,9 +1598,9 @@ static void main_loop(void)
cpu_synchronize_all_states(); cpu_synchronize_all_states();
qemu_system_reset(VMRESET_REPORT); qemu_system_reset(VMRESET_REPORT);
resume_all_vcpus(); resume_all_vcpus();
if (runstate_check(RSTATE_PANICKED) || if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
runstate_check(RSTATE_SHUTDOWN)) { runstate_check(RUN_STATE_SHUTDOWN)) {
runstate_set(RSTATE_PAUSED); runstate_set(RUN_STATE_PAUSED);
} }
} }
if (qemu_powerdown_requested()) { if (qemu_powerdown_requested()) {
...@@ -3557,7 +3557,7 @@ int main(int argc, char **argv, char **envp) ...@@ -3557,7 +3557,7 @@ int main(int argc, char **argv, char **envp)
} }
if (incoming) { if (incoming) {
runstate_set(RSTATE_IN_MIGRATE); runstate_set(RUN_STATE_INMIGRATE);
int ret = qemu_start_incoming_migration(incoming); int ret = qemu_start_incoming_migration(incoming);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "Migration failed. Exit code %s(%d), exiting.\n", fprintf(stderr, "Migration failed. Exit code %s(%d), exiting.\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册