8000 Consider adding `FdtNode::descendants()` · Issue #114 · google/dtoolkit · GitHub
[go: up one dir, main page]

Skip to content

Consider adding FdtNode::descendants() #114

Open

Description

@m4tx

It could be useful to have a method that returns a depth-first iterator over all descendants in a node. Other libraries seem to support it, e.g. https://docs.rs/flat_device_tree/latest/flat_device_tree/struct.Fdt.html#method.all_nodes , and it would be nice as using children() results in O(n²) traversal time (#102) which is not fixable by DTB design.

One problem is that our FdtNode stores parent's address/size-cells which means we would need to keep the entire ancestor chain when iterating. Since fdt is no-alloc parser, we'd have to work around this somehow - one idea would be to enforce a maximum depth (64 seems to be a sensible default used by other libraries, including libfdt AFAIR) and return an error if it's been exceeded. The maximum depth could even be configurable by using a const generic.

It would be good to figure out some specific use cases for this and perhaps implement it if the use cases are compelling.

See #108 (review) for more context.

Activity

  1. added
    enhancementNew feature or request
    questionFurther information is requested
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0