Really switch to moby/sys/mount*

Switch to moby/sys/mount and mountinfo. Keep the pkg/mount for potential
outside users.

This commit was generated by the following bash script:

```
set -e -u -o pipefail

for file in $(git grep -l 'docker/docker/pkg/mount"' | grep -v ^pkg/mount); do
	sed -i -e 's#/docker/docker/pkg/mount"#/moby/sys/mount"#' \
		-e 's#mount\.\(GetMounts\|Mounted\|Info\|[A-Za-z]*Filter\)#mountinfo.\1#g' \
		$file
	goimports -w $file
done
```

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-03-13 16:38:24 -07:00
parent 59c0495409
commit 39048cf656
36 changed files with 61 additions and 53 deletions

View File

@ -13,10 +13,10 @@ import (
containertypes "github.com/docker/docker/api/types/container" containertypes "github.com/docker/docker/api/types/container"
mounttypes "github.com/docker/docker/api/types/mount" mounttypes "github.com/docker/docker/api/types/mount"
swarmtypes "github.com/docker/docker/api/types/swarm" swarmtypes "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/volume" "github.com/docker/docker/volume"
volumemounts "github.com/docker/docker/volume/mounts" volumemounts "github.com/docker/docker/volume/mounts"
"github.com/moby/sys/mount"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View File

@ -15,10 +15,10 @@ import (
"github.com/docker/docker/daemon/links" "github.com/docker/docker/daemon/links"
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
"github.com/docker/libnetwork" "github.com/docker/libnetwork"
"github.com/moby/sys/mount"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View File

@ -9,8 +9,9 @@ import (
"strings" "strings"
"github.com/docker/docker/daemon/config" "github.com/docker/docker/daemon/config"
"github.com/docker/docker/pkg/mount"
"github.com/docker/libnetwork/resolvconf" "github.com/docker/libnetwork/resolvconf"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -75,7 +76,7 @@ func (daemon *Daemon) cleanupMounts() error {
return err return err
} }
info, err := mount.GetMounts(mount.SingleEntryFilter(daemon.root)) info, err := mountinfo.GetMounts(mountinfo.SingleEntryFilter(daemon.root))
if err != nil { if err != nil {
return errors.Wrap(err, "error reading mount table for cleanup") return errors.Wrap(err, "error reading mount table for cleanup")
} }
@ -122,7 +123,7 @@ func getCleanPatterns(id string) (regexps []*regexp.Regexp) {
return return
} }
func shouldUnmountRoot(root string, info *mount.Info) bool { func shouldUnmountRoot(root string, info *mountinfo.Info) bool {
if !strings.HasSuffix(root, info.Root) { if !strings.HasSuffix(root, info.Root) {
return false return false
} }

View File

@ -11,7 +11,8 @@ import (
containertypes "github.com/docker/docker/api/types/container" containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/daemon/config" "github.com/docker/docker/daemon/config"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp" is "gotest.tools/v3/assert/cmp"
) )
@ -123,25 +124,25 @@ func TestShouldUnmountRoot(t *testing.T) {
for _, test := range []struct { for _, test := range []struct {
desc string desc string
root string root string
info *mount.Info info *mountinfo.Info
expect bool expect bool
}{ }{
{ {
desc: "root is at /", desc: "root is at /",
root: "/docker", root: "/docker",
info: &mount.Info{Root: "/docker", Mountpoint: "/docker"}, info: &mountinfo.Info{Root: "/docker", Mountpoint: "/docker"},
expect: true, expect: true,
}, },
{ {
desc: "root is at in a submount from `/`", desc: "root is at in a submount from `/`",
root: "/foo/docker", root: "/foo/docker",
info: &mount.Info{Root: "/docker", Mountpoint: "/foo/docker"}, info: &mountinfo.Info{Root: "/docker", Mountpoint: "/foo/docker"},
expect: true, expect: true,
}, },
{ {
desc: "root is mounted in from a parent mount namespace same root dir", // dind is an example of this desc: "root is mounted in from a parent mount namespace same root dir", // dind is an example of this
root: "/docker", root: "/docker",
info: &mount.Info{Root: "/docker/volumes/1234657/_data", Mountpoint: "/docker"}, info: &mountinfo.Info{Root: "/docker/volumes/1234657/_data", Mountpoint: "/docker"},
expect: false, expect: false,
}, },
} { } {
@ -172,7 +173,7 @@ func TestShouldUnmountRoot(t *testing.T) {
func checkMounted(t *testing.T, p string, expect bool) { func checkMounted(t *testing.T, p string, expect bool) {
t.Helper() t.Helper()
mounted, err := mount.Mounted(p) mounted, err := mountinfo.Mounted(p)
assert.Check(t, err) assert.Check(t, err)
assert.Check(t, mounted == expect, "expected %v, actual %v", expect, mounted) assert.Check(t, mounted == expect, "expected %v, actual %v", expect, mounted)
} }

View File

@ -29,7 +29,6 @@ import (
"github.com/docker/docker/pkg/containerfs" "github.com/docker/docker/pkg/containerfs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/sysinfo" "github.com/docker/docker/pkg/sysinfo"
@ -42,6 +41,7 @@ import (
"github.com/docker/libnetwork/netutils" "github.com/docker/libnetwork/netutils"
"github.com/docker/libnetwork/options" "github.com/docker/libnetwork/options"
lntypes "github.com/docker/libnetwork/types" lntypes "github.com/docker/libnetwork/types"
"github.com/moby/sys/mount"
"github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/cgroups"
rsystem "github.com/opencontainers/runc/libcontainer/system" rsystem "github.com/opencontainers/runc/libcontainer/system"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"

View File

@ -42,8 +42,8 @@ import (
"github.com/docker/docker/pkg/directory" "github.com/docker/docker/pkg/directory"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/locker"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/moby/sys/mount"
rsystem "github.com/opencontainers/runc/libcontainer/system" rsystem "github.com/opencontainers/runc/libcontainer/system"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"

View File

@ -7,7 +7,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mount"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

View File

@ -29,10 +29,10 @@ import (
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/containerfs" "github.com/docker/docker/pkg/containerfs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
units "github.com/docker/go-units" units "github.com/docker/go-units"
"github.com/moby/sys/mount"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View File

@ -24,10 +24,10 @@ import (
"github.com/docker/docker/pkg/dmesg" "github.com/docker/docker/pkg/dmesg"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/loopback" "github.com/docker/docker/pkg/loopback"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
units "github.com/docker/go-units" units "github.com/docker/go-units"
"github.com/moby/sys/mount"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View File

@ -14,8 +14,8 @@ import (
"github.com/docker/docker/pkg/devicemapper" "github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/locker"
"github.com/docker/docker/pkg/mount"
units "github.com/docker/go-units" units "github.com/docker/go-units"
"github.com/moby/sys/mount"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

View File

@ -1,7 +1,7 @@
package graphdriver // import "github.com/docker/docker/daemon/graphdriver" package graphdriver // import "github.com/docker/docker/daemon/graphdriver"
import ( import (
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mountinfo"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@ -113,7 +113,7 @@ type defaultChecker struct {
} }
func (c *defaultChecker) IsMounted(path string) bool { func (c *defaultChecker) IsMounted(path string) bool {
m, _ := mount.Mounted(path) m, _ := mountinfo.Mounted(path)
return m return m
} }

View File

@ -22,9 +22,9 @@ import (
"github.com/docker/docker/pkg/directory" "github.com/docker/docker/pkg/directory"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/locker"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/moby/sys/mount"
rsystem "github.com/opencontainers/runc/libcontainer/system" rsystem "github.com/opencontainers/runc/libcontainer/system"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"

View File

@ -20,9 +20,9 @@ import (
"github.com/docker/docker/pkg/fsutils" "github.com/docker/docker/pkg/fsutils"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/locker"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/moby/sys/mount"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"

View File

@ -25,10 +25,10 @@ import (
"github.com/docker/docker/pkg/fsutils" "github.com/docker/docker/pkg/fsutils"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/locker"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
units "github.com/docker/go-units" units "github.com/docker/go-units"
"github.com/moby/sys/mount"
rsystem "github.com/opencontainers/runc/libcontainer/system" rsystem "github.com/opencontainers/runc/libcontainer/system"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View File

@ -15,9 +15,10 @@ import (
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/containerfs" "github.com/docker/docker/pkg/containerfs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
zfs "github.com/mistifyio/go-zfs" zfs "github.com/mistifyio/go-zfs"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -148,7 +149,7 @@ func lookupZfsDataset(rootdir string) (string, error) {
} }
wantedDev := stat.Dev wantedDev := stat.Dev
mounts, err := mount.GetMounts(nil) mounts, err := mountinfo.GetMounts(nil)
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -20,10 +20,11 @@ import (
"github.com/docker/docker/oci" "github.com/docker/docker/oci"
"github.com/docker/docker/oci/caps" "github.com/docker/docker/oci/caps"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/rootless/specconv" "github.com/docker/docker/rootless/specconv"
volumemounts "github.com/docker/docker/volume/mounts" volumemounts "github.com/docker/docker/volume/mounts"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"github.com/opencontainers/runc/libcontainer/apparmor" "github.com/opencontainers/runc/libcontainer/apparmor"
"github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/devices" "github.com/opencontainers/runc/libcontainer/devices"
@ -368,7 +369,7 @@ func getSourceMount(source string) (string, string, error) {
return "", "", err return "", "", err
} }
mi, err := mount.GetMounts(mount.ParentsFilter(sourcePath)) mi, err := mountinfo.GetMounts(mountinfo.ParentsFilter(sourcePath))
if err != nil { if err != nil {
return "", "", err return "", "", err
} }

View File

@ -12,7 +12,7 @@ import (
containertypes "github.com/docker/docker/api/types/container" containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/container" "github.com/docker/docker/container"
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mount"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )

View File

@ -12,8 +12,8 @@ import (
mounttypes "github.com/docker/docker/api/types/mount" mounttypes "github.com/docker/docker/api/types/mount"
"github.com/docker/docker/container" "github.com/docker/docker/container"
"github.com/docker/docker/pkg/fileutils" "github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/mount"
volumemounts "github.com/docker/docker/volume/mounts" volumemounts "github.com/docker/docker/volume/mounts"
"github.com/moby/sys/mount"
) )
// setupMounts iterates through each of the mount points for a container and // setupMounts iterates through each of the mount points for a container and

View File

@ -26,11 +26,11 @@ import (
"github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/cli/build"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/testutil/request" "github.com/docker/docker/testutil/request"
"github.com/docker/docker/volume" "github.com/docker/docker/volume"
"github.com/docker/go-connections/nat" "github.com/docker/go-connections/nat"
"github.com/moby/sys/mount"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp" is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/poll" "gotest.tools/v3/poll"

View File

@ -32,11 +32,11 @@ import (
"github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/cli/build"
"github.com/docker/docker/integration-cli/daemon" "github.com/docker/docker/integration-cli/daemon"
"github.com/docker/docker/opts" "github.com/docker/docker/opts"
"github.com/docker/docker/pkg/mount"
testdaemon "github.com/docker/docker/testutil/daemon" testdaemon "github.com/docker/docker/testutil/daemon"
units "github.com/docker/go-units" units "github.com/docker/go-units"
"github.com/docker/libnetwork/iptables" "github.com/docker/libnetwork/iptables"
"github.com/docker/libtrust" "github.com/docker/libtrust"
"github.com/moby/sys/mount"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
"gotest.tools/v3/icmd" "gotest.tools/v3/icmd"

View File

@ -27,7 +27,6 @@ import (
"github.com/docker/docker/client" "github.com/docker/docker/client"
"github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/cli/build"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
"github.com/docker/docker/testutil" "github.com/docker/docker/testutil"
@ -35,6 +34,8 @@ import (
"github.com/docker/go-connections/nat" "github.com/docker/go-connections/nat"
"github.com/docker/libnetwork/resolvconf" "github.com/docker/libnetwork/resolvconf"
"github.com/docker/libnetwork/types" "github.com/docker/libnetwork/types"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
"gotest.tools/v3/icmd" "gotest.tools/v3/icmd"
) )
@ -1438,7 +1439,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
// This test case is meant to test monitoring resolv.conf when it is // This test case is meant to test monitoring resolv.conf when it is
// a regular file not a bind mounc. So we unmount resolv.conf and replace // a regular file not a bind mounc. So we unmount resolv.conf and replace
// it with a file containing the original settings. // it with a file containing the original settings.
mounted, err := mount.Mounted("/etc/resolv.conf") mounted, err := mountinfo.Mounted("/etc/resolv.conf")
if err != nil { if err != nil {
c.Fatal(err) c.Fatal(err)
} }
@ -3789,7 +3790,7 @@ func (s *DockerSuite) TestRunVolumesMountedAsShared(c *testing.T) {
dockerCmd(c, "run", "--privileged", "-v", fmt.Sprintf("%s:/volume-dest:shared", tmpDir), "busybox", "mount", "--bind", "/volume-dest/mnt1", "/volume-dest/mnt1") dockerCmd(c, "run", "--privileged", "-v", fmt.Sprintf("%s:/volume-dest:shared", tmpDir), "busybox", "mount", "--bind", "/volume-dest/mnt1", "/volume-dest/mnt1")
// Make sure a bind mount under a shared volume propagated to host. // Make sure a bind mount under a shared volume propagated to host.
if mounted, _ := mount.Mounted(path.Join(tmpDir, "mnt1")); !mounted { if mounted, _ := mountinfo.Mounted(path.Join(tmpDir, "mnt1")); !mounted {
c.Fatalf("Bind mount under shared volume did not propagate to host") c.Fatalf("Bind mount under shared volume did not propagate to host")
} }

View File

@ -23,9 +23,9 @@ import (
"github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/cli/build"
"github.com/docker/docker/pkg/homedir" "github.com/docker/docker/pkg/homedir"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/sysinfo" "github.com/docker/docker/pkg/sysinfo"
"github.com/moby/sys/mount"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
"gotest.tools/v3/icmd" "gotest.tools/v3/icmd"
) )

View File

@ -14,8 +14,8 @@ import (
"github.com/docker/docker/api/types/versions" "github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client" "github.com/docker/docker/client"
"github.com/docker/docker/integration/internal/container" "github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/moby/sys/mount"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp" is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/fs" "gotest.tools/v3/fs"

View File

@ -10,8 +10,8 @@ import (
"syscall" "syscall"
"github.com/containerd/continuity/fs" "github.com/containerd/continuity/fs"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/moby/sys/mount"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

View File

@ -9,9 +9,9 @@ import (
"syscall" "syscall"
"testing" "testing"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/reexec"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/moby/sys/mount"
rsystem "github.com/opencontainers/runc/libcontainer/system" rsystem "github.com/opencontainers/runc/libcontainer/system"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"

View File

@ -6,7 +6,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
rsystem "github.com/opencontainers/runc/libcontainer/system" rsystem "github.com/opencontainers/runc/libcontainer/system"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@ -36,7 +37,7 @@ func chroot(path string) (err error) {
return err return err
} }
if mounted, _ := mount.Mounted(path); !mounted { if mounted, _ := mountinfo.Mounted(path); !mounted {
if err := mount.Mount(path, path, "bind", "rbind,rw"); err != nil { if err := mount.Mount(path, path, "bind", "rbind,rw"); err != nil {
return realChroot(path) return realChroot(path)
} }

View File

@ -5,7 +5,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mount"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

View File

@ -8,7 +8,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mount"
"gotest.tools/v3/skip" "gotest.tools/v3/skip"
) )

View File

@ -27,12 +27,12 @@ import (
"github.com/docker/docker/layer" "github.com/docker/docker/layer"
"github.com/docker/docker/pkg/authorization" "github.com/docker/docker/pkg/authorization"
"github.com/docker/docker/pkg/chrootarchive" "github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/progress" "github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
v2 "github.com/docker/docker/plugin/v2" v2 "github.com/docker/docker/plugin/v2"
refstore "github.com/docker/docker/reference" refstore "github.com/docker/docker/reference"
"github.com/moby/sys/mount"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"

View File

@ -18,11 +18,11 @@ import (
"github.com/docker/docker/layer" "github.com/docker/docker/layer"
"github.com/docker/docker/pkg/authorization" "github.com/docker/docker/pkg/authorization"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/pubsub" "github.com/docker/docker/pkg/pubsub"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
v2 "github.com/docker/docker/plugin/v2" v2 "github.com/docker/docker/plugin/v2"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/moby/sys/mount"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"

View File

@ -12,10 +12,10 @@ import (
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/containerfs" "github.com/docker/docker/pkg/containerfs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/plugins" "github.com/docker/docker/pkg/plugins"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
v2 "github.com/docker/docker/plugin/v2" v2 "github.com/docker/docker/plugin/v2"
"github.com/moby/sys/mount"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View File

@ -9,10 +9,11 @@ import (
"testing" "testing"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
v2 "github.com/docker/docker/plugin/v2" v2 "github.com/docker/docker/plugin/v2"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"
"gotest.tools/v3/skip" "gotest.tools/v3/skip"
@ -64,7 +65,7 @@ func TestManagerWithPluginMounts(t *testing.T) {
if err := m.Remove(p1.GetID(), &types.PluginRmConfig{ForceRemove: true}); err != nil { if err := m.Remove(p1.GetID(), &types.PluginRmConfig{ForceRemove: true}); err != nil {
t.Fatal(err) t.Fatal(err)
} }
if mounted, err := mount.Mounted(p2Mount); !mounted || err != nil { if mounted, err := mountinfo.Mounted(p2Mount); !mounted || err != nil {
t.Fatalf("expected %s to be mounted, err: %v", p2Mount, err) t.Fatalf("expected %s to be mounted, err: %v", p2Mount, err)
} }
} }

View File

@ -19,11 +19,11 @@ import (
"github.com/docker/docker/client" "github.com/docker/docker/client"
"github.com/docker/docker/opts" "github.com/docker/docker/opts"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/testutil/request" "github.com/docker/docker/testutil/request"
"github.com/docker/go-connections/sockets" "github.com/docker/go-connections/sockets"
"github.com/docker/go-connections/tlsconfig" "github.com/docker/go-connections/tlsconfig"
"github.com/moby/sys/mount"
"github.com/pkg/errors" "github.com/pkg/errors"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
) )

View File

@ -16,8 +16,9 @@ import (
"github.com/docker/docker/daemon/names" "github.com/docker/docker/daemon/names"
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/volume" "github.com/docker/docker/volume"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -335,7 +336,7 @@ func (v *localVolume) Unmount(id string) error {
func (v *localVolume) unmount() error { func (v *localVolume) unmount() error {
if v.opts != nil { if v.opts != nil {
if err := mount.Unmount(v.path); err != nil { if err := mount.Unmount(v.path); err != nil {
if mounted, mErr := mount.Mounted(v.path); mounted || mErr != nil { if mounted, mErr := mountinfo.Mounted(v.path); mounted || mErr != nil {
return errdefs.System(err) return errdefs.System(err)
} }
} }

View File

@ -10,7 +10,7 @@ import (
"testing" "testing"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mountinfo"
"gotest.tools/v3/skip" "gotest.tools/v3/skip"
) )
@ -211,7 +211,7 @@ func TestCreateWithOpts(t *testing.T) {
} }
}() }()
mountInfos, err := mount.GetMounts(mount.SingleEntryFilter(dir)) mountInfos, err := mountinfo.GetMounts(mountinfo.SingleEntryFilter(dir))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -253,7 +253,7 @@ func TestCreateWithOpts(t *testing.T) {
t.Fatalf("Expected active mount count to be 1, got %d", v.active.count) t.Fatalf("Expected active mount count to be 1, got %d", v.active.count)
} }
mounted, err := mount.Mounted(v.path) mounted, err := mountinfo.Mounted(v.path)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -15,7 +15,7 @@ import (
"time" "time"
"github.com/docker/docker/errdefs" "github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/mount" "github.com/moby/sys/mount"
"github.com/pkg/errors" "github.com/pkg/errors"
) )