@@ -16,26 +16,26 @@ package ext4
16
16
17
17
import (
18
18
"fmt"
19
- "strings"
20
19
"path/filepath"
20
+ "strings"
21
21
22
22
"github.com/prometheus/procfs/internal/fs"
23
23
"github.com/prometheus/procfs/internal/util"
24
24
)
25
25
26
26
const (
27
- sysFSPath = "fs"
28
- sysFSExt4Path = "ext4"
27
+ sysFSPath = "fs"
28
+ sysFSExt4Path = "ext4"
29
29
)
30
30
31
31
// Stats contains statistics for a single Btrfs filesystem.
32
32
// See Linux fs/btrfs/sysfs.c for more information.
33
33
type Stats struct {
34
- Name string
34
+ Name string
35
35
36
- Errors uint64
37
- Warnings uint64
38
- Messages uint64
36
+ Errors uint64
37
+ Warnings uint64
38
+ Messages uint64
39
39
}
40
40
41
41
// FS represents the pseudo-filesystems proc and sys, which provides an
@@ -74,8 +74,8 @@ func NewFS(procMountPoint string, sysMountPoint string) (FS, error) {
74
74
// ProcStat returns stats for the filesystem.
75
75
func (fs FS ) ProcStat () ([]* Stats , error ) {
76
76
matches , err := filepath .Glob (fs .sys .Path ("fs/ext4/*" ))
77
- if ( err != nil ) {
78
- return nil , err
77
+ if err != nil {
78
+ return nil , err
79
79
}
80
80
81
81
stats := make ([]* Stats , 0 , len (matches ))
@@ -86,17 +86,17 @@ func (fs FS) ProcStat() ([]*Stats, error) {
86
86
name := filepath .Base (m )
87
87
s .Name = name
88
88
for file , p := range map [string ]* uint64 {
89
- "errors_count" : & s .Errors ,
90
- "warning_count" : & s .Warnings ,
91
- "msg_count" : & s .Messages ,
89
+ "errors_count" : & s .Errors ,
90
+ "warning_count" : & s .Warnings ,
91
+ "msg_count" : & s .Messages ,
92
92
} {
93
- var val uint64
94
- val , err = util .ReadUintFromFile (fs .sys .Path (sysFSPath , sysFSExt4Path , name , file ))
95
- if err != nil {
96
- fmt .Errorf ("failed to read ext4 stats from %s: %w" , file , err )
97
- } else {
98
- * p = val
99
- }
93
+ var val uint64
94
+ val , err = util .ReadUintFromFile (fs .sys .Path (sysFSPath , sysFSExt4Path , name , file ))
95
+ if err != nil {
96
+ fmt .Errorf ("failed to read ext4 stats from %s: %w" , file , err )
97
+ } else {
98
+ * p = val
99
+ }
100
100
}
101
101
102
102
stats = append (stats , s )
0 commit comments