Patchwork [for-1.4,v2] block/raw-posix: Build fix for O_ASYNC

login
register
mail settings
Submitter Andreas Färber
Date Jan. 31, 2013, 2:40 p.m.
Message ID <1359643214-26592-1-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/217195/
State New
Headers show

Comments

Andreas Färber - Jan. 31, 2013, 2:40 p.m.
Commit eeb6b45d48800e96f67ef2a5c80332557fd45ddb (block: raw-posix image
file reopen) broke the build on OpenIndiana.

illumos has no O_ASYNC. Exclude it from flags to be compared
and instead assert that it is not set where defined.

Cf. e61ab1da7e98357da47c54d8f893b9bd6ff2f7f9 for qemu-ga.

Cc: qemu-stable@nongnu.org (1.3.x)
Cc: Jeff Cody <jcody@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 v1 -> v2:
 * Instead of excluding O_ASYNC from flag comparison only for CONFIG_SOLARIS,
   assert that O_ASYNC is not set if defined. Suggested by Paolo.

 block/raw-posix.c |   11 ++++++++++-
 1 Datei geändert, 10 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
Stefan Hajnoczi - Feb. 1, 2013, 2:11 p.m.
On Thu, Jan 31, 2013 at 03:40:14PM +0100, Andreas Färber wrote:
> Commit eeb6b45d48800e96f67ef2a5c80332557fd45ddb (block: raw-posix image
> file reopen) broke the build on OpenIndiana.
> 
> illumos has no O_ASYNC. Exclude it from flags to be compared
> and instead assert that it is not set where defined.
> 
> Cf. e61ab1da7e98357da47c54d8f893b9bd6ff2f7f9 for qemu-ga.
> 
> Cc: qemu-stable@nongnu.org (1.3.x)
> Cc: Jeff Cody <jcody@redhat.com>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  v1 -> v2:
>  * Instead of excluding O_ASYNC from flag comparison only for CONFIG_SOLARIS,
>    assert that O_ASYNC is not set if defined. Suggested by Paolo.
> 
>  block/raw-posix.c |   11 ++++++++++-
>  1 Datei geändert, 10 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 657af95..8b6b926 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -345,11 +345,20 @@  static int raw_reopen_prepare(BDRVReopenState *state,
 
     raw_s->fd = -1;
 
-    int fcntl_flags = O_APPEND | O_ASYNC | O_NONBLOCK;
+    int fcntl_flags = O_APPEND | O_NONBLOCK;
 #ifdef O_NOATIME
     fcntl_flags |= O_NOATIME;
 #endif
 
+#ifdef O_ASYNC
+    /* Not all operating systems have O_ASYNC, and those that don't
+     * will not let us track the state into raw_s->open_flags (typically
+     * you achieve the same effect with an ioctl, for example I_SETSIG
+     * on Solaris). But we do not use O_ASYNC, so that's fine.
+     */
+    assert((s->open_flags & O_ASYNC) == 0);
+#endif
+
     if ((raw_s->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) {
         /* dup the original fd */
         /* TODO: use qemu fcntl wrapper */