MCPcopy Create free account
hub / github.com/containers/common / isValidDeviceMode

Function isValidDeviceMode

pkg/parse/parse.go:140–156  ·  view source on GitHub ↗

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

(mode string)

Source from the content-addressed store, hash-verified

138// isValidDeviceMode checks if the mode for device is valid or not.
139// isValid mode is a composition of r (read), w (write), and m (mknod).
140func isValidDeviceMode(mode string) bool {
141 var legalDeviceMode = map[rune]bool{
142 'r': true,
143 'w': true,
144 'm': true,
145 }
146 if mode == "" {
147 return false
148 }
149 for _, c := range mode {
150 if !legalDeviceMode[c] {
151 return false
152 }
153 legalDeviceMode[c] = false
154 }
155 return true
156}
157
158// ValidateVolumeHostDir validates a volume mount's source directory
159func ValidateVolumeHostDir(hostDir string) error {

Callers 2

TestIsValidDeviceModeFunction · 0.85
DeviceFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsValidDeviceModeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…