reverse: initialize the longname cache only when reverse mode is used

Gets rid of the idling longnameCacheCleaner thread in "normal" mode.
This commit is contained in:
Jakob Unterwurzacher 2016-10-05 22:22:28 +02:00
parent a4956fa6bf
commit ff48dc1aab
2 changed files with 6 additions and 1 deletions

View File

@ -30,7 +30,10 @@ func longnameCacheCleaner() {
}
}
func init() {
func initLongnameCache() {
if longnameParentCache != nil {
return
}
longnameParentCache = map[string]string{}
go longnameCacheCleaner()
}

View File

@ -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)