Documentation ¶
Overview ¶
Package mount handles filesystem mount operations.
Index ¶
- func SafeUnmount(ctx context.Context, printer func(string, ...any), target string) error
- func UnmountAll() error
- type NewPointOption
- func WithData(data string) NewPointOption
- func WithExtraDirs(dirs ...string) NewPointOption
- func WithFlags(flags uintptr) NewPointOption
- func WithProjectQuota(enabled bool) NewPointOption
- func WithReadonly() NewPointOption
- func WithSelinuxLabel(label string) NewPointOption
- func WithShared() NewPointOption
- type OperationOption
- type OperationOptions
- type Point
- func NewOverlayWithBasePath(sources []string, target, basePath string, opts ...NewPointOption) *Point
- func NewPoint(source, target, fstype string, opts ...NewPointOption) *Point
- func NewReadonlyOverlay(sources []string, target string, opts ...NewPointOption) *Point
- func NewSystemOverlay(sources []string, target string, opts ...NewPointOption) *Point
- func NewVarOverlay(sources []string, target string, opts ...NewPointOption) *Point
- func Squashfs(target, squashfsFile string) (*Point, error)
- type Points
- type PrinterOptions
- type UnmountOption
- type UnmountOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SafeUnmount ¶
SafeUnmount unmounts the target path, first without force, then with force if the first attempt fails.
It makes sure that unmounting has a finite operation timeout.
func UnmountAll ¶ added in v1.9.0
func UnmountAll() error
UnmountAll attempts to unmount all the mounted filesystems via "self" mountinfo.
Types ¶
type NewPointOption ¶
type NewPointOption func(*Point)
NewPointOption is a mount point option.
func WithData ¶ added in v1.9.0
func WithData(data string) NewPointOption
WithData sets the mount data.
func WithExtraDirs ¶ added in v1.9.0
func WithExtraDirs(dirs ...string) NewPointOption
WithExtraDirs sets the extra directories to be created on mount.
func WithProjectQuota ¶
func WithProjectQuota(enabled bool) NewPointOption
WithProjectQuota sets the project quota flag.
func WithSelinuxLabel ¶ added in v1.9.0
func WithSelinuxLabel(label string) NewPointOption
WithSelinuxLabel sets the mount SELinux label.
type OperationOption ¶
type OperationOption func(*OperationOptions)
OperationOption is a mount option.
func WithMountPrinter ¶
func WithMountPrinter(printer func(string, ...any)) OperationOption
WithMountPrinter sets the printer.
func WithSkipIfMounted ¶
func WithSkipIfMounted() OperationOption
WithSkipIfMounted sets the skip if mounted flag.
type OperationOptions ¶
type OperationOptions struct { PrinterOptions SkipIfMounted bool TargetMode os.FileMode }
OperationOptions are mount options.
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point represents a mount point.
func NewOverlayWithBasePath ¶ added in v1.9.0
func NewOverlayWithBasePath(sources []string, target, basePath string, opts ...NewPointOption) *Point
NewOverlayWithBasePath creates a new overlay mount point with a base path.
func NewPoint ¶
func NewPoint(source, target, fstype string, opts ...NewPointOption) *Point
NewPoint creates a new mount point.
func NewReadonlyOverlay ¶ added in v1.9.0
func NewReadonlyOverlay(sources []string, target string, opts ...NewPointOption) *Point
NewReadonlyOverlay creates a new read-only overlay mount point.
func NewSystemOverlay ¶ added in v1.9.0
func NewSystemOverlay(sources []string, target string, opts ...NewPointOption) *Point
NewSystemOverlay creates a new /system overlay mount point.
func NewVarOverlay ¶ added in v1.9.0
func NewVarOverlay(sources []string, target string, opts ...NewPointOption) *Point
NewVarOverlay creates a new /var overlay mount point.
func Squashfs ¶ added in v1.9.0
Squashfs binds the squashfs to the loop device and returns the mountpoint for it to the specified target.
func (*Point) IsMounted ¶
IsMounted checks if the mount point is mounted by checking the mount on the target.
func (*Point) Mount ¶
func (p *Point) Mount(opts ...OperationOption) (unmounter func() error, err error)
Mount the mount point.
Mount returns an unmounter function to unmount the mount point.
func (*Point) Unmount ¶
func (p *Point) Unmount(opts ...UnmountOption) error
Unmount the mount point.
type Points ¶
type Points []*Point
Points is a list of mount points.
func CGroupMountPoints ¶ added in v1.9.0
func CGroupMountPoints() Points
CGroupMountPoints returns the cgroup mount points.
func OverlayMountPoints ¶ added in v1.9.0
func OverlayMountPoints() Points
OverlayMountPoints returns the mountpoints required to boot the system. These mountpoints are used as overlays on top of the read only rootfs.
func Pseudo ¶ added in v1.9.0
func Pseudo() Points
Pseudo returns the mountpoints required to boot the system.
func PseudoLate ¶ added in v1.9.0
func PseudoLate() Points
PseudoLate returns the mountpoints mounted later in the boot cycle.
func PseudoSubMountPoints ¶ added in v1.9.0
func PseudoSubMountPoints() Points
PseudoSubMountPoints returns the sub-mountpoints under Pseudo().
func (Points) Mount ¶
func (points Points) Mount(opts ...OperationOption) (unmounter func() error, err error)
Mount all mount points.
type PrinterOptions ¶
PrinterOptions are printer options.
func (PrinterOptions) Printf ¶
func (o PrinterOptions) Printf(format string, args ...any)
Printf prints a formatted string (or skips if printer is nil).
type UnmountOption ¶
type UnmountOption func(*UnmountOptions)
UnmountOption is an unmount option.
func WithUnmountPrinter ¶
func WithUnmountPrinter(printer func(string, ...any)) UnmountOption
WithUnmountPrinter sets the printer.
type UnmountOptions ¶
type UnmountOptions struct {
PrinterOptions
}
UnmountOptions is unmount options.