-
Notifications
You must be signed in to change notification settings - Fork 309
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
aya: Allows sharing Map between different eBPFs #540
base: main
Are you sure you want to change the base?
Conversation
❌ Deploy Preview for aya-rs-docs failed.Built without sensitive environment variables
|
f624879
to
a7f2ac9
Compare
I think that conceptually we want this API, but not in the current form. My first thought is that "shared" isn't the best name: maybe the map isn't shared, I just happen to have it loaded from a previous operation or something, or maybe I created it in some special way with custom flags etc. Maybe The bigger thing is that I'm not sure we should be exposing Is there a reason why we can't pass |
Yep that makes sense. So |
I don't think it would take a hashmap - say I have only 1 map, why would I be forced to create a hashmap? set_global also doesn't work with hashmaps, you do set_global("Foo", v).set_global("BAR", t) and I think that's the better API. I'm also not sure wrt ownership. I was making your opposite assumption: you give the loader the map and you transfer ownership to the loader. It's not clear to me why you'd want to retain ownership and it complicates the implementation of |
fc52c6a
to
a0613a3
Compare
a0613a3
to
6ecab2d
Compare
Ok so here's the deal, you can get a map by:
To use that map again:
In all of those cases, you OWN the map, so this API, IMHO, would want a Borrow. Reason being something like this: let logs_map = PerfEventArray::new(); // just assume this is a thing for now....
let first_prog = BpfLoader::new().map("AYA_LOG", logs_map).load([]);
let second_prog = BpfLoader::new().map("AYA_LOG", logs_map).load([]); Essentially I create a map I want shared across multiple programs... |
Allows to share maps between eBPFs without relying on pinned maps.
6ecab2d
to
a04d836
Compare
@marysaka, this pull request is now in conflict and requires a rebase. |
@marysaka, this pull request is now in conflict and requires a rebase. |
@marysaka, this pull request is now in conflict and requires a rebase. |
Allows to share maps between eBPFs without relying on pinned maps.
This change is