Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the vm-fdt abstractions for v0.2.0 #22

Open
andreeaflorescu opened this issue Jul 7, 2021 · 1 comment
Open

Improve the vm-fdt abstractions for v0.2.0 #22

andreeaflorescu opened this issue Jul 7, 2021 · 1 comment

Comments

@andreeaflorescu
Copy link
Member

We can improve the vm-fdt abstractions after we publish an initial version of the crate so that we do not block the first release.

The current interface was built on purpose to be similar to the libfdt one, but we can optimize it (slightly) for Rust.

Things that can be improved are better abstractions for nodes. For example, we can have the property_* functions on the FdtWriterNode instead of FdtWriter so that we can disallow properties to be added in non valid locations (see #19).

@danielverkamp
Copy link
Collaborator

This sounds like a good idea to me - anything we can do to enforce valid DT output using API design is welcome.

I think it might be possible to use Rust's ownership/lifetime semantics to help with this as well; it would be good to ensure that a FdtWriterNode can only be passed to end_node on the FdtWriter that created it, for example. I tried to add a reference back to FdtWriter in FdtWriterNode when initially writing the Rust API, but I got stuck trying to get right lifetime annotations to make the borrow checker happy; maybe somebody with more Rust experience or more perseverance can help to figure this out.

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

No branches or pull requests

2 participants