[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200630060739.1722733-1-andriin@fb.com>
Date: Mon, 29 Jun 2020 23:07:37 -0700
From: Andrii Nakryiko <andriin@...com>
To: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>, <ast@...com>,
<daniel@...earbox.net>
CC: <andrii.nakryiko@...il.com>, <kernel-team@...com>,
Andrii Nakryiko <andriin@...com>
Subject: [PATCH v2 bpf-next 0/2] Make bpf_endian.h compatible with vmlinux.h
Change libbpf's bpf_endian.h header to be compatible when used with system
headers and when using just vmlinux.h. This is a frequent request for users
writing BPF CO-RE applications. Do this by re-implementing byte swap
compile-time macros. Also add simple tests validating correct results both for
byte-swapping built-ins and macros.
Andrii Nakryiko (2):
libbpf: make bpf_endian co-exist with vmlinux.h
selftests/bpf: add byte swapping selftest
tools/lib/bpf/bpf_endian.h | 43 ++++++++++++---
.../testing/selftests/bpf/prog_tests/endian.c | 53 +++++++++++++++++++
.../testing/selftests/bpf/progs/test_endian.c | 37 +++++++++++++
3 files changed, 125 insertions(+), 8 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/endian.c
create mode 100644 tools/testing/selftests/bpf/progs/test_endian.c
--
2.24.1
Powered by blists - more mailing lists