]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virfile: Provide stub for virFileInData
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 18 May 2017 09:55:12 +0000 (11:55 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 19 May 2017 12:02:37 +0000 (14:02 +0200)
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 <mprivozn@redhat.com>
configure.ac
src/util/virfile.c

index f20b9ea4d02c400672664aff4bd9ba577b0d4320..2e60513547318fe43ae907171da5a9ac1b533225 100644 (file)
@@ -352,6 +352,11 @@ AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO,
   [], [], [[#include <linux/ethtool.h>
   ]])
 
+AC_CHECK_DECLS([SEEK_HOLE], [], [],
+               [#include <sys/types.h>
+                #include <unistd.h>])
+
+
 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.
index 2f4bc42b63e9b9e1c3ac5f34c31b1483c69db39f..d444b32f89358bbcb1eda4d15af94f818b49fa38 100644 (file)
@@ -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: