-
Notifications
You must be signed in to change notification settings - Fork 286
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
Remove MapData::pinned. Make MapData::pin public #790
Conversation
✅ Deploy Preview for aya-rs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hey @alessandrod, this pull request changes the Aya Public API and requires your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'll let this merge before continuing on #783 Thanks!
83c334a
to
4f4b6b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @alessandrod and @dave-tucker)
-- commits
line 4 at r1:
multiple
Code quote:
mutliple
-- commits
line 12 at r2:
in the PR description you write
The second change makes MapData::pin part of the public API.
This is to solve a use-case where a user (in this case bpfd) may want to:
MapData::from_pin
to open a pinned map from bpffsMapData::pin
to pin that object into another bpffsBoth operations should be easily accomplished without needing to cast a
MapData
into a concrete Map type - e.g aya::maps::HashMap.
Can this rationale be in the commit message too?
aya/src/maps/mod.rs
line 559 at r1 (raw file):
pub(crate) fn pin<P: AsRef<Path>>(&mut self, name: &str, path: P) -> Result<(), PinError> { use std::os::unix::ffi::OsStrExt as _;
nit: keep this blank line?
aya/src/maps/mod.rs
line 572 at r2 (raw file):
pub fn pin<P: AsRef<Path>>(&mut self, path: P) -> Result<(), PinError> { use std::os::unix::ffi::OsStrExt as _; let path = path.as_ref();
nit: keep this in its old position? or is there a reason it moved?
BPF objects can be pinned multiple times, to multiple different places. Tracking whether or not a map is pinned in a bool is therefore not sufficient. We could track this in a HashSet<PathBuf>, but there is really no reason to track it at all. Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
This is to solve a use-case where a user (in this case bpfd) may want to: - MapData::from_pin to open a pinned map from bpffs - MapData::pin to pin that object into another bpffs Both operations should be easily accomplished without needing to cast a MapData into a concrete Map type - e.g aya::maps::HashMap. Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
4f4b6b1
to
938f979
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments addressed. Thanks.
Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @alessandrod and @tamird)
Previously, tamird (Tamir Duberstein) wrote…
multiple
Done.
Previously, tamird (Tamir Duberstein) wrote…
in the PR description you write
The second change makes MapData::pin part of the public API.
This is to solve a use-case where a user (in this case bpfd) may want to:
MapData::from_pin
to open a pinned map from bpffsMapData::pin
to pin that object into another bpffsBoth operations should be easily accomplished without needing to cast a
MapData
into a concrete Map type - e.g aya::maps::HashMap.Can this rationale be in the commit message too?
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @alessandrod)
This is 2 small changes.
The first removes tracking of whether or not a Map has been pinned from MapData.
This is unnecessary since Maps may be pinned multiple times to multiple locations on a BPF filesystem.
The second change makes MapData::pin part of the public API.
This is to solve a use-case where a user (in this case bpfd) may want to:
MapData::from_pin
to open a pinned map from bpffsMapData::pin
to pin that object into another bpffsBoth operations should be easily accomplished without needing to cast a
MapData
into a concrete Map type - e.g aya::maps::HashMap.This change is