Skip to main content

FatFs

Struct FatFs 

Source
pub struct FatFs<'a, B: BlockDevice> {
    block_dev: &'a mut B,
    bpb: Bpb,
}

Fields§

§block_dev: &'a mut B§bpb: Bpb

Implementations§

Source§

impl<'a, B: BlockDevice> FatFs<'a, B>

Source

pub fn new(block_dev: &'a mut B) -> Option<Self>

Mount a FAT32 filesystem from a block device.

Source

fn read_sector_at( dev: &mut B, fat32_sector: u32, buf: &mut [u8; 512], kernel_block_size: usize, ) -> Option<()>

Read a FAT32 sector from a block device at any block size.

Source

fn read_sector(&mut self, fat32_sector: u32, buf: &mut [u8; 512]) -> Option<()>

Source

fn next_cluster(&mut self, cluster: u32) -> Option<u32>

Read the next cluster number from the FAT table.

Source

fn read_chain( &mut self, start_cluster: u32, clusters_to_skip: u32, max_bytes: Option<usize>, ) -> Option<Vec<u8>>

Read a full cluster chain into a heap-allocated buffer.

Skips clusters_to_skip clusters at the start (for offset-based reads). Only reads max_bytes after the skip, if provided.

Source

fn read_cluster_chain_alloc(&mut self, cluster: u32) -> Option<Vec<u8>>

Read a full cluster chain (from the start, no skip).

Source

fn read_dir_entries(&mut self, cluster: u32) -> Option<Vec<DirEntry>>

Read raw directory entries from a cluster chain.

Source

fn parse_dir_entries(&self, data: &[u8]) -> Option<Vec<DirEntry>>

Parse raw directory data into DirEntry items.

Handles:

  • End-of-directory marker (0x00)
  • Deleted entries (0xE5)
  • LFN entries (attr == 0x0F)
  • Volume ID entries (attr == 0x08)
Source

fn resolve_path(&mut self, path: &str) -> Option<DirEntry>

Resolve a path to a directory entry.

Source

pub fn read_file(&mut self, path: &str) -> Option<Vec<u8>>

Read a file by path, returning its contents.

Source

pub fn list_dir(&mut self, path: &str) -> Option<Vec<DirEntry>>

List directory contents by path.

Auto Trait Implementations§

§

impl<'a, B> !UnwindSafe for FatFs<'a, B>

§

impl<'a, B> Freeze for FatFs<'a, B>

§

impl<'a, B> RefUnwindSafe for FatFs<'a, B>
where B: RefUnwindSafe,

§

impl<'a, B> Send for FatFs<'a, B>
where B: Send,

§

impl<'a, B> Sync for FatFs<'a, B>
where B: Sync,

§

impl<'a, B> Unpin for FatFs<'a, B>

§

impl<'a, B> UnsafeUnpin for FatFs<'a, B>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.