//go:build unix package chunk_cache import ( "os" "syscall" ) // allocatedSize is how many bytes of disk f holds, preallocated blocks past // its end included. func allocatedSize(f *os.File) int64 { info, err := f.Stat() if err != nil { return 0 } return allocatedSizeOf(info) } func allocatedSizeOf(info os.FileInfo) int64 { if st, ok := info.Sys().(*syscall.Stat_t); ok { return int64(st.Blocks) * 512 } return 0 }