Re: [PATCH bpf-next v3] bpftool: use only nftw for file tree parsing

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

 



On Mon, 20 Jul 2020 at 01:13, Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote:
>
> On 17/07/2020 23:55, Tony Ambardar wrote:
> > The bpftool sources include code to walk file trees, but use multiple
> > frameworks to do so: nftw and fts. While nftw conforms to POSIX/SUSv3 and
> > is widely available, fts is not conformant and less common, especially on
> > non-glibc systems. The inconsistent framework usage hampers maintenance
> > and portability of bpftool, in particular for embedded systems.
> >
> > Standardize code usage by rewriting one fts-based function to use nftw and
> > clean up some related function warnings by extending use of "const char *"
> > arguments. This change helps in building bpftool against musl for OpenWrt.

[...]

> >  int build_pinned_obj_table(struct pinned_obj_table *tab,
> >                          enum bpf_obj_type type)
> >  {
>
> [...]
>
> >       while ((mntent = getmntent(mntfile))) {
>
> [...]
>
> > -             while ((ftse = fts_read(fts))) {
>
> [...]
>
> > +             if (nftw(path, do_build_table_cb, nopenfd, flags) == -1)
> > +                     break;
>
> Sorry I missed that on the previous reviews; but I think a simple break
> out of the loop changes the previous behaviour, we should instead
> "return -1" from build_pinned_obj_table() if nftw() returns -1, as we
> were doing so far.

Thanks for the catch. Sorry, that's totally my fault: this was meant
to be an "err = nftw(...)" with a "return err" on the common exit
path, similar to the rest of the patch. Let me fix and resend.

Kind regards,
Tony

> Looks good otherwise.
>
> >       }
> >       fclose(mntfile);
> >       return 0;



[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