AM_CONDITIONAL(USE_LIBSODIUM, test "x$have_libsodium" = xyes)
LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0"
+FUSE3_DEPENDENCY="fuse3 >= 3.1.1"
# What's in RHEL7.2.
FUSE_DEPENDENCY="fuse >= 2.9.2"
[generate rofiles-fuse helper [default=yes]])],,
enable_rofiles_fuse=yes)
AS_IF([ test x$enable_rofiles_fuse != xno ], [
- PKG_CHECK_MODULES(BUILDOPT_FUSE, $FUSE_DEPENDENCY)
-], [enable_rofiles_fuse=no])
+ PKG_CHECK_MODULES([FUSE3], [$FUSE3_DEPENDENCY],
+ [
+ FUSE_USE_VERSION=31
+ BUILDOPT_FUSE_CFLAGS="$FUSE3_CFLAGS"
+ BUILDOPT_FUSE_LIBS="$FUSE3_LIBS"
+ ],
+ [PKG_CHECK_MODULES([FUSE], [$FUSE_DEPENDENCY],
+ [
+ FUSE_USE_VERSION=26
+ BUILDOPT_FUSE_CFLAGS="$FUSE_CFLAGS"
+ BUILDOPT_FUSE_LIBS="$FUSE_LIBS"
+ ])])
+ AC_DEFINE_UNQUOTED([FUSE_USE_VERSION], [$FUSE_USE_VERSION], [Define to the FUSE API version])
+ AC_SUBST([BUILDOPT_FUSE_CFLAGS])
+ AC_SUBST([BUILDOPT_FUSE_LIBS])
+ ], [enable_rofiles_fuse=no])
AM_CONDITIONAL(BUILDOPT_FUSE, test x$enable_rofiles_fuse = xyes)
AC_ARG_WITH(dracut,
* License along with this library. If not, see <https://www.gnu.org/licenses/>.
*/
-#define FUSE_USE_VERSION 26
+#include "config.h"
+
+#ifndef FUSE_USE_VERSION
+#error config.h needs to define FUSE_USE_VERSION
+#endif
#include <sys/types.h>
#include <sys/stat.h>
}
static int
+#if FUSE_USE_VERSION >= 31
+callback_getattr (const char *path, struct stat *st_data, struct fuse_file_info *finfo)
+#else
callback_getattr (const char *path, struct stat *st_data)
+#endif
{
path = ENSURE_RELPATH (path);
if (!*path)
}
static int
+#if FUSE_USE_VERSION >= 31
+callback_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
+ off_t offset, struct fuse_file_info *fi, enum fuse_readdir_flags flags)
+#else
callback_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
+#endif
{
DIR *dp;
struct dirent *de;
memset (&st, 0, sizeof (st));
st.st_ino = de->d_ino;
st.st_mode = de->d_type << 12;
+
+#if FUSE_USE_VERSION >= 31
+ if (filler (buf, de->d_name, &st, 0, 0))
+ break;
+#else
if (filler (buf, de->d_name, &st, 0))
break;
+#endif
}
(void) closedir (dp);
}
static int
+#if FUSE_USE_VERSION >= 31
+callback_rename (const char *from, const char *to, unsigned int flags)
+#else
callback_rename (const char *from, const char *to)
+#endif
{
+#if FUSE_USE_VERSION < 31
+ unsigned int flags = 0;
+#endif
+
from = ENSURE_RELPATH (from);
to = ENSURE_RELPATH (to);
- if (renameat (basefd, from, basefd, to) == -1)
+
+ /* This assumes Linux 3.15+ */
+ if (renameat2 (basefd, from, basefd, to, flags) == -1)
return -errno;
return 0;
}
} while (0)
static int
+#if FUSE_USE_VERSION >= 31
+callback_chmod (const char *path, mode_t mode, struct fuse_file_info *finfo)
+#else
callback_chmod (const char *path, mode_t mode)
+#endif
{
PATH_WRITE_ENTRYPOINT (path);
}
static int
+#if FUSE_USE_VERSION >= 31
+callback_chown (const char *path, uid_t uid, gid_t gid, struct fuse_file_info *finfo)
+#else
callback_chown (const char *path, uid_t uid, gid_t gid)
+#endif
{
PATH_WRITE_ENTRYPOINT (path);
}
static int
+#if FUSE_USE_VERSION >= 31
+callback_truncate (const char *path, off_t size, struct fuse_file_info *finfo)
+#else
callback_truncate (const char *path, off_t size)
+#endif
{
PATH_WRITE_ENTRYPOINT (path);
}
static int
+#if FUSE_USE_VERSION >= 31
+callback_utimens (const char *path, const struct timespec tv[2], struct fuse_file_info *finfo)
+#else
callback_utimens (const char *path, const struct timespec tv[2])
+#endif
{
/* This one isn't write-verified, we support changing times
* even for hardlinked files.