From ff48dc1aab1c551dcaaa0f46b32dbc5f35e90e2e Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 5 Oct 2016 22:22:28 +0200 Subject: reverse: initialize the longname cache only when reverse mode is used Gets rid of the idling longnameCacheCleaner thread in "normal" mode. --- internal/fusefrontend_reverse/reverse_longnames.go | 5 ++++- internal/fusefrontend_reverse/rfs.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/fusefrontend_reverse') diff --git a/internal/fusefrontend_reverse/reverse_longnames.go b/internal/fusefrontend_reverse/reverse_longnames.go index 5ad95b1..d59664d 100644 --- a/internal/fusefrontend_reverse/reverse_longnames.go +++ b/internal/fusefrontend_reverse/reverse_longnames.go @@ -30,7 +30,10 @@ func longnameCacheCleaner() { } } -func init() { +func initLongnameCache() { + if longnameParentCache != nil { + return + } longnameParentCache = map[string]string{} go longnameCacheCleaner() } diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go index ab65ba3..1c143bf 100644 --- a/internal/fusefrontend_reverse/rfs.go +++ b/internal/fusefrontend_reverse/rfs.go @@ -47,6 +47,8 @@ var _ pathfs.FileSystem = &reverseFS{} // NewFS returns an encrypted FUSE overlay filesystem func NewFS(args fusefrontend.Args) pathfs.FileSystem { + initLongnameCache() + cryptoCore := cryptocore.New(args.Masterkey, args.CryptoBackend, contentenc.DefaultIVBits) contentEnc := contentenc.New(cryptoCore, contentenc.DefaultBS) nameTransform := nametransform.New(cryptoCore, args.LongNames) -- cgit v1.2.3