[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/26] runstate: Add runstate store
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 15/26] runstate: Add runstate store |
Date: |
Wed, 1 Jul 2015 12:39:39 +0200 |
This allows us to store the current state to send it through migration.
Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
---
include/sysemu/sysemu.h | 1 +
vl.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index df80951..44570d1 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -28,6 +28,7 @@ bool runstate_check(RunState state);
void runstate_set(RunState new_state);
int runstate_is_running(void);
bool runstate_needs_reset(void);
+bool runstate_store(char *str, size_t size);
typedef struct vm_change_state_entry VMChangeStateEntry;
typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
diff --git a/vl.c b/vl.c
index 69ad90c..fec7e93 100644
--- a/vl.c
+++ b/vl.c
@@ -634,6 +634,18 @@ bool runstate_check(RunState state)
return current_run_state == state;
}
+bool runstate_store(char *str, size_t size)
+{
+ const char *state = RunState_lookup[current_run_state];
+ size_t len = strlen(state) + 1;
+
+ if (len > size) {
+ return false;
+ }
+ memcpy(str, state, len);
+ return true;
+}
+
static void runstate_init(void)
{
const RunStateTransition *p;
--
2.4.3
- [Qemu-devel] [PULL 04/26] Only try and read a VMDescription if it should be there, (continued)
- [Qemu-devel] [PULL 04/26] Only try and read a VMDescription if it should be there, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 06/26] Store block name in local blocks structure, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 07/26] Translate offsets to destination address space, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 05/26] rdma typos, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 09/26] Allow rdma_delete_block to work without the hash, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 08/26] Rework ram_control_load_hook to hook during block load, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 11/26] Sort destination RAMBlocks to be the same as the source, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 12/26] Sanity check RDMA remote data, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 10/26] Rework ram block hash, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 14/26] Fix older machine type compatibility on power with section footers, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 15/26] runstate: Add runstate store,
Juan Quintela <=
- [Qemu-devel] [PULL 16/26] runstate: migration allows more transitions now, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 13/26] Fail more cleanly in mismatched RAM cases, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 17/26] migration: create new section to store global state, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 18/26] global_state: Make section optional, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 20/26] migration: Add configuration section, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 21/26] migration: Use cmpxchg correctly, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 19/26] vmstate: Create optional sections, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 22/26] migration: ensure we start in NONE state, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 23/26] migration: Use always helper to set state, Juan Quintela, 2015/07/01
- [Qemu-devel] [PULL 25/26] migration: create migration event, Juan Quintela, 2015/07/01