mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete * 2.1.0 main node rollup
23 lines
324 B
Go
23 lines
324 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package utils
|
|
|
|
import (
|
|
"log"
|
|
|
|
"go.uber.org/zap"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func GetDiskSpace(dir string) uint64 {
|
|
var stat unix.Statfs_t
|
|
|
|
err := unix.Statfs(dir, &stat)
|
|
if err != nil {
|
|
log.Panic("failed statfs", zap.Error(err))
|
|
}
|
|
|
|
return stat.Bavail * uint64(stat.Bsize)
|
|
}
|