From b0bea258d3ec16fcb6299a40ffdf72534d3396e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 22 Jan 2020 11:46:59 +0000 Subject: [PATCH] src: conditionalize use of O_DIRECT MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Daniel P. Berrangé --- src/util/iohelper.c | 4 ++++ src/util/virfile.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/util/iohelper.c b/src/util/iohelper.c index d864bbeaed..618bfb1d3d 100644 --- a/src/util/iohelper.c +++ b/src/util/iohelper.c @@ -39,6 +39,10 @@ #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) { diff --git a/src/util/virfile.c b/src/util/virfile.c index d0e0062aa7..efa59f2b13 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -95,6 +95,10 @@ VIR_LOG_INIT("util.file"); +#ifndef O_DIRECT +# define O_DIRECT 0 +#endif + int virFileClose(int *fdptr, virFileCloseFlags flags) { int saved_errno = 0; -- 2.47.2