mount

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CouldNotOpenFile

func CouldNotOpenFile(path string, err error) error

func IsFileSystemSupported

func IsFileSystemSupported(fsType string) (bool, error)

IsFileSystemSupported checks if given fs is supported by the running kernel

func SearchMountpointFromHost added in v0.20.0

func SearchMountpointFromHost(fstype string, search string) (string, int, error)

SearchMountpointFromHost scans the /proc/self/mountinfo file to find the oldest mountpoint of a specified filesystem type (fstype) that contains a given searchable string (search) in its path. This is useful in environments like containers where multiple mountpoints may exist, and we need to find the one that belongs to the host namespace.

Parameters: - fstype: The filesystem type to search for (e.g., "cgroup2", "ext4"). - search: The substring to search for within the mountpoint path (e.g., "/sys/fs/cgroup").

Returns: - string: The path of the oldest matching mountpoint. - int: The inode number of the matching mountpoint. - error: Any error encountered while reading the /proc/mounts file.

func UnmountedDirNotEmpty

func UnmountedDirNotEmpty(dir string) error

Types

type MountHostOnce added in v0.20.0

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

MountHostOnce will make sure a given source and filesystem type are mounted just once: it will check if given source and fs type are already mounted, and given from the host filesystem, and if not, it will mount it (in a temporary directory) and manage it (umounting at its destruction). If already mounted, the filesystem is left untouched at object's destruction.

func NewMountHostOnce added in v0.20.0

func NewMountHostOnce(source, fstype, data, where string) (*MountHostOnce, error)

func (*MountHostOnce) GetMountpoint added in v0.20.0

func (m *MountHostOnce) GetMountpoint() string

func (*MountHostOnce) GetMountpointInode added in v0.21.0

func (m *MountHostOnce) GetMountpointInode() int

func (*MountHostOnce) IsMounted added in v0.20.0

func (m *MountHostOnce) IsMounted() bool

func (*MountHostOnce) Mount added in v0.20.0

func (m *MountHostOnce) Mount() error

func (*MountHostOnce) Umount added in v0.20.0

func (m *MountHostOnce) Umount() error

Jump to

Keyboard shortcuts

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