mount

package
v4.1.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: BSD-3-Clause Imports: 7 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"
	// SharedTag defines tag for shared mount point between master
	// 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"
)
View Source
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

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 GetKey

func GetKey(options []string) ([]byte, error)

GetKey returns key value for image options

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

func HasPropagationFlag

func HasPropagationFlag(flags uintptr) bool

HasPropagationFlag checks if a propagation flag is set or not.

func HasRemountFlag

func HasRemountFlag(flags uintptr) bool

HasRemountFlag checks if remount flag is set or not.

func SkipOnError

func SkipOnError(options []string) bool

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

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

func (b *System) CurrentTag() AuthorizedTag

CurrentTag returns the tag being processed by MountAll.

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