mirror of
https://github.com/rclone/rclone.git
synced 2025-02-15 01:52:22 +01:00
cmount: make work under OpenBSD - fixes #1727
This commit is contained in:
parent
a910ec398d
commit
f60476e30a
@ -1,6 +1,6 @@
|
|||||||
// +build cmount
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build linux darwin freebsd windows
|
// +build linux darwin freebsd openbsd windows
|
||||||
|
|
||||||
package cmount
|
package cmount
|
||||||
|
|
||||||
@ -8,6 +8,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -225,6 +226,12 @@ func (fsys *FS) Readdir(dirPath string,
|
|||||||
// We can't seek in directories and FUSE should know that so
|
// We can't seek in directories and FUSE should know that so
|
||||||
// return an error if ofst is ever set.
|
// return an error if ofst is ever set.
|
||||||
if ofst > 0 {
|
if ofst > 0 {
|
||||||
|
// However openbsd doesn't seem to know this - perhaps a bug in its
|
||||||
|
// FUSE implementation or a bug in cgofuse?
|
||||||
|
// See: https://github.com/billziss-gh/cgofuse/issues/49
|
||||||
|
if runtime.GOOS == "openbsd" {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
return -fuse.ESPIPE
|
return -fuse.ESPIPE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// +build cmount
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build linux darwin freebsd windows
|
// +build linux darwin freebsd openbsd windows
|
||||||
|
|
||||||
package cmount
|
package cmount
|
||||||
|
|
||||||
@ -37,13 +37,17 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
|
|||||||
options = []string{
|
options = []string{
|
||||||
"-o", "fsname=" + device,
|
"-o", "fsname=" + device,
|
||||||
"-o", "subtype=rclone",
|
"-o", "subtype=rclone",
|
||||||
"-o", fmt.Sprintf("max_readahead=%d", opt.MaxReadAhead),
|
|
||||||
"-o", fmt.Sprintf("attr_timeout=%g", opt.AttrTimeout.Seconds()),
|
"-o", fmt.Sprintf("attr_timeout=%g", opt.AttrTimeout.Seconds()),
|
||||||
// This causes FUSE to supply O_TRUNC with the Open
|
}
|
||||||
// call which is more efficient for cmount. However
|
if runtime.GOOS != "openbsd" {
|
||||||
// it does not work with cgofuse on Windows with
|
options = append(options,
|
||||||
// WinFSP so cmount must work with or without it.
|
"-o", fmt.Sprintf("max_readahead=%d", opt.MaxReadAhead),
|
||||||
"-o", "atomic_o_trunc",
|
// This causes FUSE to supply O_TRUNC with the Open
|
||||||
|
// call which is more efficient for cmount. However
|
||||||
|
// it does not work with cgofuse on Windows with
|
||||||
|
// WinFSP so cmount must work with or without it.
|
||||||
|
"-o", "atomic_o_trunc",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if opt.DebugFUSE {
|
if opt.DebugFUSE {
|
||||||
options = append(options, "-o", "debug")
|
options = append(options, "-o", "debug")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// +build cmount
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build linux darwin freebsd windows
|
// +build linux darwin freebsd openbsd windows
|
||||||
// +build !race !windows
|
// +build !race !windows
|
||||||
|
|
||||||
// FIXME this doesn't work with the race detector under Windows either
|
// FIXME this doesn't work with the race detector under Windows either
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Build for cmount for unsupported platforms to stop go complaining
|
// Build for cmount for unsupported platforms to stop go complaining
|
||||||
// about "no buildable Go source files "
|
// about "no buildable Go source files "
|
||||||
|
|
||||||
// +build !linux,!darwin,!freebsd,!windows !cgo !cmount
|
// +build !linux,!darwin,!freebsd,!openbsd,!windows !cgo !cmount
|
||||||
|
|
||||||
package cmount
|
package cmount
|
||||||
|
Loading…
Reference in New Issue
Block a user