Skip to content

Commit 85ae7d5

Browse files
committed
cli/command/container: inline parseWindowsDevice
It's not parsing anything, so we may as well inline it to be more clear what's done. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 91d44d6 commit 85ae7d5

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

cli/command/container/opts.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,8 @@ func parseDevice(device, serverOS string) (container.DeviceMapping, error) {
997997
case "linux":
998998
return parseLinuxDevice(device)
999999
case "windows":
1000-
return parseWindowsDevice(device)
1000+
// Windows doesn't support mapping, so passing the given value as-is.
1001+
return container.DeviceMapping{PathOnHost: device}, nil
10011002
}
10021003
return container.DeviceMapping{}, fmt.Errorf("unknown server OS: %s", serverOS)
10031004
}
@@ -1030,18 +1031,11 @@ func parseLinuxDevice(device string) (container.DeviceMapping, error) {
10301031
dst = src
10311032
}
10321033

1033-
deviceMapping := container.DeviceMapping{
1034+
return container.DeviceMapping{
10341035
PathOnHost: src,
10351036
PathInContainer: dst,
10361037
CgroupPermissions: permissions,
1037-
}
1038-
return deviceMapping, nil
1039-
}
1040-
1041-
// parseWindowsDevice parses a device mapping string to a container.DeviceMapping struct
1042-
// knowing that the target is a Windows daemon
1043-
func parseWindowsDevice(device string) (container.DeviceMapping, error) {
1044-
return container.DeviceMapping{PathOnHost: device}, nil
1038+
}, nil
10451039
}
10461040

10471041
// validateDeviceCgroupRule validates a device cgroup rule string format

0 commit comments

Comments
 (0)