Crate loopdev[][src]

Expand description

Setup and control loop devices.

Provides rust interface with similar functionality to the Linux utility losetup.

Examples

Default options:

use loopdev::LoopControl;
let lc = LoopControl::open().unwrap();
let ld = lc.next_free().unwrap();

println!("{}", ld.path().unwrap().display());

ld.attach_file("disk.img").unwrap();
// ...
ld.detach().unwrap();

Custom options:

ld.with()
    .part_scan(true)
    .offset(512 * 1024 * 1024) // 512 MiB
    .size_limit(1024 * 1024 * 1024) // 1GiB
    .attach("disk.img").unwrap();
// ...
ld.detach().unwrap();

Structs

Used to set options when attaching a device. Created with LoopDevice::with().

Interface to the loop control device: /dev/loop-control.

Interface to a loop device ie /dev/loop0.