[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC
From: |
Jamie Lokier |
Subject: |
Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC |
Date: |
Sun, 21 Jun 2009 00:30:05 +0100 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Christoph Hellwig wrote:
> On Fri, Jun 19, 2009 at 10:22:07PM -0400, m a wrote:
> > This patch replaces O_SYNC with O_FSYNC. These two flags do the same
> > thing, but only O_FSYNC is available in Mac OS 10.3 and under. It only
> > replaces O_SYNC if it doesn't exist. This patch allows the file
> > block-raw-posix.c to compile on Mac OS 10.3. This is my first time
> > submitting a patch, so there might have been a few mistakes made.
>
> But O_SYNC is a standard posix flag, while O_FSYNC appears to be
> a BSD extension. Also the actual code uses O_DSYNC anyway, which
> also is in Posix but not actually natively supported by some OSes,
> e.g. Linux (but still provided in libc there).
If O_FSYNC and O_SYNC do the same thing, and O_SYNC is used anywhere,
there's no harm in this for portability:
#if !defined(O_SYNC) && defined(O_FSYNC)
#define O_SYNC O_FSYNC
#endif
The patch assumes O_FSYNC is defined if O_SYNC isn't, which is wrong.
> > /* OS X does not have O_DSYNC */
> > #ifndef O_DSYNC
> > #define O_DSYNC O_SYNC
>
> So if the code here is correct and Darwin is the only supported OS where
> O_DSYNC is missing we could just replace the O_SYNC in the last line
> with O_FSYNC.
I agree, though the comment might be misleading, if there's another
supported OS without O_DSYNC.
-- Jamie
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, (continued)
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Avi Kivity, 2009/06/20
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Jamie Lokier, 2009/06/20
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Andreas Färber, 2009/06/21
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Jamie Lokier, 2009/06/24
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Andreas Färber, 2009/06/24
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Filip Navara, 2009/06/24
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Jamie Lokier, 2009/06/24
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Anthony Liguori, 2009/06/20
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Avi Kivity, 2009/06/21
Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, Christoph Hellwig, 2009/06/20
- Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC,
Jamie Lokier <=
Re: [Qemu-devel] [PATCH] replace O_SYNC with O_FSYNC, G 3, 2009/06/20