From ab26790f07856f65607461c7d98008ce139bdc83 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Thu, 18 May 2017 11:55:12 +0200 Subject: [PATCH] virfile: Provide stub for virFileInData Some older systems (such as RHEL6) lack SEEK_HOLE and SEEK_DATA which virFileInData relies on. Provide a stub for these systems. Signed-off-by: Michal Privoznik --- configure.ac | 5 +++++ src/util/virfile.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index f20b9ea4d0..2e60513547 100644 --- a/configure.ac +++ b/configure.ac @@ -352,6 +352,11 @@ AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO, [], [], [[#include ]]) +AC_CHECK_DECLS([SEEK_HOLE], [], [], + [#include + #include ]) + + dnl Our only use of libtasn1.h is in the testsuite, and can be skipped dnl if the header is not present. Assume -ltasn1 is present if the dnl header could be found. diff --git a/src/util/virfile.c b/src/util/virfile.c index 2f4bc42b63..d444b32f89 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3798,6 +3798,7 @@ virFileComparePaths(const char *p1, const char *p2) } +#if HAVE_DECL_SEEK_HOLE /** * virFileInData: * @fd: file to check @@ -3904,6 +3905,21 @@ virFileInData(int fd, return ret; } +#else /* !HAVE_DECL_SEEK_HOLE */ + +int +virFileInData(int fd ATTRIBUTE_UNUSED, + int *inData ATTRIBUTE_UNUSED, + long long *length ATTRIBUTE_UNUSED) +{ + errno = ENOSYS; + virReportSystemError(errno, "%s", + _("sparse files not supported")); + return -1; +} + +#endif /* !HAVE_DECL_SEEK_HOLE */ + /** * virFileReadValueInt: -- GitLab