open-nomad/command/agent/host/linux.go
Mahmood Ali 4d90afb425 gofmt all the files
mostly to handle build directives in 1.17.
2021-10-01 10:14:28 -04:00

44 lines
707 B
Go

//go:build linux
// +build linux
package host
import (
"bufio"
"os"
"strings"
)
// mountedPaths produces a list of mounts
func mountedPaths() []string {
fh, err := os.Open("/proc/mounts")
if err != nil {
return []string{err.Error()}
}
rd := bufio.NewReader(fh)
var paths []string
for {
str, err := rd.ReadString('\n')
if err != nil {
break
}
ln := strings.Split(str, " ")
switch ln[2] {
case "autofs", "binfmt_misc", "cgroup", "debugfs",
"devpts", "devtmpfs",
"fusectl", "fuse.lxcfs",
"hugetlbfs", "mqueue",
"proc", "pstore", "rpc_pipefs", "securityfs",
"sysfs", "tmpfs", "vboxsf":
continue
default:
}
paths = append(paths, ln[1])
}
return paths
}