[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 44/50] multi-process/mig: refactor runstate_check into common
From: |
Jagannathan Raman |
Subject: |
[PATCH v5 44/50] multi-process/mig: refactor runstate_check into common file |
Date: |
Mon, 24 Feb 2020 15:55:35 -0500 |
From: Elena Ufimtseva <address@hidden>
runstate_check file is refactored into vl-parse.c
Signed-off-by: Elena Ufimtseva <address@hidden>
Signed-off-by: John G Johnson <address@hidden>
Signed-off-by: Jagannathan Raman <address@hidden>
---
Makefile.objs | 2 ++
include/sysemu/runstate.h | 2 ++
runstate.c | 36 ++++++++++++++++++++++++++++++++++++
softmmu/vl.c | 10 ----------
stubs/runstate-check.c | 3 +++
5 files changed, 43 insertions(+), 10 deletions(-)
create mode 100644 runstate.c
diff --git a/Makefile.objs b/Makefile.objs
index 65009da..cf2200d 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -40,6 +40,7 @@ remote-pci-obj-$(CONFIG_MPQEMU) += blockdev.o
remote-pci-obj-$(CONFIG_MPQEMU) += qdev-monitor.o
remote-pci-obj-$(CONFIG_MPQEMU) += bootdevice.o
remote-pci-obj-$(CONFIG_MPQEMU) += iothread.o
+remote-pci-obj-$(CONFIG_MPQEMU) += runstate.o
##############################################################
# remote-lsi-obj-y is code used to implement remote LSI device
@@ -103,6 +104,7 @@ qemu-seccomp.o-libs := $(SECCOMP_LIBS)
common-obj-$(CONFIG_FDT) += device_tree.o
common-obj-y += vl-parse.o
+common-obj-y += runstate.o
#######################################################################
# qapi
diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index f760094..ece939f 100644
--- a/include/sysemu/runstate.h
+++ b/include/sysemu/runstate.h
@@ -4,6 +4,8 @@
#include "qapi/qapi-types-run-state.h"
#include "qemu/notify.h"
+extern RunState current_run_state;
+
bool runstate_check(RunState state);
void runstate_set(RunState new_state);
int runstate_is_running(void);
diff --git a/runstate.c b/runstate.c
new file mode 100644
index 0000000..273345a
--- /dev/null
+++ b/runstate.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "sysemu/runstate.h"
+
+/***********************************************************/
+/* QEMU state */
+
+RunState current_run_state = RUN_STATE_PRECONFIG;
+
+bool runstate_check(RunState state)
+{
+ return current_run_state == state;
+}
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 42d5682..d95ee2f 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -620,11 +620,6 @@ static int default_driver_check(void *opaque, QemuOpts
*opts, Error **errp)
return 0;
}
-/***********************************************************/
-/* QEMU state */
-
-static RunState current_run_state = RUN_STATE_PRECONFIG;
-
/* We use RUN_STATE__MAX but any invalid value will do */
static RunState vmstop_requested = RUN_STATE__MAX;
static QemuMutex vmstop_lock;
@@ -732,11 +727,6 @@ static const RunStateTransition runstate_transitions_def[]
= {
static bool runstate_valid_transitions[RUN_STATE__MAX][RUN_STATE__MAX];
-bool runstate_check(RunState state)
-{
- return current_run_state == state;
-}
-
bool runstate_store(char *str, size_t size)
{
const char *state = RunState_str(current_run_state);
diff --git a/stubs/runstate-check.c b/stubs/runstate-check.c
index 2ccda2b..3038bcb 100644
--- a/stubs/runstate-check.c
+++ b/stubs/runstate-check.c
@@ -1,6 +1,9 @@
#include "qemu/osdep.h"
#include "sysemu/runstate.h"
+
+#pragma weak runstate_check
+
bool runstate_check(RunState state)
{
return state == RUN_STATE_PRELAUNCH;
--
1.8.3.1
- [PATCH v5 46/50] multi-process/mig: Restore the VMSD in remote process, (continued)
- [PATCH v5 46/50] multi-process/mig: Restore the VMSD in remote process, Jagannathan Raman, 2020/02/24
- [PATCH v5 39/50] multi-process: prevent duplicate memory initialization in remote, Jagannathan Raman, 2020/02/24
- [PATCH v5 48/50] multi-process: Validate incoming commands from Proxy, Jagannathan Raman, 2020/02/24
- [PATCH v5 41/50] multi-process/mig: Enable VMSD save in the Proxy object, Jagannathan Raman, 2020/02/24
- [PATCH v5 50/50] multi-process: add configure and usage information, Jagannathan Raman, 2020/02/24
- [PATCH v5 40/50] multi-process/mig: build migration module in the remote process, Jagannathan Raman, 2020/02/24
- [PATCH v5 44/50] multi-process/mig: refactor runstate_check into common file,
Jagannathan Raman <=
- [PATCH v5 47/50] multi-process: Enable support for multiple devices in remote, Jagannathan Raman, 2020/02/24
- [PATCH v5 49/50] multi-process: add the concept description to docs/devel/qemu-multiprocess, Jagannathan Raman, 2020/02/24
- [PATCH v5 04/50] multi-process: Add stub functions to facilate build of multi-process, Jagannathan Raman, 2020/02/24
- Re: [PATCH v5 00/50] Initial support for multi-process qemu, no-reply, 2020/02/24
- Re: [PATCH v5 00/50] Initial support for multi-process qemu, no-reply, 2020/02/24
- Re: [PATCH v5 00/50] Initial support for multi-process qemu, no-reply, 2020/02/24