From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44482 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PSBFv-0002Pn-LZ for qemu-devel@nongnu.org; Mon, 13 Dec 2010 11:28:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PSBFu-0006jH-0b for qemu-devel@nongnu.org; Mon, 13 Dec 2010 11:28:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PSBFt-0006iZ-Pm for qemu-devel@nongnu.org; Mon, 13 Dec 2010 11:28:05 -0500 From: Kevin Wolf Date: Mon, 13 Dec 2010 17:29:04 +0100 Message-Id: <1292257747-10665-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1292257747-10665-1-git-send-email-kwolf@redhat.com> References: <1292257747-10665-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 1/4] Make vm_stop available for block layer List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com blkqueue wants to stop the VM after an error has occurred, so we need to make vm_stop available in common code. It now returns a boolean that tells if the VM could be stopped, which is always true in qemu itself, and always false in the tools. Signed-off-by: Kevin Wolf --- cpus.c | 8 +++++--- qemu-common.h | 3 +++ qemu-tool.c | 5 +++++ sysemu.h | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index 91a0fb1..8ec0ed6 100644 --- a/cpus.c +++ b/cpus.c @@ -310,9 +310,10 @@ void qemu_notify_event(void) void qemu_mutex_lock_iothread(void) {} void qemu_mutex_unlock_iothread(void) {} -void vm_stop(int reason) +bool vm_stop(int reason) { do_vm_stop(reason); + return true; } #else /* CONFIG_IOTHREAD */ @@ -848,7 +849,7 @@ static void qemu_system_vmstop_request(int reason) qemu_notify_event(); } -void vm_stop(int reason) +bool vm_stop(int reason) { QemuThread me; qemu_thread_self(&me); @@ -863,9 +864,10 @@ void vm_stop(int reason) cpu_exit(cpu_single_env); cpu_single_env->stop = 1; } - return; + return true; } do_vm_stop(reason); + return true; } #endif diff --git a/qemu-common.h b/qemu-common.h index de82c2e..cb077a0 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -115,6 +115,9 @@ static inline char *realpath(const char *path, char *resolved_path) #endif /* !defined(NEED_CPU_H) */ +/* VM state */ +bool vm_stop(int reason); + /* bottom halves */ typedef void QEMUBHFunc(void *opaque); diff --git a/qemu-tool.c b/qemu-tool.c index 392e1c9..3926435 100644 --- a/qemu-tool.c +++ b/qemu-tool.c @@ -111,3 +111,8 @@ int qemu_set_fd_handler2(int fd, { return 0; } + +bool vm_stop(int reason) +{ + return false; +} diff --git a/sysemu.h b/sysemu.h index b81a70e..77788f1 100644 --- a/sysemu.h +++ b/sysemu.h @@ -38,7 +38,6 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); void vm_start(void); -void vm_stop(int reason); uint64_t ram_bytes_remaining(void); uint64_t ram_bytes_transferred(void); -- 1.7.2.3