diff --git a/mount_config.go b/mount_config.go index 50bc565c..3720b8d3 100644 --- a/mount_config.go +++ b/mount_config.go @@ -118,8 +118,8 @@ type MountConfig struct { // // Normally on OS X we mount with the novncache option // (https://tinyurl.com/52hz9vya), which disables entry caching in the - // kernel. This is because osxfuse does not honor the entry expiration values - // we return to it, instead caching potentially forever + // kernel. This is because macFUSE (osxfuse) does not honor the entry + // expiration values we return to it, instead caching potentially forever // (https://tinyurl.com/2rr6cd3m), and it is probably better to fail to cache // than to cache for too long, since the latter is more likely to hide // consistency bugs that are difficult to detect and diagnose. @@ -167,9 +167,16 @@ type MountConfig struct { // OS X only. // // The name of the mounted volume, as displayed in the Finder. If empty, a - // default name involving the string 'osxfuse' is used. + // default name involving the string 'osxfuse' (the old name of macFUSE) + // is used. VolumeName string + // OS X only. + // + // The FUSE implementation to use. One of FUSEImplFuseT (default) or + // FUSEImplMacFUSE. + FuseImpl FUSEImpl + // Additional key=value options to pass unadulterated to the underlying mount // command. See `man 8 mount`, the fuse documentation, etc. for // system-specific information. @@ -193,6 +200,13 @@ type MountConfig struct { EnableParallelDirOps bool } +type FUSEImpl uint8 + +const ( + FUSEImplFuseT = iota + FUSEImplMacFUSE +) + // Create a map containing all of the key=value mount options to be given to // the mount helper. func (c *MountConfig) toMap() (opts map[string]string) { diff --git a/mount_darwin.go b/mount_darwin.go index 3c1a9105..6964120f 100644 --- a/mount_darwin.go +++ b/mount_darwin.go @@ -381,10 +381,13 @@ func startFuseTServer(binary string, argv []string, } func mountFuset( - bin string, dir string, cfg *MountConfig, ready chan<- error) (dev *os.File, err error) { + fuseTBin, err := fusetBinary() + if err != nil { + return nil, err + } fusekernel.IsPlatformFuseT = true env := []string{} @@ -403,7 +406,7 @@ func mountFuset( env = append(env, "_FUSE_COMMVERS=2") argv = append(argv, dir) - return startFuseTServer(bin, argv, env, false, cfg.DebugLogger, ready) + return startFuseTServer(fuseTBin, argv, env, false, cfg.DebugLogger, ready) } func mount( @@ -412,8 +415,13 @@ func mount( ready chan<- error) (dev *os.File, err error) { fusekernel.IsPlatformFuseT = false - if fuset_bin, err := fusetBinary(); err == nil { - return mountFuset(fuset_bin, dir, cfg, ready) + switch cfg.FuseImpl { + case FUSEImplMacFUSE: + dev, err = mountOsxFuse(dir, cfg, ready) + case FUSEImplFuseT: + fallthrough + default: + dev, err = mountFuset(dir, cfg, ready) } - return mountOsxFuse(dir, cfg, ready) + return } diff --git a/samples/mount_hello/mount.go b/samples/mount_hello/mount.go index 9366a945..255acb6f 100644 --- a/samples/mount_hello/mount.go +++ b/samples/mount_hello/mount.go @@ -50,6 +50,7 @@ func main() { cfg := &fuse.MountConfig{ ReadOnly: *fReadOnly, + FuseImpl: fuse.FUSEImplMacFUSE, } if *fDebug {