From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1Iwl-0002CQ-CI for qemu-devel@nongnu.org; Tue, 24 Nov 2015 14:08:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1Iwg-0006wx-DF for qemu-devel@nongnu.org; Tue, 24 Nov 2015 14:08:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1Iwg-0006wt-5k for qemu-devel@nongnu.org; Tue, 24 Nov 2015 14:08:06 -0500 References: <1448382858-28616-1-git-send-email-marcandre.lureau@redhat.com> <56549B2E.6070205@redhat.com> <1705571877.16594173.1448387560812.JavaMail.zimbra@redhat.com> From: Eric Blake Message-ID: <5654B590.8000908@redhat.com> Date: Tue, 24 Nov 2015 12:08:00 -0700 MIME-Version: 1.0 In-Reply-To: <1705571877.16594173.1448387560812.JavaMail.zimbra@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ts4a2mLje3if87VKkbEa6MFuQgOVPvxmK" Subject: Re: [Qemu-devel] [PATCH 1/2] qga: flush implicitely when needed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= Cc: marcandre lureau , qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Ts4a2mLje3if87VKkbEa6MFuQgOVPvxmK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/24/2015 10:52 AM, Marc-Andr=C3=A9 Lureau wrote: > Hi >=20 > ----- Original Message ----- >> On 11/24/2015 09:34 AM, marcandre.lureau@redhat.com wrote: >>> From: Marc-Andr=C3=A9 Lureau >> >> In the subject: s/implicitely/implicitly/ if you are fixing the typo, = or >> s/implicitely/explicitly/ if you are trying to make it match what the >> patch actually does. >> >=20 > ok, I'll switch to explicitely (it depends on the point of view, I was = commenting from the qga API user pov, but I get your point) I was trying to point out not only the 2 points of view, but also the typo (it's explicitly, not explicitely) :) >>> fh =3D gfh->fh; >>> + >>> + if (!gfh->writing) { >>> + int ret =3D fseek(fh, 0, SEEK_CUR); >> >> Seems a bit odd to use fflush() in one place and fseek() in the other,= >> but the net result is the same either way. >=20 > "and input is not directly followed by output without an intervening ca= ll to a file positioning function, unless the input operation encounters = end-of-file." >=20 > so I tried to follow what the spec said. POSIX currently specifies the behavior of fflush() on seekable input files, but did not always do so; and it has been a source of bugs on several libc implementations (it is still undefined to use fflush() on a non-seekable file, but I don't know if anyone is using qga guest-file-* on non-seekable files, at least in a situation where they are both reading and writing to the same file handle). So on further thought, I actually prefer avoiding fflush() after input when possible, to avoid confusing older libc, and as a result, your asymmetry is probably the best choice after all. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Ts4a2mLje3if87VKkbEa6MFuQgOVPvxmK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWVLWQAAoJEKeha0olJ0NqiBkH/32kYcgJXjKN9Q1GX/FkD4jO g50V5kTFH7jcCn75KRJnlOsAobD1lOm002Zk+5wExE1FaF4O/Fh6ZkBV5clb8mPQ /ltqdKVxd5OA/ekMRqphxcdDXc3RRvJYMu8izOIQf679FUmhG0hjx+/Bt29unoKG +JSaDGk5Pa3+crNPlh/dfcmGYG+n+TBgPhd0gC+yH0Y/o3c6Q7AbRuOWXofWRB3S d2TkKywlNvqP9qDE7c02p3vxqrgZaEHjO/n6D/wO1RmS/BO3WC2vnbxc2F82Ecoq 4aXp64V8dlTQNzxpM1rpOjZAAkmn9LicLggzSjPvtnifc2i3dTfaO1eeWs8cqWs= =KN7i -----END PGP SIGNATURE----- --Ts4a2mLje3if87VKkbEa6MFuQgOVPvxmK--