MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / mountPointDetails

Function mountPointDetails

metric/filesystem_linux.go:79–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77}
78
79func mountPointDetails() ([]filesystemLabels, error) {
80 file, err := os.Open(procFilePath("mounts"))
81 if err != nil {
82 return nil, err
83 }
84 defer file.Close()
85
86 filesystems := []filesystemLabels{}
87 scanner := bufio.NewScanner(file)
88 for scanner.Scan() {
89 parts := strings.Fields(scanner.Text())
90
91 // Ensure we handle the translation of \040 and \011
92 // as per fstab(5).
93 parts[1] = strings.Replace(parts[1], "\\040", " ", -1)
94 parts[1] = strings.Replace(parts[1], "\\011", "\t", -1)
95
96 filesystems = append(filesystems, filesystemLabels{
97 device: parts[0],
98 mountPoint: parts[1],
99 fsType: parts[2],
100 })
101 }
102 return filesystems, scanner.Err()
103}

Callers 2

GetStatsMethod · 0.85
TestMountPointDetailsFunction · 0.85

Calls 4

procFilePathFunction · 0.85
CloseMethod · 0.65
OpenMethod · 0.45
ScanMethod · 0.45

Tested by 1

TestMountPointDetailsFunction · 0.68