//go:build linux package assetcache import "golang.org/x/sys/unix" type statfsFS struct{} // Statfs is the real FS: the kernel's answer for the filesystem holding dir. // free counts the blocks an unprivileged writer may use (Bavail). var Statfs FS = statfsFS{} func (statfsFS) Space(dir string) (total, free uint64, err error) { var st unix.Statfs_t if err := unix.Statfs(dir, &st); err != nil { return 0, 0, err } bsize := uint64(st.Bsize) return st.Blocks * bsize, st.Bavail * bsize, nil }