stremio/node/media-node/internal/health/disk_unix.go
Jos Vooges | STH 54d70735d8 Fix Linux amd64 Statfs Type cast for media-node disk dedupe build.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 07:41:24 +02:00

21 lines
505 B
Go

//go:build !windows
package health
import "syscall"
func diskStat(path string) (total, free uint64, fs fsKey, ok bool) {
var st syscall.Statfs_t
if err := syscall.Statfs(path, &st); err != nil {
return 0, 0, fsKey{}, false
}
// st.Type is int64 on amd64 / int32 on some arches — always widen.
fs = fsKey{
typ: int64(st.Type),
val0: st.Fsid.X__val[0],
val1: st.Fsid.X__val[1],
}
total = st.Blocks * uint64(st.Bsize)
free = st.Bavail * uint64(st.Bsize)
return total, free, fs, true
}