Struct loopdev::LoopDevice[][src]

pub struct LoopDevice { /* fields omitted */ }

Interface to a loop device ie /dev/loop0.

Methods

impl LoopDevice
[src]

Opens a loop device.

Deprecated since 0.2.0

: use attach_file or attach_with_offset instead

Attach the loop device to a file starting at offset into the file.

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("test.img").unwrap();

Attach the loop device to a file starting at offset into the file.

Examples

Attach the device to the start of a file.

use loopdev::LoopDevice;
let ld = LoopDevice::open("/dev/loop5").unwrap();
ld.attach_with_offset("test.img", 0).unwrap();

Attach the loop device to a file starting at offset into the file and a the given sizelimit.

Examples

Attach the device to the start of a file with a maximum size of 1024 bytes.

use loopdev::LoopDevice;
let ld = LoopDevice::open("/dev/loop6").unwrap();
ld.attach_with_sizelimit("test.img", 0, 1024).unwrap();

Deprecated since 0.2.0

: use path instead

Get the path of the loop device.

Get the path of the loop device.

Detach a loop device from its backing file.

Examples

use loopdev::LoopDevice;
let ld = LoopDevice::open("/dev/loop7").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

impl Debug for LoopDevice
[src]

Formats the value using the given formatter. Read more

impl AsRawFd for LoopDevice
[src]

Extracts the raw file descriptor. Read more

Auto Trait Implementations

impl Send for LoopDevice

impl Sync for LoopDevice