Skip to content

Improve ergonomics and re-add mutable interface & ffi - #1

Merged
yuyuyureka merged 13 commits into
mainfrom
feature/extend
Dec 3, 2026
Merged

yuyuyureka merged 13 commits into
mainfrom
feature/extend

Conversation

@yuyuyureka

@yuyuyureka yuyuyureka commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Please check all boxes that apply:

  • This code was developed in accordance with the Asahi Linux Copyright Policy
  • I have not used generative AI/LLMs to develop this code, in accordance with the Asahi Linux LLM Policy
  • I have certified the above by adding a Signed-off-by: trailer to every commit

All boxes must be checked before your pull request can be reviewed.

@yuyuyureka
yuyuyureka force-pushed the feature/extend branch 2 times, most recently from d146341 to a8d5bed Compare December 2, 2026 01:45
@yuyuyureka
yuyuyureka marked this pull request as ready for review December 2, 2026 01:49
@yuyuyureka
yuyuyureka force-pushed the feature/extend branch 3 times, most recently from a68e845 to 134b8a4 Compare December 2, 2026 12:07
@yuyuyureka yuyuyureka changed the title Improve ergonomics and re-add ffi Improve ergonomics and re-add mutable interface & ffi Dec 2, 2026
By making ADTProperty packed, we can derive IntoBytes despite the flexible array member.

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
1. trace is stored as offsets, which is both easier for the future ffi and mut interfaces
2. node_path_trace() returns a handle on which .get_reg() can be chained

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Instead of each handle storing a full view of the ADT for navigation,
only store everything after its header (which is sufficient to navigate
to properties, subnodes and next siblings. This is a refactoring in
preparation for the mut interface.

Additionally, this factors out node_from_slice and property_from_slice
and their respective checks, as these are now required both in the ADT
container as well as the ADTNode, and the checks will be re-used by the
mut versions.

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
This allows navigating the ADT with mutable borrows (`root_mut()` /
`node_path_mut()`, and then mutating properties, provided the structure
of the device tree and length of properties stays the same.

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
It's not easy to restore the alignment guarantee, so use get_cells_u8 on
the byte slice

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Implement all C ffi functions used by m1n1.

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
This allows navigating template ADTs successfully

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
There was otherwise no-ffi way to obtain an &mut ADT

Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
@yuyuyureka
yuyuyureka merged commit 9d4f189 into main Dec 3, 2026
3 checks passed
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.

1 participant