You can use bpf_obj_get() API to get a reference to the pinned map.
It was my understanding that bpf_obj_get was intended to be used as a user space API. I am looking to "open" or obtain a reference to a map in the actual eBPF program that is loaded into the kernel space. My eBPF programs do include linux/bpf.h but not the uapi bpf.h. Can/should you use it in the actual BPF program? Or is there an a different way to achieve this?
I have seen a function called bpf_obj_get_user in linux/bpf.h but I cannot find any documentation on it. It also just returns an unsupported error in my kernel's source code.
static inline int bpf_obj_get_user(const char __user *pathname, int flags)
BPF_ANNOTATE_KV_PAIR is old way to provide map key/value types, mostlyAhh interesting!