qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: G 3 <programmingkidx@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] improved patch from block-raw-posix.c
Date: Mon, 22 Jun 2009 23:13:52 +0200	[thread overview]
Message-ID: <20090622211352.GB8024@lst.de> (raw)
In-Reply-To: <d097564c372451488331f3a8514b8da1@gmail.com>

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

      parent reply	other threads:[~2009-06-22 21:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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=20090622211352.GB8024@lst.de \
    --to=hch@lst.de \
    --cc=programmingkidx@gmail.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 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).