Skip to content

ensureSize (other)

Source (upstream pre-purge) Current
File consensus/ethash/mmap_help_other.go mmap_help_other.go
Symbol ensureSize ensureSize
Ref dde2da0ef~1 etc/v1.17.3-full-node

Non-linux build-tag variant of ensureSize (Truncate fallback).

3-way merge — purge → getc ← upstream

pre-purge
// ensureSize expands the file to the given size. This is to prevent runtime
// errors later on, if the underlying file expands beyond the disk capacity,
// even though it ostensibly is already expanded, but due to being sparse
// does not actually occupy the full declared size on disk.
func ensureSize(f *os.File, size int64) error {
// On systems which do not support fallocate, we merely truncate it.
// More robust alternatives would be to
// - Use posix_fallocate, or
// - explicitly fill the file with zeroes.
return f.Truncate(size)
}
core-geth validation — **Identical** ✅ | | | |---|---| | File | [`mmap_help_other.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/consensus/ethash/mmap_help_other.go) | | Symbol | `ensureSize` | | Ref | `v1.12.20` |

← Consensus & Ethash