pub struct Controller<D, T, const MAX_DIRS: usize = 4, const MAX_FILES: usize = 4>where
    D: BlockDevice,
    T: TimeSource,
    <D as BlockDevice>::Error: Debug,
{ /* private fields */ }
Expand description

A Controller wraps a block device and gives access to the volumes within it.

Implementations§

Create a new Disk Controller using a generic BlockDevice. From this controller we can open volumes (partitions) and with those we can open files.

This creates a Controller with default values MAX_DIRS = 4, MAX_FILES = 4. Call Controller::new_with_limits(block_device, timesource) if you need different limits.

Create a new Disk Controller using a generic BlockDevice. From this controller we can open volumes (partitions) and with those we can open files.

Temporarily get access to the underlying block device.

Get a volume (or partition) based on entries in the Master Boot Record. We do not support GUID Partition Table disks. Nor do we support any concept of drive letters - that is for a higher layer to handle.

Open a directory.

You can then read the directory entries with iterate_dir and open_file_in_dir.

TODO: Work out how to prevent damage occuring to the file system while this directory handle is open. In particular, stop this directory being unlinked.

Open a directory.

You can then read the directory entries with iterate_dir and open_file_in_dir.

TODO: Work out how to prevent damage occuring to the file system while this directory handle is open. In particular, stop this directory being unlinked.

Close a directory. You cannot perform operations on an open directory and so must close it if you want to do something with it.

source

pub fn find_directory_entry(
    &mut self,
    volume: &Volume,
    dir: &Directory,
    name: &str
) -> Result<DirEntry, Error<D::Error>>

Look in a directory for a named file.

Call a callback function for each directory entry in a directory.

source

pub fn open_dir_entry(
    &mut self,
    volume: &mut Volume,
    dir_entry: DirEntry,
    mode: Mode
) -> Result<File, Error<D::Error>>

Open a file from DirEntry. This is obtained by calling iterate_dir. A file can only be opened once.

Open a file with the given full path. A file can only be opened once.

Delete a closed file with the given full path, if exists.

Read from an open file.

Write to a open file.

Close a file with the given full path.

Check if any files or folders are open.

Consume self and return BlockDevice and TimeSource

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.