github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/volume/mounts/volume_copy.go (about)

     1  package mounts // import "github.com/demonoid81/moby/volume/mounts"
     2  
     3  import "strings"
     4  
     5  // {<copy mode>=isEnabled}
     6  var copyModes = map[string]bool{
     7  	"nocopy": false,
     8  }
     9  
    10  func copyModeExists(mode string) bool {
    11  	_, exists := copyModes[mode]
    12  	return exists
    13  }
    14  
    15  // GetCopyMode gets the copy mode from the mode string for mounts
    16  func getCopyMode(mode string, def bool) (bool, bool) {
    17  	for _, o := range strings.Split(mode, ",") {
    18  		if isEnabled, exists := copyModes[o]; exists {
    19  			return isEnabled, true
    20  		}
    21  	}
    22  	return def, false
    23  }