github.com/tschmi5/nomad@v0.11.8/helper/mount/mount_linux.go (about) 1 // +build linux 2 3 package mount 4 5 import ( 6 docker_mount "github.com/docker/docker/pkg/mount" 7 ) 8 9 // mounter provides the default implementation of mount.Mounter 10 // for the linux platform. 11 // Currently it delegates to the docker `mount` package. 12 type mounter struct { 13 } 14 15 // New returns a Mounter for the current system. 16 func New() Mounter { 17 return &mounter{} 18 } 19 20 // IsNotAMountPoint determines if a directory is not a mountpoint. 21 // It does this by checking the path against the contents of /proc/self/mountinfo 22 func (m *mounter) IsNotAMountPoint(path string) (bool, error) { 23 isMount, err := docker_mount.Mounted(path) 24 return !isMount, err 25 } 26 27 func (m *mounter) Mount(device, target, mountType, options string) error { 28 // Defer to the docker implementation of `Mount`, it's correct enough for our 29 // usecase and avoids us needing to shell out to the `mount` utility. 30 return docker_mount.Mount(device, target, mountType, options) 31 }