Skip to content

Instantly share code, notes, and snippets.

@mischief
Created January 22, 2026 16:04
Show Gist options
  • Select an option

  • Save mischief/43052f35ba6ecd7ebc935f598c3297f4 to your computer and use it in GitHub Desktop.

Select an option

Save mischief/43052f35ba6ecd7ebc935f598c3297f4 to your computer and use it in GitHub Desktop.
rclone hacking for openbsd
diff --git a/fuse/host_cgo.go b/fuse/host_cgo.go
index b957917..682d239 100644
--- a/fuse/host_cgo.go
+++ b/fuse/host_cgo.go
@@ -190,7 +190,7 @@ static void *cgofuse_init_fuse(void)
#elif defined(__NetBSD__)
h = dlopen("librefuse.so.2", RTLD_NOW);
#elif defined(__OpenBSD__)
- h = dlopen("libfuse.so.2.0", RTLD_NOW);
+ h = dlopen("libfuse.so", RTLD_NOW);
#elif defined(__linux__)
#if FUSE_USE_VERSION < 30
h = dlopen("libfuse.so.2", RTLD_NOW);
diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.go
index 0dcde32..a14e71b 100644
--- a/cmd/cmount/fs.go
+++ b/cmd/cmount/fs.go
@@ -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
diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go
index 9bb1ab4..b4eaab6 100644
--- a/cmd/cmount/mount.go
+++ b/cmd/cmount/mount.go
@@ -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,12 @@ 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))
+ //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")
+ //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())))
}
diff --git a/cmd/cmount/mount_unsupported.go b/cmd/cmount/mount_unsupported.go
index 6677132..816900f 100644
--- a/cmd/cmount/mount_unsupported.go
+++ b/cmd/cmount/mount_unsupported.go
@@ -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.
//
diff --git a/go.mod b/go.mod
index 93ade07..4099e9a 100644
--- a/go.mod
+++ b/go.mod
@@ -280,3 +280,5 @@ require (
golang.org/x/mobile v0.0.0-20251021151156-188f512ec823
golang.org/x/term v0.37.0
)
+
+replace github.com/winfsp/cgofuse => /home/mischief/src/cgofuse/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment