class LoopDevControl

Set of functions for loop device management.

See Also:

man 4 loop

static loop_info64 getLoopStatus(long loopNumber)

Creates loop_info64 structure for loop device with required number.

Parameters

loopNumber

Loop device number.

Returns

loop_info64 structure object.

static bool doesLoopDeviceExistAndIsBusy(uint loopNumber)

Returns true if loop device exists, but busy.

Parameters

loopNumber

Loop device number.

Returns

true or false.

static bool isLoopDeviceBusy(uint loopNumber)

Returns true if loop device is busy.

Parameters

loopNumber

Loop device number.

Returns

true or false.

static uint getFreeLoopDevice()

Allocates or finds a free loop device for use.

Returns

free loop device number.

static void addLoopDevice(ulong loopNumber)

Adds the new loop device.

Parameters

loopNumber

Loop device number.

static void associateFileWithDevice(string filePath, ulong loopNumber)

Associates the loop device with the required file.

Parameters

filePath

File path to associate.

loopNumber

Loop device number.

static void associateFileWithDevice(string filePath, string loopDevice)

Associates the loop device with the required file.

Parameters

filePath

File path to associate.

loopDevice

Loop device path.

static void disassociateFileWithDevice(string filePath, ulong loopNumber)

Disassociates the loop device with the required file.

Parameters

filePath

Associated file.

loopNumber

Loop device number.

static void disassociateFileWithDevice(string filePath, string loopDevice)

Disassociates the loop device with the required file.

Parameters

filePath

Associated file.

loopDevice

Loop device path.

static string[] findDevicesByFile(string backingFile)

Gets all loop devices related to the specified backing file.

Parameters

backingFile

Associated file.

Returns

Array of paths to loop devices.

static string getBackingFile(uint loopDeviceNo) nothrow

Returns the associated file for the specified loop device.

static string getBackingFile(string loopDeviceName) nothrow

Returns the associated file for the specified loop device.