Skip to main content

Module bytes

Module bytes 

Source
Expand description

Bounds-checked readers for both byte orders (the Paranoid Gatekeeper standard).

UFS is endianness-agnostic on disk: the filesystem is written in the byte order of the host that created it, and the superblock magic disambiguates which order to read (like ZFS). So every reader comes in a little-endian and a big-endian form, and the Endian selector picks between them once the magic has resolved the order.

Every reader yields 0 when the requested range lies outside the buffer, so a malformed or truncated image can never panic a parser. Callers that need to distinguish “field absent” from “field is zero” bounds-check the buffer length up front and surface crate::UfsError::Truncated.

Enums§

Endian
On-disk byte order, resolved from the superblock magic.

Functions§

be_u16
Read a big-endian u16 at off, or 0 if out of range.
be_u32
Read a big-endian u32 at off, or 0 if out of range.
be_u64
Read a big-endian u64 at off, or 0 if out of range.
le_u16
Read a little-endian u16 at off, or 0 if out of range.
le_u32
Read a little-endian u32 at off, or 0 if out of range.
le_u64
Read a little-endian u64 at off, or 0 if out of range.
u8_at
Read a single byte at off, or 0 if out of range.