Add libbpf_prog bpfRingbufProg.bpf target

This is a preparation for migrating to the Rust platform bpfloader.

Bug: 410982483
Test: m bpfRingbufProg.bpf bpfRingbufProg.o
Change-Id: I094635be14e56aac53384ac517538c2587367c44
This commit is contained in:
Motomu Utsumi 2025-05-12 16:58:02 +09:00
commit fbadb82001
3 changed files with 15 additions and 0 deletions

View file

@ -18,6 +18,7 @@
#define __always_inline __attribute__((__always_inline__))
#include <linux/bpf.h>
#include <sys/cdefs.h>
#define DEFINE_BPF_MAP_BASE(the_map, TYPE, KeyType, ValueType, num_entries, gid) \
struct { \

View file

@ -31,3 +31,11 @@ bpf {
name: "bpfRingbufProg.o",
srcs: ["bpfRingbufProg.c"],
}
libbpf_prog {
name: "bpfRingbufProg.bpf",
srcs: ["bpfRingbufProg.c"],
header_libs: [
"android_bpf_defs",
],
}

View file

@ -14,7 +14,13 @@
* limitations under the License.
*/
// Because include_dirs is not allowed under system/bpf, include
// <android_bpf_defs.h> only if the code is built for libbpf_prog target.
#ifdef ENABLE_LIBBPF
#include <android_bpf_defs.h>
#else
#include "bpf_helpers.h"
#endif
// This can't be easily changed since the program is loaded on boot and may be
// run against tests at a slightly different version.