1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-19 17:53:16 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Nick Craig-Wood
fdce6dd466 cmount: make work under OpenBSD - fixes #1727 2025-12-09 15:04:24 +00:00
Nick Craig-Wood
5ef9551b02 vfs: make mount tests run on OpenBSD 2025-12-09 14:59:31 +00:00
7 changed files with 26 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
//go:build cmount && ((linux && cgo) || (darwin && cgo) || (freebsd && cgo) || windows)
//go:build cmount && ((linux && cgo) || (darwin && cgo) || (freebsd && cgo) || (openbsd && cgo) || windows)
package cmount
@@ -6,6 +6,7 @@ import (
"io"
"os"
"path"
"runtime"
"strings"
"sync"
"sync/atomic"
@@ -210,6 +211,12 @@ func (fsys *FS) Readdir(dirPath string,
// We can't seek in directories and FUSE should know that so
// return an error if ofst is ever set.
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
}

View File

@@ -1,4 +1,4 @@
//go:build cmount && ((linux && cgo) || (darwin && cgo) || (freebsd && cgo) || windows)
//go:build cmount && ((linux && cgo) || (darwin && cgo) || (freebsd && cgo) || (openbsd && cgo) || windows)
// Package cmount implements a FUSE mounting system for rclone remotes.
//
@@ -8,9 +8,9 @@ package cmount
import (
"errors"
"fmt"
"strings"
"os"
"runtime"
"strings"
"time"
"github.com/rclone/rclone/cmd/mountlib"
@@ -59,12 +59,14 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
} else {
options = append(options, "-o", "fsname="+device)
options = append(options, "-o", "subtype=rclone")
options = append(options, "-o", fmt.Sprintf("max_readahead=%d", opt.MaxReadAhead))
// 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.
options = append(options, "-o", "atomic_o_trunc")
if runtime.GOOS != "openbsd" {
options = append(options, "-o", fmt.Sprintf("max_readahead=%d", opt.MaxReadAhead))
// 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.
options = append(options, "-o", "atomic_o_trunc")
}
if opt.DaemonTimeout != 0 {
options = append(options, "-o", fmt.Sprintf("daemon_timeout=%d", int(time.Duration(opt.DaemonTimeout).Seconds())))
}

View File

@@ -1,4 +1,4 @@
//go:build cmount && ((linux && cgo) || (darwin && cgo) || (freebsd && cgo) || windows) && (!race || !windows)
//go:build cmount && ((linux && cgo) || (darwin && cgo) || (freebsd && cgo) || (openbsd && cgo) || windows) && (!race || !windows)
// Package cmount implements a FUSE mounting system for rclone remotes.
//

View File

@@ -1,4 +1,4 @@
//go:build !((linux && cgo && cmount) || (darwin && cgo && cmount) || (freebsd && cgo && cmount) || (windows && cmount))
//go:build !((linux && cgo && cmount) || (darwin && cgo && cmount) || (freebsd && cgo && cmount) || (openbsd && cgo && cmount) || (windows && cmount))
// Package cmount implements a FUSE mounting system for rclone remotes.
//

View File

@@ -5,6 +5,7 @@ import (
"runtime"
"testing"
"github.com/rclone/rclone/vfs"
"github.com/rclone/rclone/vfs/vfscommon"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -110,6 +111,9 @@ func TestWriteFileDup(t *testing.T) {
var dupFd uintptr
dupFd, err = writeTestDup(fh.Fd())
if err == vfs.ENOSYS {
t.Skip("dup not supported on this platform")
}
require.NoError(t, err)
dupFile := os.NewFile(dupFd, fh.Name())

View File

@@ -1,4 +1,4 @@
//go:build !linux && !darwin && !freebsd && !windows
//go:build !linux && !darwin && !freebsd && !openbsd && !windows
package vfstest

View File

@@ -1,4 +1,4 @@
//go:build linux || darwin || freebsd
//go:build linux || darwin || freebsd || openbsd
package vfstest