1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Unexport reexec symbols

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
Arnaud Porterie 2015-02-19 17:44:48 -08:00
parent 8ebeb1da5c
commit 7d4450e647
2 changed files with 14 additions and 14 deletions

View file

@ -7,14 +7,14 @@ type networkNamespace struct {
// Create a new network namespace mounted on the provided path.
func NewNamespace(path string) (Namespace, error) {
if err := Reexec(ReexecCreateNamespace, path); err != nil {
if err := reexec(reexecCreateNamespace, path); err != nil {
return nil, err
}
return &networkNamespace{path: path}, nil
}
func (n *networkNamespace) AddInterface(i *Interface) error {
if err := Reexec(ReexecMoveInterface, i.SrcName, i.DstName); err != nil {
if err := reexec(reexecMoveInterface, i.SrcName, i.DstName); err != nil {
return err
}
n.interfaces = append(n.interfaces, i)

View file

@ -5,38 +5,38 @@ import (
"os"
"os/exec"
"github.com/docker/docker/pkg/reexec"
dre "github.com/docker/docker/pkg/reexec"
)
type ReexecCommand int
type reexecCommand int
const (
ReexecCreateNamespace ReexecCommand = iota
ReexecMoveInterface
reexecCreateNamespace reexecCommand = iota
reexecMoveInterface
)
var ReexecCommands = map[ReexecCommand]struct {
var reexecCommands = map[reexecCommand]struct {
Key string
Entrypoint func()
}{
ReexecCreateNamespace: {"netns-create", createNetworkNamespace},
ReexecMoveInterface: {"netns-moveif", namespaceMoveInterface},
reexecCreateNamespace: {"netns-create", createNetworkNamespace},
reexecMoveInterface: {"netns-moveif", namespaceMoveInterface},
}
func init() {
for _, reexecCmd := range ReexecCommands {
reexec.Register(reexecCmd.Key, reexecCmd.Entrypoint)
for _, reexecCmd := range reexecCommands {
dre.Register(reexecCmd.Key, reexecCmd.Entrypoint)
}
}
func Reexec(command ReexecCommand, params ...string) error {
reexecCommand, ok := ReexecCommands[command]
func reexec(command reexecCommand, params ...string) error {
reexecCommand, ok := reexecCommands[command]
if !ok {
return fmt.Errorf("unknown reexec command %q", command)
}
cmd := &exec.Cmd{
Path: reexec.Self(),
Path: dre.Self(),
Args: append([]string{reexecCommand.Key}, params...),
Stdout: os.Stdout,
Stderr: os.Stderr,