mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 04:49:47 +01:00
cmount: fix problems noticed by linter
This commit is contained in:
parent
7f1240516e
commit
1f328fbcfd
@ -121,19 +121,6 @@ func (fsys *FS) lookupParentDir(filePath string) (leaf string, dir *vfs.Dir, err
|
|||||||
return leaf, dir, errc
|
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
|
// get a node and handle from the path or from the fh if not fhUnset
|
||||||
//
|
//
|
||||||
// handle may be nil
|
// handle may be nil
|
||||||
@ -580,7 +567,7 @@ func (fsys *FS) Getpath(path string, fh uint64) (errc int, normalisedPath string
|
|||||||
return errc, ""
|
return errc, ""
|
||||||
}
|
}
|
||||||
normalisedPath = node.Path()
|
normalisedPath = node.Path()
|
||||||
if !strings.HasPrefix("/", normalisedPath) {
|
if !strings.HasPrefix(normalisedPath, "/") {
|
||||||
normalisedPath = "/" + normalisedPath
|
normalisedPath = "/" + normalisedPath
|
||||||
}
|
}
|
||||||
return 0, normalisedPath
|
return 0, normalisedPath
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rclone/rclone/cmd/mountlib"
|
"github.com/rclone/rclone/cmd/mountlib"
|
||||||
@ -35,19 +34,6 @@ func init() {
|
|||||||
buildinfo.Tags = append(buildinfo.Tags, "cmount")
|
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
|
// mountOptions configures the options from the command line flags
|
||||||
func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.Options) (options []string) {
|
func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.Options) (options []string) {
|
||||||
// Options
|
// Options
|
||||||
@ -93,9 +79,9 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
|
|||||||
if VFS.Opt.ReadOnly {
|
if VFS.Opt.ReadOnly {
|
||||||
options = append(options, "-o", "ro")
|
options = append(options, "-o", "ro")
|
||||||
}
|
}
|
||||||
if opt.WritebackCache {
|
//if opt.WritebackCache {
|
||||||
// FIXME? options = append(options, "-o", WritebackCache())
|
// FIXME? options = append(options, "-o", WritebackCache())
|
||||||
}
|
//}
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
if opt.VolumeName != "" {
|
if opt.VolumeName != "" {
|
||||||
options = append(options, "-o", "volname="+opt.VolumeName)
|
options = append(options, "-o", "volname="+opt.VolumeName)
|
||||||
@ -111,9 +97,7 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
|
|||||||
for _, option := range opt.ExtraOptions {
|
for _, option := range opt.ExtraOptions {
|
||||||
options = append(options, "-o", option)
|
options = append(options, "-o", option)
|
||||||
}
|
}
|
||||||
for _, option := range opt.ExtraFlags {
|
options = append(options, opt.ExtraFlags...)
|
||||||
options = append(options, option)
|
|
||||||
}
|
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user