Skip to content

Commit

Permalink
Add 2 options --noattrcache --nodatacache (#500)
Browse files Browse the repository at this point in the history
--nocache : disables attr and data cache.
--noattrcache : disables attr cache only.
--nodatacache : disables data cache only.
  • Loading branch information
Ben RUBSON committed Mar 27, 2018
1 parent a220c39 commit 980648c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
16 changes: 12 additions & 4 deletions encfs/encfs.pod
Original file line number Diff line number Diff line change
Expand Up @@ -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>]]
Expand Down Expand Up @@ -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>

Expand Down
20 changes: 17 additions & 3 deletions encfs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion integration/reverse.t.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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'");
}

Expand Down

0 comments on commit 980648c

Please sign in to comment.