Skip to content

Commit 5d77ca3

Browse files
authored
Merge pull request #603 from q384566678/deviceValid-fix
validate: mv deviceValid to validate_linux
2 parents 0935a14 + 82836c8 commit 5d77ca3

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

validate/validate.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -747,22 +747,6 @@ func (v *Validator) rlimitValid(rlimit rspec.POSIXRlimit) (errs error) {
747747
return
748748
}
749749

750-
func deviceValid(d rspec.LinuxDevice) bool {
751-
switch d.Type {
752-
case "b", "c", "u":
753-
if d.Major <= 0 || d.Minor <= 0 {
754-
return false
755-
}
756-
case "p":
757-
if d.Major != 0 || d.Minor != 0 {
758-
return false
759-
}
760-
default:
761-
return false
762-
}
763-
return true
764-
}
765-
766750
func isStruct(t reflect.Type) bool {
767751
return t.Kind() == reflect.Struct
768752
}

validate/validate_linux.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ func LastCap() capability.Cap {
3030
return last
3131
}
3232

33+
func deviceValid(d rspec.LinuxDevice) bool {
34+
switch d.Type {
35+
case "b", "c", "u":
36+
if d.Major <= 0 || d.Minor <= 0 {
37+
return false
38+
}
39+
case "p":
40+
if d.Major != 0 || d.Minor != 0 {
41+
return false
42+
}
43+
default:
44+
return false
45+
}
46+
return true
47+
}
48+
3349
// CheckLinux checks v.spec.Linux
3450
func (v *Validator) CheckLinux() (errs error) {
3551
logrus.Debugf("check linux")

0 commit comments

Comments
 (0)