Re: [PATCH bpf-next v1] docs/bpf: Document BPF map types QUEUE and STACK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> writes:

> On Fri, Nov 4, 2022 at 10:21 AM Donald Hunter <donald.hunter@xxxxxxxxx> wrote:
>>
>> +
>> +Userspace
>> +---------
>> +
>> +This snippet shows how to use libbpf to create a queue from userspace:
>
> I'd prefer "how to use libbpf's low-level API to create a queue".
> Because ideally people use the declarative way shown above, which is
> also "use libbpf to create", but is simpler and preserves all the BTF
> type information (if map supports it).

I'll incorporate this and also see if I can reword to highlight the
preferred declarative approach.

>> +
>> +.. code-block:: c
>> +
>> +    int create_queue()
>> +    {
>> +            return bpf_map_create(BPF_MAP_TYPE_QUEUE,
>> +                                  "sample_queue", /* name */
>> +                                  0,              /* key size, must be zero */
>> +                                  sizeof(__u32),  /* value size */
>> +                                  10,             /* max entries */
>> +                                  0);             /* create options */
>
> NULL, it's a pointer

Good catch, thanks!



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux