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>
| ... | ... |
@@ -13,10 +13,10 @@ import ( |
| 13 | 13 |
containertypes "github.com/docker/docker/api/types/container" |
| 14 | 14 |
mounttypes "github.com/docker/docker/api/types/mount" |
| 15 | 15 |
swarmtypes "github.com/docker/docker/api/types/swarm" |
| 16 |
- "github.com/docker/docker/pkg/mount" |
|
| 17 | 16 |
"github.com/docker/docker/pkg/stringid" |
| 18 | 17 |
"github.com/docker/docker/volume" |
| 19 | 18 |
volumemounts "github.com/docker/docker/volume/mounts" |
| 19 |
+ "github.com/moby/sys/mount" |
|
| 20 | 20 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 21 | 21 |
"github.com/pkg/errors" |
| 22 | 22 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -15,10 +15,10 @@ import ( |
| 15 | 15 |
"github.com/docker/docker/daemon/links" |
| 16 | 16 |
"github.com/docker/docker/errdefs" |
| 17 | 17 |
"github.com/docker/docker/pkg/idtools" |
| 18 |
- "github.com/docker/docker/pkg/mount" |
|
| 19 | 18 |
"github.com/docker/docker/pkg/stringid" |
| 20 | 19 |
"github.com/docker/docker/runconfig" |
| 21 | 20 |
"github.com/docker/libnetwork" |
| 21 |
+ "github.com/moby/sys/mount" |
|
| 22 | 22 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 23 | 23 |
"github.com/pkg/errors" |
| 24 | 24 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -9,8 +9,9 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/daemon/config" |
| 12 |
- "github.com/docker/docker/pkg/mount" |
|
| 13 | 12 |
"github.com/docker/libnetwork/resolvconf" |
| 13 |
+ "github.com/moby/sys/mount" |
|
| 14 |
+ "github.com/moby/sys/mountinfo" |
|
| 14 | 15 |
"github.com/pkg/errors" |
| 15 | 16 |
"github.com/sirupsen/logrus" |
| 16 | 17 |
) |
| ... | ... |
@@ -75,7 +76,7 @@ func (daemon *Daemon) cleanupMounts() error {
|
| 75 | 75 |
return err |
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 |
- info, err := mount.GetMounts(mount.SingleEntryFilter(daemon.root)) |
|
| 78 |
+ info, err := mountinfo.GetMounts(mountinfo.SingleEntryFilter(daemon.root)) |
|
| 79 | 79 |
if err != nil {
|
| 80 | 80 |
return errors.Wrap(err, "error reading mount table for cleanup") |
| 81 | 81 |
} |
| ... | ... |
@@ -122,7 +123,7 @@ func getCleanPatterns(id string) (regexps []*regexp.Regexp) {
|
| 122 | 122 |
return |
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 |
-func shouldUnmountRoot(root string, info *mount.Info) bool {
|
|
| 125 |
+func shouldUnmountRoot(root string, info *mountinfo.Info) bool {
|
|
| 126 | 126 |
if !strings.HasSuffix(root, info.Root) {
|
| 127 | 127 |
return false |
| 128 | 128 |
} |
| ... | ... |
@@ -11,7 +11,8 @@ import ( |
| 11 | 11 |
|
| 12 | 12 |
containertypes "github.com/docker/docker/api/types/container" |
| 13 | 13 |
"github.com/docker/docker/daemon/config" |
| 14 |
- "github.com/docker/docker/pkg/mount" |
|
| 14 |
+ "github.com/moby/sys/mount" |
|
| 15 |
+ "github.com/moby/sys/mountinfo" |
|
| 15 | 16 |
"gotest.tools/v3/assert" |
| 16 | 17 |
is "gotest.tools/v3/assert/cmp" |
| 17 | 18 |
) |
| ... | ... |
@@ -123,25 +124,25 @@ func TestShouldUnmountRoot(t *testing.T) {
|
| 123 | 123 |
for _, test := range []struct {
|
| 124 | 124 |
desc string |
| 125 | 125 |
root string |
| 126 |
- info *mount.Info |
|
| 126 |
+ info *mountinfo.Info |
|
| 127 | 127 |
expect bool |
| 128 | 128 |
}{
|
| 129 | 129 |
{
|
| 130 | 130 |
desc: "root is at /", |
| 131 | 131 |
root: "/docker", |
| 132 |
- info: &mount.Info{Root: "/docker", Mountpoint: "/docker"},
|
|
| 132 |
+ info: &mountinfo.Info{Root: "/docker", Mountpoint: "/docker"},
|
|
| 133 | 133 |
expect: true, |
| 134 | 134 |
}, |
| 135 | 135 |
{
|
| 136 | 136 |
desc: "root is at in a submount from `/`", |
| 137 | 137 |
root: "/foo/docker", |
| 138 |
- info: &mount.Info{Root: "/docker", Mountpoint: "/foo/docker"},
|
|
| 138 |
+ info: &mountinfo.Info{Root: "/docker", Mountpoint: "/foo/docker"},
|
|
| 139 | 139 |
expect: true, |
| 140 | 140 |
}, |
| 141 | 141 |
{
|
| 142 | 142 |
desc: "root is mounted in from a parent mount namespace same root dir", // dind is an example of this |
| 143 | 143 |
root: "/docker", |
| 144 |
- info: &mount.Info{Root: "/docker/volumes/1234657/_data", Mountpoint: "/docker"},
|
|
| 144 |
+ info: &mountinfo.Info{Root: "/docker/volumes/1234657/_data", Mountpoint: "/docker"},
|
|
| 145 | 145 |
expect: false, |
| 146 | 146 |
}, |
| 147 | 147 |
} {
|
| ... | ... |
@@ -172,7 +173,7 @@ func TestShouldUnmountRoot(t *testing.T) {
|
| 172 | 172 |
|
| 173 | 173 |
func checkMounted(t *testing.T, p string, expect bool) {
|
| 174 | 174 |
t.Helper() |
| 175 |
- mounted, err := mount.Mounted(p) |
|
| 175 |
+ mounted, err := mountinfo.Mounted(p) |
|
| 176 | 176 |
assert.Check(t, err) |
| 177 | 177 |
assert.Check(t, mounted == expect, "expected %v, actual %v", expect, mounted) |
| 178 | 178 |
} |
| ... | ... |
@@ -29,7 +29,6 @@ import ( |
| 29 | 29 |
"github.com/docker/docker/pkg/containerfs" |
| 30 | 30 |
"github.com/docker/docker/pkg/idtools" |
| 31 | 31 |
"github.com/docker/docker/pkg/ioutils" |
| 32 |
- "github.com/docker/docker/pkg/mount" |
|
| 33 | 32 |
"github.com/docker/docker/pkg/parsers" |
| 34 | 33 |
"github.com/docker/docker/pkg/parsers/kernel" |
| 35 | 34 |
"github.com/docker/docker/pkg/sysinfo" |
| ... | ... |
@@ -42,6 +41,7 @@ import ( |
| 42 | 42 |
"github.com/docker/libnetwork/netutils" |
| 43 | 43 |
"github.com/docker/libnetwork/options" |
| 44 | 44 |
lntypes "github.com/docker/libnetwork/types" |
| 45 |
+ "github.com/moby/sys/mount" |
|
| 45 | 46 |
"github.com/opencontainers/runc/libcontainer/cgroups" |
| 46 | 47 |
rsystem "github.com/opencontainers/runc/libcontainer/system" |
| 47 | 48 |
specs "github.com/opencontainers/runtime-spec/specs-go" |
| ... | ... |
@@ -42,8 +42,8 @@ import ( |
| 42 | 42 |
"github.com/docker/docker/pkg/directory" |
| 43 | 43 |
"github.com/docker/docker/pkg/idtools" |
| 44 | 44 |
"github.com/docker/docker/pkg/locker" |
| 45 |
- "github.com/docker/docker/pkg/mount" |
|
| 46 | 45 |
"github.com/docker/docker/pkg/system" |
| 46 |
+ "github.com/moby/sys/mount" |
|
| 47 | 47 |
rsystem "github.com/opencontainers/runc/libcontainer/system" |
| 48 | 48 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 49 | 49 |
"github.com/pkg/errors" |
| ... | ... |
@@ -29,10 +29,10 @@ import ( |
| 29 | 29 |
"github.com/docker/docker/daemon/graphdriver" |
| 30 | 30 |
"github.com/docker/docker/pkg/containerfs" |
| 31 | 31 |
"github.com/docker/docker/pkg/idtools" |
| 32 |
- "github.com/docker/docker/pkg/mount" |
|
| 33 | 32 |
"github.com/docker/docker/pkg/parsers" |
| 34 | 33 |
"github.com/docker/docker/pkg/system" |
| 35 | 34 |
units "github.com/docker/go-units" |
| 35 |
+ "github.com/moby/sys/mount" |
|
| 36 | 36 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 37 | 37 |
"github.com/pkg/errors" |
| 38 | 38 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -24,10 +24,10 @@ import ( |
| 24 | 24 |
"github.com/docker/docker/pkg/dmesg" |
| 25 | 25 |
"github.com/docker/docker/pkg/idtools" |
| 26 | 26 |
"github.com/docker/docker/pkg/loopback" |
| 27 |
- "github.com/docker/docker/pkg/mount" |
|
| 28 | 27 |
"github.com/docker/docker/pkg/parsers" |
| 29 | 28 |
"github.com/docker/docker/pkg/parsers/kernel" |
| 30 | 29 |
units "github.com/docker/go-units" |
| 30 |
+ "github.com/moby/sys/mount" |
|
| 31 | 31 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 32 | 32 |
"github.com/pkg/errors" |
| 33 | 33 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -14,8 +14,8 @@ import ( |
| 14 | 14 |
"github.com/docker/docker/pkg/devicemapper" |
| 15 | 15 |
"github.com/docker/docker/pkg/idtools" |
| 16 | 16 |
"github.com/docker/docker/pkg/locker" |
| 17 |
- "github.com/docker/docker/pkg/mount" |
|
| 18 | 17 |
units "github.com/docker/go-units" |
| 18 |
+ "github.com/moby/sys/mount" |
|
| 19 | 19 |
"github.com/sirupsen/logrus" |
| 20 | 20 |
"golang.org/x/sys/unix" |
| 21 | 21 |
) |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package graphdriver // import "github.com/docker/docker/daemon/graphdriver" |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "github.com/docker/docker/pkg/mount" |
|
| 4 |
+ "github.com/moby/sys/mountinfo" |
|
| 5 | 5 |
"golang.org/x/sys/unix" |
| 6 | 6 |
) |
| 7 | 7 |
|
| ... | ... |
@@ -113,7 +113,7 @@ type defaultChecker struct {
|
| 113 | 113 |
} |
| 114 | 114 |
|
| 115 | 115 |
func (c *defaultChecker) IsMounted(path string) bool {
|
| 116 |
- m, _ := mount.Mounted(path) |
|
| 116 |
+ m, _ := mountinfo.Mounted(path) |
|
| 117 | 117 |
return m |
| 118 | 118 |
} |
| 119 | 119 |
|
| ... | ... |
@@ -22,9 +22,9 @@ import ( |
| 22 | 22 |
"github.com/docker/docker/pkg/directory" |
| 23 | 23 |
"github.com/docker/docker/pkg/idtools" |
| 24 | 24 |
"github.com/docker/docker/pkg/locker" |
| 25 |
- "github.com/docker/docker/pkg/mount" |
|
| 26 | 25 |
"github.com/docker/docker/pkg/parsers/kernel" |
| 27 | 26 |
"github.com/docker/docker/pkg/system" |
| 27 |
+ "github.com/moby/sys/mount" |
|
| 28 | 28 |
rsystem "github.com/opencontainers/runc/libcontainer/system" |
| 29 | 29 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 30 | 30 |
"github.com/pkg/errors" |
| ... | ... |
@@ -20,9 +20,9 @@ import ( |
| 20 | 20 |
"github.com/docker/docker/pkg/fsutils" |
| 21 | 21 |
"github.com/docker/docker/pkg/idtools" |
| 22 | 22 |
"github.com/docker/docker/pkg/locker" |
| 23 |
- "github.com/docker/docker/pkg/mount" |
|
| 24 | 23 |
"github.com/docker/docker/pkg/parsers" |
| 25 | 24 |
"github.com/docker/docker/pkg/system" |
| 25 |
+ "github.com/moby/sys/mount" |
|
| 26 | 26 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 27 | 27 |
"github.com/sirupsen/logrus" |
| 28 | 28 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -25,10 +25,10 @@ import ( |
| 25 | 25 |
"github.com/docker/docker/pkg/fsutils" |
| 26 | 26 |
"github.com/docker/docker/pkg/idtools" |
| 27 | 27 |
"github.com/docker/docker/pkg/locker" |
| 28 |
- "github.com/docker/docker/pkg/mount" |
|
| 29 | 28 |
"github.com/docker/docker/pkg/parsers" |
| 30 | 29 |
"github.com/docker/docker/pkg/system" |
| 31 | 30 |
units "github.com/docker/go-units" |
| 31 |
+ "github.com/moby/sys/mount" |
|
| 32 | 32 |
rsystem "github.com/opencontainers/runc/libcontainer/system" |
| 33 | 33 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 34 | 34 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -15,9 +15,10 @@ import ( |
| 15 | 15 |
"github.com/docker/docker/daemon/graphdriver" |
| 16 | 16 |
"github.com/docker/docker/pkg/containerfs" |
| 17 | 17 |
"github.com/docker/docker/pkg/idtools" |
| 18 |
- "github.com/docker/docker/pkg/mount" |
|
| 19 | 18 |
"github.com/docker/docker/pkg/parsers" |
| 20 | 19 |
zfs "github.com/mistifyio/go-zfs" |
| 20 |
+ "github.com/moby/sys/mount" |
|
| 21 |
+ "github.com/moby/sys/mountinfo" |
|
| 21 | 22 |
"github.com/opencontainers/selinux/go-selinux/label" |
| 22 | 23 |
"github.com/pkg/errors" |
| 23 | 24 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -148,7 +149,7 @@ func lookupZfsDataset(rootdir string) (string, error) {
|
| 148 | 148 |
} |
| 149 | 149 |
wantedDev := stat.Dev |
| 150 | 150 |
|
| 151 |
- mounts, err := mount.GetMounts(nil) |
|
| 151 |
+ mounts, err := mountinfo.GetMounts(nil) |
|
| 152 | 152 |
if err != nil {
|
| 153 | 153 |
return "", err |
| 154 | 154 |
} |
| ... | ... |
@@ -20,10 +20,11 @@ import ( |
| 20 | 20 |
"github.com/docker/docker/oci" |
| 21 | 21 |
"github.com/docker/docker/oci/caps" |
| 22 | 22 |
"github.com/docker/docker/pkg/idtools" |
| 23 |
- "github.com/docker/docker/pkg/mount" |
|
| 24 | 23 |
"github.com/docker/docker/pkg/stringid" |
| 25 | 24 |
"github.com/docker/docker/rootless/specconv" |
| 26 | 25 |
volumemounts "github.com/docker/docker/volume/mounts" |
| 26 |
+ "github.com/moby/sys/mount" |
|
| 27 |
+ "github.com/moby/sys/mountinfo" |
|
| 27 | 28 |
"github.com/opencontainers/runc/libcontainer/apparmor" |
| 28 | 29 |
"github.com/opencontainers/runc/libcontainer/cgroups" |
| 29 | 30 |
"github.com/opencontainers/runc/libcontainer/devices" |
| ... | ... |
@@ -368,7 +369,7 @@ func getSourceMount(source string) (string, string, error) {
|
| 368 | 368 |
return "", "", err |
| 369 | 369 |
} |
| 370 | 370 |
|
| 371 |
- mi, err := mount.GetMounts(mount.ParentsFilter(sourcePath)) |
|
| 371 |
+ mi, err := mountinfo.GetMounts(mountinfo.ParentsFilter(sourcePath)) |
|
| 372 | 372 |
if err != nil {
|
| 373 | 373 |
return "", "", err |
| 374 | 374 |
} |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
containertypes "github.com/docker/docker/api/types/container" |
| 13 | 13 |
"github.com/docker/docker/container" |
| 14 | 14 |
"github.com/docker/docker/errdefs" |
| 15 |
- "github.com/docker/docker/pkg/mount" |
|
| 15 |
+ "github.com/moby/sys/mount" |
|
| 16 | 16 |
"github.com/pkg/errors" |
| 17 | 17 |
"github.com/sirupsen/logrus" |
| 18 | 18 |
) |
| ... | ... |
@@ -12,8 +12,8 @@ import ( |
| 12 | 12 |
mounttypes "github.com/docker/docker/api/types/mount" |
| 13 | 13 |
"github.com/docker/docker/container" |
| 14 | 14 |
"github.com/docker/docker/pkg/fileutils" |
| 15 |
- "github.com/docker/docker/pkg/mount" |
|
| 16 | 15 |
volumemounts "github.com/docker/docker/volume/mounts" |
| 16 |
+ "github.com/moby/sys/mount" |
|
| 17 | 17 |
) |
| 18 | 18 |
|
| 19 | 19 |
// setupMounts iterates through each of the mount points for a container and |
| ... | ... |
@@ -26,11 +26,11 @@ import ( |
| 26 | 26 |
"github.com/docker/docker/integration-cli/cli" |
| 27 | 27 |
"github.com/docker/docker/integration-cli/cli/build" |
| 28 | 28 |
"github.com/docker/docker/pkg/ioutils" |
| 29 |
- "github.com/docker/docker/pkg/mount" |
|
| 30 | 29 |
"github.com/docker/docker/pkg/stringid" |
| 31 | 30 |
"github.com/docker/docker/testutil/request" |
| 32 | 31 |
"github.com/docker/docker/volume" |
| 33 | 32 |
"github.com/docker/go-connections/nat" |
| 33 |
+ "github.com/moby/sys/mount" |
|
| 34 | 34 |
"gotest.tools/v3/assert" |
| 35 | 35 |
is "gotest.tools/v3/assert/cmp" |
| 36 | 36 |
"gotest.tools/v3/poll" |
| ... | ... |
@@ -32,11 +32,11 @@ import ( |
| 32 | 32 |
"github.com/docker/docker/integration-cli/cli/build" |
| 33 | 33 |
"github.com/docker/docker/integration-cli/daemon" |
| 34 | 34 |
"github.com/docker/docker/opts" |
| 35 |
- "github.com/docker/docker/pkg/mount" |
|
| 36 | 35 |
testdaemon "github.com/docker/docker/testutil/daemon" |
| 37 | 36 |
units "github.com/docker/go-units" |
| 38 | 37 |
"github.com/docker/libnetwork/iptables" |
| 39 | 38 |
"github.com/docker/libtrust" |
| 39 |
+ "github.com/moby/sys/mount" |
|
| 40 | 40 |
"golang.org/x/sys/unix" |
| 41 | 41 |
"gotest.tools/v3/assert" |
| 42 | 42 |
"gotest.tools/v3/icmd" |
| ... | ... |
@@ -27,7 +27,6 @@ import ( |
| 27 | 27 |
"github.com/docker/docker/client" |
| 28 | 28 |
"github.com/docker/docker/integration-cli/cli" |
| 29 | 29 |
"github.com/docker/docker/integration-cli/cli/build" |
| 30 |
- "github.com/docker/docker/pkg/mount" |
|
| 31 | 30 |
"github.com/docker/docker/pkg/stringid" |
| 32 | 31 |
"github.com/docker/docker/runconfig" |
| 33 | 32 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -35,6 +34,8 @@ import ( |
| 35 | 35 |
"github.com/docker/go-connections/nat" |
| 36 | 36 |
"github.com/docker/libnetwork/resolvconf" |
| 37 | 37 |
"github.com/docker/libnetwork/types" |
| 38 |
+ "github.com/moby/sys/mount" |
|
| 39 |
+ "github.com/moby/sys/mountinfo" |
|
| 38 | 40 |
"gotest.tools/v3/assert" |
| 39 | 41 |
"gotest.tools/v3/icmd" |
| 40 | 42 |
) |
| ... | ... |
@@ -1438,7 +1439,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
|
| 1438 | 1438 |
// This test case is meant to test monitoring resolv.conf when it is |
| 1439 | 1439 |
// a regular file not a bind mounc. So we unmount resolv.conf and replace |
| 1440 | 1440 |
// it with a file containing the original settings. |
| 1441 |
- mounted, err := mount.Mounted("/etc/resolv.conf")
|
|
| 1441 |
+ mounted, err := mountinfo.Mounted("/etc/resolv.conf")
|
|
| 1442 | 1442 |
if err != nil {
|
| 1443 | 1443 |
c.Fatal(err) |
| 1444 | 1444 |
} |
| ... | ... |
@@ -3789,7 +3790,7 @@ func (s *DockerSuite) TestRunVolumesMountedAsShared(c *testing.T) {
|
| 3789 | 3789 |
dockerCmd(c, "run", "--privileged", "-v", fmt.Sprintf("%s:/volume-dest:shared", tmpDir), "busybox", "mount", "--bind", "/volume-dest/mnt1", "/volume-dest/mnt1")
|
| 3790 | 3790 |
|
| 3791 | 3791 |
// Make sure a bind mount under a shared volume propagated to host. |
| 3792 |
- if mounted, _ := mount.Mounted(path.Join(tmpDir, "mnt1")); !mounted {
|
|
| 3792 |
+ if mounted, _ := mountinfo.Mounted(path.Join(tmpDir, "mnt1")); !mounted {
|
|
| 3793 | 3793 |
c.Fatalf("Bind mount under shared volume did not propagate to host")
|
| 3794 | 3794 |
} |
| 3795 | 3795 |
|
| ... | ... |
@@ -23,9 +23,9 @@ import ( |
| 23 | 23 |
"github.com/docker/docker/integration-cli/cli" |
| 24 | 24 |
"github.com/docker/docker/integration-cli/cli/build" |
| 25 | 25 |
"github.com/docker/docker/pkg/homedir" |
| 26 |
- "github.com/docker/docker/pkg/mount" |
|
| 27 | 26 |
"github.com/docker/docker/pkg/parsers" |
| 28 | 27 |
"github.com/docker/docker/pkg/sysinfo" |
| 28 |
+ "github.com/moby/sys/mount" |
|
| 29 | 29 |
"gotest.tools/v3/assert" |
| 30 | 30 |
"gotest.tools/v3/icmd" |
| 31 | 31 |
) |
| ... | ... |
@@ -14,8 +14,8 @@ import ( |
| 14 | 14 |
"github.com/docker/docker/api/types/versions" |
| 15 | 15 |
"github.com/docker/docker/client" |
| 16 | 16 |
"github.com/docker/docker/integration/internal/container" |
| 17 |
- "github.com/docker/docker/pkg/mount" |
|
| 18 | 17 |
"github.com/docker/docker/pkg/system" |
| 18 |
+ "github.com/moby/sys/mount" |
|
| 19 | 19 |
"gotest.tools/v3/assert" |
| 20 | 20 |
is "gotest.tools/v3/assert/cmp" |
| 21 | 21 |
"gotest.tools/v3/fs" |
| ... | ... |
@@ -9,9 +9,9 @@ import ( |
| 9 | 9 |
"syscall" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
- "github.com/docker/docker/pkg/mount" |
|
| 13 | 12 |
"github.com/docker/docker/pkg/reexec" |
| 14 | 13 |
"github.com/docker/docker/pkg/system" |
| 14 |
+ "github.com/moby/sys/mount" |
|
| 15 | 15 |
rsystem "github.com/opencontainers/runc/libcontainer/system" |
| 16 | 16 |
"github.com/pkg/errors" |
| 17 | 17 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -6,7 +6,8 @@ import ( |
| 6 | 6 |
"os" |
| 7 | 7 |
"path/filepath" |
| 8 | 8 |
|
| 9 |
- "github.com/docker/docker/pkg/mount" |
|
| 9 |
+ "github.com/moby/sys/mount" |
|
| 10 |
+ "github.com/moby/sys/mountinfo" |
|
| 10 | 11 |
rsystem "github.com/opencontainers/runc/libcontainer/system" |
| 11 | 12 |
"golang.org/x/sys/unix" |
| 12 | 13 |
) |
| ... | ... |
@@ -36,7 +37,7 @@ func chroot(path string) (err error) {
|
| 36 | 36 |
return err |
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 |
- if mounted, _ := mount.Mounted(path); !mounted {
|
|
| 39 |
+ if mounted, _ := mountinfo.Mounted(path); !mounted {
|
|
| 40 | 40 |
if err := mount.Mount(path, path, "bind", "rbind,rw"); err != nil {
|
| 41 | 41 |
return realChroot(path) |
| 42 | 42 |
} |
| ... | ... |
@@ -27,12 +27,12 @@ import ( |
| 27 | 27 |
"github.com/docker/docker/layer" |
| 28 | 28 |
"github.com/docker/docker/pkg/authorization" |
| 29 | 29 |
"github.com/docker/docker/pkg/chrootarchive" |
| 30 |
- "github.com/docker/docker/pkg/mount" |
|
| 31 | 30 |
"github.com/docker/docker/pkg/pools" |
| 32 | 31 |
"github.com/docker/docker/pkg/progress" |
| 33 | 32 |
"github.com/docker/docker/pkg/system" |
| 34 | 33 |
v2 "github.com/docker/docker/plugin/v2" |
| 35 | 34 |
refstore "github.com/docker/docker/reference" |
| 35 |
+ "github.com/moby/sys/mount" |
|
| 36 | 36 |
digest "github.com/opencontainers/go-digest" |
| 37 | 37 |
specs "github.com/opencontainers/image-spec/specs-go/v1" |
| 38 | 38 |
"github.com/pkg/errors" |
| ... | ... |
@@ -18,11 +18,11 @@ import ( |
| 18 | 18 |
"github.com/docker/docker/layer" |
| 19 | 19 |
"github.com/docker/docker/pkg/authorization" |
| 20 | 20 |
"github.com/docker/docker/pkg/ioutils" |
| 21 |
- "github.com/docker/docker/pkg/mount" |
|
| 22 | 21 |
"github.com/docker/docker/pkg/pubsub" |
| 23 | 22 |
"github.com/docker/docker/pkg/system" |
| 24 | 23 |
v2 "github.com/docker/docker/plugin/v2" |
| 25 | 24 |
"github.com/docker/docker/registry" |
| 25 |
+ "github.com/moby/sys/mount" |
|
| 26 | 26 |
digest "github.com/opencontainers/go-digest" |
| 27 | 27 |
specs "github.com/opencontainers/runtime-spec/specs-go" |
| 28 | 28 |
"github.com/pkg/errors" |
| ... | ... |
@@ -12,10 +12,10 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/errdefs" |
| 13 | 13 |
"github.com/docker/docker/pkg/containerfs" |
| 14 | 14 |
"github.com/docker/docker/pkg/idtools" |
| 15 |
- "github.com/docker/docker/pkg/mount" |
|
| 16 | 15 |
"github.com/docker/docker/pkg/plugins" |
| 17 | 16 |
"github.com/docker/docker/pkg/stringid" |
| 18 | 17 |
v2 "github.com/docker/docker/plugin/v2" |
| 18 |
+ "github.com/moby/sys/mount" |
|
| 19 | 19 |
digest "github.com/opencontainers/go-digest" |
| 20 | 20 |
"github.com/pkg/errors" |
| 21 | 21 |
"github.com/sirupsen/logrus" |
| ... | ... |
@@ -9,10 +9,11 @@ import ( |
| 9 | 9 |
"testing" |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/api/types" |
| 12 |
- "github.com/docker/docker/pkg/mount" |
|
| 13 | 12 |
"github.com/docker/docker/pkg/stringid" |
| 14 | 13 |
"github.com/docker/docker/pkg/system" |
| 15 | 14 |
v2 "github.com/docker/docker/plugin/v2" |
| 15 |
+ "github.com/moby/sys/mount" |
|
| 16 |
+ "github.com/moby/sys/mountinfo" |
|
| 16 | 17 |
specs "github.com/opencontainers/runtime-spec/specs-go" |
| 17 | 18 |
"github.com/pkg/errors" |
| 18 | 19 |
"gotest.tools/v3/skip" |
| ... | ... |
@@ -64,7 +65,7 @@ func TestManagerWithPluginMounts(t *testing.T) {
|
| 64 | 64 |
if err := m.Remove(p1.GetID(), &types.PluginRmConfig{ForceRemove: true}); err != nil {
|
| 65 | 65 |
t.Fatal(err) |
| 66 | 66 |
} |
| 67 |
- if mounted, err := mount.Mounted(p2Mount); !mounted || err != nil {
|
|
| 67 |
+ if mounted, err := mountinfo.Mounted(p2Mount); !mounted || err != nil {
|
|
| 68 | 68 |
t.Fatalf("expected %s to be mounted, err: %v", p2Mount, err)
|
| 69 | 69 |
} |
| 70 | 70 |
} |
| ... | ... |
@@ -19,11 +19,11 @@ import ( |
| 19 | 19 |
"github.com/docker/docker/client" |
| 20 | 20 |
"github.com/docker/docker/opts" |
| 21 | 21 |
"github.com/docker/docker/pkg/ioutils" |
| 22 |
- "github.com/docker/docker/pkg/mount" |
|
| 23 | 22 |
"github.com/docker/docker/pkg/stringid" |
| 24 | 23 |
"github.com/docker/docker/testutil/request" |
| 25 | 24 |
"github.com/docker/go-connections/sockets" |
| 26 | 25 |
"github.com/docker/go-connections/tlsconfig" |
| 26 |
+ "github.com/moby/sys/mount" |
|
| 27 | 27 |
"github.com/pkg/errors" |
| 28 | 28 |
"gotest.tools/v3/assert" |
| 29 | 29 |
) |
| ... | ... |
@@ -16,8 +16,9 @@ import ( |
| 16 | 16 |
"github.com/docker/docker/daemon/names" |
| 17 | 17 |
"github.com/docker/docker/errdefs" |
| 18 | 18 |
"github.com/docker/docker/pkg/idtools" |
| 19 |
- "github.com/docker/docker/pkg/mount" |
|
| 20 | 19 |
"github.com/docker/docker/volume" |
| 20 |
+ "github.com/moby/sys/mount" |
|
| 21 |
+ "github.com/moby/sys/mountinfo" |
|
| 21 | 22 |
"github.com/pkg/errors" |
| 22 | 23 |
) |
| 23 | 24 |
|
| ... | ... |
@@ -335,7 +336,7 @@ func (v *localVolume) Unmount(id string) error {
|
| 335 | 335 |
func (v *localVolume) unmount() error {
|
| 336 | 336 |
if v.opts != nil {
|
| 337 | 337 |
if err := mount.Unmount(v.path); err != nil {
|
| 338 |
- if mounted, mErr := mount.Mounted(v.path); mounted || mErr != nil {
|
|
| 338 |
+ if mounted, mErr := mountinfo.Mounted(v.path); mounted || mErr != nil {
|
|
| 339 | 339 |
return errdefs.System(err) |
| 340 | 340 |
} |
| 341 | 341 |
} |
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 | 12 |
"github.com/docker/docker/pkg/idtools" |
| 13 |
- "github.com/docker/docker/pkg/mount" |
|
| 13 |
+ "github.com/moby/sys/mountinfo" |
|
| 14 | 14 |
"gotest.tools/v3/skip" |
| 15 | 15 |
) |
| 16 | 16 |
|
| ... | ... |
@@ -211,7 +211,7 @@ func TestCreateWithOpts(t *testing.T) {
|
| 211 | 211 |
} |
| 212 | 212 |
}() |
| 213 | 213 |
|
| 214 |
- mountInfos, err := mount.GetMounts(mount.SingleEntryFilter(dir)) |
|
| 214 |
+ mountInfos, err := mountinfo.GetMounts(mountinfo.SingleEntryFilter(dir)) |
|
| 215 | 215 |
if err != nil {
|
| 216 | 216 |
t.Fatal(err) |
| 217 | 217 |
} |
| ... | ... |
@@ -253,7 +253,7 @@ func TestCreateWithOpts(t *testing.T) {
|
| 253 | 253 |
t.Fatalf("Expected active mount count to be 1, got %d", v.active.count)
|
| 254 | 254 |
} |
| 255 | 255 |
|
| 256 |
- mounted, err := mount.Mounted(v.path) |
|
| 256 |
+ mounted, err := mountinfo.Mounted(v.path) |
|
| 257 | 257 |
if err != nil {
|
| 258 | 258 |
t.Fatal(err) |
| 259 | 259 |
} |