github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/command/agent/host/linux.go (about) 1 //go:build linux 2 // +build linux 3 4 package host 5 6 import ( 7 "bufio" 8 "os" 9 "strings" 10 ) 11 12 // mountedPaths produces a list of mounts 13 func mountedPaths() []string { 14 fh, err := os.Open("/proc/mounts") 15 if err != nil { 16 return []string{err.Error()} 17 } 18 rd := bufio.NewReader(fh) 19 20 var paths []string 21 for { 22 str, err := rd.ReadString('\n') 23 if err != nil { 24 break 25 } 26 27 ln := strings.Split(str, " ") 28 switch ln[2] { 29 case "autofs", "binfmt_misc", "cgroup", "debugfs", 30 "devpts", "devtmpfs", 31 "fusectl", "fuse.lxcfs", 32 "hugetlbfs", "mqueue", 33 "proc", "pstore", "rpc_pipefs", "securityfs", 34 "sysfs", "tmpfs", "vboxsf": 35 continue 36 default: 37 } 38 39 paths = append(paths, ln[1]) 40 } 41 42 return paths 43 }