Browse code

Remove unnecessary getLayerInit

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Daniel Nephin authored on 2018/02/14 04:29:14
Showing 4 changed files
... ...
@@ -266,7 +266,7 @@ func (daemon *Daemon) setRWLayer(container *container.Container) error {
266 266
 
267 267
 	rwLayerOpts := &layer.CreateRWLayerOpts{
268 268
 		MountLabel: container.MountLabel,
269
-		InitFunc:   daemon.getLayerInit(),
269
+		InitFunc:   setupInitLayer(daemon.idMappings),
270 270
 		StorageOpt: container.HostConfig.StorageOpt,
271 271
 	}
272 272
 
... ...
@@ -32,7 +32,6 @@ import (
32 32
 	"github.com/sirupsen/logrus"
33 33
 	// register graph drivers
34 34
 	_ "github.com/docker/docker/daemon/graphdriver/register"
35
-	"github.com/docker/docker/daemon/initlayer"
36 35
 	"github.com/docker/docker/daemon/stats"
37 36
 	dmetadata "github.com/docker/docker/distribution/metadata"
38 37
 	"github.com/docker/docker/distribution/xfer"
... ...
@@ -41,7 +40,6 @@ import (
41 41
 	"github.com/docker/docker/layer"
42 42
 	"github.com/docker/docker/libcontainerd"
43 43
 	"github.com/docker/docker/migrate/v1"
44
-	"github.com/docker/docker/pkg/containerfs"
45 44
 	"github.com/docker/docker/pkg/idtools"
46 45
 	"github.com/docker/docker/pkg/locker"
47 46
 	"github.com/docker/docker/pkg/plugingetter"
... ...
@@ -1142,11 +1140,6 @@ func prepareTempDir(rootDir string, rootIDs idtools.IDPair) (string, error) {
1142 1142
 	return tmpDir, idtools.MkdirAllAndChown(tmpDir, 0700, rootIDs)
1143 1143
 }
1144 1144
 
1145
-func (daemon *Daemon) setupInitLayer(initPath containerfs.ContainerFS) error {
1146
-	rootIDs := daemon.idMappings.RootPair()
1147
-	return initlayer.Setup(initPath, rootIDs)
1148
-}
1149
-
1150 1145
 func (daemon *Daemon) setGenericResources(conf *config.Config) error {
1151 1146
 	genericResources, err := config.ParseGenericResources(conf.NodeGenericResources)
1152 1147
 	if err != nil {
... ...
@@ -23,6 +23,7 @@ import (
23 23
 	containertypes "github.com/docker/docker/api/types/container"
24 24
 	"github.com/docker/docker/container"
25 25
 	"github.com/docker/docker/daemon/config"
26
+	"github.com/docker/docker/daemon/initlayer"
26 27
 	"github.com/docker/docker/image"
27 28
 	"github.com/docker/docker/opts"
28 29
 	"github.com/docker/docker/pkg/containerfs"
... ...
@@ -1000,8 +1001,10 @@ func removeDefaultBridgeInterface() {
1000 1000
 	}
1001 1001
 }
1002 1002
 
1003
-func (daemon *Daemon) getLayerInit() func(containerfs.ContainerFS) error {
1004
-	return daemon.setupInitLayer
1003
+func setupInitLayer(idMappings *idtools.IDMappings) func(containerfs.ContainerFS) error {
1004
+	return func(initPath containerfs.ContainerFS) error {
1005
+		return initlayer.Setup(initPath, idMappings.RootPair())
1006
+	}
1005 1007
 }
1006 1008
 
1007 1009
 // Parse the remapped root (user namespace) option, which can be one of:
... ...
@@ -54,7 +54,7 @@ func parseSecurityOpt(container *container.Container, config *containertypes.Hos
54 54
 	return nil
55 55
 }
56 56
 
57
-func (daemon *Daemon) getLayerInit() func(containerfs.ContainerFS) error {
57
+func setupInitLayer(idMappings *idtools.IDMappings) func(containerfs.ContainerFS) error {
58 58
 	return nil
59 59
 }
60 60