aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/nbd.c3
-rw-r--r--block/raw-posix.c6
-rw-r--r--block/raw-win32.c10
3 files changed, 4 insertions, 15 deletions
diff --git a/block/nbd.c b/block/nbd.c
index 47d4778999..7bac38d086 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -49,9 +49,6 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)
size_t blocksize;
int ret;
- if ((flags & BDRV_O_CREAT))
- return -EINVAL;
-
if (!strstart(filename, "nbd:", &host))
return -EINVAL;
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 52bbcdae76..325d2265f5 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -205,13 +205,9 @@ out_close:
static int raw_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVRawState *s = bs->opaque;
- int open_flags = 0;
s->type = FTYPE_FILE;
- if (flags & BDRV_O_CREAT)
- open_flags = O_CREAT | O_TRUNC;
-
- return raw_open_common(bs, filename, flags, open_flags);
+ return raw_open_common(bs, filename, flags, 0);
}
/* XXX: use host sector size if necessary with:
diff --git a/block/raw-win32.c b/block/raw-win32.c
index 01a6d2519e..526764f62f 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -76,7 +76,7 @@ static int set_sparse(int fd)
static int raw_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVRawState *s = bs->opaque;
- int access_flags, create_flags;
+ int access_flags;
DWORD overlapped;
s->type = FTYPE_FILE;
@@ -86,11 +86,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
} else {
access_flags = GENERIC_READ;
}
- if (flags & BDRV_O_CREAT) {
- create_flags = CREATE_ALWAYS;
- } else {
- create_flags = OPEN_EXISTING;
- }
+
overlapped = FILE_ATTRIBUTE_NORMAL;
if ((flags & BDRV_O_NOCACHE))
overlapped |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH;
@@ -98,7 +94,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
overlapped |= FILE_FLAG_WRITE_THROUGH;
s->hfile = CreateFile(filename, access_flags,
FILE_SHARE_READ, NULL,
- create_flags, overlapped, NULL);
+ OPEN_EXISTING, overlapped, NULL);
if (s->hfile == INVALID_HANDLE_VALUE) {
int err = GetLastError();