1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-24 13:48:56 +08:00

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: bc2c85ada1

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
This commit is contained in:
Alexander Scheel 2022-06-06 14:05:41 -04:00
parent c4a0f4689f
commit aee8cecfcd

View File

@ -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) {