From c65bacb25b91491490b98131f99fc859d02ab1b5 Mon Sep 17 00:00:00 2001 From: yura Date: Sun, 5 Nov 2006 21:40:57 +0000 Subject: [PATCH] ntfsmount: require FUSE version >= 2.6.0 for build. Fixes fusermount lookup problem and allows to drop compatibility code. --- ChangeLog | 4 +++- configure.ac | 26 ++++---------------------- ntfsprogs/ntfsmount.c | 30 ------------------------------ 3 files changed, 7 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d3cdc6b..49f8e2a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,7 +52,7 @@ xx/xx/2006 - x.xx.x - . - Allow ntfscp to create the destination file if it does not already exists by calling ntfs_create(). (Hil) - Fix GUID to string conversion. (Anton) - - Multiple big-endiness fixes. (zhanglinbao, Yuval) + - Multiple big-endianness fixes. (zhanglinbao, Yuval) - Spelling mistake fixes. (Yuval) - Remove inline keywords from static non-one-liners. (Szaka, Yuval) - Memory leak fixes. (Yura, Yuval) @@ -63,6 +63,8 @@ xx/xx/2006 - x.xx.x - . - Introduce misc.c. Move ntfs_[mc]alloc there. (Szaka) - Change malloc() calls to ntfs_malloc(). (Szaka) - Factor ntfs_attr_fill_hole() out of ntfs_attr_pwrite(). (Szaka) + - ntfsmount: require FUSE version >= 2.6.0 for build. Fixes fusermount + lookup problem and allows to drop compatibility code. (Yura) 21/06/2006 - 1.13.1 - Various fixes. diff --git a/configure.ac b/configure.ac index 0941bf39..2c743ae6 100644 --- a/configure.ac +++ b/configure.ac @@ -195,31 +195,13 @@ AM_CONDITIONAL(ENABLE_GNOME_VFS, $compile_gnome_vfs) # Autodetect whether to build FUSE module or not. compile_fuse_module=false if test "$enable_fuse_module" != "no"; then - case "$target_os" in - linux*) - PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.3.0, [ compile_fuse_module=true ], - if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.3.0.]) - else - AC_MSG_WARN([ntfsmount requires FUSE version >= 2.3.0.]) - fi - );; - freebsd*) - PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.5.0, [ compile_fuse_module=true ], - if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.5.0 under FreeBSD.]) - else - AC_MSG_WARN([ntfsmount requires FUSE version >= 2.5.0 under FreeBSD.]) - fi - );; - *) + PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.6.0, [ compile_fuse_module=true ], if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([ntfsmount can be built only under Linux and FreeBSD.]) + AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.6.0.]) else - AC_MSG_WARN([ntfsmount can be built only under Linux and FreeBSD.]) + AC_MSG_WARN([ntfsmount requires FUSE version >= 2.6.0.]) fi - ;; - esac + ) fi AM_CONDITIONAL(ENABLE_FUSE_MODULE, $compile_fuse_module) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index bcdd9b8d..9901202a 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -223,11 +223,7 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol) * Returns 0 on success or -errno on error. */ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), -#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) struct statvfs *sfs) -#else - struct statfs *sfs) -#endif { long size; ntfs_volume *vol; @@ -237,9 +233,7 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), return -ENODEV; /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; -#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) sfs->f_frsize = vol->cluster_size; -#endif /* * Total data blocks in file system in units of f_bsize and since * inodes are also stored in data blocs ($MFT is a file) this is just @@ -260,11 +254,7 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), size = 0; sfs->f_ffree = size; /* Maximum length of filenames. */ -#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) sfs->f_namemax = NTFS_MAX_NAME_LEN; -#else - sfs->f_namelen = NTFS_MAX_NAME_LEN; -#endif return 0; } @@ -1774,9 +1764,7 @@ static int parse_options(int argc, char *argv[]) int main(int argc, char *argv[]) { char *parsed_options; -#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) struct fuse_args margs = FUSE_ARGS_INIT(0, NULL); -#endif struct fuse *fh; int ffd = 0; @@ -1804,7 +1792,6 @@ int main(int argc, char *argv[]) return 4; } /* Create filesystem. */ -#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) if ((fuse_opt_add_arg(&margs, "") == -1 || fuse_opt_add_arg(&margs, "-o") == -1 || fuse_opt_add_arg(&margs, parsed_options) == -1)) @@ -1812,16 +1799,12 @@ int main(int argc, char *argv[]) if (ffd != -1) ffd = fuse_mount(opts.mnt_point, &margs); fuse_opt_free_args(&margs); -#else - ffd = fuse_mount(opts.mnt_point, parsed_options); -#endif free(parsed_options); if (ffd == -1) { ntfs_log_error("fuse_mount failed.\n"); ntfs_fuse_destroy(); return 5; } -#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) fh = (struct fuse *)1; /* Cast anything except NULL to handle errors. */ margs = (struct fuse_args)FUSE_ARGS_INIT(0, NULL); if (fuse_opt_add_arg(&margs, "") == -1 || @@ -1838,19 +1821,6 @@ int main(int argc, char *argv[]) fh = fuse_new(ffd, &margs , &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); fuse_opt_free_args(&margs); -#else - if (!ctx->debug && !ctx->no_detach) { - if (fuse_is_lib_option("kernel_cache")) - fh = fuse_new(ffd, "use_ino,kernel_cache", - &ntfs_fuse_oper, - sizeof(ntfs_fuse_oper)); - else - fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, - sizeof(ntfs_fuse_oper)); - } else - fh = fuse_new(ffd, "debug,use_ino" , &ntfs_fuse_oper, - sizeof(ntfs_fuse_oper)); -#endif if (!fh) { ntfs_log_error("fuse_new failed.\n"); close(ffd);