[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YuRA9Tmy6YNdM7Ih@google.com>
Date: Fri, 29 Jul 2022 20:20:05 +0000
From: Joe Burton <jevburton@...gle.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Joe Burton <jevburton.kernel@...il.com>,
Andrii Nakryiko <andrii@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
bpf <bpf@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 bpf-next] libbpf: Add bpf_obj_get_opts()
On Wed, Jul 27, 2022 at 04:02:43PM -0700, Andrii Nakryiko wrote:
Applied both of these in v3, which I'll send out in a moment. Thanks for
the feedback!
> > int bpf_obj_get(const char *pathname)
> > +{
> > + LIBBPF_OPTS(bpf_obj_get_opts, opts);
>
> if you were doing it this way, here should be an empty line. But
> really you can/should just pass NULL instead of opts in this case.
> > +struct bpf_obj_get_opts {
> > + size_t sz; /* size of this struct for forward/backward compatibility */
> > +
> > + __u32 file_flags;
>
> please add size_t :0; to avoid non-zero-initialized padding (we do it
> in a lot of other opts structs)
>
TIL about this trick. Very clever.
Powered by blists - more mailing lists