ProcStat returns stats for the filesystem.
()
| 72 | |
| 73 | // ProcStat returns stats for the filesystem. |
| 74 | func (fs FS) ProcStat() ([]*Stats, error) { |
| 75 | matches, err := filepath.Glob(fs.sys.Path("fs/ext4/*")) |
| 76 | if err != nil { |
| 77 | return nil, err |
| 78 | } |
| 79 | |
| 80 | stats := make([]*Stats, 0, len(matches)) |
| 81 | for _, m := range matches { |
| 82 | s := &Stats{} |
| 83 | |
| 84 | // "*" used in glob above indicates the name of the filesystem. |
| 85 | name := filepath.Base(m) |
| 86 | s.Name = name |
| 87 | for file, p := range map[string]*uint64{ |
| 88 | "errors_count": &s.Errors, |
| 89 | "warning_count": &s.Warnings, |
| 90 | "msg_count": &s.Messages, |
| 91 | } { |
| 92 | var val uint64 |
| 93 | val, err = parsers.ReadUintFromFile(fs.sys.Path(sysFSPath, sysFSExt4Path, name, file)) |
| 94 | if err == nil { |
| 95 | *p = val |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | stats = append(stats, s) |
| 100 | } |
| 101 | |
| 102 | return stats, nil |
| 103 | } |
nothing calls this directly
no test coverage detected