Refactor large funcs

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-02-19 19:14:31 -08:00
parent b48bc85967
commit e3d5adc9e2
5 changed files with 107 additions and 96 deletions

View file

@ -1,29 +1,5 @@
package libcontainer
type Namespace string
type Namespaces []Namespace
func (n Namespaces) Contains(ns Namespace) bool {
for _, nns := range n {
if nns == ns {
return true
}
}
return false
}
type Capability string
type Capabilities []Capability
func (c Capabilities) Contains(capp Capability) bool {
for _, cc := range c {
if cc == capp {
return true
}
}
return false
}
const (
CAP_SETPCAP Capability = "SETPCAP"
CAP_SYS_MODULE Capability = "SYS_MODULE"
@ -47,3 +23,27 @@ const (
CLONE_NEWPID Namespace = "NEWPID" // pid
CLONE_NEWNET Namespace = "NEWNET" // network
)
type Namespace string
type Namespaces []Namespace
func (n Namespaces) Contains(ns Namespace) bool {
for _, nns := range n {
if nns == ns {
return true
}
}
return false
}
type Capability string
type Capabilities []Capability
func (c Capabilities) Contains(capp Capability) bool {
for _, cc := range c {
if cc == capp {
return true
}
}
return false
}