tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: refuse: fuse_setup 26 incompatibility



On Sat, Jul 05, 2008 at 10:55:18AM +0100, Alistair Crooks wrote:
> On Fri, Jul 04, 2008 at 08:59:45PM +0200, Dieter Baron wrote:
> >   Should I leave fuse_setup as is, add a fuse_setup26 and use a 
> >     #define fuse_setup      fuse_setup26
> > when the 26 API is requested?
> 
> Yes, I thought that was what you had done with the fuse_setup_real
> bits, but I must have misread your change.

  Done, see the attached patch.

> >   BTW, refuse defaults to API version 26, fuse defaults to 25.  Should
> > e fix this also, so programs that use the old fuse_setup version and
> > don't define FUSE_USE_VERSION still compile?
> 
> Until you mentioned it, I wasn't aware of any significant difference
> between 2.5 and 2.6 - the reference interface used when creating
> ReFUSE was the 2.6 one, so I'd prefer to keep ReFUSE at 2.6, to save
> us being bitten in the backside by anything else that's been missed.
> It also saves us from unnecessary churn. ReFUSE has been in-tree for
> 17 months now, so we should have noticed any anomalies by now - yours
> being the obvious exception.

  As you wish.  Note, however, that we may now be bitten by
applications that expect the 2.5 version of fuse_setup without
defining FUSE_USE_VERSION (which they get with Linux's fuse, and which
they got with refuse before this change).

> What FUSE file system did you find this
> with?

  fuse-zip, http://fuse-zip.googlecode.com/

                                        yours,
                                        dillo
Index: fuse.h
===================================================================
RCS file: /cvsroot/src/lib/librefuse/fuse.h,v
retrieving revision 1.20
diff -u -r1.20 fuse.h
--- fuse.h      14 Jan 2008 20:46:11 -0000      1.20
+++ fuse.h      6 Jul 2008 13:54:20 -0000
@@ -175,11 +175,15 @@
 #if FUSE_USE_VERSION >= 26
 #define fuse_main(argc, argv, op, arg) \
             fuse_main_real(argc, argv, op, sizeof(*(op)), arg)
+#define fuse_setup     fuse_setup26
 #else
 #define fuse_main(argc, argv, op) \
             fuse_main_real(argc, argv, op, sizeof(*(op)), NULL)
 #endif
 
+struct fuse *fuse_setup26(int, char **, const struct fuse_operations *,
+       size_t, char **, int *, void *);
+
 #ifdef __cplusplus
 }
 #endif
Index: refuse.c
===================================================================
RCS file: /cvsroot/src/lib/librefuse/refuse.c,v
retrieving revision 1.88
diff -u -r1.88 refuse.c
--- refuse.c    14 Jan 2008 16:07:00 -0000      1.88
+++ refuse.c    6 Jul 2008 13:54:20 -0000
@@ -364,9 +364,10 @@
 
 
 /* this function exposes struct fuse to userland */
-struct fuse *
-fuse_setup(int argc, char **argv, const struct fuse_operations *ops,
-       size_t size, char **mountpoint, int *multithreaded, int *fd)
+static struct fuse *
+fuse_setup_real(int argc, char **argv, const struct fuse_operations *ops,
+       size_t size, char **mountpoint, int *multithreaded, int *fd,
+        void *user_data)
 {
        struct fuse_chan        *fc;
        struct fuse_args        *args;
@@ -397,7 +398,7 @@
        }
 
        fc = fuse_mount(*mountpoint = argv[i], args);
-       fuse = fuse_new(fc, args, ops, size, NULL);
+       fuse = fuse_new(fc, args, ops, size, user_data);
 
        fuse_opt_free_args(args);
        free(args);
@@ -415,6 +416,26 @@
        return fuse;
 }
 
+#ifdef fuse_setup
+#undef fuse_setup
+#endif
+
+struct fuse *
+fuse_setup(int argc, char **argv, const struct fuse_operations *ops,
+       size_t size, char **mountpoint, int *multithreaded, int *fd)
+{
+    return fuse_setup_real(argc, argv, ops, size, mountpoint,
+       multithreaded, fd, NULL);
+}
+
+struct fuse *
+fuse_setup26(int argc, char **argv, const struct fuse_operations *ops,
+       size_t size, char **mountpoint, int *multithreaded, void *user_data)
+{
+    return fuse_setup_real(argc, argv, ops, size, mountpoint,
+       multithreaded, NULL, user_data);
+}
+
 #define FUSE_ERR_UNLINK(fuse, file) if (fuse->op.unlink) fuse->op.unlink(file)
 #define FUSE_ERR_RMDIR(fuse, dir) if (fuse->op.rmdir) fuse->op.rmdir(dir)
 


Home | Main Index | Thread Index | Old Index