From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Clark Williams <williams@redhat.com>, bpf <bpf@vger.kernel.org>,
Networking <netdev@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Andrii Nakryiko <andriin@fb.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH 2/2] libbpf: Avoid designated initializers for unnamed union members
Date: Fri, 19 Jul 2019 10:28:14 -0700 [thread overview]
Message-ID: <CAEf4BzbvMyS=Z4Gxmsou5MB1mPiXLM_XKKefOgeWMf=i7NQi5A@mail.gmail.com> (raw)
In-Reply-To: <20190719143407.20847-3-acme@kernel.org>
On Fri, Jul 19, 2019 at 7:34 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> As it fails to build in some systems with:
>
> libbpf.c: In function 'perf_buffer__new':
> libbpf.c:4515: error: unknown field 'sample_period' specified in initializer
> libbpf.c:4516: error: unknown field 'wakeup_events' specified in initializer
>
> Doing as:
>
> attr.sample_period = 1;
>
> I.e. not as a designated initializer makes it build everywhere.
>
> Cc: Andrii Nakryiko <andriin@fb.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Fixes: fb84b8224655 ("libbpf: add perf buffer API")
> Link: https://lkml.kernel.org/n/tip-hnlmch8qit1ieksfppmr32si@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
Thanks, Arnaldo!
Acked-by: Andrii Nakryiko <andriin@fb.com>
> tools/lib/bpf/libbpf.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index b1dec5b1de54..aaca132def74 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -4508,13 +4508,13 @@ struct perf_buffer *perf_buffer__new(int map_fd, size_t page_cnt,
> const struct perf_buffer_opts *opts)
> {
> struct perf_buffer_params p = {};
> - struct perf_event_attr attr = {
> - .config = PERF_COUNT_SW_BPF_OUTPUT,
> - .type = PERF_TYPE_SOFTWARE,
> - .sample_type = PERF_SAMPLE_RAW,
> - .sample_period = 1,
> - .wakeup_events = 1,
> - };
> + struct perf_event_attr attr = { 0, };
> +
> + attr.config = PERF_COUNT_SW_BPF_OUTPUT,
> + attr.type = PERF_TYPE_SOFTWARE;
> + attr.sample_type = PERF_SAMPLE_RAW;
> + attr.sample_period = 1;
> + attr.wakeup_events = 1;
>
> p.attr = &attr;
> p.sample_cb = opts ? opts->sample_cb : NULL;
> --
> 2.21.0
>
next prev parent reply other threads:[~2019-07-19 17:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 14:34 [GIT PULL 0/2] libbpf build fixes Arnaldo Carvalho de Melo
2019-07-19 14:34 ` [PATCH 1/2] libbpf: Fix endianness macro usage for some compilers Arnaldo Carvalho de Melo
2019-07-19 16:25 ` Y Song
2019-07-19 18:30 ` Arnaldo Carvalho de Melo
2019-07-19 14:34 ` [PATCH 2/2] libbpf: Avoid designated initializers for unnamed union members Arnaldo Carvalho de Melo
2019-07-19 17:28 ` Andrii Nakryiko [this message]
2019-07-22 14:23 ` [GIT PULL 0/2] libbpf build fixes Daniel Borkmann
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='CAEf4BzbvMyS=Z4Gxmsou5MB1mPiXLM_XKKefOgeWMf=i7NQi5A@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=williams@redhat.com \
/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).