Browse code

oci: default devices don't need to be listed explicitly

Eliminating these things make the code much more understandable.

See also https://github.com/opencontainers/runtime-spec/blob/adcbe530a9652b6f61c740b5c4feb1a6ee8c5918/config-linux.md#default-devices
https://github.com/opencontainers/runc/blob/df25eddce6dce1e1123372bc6ccf98d7b3acc0ce/libcontainer/specconv/spec_linux.go#L454

Signed-off-by: Akihiro Suda <suda.kyoto@gmail.com>

Akihiro Suda authored on 2016/04/08 14:28:37
Showing 1 changed files
... ...
@@ -99,45 +99,13 @@ func DefaultSpec() specs.Spec {
99 99
 			{Type: "pid"},
100 100
 			{Type: "ipc"},
101 101
 		},
102
+		// Devices implicitly contains the following devices:
103
+		// null, zero, full, random, urandom, tty, console, and ptmx.
104
+		// ptmx is a bind-mount or symlink of the container's ptmx.
105
+		// See also: https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#default-devices
102 106
 		Devices: []specs.Device{
103 107
 			{
104 108
 				Type:     "c",
105
-				Path:     "/dev/zero",
106
-				Major:    1,
107
-				Minor:    5,
108
-				FileMode: fmPtr(0666),
109
-				UID:      u32Ptr(0),
110
-				GID:      u32Ptr(0),
111
-			},
112
-			{
113
-				Type:     "c",
114
-				Path:     "/dev/null",
115
-				Major:    1,
116
-				Minor:    3,
117
-				FileMode: fmPtr(0666),
118
-				UID:      u32Ptr(0),
119
-				GID:      u32Ptr(0),
120
-			},
121
-			{
122
-				Type:     "c",
123
-				Path:     "/dev/urandom",
124
-				Major:    1,
125
-				Minor:    9,
126
-				FileMode: fmPtr(0666),
127
-				UID:      u32Ptr(0),
128
-				GID:      u32Ptr(0),
129
-			},
130
-			{
131
-				Type:     "c",
132
-				Path:     "/dev/random",
133
-				Major:    1,
134
-				Minor:    8,
135
-				FileMode: fmPtr(0666),
136
-				UID:      u32Ptr(0),
137
-				GID:      u32Ptr(0),
138
-			},
139
-			{
140
-				Type:     "c",
141 109
 				Path:     "/dev/fuse",
142 110
 				Major:    10,
143 111
 				Minor:    229,