//go:build !windows package host import "syscall" // diskBytes reports the total and available bytes of the filesystem holding // dir. // // It returns BYTES, not the raw statfs fields, and that is the point: Bsize // is int64 on Linux and uint32 on darwin, a difference that already broke // the CI build once (see .amadan/ci.d/20-cross@5's header) because the // multiplication happened at every call site instead of once here. Callers // now get two plain uint64s and no per-OS arithmetic. func diskBytes(dir string) (total, avail uint64, err error) { var st syscall.Statfs_t if err := syscall.Statfs(dir, &st); err != nil { return 0, 0, err } return uint64(st.Blocks) * uint64(st.Bsize), uint64(st.Bavail) * uint64(st.Bsize), nil }