mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct/rootfs: consolidate utils imports
Signed-off-by: Kailun Qin <kailun.qin@intel.com>
This commit is contained in:
@@ -24,7 +24,6 @@ import (
|
|||||||
"github.com/opencontainers/runc/libcontainer/devices"
|
"github.com/opencontainers/runc/libcontainer/devices"
|
||||||
"github.com/opencontainers/runc/libcontainer/userns"
|
"github.com/opencontainers/runc/libcontainer/userns"
|
||||||
"github.com/opencontainers/runc/libcontainer/utils"
|
"github.com/opencontainers/runc/libcontainer/utils"
|
||||||
libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils"
|
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/opencontainers/selinux/go-selinux/label"
|
"github.com/opencontainers/selinux/go-selinux/label"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@@ -44,7 +43,7 @@ type mountConfig struct {
|
|||||||
// needsSetupDev returns true if /dev needs to be set up.
|
// needsSetupDev returns true if /dev needs to be set up.
|
||||||
func needsSetupDev(config *configs.Config) bool {
|
func needsSetupDev(config *configs.Config) bool {
|
||||||
for _, m := range config.Mounts {
|
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
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,7 +157,7 @@ func prepareRootfs(pipe io.ReadWriter, iConfig *initConfig) (err error) {
|
|||||||
func finalizeRootfs(config *configs.Config) (err error) {
|
func finalizeRootfs(config *configs.Config) (err error) {
|
||||||
// remount dev as ro if specified
|
// remount dev as ro if specified
|
||||||
for _, m := range config.Mounts {
|
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 m.Flags&unix.MS_RDONLY == unix.MS_RDONLY {
|
||||||
if err := remountReadonly(m); err != nil {
|
if err := remountReadonly(m); err != nil {
|
||||||
return newSystemErrorWithCausef(err, "remounting %q as readonly", m.Destination)
|
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
|
// 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
|
// need to be chmod-ed after mounting. The mount will be remounted ro later
|
||||||
// in finalizeRootfs() if necessary.
|
// 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
|
flags &= ^unix.MS_RDONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user