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