[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/28] runstate: Add runstate store
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 13/28] runstate: Add runstate store |
Date: |
Tue, 7 Jul 2015 15:08:54 +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 03/28] rdma typos, (continued)
- [Qemu-devel] [PULL 03/28] rdma typos, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 04/28] Store block name in local blocks structure, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 07/28] Allow rdma_delete_block to work without the hash, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 06/28] Rework ram_control_load_hook to hook during block load, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 08/28] Rework ram block hash, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 11/28] Fail more cleanly in mismatched RAM cases, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 10/28] Sanity check RDMA remote data, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 12/28] Fix older machine type compatibility on power with section footers, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 09/28] Sort destination RAMBlocks to be the same as the source, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 16/28] global_state: Make section optional, Juan Quintela, 2015/07/07
- [Qemu-devel] [PULL 13/28] runstate: Add runstate store,
Juan Quintela <=
- [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Juan Quintela, 2015/07/07
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Christian Borntraeger, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Dr. David Alan Gilbert, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Christian Borntraeger, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Christian Borntraeger, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Dr. David Alan Gilbert, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Christian Borntraeger, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Dr. David Alan Gilbert, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Juan Quintela, 2015/07/08
- Re: [Qemu-devel] [PULL 15/28] migration: create new section to store global state, Juan Quintela, 2015/07/08