fix
diff --git a/ChangeLog b/ChangeLog
index a2d2894..46c519a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-11  Miklos Szeredi <miklos@szeredi.hu>
+
+	* Use 64bit type for file handle, so the full range supported by
+	the kernel interface is available to applications
+
 2005-11-10  Miklos Szeredi <miklos@szeredi.hu>
 
 	* Moved mountpoint argument checking from fuse_parse_cmdline() to
diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c
index 93bd843..491e691 100644
--- a/example/fusexmp_fh.c
+++ b/example/fusexmp_fh.c
@@ -79,10 +79,15 @@
     return 0;
 }
 
+static inline DIR *get_dirp(struct fuse_file_info *fi)
+{
+    return (DIR *) (uintptr_t) fi->fh;
+}
+
 static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
                        off_t offset, struct fuse_file_info *fi)
 {
-    DIR *dp = (DIR *) fi->fh;
+    DIR *dp = get_dirp(fi);
     struct dirent *de;
 
     (void) path;
@@ -101,7 +106,7 @@
 
 static int xmp_releasedir(const char *path, struct fuse_file_info *fi)
 {
-    DIR *dp = (DIR *) fi->fh;
+    DIR *dp = get_dirp(fi);
     (void) path;
     closedir(dp);
     return 0;
diff --git a/include/fuse.h b/include/fuse.h
index 2e977b2..adf0c9a 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -167,7 +167,14 @@
                   struct fuse_file_info *);
 
     /** Just a placeholder, don't set */
-    void (*statfs_old) (void);
+    /** Get file system statistics
+     *
+     * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
+     *
+     * Replaced 'struct statfs' parameter with 'struct statvfs' in
+     * version 2.5
+     */
+    int (*statfs) (const char *, struct statvfs *);
 
     /** Possibly flush cached data
      *
@@ -353,15 +360,6 @@
      * Introduced in version 2.5
      */
     int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
-
-    /** Get file system statistics
-     *
-     * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
-     *
-     * Replaced 'struct statfs' parameter with 'struct statvfs' in
-     * version 2.5
-     */
-    int (*statfs) (const char *, struct statvfs *);
 };
 
 /** Extra context that may be needed by some filesystems
@@ -549,8 +547,12 @@
 #  undef fuse_main
 #  if FUSE_USE_VERSION == 22
 #    define FUSE_MINOR_VERSION 4
-#    define fuse_main fuse_main_compat22
+#    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
 #  else
 #    define fuse_dirfil_t fuse_dirfil_t_compat
 #    define __fuse_read_cmd fuse_read_cmd
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 96f4702..979c092 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -13,6 +13,8 @@
 #ifndef _FUSE_COMMON_H_
 #define _FUSE_COMMON_H_
 
+#include <stdint.h>
+
 /** Major version of FUSE library interface */
 #define FUSE_MAJOR_VERSION 2
 
@@ -31,14 +33,17 @@
 extern "C" {
 #endif
 
-/** Information about open files */
+/**
+ * Information about open files
+ *
+ * Changed in version 2.5
+ */
 struct fuse_file_info {
     /** Open flags.  Available in open() and release() */
     int flags;
 
-    /** File handle.  May be filled in by filesystem in open().
-        Available in all other file operations */
-    unsigned long fh;
+    /** Old file handle, don't use */
+    unsigned long fh_old;
 
     /** In case of a write operation indicates if this was caused by a
         writepage */
@@ -51,6 +56,13 @@
     /** Can be filled in by open, to indicate, that cached file data
         need not be invalidated.  Introduced in version 2.4 */
     unsigned int keep_cache : 1;
+
+    /** Padding.  Do not use*/
+    unsigned int padding : 30;
+
+    /** File handle.  May be filled in by filesystem in open().
+        Available in all other file operations */
+    uint64_t fh;
 };
 
 /*
diff --git a/include/fuse_compat.h b/include/fuse_compat.h
index 176560f..1fe68ec 100644
--- a/include/fuse_compat.h
+++ b/include/fuse_compat.h
@@ -11,6 +11,14 @@
 
 #include <sys/statfs.h>
 
+struct fuse_file_info_compat22 {
+    int flags;
+    unsigned long fh;
+    int writepage;
+    unsigned int direct_io : 1;
+    unsigned int keep_cache : 1;
+};
+
 struct fuse_operations_compat22 {
     int (*getattr) (const char *, struct stat *);
     int (*readlink) (const char *, char *, size_t);
@@ -26,39 +34,40 @@
     int (*chown) (const char *, uid_t, gid_t);
     int (*truncate) (const char *, off_t);
     int (*utime) (const char *, struct utimbuf *);
-    int (*open) (const char *, struct fuse_file_info *);
-    int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *);
+    int (*open) (const char *, struct fuse_file_info_compat22 *);
+    int (*read) (const char *, char *, size_t, off_t,
+                 struct fuse_file_info_compat22 *);
     int (*write) (const char *, const char *, size_t, off_t,
-                  struct fuse_file_info *);
+                  struct fuse_file_info_compat22 *);
     int (*statfs) (const char *, struct statfs *);
-    int (*flush) (const char *, struct fuse_file_info *);
-    int (*release) (const char *, struct fuse_file_info *);
-    int (*fsync) (const char *, int, struct fuse_file_info *);
+    int (*flush) (const char *, struct fuse_file_info_compat22 *);
+    int (*release) (const char *, struct fuse_file_info_compat22 *);
+    int (*fsync) (const char *, int, struct fuse_file_info_compat22 *);
     int (*setxattr) (const char *, const char *, const char *, size_t, int);
     int (*getxattr) (const char *, const char *, char *, size_t);
     int (*listxattr) (const char *, char *, size_t);
     int (*removexattr) (const char *, const char *);
-    int (*opendir) (const char *, struct fuse_file_info *);
+    int (*opendir) (const char *, struct fuse_file_info_compat22 *);
     int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
-                    struct fuse_file_info *);
-    int (*releasedir) (const char *, struct fuse_file_info *);
-    int (*fsyncdir) (const char *, int, struct fuse_file_info *);
+                    struct fuse_file_info_compat22 *);
+    int (*releasedir) (const char *, struct fuse_file_info_compat22 *);
+    int (*fsyncdir) (const char *, int, struct fuse_file_info_compat22 *);
     void *(*init) (void);
     void (*destroy) (void *);
-    int (*access) (const char *, int);
-    int (*create) (const char *, mode_t, struct fuse_file_info *);
-    int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
-    int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
-    void (*statfs_new) (void);
 };
 
-static inline int fuse_main_compat22(int argc, char *argv[],
-                                     const struct fuse_operations_compat22 *op)
-{
-    return fuse_main_real(argc, argv, (const struct fuse_operations *) op,
-                          sizeof(*op));
-}
+struct fuse *fuse_new_compat22(int fd, const char *opts,
+                               const struct fuse_operations_compat22 *op,
+                               size_t op_size);
 
+struct fuse *fuse_setup_compat22(int argc, char *argv[],
+                                 const struct fuse_operations_compat22 *op,
+                                 size_t op_size, char **mountpoint,
+                                 int *multithreaded, int *fd);
+
+int fuse_main_real_compat22(int argc, char *argv[],
+                            const struct fuse_operations_compat22 *op,
+                            size_t op_size);
 
 typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int type);
 struct fuse_operations_compat2 {
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index d2b43a2..aa1e453 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -1211,13 +1211,12 @@
  * ----------------------------------------------------------- */
 
 #if FUSE_USE_VERSION == 24
-#include <sys/statfs.h>
-
-int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf);
-
+#include "fuse_lowlevel_compat.h"
 #undef FUSE_MINOR_VERSION
 #define FUSE_MINOR_VERSION 4
+#define fuse_file_info fuse_file_info_compat
 #define fuse_reply_statfs fuse_reply_statfs_compat
+#define fuse_reply_open fuse_reply_open_compat
 
 #elif FUSE_USE_VERSION < 25
 #  error Compatibility with low level API version other than 24 not supported
diff --git a/include/fuse_lowlevel_compat.h b/include/fuse_lowlevel_compat.h
new file mode 100644
index 0000000..c2bd3c1
--- /dev/null
+++ b/include/fuse_lowlevel_compat.h
@@ -0,0 +1,25 @@
+/*
+    FUSE: Filesystem in Userspace
+    Copyright (C) 2001-2005  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! */
+
+#include <sys/statfs.h>
+
+struct fuse_file_info_compat {
+    int flags;
+    unsigned long fh;
+    int writepage;
+    unsigned int direct_io : 1;
+    unsigned int keep_cache : 1;
+};
+
+int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf);
+
+int fuse_reply_open_compat(fuse_req_t req,
+                           const struct fuse_file_info_compat *fi);
diff --git a/lib/fuse.c b/lib/fuse.c
index f3bec93..5c5eb0a 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -21,7 +21,6 @@
 #include <limits.h>
 #include <errno.h>
 #include <assert.h>
-#include <stdint.h>
 #include <pthread.h>
 #include <sys/param.h>
 #include <sys/uio.h>
@@ -106,7 +105,7 @@
     unsigned size;
     unsigned needlen;
     int filled;
-    unsigned long fh;
+    uint64_t fh;
     int error;
     fuse_ino_t nodeid;
 };
@@ -142,8 +141,8 @@
 {
     struct node *node = get_node_nocheck(f, nodeid);
     if (!node) {
-        fprintf(stderr, "fuse internal error: node %lu not found\n",
-                nodeid);
+        fprintf(stderr, "fuse internal error: node %llu not found\n",
+                (unsigned long long) nodeid);
         abort();
     }
     return node;
@@ -203,8 +202,8 @@
                 node->parent = 0;
                 return;
             }
-        fprintf(stderr, "fuse internal error: unable to unhash node: %lu\n",
-                node->nodeid);
+        fprintf(stderr, "fuse internal error: unable to unhash node: %llu\n",
+                (unsigned long long) node->nodeid);
         abort();
     }
 }
@@ -227,7 +226,7 @@
 static void delete_node(struct fuse *f, struct node *node)
 {
     if (f->flags & FUSE_DEBUG) {
-        printf("delete: %lu\n", node->nodeid);
+        printf("delete: %llu\n", (unsigned long long) node->nodeid);
         fflush(stdout);
     }
     assert(!node->name);
@@ -619,7 +618,7 @@
 {
     struct fuse *f = req_fuse(req);
     if (f->flags & FUSE_DEBUG) {
-        printf("FORGET %lu/%lu\n", ino, nlookup);
+        printf("FORGET %llu/%lu\n", (unsigned long long) ino, nlookup);
         fflush(stdout);
     }
     forget_node(f, ino, nlookup);
@@ -1016,8 +1015,8 @@
             err = f->op.create(path, mode, fi);
             if (!err) {
                 if (f->flags & FUSE_DEBUG) {
-                    printf("CREATE[%lu] flags: 0x%x %s\n", fi->fh, fi->flags,
-                           path);
+                    printf("CREATE[%llu] flags: 0x%x %s\n",
+                           (unsigned long long) fi->fh, fi->flags, path);
                     fflush(stdout);
                 }
                 err = lookup_path(f, parent, name, path, &e, fi);
@@ -1073,13 +1072,20 @@
         if (path != NULL) {
             if (!f->compat)
                 err = f->op.open(path, fi);
-            else
+            else if (f->compat == 22) {
+                struct fuse_file_info_compat22 tmp;
+                memcpy(&tmp, fi, sizeof(tmp));
+                err = ((struct fuse_operations_compat22 *) &f->op)->open(path, &tmp);
+                memcpy(fi, &tmp, sizeof(tmp));
+                fi->fh = tmp.fh;
+            } else
                 err = ((struct fuse_operations_compat2 *) &f->op)->open(path, fi->flags);
         }
     }
     if (!err) {
         if (f->flags & FUSE_DEBUG) {
-            printf("OPEN[%lu] flags: 0x%x\n", fi->fh, fi->flags);
+            printf("OPEN[%llu] flags: 0x%x\n", (unsigned long long) fi->fh,
+                   fi->flags);
             fflush(stdout);
         }
 
@@ -1092,7 +1098,7 @@
         if (fuse_reply_open(req, fi) == -ENOENT) {
             /* The open syscall was interrupted, so it must be cancelled */
             if(f->op.release && path != NULL) {
-                if (!f->compat)
+                if (!f->compat || f->compat >= 22)
                     f->op.release(path, fi);
                 else
                     ((struct fuse_operations_compat2 *) &f->op)->release(path, fi->flags);
@@ -1129,7 +1135,8 @@
     path = get_path(f, ino);
     if (path != NULL) {
         if (f->flags & FUSE_DEBUG) {
-            printf("READ[%lu] %u bytes from %llu\n", fi->fh, size, off);
+            printf("READ[%llu] %u bytes from %llu\n",
+                   (unsigned long long) fi->fh, size, off);
             fflush(stdout);
         }
 
@@ -1142,7 +1149,8 @@
 
     if (res >= 0) {
         if (f->flags & FUSE_DEBUG) {
-            printf("   READ[%lu] %u bytes\n", fi->fh, res);
+            printf("   READ[%llu] %u bytes\n", (unsigned long long) fi->fh,
+                   res);
             fflush(stdout);
         }
         if ((size_t) res > size)
@@ -1166,8 +1174,9 @@
     path = get_path(f, ino);
     if (path != NULL) {
         if (f->flags & FUSE_DEBUG) {
-            printf("WRITE%s[%lu] %u bytes to %llu\n",
-                   fi->writepage ? "PAGE" : "", fi->fh, size, off);
+            printf("WRITE%s[%llu] %u bytes to %llu\n",
+                   fi->writepage ? "PAGE" : "", (unsigned long long) fi->fh,
+                   size, off);
             fflush(stdout);
         }
 
@@ -1180,8 +1189,9 @@
 
     if (res >= 0) {
         if (f->flags & FUSE_DEBUG) {
-            printf("   WRITE%s[%lu] %u bytes\n",
-                   fi->writepage ? "PAGE" : "", fi->fh, res);
+            printf("   WRITE%s[%llu] %u bytes\n",
+                   fi->writepage ? "PAGE" : "", (unsigned long long) fi->fh,
+                   res);
             fflush(stdout);
         }
         if ((size_t) res > size)
@@ -1203,7 +1213,7 @@
     path = get_path(f, ino);
     if (path != NULL) {
         if (f->flags & FUSE_DEBUG) {
-            printf("FLUSH[%lu]\n", fi->fh);
+            printf("FLUSH[%llu]\n", (unsigned long long) fi->fh);
             fflush(stdout);
         }
         err = -ENOSYS;
@@ -1233,11 +1243,12 @@
     pthread_rwlock_rdlock(&f->tree_lock);
     path = get_path(f, ino);
     if (f->flags & FUSE_DEBUG) {
-        printf("RELEASE[%lu] flags: 0x%x\n", fi->fh, fi->flags);
+        printf("RELEASE[%llu] flags: 0x%x\n", (unsigned long long) fi->fh,
+               fi->flags);
         fflush(stdout);
     }
     if (f->op.release) {
-        if (!f->compat)
+        if (!f->compat || f->compat >= 22)
             f->op.release(path ? path : "-", fi);
         else if (path)
             ((struct fuse_operations_compat2 *) &f->op)->release(path, fi->flags);
@@ -1265,7 +1276,7 @@
     path = get_path(f, ino);
     if (path != NULL) {
         if (f->flags & FUSE_DEBUG) {
-            printf("FSYNC[%lu]\n", fi->fh);
+            printf("FSYNC[%llu]\n", (unsigned long long) fi->fh);
             fflush(stdout);
         }
         err = -ENOSYS;
@@ -1280,7 +1291,7 @@
 static struct fuse_dirhandle *get_dirhandle(const struct fuse_file_info *llfi,
                                             struct fuse_file_info *fi)
 {
-    struct fuse_dirhandle *dh = (struct fuse_dirhandle *) llfi->fh;
+    struct fuse_dirhandle *dh = (struct fuse_dirhandle *) (uintptr_t) llfi->fh;
     memset(fi, 0, sizeof(struct fuse_file_info));
     fi->fh = dh->fh;
     return dh;
@@ -1305,7 +1316,7 @@
     dh->nodeid = ino;
     mutex_init(&dh->lock);
 
-    llfi->fh = (unsigned long) dh;
+    llfi->fh = (uintptr_t) dh;
 
     if (f->op.opendir) {
         struct fuse_file_info fi;
@@ -1319,8 +1330,15 @@
         pthread_rwlock_rdlock(&f->tree_lock);
         path = get_path(f, ino);
         if (path != NULL) {
-            err = f->op.opendir(path, &fi);
-            dh->fh = fi.fh;
+            if (!f->compat) {
+                err = f->op.opendir(path, &fi);
+                dh->fh = fi.fh;
+            } else {
+                struct fuse_file_info_compat22 tmp;
+                memcpy(&tmp, &fi, sizeof(tmp));
+                err = ((struct fuse_operations_compat22 *) &f->op)->opendir(path, &tmp);
+                dh->fh = tmp.fh;
+            }
         }
         if (!err) {
             pthread_mutex_lock(&f->lock);
@@ -1565,9 +1583,9 @@
 
     memset(&buf, 0, sizeof(buf));
     if (f->op.statfs) {
-        err = f->op.statfs("/", &buf);
-    } else if (f->op.statfs_old) {
-        if (!f->compat || f->compat > 11) {
+        if (!f->compat) {
+            err = f->op.statfs("/", &buf);
+        } else if (f->compat > 11) {
             struct statfs oldbuf;
             err = ((struct fuse_operations_compat22 *) &f->op)->statfs("/", &oldbuf);
             if (!err)
@@ -2023,6 +2041,14 @@
     return fuse_new_common(fd, opts, op, op_size, 0);
 }
 
+struct fuse *fuse_new_compat22(int fd, const char *opts,
+                               const struct fuse_operations_compat22 *op,
+                               size_t op_size)
+{
+    return fuse_new_common(fd, opts, (struct fuse_operations *) op,
+                           op_size, 22);
+}
+
 struct fuse *fuse_new_compat2(int fd, const char *opts,
                               const struct fuse_operations_compat2 *op)
 {
@@ -2077,3 +2103,4 @@
 __asm__(".symver fuse_read_cmd,__fuse_read_cmd@");
 __asm__(".symver fuse_set_getcontext_func,__fuse_set_getcontext_func@");
 __asm__(".symver fuse_new_compat2,fuse_new@");
+__asm__(".symver fuse_new_compat22,fuse_new@FUSE_2.2");
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index ad6b241..f2ac121 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -8,6 +8,7 @@
 
 #include <config.h>
 #include "fuse_lowlevel.h"
+#include "fuse_lowlevel_compat.h"
 #include "fuse_kernel.h"
 
 #include <stdio.h>
@@ -16,7 +17,6 @@
 #include <unistd.h>
 #include <limits.h>
 #include <errno.h>
-#include <stdint.h>
 #include <sys/statfs.h>
 
 #define PARAM(inarg) (((char *)(inarg)) + sizeof(*(inarg)))
@@ -268,6 +268,16 @@
         arg->open_flags |= FOPEN_KEEP_CACHE;
 }
 
+static void fill_open_compat(struct fuse_open_out *arg,
+                      const struct fuse_file_info_compat *f)
+{
+    arg->fh = f->fh;
+    if (f->direct_io)
+        arg->open_flags |= FOPEN_DIRECT_IO;
+    if (f->keep_cache)
+        arg->open_flags |= FOPEN_KEEP_CACHE;
+}
+
 int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e)
 {
     struct fuse_entry_out arg;
@@ -318,6 +328,16 @@
     return send_reply_ok(req, &arg, sizeof(arg));
 }
 
+int fuse_reply_open_compat(fuse_req_t req,
+                           const struct fuse_file_info_compat *f)
+{
+    struct fuse_open_out arg;
+
+    memset(&arg, 0, sizeof(arg));
+    fill_open_compat(&arg, f);
+    return send_reply_ok(req, &arg, sizeof(arg));
+}
+
 int fuse_reply_write(fuse_req_t req, size_t count)
 {
     struct fuse_write_out arg;
@@ -400,6 +420,7 @@
             memset(&fi_store, 0, sizeof(fi_store));
             fi = &fi_store;
             fi->fh = arg->fh;
+            fi->fh_old = fi->fh;
         }
         req->f->op.setattr(req, nodeid, &stbuf, arg->valid, fi);
     } else
@@ -523,6 +544,7 @@
 
         memset(&fi, 0, sizeof(fi));
         fi.fh = arg->fh;
+        fi.fh_old = fi.fh;
         req->f->op.read(req, nodeid, arg->size, arg->offset, &fi);
     } else
         fuse_reply_err(req, ENOSYS);
@@ -535,6 +557,7 @@
 
     memset(&fi, 0, sizeof(fi));
     fi.fh = arg->fh;
+    fi.fh_old = fi.fh;
     fi.writepage = arg->write_flags & 1;
 
     if (req->f->op.write)
@@ -551,6 +574,7 @@
 
     memset(&fi, 0, sizeof(fi));
     fi.fh = arg->fh;
+    fi.fh_old = fi.fh;
 
     if (req->f->op.flush)
         req->f->op.flush(req, nodeid, &fi);
@@ -566,6 +590,7 @@
     memset(&fi, 0, sizeof(fi));
     fi.flags = arg->flags;
     fi.fh = arg->fh;
+    fi.fh_old = fi.fh;
 
     if (req->f->op.release)
         req->f->op.release(req, nodeid, &fi);
@@ -580,6 +605,7 @@
 
     memset(&fi, 0, sizeof(fi));
     fi.fh = inarg->fh;
+    fi.fh_old = fi.fh;
 
     if (req->f->op.fsync)
         req->f->op.fsync(req, nodeid, inarg->fsync_flags & 1, &fi);
@@ -608,6 +634,7 @@
 
     memset(&fi, 0, sizeof(fi));
     fi.fh = arg->fh;
+    fi.fh_old = fi.fh;
 
     if (req->f->op.readdir)
         req->f->op.readdir(req, nodeid, arg->size, arg->offset, &fi);
@@ -623,6 +650,7 @@
     memset(&fi, 0, sizeof(fi));
     fi.flags = arg->flags;
     fi.fh = arg->fh;
+    fi.fh_old = fi.fh;
 
     if (req->f->op.releasedir)
         req->f->op.releasedir(req, nodeid, &fi);
@@ -637,6 +665,7 @@
 
     memset(&fi, 0, sizeof(fi));
     fi.fh = inarg->fh;
+    fi.fh_old = fi.fh;
 
     if (req->f->op.fsyncdir)
         req->f->op.fsyncdir(req, nodeid, inarg->fsync_flags & 1, &fi);
@@ -936,7 +965,6 @@
     free(f);
 }
 
-
 struct fuse_session *fuse_lowlevel_new(const char *opts,
                                        const struct fuse_lowlevel_ops *op,
                                        size_t op_size, void *userdata)
@@ -979,3 +1007,4 @@
 }
 
 __asm__(".symver fuse_reply_statfs_compat,fuse_reply_statfs@FUSE_2.4");
+__asm__(".symver fuse_reply_open_compat,fuse_reply_open@FUSE_2.4");
diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript
index 9f17c99..f3f4e21 100644
--- a/lib/fuse_versionscript
+++ b/lib/fuse_versionscript
@@ -12,16 +12,13 @@
 		fuse_main;
 		fuse_main_compat1;
 		fuse_main_compat2;
-		fuse_main_real;
 		fuse_mount;
 		fuse_mount_compat1;
-		fuse_new;
 		fuse_new_compat1;
 		fuse_new_compat2;
 		fuse_process_cmd;
 		fuse_read_cmd;
 		fuse_set_getcontext_func;
-		fuse_setup;
 		fuse_setup_compat2;
 		fuse_teardown;
 		fuse_unmount;
@@ -47,7 +44,6 @@
 		fuse_reply_entry;
 		fuse_reply_err;
 		fuse_reply_none;
-		fuse_reply_open;
 		fuse_reply_readlink;
 		fuse_reply_write;
 		fuse_reply_xattr;
@@ -67,9 +63,17 @@
 
 FUSE_2.5 {
 	global:
-		fuse_reply_statfs;
+		fuse_main_real;
+		fuse_main_real_compat22;
+		fuse_new;
+		fuse_new_compat22;
 		fuse_reply_create;
+		fuse_reply_open;
+		fuse_reply_open_compat;
+		fuse_reply_statfs;
 		fuse_reply_statfs_compat;
+		fuse_setup;
+		fuse_setup_compat22;
 
 	local:
 		 *;
diff --git a/lib/helper.c b/lib/helper.c
index 89cd7a8..d8a522f 100644
--- a/lib/helper.c
+++ b/lib/helper.c
@@ -353,6 +353,15 @@
                              multithreaded, fd, 0);
 }
 
+struct fuse *fuse_setup_compat22(int argc, char *argv[],
+                                 const struct fuse_operations_compat22 *op,
+                                 size_t op_size, char **mountpoint,
+                                 int *multithreaded, int *fd)
+{
+    return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
+                             op_size, mountpoint, multithreaded, fd, 22);
+}
+
 struct fuse *fuse_setup_compat2(int argc, char *argv[],
                                  const struct fuse_operations_compat2 *op,
                                  char **mountpoint, int *multithreaded,
@@ -410,6 +419,14 @@
     return fuse_main_common(argc, argv, op, op_size, 0);
 }
 
+int fuse_main_real_compat22(int argc, char *argv[],
+                            const struct fuse_operations_compat22 *op,
+                            size_t op_size)
+{
+    return fuse_main_common(argc, argv, (struct fuse_operations *) op,
+                            op_size, 22);
+}
+
 #undef fuse_main
 int fuse_main(void)
 {
@@ -432,5 +449,7 @@
 }
 
 __asm__(".symver fuse_setup_compat2,__fuse_setup@");
+__asm__(".symver fuse_setup_compat22,fuse_setup@FUSE_2.2");
 __asm__(".symver fuse_teardown,__fuse_teardown@");
 __asm__(".symver fuse_main_compat2,fuse_main@");
+__asm__(".symver fuse_main_real_compat22,fuse_main_real@FUSE_2.2");