Struct loopdev::AttachOptions[][src]

pub struct AttachOptions<'d> { /* fields omitted */ }
Expand description

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

Examples

Enable partition scanning on attach:

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

A 1MiB slice of the file located at 1KiB into the file.

use loopdev::LoopDevice;
let mut ld = LoopDevice::open("/dev/loop7").unwrap();
ld.with()
    .offset(1024*1024)
    .size_limit(1024*1024*1024)
    .attach("disk.img")
    .unwrap();

Implementations

Offset in bytes from the start of the backing file the data will start at.

Maximum size of the data in bytes.

Set read only flag

Set autoclear flag

Force the kernel to scan the partition table on a newly created loop device. Note that the partition table parsing depends on sector sizes. The default is sector size is 512 bytes

Attach the loop device to a file with the set options.

Attach the loop device to an fd

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.