2013-11-27 22:12:51 -05:00
|
|
|
// +build linux
|
|
|
|
|
2013-11-07 17:37:33 -05:00
|
|
|
package devmapper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
|
|
|
// FIXME: this is copy-pasted from the aufs driver.
|
|
|
|
// It should be moved into the core.
|
|
|
|
|
2013-11-21 19:32:16 -05:00
|
|
|
var Mounted = func(mountpoint string) (bool, error) {
|
2013-11-20 16:05:17 -05:00
|
|
|
mntpoint, err := osStat(mountpoint)
|
2013-11-07 17:37:33 -05:00
|
|
|
if err != nil {
|
2013-11-20 16:05:17 -05:00
|
|
|
if osIsNotExist(err) {
|
2013-11-07 17:37:33 -05:00
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
return false, err
|
|
|
|
}
|
2013-11-20 16:05:17 -05:00
|
|
|
parent, err := osStat(filepath.Join(mountpoint, ".."))
|
2013-11-07 17:37:33 -05:00
|
|
|
if err != nil {
|
|
|
|
return false, err
|
|
|
|
}
|
2013-11-20 15:49:01 -05:00
|
|
|
mntpointSt := toSysStatT(mntpoint.Sys())
|
|
|
|
parentSt := toSysStatT(parent.Sys())
|
2013-11-07 17:37:33 -05:00
|
|
|
return mntpointSt.Dev != parentSt.Dev, nil
|
|
|
|
}
|