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

Function validDeviceMode

cli/command/container/opts.go:1056–1072  ·  view source on GitHub ↗

validDeviceMode checks if the mode for device is valid or not. Valid mode is a composition of r (read), w (write), and m (mknod).

(mode string)

Source from the content-addressed store, hash-verified

1054// validDeviceMode checks if the mode for device is valid or not.
1055// Valid mode is a composition of r (read), w (write), and m (mknod).
1056func validDeviceMode(mode string) bool {
1057 legalDeviceMode := map[rune]bool{
1058 'r': true,
1059 'w': true,
1060 'm': true,
1061 }
1062 if mode == "" {
1063 return false
1064 }
1065 for _, c := range mode {
1066 if !legalDeviceMode[c] {
1067 return false
1068 }
1069 legalDeviceMode[c] = false
1070 }
1071 return true
1072}
1073
1074// validateDevice validates a path for devices
1075func validateDevice(val string, serverOS string) (string, error) {

Callers 1

parseLinuxDeviceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…