Browse Source
Add support for OpenBSD (#5578)
Co-authored-by: Dave St.Germain <dcs@adullmoment.com>
pull/5581/head
Dave St.Germain
8 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
27 additions and
2 deletions
-
weed/stats/disk_notsupported.go
-
weed/stats/disk_openbsd.go
|
|
@ -1,5 +1,5 @@ |
|
|
|
//go:build openbsd || netbsd || plan9 || solaris
|
|
|
|
// +build openbsd netbsd plan9 solaris
|
|
|
|
//go:build netbsd || plan9 || solaris
|
|
|
|
// +build netbsd plan9 solaris
|
|
|
|
|
|
|
|
package stats |
|
|
|
|
|
|
|
|
|
@ -0,0 +1,25 @@ |
|
|
|
//go:build openbsd
|
|
|
|
// +build openbsd
|
|
|
|
|
|
|
|
package stats |
|
|
|
|
|
|
|
import ( |
|
|
|
"syscall" |
|
|
|
|
|
|
|
"github.com/seaweedfs/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.F_blocks * uint64(fs.F_bsize) |
|
|
|
disk.Free = fs.F_bfree * uint64(fs.F_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 |
|
|
|
} |
|
|
|
|
xxxxxxxxxx