Re: [PATCH v2 bpf-next 2/3] libbpf: make global data internal arrays mmap()-able, if possible

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

 



On Mon, Nov 11, 2019 at 10:41 AM Jakub Kicinski
<jakub.kicinski@xxxxxxxxxxxxx> wrote:
>
> On Sat, 9 Nov 2019 00:06:31 -0800, Andrii Nakryiko wrote:
> > +static int bpf_object__probe_array_mmap(struct bpf_object *obj)
> > +{
> > +     struct bpf_create_map_attr attr = {
> > +             .map_type = BPF_MAP_TYPE_ARRAY,
> > +             .map_flags = BPF_F_MMAPABLE,
> > +             .key_size = sizeof(int),
> > +             .value_size = sizeof(int),
> > +             .max_entries = 1,
> > +     };
> > +     int fd = bpf_create_map_xattr(&attr);
> > +
> > +     if (fd >= 0) {
>
> The point of the empty line between variable declarations and code in
> the Linux coding style is to provide a visual separation between
> variables and code.
>
> If you call a complex function in variable init and then check for
> errors in the code that really breaks that principle.

I'll split declaration and initialization, no problem

>
> > +             obj->caps.array_mmap = 1;
> > +             close(fd);
> > +             return 1;
> > +     }
> > +
> > +     return 0;
> > +}
>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux