On Wed, Dec 09, 2015 at 12:15:26PM +0100, Jean-Pierre André wrote: > Maybe, but ENODATA is defined by Posix as optional...
ENODATA would be consistent with ntfs_get_ntfs_reparse_data(), which also uses ENODATA. include/ntfs-3g/compat.h already defines ENODATA to ENOENT if it isn't already defined. > Not done (yet ?). There are more exceptions now. > I agree this should be improved, but have to find > out how. In which cases doesn't the macro work? > > - Perhaps it should be possible to disable external plugins at build time > > as a > > ./configure option? > Done. This obfuscates the code even more. I actually had in mind that only *external* plugins would be disable-able. I expect that dynamic loading is the main part which people may want to disable. The internal plugins for symlinks and junctions can still be enabled by default; ntfs-3g already supported such files, after all. With that approach, nearly all the '#ifdef PLUGINS_ENABLED' aren't needed. I think there would only need to be one #ifdef around the part that opens a plugin with dlopen() and dlsym(), and one #ifdef around the part that does dlclose(). > > There are at least three problems with this : > > - if I force a new option on ./configure, some > > distributions will give up. There are distros > > which are still releasing versions from before > > the ntfsprogs were merged into ntfs-3g. > >- AFAIK the standard library directory is not known > > at compile time, and I do not known how to get it > > at execution time. > >- if the plugin directory is defined as an absolute > > path in a configure option, I cannot test a new > > release without installing it (or executing some > > specific code in test mode, like a car manufacturer) > > Unless a better way is found, ./configure with no > new option will not enable the reparse plugins. One option is to set the plugin directory as "$(libdir)/ntfs-3g" in src/Makefile.am and pass it as a compiler flag. That will honor the packager's choice of prefix and library directory, although the plugin directory itself would not be directly configurable. There also would need to be an install hook added to create the empty plugin directory. As far as I know, the plugin directory will have to be named by an absolute path (as the above suggestion does) if there is going to be a plugin directory at all. As you pointed out, that doesn't work for "testing without installing". There may not be a good way around that. There could be a configure option that enables a fallback where the plugin name with no path component is tried if the plugin is not found in the plugin directory. That would allow use of LD_LIBRARY_PATH. But I don't think that should be done by default, especially if external plugins are to be enabled by default. I attached a patch for configure.ac and src/Makefile.am to consider. Note that I made the plugins enabled by default, but the decision is up to you. > > - Perhaps plugin_list_t should be made private to src/ntfs-3g_common.c? I > > don't > > think other files should care about how the list is implemented. The > > function > > to register a new plugin can return 0 on success or -1 with errno set on > > failure. > Debatable : the head of the list is in the context > used by ntfs-3g.c Since it's a pointer, the struct can be forward declared (in a similar manner to how things like ntfs_inode are forward-declared in some headers). Eric
diff --git a/configure.ac b/configure.ac index c2cf8cd..b83e4f5 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,14 @@ AC_ARG_ENABLE( ) AC_ARG_ENABLE( + [plugins], + [AS_HELP_STRING([--disable-plugins], [Disable external reparse point + plugins for the ntfs-3g FUSE driver])], + , + [enable_plugins="yes"] +) + +AC_ARG_ENABLE( [device-default-io-ops], [AS_HELP_STRING([--disable-device-default-io-ops],[install default IO ops])], , @@ -617,6 +625,7 @@ AM_CONDITIONAL([ENABLE_NTFS_3G], [test "${enable_ntfs_3g}" = "yes"]) AM_CONDITIONAL([ENABLE_NTFSPROGS], [test "${enable_ntfsprogs}" = "yes"]) AM_CONDITIONAL([ENABLE_EXTRAS], [test "${enable_extras}" = "yes"]) AM_CONDITIONAL([ENABLE_QUARANTINED], [test "${enable_quarantined}" = "yes"]) +AM_CONDITIONAL([ENABLE_PLUGINS], [test "${enable_plugins}" = "yes"]) # workaround for <autoconf-2.60 if test -z "${docdir}"; then diff --git a/src/Makefile.am b/src/Makefile.am index 7fd4af4..64844d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,6 +11,11 @@ FUSE_CFLAGS = $(FUSE_MODULE_CFLAGS) FUSE_LIBS = $(FUSE_MODULE_LIBS) endif +if ENABLE_PLUGINS +plugindir = $(libdir)/ntfs-3g +PLUGIN_CFLAGS = -DPLUGIN_DIR="$(plugindir)" +endif + if ENABLE_NTFS_3G bin_PROGRAMS = ntfs-3g.probe \ @@ -22,7 +27,7 @@ man_MANS = ntfs-3g.8 ntfs-3g.probe.8 \ ntfs-3g.usermap.8 \ ntfs-3g.secaudit.8 -ntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la +ntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la if REALLYSTATIC ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static endif @@ -30,10 +35,11 @@ ntfs_3g_CFLAGS = \ $(AM_CFLAGS) \ -DFUSE_USE_VERSION=26 \ $(FUSE_CFLAGS) \ - -I$(top_srcdir)/include/ntfs-3g + -I$(top_srcdir)/include/ntfs-3g \ + $(PLUGIN_CFLAGS) ntfs_3g_SOURCES = ntfs-3g.c ntfs-3g_common.c -lowntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la +lowntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la if REALLYSTATIC lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static endif @@ -41,7 +47,8 @@ lowntfs_3g_CFLAGS = \ $(AM_CFLAGS) \ -DFUSE_USE_VERSION=26 \ $(FUSE_CFLAGS) \ - -I$(top_srcdir)/include/ntfs-3g + -I$(top_srcdir)/include/ntfs-3g \ + $(PLUGIN_CFLAGS) lowntfs_3g_SOURCES = lowntfs-3g.c ntfs-3g_common.c ntfs_3g_probe_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la @@ -61,10 +68,13 @@ ntfs_3g_secaudit_SOURCES = secaudit.c drivers : $(FUSE_LIBS) ntfs-3g lowntfs-3g -if RUN_LDCONFIG install-exec-hook: +if RUN_LDCONFIG $(LDCONFIG) endif +if ENABLE_PLUGINS + $(MKDIR_P) $(DESTDIR)/$(plugindir) +endif if ENABLE_MOUNT_HELPER install-exec-local: install-rootbinPROGRAMS
------------------------------------------------------------------------------
_______________________________________________ ntfs-3g-devel mailing list ntfs-3g-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel