All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <mlureau@redhat.com>
Cc: marcandre lureau <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] qga: flush implicitely when needed
Date: Tue, 24 Nov 2015 12:08:00 -0700	[thread overview]
Message-ID: <5654B590.8000908@redhat.com> (raw)
In-Reply-To: <1705571877.16594173.1448387560812.JavaMail.zimbra@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1813 bytes --]

On 11/24/2015 10:52 AM, Marc-André Lureau wrote:
> Hi
> 
> ----- Original Message -----
>> On 11/24/2015 09:34 AM, marcandre.lureau@redhat.com wrote:
>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> 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.
>>
> 
> 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 = gfh->fh;
>>> +
>>> +    if (!gfh->writing) {
>>> +        int ret = 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.
> 
> "and input is not directly followed by output without an intervening call to a file positioning function, unless the input operation encounters end-of-file."
> 
> 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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2015-11-24 19:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24 16:34 [Qemu-devel] [PATCH 1/2] qga: flush implicitely when needed marcandre.lureau
2015-11-24 16:34 ` [Qemu-devel] [PATCH 2/2] tests: add file-write-read test marcandre.lureau
2015-11-24 17:29   ` Eric Blake
2015-11-24 17:58     ` Marc-André Lureau
2015-11-24 18:44       ` Eric Blake
2015-11-24 17:15 ` [Qemu-devel] [PATCH 1/2] qga: flush implicitely when needed Eric Blake
2015-11-24 17:52   ` Marc-André Lureau
2015-11-24 19:08     ` Eric Blake [this message]

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=5654B590.8000908@redhat.com \
    --to=eblake@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mlureau@redhat.com \
    --cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.