From 9c2657b4ae0a90b262a2d8a90b892538ea080d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Wed, 30 Sep 2015 08:36:37 +0200 Subject: [PATCH] Made use of fuse module cache on OpenIndiana The fuse cache does not handle properly hard-linked files, so ntfs-3g traditionally disables it by using a null time-out. With an upgrade of the fuse kernel module on OpenIndiana, cacheing of non hard-linked files is now possible, so use it. --- include/ntfs-3g/param.h | 13 ++++++++++--- src/lowntfs-3g.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/ntfs-3g/param.h b/include/ntfs-3g/param.h index f67193c4..3210fab9 100644 --- a/include/ntfs-3g/param.h +++ b/include/ntfs-3g/param.h @@ -110,12 +110,14 @@ enum { * Possible values for high level : * 1 : no cache, kernel control (recommended) * 4 : no cache, file system control + * 6 : kernel/fuse cache, file system control (OpenIndiana only) * 7 : no cache, kernel control for ACLs * * Possible values for low level : * 2 : no cache, kernel control * 3 : use kernel/fuse cache, kernel control (external fuse >= 2.8) - * 5 : no cache, file system control (recommended) + * 5 : no cache, file system control (recommended on Linux) + * 6 : kernel/fuse cache, file system control (OpenIndiana only) * 8 : no cache, kernel control for ACLs * * Use of options 7 and 8 requires a patch to fuse @@ -124,14 +126,19 @@ enum { */ #if defined(__sun) && defined(__SVR4) -#define HPERMSCONFIG 4 /* access control by kernel is broken on OpenIndiana */ +/* + * Access control by kernel is not implemented on OpenIndiana, + * however care is taken of cacheing hard-linked files. + */ +#define HPERMSCONFIG 6 +#define LPERMSCONFIG 6 #else #define HPERMSCONFIG 1 -#endif #if defined(FUSE_INTERNAL) || !defined(FUSE_VERSION) || (FUSE_VERSION < 28) #define LPERMSCONFIG 5 #else #define LPERMSCONFIG 3 #endif +#endif /* defined(__sun) && defined(__SVR4) */ #endif /* defined _NTFS_PARAM_H */ diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 40004a41..c68a49b7 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -124,20 +124,24 @@ #error "Incompatible options KERNELACLS and KERNELPERMS" #endif -#if CACHEING & (KERNELACLS | !KERNELPERMS) -#warning "Fuse cacheing is only usable with basic permissions checked by kernel" -#endif - #if !CACHEING #define ATTR_TIMEOUT 0.0 #define ENTRY_TIMEOUT 0.0 #else +#if defined(__sun) && defined (__SVR4) +#define ATTR_TIMEOUT 10.0 +#define ENTRY_TIMEOUT 10.0 +#else /* defined(__sun) && defined (__SVR4) */ /* * FUSE cacheing is only usable with basic permissions * checked by the kernel with external fuse >= 2.8 */ +#if KERNELACLS | !KERNELPERMS +#warning "Fuse cacheing is only usable with basic permissions checked by kernel" +#endif #define ATTR_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0) #define ENTRY_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0) +#endif /* defined(__sun) && defined (__SVR4) */ #endif #define GHOSTLTH 40 /* max length of a ghost file name - see ghostformat */