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

Fix up some mutability warts on datasec skeleton accessors (take #2) #614

Merged
merged 5 commits into from
Nov 21, 2023
Merged

Fix up some mutability warts on datasec skeleton accessors (take #2) #614

merged 5 commits into from
Nov 21, 2023

Conversation

danielocfb
Copy link
Collaborator

Respin of #611.

When we create a skeleton with a getter for an immutable map, we should
be able to use a non-exclusive receiver (&self) instead of an exclusive
one (&mut self). Using the latter unconditionally can be the cause of
unnecessary borrow conflicts.

Refs: #606

Signed-off-by: Daniel Müller <[email protected]>
There is not too much of a point in passing in the desired mutability to
gen_skel_prog_getter() when all call sites invoke it with both true and
false.
Move the logic for dealing with mutability into the function itself to
shield callers from the need to care.

Signed-off-by: Daniel Müller <[email protected]>
There is not too much of a point in passing in the desired mutability to
gen_skel_map_getters() when all call sites invoke it with both true and
false.
Move the logic for dealing with mutability into the function itself to
shield callers from the need to care.

Signed-off-by: Daniel Müller <[email protected]>
There is not too much of a point in passing in the desired mutability to
gen_skel_map_defs() when all call sites invoke it with both true and
false.
Move the logic for dealing with mutability into the function itself to
shield callers from the need to care.

Signed-off-by: Daniel Müller <[email protected]>
It's not particularly user friendly to only have exclusive shared
datasec accessor variants available, as that can lead to unnecessary
borrow conflicts.
With this change we revamp the generation logic to generate shared and
exclusive accessors when possible.

Refs: #606

Signed-off-by: Daniel Müller <[email protected]>
@danielocfb danielocfb merged commit 855eb84 into libbpf:master Nov 21, 2023
10 checks passed
@danielocfb danielocfb deleted the topic/cargo-mut-2 branch November 21, 2023 21:55
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