提交 414f0dab 编写于 作者: B blueswir1

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
上级 53c37487
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
#endif #endif
#include "block_int.h" #include "block_int.h"
#include <assert.h> #include <assert.h>
#ifdef CONFIG_AIO
#include <aio.h> #include <aio.h>
#endif
#ifdef CONFIG_COCOA #ifdef CONFIG_COCOA
#include <paths.h> #include <paths.h>
...@@ -418,6 +420,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset, ...@@ -418,6 +420,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
#endif #endif
#ifdef CONFIG_AIO
/***********************************************************/ /***********************************************************/
/* Unix AIO using POSIX AIO */ /* Unix AIO using POSIX AIO */
...@@ -688,6 +691,37 @@ static void raw_aio_cancel(BlockDriverAIOCB *blockacb) ...@@ -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) static void raw_close(BlockDriverState *bs)
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
...@@ -792,10 +826,12 @@ BlockDriver bdrv_raw = { ...@@ -792,10 +826,12 @@ BlockDriver bdrv_raw = {
raw_create, raw_create,
raw_flush, raw_flush,
#ifdef CONFIG_AIO
.bdrv_aio_read = raw_aio_read, .bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write, .bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel, .bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB), .aiocb_size = sizeof(RawAIOCB),
#endif
.protocol_name = "file", .protocol_name = "file",
.bdrv_pread = raw_pread, .bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite, .bdrv_pwrite = raw_pwrite,
...@@ -1144,10 +1180,12 @@ BlockDriver bdrv_host_device = { ...@@ -1144,10 +1180,12 @@ BlockDriver bdrv_host_device = {
NULL, NULL,
raw_flush, raw_flush,
#ifdef CONFIG_AIO
.bdrv_aio_read = raw_aio_read, .bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write, .bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel, .bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB), .aiocb_size = sizeof(RawAIOCB),
#endif
.bdrv_pread = raw_pread, .bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite, .bdrv_pwrite = raw_pwrite,
.bdrv_getlength = raw_getlength, .bdrv_getlength = raw_getlength,
......
...@@ -106,6 +106,7 @@ darwin_user="no" ...@@ -106,6 +106,7 @@ darwin_user="no"
build_docs="no" build_docs="no"
uname_release="" uname_release=""
curses="yes" curses="yes"
aio="yes"
nptl="yes" nptl="yes"
mixemu="no" mixemu="no"
...@@ -334,6 +335,8 @@ for opt do ...@@ -334,6 +335,8 @@ for opt do
;; ;;
--enable-mixemu) mixemu="yes" --enable-mixemu) mixemu="yes"
;; ;;
--disable-aio) aio="no"
;;
*) echo "ERROR: unknown option $opt"; show_help="yes" *) echo "ERROR: unknown option $opt"; show_help="yes"
;; ;;
esac esac
...@@ -436,6 +439,7 @@ echo " --fmod-inc path to FMOD includes" ...@@ -436,6 +439,7 @@ echo " --fmod-inc path to FMOD includes"
echo " --enable-uname-release=R Return R for uname -r in usermode emulation" echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
echo " --disable-vde disable support for vde network" echo " --disable-vde disable support for vde network"
echo " --disable-aio disable AIO support"
echo "" echo ""
echo "NOTE: The object files are built at the place where configure is launched" echo "NOTE: The object files are built at the place where configure is launched"
exit 1 exit 1
...@@ -863,6 +867,19 @@ EOF ...@@ -863,6 +867,19 @@ EOF
fi fi
fi # test "$curses" fi # test "$curses"
##########################################
# AIO probe
if test "$aio" = "yes" ; then
aio=no
cat > $TMPC << EOF
#include <aio.h>
int main(void) { return aio_write(NULL); }
EOF
if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
aio=yes
fi
fi
# Check if tools are available to build documentation. # Check if tools are available to build documentation.
if [ -x "`which texi2html 2>/dev/null`" ] && \ if [ -x "`which texi2html 2>/dev/null`" ] && \
[ -x "`which pod2man 2>/dev/null`" ]; then [ -x "`which pod2man 2>/dev/null`" ]; then
...@@ -934,6 +951,7 @@ echo "Documentation $build_docs" ...@@ -934,6 +951,7 @@ echo "Documentation $build_docs"
echo "uname -r $uname_release" echo "uname -r $uname_release"
echo "NPTL support $nptl" echo "NPTL support $nptl"
echo "vde support $vde" echo "vde support $vde"
echo "AIO support $aio"
if test $sdl_too_old = "yes"; then if test $sdl_too_old = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support" echo "-> Your SDL version is too old - please upgrade to have SDL support"
...@@ -1179,6 +1197,9 @@ if test "$brlapi" = "yes" ; then ...@@ -1179,6 +1197,9 @@ if test "$brlapi" = "yes" ; then
echo "#define CONFIG_BRLAPI 1" >> $config_h echo "#define CONFIG_BRLAPI 1" >> $config_h
echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
fi fi
if test "$aio" = "yes" ; then
echo "#define CONFIG_AIO 1" >> $config_h
fi
# XXX: suppress that # XXX: suppress that
if [ "$bsd" = "yes" ] ; then if [ "$bsd" = "yes" ] ; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册