mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-23 14:30:46 +02:00
A device-ID boundary alone does not prove FUSE: a tmpfs mount would pass mountedAt and report its results as FUSE compliance. Check the filesystem type (statfs magic on linux, fstypename on the BSDs); platforms without a check keep the mount and write verification.
26 lines
540 B
Go
26 lines
540 B
Go
//go:build darwin || freebsd
|
|
|
|
package fuse
|
|
|
|
import (
|
|
"strings"
|
|
"syscall"
|
|
)
|
|
|
|
// fuseFilesystem reports whether path sits on a FUSE mount; macFUSE, osxfuse
|
|
// and fusefs all carry "fuse" in the filesystem type name.
|
|
func fuseFilesystem(path string) bool {
|
|
var st syscall.Statfs_t
|
|
if err := syscall.Statfs(path, &st); err != nil {
|
|
return false
|
|
}
|
|
name := make([]byte, 0, len(st.Fstypename))
|
|
for _, c := range st.Fstypename {
|
|
if c == 0 {
|
|
break
|
|
}
|
|
name = append(name, byte(c))
|
|
}
|
|
return strings.Contains(string(name), "fuse")
|
|
}
|