Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMaxLoopDevices ¶
func GetMaxLoopDevices() int
GetMaxLoopDevices Return the maximum number of loop devices allowed
func GetStatusFromFd ¶
func GetStatusFromFd(fd uintptr) (*unix.LoopInfo64, error)
GetStatusFromFd gets info status about an opened loop device
func GetStatusFromPath ¶
func GetStatusFromPath(path string) (*unix.LoopInfo64, error)
GetStatusFromPath gets info status about a loop device from path
Types ¶
type Device ¶
type Device struct { MaxLoopDevices int Info *unix.LoopInfo64 // contains filtered or unexported fields }
Device describes a loop device
func (*Device) AttachFromFile ¶
AttachFromFile attempts to find a suitable loop device to use for the specified image. It runs through /dev/loopXX, up to MaxLoopDevices to find a free loop device, or to share a loop device already associated to file (if shared loop devices are enabled). If a usable loop device is found, then loop.Fd is set and no error is returned. If a usable loop device is not found, and this is due to a transient EAGAIN / EBUSY error, then it will retry up to maxRetries times, retryInterval apart, before returning an error.
func (*Device) AttachFromPath ¶
AttachFromPath finds a free loop device, opens it, and stores file descriptor of opened image path