Re: [PATCH v4 bpf-next 18/22] bpftool: Use syscall/loader program in "prog load" and "gen skeleton" command.

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

 



On Wed, May 12, 2021 at 11:44 AM Alexei Starovoitov <ast@xxxxxx> wrote:
>
> On 5/11/21 9:17 PM, Andrii Nakryiko wrote:
> >> +       bpf_object__for_each_program(prog, obj) {
> >> +               printf("\tif (skel->links.%1$s_fd > 0) close(skel->links.%1$s_fd);\n",
> >> +                      bpf_program__name(prog));
> >
> > you use bpf_program__name(prog) in so many place that it will be much
> > simpler if you have a dedicated variable for it
>
> Every time it's in the different loop over all progs.

ok, it's no big deal, using variable is always an option to shorten
printf if necessary

>
> >> +       obj = bpf_object__open_file(file, &open_opts);
> >> +       if (IS_ERR_OR_NULL(obj)) {
> >
> > please use libbpf_get_error() instead of IS_ERR_OR_NULL()
>
> That was copy-pasted from another place in the same file.
> Fixed both and the rest of comments.

The reason to use libbpf_get_error() is because we'll be changing how
error is reported for APIs like bpf_object__open_file and
libbpf_get_error() will handle that transition automatically, so not
having IS_ERR or IS_ERR_OR_NULL reduces amount of clean up we'll need
to do.



[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