mount

package
v3.0.2-rc1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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

func ConvertOptions(options []string) (uintptr, []string)

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 GetOffset

func GetOffset(options []string) (uint64, error)

GetOffset return offset value for image options

func GetSizeLimit

func GetSizeLimit(options []string) (uint64, error)

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 Point

type Point struct {
	specs.Mount
	InternalOptions []string `json:"internalOptions"`
}

Point describes a mount point

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) 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) 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

func (p *Points) AddMaskedPaths(paths []string) error

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

func (p *Points) AddReadonlyPaths(paths []string) error

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

func (p *Points) GetAllBinds() []Point

GetAllBinds returns a list of all registered bind mount points

func (*Points) GetAllFS

func (p *Points) GetAllFS() []Point

GetAllFS returns a list of all registered filesystem mount points

func (*Points) GetAllImages

func (p *Points) GetAllImages() []Point

GetAllImages returns a list of all registered image mount points

func (*Points) GetAllOverlays

func (p *Points) GetAllOverlays() []Point

GetAllOverlays returns a list of all registered overlay mount points

func (*Points) GetByDest

func (p *Points) GetByDest(dest string) []Point

GetByDest returns registered mount points with the matched destination

func (*Points) GetBySource

func (p *Points) GetBySource(source string) []Point

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

func (p *Points) GetContext() string

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

func (p *Points) ImportFromSpec(mounts []specs.Mount) error

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

func (p *Points) RemoveByDest(dest string)

RemoveByDest removes mount points identified by destination

func (*Points) RemoveBySource

func (p *Points) RemoveBySource(source string)

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

func (p *Points) SetContext(context string) error

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

func (b *System) MountAll() error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL