Skip to content

Commit

Permalink
add MountConfig FuseType
Browse files Browse the repository at this point in the history
  • Loading branch information
labulakalia committed Dec 24, 2023
1 parent 2b0495a commit 4337491
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
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 OsxFuse/Fuse-T,default is OsxFuse
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
17 changes: 12 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,12 @@ 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 FuseTypeFuseT:
dev, err = mountFuset(dir, cfg, ready)
case FuseTypeOsxFuse:
default:
dev, err = mountOsxFuse(dir, cfg, ready)
}
return mountOsxFuse(dir, cfg, ready)
return
}

0 comments on commit 4337491

Please sign in to comment.