mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-23 14:30:46 +02:00
fuse integration: require an external mount to be a FUSE filesystem
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.
This commit is contained in:
1 parent
6d62bf517d
commit
8342499e35
6 files changed
+71
-1
No files matched your search
@@ -0,0 +1,17 @@
|
||||
//go:build linux
|
||||
|
||||
package fuse
|
||||
|
||||
import "syscall"
|
||||
|
||||
// fuseSuperMagic is statfs f_type for fuse and fuseblk mounts.
|
||||
const fuseSuperMagic = 0x65735546
|
||||
|
||||
// fuseFilesystem reports whether path sits on a FUSE mount.
|
||||
func fuseFilesystem(path string) bool {
|
||||
var st syscall.Statfs_t
|
||||
if err := syscall.Statfs(path, &st); err != nil {
|
||||
return false
|
||||
}
|
||||
return st.Type == fuseSuperMagic
|
||||
}
|
||||
Reference in new issue
Block a user