fix
authorMiklos Szeredi <miklos@szeredi.hu>
Wed, 18 Jan 2006 12:17:33 +0000 (12:17 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Wed, 18 Jan 2006 12:17:33 +0000 (12:17 +0000)
ChangeLog
configure.in
include/fuse.h
include/fuse_opt.h
kernel/configure.ac
kernel/file.c
kernel/fuse_i.h
lib/Makefile.am
lib/fuse_opt.c

index 8b764228dd041ce627b7c7e4f4c16e2a8508ec47..756d02b37e8b81cd6407979a6fec84ff9f504722 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-01-18  Miklos Szeredi <miklos@szeredi.hu>
+
+       * kernel: fix detection of case when fuse is not configured into
+       the kernel either as module or built-in
+
+       * fuse_opt.h: fix incompatibility with C++ compilers by renaming
+       'template' structure member to 'templ'.  Reported by Takashi Iwai
+
+       * fuse.h: fix compatibility bugs.  Patch by Yura Pakhuchiy
+
+       * kernel: support version 2.6.16 (i_sem -> i_mutex)
+
 2006-01-14  Miklos Szeredi <miklos@szeredi.hu>
 
        * Released 2.5.0
@@ -12,7 +24,7 @@
 
        * Clearing ->connected or ->mounted connection flags could race
        with setting other bitfields not protected with a lock
-       
+
 2006-01-10  Miklos Szeredi <miklos@szeredi.hu>
 
        * kernel: add necessary compile flags for 2.4.X/x86_64.
index d14db87990081a955442e49d68b90746f7bdab56..aa627ca68f7f461ff15240f76b726bc77f9d1637 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(fuse, 2.5.0)
+AC_INIT(fuse, 2.5.1)
 AC_CANONICAL_TARGET
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(include/config.h)
index a94c61a105f00ab5219785e30d0e32ee9fa78687..09206b4976a911ec206cac37a442f7d4dbb73ae0 100644 (file)
@@ -549,13 +549,14 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
 #    define fuse_setup fuse_setup_compat22
 #    define fuse_operations fuse_operations_compat22
 #    define fuse_file_info fuse_file_info_compat22
+#    define fuse_mount fuse_mount_compat22
 #  else
 #    define fuse_dirfil_t fuse_dirfil_t_compat
 #    define __fuse_read_cmd fuse_read_cmd
 #    define __fuse_process_cmd fuse_process_cmd
 #    define __fuse_loop_mt fuse_loop_mt_proc
 #    if FUSE_USE_VERSION == 21
-#      define FUSE_MAJOR_VERSION 2
+#      define FUSE_MINOR_VERSION 1
 #      define fuse_operations fuse_operations_compat2
 #      define fuse_main fuse_main_compat2
 #      define fuse_new fuse_new_compat2
@@ -563,6 +564,7 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
 #      define __fuse_teardown fuse_teardown
 #      define __fuse_exited fuse_exited
 #      define __fuse_set_getcontext_func fuse_set_getcontext_func
+#      define fuse_mount fuse_mount_compat22
 #    else
 #      warning Compatibility with API version 11 is deprecated
 #      undef FUSE_MAJOR_VERSION
index 2ef5d56ce6e05815d34e0091ad40164714d6a27b..2988902f2f0cdc9cae31e79b77f1f2d37f55c805 100644 (file)
@@ -72,7 +72,7 @@ extern "C" {
  */
 struct fuse_opt {
     /** Matching template and optional parameter formatting */
-    const char *template;
+    const char *templ;
 
     /**
      * Offset of variable within 'data' parameter of fuse_opt_parse()
@@ -82,7 +82,7 @@ struct fuse_opt {
 
     /**
      * Value to set the variable to, or to be passed as 'key' to the
-     * processing function.  Ignored if template a format
+     * processing function.  Ignored if template has a format
      */
     int value;
 };
@@ -91,13 +91,13 @@ struct fuse_opt {
  * Key option.  In case of a match, the processing function will be
  * called with the specified key.
  */
-#define FUSE_OPT_KEY(template, key) { template, -1U, key }
+#define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
 
 /**
  * Last option.  An array of 'struct fuse_opt' must end with a NULL
  * template value
  */
-#define FUSE_OPT_END { .template = NULL }
+#define FUSE_OPT_END { .templ = NULL }
 
 /**
  * Argument list
@@ -120,7 +120,7 @@ struct fuse_args {
 
 /**
  * Key value passed to the processing function if an option did not
- * match any templated
+ * match any template
  */
 #define FUSE_OPT_KEY_OPT     -1
 
index 12d224ae90eb1294b97254aba7a4e6c1e42a9d0f..570f8ce601f07fdbe70c56db481e2ad266224b3c 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(fuse-kernel, 2.5.0)
+AC_INIT(fuse-kernel, 2.5.1)
 AC_CONFIG_HEADERS([config.h])
 
 AC_PROG_INSTALL
@@ -37,7 +37,9 @@ if test -z "$enable_kernel_module" -a -z "$kernelbuild" && echo "$runver" | grep
        fi
        if test "$checkmodule" = yes; then
                AC_MSG_CHECKING([if FUSE module is from official kernel])
-                       if fgrep -q "fuse distribution version: " /lib/modules/${runver}/kernel/fs/fuse/fuse.ko 2> /dev/null; then
+               if test ! -f /lib/modules/${runver}/kernel/fs/fuse/fuse.ko; then
+                       AC_MSG_RESULT([no])
+               elif fgrep -q "fuse distribution version: " /lib/modules/${runver}/kernel/fs/fuse/fuse.ko 2> /dev/null; then
                        AC_MSG_RESULT([no])
                else
                        AC_MSG_RESULT([yes])
index 14c4f7c3cc05915a12d0e3d014bf6994b4186742..bf46a9c0bbed67d4b0779aacdc30e0a76d61d911 100644 (file)
@@ -675,9 +675,15 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
        struct inode *inode = file->f_dentry->d_inode;
        ssize_t res;
        /* Don't allow parallel writes to the same file */
+#ifdef KERNEL_2_6_16_PLUS
+       mutex_lock(&inode->i_mutex);
+       res = fuse_direct_io(file, buf, count, ppos, 1);
+       mutex_unlock(&inode->i_mutex);
+#else
        down(&inode->i_sem);
        res = fuse_direct_io(file, buf, count, ppos, 1);
        up(&inode->i_sem);
+#endif
        return res;
 }
 
index 84e17dc6c5fdfe4848f19798a3804b069ae4c656..57d9194976bf5623a07f090c835c4e730f855e46 100644 (file)
@@ -40,6 +40,9 @@
 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
 #    define KERNEL_2_6_13_PLUS
 #  endif
+#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+#    define KERNEL_2_6_16_PLUS
+#  endif
 #endif
 
 #include "config.h"
index d58cfed7a256cf3c860118b0fb12c336a213e259..fb52a0b409de668b16f55c684727b25a3356b99a 100644 (file)
@@ -22,7 +22,7 @@ libfuse_la_SOURCES =          \
        helper.c                \
        $(mount_source)
 
-libfuse_la_LDFLAGS = -lpthread -version-number 2:5:0 \
+libfuse_la_LDFLAGS = -lpthread -version-number 2:5:1 \
        -Wl,--version-script,fuse_versionscript
 
 EXTRA_DIST = fuse_versionscript
index 2ac499c91a44be9b677302920f989b2e731f4f69..65ff1ec97e2a17b75b9075fc3970fd0b6cc77de8 100644 (file)
@@ -155,8 +155,8 @@ static int match_template(const char *t, const char *arg, unsigned *sepp)
 static const struct fuse_opt *find_opt(const struct fuse_opt *opt,
                                        const char *arg, unsigned *sepp)
 {
-    for (; opt && opt->template; opt++)
-        if (match_template(opt->template, arg, sepp))
+    for (; opt && opt->templ; opt++)
+        if (match_template(opt->templ, arg, sepp))
             return opt;
     return NULL;
 }
@@ -195,11 +195,11 @@ static int process_opt(struct fuse_opt_context *ctx,
             return -1;
     } else {
         void *var = ctx->data + opt->offset;
-        if (sep && opt->template[sep + 1]) {
+        if (sep && opt->templ[sep + 1]) {
             const char *param = arg + sep;
-            if (opt->template[sep] == '=')
+            if (opt->templ[sep] == '=')
                 param ++;
-            if (process_opt_param(var, opt->template + sep + 1,
+            if (process_opt_param(var, opt->templ + sep + 1,
                                   param, arg) == -1)
                 return -1;
         } else
@@ -239,7 +239,7 @@ static int process_gopt(struct fuse_opt_context *ctx, const char *arg, int iso)
     if (opt) {
         for (; opt; opt = find_opt(opt + 1, arg, &sep)) {
             int res;
-            if (sep && opt->template[sep] == ' ' && !arg[sep])
+            if (sep && opt->templ[sep] == ' ' && !arg[sep])
                 res = process_opt_sep_arg(ctx, opt, sep, arg, iso);
             else
                 res = process_opt(ctx, opt, sep, arg, iso);