From patchwork Fri Apr 8 20:49:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 90417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AA5A71007D1 for ; Sat, 9 Apr 2011 06:55:53 +1000 (EST) Received: from localhost ([127.0.0.1]:53267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8IhA-0004wX-0U for incoming@patchwork.ozlabs.org; Fri, 08 Apr 2011 16:54:20 -0400 Received: from [140.186.70.92] (port=60038 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8Ich-0003RH-HC for qemu-devel@nongnu.org; Fri, 08 Apr 2011 16:49:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8Ice-0000rS-9h for qemu-devel@nongnu.org; Fri, 08 Apr 2011 16:49:43 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:61461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8Ice-0000qw-2A for qemu-devel@nongnu.org; Fri, 08 Apr 2011 16:49:40 -0400 Received: by vws17 with SMTP id 17so3462580vws.4 for ; Fri, 08 Apr 2011 13:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=WtWerp/lMHp4rZSiKHHy9JU1xOuXYD0Pq7qpIhE29+k=; b=fyZ53O7Ce2RHbaTNlCLkx9ugiNCbe3sUFDvhMGYTOtS17rDL3EFtiEZFx6xQMdLHy0 WB2TS3Q8WFetKPV3XzeBaON2vWhiir/2ZfSf4dagysllwwWlE7J1N56SGfCJ37srcBSX VsNh7pzxWfKeyOc0X0/ChvJBHo8Lk9n33o5VM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=imGsVvM3aqYIZTIgMCsy0hTe1AaclHvJx3vvS6LknkyHjGtnnicO7lUHoZMT7DkOAQ TWQx+zQ5PhwWyCldQHfncrTOe4SM+qlrOKjCK2PXRlBbICYcSqRltzZWpRbCeOnh3QeQ p7F7EgKlgoxBzhS2Eq3u6SKCCO2Y6JguSe32I= Received: by 10.220.98.21 with SMTP id o21mr728016vcn.259.1302295779235; Fri, 08 Apr 2011 13:49:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.178.70 with HTTP; Fri, 8 Apr 2011 13:49:19 -0700 (PDT) From: Blue Swirl Date: Fri, 8 Apr 2011 23:49:19 +0300 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.45 Subject: [Qemu-devel] [PATCH 09/11] Introduce emulator state v2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- emulator-state.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sysemu.h | 42 +----------------------------------------- 2 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 emulator-state.h 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 { 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 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 --- 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