Introduce emulator state v2
PATCH 9/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.
--- emulator-state.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sysemu.h | 42 +----------------------------------------- 2 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 emulator-state.h
emulator-state.h new file +52 -0
@@ -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
sysemu.h +1 -2
@@ -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 {
Signature · 1 line
1.7.2.5
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 <[email protected]>
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.
--- emulator-state.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sysemu.h | 42 +----------------------------------------- 2 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 emulator-state.h
emulator-state.h new file +52 -0
52 lines not on this page · raw message
sysemu.h +1 -41
65 lines not on this page · raw message
Signature · 1 line
1.7.2.5