@@ -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
@@ -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);
new file mode 100644
@@ -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;
+}
@@ -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);
@@ -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;