Skip to content

libbpf: fix libbp_sha256() for Github compatibility

Andrii Nakryiko bpf 2 versions – Applied

Status from this message: This series was applied to bpf/bpf.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 2 repliesApplied 5/5
  2. v15 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- add missed cpu_to_be32() and be32_to_cpu() conversions inside {get/put}_unaligned_be32() macros;
- target bpf tree (Alexei);
- applied Eric's libbpf_sha256 selftest locally and verified it works;

Patches in v2 All 5 applied

#Subject and filesSizeRepliesApplied
1/5libbpf: make libbpf_errno.c into more generic libbpf_utils.ctools/lib/bpf/Build tools/lib/bpf/libbpf_utils.c+1 -10 repliesApplied
2/5libbpf: remove unused libbpf_strerror_r and STRERR_BUFSIZEtools/lib/bpf/libbpf.c tools/lib/bpf/str_error.c tools/lib/bpf/str_error.h+0 -300 repliesApplied
3/5libbpf: move libbpf_errstr() into libbpf_utils.ctools/lib/bpf/Build tools/lib/bpf/btf.c tools/lib/bpf/btf_dump.c +12 more+84 -1070 repliesApplied
4/5libbpf: move libbpf_sha256() implementation into libbpf_utils.ctools/lib/bpf/libbpf.c tools/lib/bpf/libbpf_internal.h tools/lib/bpf/libbpf_utils.c+100 -980 repliesApplied
5/5libbpf: remove linux/unaligned.h dependency for libbpf_sha256()tools/lib/bpf/libbpf_utils.c+11 -20 repliesApplied

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEduard Zingerman
SeriesA-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 bpf 0/5] libbpf: fix libbp_sha256() for Github compatibility

Recent reimplementation of libbpf_sha256() introduced issues for libbpf's Github mirror due to reliance on linux/unaligned.h header. This patch set fixes those issues to make libbpf source code compatible with Github mirror setup.

This patch set starts with a bit of organization: we introduce libbpf_utils.c as a place for generic internal helpers like libbpf_errstr() and libbpf_sha256(), and move a few existing helpers there. We also clean up libbpf_strerror_r(), which seems to be a leftover of some previous refactorings.

And finally, we move libbpf_sha256() from huge libbpf.c into libbpf_utils.c, following up with fix ups to make its code more Github-friendly.

v1->v2:
- add missed cpu_to_be32() and be32_to_cpu() conversions inside {get/put}_unaligned_be32() macros;
- target bpf tree (Alexei);
- applied Eric's libbpf_sha256 selftest locally and verified it works;

v1:
https://lore.kernel.org/bpf/[email protected]/

Andrii Nakryiko (5):
libbpf: make libbpf_errno.c into more generic libbpf_utils.c
libbpf: remove unused libbpf_strerror_r and STRERR_BUFSIZE
libbpf: move libbpf_errstr() into libbpf_utils.c
libbpf: move libbpf_sha256() implementation into libbpf_utils.c
libbpf: remove linux/unaligned.h dependency for libbpf_sha256()

 tools/lib/bpf/Build             |   2 +-
 tools/lib/bpf/btf.c             |   1 -
 tools/lib/bpf/btf_dump.c        |   1 -
 tools/lib/bpf/elf.c             |   1 -
 tools/lib/bpf/features.c        |   1 -
 tools/lib/bpf/gen_loader.c      |   3 +-
 tools/lib/bpf/libbpf.c          | 101 -------------
 tools/lib/bpf/libbpf_errno.c    |  75 ----------
 tools/lib/bpf/libbpf_internal.h |  15 ++
 tools/lib/bpf/libbpf_utils.c    | 251 ++++++++++++++++++++++++++++++++
 tools/lib/bpf/linker.c          |   1 -
 tools/lib/bpf/relo_core.c       |   1 -
 tools/lib/bpf/ringbuf.c         |   1 -
 tools/lib/bpf/str_error.c       | 104 -------------
 tools/lib/bpf/str_error.h       |  19 ---
 tools/lib/bpf/usdt.c            |   1 -
 16 files changed, 268 insertions(+), 310 deletions(-)
 delete mode 100644 tools/lib/bpf/libbpf_errno.c
 create mode 100644 tools/lib/bpf/libbpf_utils.c
 delete mode 100644 tools/lib/bpf/str_error.c
 delete mode 100644 tools/lib/bpf/str_error.h
Signature · 1 line
2.47.3