Attribute Macro redbpf_macros::map [−][src]
#[map]
Expand description
Attribute macro that must be used when creating eBPF maps.
The default #[map]
places the map into a section of the resulting
ELF binary called maps/<item_name>
.
If you wish to set the section name manually for BPF programs that
require strict naming conventions use #[map(link_section = "foo")]
which place the map into a section called foo
.
Example
// Will be linked into the ELF in the section 'maps/counts'
#[map]
static mut counts: PerfMap<u64> = PerfMap::with_max_entries(10240);
// Will be linked into the ELF in the section 'dns_queries'
#[map(link_section = "dns_queries")]
static mut queries: PerfMap<Query> = PerfMap::with_max_entries(1024);
struct Query {
// ...
}