浏览文件
storage_volume_linux.go
21 行 · 669 B历史下载| 1 | package cage |
| 2 | |
| 3 | import ( |
| 4 | "errors" |
| 5 | |
| 6 | "golang.org/x/sys/unix" |
| 7 | ) |
| 8 | |
| 9 | func localStorageVolume(path string) error { |
| 10 | var info unix.Statfs_t |
| 11 | if err := unix.Statfs(path, &info); err != nil { |
| 12 | return err |
| 13 | } |
| 14 | // Only admit filesystems with local disk, private mode and sparse-file |
| 15 | // semantics. FUSE in particular may represent a remote mount. |
| 16 | switch uint32(info.Type) { |
| 17 | case unix.EXT4_SUPER_MAGIC, unix.XFS_SUPER_MAGIC, unix.BTRFS_SUPER_MAGIC, unix.F2FS_SUPER_MAGIC, unix.OVERLAYFS_SUPER_MAGIC, 0x2fc12fc1 /* zfs */, 0xca451a4e /* bcachefs */ : |
| 18 | return nil |
| 19 | } |
| 20 | return errors.New("请选择支持私有权限和稀疏文件的本地磁盘(例如 ext4、XFS 或 Btrfs)") |
| 21 | } |

