Documentation ¶
Index ¶
- Constants
- func ConvertOptions(options []string) (uintptr, []string)
- func ConvertSpec(mounts []specs.Mount) (map[AuthorizedTag][]Point, error)
- func GetOffset(options []string) (uint64, error)
- func GetSizeLimit(options []string) (uint64, error)
- 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) AddImage(tag AuthorizedTag, source string, dest string, fstype string, flags uintptr, ...) error
- func (p *Points) AddMaskedPaths(paths []string) error
- func (p *Points) AddOverlay(tag AuthorizedTag, dest string, flags uintptr, lowerdir string, ...) error
- func (p *Points) AddReadonlyPaths(paths []string) 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" // 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" // UserbindsTag defines tag for user bind mount points UserbindsTag = "userbinds" // 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" // 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" )
Variables ¶
This section is empty.
Functions ¶
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
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) AddFS ¶
func (p *Points) AddFS(tag AuthorizedTag, dest string, fstype string, flags uintptr, options string) error
AddFS 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) error
AddImage adds an image mount point
func (*Points) AddMaskedPaths ¶
AddMaskedPaths adds mount points that will masked will /dev/null
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) AddReadonlyPaths ¶
AddReadonlyPaths adds bind mount points that will be mounted in read-only mode
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) 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