Documentation ¶
Overview ¶
Package loop provides an interface to interacting with Linux loop devices.
A loop device exposes a regular file as if it were a block device.
Index ¶
- func ClearFD(fd int) error
- func ClearFile(devicename string) error
- func FindDevice() (string, error)
- func GetFree(fd int) (int, error)
- func New(source, target, fstype string, flags uintptr, data string) (mount.Mounter, error)
- func SetFD(lfd, ffd int) error
- func SetFile(devicename, filename string) error
- type Loop
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindDevice ¶
FindDevice finds an unused loop device and returns its /dev/loopN path.
func GetFree ¶
GetFree finds a free loop device /dev/loopN.
fd must be a loop control device.
It returns the number of the free loop device /dev/loopN.
func New ¶
New initializes a Loop struct and allocates a loodevice to it.
source is the file to use as a loop block device. target is the directory the device should be mounted on.
Types ¶
type Loop ¶
type Loop struct { // Dev is the loop device path. Dev string // Source is the regular file to use as a block device. Source string // Dir is the directory to mount the block device on. Dir string // FSType is the file system to use when mounting the block device. FSType string // Flags are flags to pass to mount(2). Flags uintptr // Data is the data to pass to mount(2). Data string // Mounted indicates whether the device has been mounted. Mounted bool }
Loop represents a regular file exposed as a loop block device.
Loop implements mount.Mount.
func (*Loop) Mount ¶
Mount mounts the provided source file, with type fstype, and flags and data options (which are usually 0 and ""), using the allocated loop device.