From c79e73aa2a9ce9bb072a7b67747ff96d9effa075 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 12 Jun 2025 08:19:47 -0700 Subject: [PATCH] mount: complete fix for freebsd fix https://github.com/seaweedfs/seaweedfs/issues/6645 --- weed/command/mount_freebsd.go | 5 +++++ weed/command/mount_notsupported.go | 4 ++-- weed/command/mount_std.go | 7 ++++--- weed/mount/weedfs_attr_freebsd.go | 8 ++++++++ weed/mount/weedfs_xattr.go | 3 +++ weed/mount/weedfs_xattr_freebsd.go | 27 +++++++++++++++++++++++++++ 6 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 weed/command/mount_freebsd.go create mode 100644 weed/mount/weedfs_attr_freebsd.go create mode 100644 weed/mount/weedfs_xattr_freebsd.go diff --git a/weed/command/mount_freebsd.go b/weed/command/mount_freebsd.go new file mode 100644 index 000000000..05d6a1bc4 --- /dev/null +++ b/weed/command/mount_freebsd.go @@ -0,0 +1,5 @@ +package command + +func checkMountPointAvailable(dir string) bool { + return true +} diff --git a/weed/command/mount_notsupported.go b/weed/command/mount_notsupported.go index 894c8e313..1e5c9f53d 100644 --- a/weed/command/mount_notsupported.go +++ b/weed/command/mount_notsupported.go @@ -1,5 +1,5 @@ -//go:build !linux && !darwin -// +build !linux,!darwin +//go:build !linux && !darwin && !freebsd +// +build !linux,!darwin,!freebsd package command diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go index 84c84b767..677dca793 100644 --- a/weed/command/mount_std.go +++ b/weed/command/mount_std.go @@ -1,12 +1,11 @@ -//go:build linux || darwin -// +build linux darwin +//go:build linux || darwin || freebsd +// +build linux darwin freebsd package command import ( "context" "fmt" - "github.com/seaweedfs/seaweedfs/weed/util/version" "net" "net/http" "os" @@ -17,6 +16,8 @@ import ( "syscall" "time" + "github.com/seaweedfs/seaweedfs/weed/util/version" + "github.com/hanwen/go-fuse/v2/fuse" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/mount" diff --git a/weed/mount/weedfs_attr_freebsd.go b/weed/mount/weedfs_attr_freebsd.go new file mode 100644 index 000000000..e7767d4a6 --- /dev/null +++ b/weed/mount/weedfs_attr_freebsd.go @@ -0,0 +1,8 @@ +package mount + +import ( + "github.com/hanwen/go-fuse/v2/fuse" +) + +func setBlksize(out *fuse.Attr, size uint32) { +} diff --git a/weed/mount/weedfs_xattr.go b/weed/mount/weedfs_xattr.go index e1d6d4351..78acaafc8 100644 --- a/weed/mount/weedfs_xattr.go +++ b/weed/mount/weedfs_xattr.go @@ -1,3 +1,6 @@ +//go:build !freebsd +// +build !freebsd + package mount import ( diff --git a/weed/mount/weedfs_xattr_freebsd.go b/weed/mount/weedfs_xattr_freebsd.go new file mode 100644 index 000000000..01cb748e5 --- /dev/null +++ b/weed/mount/weedfs_xattr_freebsd.go @@ -0,0 +1,27 @@ +package mount + +import ( + "syscall" + + "github.com/hanwen/go-fuse/v2/fuse" +) + +func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string, dest []byte) (size uint32, code fuse.Status) { + + return 0, fuse.Status(syscall.ENOTSUP) +} + +func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr string, data []byte) fuse.Status { + + return fuse.Status(syscall.ENOTSUP) +} + +func (wfs *WFS) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []byte) (n uint32, code fuse.Status) { + + return 0, fuse.Status(syscall.ENOTSUP) +} + +func (wfs *WFS) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string) fuse.Status { + + return fuse.Status(syscall.ENOTSUP) +}