Documentation ¶
Overview ¶
Package mount implements mounting, moving, and unmounting file systems.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
Mount attaches the fsType file system at path.
dev is the device to mount (this is often the path of a block device, name of a file, or a dummy string). data usually contains arguments for the specific file system.
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 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 makes newRootDir the new root directory of the system.
To be exact, it makes newRootDir the new root directory of the calling process's mount namespace.
It 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.
func Unmount ¶
Unmount detaches any file system mounted at path.
force forces an unmount regardless of currently open or otherwise used files within the file system to be unmounted.
lazy disallows future uses of any files below path -- i.e. it hides the file system mounted at path, but the file system itself is still active and any currently open files can continue to be used. When all references to files from this file system are gone, the file system will actually be unmounted.
Types ¶
type Mounter ¶
type Mounter interface { // Mount mounts the file system at path. Mount(path string, flags uintptr) error // Unmount unmounts a file system that was previously mounted. // // Mount must have been previously called on this same object. Unmount(flags int) error }
Mounter is an object that can be mounted.