func GetMountRefsByDev(mounter Interface, mountPath string) ([]string, error) {
	mps, err := mounter.List()
	if err != nil {
		return nil, err
	}
	slTarget, err := filepath.EvalSymlinks(mountPath)
	if err != nil {
		slTarget = mountPath
	}
	diskDev := ""
	for i := range mps {
		if slTarget == mps[i].Path {
			diskDev = mps[i].Device
			break
		}
	}
	var refs []string
	for i := range mps {
		if mps[i].Device == diskDev || mps[i].Device == slTarget {
			if mps[i].Path != slTarget {
				refs = append(refs, mps[i].Path)
			}
		}
	}
	return refs, nil
}
GetMountRefsByDev finds all references to the device provided
by mountPath; returns a list of paths.
package mount
import (
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"syscall"
)
type FileType string
const (
	defaultMountCommand           = "mount"
	MountsInGlobalPDPath          = "mounts"
	FileTypeDirectory    FileType = "Directory"
	FileTypeFile         FileType = "File"
	FileTypeSocket       FileType = "Socket"
	FileTypeCharDev      FileType = "CharDevice"
	FileTypeBlockDev     FileType = "BlockDevice"
)
type Interface interface {
	Mount(source string, target string, fstype string, options []string) error
	Unmount(target string) error
	List() ([]MountPoint, error)
	IsMountPointMatch(mp MountPoint, dir string) bool
	IsNotMountPoint(file string) (bool, error)
	IsLikelyNotMountPoint(file string) (bool, error)
	DeviceOpened(pathname string) (bool, error)
	PathIsDevice(pathname string) (bool, error)
	GetDeviceNameFromMount(mountPath, pluginDir string) (string, error)
	MakeRShared(path string) error
	GetFileType(pathname string) (FileType, error)
	MakeFile(pathname string) error
	MakeDir(pathname string) error
	SafeMakeDir(pathname string, base string, perm os.FileMode) error
	ExistsPath(pathname string) bool
	CleanSubPaths(podDir string, volumeName string) error
	PrepareSafeSubpath(subPath Subpath) (newHostPath string, cleanupAction func(), err error)
}
type Subpath struct {
	VolumeMountIndex int
	Path string
	VolumeName string
	VolumePath string
	PodDir string
	ContainerName string
	ReadOnly bool
}
type Exec interface {
	Run(cmd string, args ...string) ([]byte, error)
}
var _ Interface = &Mounter{}
type MountPoint struct {
	Device string
	Path   string
	Type   string
	Opts   []string
	Freq   int
	Pass   int
}
type SafeFormatAndMount struct {
	Interface
	Exec
}
func (mounter *SafeFormatAndMount) FormatAndMount(source string, target string, fstype string, options []string) error {
	return mounter.formatAndMount(source, target, fstype, options)
}