diff options
author | Jakob Unterwurzacher | 2021-04-05 18:20:17 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-04-05 18:20:17 +0200 |
commit | f73aee72f87ba6cd3e46184ae75824fd38250f04 (patch) | |
tree | 270b10742ea9f4fb70795becb9e44d862480048e /mount.go | |
parent | 043f81dd0129b78ec7d4553843f90203535fa406 (diff) |
fusefrontend: print dirCache stats after unmount
Diffstat (limited to 'mount.go')
-rw-r--r-- | mount.go | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |