aboutsummaryrefslogtreecommitdiff
path: root/block-raw-posix.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-15 18:20:52 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-15 18:20:52 +0000
commit414f0dab0970795f043f2396fe9449f69b49b20c (patch)
treedd27cdae1dad00f5a49e998401ab91161aa11877 /block-raw-posix.c
parent53c374879442751032608a488740686b794eb234 (diff)
Use AIO only if host supports it (based on OpenBSD patches by Todd T. Fries)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5010 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-raw-posix.c')
-rw-r--r--block-raw-posix.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 81382b5255..5c3b0ac2e7 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -28,7 +28,9 @@
#endif
#include "block_int.h"
#include <assert.h>
+#ifdef CONFIG_AIO
#include <aio.h>
+#endif
#ifdef CONFIG_COCOA
#include <paths.h>
@@ -418,6 +420,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
#endif
+#ifdef CONFIG_AIO
/***********************************************************/
/* Unix AIO using POSIX AIO */
@@ -688,6 +691,37 @@ static void raw_aio_cancel(BlockDriverAIOCB *blockacb)
}
}
+# else /* CONFIG_AIO */
+
+void qemu_aio_init(void)
+{
+}
+
+void qemu_aio_poll(void)
+{
+}
+
+void qemu_aio_flush(void)
+{
+}
+
+void qemu_aio_wait_start(void)
+{
+}
+
+void qemu_aio_wait(void)
+{
+#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
+ qemu_bh_poll();
+#endif
+}
+
+void qemu_aio_wait_end(void)
+{
+}
+
+#endif /* CONFIG_AIO */
+
static void raw_close(BlockDriverState *bs)
{
BDRVRawState *s = bs->opaque;
@@ -792,10 +826,12 @@ BlockDriver bdrv_raw = {
raw_create,
raw_flush,
+#ifdef CONFIG_AIO
.bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB),
+#endif
.protocol_name = "file",
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
@@ -1144,10 +1180,12 @@ BlockDriver bdrv_host_device = {
NULL,
raw_flush,
+#ifdef CONFIG_AIO
.bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB),
+#endif
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
.bdrv_getlength = raw_getlength,