mount

package
v0.0.0-...-c269f4c Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package mount provides general data structure for mount and mount namespace (multiple mounts) definition.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Mounts []Mount
}

Builder builds fork_exec friendly mount syscall format

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates new mount builder instance

func NewDefaultBuilder

func NewDefaultBuilder() *Builder

NewDefaultBuilder creates default builder for minimal rootfs

func (*Builder) Build

func (b *Builder) Build() ([]SyscallParams, error)

Build creates sequence of syscalls for fork_exec

func (*Builder) FilterNotExist

func (b *Builder) FilterNotExist() *Builder

FilterNotExist removes bind mount that does not exists

func (Builder) String

func (b Builder) String() string

func (*Builder) WithBind

func (b *Builder) WithBind(source, target string, readonly bool) *Builder

WithBind adds a bind mount to builder

func (*Builder) WithMount

func (b *Builder) WithMount(m Mount) *Builder

WithMount add single mount to builder

func (*Builder) WithMounts

func (b *Builder) WithMounts(m []Mount) *Builder

WithMounts add mounts to builder

func (*Builder) WithProc

func (b *Builder) WithProc() *Builder

WithProc add proc file system

func (*Builder) WithTmpfs

func (b *Builder) WithTmpfs(target, data string) *Builder

WithTmpfs add a tmpfs mount to builder

type Mount

type Mount struct {
	Source, Target, FsType, Data string
	Flags                        uintptr
}

Mount defines syscall for mount points

func (Mount) IsBindMount

func (m Mount) IsBindMount() bool

IsBindMount returns if it is a bind mount

func (Mount) IsReadOnly

func (m Mount) IsReadOnly() bool

IsReadOnly returns if it is a readonly mount

func (Mount) IsTmpFs

func (m Mount) IsTmpFs() bool

IsTmpFs returns if the fsType is tmpfs

func (*Mount) Mount

func (m *Mount) Mount() error

Mount calls mount syscall

func (Mount) String

func (m Mount) String() string

func (*Mount) ToSyscall

func (m *Mount) ToSyscall() (*SyscallParams, error)

ToSyscall convert Mount to SyscallPrams

type SyscallParams

type SyscallParams struct {
	Source, Target, FsType, Data *byte
	Flags                        uintptr
	Prefixes                     []*byte
	MakeNod                      bool
}

SyscallParams defines the raw syscall arguments to mount

Jump to

Keyboard shortcuts

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