From: Kirk Allan <kallan@suse.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Kirk Allan <kallan@suse.com>,
mdroth@linux.vnet.ibm.com, qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH v2] qga: fix append file open modes for win32
Date: Tue, 10 Nov 2015 16:19:11 -0700 [thread overview]
Message-ID: <1447197551-15869-1-git-send-email-kallan@suse.com> (raw)
For append file open modes, use FILE_APPEND_DATA for the desired access
for writing at the end of the file.
Version 2:
For "a+", "ab+", and "a+b" modes use FILE_APPEND_DATA|GENERIC_READ.
ORing in GENERIC_READ starts a read at the begining of the file. All
writes will append to the end fo the file.
Added white space to maintain the alignment of the guest_file_open_modes[].
Signed-off-by: Kirk Allan <kallan@suse.com>
---
qga/commands-win32.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index a5306e7..5a75c3d 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -66,20 +66,20 @@ typedef struct OpenFlags {
DWORD creation_disposition;
} OpenFlags;
static OpenFlags guest_file_open_modes[] = {
- {"r", GENERIC_READ, OPEN_EXISTING},
- {"rb", GENERIC_READ, OPEN_EXISTING},
- {"w", GENERIC_WRITE, CREATE_ALWAYS},
- {"wb", GENERIC_WRITE, CREATE_ALWAYS},
- {"a", GENERIC_WRITE, OPEN_ALWAYS },
- {"r+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
- {"rb+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
- {"r+b", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
- {"w+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
- {"wb+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
- {"w+b", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
- {"a+", GENERIC_WRITE|GENERIC_READ, OPEN_ALWAYS },
- {"ab+", GENERIC_WRITE|GENERIC_READ, OPEN_ALWAYS },
- {"a+b", GENERIC_WRITE|GENERIC_READ, OPEN_ALWAYS }
+ {"r", GENERIC_READ, OPEN_EXISTING},
+ {"rb", GENERIC_READ, OPEN_EXISTING},
+ {"w", GENERIC_WRITE, CREATE_ALWAYS},
+ {"wb", GENERIC_WRITE, CREATE_ALWAYS},
+ {"a", FILE_APPEND_DATA, OPEN_ALWAYS },
+ {"r+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
+ {"rb+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
+ {"r+b", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
+ {"w+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
+ {"wb+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
+ {"w+b", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
+ {"a+", FILE_APPEND_DATA|GENERIC_READ, OPEN_ALWAYS },
+ {"ab+", FILE_APPEND_DATA|GENERIC_READ, OPEN_ALWAYS },
+ {"a+b", FILE_APPEND_DATA|GENERIC_READ, OPEN_ALWAYS }
};
static OpenFlags *find_open_flag(const char *mode_str)
--
1.8.5.6
next reply other threads:[~2015-11-10 23:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-10 23:19 Kirk Allan [this message]
2015-11-11 16:23 ` [Qemu-devel] [PATCH v2] qga: fix append file open modes for win32 Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447197551-15869-1-git-send-email-kallan@suse.com \
--to=kallan@suse.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).