Re: [PATCH bpf-next v8 1/1] bpf, docs: document BPF_MAP_TYPE_ARRAY

Maryam Tahhan
2022-10-24T23:17:58Z

On 21/10/2022 15:22, Donald Hunter wrote:
> |+.. code-block:: c + + int initialize_array(int fd) + { + int ncpus =
> libbpf_num_possible_cpus(); + long values[ncpus]; + __u32 i, j; + int
> ret; + + for (i = 0; i < 256 ; i++) { + for (j = 0; j < ncpus; j++) +
> values[j] = i; + ret = bpf_map_update_elem(fd, &i, &values, BPF_ANY); +
> if (ret < 0) + return ret; + } + + return ret;|

Reviewed-by: Maryam Tahhan <mtahhan@redhat.com>