sys

package
v1.4.4-0...-86a696e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindMount

func BindMount(source, target, fsType string, recursive, readOnly bool, superBlockFlags string) error

BindMount does bind-mount of source to target.

func GetDeviceByFSUUID

func GetDeviceByFSUUID(fsuuid string) (device string, err error)

GetDeviceByFSUUID get device name by it's FSUUID.

func Mkdir

func Mkdir(name string, perm os.FileMode) (err error)

Mkdir is a util to mkdir with some special error handling

func Mount

func Mount(device, target, fsType string, flags []string, superBlockFlags string) error

Mount mounts device to target using fsType, flags and superBlockFlags.

func Unmount

func Unmount(target string, force, detach, expire bool) error

Unmount unmounts target with force, detach and expire options.

Types

type ErrMountPointAlreadyMounted

type ErrMountPointAlreadyMounted struct {
	MountPoint string
	Devices    []string
}

ErrMountPointAlreadyMounted denotes mount point already mounted error.

func (*ErrMountPointAlreadyMounted) Error

Error is error interface compatible method.

type MountEntry

type MountEntry struct {
	MountID        string
	ParentID       string
	MajorMinor     string
	Root           string
	MountPoint     string
	MountOptions   utils.StringSet
	OptionalFields []string
	FilesystemType string
	MountSource    string
	// contains filtered or unexported fields
}

MountEntry contains single mount information from /proc/self/mountinfo

func (MountEntry) String

func (m MountEntry) String() string

type MountInfo

type MountInfo struct {
	// contains filtered or unexported fields
}

MountInfo contains multiple mount information from /proc/self/mountinfo

func FakeMountInfo

func FakeMountInfo(mountEntries ...MountEntry) *MountInfo

FakeMountInfo creates mount information with tesing mount entries

func NewMountInfo

func NewMountInfo() (*MountInfo, error)

NewMountInfo creates mount information from /proc/self/mountinfo

func (*MountInfo) FilterByMajorMinor

func (info *MountInfo) FilterByMajorMinor(value string) *MountInfo

FilterByMajorMinor returns mount information filtered by major:minor

func (*MountInfo) FilterByMountPoint

func (info *MountInfo) FilterByMountPoint(value string) *MountInfo

FilterByMountPoint returns mount information filtered by mount point

func (*MountInfo) FilterByMountSource

func (info *MountInfo) FilterByMountSource(value string) *MountInfo

FilterByMountSource returns mount information filtered by mount source

func (*MountInfo) FilterByRoot

func (info *MountInfo) FilterByRoot(value string) *MountInfo

FilterByRoot returns mount information filtered by root mount point

func (*MountInfo) IsEmpty

func (info *MountInfo) IsEmpty() bool

IsEmpty checks whether this mount information is empty or not

func (*MountInfo) Length

func (info *MountInfo) Length() int

Length returns number of mount information available

func (*MountInfo) List

func (info *MountInfo) List() (mounts []*MountEntry)

List returns list of mount entries available

Jump to

Keyboard shortcuts

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