Add 2 options --noattrcache --nodatacache (#500)

--nocache : disables attr and data cache.
--noattrcache : disables attr cache only.
--nodatacache : disables data cache only.
This commit is contained in:
Ben RUBSON 2018-03-27 08:56:31 +02:00 committed by GitHub
parent a220c395f4
commit 980648c3b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 8 deletions

View File

@ -21,7 +21,7 @@ B<encfs> [B<--version>] [B<-v>|B<--verbose>] [B<-c>|B<--config>] [B<-t>|B<--sysl
[B<--reverse>] [B<--reversewrite>] [B<--extpass=program>] [B<-S>|B<--stdinpass>]
[B<--anykey>] [B<--forcedecode>] [B<-require-macs>]
[B<-i MINUTES>|B<--idle=MINUTES>] [B<-m>|B<--ondemand>] [B<--delaymount>] [B<-u>|B<--unmount>]
[B<--public>] [B<--nocache>] [B<--no-default-flags>]
[B<--public>] [B<--nocache>] [B<--noattrcache>] [B<--nodatacache>] [B<--no-default-flags>]
[B<-o FUSE_OPTION>] [B<-d>|B<--fuse-debug>] [B<-H>|B<--fuse-help>]
I<rootdir> I<mountPoint>
[B<--> [I<Fuse Mount Options>]]
@ -238,9 +238,17 @@ you want before considering the use of B<--public>.
Disable the kernel's cache of file attributes.
Setting this option makes EncFS pass "attr_timeout=0" and "entry_timeout=0" to
FUSE. This makes sure that modifications to the backing files that occour
outside EncFS show up immediately in the EncFS mount. The main use case
for "--nocache" is reverse mode.
FUSE. This makes sure that modifications to the backing file attributes that
occour outside EncFS show up immediately in the EncFS mount. The internal EncFS
data cache is also disabled. The main use case for B<--nocache> is reverse mode.
=item B<--noattrcache>
Same as B<--nocache> but for attributes only.
=item B<--nodatacache>
Same as B<--nocache> but for data only.
=item B<--no-default-flags>

View File

@ -47,8 +47,10 @@
* not have a short version */
#define LONG_OPT_ANNOTATE 513
#define LONG_OPT_NOCACHE 514
#define LONG_OPT_REQUIRE_MAC 515
#define LONG_OPT_INSECURE 516
#define LONG_OPT_NODATACACHE 515
#define LONG_OPT_NOATTRCACHE 516
#define LONG_OPT_REQUIRE_MAC 517
#define LONG_OPT_INSECURE 518
using namespace std;
using namespace encfs;
@ -254,7 +256,9 @@ static bool processArgs(int argc, char *argv[],
{"syslogtag", 1, nullptr, 't'}, // syslog tag
{"annotate", 0, nullptr,
LONG_OPT_ANNOTATE}, // Print annotation lines to stderr
{"nocache", 0, nullptr, LONG_OPT_NOCACHE}, // disable caching
{"nocache", 0, nullptr, LONG_OPT_NOCACHE}, // disable all caching
{"nodatacache", 0, nullptr, LONG_OPT_NODATACACHE}, // disable data caching
{"noattrcache", 0, nullptr, LONG_OPT_NOATTRCACHE}, // disable attr caching
{"verbose", 0, nullptr, 'v'}, // verbose mode
{"version", 0, nullptr, 'V'}, // version
{"reverse", 0, nullptr, 'r'}, // reverse encryption
@ -384,6 +388,16 @@ static bool processArgs(int argc, char *argv[],
// Should be enforced due to attr_timeout=0, but does not seem to work correctly
// https://github.com/billziss-gh/winfsp/issues/155
PUSHARG("-oFileInfoTimeout=0");
#endif
break;
case LONG_OPT_NODATACACHE:
out->opts->noCache = true;
break;
case LONG_OPT_NOATTRCACHE:
PUSHARG("-oattr_timeout=0");
PUSHARG("-oentry_timeout=0");
#ifdef __CYGWIN__
PUSHARG("-oFileInfoTimeout=0");
#endif
break;
case 'm':

View File

@ -90,7 +90,7 @@ sub mount
ok(waitForFile("$plain/.encfs6.xml"), "plain .encfs6.xml exists") or BAIL_OUT("'$plain/.encfs6.xml'");
my $e = encName(".encfs6.xml");
ok(waitForFile("$ciphertext/$e"), "encrypted .encfs6.xml exists") or BAIL_OUT("'$ciphertext/$e'");
system("ENCFS6_CONFIG=$plain/.encfs6.xml ./build/encfs --nocache --extpass=\"echo test\" $ciphertext $decrypted");
system("ENCFS6_CONFIG=$plain/.encfs6.xml ./build/encfs --noattrcache --nodatacache --extpass=\"echo test\" $ciphertext $decrypted");
ok(waitForFile("$decrypted/.encfs6.xml"), "decrypted .encfs6.xml exists") or BAIL_OUT("'$decrypted/.encfs6.xml'");
}