pub struct Fdt { /* private fields */ }
Expand description
§Fdt
A wrapper for an FDT
binary.
This is the first object to instantiate to manipulate FDT binaries.
Implementations§
Source§impl Fdt
impl Fdt
Sourcepub fn new(fdt: Box<[u8]>) -> Result<Fdt, Error>
pub fn new(fdt: Box<[u8]>) -> Result<Fdt, Error>
Create a new Fdt
from its binary representation.
The binary is not copied.
Sourcepub fn path_offset(&self, path: &str) -> Result<Offset, Error>
pub fn path_offset(&self, path: &str) -> Result<Offset, Error>
Get the offset of a node, given its path.
Sourcepub fn first_property_offset(&self, nodeoffset: Offset) -> Result<Offset, Error>
pub fn first_property_offset(&self, nodeoffset: Offset) -> Result<Offset, Error>
Get the first property of a node, given its offset.
This is mostly useful to iterate over the properties of a node.
Please check FdtNode::properties_iter
and the documentation of crate::FdtPropertyIter
if you are looking for a property iterator.
Sourcepub fn first_property<'fdt>(
&'fdt self,
node: &FdtNode<'fdt>,
) -> Result<Option<FdtProperty<'fdt>>, Error>
pub fn first_property<'fdt>( &'fdt self, node: &FdtNode<'fdt>, ) -> Result<Option<FdtProperty<'fdt>>, Error>
Get the first property of an FdtNode
.
This is mostly useful to iterate over the properties of a node.
Please check FdtNode::properties_iter
and the documentation of crate::FdtPropertyIter
if you are looking for a property iterator.
Sourcepub fn next_property_offset(&self, offset: Offset) -> Result<Offset, Error>
pub fn next_property_offset(&self, offset: Offset) -> Result<Offset, Error>
Get the next property of a node, given its offset.
This is mostly useful to iterate over the properties of a node.
Please check FdtNode::properties_iter
and the documentation of crate::FdtPropertyIter
if you are looking for a property iterator.
Sourcepub fn next_property<'fdt>(
&'fdt self,
property: &FdtProperty<'fdt>,
) -> Result<Option<FdtProperty<'fdt>>, Error>
pub fn next_property<'fdt>( &'fdt self, property: &FdtProperty<'fdt>, ) -> Result<Option<FdtProperty<'fdt>>, Error>
Get the next property of an FdtNode
.
This is mostly useful to iterate over the properties of a node.
Please check FdtNode::properties_iter
and the documentation of crate::FdtPropertyIter
if you are looking for a property iterator.
Sourcepub fn first_subnode_offset(&self, offset: Offset) -> Result<Offset, Error>
pub fn first_subnode_offset(&self, offset: Offset) -> Result<Offset, Error>
Get the first subnode of a node, given its offset.
This is mostly useful to iterate over the subnodes of a node.
Please check FdtNode::subnodes_iter
and the documentation of crate::FdtNodeIter
if you are looking for a subnode iterator.
Sourcepub fn first_subnode<'fdt>(
&'fdt self,
parent_node: &FdtNode<'fdt>,
) -> Result<Option<FdtNode<'fdt>>, Error>
pub fn first_subnode<'fdt>( &'fdt self, parent_node: &FdtNode<'fdt>, ) -> Result<Option<FdtNode<'fdt>>, Error>
Get the first subnode of a FdtNode
.
This is mostly useful to iterate over the subnodes of a node.
Please check FdtNode::subnodes_iter
and the documentation of crate::FdtNodeIter
if you are looking for a subnode iterator.
Sourcepub fn next_subnode_offset(&self, offset: Offset) -> Result<Offset, Error>
pub fn next_subnode_offset(&self, offset: Offset) -> Result<Offset, Error>
Get the next subnode of a node, given its offset.
This is mostly useful to iterate over the subnodes of a node.
Please check FdtNode::subnodes_iter
and the documentation of crate::FdtNodeIter
if you are looking for a subnode iterator.
Sourcepub fn next_subnode<'fdt>(
&'fdt self,
previous_node: &FdtNode<'fdt>,
) -> Result<Option<FdtNode<'fdt>>, Error>
pub fn next_subnode<'fdt>( &'fdt self, previous_node: &FdtNode<'fdt>, ) -> Result<Option<FdtNode<'fdt>>, Error>
Get the next subnode of a FdtNode
.
This is mostly useful to iterate over the subnodes of a node.
Please check FdtNode::subnodes_iter
and the documentation of crate::FdtNodeIter
if you are looking for a subnode iterator.
Sourcepub fn get_node_by_offset<'fdt>(
&'fdt self,
nodeoffset: Offset,
) -> Result<FdtNode<'fdt>, Error>
pub fn get_node_by_offset<'fdt>( &'fdt self, nodeoffset: Offset, ) -> Result<FdtNode<'fdt>, Error>
Sourcepub fn get_property_by_offset<'fdt>(
&'fdt self,
offset: Offset,
) -> Result<FdtProperty<'fdt>, Error>
pub fn get_property_by_offset<'fdt>( &'fdt self, offset: Offset, ) -> Result<FdtProperty<'fdt>, Error>
Get an FdtProperty
from its offset in the Fdt
Sourcepub fn get_property<'fdt>(
&'fdt self,
node: &FdtNode<'fdt>,
property_name: &str,
) -> Result<FdtProperty<'fdt>, Error>
pub fn get_property<'fdt>( &'fdt self, node: &FdtNode<'fdt>, property_name: &str, ) -> Result<FdtProperty<'fdt>, Error>
Get an FdtProperty
given its parent node and its name.
Sourcepub fn get_phandle<'fdt>(
&'fdt self,
node: &FdtNode<'fdt>,
) -> Result<Phandle, Error>
pub fn get_phandle<'fdt>( &'fdt self, node: &FdtNode<'fdt>, ) -> Result<Phandle, Error>
Get the phandle of a given FdtNode
.
Returns Error::BadPhandle
if not phandle property is attached to the input node
Sourcepub fn is_compatible<'fdt>(
&'fdt self,
node: &FdtNode<'fdt>,
compatible: &str,
) -> Result<bool, Error>
pub fn is_compatible<'fdt>( &'fdt self, node: &FdtNode<'fdt>, compatible: &str, ) -> Result<bool, Error>
Determines if the input compatible string matches with the ‘compatible’ property of a given node.
Returns Error::NotFound
if not compatible property is attached to the input node
Sourcepub fn get_node<'fdt>(&'fdt self, path: &str) -> Result<FdtNode<'fdt>, Error>
pub fn get_node<'fdt>(&'fdt self, path: &str) -> Result<FdtNode<'fdt>, Error>
Get the FdtNode
associated with the input path.
Sourcepub fn get_node_by_phandle<'fdt>(
&'fdt self,
phandle: &Phandle,
) -> Result<FdtNode<'fdt>, Error>
pub fn get_node_by_phandle<'fdt>( &'fdt self, phandle: &Phandle, ) -> Result<FdtNode<'fdt>, Error>
Get the FdtNode
associated with the given phandle.
Sourcepub fn as_path<'fdt>(
&'fdt self,
node_ref: &'fdt FdtNodeRef,
) -> Result<&'fdt str, Error>
pub fn as_path<'fdt>( &'fdt self, node_ref: &'fdt FdtNodeRef, ) -> Result<&'fdt str, Error>
Get the full path of an FdtNodeRef
.
It is particularly useful for parsing symbol tables in the Fdt
.