From c508a7bc0a0e67e4df4aa94e43ddd07d0c44e49b Mon Sep 17 00:00:00 2001 From: Kailun Qin Date: Wed, 30 Jun 2021 06:47:17 -0400 Subject: [PATCH] libct/rootfs: consolidate utils imports Signed-off-by: Kailun Qin --- libcontainer/rootfs_linux.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libcontainer/rootfs_linux.go b/libcontainer/rootfs_linux.go index 0882cf3e0..76f178137 100644 --- a/libcontainer/rootfs_linux.go +++ b/libcontainer/rootfs_linux.go @@ -24,7 +24,6 @@ import ( "github.com/opencontainers/runc/libcontainer/devices" "github.com/opencontainers/runc/libcontainer/userns" "github.com/opencontainers/runc/libcontainer/utils" - libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils" "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/selinux/go-selinux/label" "github.com/sirupsen/logrus" @@ -44,7 +43,7 @@ type mountConfig struct { // needsSetupDev returns true if /dev needs to be set up. func needsSetupDev(config *configs.Config) bool { for _, m := range config.Mounts { - if m.Device == "bind" && libcontainerUtils.CleanPath(m.Destination) == "/dev" { + if m.Device == "bind" && utils.CleanPath(m.Destination) == "/dev" { return false } } @@ -158,7 +157,7 @@ func prepareRootfs(pipe io.ReadWriter, iConfig *initConfig) (err error) { func finalizeRootfs(config *configs.Config) (err error) { // remount dev as ro if specified for _, m := range config.Mounts { - if libcontainerUtils.CleanPath(m.Destination) == "/dev" { + if utils.CleanPath(m.Destination) == "/dev" { if m.Flags&unix.MS_RDONLY == unix.MS_RDONLY { if err := remountReadonly(m); err != nil { return newSystemErrorWithCausef(err, "remounting %q as readonly", m.Destination) @@ -1057,7 +1056,7 @@ func mountPropagate(m *configs.Mount, rootfs string, mountLabel string) error { // operations on it. We need to set up files in "/dev" and tmpfs mounts may // need to be chmod-ed after mounting. The mount will be remounted ro later // in finalizeRootfs() if necessary. - if libcontainerUtils.CleanPath(m.Destination) == "/dev" || m.Device == "tmpfs" { + if utils.CleanPath(m.Destination) == "/dev" || m.Device == "tmpfs" { flags &= ^unix.MS_RDONLY }