updated on Wed Jan 25 12:16:47 UTC 2012
[aur-mirror.git] / encfs-trueondemand / true_ondemand.patch
bloba8d5755722d43f624bcdabb15b5c5fbfb717f480
1 --- encfs-orig/encfs/main.cpp 2009-11-29 23:04:12.000000000 +0100
2 +++ src/encfs-1.7.4/encfs/main.cpp 2011-09-19 11:38:35.000000000 +0200
3 @@ -50,6 +50,7 @@
4 #include "Context.h"
6 #include "openssl.h"
7 +#include "signal.h"
9 // Fuse version >= 26 requires another argument to fuse_unmount, which we
10 // don't have. So use the backward compatible call instead..
11 @@ -482,6 +483,14 @@
15 +EncFS_Context *ctx;
17 +void handle_sigusr1(int signo)
19 + ctx->setRoot( shared_ptr<DirNode>() );
23 int main(int argc, char *argv[])
25 // initialize the logging library
26 @@ -586,16 +595,24 @@
28 // context is not a smart pointer because it will live for the life of
29 // the filesystem.
30 - EncFS_Context *ctx = new EncFS_Context;
31 + ctx = new EncFS_Context;
32 + signal(SIGUSR1,handle_sigusr1);
33 ctx->publicFilesystem = encfsArgs->opts->ownerCreate;
34 - RootPtr rootInfo = initFS( ctx, encfsArgs->opts );
35 + RootPtr rootInfo;
37 int returnCode = EXIT_FAILURE;
39 - if( rootInfo )
40 + if (!encfsArgs->opts->mountOnDemand)
41 + rootInfo = initFS( ctx, encfsArgs->opts );
44 + if( rootInfo || encfsArgs->opts->mountOnDemand )
46 // set the globally visible root directory node
47 - ctx->setRoot( rootInfo->root );
48 + if ( encfsArgs->opts->mountOnDemand )
49 + ctx->setRoot( shared_ptr<DirNode>() );
50 + else
51 + ctx->setRoot( rootInfo->root );
52 ctx->args = encfsArgs;
53 ctx->opts = encfsArgs->opts;
55 @@ -691,11 +708,14 @@
56 static
57 void * idleMonitor(void *_arg)
59 - EncFS_Context *ctx = (EncFS_Context*)_arg;
60 + ctx = (EncFS_Context*)_arg;
61 shared_ptr<EncFS_Args> arg = ctx->args;
63 const int timeoutCycles = 60 * arg->idleTimeout / ActivityCheckInterval;
64 int idleCycles = 0;
66 + if (arg->opts->mountOnDemand)
67 + idleCycles = timeoutCycles +1;
69 pthread_mutex_lock( &ctx->wakeupMutex );