[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v4 PATCH 44/49] multi-process/mig: refactor runstate_check into com
From: |
Jagannathan Raman |
Subject: |
[RFC v4 PATCH 44/49] multi-process/mig: refactor runstate_check into common file |
Date: |
Thu, 24 Oct 2019 05:09:25 -0400 |
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>
---
New patch in v4
Makefile.objs | 2 ++
include/sysemu/runstate.h | 2 ++
runstate.c | 36 ++++++++++++++++++++++++++++++++++++
stubs/runstate-check.c | 3 +++
vl-parse.c | 1 -
vl.c | 10 ----------
6 files changed, 43 insertions(+), 11 deletions(-)
create mode 100644 runstate.c
diff --git a/Makefile.objs b/Makefile.objs
index ebb1938..66fbee0 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -38,6 +38,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
@@ -111,6 +112,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
remote-pci-obj-$(CONFIG_MPQEMU) += net/
diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index 0b41555..e89ebf8 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/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;
diff --git a/vl-parse.c b/vl-parse.c
index 1c8ecbe..3bf1f0f 100644
--- a/vl-parse.c
+++ b/vl-parse.c
@@ -159,4 +159,3 @@ int rdevice_init_func(void *opaque, QemuOpts *opts, Error
**errp)
return 0;
}
#endif
-
diff --git a/vl.c b/vl.c
index 8a26d81..725429b 100644
--- a/vl.c
+++ b/vl.c
@@ -665,11 +665,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;
@@ -777,11 +772,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);
--
1.8.3.1
- [RFC v4 PATCH 32/49] multi-process: Use separate MMIO communication channel, (continued)
- [RFC v4 PATCH 32/49] multi-process: Use separate MMIO communication channel, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 34/49] multi-process/mon: choose HMP commands based on target, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 35/49] multi-process/mon: stub functions to enable QMP module for remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 36/49] multi-process/mon: enable QMP module support in the remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 38/49] multi-process/mon: Initialize QMP module for remote processes, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 37/49] multi-process/mon: Refactor monitor/chardev functions out of vl.c, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 39/49] multi-process: prevent duplicate memory initialization in remote, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 40/49] multi-process/mig: build migration module in the remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 41/49] multi-process/mig: Enable VMSD save in the Proxy object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 42/49] multi-process/mig: Send VMSD of remote to the Proxy object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 44/49] multi-process/mig: refactor runstate_check into common file,
Jagannathan Raman <=
- [RFC v4 PATCH 45/49] multi-process/mig: Synchronize runstate of remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 47/49] multi-process: Enable support for multiple devices in remote, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 08/49] multi-process: add functions to synchronize proxy and remote endpoints, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 07/49] multi-process: define mpqemu-link object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 49/49] multi-process: add configure and usage information, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 48/49] multi-process: add the concept description to docs/devel/qemu-multiprocess, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 12/49] multi-process: remote process initialization, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 17/49] multi-process: Synchronize remote memory, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 25/49] multi-process: Introduce build flags to separate remote process code, Jagannathan Raman, 2019/10/24