Revision 9a2d77ad block/raw-win32.c
b/block/raw-win32.c | ||
---|---|---|
76 | 76 |
static int raw_open(BlockDriverState *bs, const char *filename, int flags) |
77 | 77 |
{ |
78 | 78 |
BDRVRawState *s = bs->opaque; |
79 |
int access_flags, create_flags;
|
|
79 |
int access_flags; |
|
80 | 80 |
DWORD overlapped; |
81 | 81 |
|
82 | 82 |
s->type = FTYPE_FILE; |
... | ... | |
86 | 86 |
} else { |
87 | 87 |
access_flags = GENERIC_READ; |
88 | 88 |
} |
89 |
if (flags & BDRV_O_CREAT) { |
|
90 |
create_flags = CREATE_ALWAYS; |
|
91 |
} else { |
|
92 |
create_flags = OPEN_EXISTING; |
|
93 |
} |
|
89 |
|
|
94 | 90 |
overlapped = FILE_ATTRIBUTE_NORMAL; |
95 | 91 |
if ((flags & BDRV_O_NOCACHE)) |
96 | 92 |
overlapped |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH; |
... | ... | |
98 | 94 |
overlapped |= FILE_FLAG_WRITE_THROUGH; |
99 | 95 |
s->hfile = CreateFile(filename, access_flags, |
100 | 96 |
FILE_SHARE_READ, NULL, |
101 |
create_flags, overlapped, NULL);
|
|
97 |
OPEN_EXISTING, overlapped, NULL);
|
|
102 | 98 |
if (s->hfile == INVALID_HANDLE_VALUE) { |
103 | 99 |
int err = GetLastError(); |
104 | 100 |
|
Also available in: Unified diff