Merge "add mainline module support for targetting only newer bpfloader versions" am: 210d6be5ac
am: c50acfa7b9
am: d87a5be05f
am: e7f7b4907e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1895608 Change-Id: Ie34f4b666ebcd607f8b3d8ec0841c567e3583016
This commit is contained in:
commit
feecc6d2b9
2 changed files with 19 additions and 4 deletions
|
@ -28,9 +28,9 @@
|
|||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// This is BpfLoader v0.5
|
||||
// This is BpfLoader v0.6
|
||||
#define BPFLOADER_VERSION_MAJOR 0u
|
||||
#define BPFLOADER_VERSION_MINOR 5u
|
||||
#define BPFLOADER_VERSION_MINOR 6u
|
||||
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
|
||||
|
||||
#include "../progs/include/bpf_map_def.h"
|
||||
|
|
|
@ -19,6 +19,21 @@
|
|||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/* For mainline module use, you can #define BPFLOADER_{MIN/MAX}_VER
|
||||
* before #include "bpf_helpers.h" to change which bpfloaders will
|
||||
* process the resulting .o file.
|
||||
*
|
||||
* While this will work outside of mainline too, there just is no point to
|
||||
* using it when the .o and the bpfloader ship in sync with each other.
|
||||
*/
|
||||
#ifndef BPFLOADER_MIN_VER
|
||||
#define BPFLOADER_MIN_VER DEFAULT_BPFLOADER_MIN_VER
|
||||
#endif
|
||||
|
||||
#ifndef BPFLOADER_MAX_VER
|
||||
#define BPFLOADER_MAX_VER DEFAULT_BPFLOADER_MAX_VER
|
||||
#endif
|
||||
|
||||
/* place things in different elf sections */
|
||||
#define SECTION(NAME) __attribute__((section(NAME), used))
|
||||
|
||||
|
@ -42,8 +57,8 @@
|
|||
* while size_of_bpf_{map/prog}_def default to 32/20 which are the v0.0 sizes.
|
||||
*/
|
||||
#define LICENSE(NAME) \
|
||||
unsigned int _bpfloader_min_ver SECTION("bpfloader_min_ver") = DEFAULT_BPFLOADER_MIN_VER; \
|
||||
unsigned int _bpfloader_max_ver SECTION("bpfloader_max_ver") = DEFAULT_BPFLOADER_MAX_VER; \
|
||||
unsigned int _bpfloader_min_ver SECTION("bpfloader_min_ver") = BPFLOADER_MIN_VER; \
|
||||
unsigned int _bpfloader_max_ver SECTION("bpfloader_max_ver") = BPFLOADER_MAX_VER; \
|
||||
size_t _size_of_bpf_map_def SECTION("size_of_bpf_map_def") = sizeof(struct bpf_map_def); \
|
||||
size_t _size_of_bpf_prog_def SECTION("size_of_bpf_prog_def") = sizeof(struct bpf_prog_def); \
|
||||
char _license[] SECTION("license") = (NAME)
|
||||
|
|
Loading…
Reference in a new issue