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 ¶
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. The _LOOP_CTL_GET_FREE does not follow the rules. Values of 0 or greater are the number of the device; less than zero is an error. So you can not use unix.IoctlGetInt as it assumes the return value is stored in a pointer in the normal style. Yuck.
func New ¶
New initializes a Loop struct and allocates a loop device to it.
source is the file to use as a loop block device. fstype the file system name. data is the data argument to the mount(2) syscall.
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 // FSType is the file system to use when mounting the block device. FSType string // Data is the data to pass to mount(2). Data string // Mounted indicates whether the device has been mounted. Mounted bool // contains filtered or unexported fields }
Loop represents a regular file exposed as a loop block device.
Loop implements mount.Mounter.