armhf fix for getfstype (#2884)

* armhf fix for getfstype
This commit is contained in:
Manuel Sabban 2024-03-12 14:33:10 +01:00 committed by GitHub
parent 49e0735b53
commit 1a56a0e0b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,13 +4,13 @@ package types
import (
"fmt"
"syscall"
"golang.org/x/sys/unix"
)
// Generated with `man statfs | grep _MAGIC | awk '{split(tolower($1),a,"_"); print $2 ": \"" a[1] "\","}'`
// ext2/3/4 duplicates removed to just have ext4
// XIAFS removed as well
var fsTypeMapping map[int]string = map[int]string{
var fsTypeMapping map[int64]string = map[int64]string{
0xadf5: "adfs",
0xadff: "affs",
0x5346414f: "afs",
@ -95,15 +95,15 @@ var fsTypeMapping map[int]string = map[int]string{
}
func GetFSType(path string) (string, error) {
var buf syscall.Statfs_t
var buf unix.Statfs_t
err := syscall.Statfs(path, &buf)
err := unix.Statfs(path, &buf)
if err != nil {
return "", err
}
fsType, ok := fsTypeMapping[int(buf.Type)]
fsType, ok := fsTypeMapping[buf.Type]
if !ok {
return "", fmt.Errorf("unknown fstype %d", buf.Type)
}