pub struct Disk { /* private fields */ }
Available on crate feature
myfs
only.Expand description
A disk device with a cursor.
Implementations§
Source§impl Disk
impl Disk
Sourcepub fn new(dev: AxBlockDevice) -> Self
pub fn new(dev: AxBlockDevice) -> Self
Create a new disk.
Sourcepub fn set_position(&mut self, pos: u64)
pub fn set_position(&mut self, pos: u64)
Set the position of the cursor.
Sourcepub fn read_one(&mut self, buf: &mut [u8]) -> DevResult<usize>
pub fn read_one(&mut self, buf: &mut [u8]) -> DevResult<usize>
Read within one block, returns the number of bytes read.
Sourcepub fn write_one(&mut self, buf: &[u8]) -> DevResult<usize>
pub fn write_one(&mut self, buf: &[u8]) -> DevResult<usize>
Write within one block, returns the number of bytes written.
Sourcepub fn read_offset(&mut self, offset: usize) -> [u8; 512]
pub fn read_offset(&mut self, offset: usize) -> [u8; 512]
Read a single block starting from the specified offset.
Sourcepub fn write_offset(&mut self, offset: usize, buf: &[u8]) -> DevResult<usize>
pub fn write_offset(&mut self, offset: usize, buf: &[u8]) -> DevResult<usize>
Write single block starting from the specified offset.
Auto Trait Implementations§
impl Freeze for Disk
impl RefUnwindSafe for Disk
impl Send for Disk
impl Sync for Disk
impl Unpin for Disk
impl UnwindSafe for Disk
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