bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Andrii Nakryiko <andriin@fb.com>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v2 bpf-next 2/3] libbpf: make global data internal arrays mmap()-able, if possible
Date: Mon, 11 Nov 2019 18:11:21 -0800	[thread overview]
Message-ID: <CAEf4Bzb_49EvfBP0P-jo5=Rg9cP26_hSCztK4HcUMHD-4fPA=g@mail.gmail.com> (raw)
In-Reply-To: <20191111104057.0a9dfd84@cakuba>

On Mon, Nov 11, 2019 at 10:41 AM Jakub Kicinski
<jakub.kicinski@netronome.com> 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;
> > +}
>

  reply	other threads:[~2019-11-12  2:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-09  8:06 [PATCH v2 bpf-next 0/3] Add support for memory-mapping BPF array maps Andrii Nakryiko
2019-11-09  8:06 ` [PATCH v2 bpf-next 1/3] bpf: add mmap() support for BPF_MAP_TYPE_ARRAY Andrii Nakryiko
2019-11-11 16:40   ` Song Liu
2019-11-11 18:37   ` Jakub Kicinski
2019-11-12  2:06     ` Andrii Nakryiko
2019-11-12 19:17       ` Jakub Kicinski
2019-11-12 22:03         ` Andrii Nakryiko
2019-11-12 22:38           ` Jakub Kicinski
2019-11-13  3:19             ` Andrii Nakryiko
2019-11-11 18:39   ` Jakub Kicinski
2019-11-12  2:01     ` Andrii Nakryiko
2019-11-09  8:06 ` [PATCH v2 bpf-next 2/3] libbpf: make global data internal arrays mmap()-able, if possible Andrii Nakryiko
2019-11-11 18:40   ` Jakub Kicinski
2019-11-12  2:11     ` Andrii Nakryiko [this message]
2019-11-09  8:06 ` [PATCH v2 bpf-next 3/3] selftests/bpf: add BPF_TYPE_MAP_ARRAY mmap() tests Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEf4Bzb_49EvfBP0P-jo5=Rg9cP26_hSCztK4HcUMHD-4fPA=g@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).