|
From: | G 3 |
Subject: | [Qemu-devel] [PATCH] Substitute O_DSYNC with O_SYNC or O_FSYNC when needed. |
Date: | Wed, 1 Jul 2009 13:28:32 -0400 |
On Jul 1, 2009, at 9:54 AM, Christoph Hellwig wrote:
On Fri, Jun 26, 2009 at 03:02:47PM -0400, G 3 wrote:/* OS X does not have O_DSYNC */ #ifndef O_DSYNC #ifdef O_SYNC /* Works on Mac OS 10.4 and greater */ #define O_DSYNC O_SYNC #elif defined(O_FSYNC) /* Works on Mac OS 10.3 and under */ #define O_DSYNC O_FSYNC #else /* If no substitute is available */ #define O_DSYNC 0 #endif #endifThis still does the NULL sync which can cause silent data loss if no O_*SYNC is available. If you want to be safe and support either O_SYNC or O_FSYNC as O_DSYNC replacement the following should be enough: /** MacOS X does not have O_DSYNC, and in earlier version no O_SYNC either.*/ #ifndef O_DSYNC #ifdef O_SYNC #define O_DSYNC O_SYNC #else #define O_DSYNC O_FSYNC #endif #endif
This patch should be what you want. commit b32354139556d1a807d04aa54ed82610e0f4507a Author: John Arbuckle <address@hidden> Date: Wed Jul 1 13:24:37 2009 -0400 Substitute O_DSYNC with O_SYNC or O_FSYNC when needed. Signed-off-by: John Arbuckle <address@hidden> diff --git a/block/raw-posix.c b/block/raw-posix.c index 8b1e67c..17338ee 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -81,7 +81,11 @@ /* OS X does not have O_DSYNC */ #ifndef O_DSYNC +#ifdef O_SYNC #define O_DSYNC O_SYNC +#elif defined(O_FSYNC) +#define O_DSYNC O_FSYNC +#endif #endif
[Prev in Thread] | Current Thread | [Next in Thread] |