MCPcopy Index your code
hub / github.com/docker/cli / parseDevice

Function parseDevice

cli/command/container/opts.go:995–1005  ·  view source on GitHub ↗

parseDevice parses a device mapping string to a container.DeviceMapping struct

(device, serverOS string)

Source from the content-addressed store, hash-verified

993
994// parseDevice parses a device mapping string to a container.DeviceMapping struct
995func parseDevice(device, serverOS string) (container.DeviceMapping, error) {
996 switch serverOS {
997 case "linux":
998 return parseLinuxDevice(device)
999 case "windows":
1000 // Windows doesn't support mapping, so passing the given value as-is.
1001 return container.DeviceMapping{PathOnHost: device}, nil
1002 default:
1003 return container.DeviceMapping{}, fmt.Errorf("unknown server OS: %s", serverOS)
1004 }
1005}
1006
1007// parseLinuxDevice parses a device mapping string to a container.DeviceMapping struct
1008// knowing that the target is a Linux daemon

Callers 1

parseFunction · 0.85

Calls 1

parseLinuxDeviceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…