bpf2go: Generate constant names for maps, programs, and variables#1860
bpf2go: Generate constant names for maps, programs, and variables#1860ti-mo merged 1 commit intocilium:mainfrom
Conversation
76b761a to
eafdbd2
Compare
|
What is the benefit of turning strings into constants? Some type of compile time error I guess? My gut feeling is against adding this: usually names for maps and programs don't change that often, and in my experience are used only in a few places. Maybe you can explain why you want to use bpf2go while still going via collection and collectionspec instead of the generated types? |
IMO precisely to get the best of both worlds: compile-time codegen and ELF embedding + 'fearless' access of e.g. |
This commit emits constants for BPF object names for safe lookups in Collection(Spec).Maps/Programs/Variables. Signed-off-by: Matthías Á. Jónsson <matthiasasgeir@gmail.com> Co-authored-by: Timo Beckers <timo@isovalent.com>
eafdbd2 to
a369ac8
Compare
|
@mattijons Thanks for working on this, I've removed most of the fluff around the generated code and shortened the intermediate 'prefixes' to Map/Prog/Var. |
Idea #1833.
Add bpf2go functionality that generates constant string names for maps, programs, and variables. Useful when working with
ebpf.Collectionandebpf.CollectionSpec.Example output from
TestObjects: