summaryrefslogtreecommitdiff
path: root/block-raw-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'block-raw-posix.c')
-rw-r--r--block-raw-posix.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 089a1f4a99..8ace5ef746 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -106,6 +106,10 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
}
if (flags & BDRV_O_CREAT)
open_flags |= O_CREAT | O_TRUNC;
+#ifdef O_DIRECT
+ if (flags & BDRV_O_DIRECT)
+ open_flags |= O_DIRECT;
+#endif
s->type = FTYPE_FILE;
@@ -659,6 +663,10 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
open_flags |= O_RDONLY;
bs->read_only = 1;
}
+#ifdef O_DIRECT
+ if (flags & BDRV_O_DIRECT)
+ open_flags |= O_DIRECT;
+#endif
s->type = FTYPE_FILE;
#if defined(__linux__)