Skip to content

Commit b1b09bc

Browse files
authored
Merge pull request #1907 from shirou/feat/remove_binary_go_file
[disk][process][freebsd]: remove binary.go from common
2 parents 3d59eeb + 2758ffc commit b1b09bc

File tree

11 files changed

+13
-654
lines changed

11 files changed

+13
-654
lines changed

disk/disk_freebsd.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ func (b bintime) Compute() float64 {
154154
func parsedevstat(buf []byte) (devstat, error) {
155155
var ds devstat
156156
br := bytes.NewReader(buf)
157-
// err := binary.Read(br, binary.LittleEndian, &ds)
158-
err := common.Read(br, binary.LittleEndian, &ds)
159-
if err != nil {
157+
if err := binary.Read(br, binary.LittleEndian, &ds); err != nil {
160158
return ds, err
161159
}
162160

disk/disk_freebsd_386.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type devstat struct {
5050
Flags uint32
5151
Device_type uint32
5252
Priority uint32
53-
Id *byte
53+
Id [sizeofPtr]byte
5454
Sequence1 uint32
5555
}
5656

disk/disk_freebsd_amd64.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type devstat struct {
5252
Device_type uint32
5353
Priority uint32
5454
Pad_cgo_1 [4]byte
55-
ID *byte
55+
ID [sizeofPtr]byte
5656
Sequence1 uint32
5757
Pad_cgo_2 [4]byte
5858
}

disk/disk_freebsd_arm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type devstat struct {
5050
Flags uint32
5151
Device_type uint32
5252
Priority uint32
53-
Id *byte
53+
Id [sizeofPtr]byte
5454
Sequence1 uint32
5555
}
5656

disk/disk_freebsd_arm64.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

disk/disk_openbsd.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCou
114114
func parseDiskstats(buf []byte) (Diskstats, error) {
115115
var ds Diskstats
116116
br := bytes.NewReader(buf)
117-
// err := binary.Read(br, binary.LittleEndian, &ds)
118-
err := common.Read(br, binary.LittleEndian, &ds)
119-
if err != nil {
117+
if err := binary.Read(br, binary.LittleEndian, &ds); err != nil {
120118
return ds, err
121119
}
122120

disk/types_freebsd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// SPDX-License-Identifier: BSD-3-Clause
22
//go:build ignore
33

4-
// Hand writing: _Ctype_struct___0
4+
// Hand writing:
5+
// - add _Ctype_struct___0 struct
6+
// - devstat.ID *byte -> [sizeOfPtr]byte in order to use binary.Read
57

68
/*
79
Input to cgo -godefs.

0 commit comments

Comments
 (0)