diff --git a/bdetools/bdemount.c b/bdetools/bdemount.c index 6eafaa1..1f5b79d 100644 --- a/bdetools/bdemount.c +++ b/bdetools/bdemount.c @@ -157,10 +157,10 @@ int main( int argc, char * const argv[] ) int unattended_mode = 0; int verbose = 0; -#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) +#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) struct fuse_operations bdemount_fuse_operations; -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) /* Need to set this to 1 even if there no arguments, otherwise this causes * fuse: empty argv passed to fuse_session_new() */ @@ -435,7 +435,7 @@ int main( int argc, char * const argv[] ) goto on_error; } -#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) +#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) if( option_extended_options != NULL ) { /* This argument is required but ignored @@ -491,7 +491,7 @@ int main( int argc, char * const argv[] ) bdemount_fuse_operations.getattr = &mount_fuse_getattr; bdemount_fuse_operations.destroy = &mount_fuse_destroy; -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) bdemount_fuse_handle = fuse_new( &bdemount_fuse_arguments, &bdemount_fuse_operations, @@ -546,7 +546,7 @@ int main( int argc, char * const argv[] ) goto on_error; } -#endif /* FUSE_USE_VERSION >= 30 */ +#endif /* defined( HAVE_LIBFUSE3 ) */ if( verbose == 0 ) { @@ -746,7 +746,7 @@ int main( int argc, char * const argv[] ) return( EXIT_FAILURE ); -#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) */ +#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) */ on_error: if( error != NULL ) @@ -756,7 +756,7 @@ int main( int argc, char * const argv[] ) libcerror_error_free( &error ); } -#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) +#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) if( bdemount_fuse_handle != NULL ) { fuse_destroy( diff --git a/bdetools/mount_fuse.c b/bdetools/mount_fuse.c index d2872a6..e2d612f 100644 --- a/bdetools/mount_fuse.c +++ b/bdetools/mount_fuse.c @@ -44,7 +44,7 @@ extern mount_handle_t *bdemount_mount_handle; -#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) +#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) #if ( SIZEOF_OFF_T != 8 ) && ( SIZEOF_OFF_T != 4 ) #error Size of off_t not supported @@ -255,7 +255,7 @@ int mount_fuse_filldir( return( -1 ); } -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) if( filler( buffer, name, @@ -664,7 +664,7 @@ int mount_fuse_opendir( /* Reads a directory * Returns 0 if successful or a negative errno value otherwise */ -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) int mount_fuse_readdir( const char *path, void *buffer, @@ -694,7 +694,7 @@ int mount_fuse_readdir( BDETOOLS_UNREFERENCED_PARAMETER( offset ) -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) BDETOOLS_UNREFERENCED_PARAMETER( flags ) #endif @@ -1067,7 +1067,7 @@ int mount_fuse_releasedir( /* Retrieves the file stat info * Returns 0 if successful or a negative errno value otherwise */ -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) int mount_fuse_getattr( const char *path, struct stat *stat_info, @@ -1088,7 +1088,7 @@ int mount_fuse_getattr( uint16_t file_mode = 0; int result = 0; -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) BDETOOLS_UNREFERENCED_PARAMETER( file_info ) #endif @@ -1348,5 +1348,5 @@ void mount_fuse_destroy( return; } -#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) */ +#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) */ diff --git a/bdetools/mount_fuse.h b/bdetools/mount_fuse.h index 7f50dca..b142013 100644 --- a/bdetools/mount_fuse.h +++ b/bdetools/mount_fuse.h @@ -25,22 +25,27 @@ #include #include -#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) +#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) + +#if !defined( FUSE_USE_VERSION ) && !defined( CYGFUSE ) /* Ensure FUSE_USE_VERSION is defined before including fuse.h */ -#if !defined( FUSE_USE_VERSION ) -#warning FUSE_USE_VERSION not set, defaulting to 26 +#if defined( HAVE_LIBFUSE3 ) +#define FUSE_USE_VERSION 30 +#else #define FUSE_USE_VERSION 26 #endif -#if defined( HAVE_LIBFUSE ) +#endif /* !defined( FUSE_USE_VERSION ) && !defined( CYGFUSE ) */ + +#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) #include #elif defined( HAVE_LIBOSXFUSE ) #include #endif -#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) */ +#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) */ #include "bdetools_libbde.h" #include "bdetools_libcerror.h" @@ -51,7 +56,7 @@ extern "C" { #endif -#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) +#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) int mount_fuse_set_stat_info( struct stat *stat_info, @@ -89,7 +94,7 @@ int mount_fuse_opendir( const char *path, struct fuse_file_info *file_info ); -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) int mount_fuse_readdir( const char *path, void *buffer, @@ -110,7 +115,7 @@ int mount_fuse_releasedir( const char *path, struct fuse_file_info *file_info ); -#if FUSE_USE_VERSION >= 30 +#if defined( HAVE_LIBFUSE3 ) int mount_fuse_getattr( const char *path, struct stat *stat_info, @@ -124,7 +129,7 @@ int mount_fuse_getattr( void mount_fuse_destroy( void *private_data ); -#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE ) */ +#endif /* defined( HAVE_LIBFUSE ) || defined( HAVE_LIBFUSE3 ) || defined( HAVE_LIBOSXFUSE ) */ #if defined( __cplusplus ) } diff --git a/m4/libfuse.m4 b/m4/libfuse.m4 index 7bd4e89..eec18d6 100644 --- a/m4/libfuse.m4 +++ b/m4/libfuse.m4 @@ -41,12 +41,12 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], AS_IF( [test "x$ac_cv_libfuse" = xlibfuse3], - [ac_cv_libfuse_CPPFLAGS="$pkg_cv_fuse3_CFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=30" + [ac_cv_libfuse_CPPFLAGS="$pkg_cv_fuse3_CFLAGS -D_FILE_OFFSET_BITS=64" ac_cv_libfuse_LIBADD="$pkg_cv_fuse3_LIBS"]) AS_IF( [test "x$ac_cv_libfuse" = xlibfuse], - [ac_cv_libfuse_CPPFLAGS="$pkg_cv_fuse_CFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26" + [ac_cv_libfuse_CPPFLAGS="$pkg_cv_fuse_CFLAGS -D_FILE_OFFSET_BITS=64" ac_cv_libfuse_LIBADD="$pkg_cv_fuse_LIBS"]) ]) ]) @@ -58,17 +58,13 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], [test "x$ac_cv_libfuse" != xlibfuse && test "x$ac_cv_libfuse" != xlibfuse3], [dnl Check for headers - dnl libfuse3 requires -D_FILE_OFFSET_BITS=64 to be set - ac_cv_libfuse_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=30" - CPPFLAGS="$backup_CPPFLAGS $ac_cv_libfuse_CPPFLAGS" + CPPFLAGS="$backup_CPPFLAGS -DFUSE_USE_VERSION=30" AC_CHECK_HEADERS([fuse.h]) AS_IF( [test "x$ac_cv_header_fuse_h" = xyes], [ac_cv_libfuse=libfuse3], - [dnl libfuse requires -D_FILE_OFFSET_BITS=64 to be set - ac_cv_libfuse_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26" - CPPFLAGS="$backup_CPPFLAGS $ac_cv_libfuse_CPPFLAGS" + [CPPFLAGS="$backup_CPPFLAGS -DFUSE_USE_VERSION=26" AC_CHECK_HEADERS([fuse.h]) AS_IF( @@ -80,7 +76,11 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], [test "x$ac_cv_header_fuse_h" = xno], [ac_cv_libfuse=no], [dnl Check for the individual functions - ac_cv_libfuse=libfuse + AC_CHECK_LIB( + fuse, + fuse_invalidate, + [ac_cv_libfuse=libfuse], + [ac_cv_libfuse=libfuse3]) AC_CHECK_LIB( fuse, @@ -103,6 +103,9 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], [ac_cv_libfuse_dummy=yes], [ac_cv_libfuse=no]) + dnl libfuse and libfuse3 require -D_FILE_OFFSET_BITS=64 to be set + ac_cv_libfuse_CPPFLAGS="-D_FILE_OFFSET_BITS=64" + AS_IF( [test "x$ac_cv_libfuse" = xlibfuse3], [ac_cv_libfuse_LIBADD="-lfuse3"], @@ -113,9 +116,7 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], dnl Check for libosxfuse AS_IF( [test "x$ac_cv_with_libfuse" != xno && test "x$ac_cv_header_fuse_h" = xno], - [dnl libosxfuse requires -D_FILE_OFFSET_BITS=64 to be set - ac_cv_libfuse_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26" - CPPFLAGS="$backup_CPPFLAGS $ac_cv_libfuse_CPPFLAGS" + [CPPFLAGS="$backup_CPPFLAGS -DFUSE_USE_VERSION=26" AC_CHECK_HEADERS([osxfuse/fuse.h]) AS_IF( @@ -145,6 +146,9 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], [ac_cv_libfuse_dummy=yes], [ac_cv_libfuse=no]) + dnl libosxfuse requires -D_FILE_OFFSET_BITS=64 to be set + ac_cv_libfuse_CPPFLAGS="-D_FILE_OFFSET_BITS=64" + ac_cv_libfuse_LIBADD="-losxfuse"; ]) ]) @@ -155,6 +159,7 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], [unable to find supported libfuse in directory: $ac_cv_with_libfuse], [1]) ]) + CPPFLAGS="$backup_CPPFLAGS" ]) @@ -168,7 +173,7 @@ AC_DEFUN([AX_LIBFUSE_CHECK_LIB], AS_IF( [test "x$ac_cv_libfuse" = xlibfuse3], [AC_DEFINE( - [HAVE_LIBFUSE], + [HAVE_LIBFUSE3], [1], [Define to 1 if you have the 'fuse3' library (-lfuse3).]) ])