Struct VolumeRecord
pub struct VolumeRecord<'a> {
pub reserved_blocks: u32,
pub alignment: u32,
pub data_pad: u32,
pub kind: VolumeKind,
pub update_marker: bool,
pub name: &'a [u8],
pub autoresize: bool,
pub skip_crc_check: bool,
}Expand description
Record of a volume in the volume table.
The volume table is stored in each of the two logical eraseblocks of the
layout volume, LAYOUT_VOLUME_ID. The record borrows its name from the
parsed data.
Fields§
§reserved_blocks: u32Erase blocks reserved for the volume.
alignment: u32Alignment of the volume.
data_pad: u32Bytes at the end of each block that alignment leaves unused.
kind: VolumeKindType of the volume.
update_marker: boolWhether an update of the volume didn’t finish.
name: &'a [u8]Name of the volume. The kernel allows any bytes except NUL, so it may not be UTF-8.
autoresize: boolWhether UBI grows the volume to fill the device on the first attach.
skip_crc_check: boolWhether UBI skips the CRC check when it reads a static volume. Older kernels, such as 3.18, ignore it.
Implementations§
§impl<'a> VolumeRecord<'a>
impl<'a> VolumeRecord<'a>
pub fn parse(data: &'a [u8]) -> Result<Option<Self>, FormatError>
pub fn parse(data: &'a [u8]) -> Result<Option<Self>, FormatError>
Parses the record at the start of data.
Returns None for an unused record. It applies the checks of the
kernel’s vtbl_check that only look at this record.
VolumeRecord::read_table also checks the record against the table
and the size of the logical eraseblock.
§Errors
Returns an error if data is too short, the CRC is wrong, an unused
record isn’t all zeros, or a field has a value that the kernel
rejects.
pub fn read_table(
data: &'a [u8],
leb_size: u32,
) -> impl Iterator<Item = Result<(u32, Self), FormatError>> + 'a
pub fn read_table( data: &'a [u8], leb_size: u32, ) -> impl Iterator<Item = Result<(u32, Self), FormatError>> + 'a
Returns the used records of a volume table with the ID of their volume.
data is the data of a logical eraseblock of the layout volume, and
leb_size is the size of a logical eraseblock, see
super::ImageBlock::leb_size. Besides VolumeRecord::parse, it
checks the alignment against leb_size, that no two volumes share a
name and that only one volume has the autoresize flag. The kernel also
checks the alignment against the minimum I/O size and the reserved
blocks against the device, which a table alone can’t know.
fn check_geometry(&self, leb_size: u32) -> Result<(), FormatError>
fn check_geometry(&self, leb_size: u32) -> Result<(), FormatError>
Checks the alignment against the size of a logical eraseblock.
Trait Implementations§
§impl<'a> Clone for VolumeRecord<'a>
impl<'a> Clone for VolumeRecord<'a>
§fn clone(&self) -> VolumeRecord<'a>
fn clone(&self) -> VolumeRecord<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more