6a70fd222b
This moves the platform specific stuff in a separate package and keeps the `volume` package and the defined interfaces light to import. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
23 lines
524 B
Go
23 lines
524 B
Go
package mounts // import "github.com/docker/docker/volume/mounts"
|
|
|
|
import "strings"
|
|
|
|
// {<copy mode>=isEnabled}
|
|
var copyModes = map[string]bool{
|
|
"nocopy": false,
|
|
}
|
|
|
|
func copyModeExists(mode string) bool {
|
|
_, exists := copyModes[mode]
|
|
return exists
|
|
}
|
|
|
|
// GetCopyMode gets the copy mode from the mode string for mounts
|
|
func getCopyMode(mode string, def bool) (bool, bool) {
|
|
for _, o := range strings.Split(mode, ",") {
|
|
if isEnabled, exists := copyModes[o]; exists {
|
|
return isEnabled, true
|
|
}
|
|
}
|
|
return def, false
|
|
}
|