Signed-off-by: Ian Jackson <address@hidden>
---
block-raw-posix.c | 14 +++++++-------
qemu-common.h | 5 +++++
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 94928c0..ef1c993 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu-common.h"
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#ifdef QEMU_ASYNC_EVENTLOOP
#include "qemu-char.h"
#include "qemu_socket.h"
#include "qemu-timer.h"
@@ -447,7 +447,7 @@ static int aio_sig_pipe[2];
static void aio_signal_handler(int signum)
{
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#ifdef QEMU_ASYNC_EVENTLOOP
int e;
e = errno;
write(aio_sig_pipe[1],"",1); /* ignore errors as they should be EAGAIN */
@@ -465,7 +465,7 @@ static void aio_signal_handler(int signum)
#endif
}
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#ifdef QEMU_ASYNC_EVENTLOOP
static void qemu_aio_sig_pipe_read(void *opaque_ignored) {
qemu_aio_poll();
}
@@ -481,7 +481,7 @@ void qemu_aio_init(void)
fcntl(aio_sig_pipe[0], F_SETFL, O_NONBLOCK);
fcntl(aio_sig_pipe[1], F_SETFL, O_NONBLOCK);
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#ifdef QEMU_ASYNC_EVENTLOOP
ret = qemu_set_fd_handler2(aio_sig_pipe[0], NULL,
qemu_aio_sig_pipe_read, NULL, NULL);
if (ret) {
@@ -581,7 +581,7 @@ void qemu_aio_wait(void)
{
fd_set check;
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#ifdef QEMU_ASYNC_EVENTLOOP
if (qemu_bh_poll())
return;
#endif
@@ -622,7 +622,7 @@ static RawAIOCB *raw_aio_setup(BlockDriverState *bs,
return acb;
}
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#ifdef QEMU_ASYNC_EVENTLOOP
static void raw_aio_em_cb(void* opaque)
{
RawAIOCB *acb = opaque;
@@ -744,7 +744,7 @@ void qemu_aio_wait_start(void)
void qemu_aio_wait(void)
{
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#ifdef QEMU_ASYNC_EVENTLOOP
qemu_bh_poll();
#endif
}
diff --git a/qemu-common.h b/qemu-common.h
index 23d1444..04c38fd 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -49,6 +49,11 @@ static inline char *realpath(const char *path, char
*resolved_path)
#define PRIo64 "I64o"
#endif
+#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+# define QEMU_ASYNC_EVENTLOOP
+ /* The standalone utilities do not use or support asynchronous IO */
+#endif
+
/* FIXME: Remove NEED_CPU_H. */
#ifndef NEED_CPU_H