1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #36437 from kolyshkin/dm-unused

devmapper.Mounted: remove
This commit is contained in:
Brian Goff 2018-03-05 18:14:36 -08:00 committed by GitHub
commit a6b1d2ea29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,30 +6,8 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"os" "os"
"path/filepath"
"golang.org/x/sys/unix"
) )
// FIXME: this is copy-pasted from the aufs driver.
// It should be moved into the core.
// Mounted returns true if a mount point exists.
func Mounted(mountpoint string) (bool, error) {
var mntpointSt unix.Stat_t
if err := unix.Stat(mountpoint, &mntpointSt); err != nil {
if os.IsNotExist(err) {
return false, nil
}
return false, err
}
var parentSt unix.Stat_t
if err := unix.Stat(filepath.Join(mountpoint, ".."), &parentSt); err != nil {
return false, err
}
return mntpointSt.Dev != parentSt.Dev, nil
}
type probeData struct { type probeData struct {
fsName string fsName string
magic string magic string