From 4cb9479ce490408daae2ffc2b7d28ad181ce24c3 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Wed, 22 Jul 2015 09:24:35 -0400 Subject: [PATCH] Rename internel field Relabel to Mode Docker-DCO-1.1-Signed-off-by: Dan Walsh (github: rhatdan) --- api/types/types.go | 2 +- daemon/inspect.go | 2 +- daemon/volumes.go | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/types/types.go b/api/types/types.go index 0e7078bc72..3fc98e50a3 100644 --- a/api/types/types.go +++ b/api/types/types.go @@ -274,6 +274,6 @@ type MountPoint struct { Source string Destination string Driver string `json:",omitempty"` - Mode string // this is internally named `Relabel` + Mode string RW bool } diff --git a/daemon/inspect.go b/daemon/inspect.go index 1fb73c43ae..f913c2006a 100644 --- a/daemon/inspect.go +++ b/daemon/inspect.go @@ -27,7 +27,7 @@ func (daemon *Daemon) ContainerInspect(name string) (*types.ContainerJSON, error Source: m.Path(), Destination: m.Destination, Driver: m.Driver, - Mode: m.Relabel, + Mode: m.Mode, RW: m.RW, }) } diff --git a/daemon/volumes.go b/daemon/volumes.go index 556e304977..d484648375 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -29,7 +29,7 @@ type mountPoint struct { RW bool Volume volume.Volume `json:"-"` Source string - Relabel string + Mode string `json:"Relabel"` // Originally field was `Relabel`" } func (m *mountPoint) Setup() (string, error) { @@ -94,8 +94,8 @@ func parseBindMount(spec string, mountLabel string, config *runconfig.Config) (* return nil, fmt.Errorf("invalid mode for volumes-from: %s", mode) } bind.RW = isRw - // Relabel will apply a SELinux label, if necessary - bind.Relabel = mode + // Mode field is used by SELinux to decide whether to apply label + bind.Mode = mode default: return nil, fmt.Errorf("Invalid volume specification: %s", spec) } @@ -226,12 +226,12 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc bind.Volume = v bind.Source = v.Path() // Since this is just a named volume and not a typical bind, set to shared mode `z` - if bind.Relabel == "" { - bind.Relabel = "z" + if bind.Mode == "" { + bind.Mode = "z" } } - if err := label.Relabel(bind.Source, container.MountLabel, bind.Relabel); err != nil { + if err := label.Relabel(bind.Source, container.MountLabel, bind.Mode); err != nil { return err } binds[bind.Destination] = true