Struct driver_block::ramdisk::RamDisk
source · pub struct RamDisk { /* private fields */ }
Available on crate feature
ramdisk
only.Expand description
A RAM disk that stores data in a vector.
Implementations§
source§impl RamDisk
impl RamDisk
sourcepub fn new(size_hint: usize) -> Self
pub fn new(size_hint: usize) -> Self
Creates a new RAM disk with the given size hint.
The actual size of the RAM disk will be aligned upwards to the block size (512 bytes).
sourcepub fn from(buf: &[u8]) -> Self
pub fn from(buf: &[u8]) -> Self
Creates a new RAM disk from the exiting data.
The actual size of the RAM disk will be aligned upwards to the block size (512 bytes).
sourcepub unsafe fn copy_from_slice(&mut self, vaddr: *const u8)
pub unsafe fn copy_from_slice(&mut self, vaddr: *const u8)
Copies the data from the given slice to the RAM disk.
Safety
The caller must ensure that the given slice is valid for the lifetime of the RAM disk.
Trait Implementations§
source§impl BaseDriverOps for RamDisk
impl BaseDriverOps for RamDisk
source§fn device_type(&self) -> DeviceType
fn device_type(&self) -> DeviceType
The type of the device.
source§fn device_name(&self) -> &str
fn device_name(&self) -> &str
The name of the device.
source§impl BlockDriverOps for RamDisk
impl BlockDriverOps for RamDisk
source§fn num_blocks(&self) -> u64
fn num_blocks(&self) -> u64
The number of blocks in this storage device. Read more
source§fn block_size(&self) -> usize
fn block_size(&self) -> usize
The size of each block in bytes.
source§fn read_block(&mut self, block_id: u64, buf: &mut [u8]) -> DevResult
fn read_block(&mut self, block_id: u64, buf: &mut [u8]) -> DevResult
Reads blocked data from the given block. Read more
Auto Trait Implementations§
impl RefUnwindSafe for RamDisk
impl Send for RamDisk
impl Sync for RamDisk
impl Unpin for RamDisk
impl UnwindSafe for RamDisk
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