Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MountConfig FuseType #155

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions mount_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) {
Expand Down
18 changes: 13 additions & 5 deletions mount_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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(
Expand All @@ -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
}
1 change: 1 addition & 0 deletions samples/mount_hello/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func main() {

cfg := &fuse.MountConfig{
ReadOnly: *fReadOnly,
FuseType: fuse.FuseTypeOsxFuse,
}

if *fDebug {
Expand Down