From aee8cecfcddaae298eb1bf2b51791e3a134a8454 Mon Sep 17 00:00:00 2001 From: Alexander Scheel Date: Mon, 6 Jun 2022 14:05:41 -0400 Subject: [PATCH] Mirror updated x/sys/unix OpenBSD Statfs_t fields Per change in x/sys/unix, these Statfs_t fields are now converted to []byte rather than []int8. Callers with updated x/sys/unix versions will now see something like: > Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:59:53: cannot use stat.F_mntfromname[:] (type []byte) as type []int8 in argument to common.IntToString > Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:60:51: cannot use stat.F_mntonname[:] (type []byte) as type []int8 in argument to common.IntToString > Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:61:52: cannot use stat.F_fstypename[:] (type []byte) as type []int8 in argument to common.IntToString > Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:149:45: cannot use stat.F_fstypename[:] (type []byte) as type []int8 in argument to common.IntToString It is probably prudent to update to the newer struct definitions as a result. See also: https://groups.google.com/g/golang-codereviews/c/bPBR9-4hV6E See also: https://go-review.googlesource.com/c/sys/+/407195/2 See also: https://github.com/golang/sys/commit/bc2c85ada10aa9b6aa9607e9ac9ad0761b95cf1d Signed-off-by: Alexander Scheel --- disk/disk_openbsd.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/disk/disk_openbsd.go b/disk/disk_openbsd.go index e0658650..81ff2399 100644 --- a/disk/disk_openbsd.go +++ b/disk/disk_openbsd.go @@ -57,9 +57,9 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro } d := PartitionStat{ - Device: common.IntToString(stat.F_mntfromname[:]), - Mountpoint: common.IntToString(stat.F_mntonname[:]), - Fstype: common.IntToString(stat.F_fstypename[:]), + Device: common.ByteToString(stat.F_mntfromname[:]), + Mountpoint: common.ByteToString(stat.F_mntonname[:]), + Fstype: common.ByteToString(stat.F_fstypename[:]), Opts: opts, } @@ -147,7 +147,7 @@ func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { } func getFsType(stat unix.Statfs_t) string { - return common.IntToString(stat.F_fstypename[:]) + return common.ByteToString(stat.F_fstypename[:]) } func SerialNumberWithContext(ctx context.Context, name string) (string, error) {