mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
samples/bpf: use vmlinux.h instead of implicit headers in BPF test program
This commit applies vmlinux.h to BPF functionality testing program. Macros that were not defined despite migration to "vmlinux.h" were defined separately in individual files. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Link: https://lore.kernel.org/r/20230115071613.125791-10-danieltimlee@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
c2f4f5593e
commit
e8acf8f47a
@@ -10,10 +10,7 @@
|
|||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <uapi/linux/bpf.h>
|
#include "vmlinux.h"
|
||||||
#include <uapi/linux/if_ether.h>
|
|
||||||
#include <uapi/linux/ip.h>
|
|
||||||
#include <uapi/linux/in.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include "vmlinux.h"
|
||||||
#include "net_shared.h"
|
#include "net_shared.h"
|
||||||
#include <uapi/linux/bpf.h>
|
|
||||||
#include <linux/net.h>
|
|
||||||
#include <uapi/linux/in.h>
|
|
||||||
#include <uapi/linux/in6.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
|
|
||||||
SEC("cgroup/sock")
|
SEC("cgroup/sock")
|
||||||
|
@@ -5,9 +5,8 @@
|
|||||||
* License as published by the Free Software Foundation.
|
* License as published by the Free Software Foundation.
|
||||||
*/
|
*/
|
||||||
#define KBUILD_MODNAME "foo"
|
#define KBUILD_MODNAME "foo"
|
||||||
|
#include "vmlinux.h"
|
||||||
#include "net_shared.h"
|
#include "net_shared.h"
|
||||||
#include <uapi/linux/ipv6.h>
|
|
||||||
#include <uapi/linux/bpf.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
|
|
||||||
/* copy of 'struct ethhdr' without __packed */
|
/* copy of 'struct ethhdr' without __packed */
|
||||||
|
@@ -10,17 +10,8 @@
|
|||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "vmlinux.h"
|
||||||
#include "net_shared.h"
|
#include "net_shared.h"
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <linux/bpf.h>
|
|
||||||
#include <linux/ip.h>
|
|
||||||
#include <linux/in.h>
|
|
||||||
#include <linux/in6.h>
|
|
||||||
#include <linux/tcp.h>
|
|
||||||
#include <linux/udp.h>
|
|
||||||
#include <linux/icmpv6.h>
|
|
||||||
#include <linux/if_ether.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@@ -6,16 +6,17 @@
|
|||||||
* License as published by the Free Software Foundation.
|
* License as published by the Free Software Foundation.
|
||||||
*/
|
*/
|
||||||
#define KBUILD_MODNAME "foo"
|
#define KBUILD_MODNAME "foo"
|
||||||
#include <linux/ptrace.h>
|
#include "vmlinux.h"
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#include <uapi/linux/bpf.h>
|
|
||||||
#include <uapi/linux/in6.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
#include <bpf/bpf_tracing.h>
|
#include <bpf/bpf_tracing.h>
|
||||||
#include <bpf/bpf_core_read.h>
|
#include <bpf/bpf_core_read.h>
|
||||||
|
|
||||||
#define MAX_NR_PORTS 65536
|
#define MAX_NR_PORTS 65536
|
||||||
|
|
||||||
|
#define EINVAL 22
|
||||||
|
#define ENOENT 2
|
||||||
|
|
||||||
/* map #0 */
|
/* map #0 */
|
||||||
struct inner_a {
|
struct inner_a {
|
||||||
__uint(type, BPF_MAP_TYPE_ARRAY);
|
__uint(type, BPF_MAP_TYPE_ARRAY);
|
||||||
|
@@ -4,10 +4,8 @@
|
|||||||
* modify it under the terms of version 2 of the GNU General Public
|
* modify it under the terms of version 2 of the GNU General Public
|
||||||
* License as published by the Free Software Foundation.
|
* License as published by the Free Software Foundation.
|
||||||
*/
|
*/
|
||||||
|
#include "vmlinux.h"
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#include <linux/ptrace.h>
|
|
||||||
#include <linux/sched.h>
|
|
||||||
#include <uapi/linux/bpf.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
#include <bpf/bpf_tracing.h>
|
#include <bpf/bpf_tracing.h>
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
/* Copyright (c) 2018 Facebook */
|
/* Copyright (c) 2018 Facebook */
|
||||||
#include <uapi/linux/bpf.h>
|
#include "vmlinux.h"
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
|
|
||||||
SEC("raw_tracepoint/task_rename")
|
SEC("raw_tracepoint/task_rename")
|
||||||
|
@@ -4,8 +4,7 @@
|
|||||||
* modify it under the terms of version 2 of the GNU General Public
|
* modify it under the terms of version 2 of the GNU General Public
|
||||||
* License as published by the Free Software Foundation.
|
* License as published by the Free Software Foundation.
|
||||||
*/
|
*/
|
||||||
#include <linux/sched.h>
|
#include "vmlinux.h"
|
||||||
#include <uapi/linux/bpf.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
#include <bpf/bpf_helpers.h>
|
||||||
|
|
||||||
/* from /sys/kernel/debug/tracing/events/task/task_rename/format */
|
/* from /sys/kernel/debug/tracing/events/task/task_rename/format */
|
||||||
|
Reference in New Issue
Block a user