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.
23 lines
581 B
23 lines
581 B
// +build !windows,!openbsd,!netbsd,!plan9,!solaris
|
|
|
|
package stats
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
|
)
|
|
|
|
func fillInDiskStatus(disk *volume_server_pb.DiskStatus) {
|
|
fs := syscall.Statfs_t{}
|
|
err := syscall.Statfs(disk.Dir, &fs)
|
|
if err != nil {
|
|
return
|
|
}
|
|
disk.All = fs.Blocks * uint64(fs.Bsize)
|
|
disk.Free = fs.Bfree * uint64(fs.Bsize)
|
|
disk.Used = disk.All - disk.Free
|
|
disk.PercentFree = float32((float64(disk.Free) / float64(disk.All)) * 100)
|
|
disk.PercentUsed = float32((float64(disk.Used) / float64(disk.All)) * 100)
|
|
return
|
|
}
|