Struct fuchsia_zbi::ZbiParser
source · pub struct ZbiParser { /* private fields */ }
Implementations§
source§impl ZbiParser
impl ZbiParser
pub fn align_zbi_item(length: u32) -> Result<u32, ZbiParserError>
pub fn new(vmo: Vmo) -> ZbiParser
sourcepub fn set_store_item(self, zbi_type: ZbiType) -> Self
pub fn set_store_item(self, zbi_type: ZbiType) -> Self
Set a ZBI item type as should be stored. If no item types are set to store, then all known items are stored.
sourcepub fn try_get_item(
&self,
zbi_type_raw: u32,
extra: Option<u32>,
) -> Result<Vec<ZbiResult>, ZbiParserError>
pub fn try_get_item( &self, zbi_type_raw: u32, extra: Option<u32>, ) -> Result<Vec<ZbiResult>, ZbiParserError>
Try and get one stored item type, optionally restricted by the item’s extra. The raw type is passed to allow differentiating between different types of driver metadata.
sourcepub fn try_get_last_matching_item(
&self,
zbi_type_raw: u32,
extra: u32,
) -> Result<ZbiResult, ZbiParserError>
pub fn try_get_last_matching_item( &self, zbi_type_raw: u32, extra: u32, ) -> Result<ZbiResult, ZbiParserError>
Helper function to return the last item matching a given type and extra value. This avoids reading unwanted results from the underlying VMO. The raw type is passed to allow differentiating between different types of driver metadata.
sourcepub fn get_items(
&self,
) -> Result<HashMap<ZbiType, Vec<ZbiResult>>, ZbiParserError>
pub fn get_items( &self, ) -> Result<HashMap<ZbiType, Vec<ZbiResult>>, ZbiParserError>
Get all stored ZBI items.
sourcepub fn release_item(&mut self, zbi_type: ZbiType) -> Result<(), ZbiParserError>
pub fn release_item(&mut self, zbi_type: ZbiType) -> Result<(), ZbiParserError>
Release an item type, zeroing the VMO memory and decommitting the pages if possible.
sourcepub fn parse(self) -> Result<Self, ZbiParserError>
pub fn parse(self) -> Result<Self, ZbiParserError>
Parse a ZBI VMO, storing the offset for each item. If set_store_item
was used, only
those item types will be stored, and the other item types will be zeroed and decommitted.