volume_copy.go 475 B

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