Merge pull request #90 from giuseppe/fix-ubuntu-build

build: fix build with older versions of libfuse
This commit is contained in:
Giuseppe Scrivano 2019-07-23 16:14:12 +02:00 committed by GitHub
commit d99d8684c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -32,6 +32,29 @@ AC_DEFINE([USE_DIFF_HASH], 1, [Use the same hashing function as GNU diff])
PKG_CHECK_MODULES([FUSE], [fuse3 >= 3.2.1], [AC_DEFINE([HAVE_FUSE], 1, [Define if libfuse is available])], [AC_MSG_ERROR([*** libfuse not found])]]) PKG_CHECK_MODULES([FUSE], [fuse3 >= 3.2.1], [AC_DEFINE([HAVE_FUSE], 1, [Define if libfuse is available])], [AC_MSG_ERROR([*** libfuse not found])]])
old_CFLAGS=$CFLAGS
old_LDFLAGS=$LDFLAGS
CFLAGS=$pkg_cv_FUSE_CFLAGS
LDFLAGS=$pkg_cv_FUSE_LDFLAGS
AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE([
#define FUSE_USE_VERSION 32
#include <fuse_lowlevel.h>
void foo()
{
struct fuse_file_info fi;
fi.cache_readdir = 1;
}])
],
[cache_readdir=1],
[cache_readdir=0])
CFLAGS=$old_CFLAGS
LDFLAGS=$old_LDFLAGS
AC_DEFINE_UNQUOTED([HAVE_FUSE_CACHE_READDIR], $cache_readdir, [Define if libfuse is available])
AC_FUNC_ERROR_AT_LINE AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC AC_FUNC_MALLOC
AC_CHECK_FUNCS([open_by_handle_at error memset strdup copy_file_range]) AC_CHECK_FUNCS([open_by_handle_at error memset strdup copy_file_range])

2
main.c
View File

@ -1744,7 +1744,9 @@ ovl_opendir (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
if (get_timeout (lo) > 0) if (get_timeout (lo) > 0)
{ {
fi->keep_cache = 1; fi->keep_cache = 1;
#if HAVE_FUSE_CACHE_READDIR
fi->cache_readdir = 1; fi->cache_readdir = 1;
#endif
} }
fuse_reply_open (req, fi); fuse_reply_open (req, fi);
return; return;