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