-
Notifications
You must be signed in to change notification settings - Fork 256
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
Allow maps to be created from user-space #46
Comments
Hi, is this feature ready now? In my usecases, I want to create maps in userspace dynamically. There is a function |
Hiya @loheagn This isn't implemented yet, but I might be able to pick it up here soon! Will post back here with updates. |
So aya::maps::MapData::create takes obj: obj::Map,
name: &str,
btf_fd: Option<BorrowedFd<'_>>, as args meaning the map was defined in bytecode, and I don't think it was designed to be used directly (maybe this function shouldn't actually be public 🤔 ). The API which @dave-tucker describes above allows direct instantiation of Maps with simple data such as K/V types+size along with pin path etc. |
@astoycos I see the differences. Then I may need some workaround. Thanks again! |
It would be nice if maps could be created from user-space before the program is loaded.
This gives more granular control over which maps should (or should not) be pinned than what is available in #45.
As for the API, it's going to be a fairly big change and requires a bit of upfront design.
Typed maps could be able to be instantiated directly, like in the
bpf
crate, but we'd make the syscalls immediately (or in the case of pinning and the map exists, the use that instead).The only complication is that created maps need to be available to
Bpf::load
so we can perform relocations.In which case we'd need to somehow register created maps with the
Bpf
struct and make ensure that all load functions have a reference to&self
The text was updated successfully, but these errors were encountered: