You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
476 B
21 lines
476 B
//go:build linux
|
|
|
|
package logstorage
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
func filesystemTotalBytes(path string) (int64, error) {
|
|
var stat unix.Statfs_t
|
|
if err := unix.Statfs(path, &stat); err != nil {
|
|
return 0, err
|
|
}
|
|
return int64(stat.Blocks) * int64(stat.Bsize), nil
|
|
}
|
|
|
|
func filesystemFreeBytes(path string) (int64, error) {
|
|
var stat unix.Statfs_t
|
|
if err := unix.Statfs(path, &stat); err != nil {
|
|
return 0, err
|
|
}
|
|
return int64(stat.Bavail) * int64(stat.Bsize), nil
|
|
}
|
|
|