Skip to content

libbpf-rs: Add helper APIs and tests for OpenMap#1385

Merged
d-e-s-o merged 1 commit intolibbpf:masterfrom
fkcrazy001:smaster
Apr 24, 2026
Merged

libbpf-rs: Add helper APIs and tests for OpenMap#1385
d-e-s-o merged 1 commit intolibbpf:masterfrom
fkcrazy001:smaster

Conversation

@fkcrazy001
Copy link
Copy Markdown
Contributor

Add apis key_size, value_size, map_flags and numa_node for OpenMap , along with tests covering these APIs.
For more details, see #1382

@fkcrazy001 fkcrazy001 changed the title Add helper APIs and tests for OpenMap libbpf-rs: Add helper APIs and tests for OpenMap Apr 23, 2026
@fkcrazy001
Copy link
Copy Markdown
Contributor Author

weird, success on my fork: https://github.com/fkcrazy001/libbpf-rs/actions/runs/24815386819

Copy link
Copy Markdown
Collaborator

@d-e-s-o d-e-s-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine overall. Can you please squash into a single commit, though?

Comment thread libbpf-rs/tests/test.rs Outdated
Comment thread libbpf-rs/tests/test.rs
assert_eq!(start.map_flags(), 0);
assert_eq!(start.map_type(), MapType::Hash);
assert_eq!(start.max_entries(), 10240);
assert_eq!(start.numa_node(), 0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NUMA node seems bogus to me. Is there any guarantee it will be 0? If not let's leave it out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref to doc of bpf_map__numa_node: https://docs.ebpf.io/ebpf-library/libbpf/userspace/bpf_map__numa_node/ .
And it says "NUMA node the map is or will be created on. Or 0 if no preference is given". So I think 0 should be expected for this map

@fkcrazy001 fkcrazy001 force-pushed the smaster branch 2 times, most recently from 47c8241 to edf28ac Compare April 24, 2026 02:56
for more details: ref to libbpf#1382

Signed-off-by: Panda Jiang <3160104094@zju.edu.cn>

add test for openMapImpl

Signed-off-by: Panda Jiang <3160104094@zju.edu.cn>

fmt fix

Signed-off-by: Panda Jiang <3160104094@zju.edu.cn>

Apply suggestion from @d-e-s-o

Co-authored-by: Daniel Müller <d-e-s-o@users.noreply.github.com>
@d-e-s-o d-e-s-o merged commit 525b60a into libbpf:master Apr 24, 2026
18 checks passed
d-e-s-o added a commit that referenced this pull request Apr 24, 2026
Add a CHANGELOG entry for pull request #1385, which added basic getters
to the OpenMap and OpenMapMut types.

Signed-off-by: Daniel Müller <deso@posteo.net>
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