aboutsummaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-04-05 18:20:17 +0200
committerJakob Unterwurzacher2021-04-05 18:20:17 +0200
commitf73aee72f87ba6cd3e46184ae75824fd38250f04 (patch)
tree270b10742ea9f4fb70795becb9e44d862480048e /mount.go
parent043f81dd0129b78ec7d4553843f90203535fa406 (diff)
fusefrontend: print dirCache stats after unmount
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/mount.go b/mount.go
index 571b51b..1194104 100644
--- a/mount.go
+++ b/mount.go
@@ -37,6 +37,12 @@ import (
"github.com/rfjakob/gocryptfs/internal/tlog"
)
+// AfterUnmount is called after the filesystem has been unmounted.
+// This can be used for cleanup and printing statistics.
+type AfterUnmounter interface {
+ AfterUnmount()
+}
+
// doMount mounts an encrypted directory.
// Called from main.
func doMount(args *argContainer) {
@@ -116,10 +122,13 @@ func doMount(args *argContainer) {
tlog.Debug.Printf("cli args: %#v", args)
// Initialize gocryptfs (read config file, ask for password, ...)
fs, wipeKeys := initFuseFrontend(args)
- // Initialize go-fuse FUSE server
- srv := initGoFuse(fs, args)
// Try to wipe secret keys from memory after unmount
defer wipeKeys()
+ // Initialize go-fuse FUSE server
+ srv := initGoFuse(fs, args)
+ if x, ok := fs.(AfterUnmounter); ok {
+ defer x.AfterUnmount()
+ }
tlog.Info.Println(tlog.ColorGreen + "Filesystem mounted and ready." + tlog.ColorReset)
// We have been forked into the background, as evidenced by the set