diff --git a/namespaces/exec.go b/namespaces/exec.go index 0aa2bb9c7..9053f632a 100644 --- a/namespaces/exec.go +++ b/namespaces/exec.go @@ -12,6 +12,7 @@ import ( "github.com/docker/libcontainer/cgroups/fs" "github.com/docker/libcontainer/cgroups/systemd" "github.com/docker/libcontainer/network" + "github.com/docker/libcontainer/syncpipe" "github.com/dotcloud/docker/pkg/system" ) @@ -28,7 +29,7 @@ func Exec(container *libcontainer.Config, term Terminal, rootfs, dataPath string // create a pipe so that we can syncronize with the namespaced process and // pass the veth name to the child - syncPipe, err := NewSyncPipe() + syncPipe, err := syncpipe.NewSyncPipe() if err != nil { return -1, err } @@ -42,7 +43,7 @@ func Exec(container *libcontainer.Config, term Terminal, rootfs, dataPath string term.SetMaster(master) } - command := createCommand(container, console, rootfs, dataPath, os.Args[0], syncPipe.child, args) + command := createCommand(container, console, rootfs, dataPath, os.Args[0], syncPipe.Child(), args) if err := term.Attach(command); err != nil { return -1, err @@ -166,7 +167,7 @@ func SetupCgroups(container *libcontainer.Config, nspid int) (cgroups.ActiveCgro // InitializeNetworking creates the container's network stack outside of the namespace and moves // interfaces into the container's net namespaces if necessary -func InitializeNetworking(container *libcontainer.Config, nspid int, pipe *SyncPipe, networkState *network.NetworkState) error { +func InitializeNetworking(container *libcontainer.Config, nspid int, pipe *syncpipe.SyncPipe, networkState *network.NetworkState) error { for _, config := range container.Networks { strategy, err := network.GetStrategy(config.Type) if err != nil { diff --git a/namespaces/init.go b/namespaces/init.go index 53d2611b8..4674944cb 100644 --- a/namespaces/init.go +++ b/namespaces/init.go @@ -18,6 +18,7 @@ import ( "github.com/docker/libcontainer/network" "github.com/docker/libcontainer/security/capabilities" "github.com/docker/libcontainer/security/restrict" + "github.com/docker/libcontainer/syncpipe" "github.com/docker/libcontainer/utils" "github.com/dotcloud/docker/pkg/system" "github.com/dotcloud/docker/pkg/user" @@ -27,7 +28,7 @@ import ( // Move this to libcontainer package. // Init is the init process that first runs inside a new namespace to setup mounts, users, networking, // and other options required for the new container. -func Init(container *libcontainer.Config, uncleanRootfs, consolePath string, syncPipe *SyncPipe, args []string) (err error) { +func Init(container *libcontainer.Config, uncleanRootfs, consolePath string, syncPipe *syncpipe.SyncPipe, args []string) (err error) { defer func() { if err != nil { syncPipe.ReportChildError(err) diff --git a/nsinit/init.go b/nsinit/init.go index 5b153455b..0dd964115 100644 --- a/nsinit/init.go +++ b/nsinit/init.go @@ -7,6 +7,7 @@ import ( "github.com/codegangsta/cli" "github.com/docker/libcontainer/namespaces" + "github.com/docker/libcontainer/syncpipe" ) var ( @@ -37,7 +38,7 @@ func initAction(context *cli.Context) { log.Fatal(err) } - syncPipe, err := namespaces.NewSyncPipeFromFd(0, uintptr(pipeFd)) + syncPipe, err := syncpipe.NewSyncPipeFromFd(0, uintptr(pipeFd)) if err != nil { log.Fatalf("unable to create sync pipe: %s", err) } diff --git a/namespaces/sync_pipe.go b/syncpipe/sync_pipe.go similarity index 98% rename from namespaces/sync_pipe.go rename to syncpipe/sync_pipe.go index dcb5d9749..10a21a9ef 100644 --- a/namespaces/sync_pipe.go +++ b/syncpipe/sync_pipe.go @@ -1,4 +1,4 @@ -package namespaces +package syncpipe import ( "encoding/json" diff --git a/namespaces/sync_pipe_linux.go b/syncpipe/sync_pipe_linux.go similarity index 95% rename from namespaces/sync_pipe_linux.go rename to syncpipe/sync_pipe_linux.go index ad61e75d2..bea4b52f9 100644 --- a/namespaces/sync_pipe_linux.go +++ b/syncpipe/sync_pipe_linux.go @@ -1,4 +1,4 @@ -package namespaces +package syncpipe import ( "os" diff --git a/namespaces/sync_pipe_test.go b/syncpipe/sync_pipe_test.go similarity index 98% rename from namespaces/sync_pipe_test.go rename to syncpipe/sync_pipe_test.go index 69bd0abbf..3f99a7d1f 100644 --- a/namespaces/sync_pipe_test.go +++ b/syncpipe/sync_pipe_test.go @@ -1,4 +1,4 @@ -package namespaces +package syncpipe import ( "fmt"