]> xenbits.xensource.com Git - libvirt.git/commitdiff
src: conditionalize use of O_DIRECT
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 22 Jan 2020 11:46:59 +0000 (11:46 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 29 Jan 2020 14:51:40 +0000 (14:51 +0000)
The O_DIRECT flag is not available on all platforms, so we
must introduce a compat define the same way gnulib does.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/util/iohelper.c
src/util/virfile.c

index d864bbeaedb533572b1494d7f94d411073c4530e..618bfb1d3dbbab5013d55e4833d1fc94a0d52229 100644 (file)
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
+#ifndef O_DIRECT
+# define O_DIRECT 0
+#endif
+
 static int
 runIO(const char *path, int fd, int oflags)
 {
index d0e0062aa788529df763d265a846cadd3c7a206f..efa59f2b13fb6bc162ad6c493682fadae3a3e912 100644 (file)
 
 VIR_LOG_INIT("util.file");
 
+#ifndef O_DIRECT
+# define O_DIRECT 0
+#endif
+
 int virFileClose(int *fdptr, virFileCloseFlags flags)
 {
     int saved_errno = 0;