pub struct BlockDevice {
pub size: u64,
pub read_only: bool,
/* private fields */
}Expand description
Host block device backing /dev/wda, /dev/wdb, etc.
Fields§
§size: u64§read_only: boolImplementations§
Source§impl BlockDevice
impl BlockDevice
pub fn open_readonly(path: &Path) -> Result<Self>
Sourcepub fn open_data_disk(
path: &Path,
read_only: bool,
snapshot_cow: bool,
) -> Result<Self>
pub fn open_data_disk( path: &Path, read_only: bool, snapshot_cow: bool, ) -> Result<Self>
Open a persistent data disk (read-write, read-only, or in-memory snapshot COW).
Sourcepub fn from_snapshot(snap: &DiskSnapshot) -> Result<Self>
pub fn from_snapshot(snap: &DiskSnapshot) -> Result<Self>
Open a writable COW BlockDevice seeded from an existing DiskSnapshot.
Never mutates snap.base_path; further writes stay isolated to this branch.
Sourcepub fn snapshot(&self) -> Result<DiskSnapshot>
pub fn snapshot(&self) -> Result<DiskSnapshot>
Capture a cloneable DiskSnapshot of this device’s current state (< 1 ms for COW disks).
pub fn flags(&self) -> u32
pub fn read_at(&self, off: u64, dst: &mut [u8]) -> Result<()>
pub fn write_at(&self, off: u64, src: &[u8]) -> Result<()>
pub fn flush(&self) -> Result<()>
pub fn write_zeroes(&self, off: u64, len: u64) -> Result<()>
pub fn discard(&self, off: u64, len: u64) -> Result<()>
Auto Trait Implementations§
impl !Freeze for BlockDevice
impl Forget for BlockDevice
impl Move for BlockDevice
impl RefUnwindSafe for BlockDevice
impl Send for BlockDevice
impl Sync for BlockDevice
impl Unpin for BlockDevice
impl UnsafeUnpin for BlockDevicewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
I32NotAllOnes: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
PhantomData<(u64, Box<[u8; 4096]>)>: UnsafeUnpin,
impl UnwindSafe for BlockDevicewhere
RawVecInner: UnwindSafe,
I32NotAllOnes: UnwindSafe,
Mutex<HashMap<u64, Box<[u8; 4096]>>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more