qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-1.2] osdep: Fix compilation failure on BSD s


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH for-1.2] osdep: Fix compilation failure on BSD systems
Date: Thu, 16 Aug 2012 14:27:25 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

Am 16.08.2012 13:15, schrieb Peter Maydell:
Fix compilation failure on BSD systems (which don't have
O_DIRECT or O_NOATIME:
osdep.c:116: error: ‘O_DIRECT’ undeclared (first use in this function)
osdep.c:116: error: (Each undeclared identifier is reported only once
osdep.c:116: error: for each function it appears in.)
osdep.c:116: error: ‘O_NOATIME’ undeclared (first use in this function)

Signed-off-by: Peter Maydell <address@hidden>
---
PS: Do we care about O_DSYNC, O_RSYNC, O_SYNC? POSIX says those can be
used via fcntl() too...

  osdep.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/osdep.c b/osdep.c
index 5b78cee..3b25297 100644
--- a/osdep.c
+++ b/osdep.c
@@ -113,7 +113,13 @@ static int qemu_dup_flags(int fd, int flags)
      }
/* Set/unset flags that we can with fcntl */
-    setfl_flags = O_APPEND | O_ASYNC | O_DIRECT | O_NOATIME | O_NONBLOCK;
+    setfl_flags = O_APPEND | O_ASYNC | O_NONBLOCK;
+#ifdef O_NOATIME
+    setfl_flags |= O_NOATIME;
+#endif
+#ifdef O_DIRECT
+    setfl_flags |= O_DIRECT;
+#endif
      dup_flags &= ~setfl_flags;
      dup_flags |= (flags & setfl_flags);
      if (fcntl(ret, F_SETFL, dup_flags) == -1) {

Would O_DSYNC be a good replacement here for an
undefined O_DIRECT? block/raw-posix.c does it like that.

What about defining O_NOATIME and O_DIRECT in qemu-common.h
when needed (like it is done for O_BINARY)?

But I don't want to delay 1.2, therefore

Reviewed-by: Stefan Weil <address@hidden>

Regards,

Stefan W.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]