Documentation ¶
Index ¶
- Constants
- func AuthorizeImageFS(fs string)
- func ConvertOptions(options []string) (uintptr, []string)
- func ConvertSpec(mounts []specs.Mount) (map[AuthorizedTag][]Point, error)
- func GetKey(options []string) ([]byte, error)
- func GetOffset(options []string) (uint64, error)
- func GetSizeLimit(options []string) (uint64, error)
- func HasPropagationFlag(flags uintptr) bool
- func HasRemountFlag(flags uintptr) bool
- func SkipOnError(options []string) bool
- type AuthorizedTag
- type Point
- type Points
- func (p *Points) AddBind(tag AuthorizedTag, source string, dest string, flags uintptr, ...) error
- func (p *Points) AddFS(tag AuthorizedTag, dest string, fstype string, flags uintptr, options string) error
- func (p *Points) AddFSWithSource(tag AuthorizedTag, source string, dest string, fstype string, flags uintptr, ...) error
- func (p *Points) AddImage(tag AuthorizedTag, source string, dest string, fstype string, flags uintptr, ...) error
- func (p *Points) AddOverlay(tag AuthorizedTag, dest string, flags uintptr, lowerdir string, ...) error
- func (p *Points) AddPropagation(tag AuthorizedTag, dest string, flags uintptr) error
- func (p *Points) AddRemount(tag AuthorizedTag, dest string, flags uintptr) error
- func (p *Points) GetAll() map[AuthorizedTag][]Point
- func (p *Points) GetAllBinds() []Point
- func (p *Points) GetAllFS() []Point
- func (p *Points) GetAllImages() []Point
- func (p *Points) GetAllOverlays() []Point
- func (p *Points) GetByDest(dest string) []Point
- func (p *Points) GetBySource(source string) []Point
- func (p *Points) GetByTag(tag AuthorizedTag) []Point
- func (p *Points) GetContext() string
- func (p *Points) Import(points map[AuthorizedTag][]Point) error
- func (p *Points) ImportFromSpec(mounts []specs.Mount) error
- func (p *Points) RemoveAll()
- func (p *Points) RemoveByDest(dest string)
- func (p *Points) RemoveBySource(source string)
- func (p *Points) RemoveByTag(tag AuthorizedTag)
- func (p *Points) SetContext(context string) error
- type System
Constants ¶
const ( // SessionTag defines tag for session directory SessionTag AuthorizedTag = "sessiondir" // RootfsTag defines tag for container root filesystem RootfsTag = "rootfs" // PreLayerTag defines tag to prepare overlay/underlay layer PreLayerTag = "prelayer" // LayerTag defines tag for overlay/underlay final mount point LayerTag = "layer" // and container processes SharedTag = "shared" // DevTag defines tag for dev related mount point DevTag = "dev" // HostfsTag defines tag for host filesystem mount point HostfsTag = "hostfs" // BindsTag defines tag for bind path BindsTag = "binds" // KernelTag defines tag for kernel related mount point (proc, sysfs) KernelTag = "kernel" // HomeTag defines tag for home directory mount point HomeTag = "home" // TmpTag defines tag for temporary filesystem mount points (/tmp, /var/tmp) TmpTag = "tmp" // ScratchTag defines tag for scratch mount points ScratchTag = "scratch" // CwdTag defines tag for current working directory mount point CwdTag = "cwd" // FilesTag defines tag for file mount points (passwd, group ...) FilesTag = "files" // UserbindsTag defines tag for user bind mount points UserbindsTag = "userbinds" // OtherTag defines tag for other mount points that can't be classified OtherTag = "other" // FinalTag defines tag for mount points to mount/remount at the end of mount process FinalTag = "final" )
const (
// ErrMountExists indicates a duplicated mount being asked for
ErrMountExists = mountError("destination is already in the mount point list")
)
Variables ¶
This section is empty.
Functions ¶
func AuthorizeImageFS ¶
func AuthorizeImageFS(fs string)
AuthorizeImageFS adds the specified filesystem from the authorizedImage list. This means a loopback mount can then be performed from an image file with this filesystem.
func ConvertOptions ¶
ConvertOptions converts an options string into a pair of mount flags and mount options
func ConvertSpec ¶
func ConvertSpec(mounts []specs.Mount) (map[AuthorizedTag][]Point, error)
ConvertSpec converts an OCI Mount spec into an importable mount points list
func GetSizeLimit ¶
GetSizeLimit returns sizelimit value for image options
func HasPropagationFlag ¶
HasPropagationFlag checks if a propagation flag is set or not.
func HasRemountFlag ¶
HasRemountFlag checks if remount flag is set or not.
func SkipOnError ¶
SkipOnError returns whether the skip-on-error internal option is set for the mount
Types ¶
type AuthorizedTag ¶
type AuthorizedTag string
AuthorizedTag defines the tag type
func GetTagList ¶
func GetTagList() []AuthorizedTag
GetTagList returns authorized tags in right order
type Points ¶
type Points struct {
// contains filtered or unexported fields
}
Points defines and stores a set of mount points by tag
func (*Points) AddBind ¶
func (p *Points) AddBind(tag AuthorizedTag, source string, dest string, flags uintptr, options ...string) error
AddBind adds a bind mount point
func (*Points) AddFS ¶
func (p *Points) AddFS(tag AuthorizedTag, dest string, fstype string, flags uintptr, options string) error
AddFS adds a filesystem mount point
func (*Points) AddFSWithSource ¶
func (p *Points) AddFSWithSource(tag AuthorizedTag, source string, dest string, fstype string, flags uintptr, options string) error
AddFSWithSource adds a filesystem mount point
func (*Points) AddImage ¶
func (p *Points) AddImage(tag AuthorizedTag, source string, dest string, fstype string, flags uintptr, offset uint64, sizelimit uint64, key []byte) error
AddImage adds an image mount point
func (*Points) AddOverlay ¶
func (p *Points) AddOverlay(tag AuthorizedTag, dest string, flags uintptr, lowerdir string, upperdir string, workdir string) error
AddOverlay adds an overlay mount point
func (*Points) AddPropagation ¶
func (p *Points) AddPropagation(tag AuthorizedTag, dest string, flags uintptr) error
AddPropagation adds a mount propagation for mount point
func (*Points) AddRemount ¶
func (p *Points) AddRemount(tag AuthorizedTag, dest string, flags uintptr) error
AddRemount adds a mount point to remount
func (*Points) GetAll ¶
func (p *Points) GetAll() map[AuthorizedTag][]Point
GetAll returns all registered mount points
func (*Points) GetAllBinds ¶
GetAllBinds returns a list of all registered bind mount points
func (*Points) GetAllImages ¶
GetAllImages returns a list of all registered image mount points
func (*Points) GetAllOverlays ¶
GetAllOverlays returns a list of all registered overlay mount points
func (*Points) GetBySource ¶
GetBySource returns registered mount points with the matched source
func (*Points) GetByTag ¶
func (p *Points) GetByTag(tag AuthorizedTag) []Point
GetByTag returns mount points attached to a tag
func (*Points) GetContext ¶
GetContext returns SELinux mount context
func (*Points) Import ¶
func (p *Points) Import(points map[AuthorizedTag][]Point) error
Import imports a mount point list
func (*Points) ImportFromSpec ¶
ImportFromSpec converts an OCI Mount spec into a mount point list and imports it
func (*Points) RemoveAll ¶
func (p *Points) RemoveAll()
RemoveAll removes all mounts points from list
func (*Points) RemoveByDest ¶
RemoveByDest removes mount points identified by destination
func (*Points) RemoveBySource ¶
RemoveBySource removes mount points identified by source
func (*Points) RemoveByTag ¶
func (p *Points) RemoveByTag(tag AuthorizedTag)
RemoveByTag removes mount points attached to a tag
func (*Points) SetContext ¶
SetContext sets SELinux mount context, once set it can't be modified
type System ¶
type System struct { Points *Points Mount mountFn // contains filtered or unexported fields }
System defines a mount system allowing to register before/after hook functions for specific tag during mount phase
func (*System) CurrentTag ¶
func (b *System) CurrentTag() AuthorizedTag
CurrentTag returns the tag being processed by MountAll.
func (*System) MountAll ¶
MountAll iterates over mount point list and mounts every point by calling hook before/after hook functions
func (*System) RunAfterTag ¶
func (b *System) RunAfterTag(tag AuthorizedTag, fn hookFn) error
RunAfterTag registers a hook function executed after mounting points of tag list
func (*System) RunBeforeTag ¶
func (b *System) RunBeforeTag(tag AuthorizedTag, fn hookFn) error
RunBeforeTag registers a hook function executed before mounting points of tag list