summaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-11-10 00:27:08 +0100
committerJakob Unterwurzacher2016-11-10 00:27:08 +0100
commit75ebb28a625bc16d145f5acd9e0cc1d305716afe (patch)
tree6e4c654c67b93933a2575857883777b3f05fc5d3 /mount.go
parentdf28fc5a11f5e52897f45cc299ab62a2a2cbaf4c (diff)
ctlsock: add initial limited implementation
At the moment, in forward mode you can only encrypt paths and in reverse mode you can only decrypt paths.
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/mount.go b/mount.go
index 1a00bb7..3bafd8c 100644
--- a/mount.go
+++ b/mount.go
@@ -18,6 +18,7 @@ import (
"github.com/rfjakob/gocryptfs/internal/configfile"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
+ "github.com/rfjakob/gocryptfs/internal/ctlsock"
"github.com/rfjakob/gocryptfs/internal/fusefrontend"
"github.com/rfjakob/gocryptfs/internal/fusefrontend_reverse"
"github.com/rfjakob/gocryptfs/internal/tlog"
@@ -165,10 +166,18 @@ func initFuseFrontend(key []byte, args *argContainer, confFile *configfile.ConfF
jsonBytes, _ := json.MarshalIndent(frontendArgs, "", "\t")
tlog.Debug.Printf("frontendArgs: %s", string(jsonBytes))
var finalFs pathfs.FileSystem
+ var ctlSockBackend ctlsock.Interface
if args.reverse {
- finalFs = fusefrontend_reverse.NewFS(frontendArgs)
+ fs := fusefrontend_reverse.NewFS(frontendArgs)
+ finalFs = fs
+ ctlSockBackend = fs
} else {
- finalFs = fusefrontend.NewFS(frontendArgs)
+ fs := fusefrontend.NewFS(frontendArgs)
+ finalFs = fs
+ ctlSockBackend = fs
+ }
+ if args.ctlsock != "" {
+ ctlsock.CreateAndServe(args.ctlsock, ctlSockBackend)
}
pathFsOpts := &pathfs.PathNodeFsOptions{ClientInodes: true}
pathFs := pathfs.NewPathNodeFs(finalFs, pathFsOpts)
@@ -200,9 +209,8 @@ func initFuseFrontend(key []byte, args *argContainer, confFile *configfile.ConfF
if args.reverse {
mOpts.Name += "-reverse"
}
-
// The kernel enforces read-only operation, we just have to pass "ro".
- // Reverse mounts are always read-only
+ // Reverse mounts are always read-only.
if args.ro || args.reverse {
mOpts.Options = append(mOpts.Options, "ro")
}