diff --git a/mount_config.go b/mount_config.go index 86be126d..a54caf78 100644 --- a/mount_config.go +++ b/mount_config.go @@ -169,6 +169,11 @@ type MountConfig struct { // default name involving the string 'osxfuse' is used. VolumeName string + // OS X only. + // + // FuseType choice FUSE impl By Fuse-T/OsxFuse,default is Fuse-T + FuseType FuseType + // Additional key=value options to pass unadulterated to the underlying mount // command. See `man 8 mount`, the fuse documentation, etc. for // system-specific information. @@ -187,6 +192,13 @@ type MountConfig struct { EnableAsyncReads bool } +type FuseType uint8 + +const ( + FuseTypeOsxFuse = iota + 1 + FuseTypeFuseT +) + // 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..cf838dfb 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.FuseType { + case FuseTypeOsxFuse: + dev, err = mountOsxFuse(dir, cfg, ready) + case FuseTypeFuseT: + 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..e8d2d36f 100644 --- a/samples/mount_hello/mount.go +++ b/samples/mount_hello/mount.go @@ -50,6 +50,7 @@ func main() { cfg := &fuse.MountConfig{ ReadOnly: *fReadOnly, + FuseType: fuse.FuseTypeOsxFuse, } if *fDebug {