[libvirt PATCH 26/32] src: conditionalize use of O_DIRECT

Daniel P. Berrangé berrange at redhat.com
Thu Jan 23 11:43:19 UTC 2020


The O_DIRECT flag is not available on platforms, so we
must avoid it once we remove GNULIB.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/util/virfile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index d0e0062aa7..617d5d7a48 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -178,7 +178,11 @@ virFileDirectFdFlag(void)
 {
     /* XXX For now, Linux posix_fadvise is not powerful enough to
      * avoid O_DIRECT.  */
+#ifdef O_DIRECT
     return O_DIRECT ? O_DIRECT : -1;
+#else
+    return -1;
+#endif
 }
 
 /* Opaque type for managing a wrapper around a fd.  For now,
-- 
2.24.1




More information about the libvir-list mailing list