pub unsafe extern "C" fn fdt_node_offset_by_prop_value(
fdt: *const c_void,
startoffset: c_int,
propname: *const c_char,
propval: *const c_void,
proplen: c_int,
) -> c_intExpand description
fdt_node_offset_by_prop_value - find nodes with a given property value @fdt: pointer to the device tree blob @startoffset: only find nodes after this offset @propname: property name to check @propval: property value to search for @proplen: length of the value in propval
fdt_node_offset_by_prop_value() returns the offset of the first node after startoffset, which has a property named propname whose value is of length proplen and has value equal to propval; or if startoffset is -1, the very first such node in the tree.
To iterate through all nodes matching the criterion, the following idiom can be used: offset = fdt_node_offset_by_prop_value(fdt, -1, propname, propval, proplen); while (offset != -FDT_ERR_NOTFOUND) { // other code here offset = fdt_node_offset_by_prop_value(fdt, offset, propname, propval, proplen); }
Note the -1 in the first call to the function, if 0 is used here instead, the function will never locate the root node, even if it matches the criterion.
returns: structure block offset of the located node (>= 0, >startoffset), on success -FDT_ERR_NOTFOUND, no node matching the criterion exists in the tree after startoffset -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings