Struct loopdev::LoopDevice [−][src]
pub struct LoopDevice { /* fields omitted */ }
Interface to a loop device ie /dev/loop0
.
Methods
impl LoopDevice
[src]
impl LoopDevice
pub fn open<P: AsRef<Path>>(dev: P) -> Result<LoopDevice>
[src]
pub fn open<P: AsRef<Path>>(dev: P) -> Result<LoopDevice>
Opens a loop device.
pub fn attach<P: AsRef<Path>>(&self, backing_file: P, offset: u64) -> Result<()>
[src]
pub fn attach<P: AsRef<Path>>(&self, backing_file: P, offset: u64) -> Result<()>
: use attach_file
or attach_with_offset
instead
Attach the loop device to a file starting at offset into the file.
pub fn attach_file<P: AsRef<Path>>(&self, backing_file: P) -> Result<()>
[src]
pub fn attach_file<P: AsRef<Path>>(&self, backing_file: P) -> Result<()>
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();
pub fn attach_with_offset<P: AsRef<Path>>(
&self,
backing_file: P,
offset: u64
) -> Result<()>
[src]
pub fn attach_with_offset<P: AsRef<Path>>(
&self,
backing_file: P,
offset: u64
) -> Result<()>
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();
pub fn attach_with_sizelimit<P: AsRef<Path>>(
&self,
backing_file: P,
offset: u64,
sizelimit: u64
) -> Result<()>
[src]
pub fn attach_with_sizelimit<P: AsRef<Path>>(
&self,
backing_file: P,
offset: u64,
sizelimit: u64
) -> Result<()>
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();
pub fn get_path(&self) -> Option<PathBuf>
[src]
pub fn get_path(&self) -> Option<PathBuf>
: use path
instead
Get the path of the loop device.
pub fn path(&self) -> Option<PathBuf>
[src]
pub fn path(&self) -> Option<PathBuf>
Get the path of the loop device.
pub fn detach(&self) -> Result<()>
[src]
pub fn detach(&self) -> Result<()>
Detach a loop device from its backing file.
Examples
use loopdev::LoopDevice; let ld = LoopDevice::open("/dev/loop7").unwrap(); ld.detach().unwrap();
pub fn set_capacity(&self) -> Result<()>
[src]
pub fn set_capacity(&self) -> Result<()>
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]
impl Debug for LoopDevice
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl AsRawFd for LoopDevice
[src]
impl AsRawFd for LoopDevice
Auto Trait Implementations
impl Send for LoopDevice
impl Send for LoopDevice
impl Sync for LoopDevice
impl Sync for LoopDevice