code: func validateLinuxPath(val string, validator func(string) bool) (string, error) {
  	var containerPath string
  	var mode string
  
  	if strings.Count(val, ":") > 2 {
  		return val, errors.Errorf("bad format for path: %s", val)
  	}
  
  	split := strings.SplitN(val, ":", 3)
  	if split[0] == "" {
  		return val, errors.Errorf("bad format for path: %s", val)
  	}
  	switch len(split) {
  	case 1:
  		containerPath = split[0]
  		val = path.Clean(containerPath)
  	case 2:
  		if isValid := validator(split[1]); isValid {
  			containerPath = split[0]
  			mode = split[1]
  			val = fmt.Sprintf("%s:%s", path.Clean(containerPath), mode)
  		} else {
  			containerPath = split[1]
  			val = fmt.Sprintf("%s:%s", split[0], path.Clean(containerPath))
  		}
  	case 3:
  		containerPath = split[1]
  		mode = split[2]
  		if isValid := validator(split[2]); !isValid {
  			return val, errors.Errorf("bad mode specified: %s", mode)
  		}
  		val = fmt.Sprintf("%s:%s:%s", split[0], containerPath, mode)
  	}
  
  	if !path.IsAbs(containerPath) {
  		return val, errors.Errorf("%s is not an absolute path", containerPath)
  	}
  	return val, nil
  }
docs: // validateLinuxPath is the implementation of validateDevice knowing that the
  // target server operating system is a Linux daemon.
  // It will make sure 'val' is in the form:
  //    [host-dir:]container-path[:mode]
  // It also validates the device mode.