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