<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From b551ad1ad2a2cfecf2f0d33b65e0c57a08140646 Mon Sep 17 00:00:00 2001
From: Kevin Wolf &lt;kwolf@redhat.com&gt;
Date: Tue, 14 Feb 2012 11:13:49 +0100
Subject: [PATCH 24/99] tools: Use real async.c instead of stubs

RH-Author: Kevin Wolf &lt;kwolf@redhat.com&gt;
Message-id: &lt;1329218101-24213-25-git-send-email-kwolf@redhat.com&gt;
Patchwork-id: 37215
O-Subject: [RHEL-6.3 qemu-kvm PATCH v2 24/96] tools: Use real async.c instead of stubs
Bugzilla: 783950
RH-Acked-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
RH-Acked-by: Marcelo Tosatti &lt;mtosatti@redhat.com&gt;
RH-Acked-by: Laszlo Ersek &lt;lersek@redhat.com&gt;

Bugzilla: 783950

It's wrong to call BHs directly, even in tools. The only operations that
schedule BHs are called in a loop that (indirectly) contains a call to
qemu_bh_poll anyway, so we're not losing the scheduled BHs: Tools either use
synchronous functions, which are guaranteed to have completed (including any
BHs) when they return; or if they use asynchronous functions, they need to call
qemu_aio_wait() or similar functions already today.

Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@linux.vnet.ibm.com&gt;
(cherry picked from commit 4e59b545868a5ee5f59b346337f0c44209929334)

Conflicts:

	Makefile.objs
	qemu-tool.c

Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
---
 Makefile.objs   |    2 +-
 Makefile.target |    2 +-
 qemu-tool.c     |   47 ++++-------------------------------------------
 3 files changed, 6 insertions(+), 45 deletions(-)

Signed-off-by: Michal Novotny &lt;minovotn@redhat.com&gt;
---
 Makefile.objs   |    2 +-
 Makefile.target |    2 +-
 qemu-tool.c     |   47 ++++-------------------------------------------
 3 files changed, 6 insertions(+), 45 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index 5fcfc72..f05a23a 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -7,7 +7,7 @@ qobject-obj-y += qerror.o
 #######################################################################
 # block-obj-y is code used by both qemu system emulation and qemu-img
 
-block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
+block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o async.o
 block-obj-y += nbd.o block.o aio.o aes.o osdep.o qemu-config.o qemu-progress.o
 block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
 block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
diff --git a/Makefile.target b/Makefile.target
index 50996f5..939334c 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -201,7 +201,7 @@ endif #CONFIG_BSD_USER
 # System emulator target
 ifdef CONFIG_SOFTMMU
 
-obj-y = vl.o async.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o balloon.o
+obj-y = vl.o monitor.o pci.o pci_host.o pcie_host.o machine.o gdbstub.o balloon.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
diff --git a/qemu-tool.c b/qemu-tool.c
index 4516675..e205cb7 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -56,19 +56,6 @@ void monitor_print_filename(Monitor *mon, const char *filename)
 {
 }
 
-void async_context_push(void)
-{
-}
-
-void async_context_pop(void)
-{
-}
-
-int get_async_context_id(void)
-{
-    return 0;
-}
-
 void monitor_protocol_event(MonitorEvent event, QObject *data)
 {
 }
@@ -91,36 +78,6 @@ void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
 {
 }
 
-QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
-{
-    QEMUBH *bh;
-
-    bh = qemu_malloc(sizeof(*bh));
-    bh-&gt;cb = cb;
-    bh-&gt;opaque = opaque;
-
-    return bh;
-}
-
-int qemu_bh_poll(void)
-{
-    return 0;
-}
-
-void qemu_bh_schedule(QEMUBH *bh)
-{
-    bh-&gt;cb(bh-&gt;opaque);
-}
-
-void qemu_bh_cancel(QEMUBH *bh)
-{
-}
-
-void qemu_bh_delete(QEMUBH *bh)
-{
-    qemu_free(bh);
-}
-
 int qemu_set_fd_handler2(int fd,
                          IOCanRWHandler *fd_read_poll,
                          IOHandler *fd_read,
@@ -145,3 +102,7 @@ int64_t get_clock(void)
 {
 	return 0;
 }
+
+void qemu_notify_event(void)
+{
+}
-- 
1.7.7.5

</pre></body></html>