Re: [PATCH v2 bpf-next] libbpf: Add bpf_obj_get_opts()

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

 



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.



[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