aya-bpf: why BPF_MAP_TYPE_ARRAY doesn't have get_mut() method?
in aya, Array has set() method https://github.com/aya-rs/aya/blob/main/aya/src/maps/array/array.rs#L115-L125
...but aya-bpf Array doesn't. why? https://github.com/aya-rs/aya/blob/main/bpf/aya-bpf/src/maps/array.rs#L19-L60
I thought BPF_MAP_TYPE_ARRAY is mutable from bpf side. am I missing something? https://prototype-kernel.readthedocs.io/en/latest/bpf/ebpf_maps_types.html
It's indeed mutable. I already have a PR adding get_ptr and get_mut_ptr methods. I can also add a set/insert method there.
@vadorovsky looks like we still don't have get_mut?
@vadorovsky looks like we still don't have get_mut?
It has get_ptr_mut as the other map do.
https://github.com/aya-rs/aya/blob/33baf7ef2203a27c69ff640d17fb382fca870c5c/bpf/aya-bpf/src/maps/array.rs#L61-L64
I don't think we have get_mut methods on any map type anymore, but I would have to scroll Discord to search for the reason why we dropped get_mut (returning &mut T) in favor of get_ptr_mut (returning *mut T).
The question is whether we want to have set() method, to give people better API then using raw pointers. I can work on that.