From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwYB8-0007qH-JV for qemu-devel@nongnu.org; Wed, 11 Nov 2015 11:23:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwYB5-0002qp-BV for qemu-devel@nongnu.org; Wed, 11 Nov 2015 11:23:22 -0500 Received: from e36.co.us.ibm.com ([32.97.110.154]:57053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwYB5-0002qT-4L for qemu-devel@nongnu.org; Wed, 11 Nov 2015 11:23:19 -0500 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Nov 2015 09:23:18 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1447197551-15869-1-git-send-email-kallan@suse.com> References: <1447197551-15869-1-git-send-email-kallan@suse.com> Message-ID: <20151111162307.31702.26296@loki> Date: Wed, 11 Nov 2015 10:23:07 -0600 Subject: Re: [Qemu-devel] [PATCH v2] qga: fix append file open modes for win32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kirk Allan , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, qemu-stable@nongnu.org Quoting Kirk Allan (2015-11-10 17:19:11) > 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 Thanks, applied to qga tree with changes discussed in v1 thread: https://github.com/mdroth/qemu/commits/qga > --- > 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[] =3D { > - {"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 >=20