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

     1  package mounts // import "github.com/demonoid81/moby/volume/mounts"
     2  
     3  import (
     4  	"errors"
     5  	"path"
     6  
     7  	"github.com/demonoid81/moby/api/types/mount"
     8  )
     9  
    10  var lcowSpecificValidators mountValidator = func(m *mount.Mount) error {
    11  	if path.Clean(m.Target) == "/" {
    12  		return ErrVolumeTargetIsRoot
    13  	}
    14  	if m.Type == mount.TypeNamedPipe {
    15  		return errors.New("Linux containers on Windows do not support named pipe mounts")
    16  	}
    17  	return nil
    18  }
    19  
    20  type lcowParser struct {
    21  	windowsParser
    22  }
    23  
    24  func (p *lcowParser) ValidateMountConfig(mnt *mount.Mount) error {
    25  	return p.validateMountConfigReg(mnt, rxLCOWDestination, lcowSpecificValidators)
    26  }
    27  
    28  func (p *lcowParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) {
    29  	return p.parseMountRaw(raw, volumeDriver, rxLCOWDestination, false, lcowSpecificValidators)
    30  }
    31  
    32  func (p *lcowParser) ParseMountSpec(cfg mount.Mount) (*MountPoint, error) {
    33  	return p.parseMountSpec(cfg, rxLCOWDestination, false, lcowSpecificValidators)
    34  }