Skip to content

Commit 9bab930

Browse files
committed
Fix type of devices type
Fixes: opencontainers/runc#566 For type rune, we can assign char as 'c' in struct, but after marshal, it'll be presented as int32. So in json config it needs to be presented as a number which is not friendly to be identified. Change it to string so that you can actually write "b", "c" in json spec and you can easily know what type of device it is. Signed-off-by: Qiang Huang <[email protected]>
1 parent fed01f4 commit 9bab930

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

config-linux.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The runtime may supply them however it likes (with [mknod][mknod.2], by bind mou
112112

113113
The following parameters can be specified:
114114

115-
* **`type`** *(char, required)* - type of device: `c`, `b`, `u` or `p`.
115+
* **`type`** *(string, required)* - type of device: `c`, `b`, `u` or `p`.
116116
More info in [mknod(1)][mknod.1].
117117
* **`path`** *(string, required)* - full path to device inside container.
118118
* **`major, minor`** *(int64, required unless **`type`** is `p`)* - [major, minor numbers][devices] for the device.
@@ -194,7 +194,7 @@ The runtime MUST apply entries in the listed order.
194194
The following parameters can be specified:
195195

196196
* **`allow`** *(boolean, required)* - whether the entry is allowed or denied.
197-
* **`type`** *(char, optional)* - type of device: `a` (all), `c` (char), or `b` (block).
197+
* **`type`** *(string, optional)* - type of device: `a` (all), `c` (char), or `b` (block).
198198
`null` or unset values mean "all", mapping to `a`.
199199
* **`major, minor`** *(int64, optional)* - [major, minor numbers][devices] for the device.
200200
`null` or unset values mean "all", mapping to [`*` in the filesystem API][cgroup-v1-devices].

config_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ type Device struct {
238238
// Path to the device.
239239
Path string `json:"path"`
240240
// Device type, block, char, etc.
241-
Type rune `json:"type"`
241+
Type string `json:"type"`
242242
// Major is the device's major number.
243243
Major int64 `json:"major"`
244244
// Minor is the device's minor number.
@@ -256,7 +256,7 @@ type DeviceCgroup struct {
256256
// Allow or deny
257257
Allow bool `json:"allow"`
258258
// Device type, block, char, etc.
259-
Type *rune `json:"type,omitempty"`
259+
Type *string `json:"type,omitempty"`
260260
// Major is the device's major number.
261261
Major *int64 `json:"major,omitempty"`
262262
// Minor is the device's minor number.

0 commit comments

Comments
 (0)