Struct loopdev::LoopDevice[][src]

pub struct LoopDevice { /* fields omitted */ }
Expand description

Interface to a loop device ie /dev/loop0.

Implementations

Opens a loop device.

Attach the loop device to a file with given options.

Examples

Attach the device to a file.

use loopdev::LoopDevice;
let mut ld = LoopDevice::open("/dev/loop3").unwrap();
ld.with().part_scan(true).attach("disk.img").unwrap();

Attach the loop device to a file that maps to the whole file.

Examples

Attach the device to a file.

use loopdev::LoopDevice;
let ld = LoopDevice::open("/dev/loop4").unwrap();
ld.attach_file("disk.img").unwrap();

Get the path of the loop device.

Get the device major number

Get the device major number

Detach a loop device from its backing file.

Note that the device won’t fully detach until a short delay after the underling device file gets closed. This happens when LoopDev goes out of scope so you should ensure the LoopDev lives for a short a time as possible.

Examples
use loopdev::LoopDevice;
let ld = LoopDevice::open("/dev/loop5").unwrap();
ld.detach().unwrap();

Resize a live loop device. If the size of the backing file changes this can be called to inform the loop driver about the new size.

Trait Implementations

Extracts the raw file descriptor. Read more

Formats the value using the given formatter. Read more

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.