Documentation ¶
Overview ¶
The mount package implements functions for mounting and unmounting file systems and defines the mount interface.
The mount package implements functions for mounting and unmounting file systems and defines the mount interface.
Index ¶
- func AddSpecialMounts(newRoot string) error
- func DirIsEmpty(name string) (bool, error)
- func ExecInit(init string) error
- func Mount(dev, path, fsType, data string, flags uintptr) error
- func MoveMount(oldPath string, newPath string) error
- func NewRoot(newRoot string) error
- func RecursiveDelete(fd int) error
- func SameFilesystem(path1, path2 string) (bool, error)
- func SwitchRoot(newRoot string, init string) error
- func Unmount(path string, force, lazy bool) error
- type Mounter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSpecialMounts ¶ added in v0.5.0
AddSpecialMounts moves the 'special' mounts to the given target path
'special' in this context refers to the following non-blockdevice backed mounts that are almost always used: /dev, /proc, /sys, and /run. This function will create the target directories, if necessary. If the target directories already exist, they must be empty. This function skips missing mounts.
func DirIsEmpty ¶ added in v0.5.0
DirIsEmpty returns true if the directory with the given path is empty.
func ExecInit ¶ added in v0.5.0
Function ExecInit is generally only useful as part of SwitchRoot or similar. It exec's the given binary in place of the current binary, necessary so that the new binary can be pid 1.
func MoveMount ¶
MoveMount moves a mount from oldPath to newPath.
This function is just a wrapper around the MOUNT syscall with the MOVE flag supplied.
func NewRoot ¶ added in v0.5.0
NewRoot is the "first half" of SwitchRoot - that is, it creates special mounts in newRoot, chroot's there, and RECURSIVELY DELETES everything in the old root.
func RecursiveDelete ¶ added in v0.5.0
RecursiveDelete deletes a directory identified by `fd` and everything in it.
This function allows deleting directories no longer referenceable by any file name. This function does not descend into mounts.
func SameFilesystem ¶
SameFilesystem returns true if both paths reside in the same filesystem. This is achieved by comparing Stat_t.Dev, which contains the fs device's major/minor numbers.
func SwitchRoot ¶
SwitchRoot moves special mounts (dev, proc, sys, run) to the new directory, then does a chroot, moves the root mount to the new directory and finally DELETES EVERYTHING in the old root and execs the given init.