//go:build !windows package backup import ( "errors" "golang.org/x/sys/unix" ) func restoreFreeBytes(target string) (uint64, error) { var statistics unix.Statfs_t if err := unix.Statfs(target, &statistics); err != nil { return 0, errors.New("restore filesystem capacity is unavailable") } blockSize := uint64(statistics.Bsize) available := uint64(statistics.Bavail) if blockSize != 0 && available > ^uint64(0)/blockSize { return 0, errors.New("restore filesystem capacity is invalid") } return blockSize * available, nil }