tech-userlevel archive

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

More compatibility for refuse



hi folks,

this adds the version of fuse_mount, fuse_new, fuse_unmount between FUSE
2.2 and FUSE 3.0 as compat shims.

This is used by fuse-ntfs-3g, fuse-encfs.

This also adds fuse_version. This is used by fuse-ext2 that is being
patched in pkgsrc.

Tell me what you think. I will commit it soon otherwise.

I had to add FUSE_USE_VERSION 30 to refuse.c so I could use the real
definitions. I don't want to bump it, I think it makes ntfs-3g harder to
compile.

I can build an older version of ntfs-3g from 6 years ago, but I have
trouble with the current one, since it has a 'lowntfs-3g' that seems
toduplicate some stuff and want a lot of different interfaces.

I don't know where I would find an NTFS filesystem, though, to test it.
Provide the definitions of fuse_mount, fuse_unmount, fuse_new before
FUSE 3.0.0.

Index: fuse.h
===================================================================
RCS file: /cvsroot/src/lib/librefuse/fuse.h,v
retrieving revision 1.22
diff -u -r1.22 fuse.h
--- fuse.h	20 Nov 2016 13:28:32 -0000	1.22
+++ fuse.h	10 Apr 2019 14:03:44 -0000
@@ -78,6 +78,9 @@
 	void		*private_data;
 };
 
+struct fuse_chan {
+};
+
 /**
  * Argument list
  */
@@ -153,9 +156,18 @@
 struct fuse *fuse_new(struct fuse_args *,
 	const struct fuse_operations *, size_t, void *);
 
+#if FUSE_USE_VERSION < 30
+#define fuse_new fuse_new_compat30
+#endif
+
+struct fuse *fuse_new_compat30(struct fuse_chan *, struct fuse_args *,
+	const struct fuse_operations *, size_t, void *);
+
 int fuse_mount(struct fuse *, const char *);
 void fuse_unmount(struct fuse *);
 
+int fuse_version(void);
+
 int fuse_daemonize(struct fuse *);
 
 int fuse_main_real(int, char **, const struct fuse_operations *, size_t, void *);
@@ -164,6 +176,12 @@
 void fuse_exit(struct fuse *);
 void fuse_destroy(struct fuse *);
 
+#if FUSE_USE_VERSION < 30
+#define fuse_unmount fuse_unmount_compat30
+#endif
+
+void fuse_unmount_compat30(const char *, struct fuse_chan *);
+
 #if FUSE_USE_VERSION == 22
 #define fuse_unmount fuse_unmount_compat22
 #endif
Index: refuse.c
===================================================================
RCS file: /cvsroot/src/lib/librefuse/refuse.c,v
retrieving revision 1.98
diff -u -r1.98 refuse.c
--- refuse.c	20 Nov 2016 13:28:32 -0000	1.98
+++ refuse.c	10 Apr 2019 14:03:44 -0000
@@ -39,6 +39,7 @@
 #include <assert.h>
 #include <err.h>
 #include <errno.h>
+#define FUSE_USE_VERSION 30
 #include <fuse.h>
 #include <fuse_lowlevel.h>
 #include <fuse_opt.h>
@@ -1322,6 +1323,13 @@
 	free(config.fsname);
 	return fuse;
 }
+struct fuse *
+fuse_new_compat30(struct fuse_chan *fc, struct fuse_args *args,
+	const struct fuse_operations *ops, size_t size, void *userdata)
+{
+
+	return fuse_new(args, ops, size, userdata);
+}
 
 int
 fuse_loop(struct fuse *fuse)
@@ -1368,8 +1376,22 @@
 
 /*ARGSUSED*/
 void
+fuse_unmount_compat30(const char *mp, struct fuse_chan *fc)
+{
+
+	return;
+}
+
+/*ARGSUSED*/
+void
 fuse_unmount_compat22(const char *mp)
 {
 
 	return;
 }
+
+int
+fuse_version(void)
+{
+	return FUSE_USE_VERSION;
+}


Home | Main Index | Thread Index | Old Index