reverse: re-enable kernel cache

Disabling the kernel cache make sure the encrypted view is always
up-to-date, however, it causes a factor 3 slowdown.
Please use --nocache manually if you want to disable caching.
Closes #60.

Also replaces the magic identifiers 513 and 514 by proper defines.
This commit is contained in:
Jakob Unterwurzacher 2015-03-12 00:39:28 +01:00
parent b2f50bab1e
commit 5ef4ab0a41
2 changed files with 16 additions and 8 deletions

View File

@ -57,6 +57,11 @@
extern "C" void fuse_unmount_compat22(const char *mountpoint);
#define fuse_unmount fuse_unmount_compat22
/* Arbitrary identifiers for long options that do
* not have a short version */
#define LONG_OPT_ANNOTATE 513
#define LONG_OPT_NOCACHE 514
using namespace std;
using namespace rlog;
using namespace rel;
@ -217,8 +222,8 @@ static bool processArgs(int argc, char *argv[],
{"extpass", 1, 0, 'p'}, // external password program
// {"single-thread", 0, 0, 's'}, // single-threaded mode
{"stdinpass", 0, 0, 'S'}, // read password from stdin
{"annotate", 0, 0, 513}, // Print annotation lines to stderr
{"nocache", 0, 0, 514}, // disable caching
{"annotate", 0, 0, LONG_OPT_ANNOTATE}, // Print annotation lines to stderr
{"nocache", 0, 0, LONG_OPT_NOCACHE}, // disable caching
{"verbose", 0, 0, 'v'}, // verbose mode
{"version", 0, 0, 'V'}, // version
{"reverse", 0, 0, 'r'}, // reverse encryption
@ -255,7 +260,7 @@ static bool processArgs(int argc, char *argv[],
case 'S':
out->opts->useStdin = true;
break;
case 513:
case LONG_OPT_ANNOTATE:
out->opts->annotate = true;
break;
case 'f':
@ -295,8 +300,11 @@ static bool processArgs(int argc, char *argv[],
* filesystem where something can change the underlying
* filesystem without going through fuse can run into
* inconsistencies."
* Enabling reverse automatically enables noCache */
case 514:
* However, disabling the caches causes a factor 3
* slowdown. If you are concerned about inconsistencies,
* please use --nocache. */
break;
case LONG_OPT_NOCACHE:
/* Disable EncFS block cache
* Causes reverse grow tests to fail because short reads
* are returned */

View File

@ -46,7 +46,7 @@ sub cleanup
sub mount
{
delete $ENV{"ENCFS6_CONFIG"};
system("./encfs/encfs --extpass=\"echo test\" --standard $plain $ciphertext --reverse");
system("./encfs/encfs --extpass=\"echo test\" --standard $plain $ciphertext --reverse --nocache");
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'");