pub struct SyncFileSystem { /* private fields */ }
Implementations§
Source§impl SyncFileSystem
impl SyncFileSystem
pub const fn root_dir_id() -> EntryId
pub fn num_blocks(&self) -> u64
pub fn empty_blocks(&self) -> u64
pub fn open_fs(block_device: Box<dyn SyncBlockDevice>) -> Result<Self, FsError>
Sourcepub fn add_file(
&mut self,
parent_id: EntryId,
name: &str,
) -> Result<EntryId, FsError>
pub fn add_file( &mut self, parent_id: EntryId, name: &str, ) -> Result<EntryId, FsError>
Create a new file.
Sourcepub fn add_directory(
&mut self,
parent_id: EntryId,
name: &str,
) -> Result<EntryId, FsError>
pub fn add_directory( &mut self, parent_id: EntryId, name: &str, ) -> Result<EntryId, FsError>
Create a new directory.
Sourcepub fn get_directory_entry(
&mut self,
parent: EntryId,
pos: u64,
) -> Result<DirEntry, FsError>
pub fn get_directory_entry( &mut self, parent: EntryId, pos: u64, ) -> Result<DirEntry, FsError>
Get a specific directory entry (child).
pub fn get_directory_entry_by_name( &mut self, parent: EntryId, name: &str, ) -> Result<DirEntry, FsError>
Sourcepub fn get_num_entries(&mut self, dir: EntryId) -> Result<u64, FsError>
pub fn get_num_entries(&mut self, dir: EntryId) -> Result<u64, FsError>
Get the number of directory entries (children).
pub fn stat(&mut self, entry: EntryId) -> Result<Attr, FsError>
pub fn set_file_size( &mut self, file_id: EntryId, new_size: u64, ) -> Result<(), FsError>
pub fn get_parent( &mut self, entry_id: EntryId, ) -> Result<Option<EntryId>, FsError>
pub fn get_name(&mut self, entry_id: EntryId) -> Result<String, FsError>
pub fn move_rename( &mut self, entry_id: EntryId, new_parent: EntryId, new_name: &str, ) -> Result<(), FsError>
pub fn remove(&mut self, entry_id: EntryId) -> Result<(), FsError>
Sourcepub fn write(
&mut self,
file_id: EntryId,
offset: u64,
buf: &[u8],
) -> Result<usize, FsError>
pub fn write( &mut self, file_id: EntryId, offset: u64, buf: &[u8], ) -> Result<usize, FsError>
Write buf to file at offset. At most 4096 bytes will be written.
A write may succeed with the resulting usize less than buf.len; this usually happens when the write would otherwise cross a block boundary. Just do another write for the remaining bytes then.
pub fn read( &mut self, file_id: EntryId, offset: u64, buf: &mut [u8], ) -> Result<usize, FsError>
Auto Trait Implementations§
impl Freeze for SyncFileSystem
impl !RefUnwindSafe for SyncFileSystem
impl !Send for SyncFileSystem
impl !Sync for SyncFileSystem
impl Unpin for SyncFileSystem
impl !UnwindSafe for SyncFileSystem
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