When using sheepfs on rhel5 environment, it will report:

    fuse: unknown option `big_writes'

because the 'big_writes' option is only supported by libfuse with version >= 
2.8.0.

So we should add check for version of libfuse in configure.ac.

Signed-off-by: RobinDong <[email protected]>
---
 configure.ac   |    8 ++++++++
 sheepfs/core.c |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9e878f5..6ab58cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,6 +323,14 @@ if test "x${enable_sheepfs}" = xyes; then
                [#define _FILE_OFFSET_BITS 64])
        AC_DEFINE_UNQUOTED([HAVE_SHEEPFS], 1, [have sheepfs])
        PACKAGE_FEATURES="$PACKAGE_FEATURES sheepfs"
+       for FUSE_SO_FILE in /lib/libfuse.so /lib64/libfuse.so /lib/libfuse.so.2 
/lib64/libfuse.so.2; do
+               if [[[ -a $FUSE_SO_FILE ]]]; then
+                       if [[[ `file $FUSE_SO_FILE|awk -F"libfuse.so.|'" 
'{print $(NF-1)}'|sed s/\\\.//g` -ge 280 ]]]; then
+                               AC_DEFINE_UNQUOTED([FUSE_SUPPORT_BIGWRITES], 1, 
[Support -obig_writes for fuse])
+                               break;
+                       fi
+               fi
+       done
 fi
 
 if test "x${enable_http}" = xyes; then
diff --git a/sheepfs/core.c b/sheepfs/core.c
index 71253aa..1482596 100644
--- a/sheepfs/core.c
+++ b/sheepfs/core.c
@@ -258,7 +258,9 @@ static int sheepfs_main_loop(char *mountpoint)
 
        fuse_opt_add_arg(&args, "sheepfs"); /* placeholder for argv[0] */
        fuse_opt_add_arg(&args, "-oallow_root");
+       #ifdef FUSE_SUPPORT_BIGWRITES
        fuse_opt_add_arg(&args, "-obig_writes");
+       #endif
        fuse_opt_add_arg(&args, "-okernel_cache");
        fuse_opt_add_arg(&args, "-ofsname=sheepfs");
        fuse_opt_add_arg(&args, mountpoint);
-- 
1.7.3.2

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to