From dadff5d9b5b4c397fadc2740d05661167f66e2b6 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Wed, 1 Apr 2015 13:25:16 +1100 Subject: [PATCH] Disable annoying Apple Double files on OS X. If these ever prove to be desirable, we can revert this or add a mount option. --- mounted_file_system.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mounted_file_system.go b/mounted_file_system.go index 1b96e58..db3e9e1 100644 --- a/mounted_file_system.go +++ b/mounted_file_system.go @@ -76,15 +76,26 @@ type MountConfig struct { // Convert to mount options to be passed to package bazilfuse. func (c *MountConfig) bazilfuseOptions() (opts []bazilfuse.MountOption) { + isDarwin := runtime.GOOS == "darwin" + // Enable permissions checking in the kernel. See the comments on // InodeAttributes.Mode. opts = append(opts, bazilfuse.SetOption("default_permissions", "")) - // OS X only: set novncache when appropriate. - if runtime.GOOS == "darwin" && !c.EnableVnodeCaching { + // OS X: set novncache when appropriate. + if isDarwin && !c.EnableVnodeCaching { opts = append(opts, bazilfuse.SetOption("novncache", "")) } + // OS X: disable the use of "Apple Double" (._foo and .DS_Store) files, which + // just add noise to debug output and can have significant cost on + // network-based file systems. + // + // Cf. https://github.com/osxfuse/osxfuse/wiki/Mount-options + if isDarwin { + opts = append(opts, bazilfuse.SetOption("noappledouble", "")) + } + return }