Skip to content

feat(overlay): add read-only DT overlay inspection capabilities#57

Open
m4tx wants to merge 4 commits into
mainfrom
overlay-read-only
Open

feat(overlay): add read-only DT overlay inspection capabilities#57
m4tx wants to merge 4 commits into
mainfrom
overlay-read-only

Conversation

@m4tx

@m4tx m4tx commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@m4tx m4tx requested a review from qwandor July 15, 2026 14:00
Comment thread Cargo.toml
default = []
alloc = []
arrayvec07 = ["dep:arrayvec"]
overlay = ["write"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does read-only inspection of an overlay require the write feature, and hence alloc?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually for that matter, why does it need a separate feature at all? It doesn't add any extra dependencies, so why not enable it always?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, at least alloc is needed for the use of String to provide more useful errors. The actual feature of applying overlays (in #60) is implemented for DeviceTree only (for now), so it's a bit forward-looking - but the point is, in the final form, write will be needed anyways. I can change this to alloc in this PR, though.

Comment thread src/overlay.rs
//! overlay inspection works uniformly across both read-only (`FdtNode`) and
//! in-memory (`DeviceTreeNode`) representations.

#![allow(unused)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

@m4tx m4tx Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry - I should've made it clear that this is part of a bigger chain that is split to make the reviewing a bit easier (maybe eventually we'll get stacked PRs in GitHub, but for this needs to do). This read only part is later used in #60.

Comment thread src/error.rs

/// An error that can occur when inspecting or applying a device tree overlay.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Error)]
#[cfg(feature = "write")]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why write rather than overlay?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - yes, this should be overlay.

Comment thread src/overlay.rs

/// Typed wrapper for a device tree overlay root node.
#[derive(Debug, Clone, Copy)]
pub(crate) struct Overlay<N> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why this shouldn't be public? I guess it's not super common, but someone might want to use this crate to display an overlay in some sort of debug UI or something.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the main reason could be that we promise some API that people might start relying on, on later on we might change or remove it. If you think it could be useful, though, I guess it's fine to make it public.

Base automatically changed from add-child-mut to main July 16, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants