[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] improved patch from block-raw-posix.c
From: |
Christoph Hellwig |
Subject: |
Re: [Qemu-devel] [PATCH] improved patch from block-raw-posix.c |
Date: |
Mon, 22 Jun 2009 23:13:52 +0200 |
User-agent: |
Mutt/1.3.28i |
On Sun, Jun 21, 2009 at 07:55:43PM -0400, G 3 wrote:
> +/* O_SYNC isn't available on Mac OS 10.3 and under */
> +/* O_SYNC and O_FSYNC do the same thing */
> +#ifndef O_SYNC
> + #ifdef O_FSYNC
> + #define O_SYNC O_FSYNC
> + #else
> + #define O_SYNC 0
> + #endif
> +#endif
Please don't indent these cpp statements, it makes the code look
really ugly. Also I don't think just defining O_SYNC away is good,
if something doesn't have either of the O_*SYNC compilation should fail
so we can find a workaround to provide data integrity.
Personally I'd just go for the simple one below:
--
Subject: raw-posix: deal with old MacOS versions that don't have O_SYNC
From: Christoph Hellwig <address@hidden>
MacOS X versions older than 10.4 do not provide O_SYNC, but support the
old BSD O_FSYNC flag. So define O_DSYNC as O_FSYNC if not present to
be compatible with MacOS X (and possibly other pre-historic BSD derivates).
Signed-off-by: Christoph Hellwig <address@hidden>
Reported-by: G 3 <address@hidden>
Index: qemu/block/raw-posix.c
===================================================================
--- qemu.orig/block/raw-posix.c 2009-06-22 23:08:41.224930238 +0200
+++ qemu/block/raw-posix.c 2009-06-22 23:10:37.403934071 +0200
@@ -79,9 +79,12 @@
#define DEBUG_BLOCK_PRINT(formatCstr, ...)
#endif
-/* OS X does not have O_DSYNC */
+/*
+ * OS X does not have O_DSYNC, but provides the old BSDism O_FSYNC.
+ * (Never versions also have O_SYNC, but let's go for full compatiblity here).
+ */
#ifndef O_DSYNC
-#define O_DSYNC O_SYNC
+#define O_DSYNC O_FSYNC
#endif
/* Approximate O_DIRECT with O_DSYNC if O_DIRECT isn't available */