src: conditionalize use of O_DIRECT

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>
This commit is contained in:
Daniel P. Berrangé 2020-01-22 11:46:59 +00:00
parent 4b9919af40
commit b0bea258d3
2 changed files with 8 additions and 0 deletions

View File

@ -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)
{

View File

@ -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;