|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] [PATCH 2/7] Replace VMSTOP macros with a proper QemuState type |
Date: | Thu, 04 Aug 2011 12:55:24 +0300 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc15 Thunderbird/3.1.11 |
On 08/03/2011 06:17 PM, Luiz Capitulino wrote:
@@ -9,6 +9,20 @@ #include "notify.h" /* vl.c */ + +typedef enum { + QSTATE_DEBUG, /* qemu is running under gdb */ + QSTATE_INTERROR, /* paused due to an internal error */ + QSTATE_IOERROR, /* paused due to an I/O error */ + QSTATE_PAUSED, /* paused by the user (ie. the 'stop' command) */ + QSTATE_PREMIGRATE, /* paused preparing to finish migrate */ + QSTATE_RESTVM, /* paused restoring the VM state */ + QSTATE_RUNNING, /* qemu is running */ + QSTATE_SAVEVM, /* paused saving VM state */ + QSTATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */ + QSTATE_WATCHDOG /* watchdog fired and qemu is configured to pause */ +} QemuState; + extern const char *bios_name;
Why "QemuState"? In general, "qemu" can be inferred from the fact that we're in qemu.git. Suggest "RunState".
Second, these states can coexist. A user may pause the VM simultaneously with the watchdog firing or entering premigrate state. In fact, with multiple monitors, each monitor can pause and resume the vm independently.
So I think we should keep a reference count instead of just a start/stop state. Perhaps
vm_stop(QemuState s) { ++stopcount[s]; } vm_is_stopped() { for (s in states) if (stopcount[s]) return true; return false; } -- error compiling committee.c: too many arguments to function
[Prev in Thread] | Current Thread | [Next in Thread] |