2024-05-11 05:35:41 +08:00
|
|
|
//go:build openbsd
|
|
|
|
// +build openbsd
|
|
|
|
|
|
|
|
package stats
|
|
|
|
|
|
|
|
import (
|
2024-05-23 23:25:16 +08:00
|
|
|
"syscall"
|
2024-05-11 05:35:41 +08:00
|
|
|
|
2024-05-23 23:25:16 +08:00
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
|
2024-05-11 05:35:41 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func fillInDiskStatus(disk *volume_server_pb.DiskStatus) {
|
2024-05-23 23:25:16 +08:00
|
|
|
fs := syscall.Statfs_t{}
|
|
|
|
err := syscall.Statfs(disk.Dir, &fs)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2024-06-03 13:10:28 +08:00
|
|
|
|
2024-05-23 23:25:16 +08:00
|
|
|
disk.All = fs.F_blocks * uint64(fs.F_bsize)
|
|
|
|
disk.Free = fs.F_bfree * uint64(fs.F_bsize)
|
2024-06-03 13:10:28 +08:00
|
|
|
calculateDiskRemaining(disk)
|
|
|
|
|
2024-05-23 23:25:16 +08:00
|
|
|
return
|
2024-05-11 05:35:41 +08:00
|
|
|
}
|