2014-07-24 19:24:01 +00:00
|
|
|
// +build !windows,!openbsd,!netbsd,!plan9,!solaris
|
2014-03-28 19:18:01 +00:00
|
|
|
|
|
|
|
package stats
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
2018-10-16 05:25:28 +00:00
|
|
|
|
2019-09-12 13:18:21 +00:00
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
2014-03-28 19:18:01 +00:00
|
|
|
)
|
|
|
|
|
2018-10-16 05:25:28 +00:00
|
|
|
func fillInDiskStatus(disk *volume_server_pb.DiskStatus) {
|
2014-03-28 19:18:01 +00:00
|
|
|
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
|
|
|
|
return
|
|
|
|
}
|