Browse code

Rename internel field Relabel to Mode

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)

Dan Walsh authored on 2015/07/22 22:24:35
Showing 3 changed files
... ...
@@ -274,6 +274,6 @@ type MountPoint struct {
274 274
 	Source      string
275 275
 	Destination string
276 276
 	Driver      string `json:",omitempty"`
277
-	Mode        string // this is internally named `Relabel`
277
+	Mode        string
278 278
 	RW          bool
279 279
 }
... ...
@@ -27,7 +27,7 @@ func (daemon *Daemon) ContainerInspect(name string) (*types.ContainerJSON, error
27 27
 			Source:      m.Path(),
28 28
 			Destination: m.Destination,
29 29
 			Driver:      m.Driver,
30
-			Mode:        m.Relabel,
30
+			Mode:        m.Mode,
31 31
 			RW:          m.RW,
32 32
 		})
33 33
 	}
... ...
@@ -29,7 +29,7 @@ type mountPoint struct {
29 29
 	RW          bool
30 30
 	Volume      volume.Volume `json:"-"`
31 31
 	Source      string
32
-	Relabel     string
32
+	Mode        string `json:"Relabel"` // Originally field was `Relabel`"
33 33
 }
34 34
 
35 35
 func (m *mountPoint) Setup() (string, error) {
... ...
@@ -94,8 +94,8 @@ func parseBindMount(spec string, mountLabel string, config *runconfig.Config) (*
94 94
 			return nil, fmt.Errorf("invalid mode for volumes-from: %s", mode)
95 95
 		}
96 96
 		bind.RW = isRw
97
-		// Relabel will apply a SELinux label, if necessary
98
-		bind.Relabel = mode
97
+		// Mode field is used by SELinux to decide whether to apply label
98
+		bind.Mode = mode
99 99
 	default:
100 100
 		return nil, fmt.Errorf("Invalid volume specification: %s", spec)
101 101
 	}
... ...
@@ -226,12 +226,12 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc
226 226
 			bind.Volume = v
227 227
 			bind.Source = v.Path()
228 228
 			// Since this is just a named volume and not a typical bind, set to shared mode `z`
229
-			if bind.Relabel == "" {
230
-				bind.Relabel = "z"
229
+			if bind.Mode == "" {
230
+				bind.Mode = "z"
231 231
 			}
232 232
 		}
233 233
 
234
-		if err := label.Relabel(bind.Source, container.MountLabel, bind.Relabel); err != nil {
234
+		if err := label.Relabel(bind.Source, container.MountLabel, bind.Mode); err != nil {
235 235
 			return err
236 236
 		}
237 237
 		binds[bind.Destination] = true