stremio/node/media-node/internal/health/disk_unix.go
Jos Vooges | STH 106aa996a4 Fix storage double-count, add incremental catch-up scan, improve 4K detection.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 07:39:43 +02:00

22 lines
475 B
Go

//go:build !windows
package health
import "syscall"
type fsKey struct {
typ int32
val0 int32
val1 int32
}
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
}
fs = fsKey{typ: 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
}