From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH 09/11] Introduce emulator state v2
Date: Fri, 8 Apr 2011 23:49:19 +0300 [thread overview]
Message-ID: <BANLkTimvvsPBmFRX1sK-13eyx8UeV8zmMA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4420 bytes --]
Move all state related to current VM to emulator-state.h. Move a few
migration related function declarations to migration.h.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
emulator-state.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
sysemu.h | 42 +-----------------------------------------
2 files changed, 53 insertions(+), 41 deletions(-)
create mode 100644 emulator-state.h
diff --git a/emulator-state.h b/emulator-state.h
new file mode 100644
index 0000000..4609382
--- /dev/null
+++ b/emulator-state.h
@@ -0,0 +1,52 @@
+#ifndef QEMU_EMULATOR_STATE_H
+#define QEMU_EMULATOR_STATE_H
+/*
+ * Emulator state: All state related to current VM. Usually not guest
+ * visible except for PV.
+ */
+
+#include "qdict.h"
+
+extern int vm_running;
+
+typedef struct vm_change_state_entry VMChangeStateEntry;
+typedef void VMChangeStateHandler(void *opaque, int running, int reason);
+
+VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
+ void *opaque);
+void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
+
+#define VMSTOP_USER 0
+#define VMSTOP_DEBUG 1
+#define VMSTOP_SHUTDOWN 2
+#define VMSTOP_DISKFULL 3
+#define VMSTOP_WATCHDOG 4
+#define VMSTOP_PANIC 5
+#define VMSTOP_SAVEVM 6
+#define VMSTOP_LOADVM 7
+#define VMSTOP_MIGRATE 8
+
+void vm_start(void);
+void vm_stop(int reason);
+
+void qemu_system_vmstop_request(int reason);
+
+void do_savevm(Monitor *mon, const QDict *qdict);
+int load_vmstate(const char *name);
+void do_delvm(Monitor *mon, const QDict *qdict);
+void do_info_snapshots(Monitor *mon);
+
+void qemu_announce_self(void);
+
+void main_loop_wait(int nonblocking);
+
+bool qemu_savevm_state_blocked(Monitor *mon);
+int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
+ int shared);
+int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
+int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
+void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
+int qemu_loadvm_state(QEMUFile *f);
+
+extern int autostart;
+#endif
diff --git a/sysemu.h b/sysemu.h
index 4bd1543..2d7a476 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -8,40 +8,18 @@
#include "qemu-timer.h"
#include "notify.h"
#include "host-state.h"
+#include "emulator-state.h"
/* vl.c */
extern const char *bios_name;
-
-extern int vm_running;
extern uint8_t qemu_uuid[];
int qemu_uuid_parse(const char *str, uint8_t *uuid);
#define UUID_FMT
"%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
-typedef struct vm_change_state_entry VMChangeStateEntry;
-typedef void VMChangeStateHandler(void *opaque, int running, int reason);
-
-VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
- void *opaque);
-void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
-
-#define VMSTOP_USER 0
-#define VMSTOP_DEBUG 1
-#define VMSTOP_SHUTDOWN 2
-#define VMSTOP_DISKFULL 3
-#define VMSTOP_WATCHDOG 4
-#define VMSTOP_PANIC 5
-#define VMSTOP_SAVEVM 6
-#define VMSTOP_LOADVM 7
-#define VMSTOP_MIGRATE 8
-
-void vm_start(void);
-void vm_stop(int reason);
-
void qemu_system_reset_request(void);
void qemu_system_shutdown_request(void);
void qemu_system_powerdown_request(void);
void qemu_system_debug_request(void);
-void qemu_system_vmstop_request(int reason);
int qemu_shutdown_requested(void);
int qemu_reset_requested(void);
int qemu_powerdown_requested(void);
@@ -50,24 +28,6 @@ void qemu_system_reset(void);
void qemu_add_machine_init_done_notifier(Notifier *notify);
-void do_savevm(Monitor *mon, const QDict *qdict);
-int load_vmstate(const char *name);
-void do_delvm(Monitor *mon, const QDict *qdict);
-void do_info_snapshots(Monitor *mon);
-
-void qemu_announce_self(void);
-
-void main_loop_wait(int nonblocking);
-
-bool qemu_savevm_state_blocked(Monitor *mon);
-int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
- int shared);
-int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
-int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
-void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
-int qemu_loadvm_state(QEMUFile *f);
-
-extern int autostart;
extern int bios_size;
typedef enum {
--
1.7.2.5
[-- Attachment #2: 0009-Introduce-emulator-state-v2.patch --]
[-- Type: text/x-diff, Size: 4901 bytes --]
From 1417eb555b3590b72750e934b47628f59d40c296 Mon Sep 17 00:00:00 2001
Message-Id: <1417eb555b3590b72750e934b47628f59d40c296.1302295418.git.blauwirbel@gmail.com>
In-Reply-To: <6a1748c587d34b0ce37488596c68c4aee58a4638.1302295418.git.blauwirbel@gmail.com>
References: <6a1748c587d34b0ce37488596c68c4aee58a4638.1302295418.git.blauwirbel@gmail.com>
From: Blue Swirl <blauwirbel@gmail.com>
Date: Sat, 26 Mar 2011 15:59:37 +0000
Subject: [PATCH 09/11] Introduce emulator state v2
Move all state related to current VM to emulator-state.h. Move a few
migration related function declarations to migration.h.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
emulator-state.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
sysemu.h | 42 +-----------------------------------------
2 files changed, 53 insertions(+), 41 deletions(-)
create mode 100644 emulator-state.h
diff --git a/emulator-state.h b/emulator-state.h
new file mode 100644
index 0000000..4609382
--- /dev/null
+++ b/emulator-state.h
@@ -0,0 +1,52 @@
+#ifndef QEMU_EMULATOR_STATE_H
+#define QEMU_EMULATOR_STATE_H
+/*
+ * Emulator state: All state related to current VM. Usually not guest
+ * visible except for PV.
+ */
+
+#include "qdict.h"
+
+extern int vm_running;
+
+typedef struct vm_change_state_entry VMChangeStateEntry;
+typedef void VMChangeStateHandler(void *opaque, int running, int reason);
+
+VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
+ void *opaque);
+void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
+
+#define VMSTOP_USER 0
+#define VMSTOP_DEBUG 1
+#define VMSTOP_SHUTDOWN 2
+#define VMSTOP_DISKFULL 3
+#define VMSTOP_WATCHDOG 4
+#define VMSTOP_PANIC 5
+#define VMSTOP_SAVEVM 6
+#define VMSTOP_LOADVM 7
+#define VMSTOP_MIGRATE 8
+
+void vm_start(void);
+void vm_stop(int reason);
+
+void qemu_system_vmstop_request(int reason);
+
+void do_savevm(Monitor *mon, const QDict *qdict);
+int load_vmstate(const char *name);
+void do_delvm(Monitor *mon, const QDict *qdict);
+void do_info_snapshots(Monitor *mon);
+
+void qemu_announce_self(void);
+
+void main_loop_wait(int nonblocking);
+
+bool qemu_savevm_state_blocked(Monitor *mon);
+int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
+ int shared);
+int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
+int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
+void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
+int qemu_loadvm_state(QEMUFile *f);
+
+extern int autostart;
+#endif
diff --git a/sysemu.h b/sysemu.h
index 4bd1543..2d7a476 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -8,40 +8,18 @@
#include "qemu-timer.h"
#include "notify.h"
#include "host-state.h"
+#include "emulator-state.h"
/* vl.c */
extern const char *bios_name;
-
-extern int vm_running;
extern uint8_t qemu_uuid[];
int qemu_uuid_parse(const char *str, uint8_t *uuid);
#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
-typedef struct vm_change_state_entry VMChangeStateEntry;
-typedef void VMChangeStateHandler(void *opaque, int running, int reason);
-
-VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
- void *opaque);
-void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
-
-#define VMSTOP_USER 0
-#define VMSTOP_DEBUG 1
-#define VMSTOP_SHUTDOWN 2
-#define VMSTOP_DISKFULL 3
-#define VMSTOP_WATCHDOG 4
-#define VMSTOP_PANIC 5
-#define VMSTOP_SAVEVM 6
-#define VMSTOP_LOADVM 7
-#define VMSTOP_MIGRATE 8
-
-void vm_start(void);
-void vm_stop(int reason);
-
void qemu_system_reset_request(void);
void qemu_system_shutdown_request(void);
void qemu_system_powerdown_request(void);
void qemu_system_debug_request(void);
-void qemu_system_vmstop_request(int reason);
int qemu_shutdown_requested(void);
int qemu_reset_requested(void);
int qemu_powerdown_requested(void);
@@ -50,24 +28,6 @@ void qemu_system_reset(void);
void qemu_add_machine_init_done_notifier(Notifier *notify);
-void do_savevm(Monitor *mon, const QDict *qdict);
-int load_vmstate(const char *name);
-void do_delvm(Monitor *mon, const QDict *qdict);
-void do_info_snapshots(Monitor *mon);
-
-void qemu_announce_self(void);
-
-void main_loop_wait(int nonblocking);
-
-bool qemu_savevm_state_blocked(Monitor *mon);
-int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
- int shared);
-int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
-int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
-void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
-int qemu_loadvm_state(QEMUFile *f);
-
-extern int autostart;
extern int bios_size;
typedef enum {
--
1.7.2.5
reply other threads:[~2011-04-08 20:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTimvvsPBmFRX1sK-13eyx8UeV8zmMA@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).