Skip to content

Commit

Permalink
cmount: fix problems noticed by linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ncw committed Dec 13, 2024
1 parent 7f12405 commit 1f328fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
15 changes: 1 addition & 14 deletions cmd/cmount/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,6 @@ func (fsys *FS) lookupParentDir(filePath string) (leaf string, dir *vfs.Dir, err
return leaf, dir, errc
}

// lookup a File given a path
func (fsys *FS) lookupFile(path string) (file *vfs.File, errc int) {
node, errc := fsys.lookupNode(path)
if errc != 0 {
return nil, errc
}
file, ok := node.(*vfs.File)
if !ok {
return nil, -fuse.EISDIR
}
return file, 0
}

// get a node and handle from the path or from the fh if not fhUnset
//
// handle may be nil
Expand Down Expand Up @@ -580,7 +567,7 @@ func (fsys *FS) Getpath(path string, fh uint64) (errc int, normalisedPath string
return errc, ""
}
normalisedPath = node.Path()
if !strings.HasPrefix("/", normalisedPath) {
if !strings.HasPrefix(normalisedPath, "/") {
normalisedPath = "/" + normalisedPath
}
return 0, normalisedPath
Expand Down
24 changes: 4 additions & 20 deletions cmd/cmount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"os"
"runtime"
"strings"
"time"

"github.com/rclone/rclone/cmd/mountlib"
Expand All @@ -35,19 +34,6 @@ func init() {
buildinfo.Tags = append(buildinfo.Tags, "cmount")
}

// Find the option string in the current options
func findOption(name string, options []string) (found bool) {
for _, option := range options {
if option == "-o" {
continue
}
if strings.Contains(option, name) {
return true
}
}
return false
}

// mountOptions configures the options from the command line flags
func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.Options) (options []string) {
// Options
Expand Down Expand Up @@ -93,9 +79,9 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
if VFS.Opt.ReadOnly {
options = append(options, "-o", "ro")
}
if opt.WritebackCache {
// FIXME? options = append(options, "-o", WritebackCache())
}
//if opt.WritebackCache {
// FIXME? options = append(options, "-o", WritebackCache())
//}
if runtime.GOOS == "darwin" {
if opt.VolumeName != "" {
options = append(options, "-o", "volname="+opt.VolumeName)
Expand All @@ -111,9 +97,7 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
for _, option := range opt.ExtraOptions {
options = append(options, "-o", option)
}
for _, option := range opt.ExtraFlags {
options = append(options, option)
}
options = append(options, opt.ExtraFlags...)
return options
}

Expand Down

0 comments on commit 1f328fb

Please sign in to comment.