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
429 B

  1. // +build !windows,!openbsd,!netbsd,!plan9,!solaris
  2. package stats
  3. import (
  4. "syscall"
  5. "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
  6. )
  7. func fillInDiskStatus(disk *volume_server_pb.DiskStatus) {
  8. fs := syscall.Statfs_t{}
  9. err := syscall.Statfs(disk.Dir, &fs)
  10. if err != nil {
  11. return
  12. }
  13. disk.All = fs.Blocks * uint64(fs.Bsize)
  14. disk.Free = fs.Bfree * uint64(fs.Bsize)
  15. disk.Used = disk.All - disk.Free
  16. return
  17. }