qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] improved patch from block-raw-posix.c
@ 2009-06-21 23:55 G 3
  2009-06-22 16:12 ` Anthony Liguori
  2009-06-22 21:13 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: G 3 @ 2009-06-21 23:55 UTC (permalink / raw)
  To: qemu-devel

This patch is an improvement over a previous patch for the file 
block-raw-posix.c. This time the code checks to see if O_FSYNC is 
defined before defining O_SYNC as O_FSYNC. If it isn't defined, then it 
defines O_SYNC as 0.

signed-off-by: ProgrammingKid <programmingkidx@gmail.com>
--- /Users/misbah/Desktop/block-raw-posix-original.c	Wed May 20 
16:46:58 2009
+++ /Users/misbah/Desktop/block-raw-posix.c	Sun Jun 21 19:48:15 2009
@@ -73,6 +73,16 @@
  #define DEBUG_BLOCK_PRINT(formatCstr, args...)
  #endif

+/* 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
+
  /* OS X does not have O_DSYNC */
  #ifndef O_DSYNC
  #define O_DSYNC O_SYNC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] improved patch from block-raw-posix.c
  2009-06-21 23:55 [Qemu-devel] [PATCH] improved patch from block-raw-posix.c G 3
@ 2009-06-22 16:12 ` Anthony Liguori
  2009-06-22 21:13 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2009-06-22 16:12 UTC (permalink / raw)
  To: G 3; +Cc: qemu-devel

G 3 wrote:
> This patch is an improvement over a previous patch for the file 
> block-raw-posix.c. This time the code checks to see if O_FSYNC is 
> defined before defining O_SYNC as O_FSYNC. If it isn't defined, then 
> it defines O_SYNC as 0.
>
> signed-off-by: ProgrammingKid <programmingkidx@gmail.com> 
You have to use your real name with Signed-off-by.

See http://kerneltrap.org/files/Jeremy/DCO.txt

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] improved patch from block-raw-posix.c
  2009-06-21 23:55 [Qemu-devel] [PATCH] improved patch from block-raw-posix.c G 3
  2009-06-22 16:12 ` Anthony Liguori
@ 2009-06-22 21:13 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2009-06-22 21:13 UTC (permalink / raw)
  To: G 3; +Cc: qemu-devel

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 <hch@lst.de>

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 <hch@lst.de>
Reported-by: G 3 <programmingkidx@gmail.com>

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 */

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-22 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-21 23:55 [Qemu-devel] [PATCH] improved patch from block-raw-posix.c G 3
2009-06-22 16:12 ` Anthony Liguori
2009-06-22 21:13 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).