Hi, Please consider the following patch to simplify how reparse plugin support is configured. I had suggested this approach before and I do think it is a more maintainable approach. So here is a concrete patch:
By making symlinks and junctions always handled through internal plugins, we can eliminate much duplicate code and #ifdefs. The --disable-plugins configuration option is renamed to --disable-external-plugins and now only disables *external* (i.e. dynamically loaded) plugins. --- README | 2 +- configure.ac | 13 ++++---- src/Makefile.am | 4 +-- src/lowntfs-3g.c | 93 ---------------------------------------------------- src/ntfs-3g.c | 89 ------------------------------------------------- src/ntfs-3g_common.c | 20 +++++------ src/ntfs-3g_common.h | 10 ------ 7 files changed, 19 insertions(+), 212 deletions(-) diff --git a/README b/README index b829fd0..6f29012 100644 --- a/README +++ b/README @@ -62,7 +62,7 @@ typing : Below are a few specific options to ./configure : --disable-ntfsprogs : do not build the ntfsprogs tools, --enable-extras : build more ntfsprogs tools, - --disable-plugins : disable support for plugins + --disable-external-plugins : disable support for external plugins --enable-posix-acls : enable support for Posix ACLs --enable-xattr-mappings : enable system extended attributes mappings --with-fuse=external : use external fuse (overriding Linux default) diff --git a/configure.ac b/configure.ac index 644ae00..e99d58a 100644 --- a/configure.ac +++ b/configure.ac @@ -122,11 +122,11 @@ AC_ARG_ENABLE( ) AC_ARG_ENABLE( - [plugins], - [AS_HELP_STRING([--disable-plugins], [Disable external reparse point - plugins for the ntfs-3g FUSE driver])], + [external-plugins], + [AS_HELP_STRING([--disable-external-plugins], [disable external reparse + point plugins for the ntfs-3g FUSE driver])], , - [disable_plugins="no"] + [enable_external_plugins="yes"] ) AC_ARG_ENABLE( @@ -574,7 +574,8 @@ test "${enable_device_default_io_ops}" = "no" && AC_DEFINE( test "${enable_mtab}" = "no" && AC_DEFINE([IGNORE_MTAB], [1], [Don't update /etc/mtab]) test "${enable_posix_acls}" != "no" && AC_DEFINE([POSIXACLS], [1], [POSIX ACL support]) test "${enable_xattr_mappings}" != "no" && AC_DEFINE([XATTR_MAPPINGS], [1], [system extended attributes mappings]) -test "${disable_plugins}" != "no" && AC_DEFINE([DISABLE_PLUGINS], [1], [Define to 1 for disabling reparse plugins]) +test "${enable_external_plugins}" != "no" && AC_DEFINE([ENABLE_EXTERNAL_PLUGINS], [1], + [Define to 1 if you want to enable external reparse plugins]) test "${enable_really_static}" = "yes" && enable_library="no" test "${enable_library}" = "no" && enable_ldconfig="no" @@ -626,7 +627,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([DISABLE_PLUGINS], [test "${disable_plugins}" != "no"]) +AM_CONDITIONAL([ENABLE_EXTERNAL_PLUGINS], [test "${enable_external_plugins}" = "yes"]) # workaround for <autoconf-2.60 if test -z "${docdir}"; then diff --git a/src/Makefile.am b/src/Makefile.am index d689527..4036dff 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ FUSE_CFLAGS = $(FUSE_MODULE_CFLAGS) FUSE_LIBS = $(FUSE_MODULE_LIBS) endif -if !DISABLE_PLUGINS +if ENABLE_EXTERNAL_PLUGINS plugindir = $(libdir)/ntfs-3g PLUGIN_CFLAGS = -DPLUGIN_DIR=\"$(plugindir)\" endif @@ -60,7 +60,7 @@ install-exec-hook: if RUN_LDCONFIG $(LDCONFIG) endif -if !DISABLE_PLUGINS +if ENABLE_EXTERNAL_PLUGINS $(MKDIR_P) $(DESTDIR)/$(plugindir) endif diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 5439b10..f1ac26d 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -204,9 +204,7 @@ struct open_file { fuse_ino_t ino; fuse_ino_t parent; int state; -#ifndef PLUGINS_DISABLED struct fuse_file_info fi; -#endif /* PLUGINS_DISABLED */ } ; enum { @@ -619,7 +617,6 @@ static void ntfs_init(void *userdata __attribute__((unused)), #endif /* defined(FUSE_CAP_IOCTL_DIR) */ } -#ifndef PLUGINS_DISABLED /* * Define attributes for a junction or symlink @@ -678,8 +675,6 @@ static void apply_umask(struct stat *stbuf) } } -#endif /* PLUGINS_DISABLED */ - static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, ntfs_inode *ni, struct stat *stbuf) { @@ -693,7 +688,6 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, if ((ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) || (ni->flags & FILE_ATTR_REPARSE_POINT)) { if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -709,36 +703,6 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, res = 0; } goto ok; -#else /* PLUGINS_DISABLED */ - char *target; - int attr_size; - - errno = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, - &attr_size); - /* - * If the reparse point is not a valid - * directory junction, and there is no error - * we still display as a symlink - */ - if (target || (errno == EOPNOTSUPP)) { - /* returning attribute size */ - if (target) - stbuf->st_size = attr_size; - else - stbuf->st_size = - sizeof(ntfs_bad_reparse); - stbuf->st_blocks = - (ni->allocated_size + 511) >> 9; - stbuf->st_nlink = - le16_to_cpu(ni->mrec->link_count); - stbuf->st_mode = S_IFLNK; - free(target); - } else { - res = -errno; - goto exit; - } -#endif /* PLUGINS_DISABLED */ } else { /* Directory. */ stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); @@ -842,9 +806,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, } stbuf->st_mode |= (0777 & ~ctx->fmask); } -#ifndef PLUGINS_DISABLED ok: -#endif /* PLUGINS_DISABLED */ if (withusermapping) { if (ntfs_get_owner_mode(scx,ni,stbuf) < 0) set_fuse_error(&res); @@ -987,8 +949,6 @@ static void ntfs_fuse_lookup(fuse_req_t req, fuse_ino_t parent, fuse_reply_entry(req, &entry); } -#ifndef PLUGINS_DISABLED - /* * Get the link defined by a junction or symlink * (internal plugin) @@ -1015,8 +975,6 @@ static int junction_readlink(ntfs_inode *ni, return (res); } -#endif /* PLUGINS_DISABLED */ - static void ntfs_fuse_readlink(fuse_req_t req, fuse_ino_t ino) { ntfs_inode *ni = NULL; @@ -1035,7 +993,6 @@ static void ntfs_fuse_readlink(fuse_req_t req, fuse_ino_t ino) * Reparse point : analyze as a junction point */ if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1045,19 +1002,6 @@ static void ntfs_fuse_readlink(fuse_req_t req, fuse_ino_t ino) if (!buf) res = -errno; } -#else /* PLUGINS_DISABLED */ - int attr_size; - - errno = 0; - res = 0; - buf = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); - if (!buf) { - if (errno == EOPNOTSUPP) - buf = strdup(ntfs_bad_reparse); - if (!buf) - res = -errno; - } -#endif /* PLUGINS_DISABLED */ goto exit; } /* Sanity checks. */ @@ -1445,7 +1389,6 @@ static void ntfs_fuse_open(fuse_req_t req, fuse_ino_t ino, } #endif if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1454,9 +1397,6 @@ static void ntfs_fuse_open(fuse_req_t req, fuse_ino_t ino, if (!res && fi->fh) { state = CLOSE_REPARSE; } -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto close; } if ((res >= 0) @@ -1490,9 +1430,7 @@ close: of->parent = 0; of->ino = ino; of->state = state; -#ifdef PLUGIN_ENABLED memcpy(&of->fi, fi, sizeof(struct fuse_file_info)); -#endif /* PLUGIN_ENABLED */ of->next = ctx->open_files; of->previous = (struct open_file*)NULL; if (ctx->open_files) @@ -1534,7 +1472,6 @@ static void ntfs_fuse_read(fuse_req_t req, fuse_ino_t ino, size_t size, goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; struct open_file *of; @@ -1544,9 +1481,6 @@ static void ntfs_fuse_read(fuse_req_t req, fuse_ino_t ino, size_t size, if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); @@ -1585,9 +1519,7 @@ static void ntfs_fuse_read(fuse_req_t req, fuse_ino_t ino, size_t size, } ok: res = total; -#ifndef PLUGINS_DISABLED stamps : -#endif /* PLUGINS_DISABLED */ ntfs_fuse_update_times(ni, NTFS_UPDATE_ATIME); exit: if (na) @@ -1615,7 +1547,6 @@ static void ntfs_fuse_write(fuse_req_t req, fuse_ino_t ino, const char *buf, goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; struct open_file *of; @@ -1626,9 +1557,6 @@ static void ntfs_fuse_write(fuse_req_t req, fuse_ino_t ino, const char *buf, if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); @@ -1647,9 +1575,7 @@ static void ntfs_fuse_write(fuse_req_t req, fuse_ino_t ino, const char *buf, total += ret; } res = total; -#ifndef PLUGINS_DISABLED stamps : -#endif /* PLUGINS_DISABLED */ if ((res > 0) && (!ctx->dmtime || (sle64_to_cpu(ntfs_current_time()) @@ -1829,7 +1755,6 @@ static int ntfs_fuse_trunc(struct SECURITY_CONTEXT *scx, fuse_ino_t ino, } #endif if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1838,9 +1763,6 @@ static int ntfs_fuse_trunc(struct SECURITY_CONTEXT *scx, fuse_ino_t ino, set_archive(ni); goto stamps; } -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto exit; } /* @@ -1859,9 +1781,7 @@ static int ntfs_fuse_trunc(struct SECURITY_CONTEXT *scx, fuse_ino_t ino, if (oldsize != size) set_archive(ni); -#ifndef PLUGINS_DISABLED stamps : -#endif /* PLUGINS_DISABLED */ ntfs_fuse_update_times(ni, NTFS_UPDATE_MCTIME); res = ntfs_fuse_getstat(scx, ni, stbuf); errno = (res ? -res : 0); @@ -2785,7 +2705,6 @@ static void ntfs_fuse_release(fuse_req_t req, fuse_ino_t ino, goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -2793,10 +2712,6 @@ static void ntfs_fuse_release(fuse_req_t req, fuse_ino_t ino, if (!res) { goto stamps; } -#else /* PLUGINS_DISABLED */ - /* Assume release() was not needed */ - res = 0; -#endif /* PLUGINS_DISABLED */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); @@ -2811,9 +2726,7 @@ static void ntfs_fuse_release(fuse_req_t req, fuse_ino_t ino, if (of->state & CLOSE_ENCRYPTED) res = ntfs_efs_fixup_attribute(NULL, na); #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED stamps : -#endif /* PLUGINS_DISABLED */ if (of->state & CLOSE_DMTIME) ntfs_inode_update_times(ni,NTFS_UPDATE_MCTIME); exit: @@ -3810,7 +3723,6 @@ out : #endif #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED static void register_internal_reparse_plugins(void) { static const plugin_operations_t ops = { @@ -3822,7 +3734,6 @@ static void register_internal_reparse_plugins(void) register_reparse_plugin(ctx, IO_REPARSE_TAG_SYMLINK, &ops, (void*)NULL); } -#endif /* PLUGINS_DISABLED */ static void ntfs_close(void) { @@ -4438,9 +4349,7 @@ int main(int argc, char *argv[]) free(ctx->xattrmap_path); #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ -#ifndef PLUGINS_DISABLED register_internal_reparse_plugins(); -#endif /* PLUGINS_DISABLED */ se = mount_fuse(parsed_options); if (!se) { @@ -4477,9 +4386,7 @@ err_out: #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ err2: ntfs_close(); -#ifndef PLUGINS_DISABLED close_reparse_plugins(ctx); -#endif /* PLUGINS_DISABLED */ free(ctx); free(parsed_options); free(opts.options); diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 6b25f03..b5352b4 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -681,8 +681,6 @@ static void *ntfs_init(struct fuse_conn_info *conn) return NULL; } -#ifndef PLUGINS_DISABLED - /* * Define attributes for a junction or symlink * (internal plugin) @@ -740,8 +738,6 @@ static void apply_umask(struct stat *stbuf) } } -#endif /* PLUGINS_DISABLED */ - static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) { int res = 0; @@ -781,7 +777,6 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) || (ni->flags & FILE_ATTR_REPARSE_POINT)) && !stream_name_len) { if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -799,32 +794,6 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) goto ok; } goto exit; -#else /* PLUGINS_DISABLED */ - char *target; - int attr_size; - - errno = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); - /* - * If the reparse point is not a valid - * directory junction, and there is no error - * we still display as a symlink - */ - if (target || (errno == EOPNOTSUPP)) { - /* returning attribute size */ - if (target) - stbuf->st_size = attr_size; - else - stbuf->st_size = sizeof(ntfs_bad_reparse); - stbuf->st_blocks = (ni->allocated_size + 511) >> 9; - stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); - stbuf->st_mode = S_IFLNK; - free(target); - } else { - res = -errno; - goto exit; - } -#endif /* PLUGINS_DISABLED */ } else { /* Directory. */ stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); @@ -945,9 +914,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) } stbuf->st_mode |= (0777 & ~ctx->fmask); } -#ifndef PLUGINS_DISABLED ok: -#endif /* PLUGINS_DISABLED */ if (withusermapping) { if (ntfs_get_owner_mode(&security,ni,stbuf) < 0) set_fuse_error(&res); @@ -1003,8 +970,6 @@ exit: return res; } -#ifndef PLUGINS_DISABLED - /* * Get the link defined by a junction or symlink * (internal plugin) @@ -1031,8 +996,6 @@ static int junction_readlink(ntfs_inode *ni, return (res); } -#endif /* PLUGINS_DISABLED */ - static int ntfs_fuse_readlink(const char *org_path, char *buf, size_t buf_size) { char *path = NULL; @@ -1059,7 +1022,6 @@ static int ntfs_fuse_readlink(const char *org_path, char *buf, size_t buf_size) * Reparse point : analyze as a junction point */ if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED char *gotlink; const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1073,22 +1035,6 @@ static int ntfs_fuse_readlink(const char *org_path, char *buf, size_t buf_size) strncpy(buf, ntfs_bad_reparse, buf_size); res = 0; } -#else /* PLUGINS_DISABLED */ - char *target; - int attr_size; - - errno = 0; - res = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); - if (target) { - strncpy(buf,target,buf_size); - free(target); - } else - if (errno == EOPNOTSUPP) - strcpy(buf,ntfs_bad_reparse); - else - res = -errno; -#endif /* PLUGINS_DISABLED */ goto exit; } /* Sanity checks. */ @@ -1355,15 +1301,11 @@ static int ntfs_fuse_open(const char *org_path, } #endif if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; fi->fh = 0; res = CALL_REPARSE_PLUGIN(ni, open, fi); -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto close; } if ((res >= 0) @@ -1420,7 +1362,6 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1432,9 +1373,6 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1473,9 +1411,7 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, } ok: res = total; -#ifndef PLUGINS_DISABLED stamps: -#endif /* PLUGINS_DISABLED */ ntfs_fuse_update_times(ni, NTFS_UPDATE_ATIME); exit: if (na) @@ -1508,7 +1444,6 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1520,9 +1455,6 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1541,9 +1473,7 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, total += ret; } res = total; -#ifndef PLUGINS_DISABLED stamps: -#endif /* PLUGINS_DISABLED */ if ((res > 0) && (!ctx->dmtime || (sle64_to_cpu(ntfs_current_time()) @@ -1594,7 +1524,6 @@ static int ntfs_fuse_release(const char *org_path, goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1606,10 +1535,6 @@ static int ntfs_fuse_release(const char *org_path, if (!res) { goto stamps; } -#else /* PLUGINS_DISABLED */ - /* Assume release() was not needed */ - res = 0; -#endif /* PLUGINS_DISABLED */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1624,9 +1549,7 @@ static int ntfs_fuse_release(const char *org_path, if (fi->fh & CLOSE_ENCRYPTED) res = ntfs_efs_fixup_attribute(NULL, na); #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED stamps: -#endif /* PLUGINS_DISABLED */ if (fi->fh & CLOSE_DMTIME) ntfs_inode_update_times(ni,NTFS_UPDATE_MCTIME); exit: @@ -1676,7 +1599,6 @@ static int ntfs_fuse_trunc(const char *org_path, off_t size, } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1689,9 +1611,6 @@ static int ntfs_fuse_trunc(const char *org_path, off_t size, set_archive(ni); goto stamps; } -#else /* PLUGINS_DISABLED */ - res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1727,9 +1646,7 @@ static int ntfs_fuse_trunc(const char *org_path, off_t size, if (oldsize != size) set_archive(ni); -#ifndef PLUGINS_DISABLED stamps: -#endif /* PLUGINS_DISABLED */ ntfs_fuse_update_times(ni, NTFS_UPDATE_MCTIME); errno = 0; exit: @@ -3609,7 +3526,6 @@ exit: #endif #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED static void register_internal_reparse_plugins(void) { static const plugin_operations_t ops = { @@ -3621,7 +3537,6 @@ static void register_internal_reparse_plugins(void) register_reparse_plugin(ctx, IO_REPARSE_TAG_SYMLINK, &ops, (void*)NULL); } -#endif /* PLUGINS_DISABLED */ static void ntfs_close(void) { @@ -4242,9 +4157,7 @@ int main(int argc, char *argv[]) free(ctx->xattrmap_path); #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ -#ifndef PLUGINS_DISABLED register_internal_reparse_plugins(); -#endif /* PLUGINS_DISABLED */ fh = mount_fuse(parsed_options); if (!fh) { @@ -4283,9 +4196,7 @@ err_out: #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ err2: ntfs_close(); -#ifndef PLUGINS_DISABLED close_reparse_plugins(ctx); -#endif /* PLUGINS_DISABLED */ free(ctx); free(parsed_options); free(opts.options); diff --git a/src/ntfs-3g_common.c b/src/ntfs-3g_common.c index edb4ec4..cc4c513 100644 --- a/src/ntfs-3g_common.c +++ b/src/ntfs-3g_common.c @@ -759,8 +759,6 @@ exit : #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED - int register_reparse_plugin(ntfs_fuse_context_t *ctx, le32 tag, const plugin_operations_t *ops, void *handle) { @@ -794,11 +792,9 @@ const struct plugin_operations *select_reparse_plugin(ntfs_fuse_context_t *ctx, ntfs_inode *ni, REPARSE_POINT **reparse_wanted) { const struct plugin_operations *ops; - void *handle; REPARSE_POINT *reparse; le32 tag; plugin_list_t *plugin; - plugin_init_t pinit; ops = (struct plugin_operations*)NULL; reparse = ntfs_get_reparse_point(ni); @@ -808,7 +804,14 @@ const struct plugin_operations *select_reparse_plugin(ntfs_fuse_context_t *ctx, plugin = plugin->next) { } if (plugin) { ops = plugin->ops; - } else { + } +#ifdef ENABLE_EXTERNAL_PLUGINS + /* + * Look for an external plugin that can handle the reparse point + */ + else { + plugin_init_t pinit; + void *handle; #ifdef PLUGIN_DIR char name[sizeof(PLUGIN_DIR) + 64]; @@ -842,6 +845,7 @@ const struct plugin_operations *select_reparse_plugin(ntfs_fuse_context_t *ctx, ctx->errors_logged |= ERR_PLUGIN; } } +#endif /* ENABLE_EXTERNAL_PLUGINS */ if (ops && reparse_wanted) *reparse_wanted = reparse; else @@ -863,8 +867,6 @@ void close_reparse_plugins(ntfs_fuse_context_t *ctx) } } -#endif /* PLUGINS_DISABLED */ - #ifdef HAVE_SETXATTR /* @@ -887,7 +889,6 @@ BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx, ntfs_inode *ni) else { /* Reparse point depends on kind, see plugin */ if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED struct stat stbuf; REPARSE_POINT *reparse; const plugin_operations_t *ops; @@ -901,9 +902,6 @@ BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx, ntfs_inode *ni) || S_ISDIR(stbuf.st_mode); } free(reparse); -#else /* PLUGINS_DISABLED */ - res = FALSE; /* mountpoints, symlinks, ... */ -#endif /* PLUGINS_DISABLED */ } } else { /* Metadata */ diff --git a/src/ntfs-3g_common.h b/src/ntfs-3g_common.h index e902657..ef07d19 100644 --- a/src/ntfs-3g_common.h +++ b/src/ntfs-3g_common.h @@ -114,8 +114,6 @@ typedef enum { ERR_PLUGIN = 1 } single_log_t; -#ifndef PLUGINS_DISABLED - typedef struct plugin_list { struct plugin_list *next; void *handle; @@ -123,8 +121,6 @@ typedef struct plugin_list { le32 tag; } plugin_list_t; -#endif /* PLUGINS_DISABLED */ - typedef struct { ntfs_volume *vol; unsigned int uid; @@ -163,9 +159,7 @@ typedef struct { single_log_t errors_logged; char *usermap_path; char *abs_mnt_point; -#ifndef PLUGINS_DISABLED plugin_list_t *plugins; -#endif /* PLUGINS_DISABLED */ struct PERMISSIONS_CACHE *seccache; struct SECURITY_CONTEXT security; struct open_file *open_files; /* only defined in lowntfs-3g */ @@ -201,8 +195,6 @@ int ntfs_parse_options(struct ntfs_options *popts, void (*usage)(void), int ntfs_fuse_listxattr_common(ntfs_inode *ni, ntfs_attr_search_ctx *actx, char *list, size_t size, BOOL prefixing); -#ifndef PLUGINS_DISABLED - void close_reparse_plugins(ntfs_fuse_context_t *ctx); const struct plugin_operations *select_reparse_plugin(ntfs_fuse_context_t *ctx, ntfs_inode *ni, REPARSE_POINT **reparse); @@ -210,6 +202,4 @@ int register_reparse_plugin(ntfs_fuse_context_t *ctx, le32 tag, const plugin_operations_t *ops, void *handle); BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx, ntfs_inode *ni); -#endif /* PLUGINS_DISABLED */ - #endif /* _NTFS_3G_COMMON_H */ -- 2.8.2 ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ ntfs-3g-devel mailing list ntfs-3g-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel