fix
authorMiklos Szeredi <miklos@szeredi.hu>
Fri, 10 Mar 2006 10:18:20 +0000 (10:18 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Fri, 10 Mar 2006 10:18:20 +0000 (10:18 +0000)
ChangeLog
include/fuse.h
include/fuse_common.h
include/fuse_common_compat.h [new file with mode: 0644]
include/fuse_compat.h
include/fuse_lowlevel.h

index dd498f45fddc5313ecd8a93f6ecf74addda0ef5d..28cdb7d9e3643bacb13035ca8180e2ee3c3642e5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-10  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Fix source compatibility breakage for fuse_unmount().  Report
+       from Yura Pakhuchiy
+
 2006-03-02  Miklos Szeredi <miklos@szeredi.hu>
 
        * Fix O_ASYNC handling in fuse_dev_release().  From Jeff Dike
index 6c0bb72f6d78ca4801d67f3fa9329d0a7b831b2b..065ae75b48ad891509829656a6ec17d836aad501 100644 (file)
@@ -535,41 +535,30 @@ void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
  * Compatibility stuff                                         *
  * ----------------------------------------------------------- */
 
-#ifdef __FreeBSD__
-#  if FUSE_USE_VERSION < 25
-#    error On FreeBSD API version 25 or greater must be used
-#  endif
-#endif
-
-#if FUSE_USE_VERSION == 25 || FUSE_USE_VERSION == 22 || \
-    FUSE_USE_VERSION == 21 || FUSE_USE_VERSION == 11
+#if FUSE_USE_VERSION < 26
 #  include "fuse_compat.h"
-#  undef FUSE_MINOR_VERSION
 #  undef fuse_main
 #  if FUSE_USE_VERSION == 25
-#    define FUSE_MINOR_VERSION 5
 #    define fuse_main(argc, argv, op) \
             fuse_main_real_compat25(argc, argv, op, sizeof(*(op)))
 #    define fuse_new fuse_new_compat25
 #    define fuse_setup fuse_setup_compat25
 #    define fuse_operations fuse_operations_compat25
 #  elif FUSE_USE_VERSION == 22
-#    define FUSE_MINOR_VERSION 4
 #    define fuse_main(argc, argv, op) \
             fuse_main_real_compat22(argc, argv, op, sizeof(*(op)))
 #    define fuse_new fuse_new_compat22
 #    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
-#    define fuse_unmount fuse_unmount_compat22
+#  elif FUSE_USE_VERSION == 24
+#    error Compatibility with high-level API version 24 not supported
 #  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_MINOR_VERSION 1
 #      define fuse_operations fuse_operations_compat2
 #      define fuse_main fuse_main_compat2
 #      define fuse_new fuse_new_compat2
@@ -577,22 +566,14 @@ 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
-#      define FUSE_MAJOR_VERSION 1
-#      define FUSE_MINOR_VERSION 1
 #      define fuse_statfs fuse_statfs_compat1
 #      define fuse_operations fuse_operations_compat1
 #      define fuse_main fuse_main_compat1
 #      define fuse_new fuse_new_compat1
-#      define fuse_mount fuse_mount_compat1
 #      define FUSE_DEBUG FUSE_DEBUG_COMPAT1
 #    endif
 #  endif
-#elif FUSE_USE_VERSION < 26
-#  error Compatibility with API version other than 21, 22, 25 and 11 not supported
 #endif
 
 #ifdef __cplusplus
index f05d2376b47ba19283109da517dae381c04d594b..056b92b7dabde53a89235ab5e3777cf32a18b612 100644 (file)
@@ -120,6 +120,35 @@ int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint,
                        int *multithreaded, int *foreground);
 
 
+#if FUSE_USE_VERSION < 26
+#    ifdef __FreeBSD__
+#        if FUSE_USE_VERSION < 25
+#            error On FreeBSD API version 25 or greater must be used
+#        endif
+#    endif
+#    include "fuse_common_compat.h"
+#    undef FUSE_MINOR_VERSION
+#    undef fuse_main
+#    define fuse_unmount fuse_unmount_compat22
+#    if FUSE_USE_VERSION == 25
+#        define FUSE_MINOR_VERSION 5
+#    elif FUSE_USE_VERSION == 24 || FUSE_USE_VERSION == 22
+#        define FUSE_MINOR_VERSION 4
+#        define fuse_mount fuse_mount_compat22
+#    elif FUSE_USE_VERSION == 21
+#        define FUSE_MINOR_VERSION 1
+#        define fuse_mount fuse_mount_compat22
+#    elif FUSE_USE_VERSION == 11
+#        warning Compatibility with API version 11 is deprecated
+#        undef FUSE_MAJOR_VERSION
+#        define FUSE_MAJOR_VERSION 1
+#        define FUSE_MINOR_VERSION 1
+#        define fuse_mount fuse_mount_compat1
+#    else
+#        error Compatibility with API version other than 21, 22, 24, 25 and 11 not supported
+#    endif
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/fuse_common_compat.h b/include/fuse_common_compat.h
new file mode 100644 (file)
index 0000000..ce54fdf
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+    FUSE: Filesystem in Userspace
+    Copyright (C) 2001-2006  Miklos Szeredi <miklos@szeredi.hu>
+
+    This program can be distributed under the terms of the GNU LGPL.
+    See the file COPYING.LIB.
+*/
+
+/* these definitions provide source compatibility to prior versions.
+   Do not include this file directly! */
+
+int fuse_mount_compat22(const char *mountpoint, const char *opts);
+
+int fuse_mount_compat1(const char *mountpoint, const char *args[]);
+
+void fuse_unmount_compat22(const char *mountpoint);
+
index ef7ff6757f3d2f4bc73075c104ea5a608b6f1567..a2144f053a47efb7d57e2043b7c3b4e860419649 100644 (file)
@@ -62,8 +62,6 @@ struct fuse *fuse_setup_compat25(int argc, char *argv[],
                                  size_t op_size, char **mountpoint,
                                  int *multithreaded, int *fd);
 
-void fuse_unmount_compat22(const char *mountpoint);
-
 #ifndef __FreeBSD__
 #include <sys/statfs.h>
 
@@ -125,8 +123,6 @@ int fuse_main_real_compat22(int argc, char *argv[],
                             const struct fuse_operations_compat22 *op,
                             size_t op_size);
 
-int fuse_mount_compat22(const char *mountpoint, const char *opts);
-
 typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int type);
 struct fuse_operations_compat2 {
     int (*getattr)     (const char *, struct stat *);
@@ -196,8 +192,6 @@ struct fuse_operations_compat1 {
 
 #define FUSE_DEBUG_COMPAT1       (1 << 1)
 
-int fuse_mount_compat1(const char *mountpoint, const char *args[]);
-
 struct fuse *fuse_new_compat1(int fd, int flags, const struct fuse_operations_compat1 *op);
 
 void fuse_main_compat1(int argc, char *argv[], const struct fuse_operations_compat1 *op);
index f042dfba6e8d16e0a4aec890edeb8f6751580afe..3cfff327c973496a8d90eb30cad6811c09ed9e4e 100644 (file)
@@ -1236,27 +1236,19 @@ void fuse_remove_signal_handlers(struct fuse_session *se);
  * Compatibility stuff                                         *
  * ----------------------------------------------------------- */
 
-#ifdef __FreeBSD__
-#  if FUSE_USE_VERSION < 25
-#    error On FreeBSD API version 25 or greater must be used
-#  endif
-#endif
-
-#if FUSE_USE_VERSION == 25 || FUSE_USE_VERSION == 24
+#if FUSE_USE_VERSION < 26
 #  include "fuse_lowlevel_compat.h"
 #  undef FUSE_MINOR_VERSION
 #  if FUSE_USE_VERSION == 25
-#    define FUSE_MINOR_VERSION 5
 #    define fuse_lowlevel_ops fuse_lowlevel_ops_compat25
 #    define fuse_lowlevel_new fuse_lowlevel_new_compat25
-#  else
-#    define FUSE_MINOR_VERSION 4
+#  elif FUSE_USE_VERSION == 24
 #    define fuse_file_info fuse_file_info_compat
 #    define fuse_reply_statfs fuse_reply_statfs_compat
 #    define fuse_reply_open fuse_reply_open_compat
+#  else 
+#    error Compatibility with low-level API version < 24 not supported
 #  endif
-#elif FUSE_USE_VERSION < 26
-#  error Compatibility with low level API version other than 24 and 25 not supported
 #endif
 
 #ifdef __cplusplus