Struct EcHeader
pub struct EcHeader {
pub erase_count: u64,
pub vid_header_offset: u32,
pub data_offset: u32,
pub image_seq: u32,
}Expand description
Erase counter header at the start of every used erase block.
Fields§
§erase_count: u64How often the block was erased.
vid_header_offset: u32Offset of the super::VidHeader in the block.
data_offset: u32Offset of the data in the block.
image_seq: u32Number that all blocks of one UBI image share.
Implementations§
§impl EcHeader
impl EcHeader
pub fn parse(data: &[u8]) -> Result<Self, FormatError>
pub fn parse(data: &[u8]) -> Result<Self, FormatError>
Parses the header at the start of data.
§Errors
Returns an error if data is too short or a field has a value that the
kernel rejects. It doesn’t check the offsets, because they depend on
the block. super::ImageReader checks them.
pub fn to_bytes(&self) -> [u8; 64]
pub fn to_bytes(&self) -> [u8; 64]
Returns the header as stored on flash, with version 1 and its CRC.
EcHeader::parse rejects an erase counter above 0x7FFFFFFF, so keep
EcHeader::erase_count below that.
Trait Implementations§
impl Copy for EcHeader
impl Eq for EcHeader
impl StructuralPartialEq for EcHeader
Auto Trait Implementations§
impl Freeze for EcHeader
impl RefUnwindSafe for EcHeader
impl Send for EcHeader
impl Sync for EcHeader
impl Unpin for EcHeader
impl UnsafeUnpin for EcHeader
impl UnwindSafe for EcHeader
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