From: David Sterba Date: Wed, 27 Aug 2014 15:48:35 +0000 (+0200) Subject: Add conditionals for btrfs library versions X-Git-Tag: v0.2.4~3^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F108%2Fhead;p=thirdparty%2Fsnapper.git Add conditionals for btrfs library versions Currently the btrfs library API is not versioned and causes build problems. Add a configure-time conditional check for btrfs/version.h that defines BTRFS_LIB_VERSION, otherwise assume the value 100. Use it to fix breakage of btrfs_read_and_process_send_stream in btrfsprogs 3.16. --- diff --git a/configure.ac b/configure.ac index 31032bc6..63e7fc88 100644 --- a/configure.ac +++ b/configure.ac @@ -102,6 +102,7 @@ AC_ARG_ENABLE([zypp], AC_HELP_STRING([--disable-zypp],[Disable zypp plugin suppo AM_CONDITIONAL(HAVE_ZYPP, [test "x$with_zypp" = "xyes"]) AC_CHECK_LIB(btrfs, btrfs_read_and_process_send_stream) +AC_CHECK_HEADERS([btrfs/version.h]) AC_ARG_ENABLE([xattrs], AC_HELP_STRING([--disable-xattrs],[Disable extended attributes support]), [with_xattrs=$enableval],[with_xattrs=yes]) diff --git a/snapper/Btrfs.cc b/snapper/Btrfs.cc index 7eae0db6..c6c6bb33 100644 --- a/snapper/Btrfs.cc +++ b/snapper/Btrfs.cc @@ -34,6 +34,11 @@ #include #endif #ifdef HAVE_LIBBTRFS +#ifdef HAVE_BTRFS_VERSION_H +#include +#else +#define BTRFS_LIB_VERSION (100) +#endif #include #include #include @@ -1142,7 +1147,13 @@ namespace snapper boost::this_thread::interruption_point(); // remove the fourth parameter for older versions of libbtrfs - int r = btrfs_read_and_process_send_stream(fd, &send_ops, &*this, 0); + int r; + +#if BTRFS_LIB_VERSION < 101 + r = btrfs_read_and_process_send_stream(fd, &send_ops, &*this, 0); +#else + r = btrfs_read_and_process_send_stream(fd, &send_ops, &*this, 0, 1); +#endif if (r < 0) {