Skip to content

Commit

Permalink
samples: bpf: include bpf/bpf.h instead of local libbpf.h
Browse files Browse the repository at this point in the history
There are two files in the tree called libbpf.h which is becoming
problematic.  Most samples don't actually need the local libbpf.h
they simply include it to get to bpf/bpf.h.  Include bpf/bpf.h
directly instead.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Jakub Kicinski authored and Alexei Starovoitov committed May 15, 2018
1 parent fb40c9d commit 2bf3e2e
Show file tree
Hide file tree
Showing 35 changed files with 34 additions and 35 deletions.
2 changes: 1 addition & 1 deletion samples/bpf/bpf_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <poll.h>
#include <ctype.h>
#include <assert.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include "perf-sys.h"

Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/bpf_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef __BPF_LOAD_H
#define __BPF_LOAD_H

#include "libbpf.h"
#include <bpf/bpf.h>

#define MAX_MAPS 32
#define MAX_PROGS 32
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/cpustat_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <sys/resource.h>
#include <sys/wait.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

#define MAX_CPU 8
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/lathist_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdlib.h>
#include <signal.h>
#include <linux/bpf.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

#define MAX_ENTRIES 20
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/load_sock_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <linux/bpf.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include <unistd.h>
#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/lwt_len_hist_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <errno.h>
#include <arpa/inet.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_util.h"

#define MAX_INDEX 64
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/map_perf_test_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <arpa/inet.h>
#include <errno.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

#define TEST_BIT(t) (1U << (t))
Expand Down
1 change: 0 additions & 1 deletion samples/bpf/sock_example.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <net/if.h>
#include <linux/if_packet.h>
#include <arpa/inet.h>
#include "libbpf.h"

static inline int open_raw_sock(const char *name)
{
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/sockex1_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdio.h>
#include <assert.h>
#include <linux/bpf.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include "sock_example.h"
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/sockex2_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdio.h>
#include <assert.h>
#include <linux/bpf.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include "sock_example.h"
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/sockex3_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdio.h>
#include <assert.h>
#include <linux/bpf.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include "sock_example.h"
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/syscall_tp_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <assert.h>
#include <stdbool.h>
#include <sys/resource.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

/* This program verifies bpf attachment to tracepoint sys_enter_* and sys_exit_*.
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tc_l2_redirect_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <string.h>
#include <errno.h>

#include "libbpf.h"
#include <bpf/bpf.h>

static void usage(void)
{
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/test_cgrp2_array_pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <errno.h>
#include <fcntl.h>

#include "libbpf.h"
#include <bpf/bpf.h>

static void usage(void)
{
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/test_current_task_under_cgroup_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <stdio.h>
#include <linux/bpf.h>
#include <unistd.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include <linux/bpf.h>
#include "cgroup_helpers.h"
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/test_lru_dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <stdlib.h>
#include <time.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_util.h"

#define min(a, b) ((a) < (b) ? (a) : (b))
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/test_map_in_map_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

#define PORT_A (map_fd[0])
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/test_overhead_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <string.h>
#include <time.h>
#include <sys/resource.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

#define MAX_CNT 1000000
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/test_probe_write_user_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <assert.h>
#include <linux/bpf.h>
#include <unistd.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include <sys/socket.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/trace_output_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <sys/mman.h>
#include <time.h>
#include <signal.h>
#include "libbpf.h"
#include <libbpf.h>
#include "bpf_load.h"
#include "perf-sys.h"
#include "trace_helpers.h"
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tracex1_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdio.h>
#include <linux/bpf.h>
#include <unistd.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

int main(int ac, char **argv)
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tracex2_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <string.h>
#include <sys/resource.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include "bpf_util.h"

Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tracex3_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/bpf.h>
#include <sys/resource.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include "bpf_util.h"

Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tracex4_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <linux/bpf.h>
#include <sys/resource.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

struct pair {
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tracex5_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <linux/filter.h>
#include <linux/seccomp.h>
#include <sys/prctl.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include <sys/resource.h>

Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tracex6_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <unistd.h>

#include "bpf_load.h"
#include "libbpf.h"
#include <bpf/bpf.h>
#include "perf-sys.h"

#define SAMPLE_PERIOD 0x7fffffffffffffffULL
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/tracex7_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <stdio.h>
#include <linux/bpf.h>
#include <unistd.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

int main(int argc, char **argv)
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_fwd_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "bpf_load.h"
#include "bpf_util.h"
#include "libbpf.h"
#include <bpf/bpf.h>


static int do_attach(int idx, int fd, const char *name)
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_monitor_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static const char *__doc_err_only__=
#include <net/if.h>
#include <time.h>

#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"
#include "bpf_util.h"

Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_redirect_cpu_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static const char *__doc__ =
* use bpf/libbpf.h), but cannot as (currently) needed for XDP
* attaching to a device via bpf_set_link_xdp_fd()
*/
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_load.h"

#include "bpf_util.h"
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_redirect_map_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "bpf_load.h"
#include "bpf_util.h"
#include "libbpf.h"
#include <bpf/bpf.h>

static int ifindex_in;
static int ifindex_out;
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_redirect_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "bpf_load.h"
#include "bpf_util.h"
#include "libbpf.h"
#include <bpf/bpf.h>

static int ifindex_in;
static int ifindex_out;
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_router_ipv4_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <sys/socket.h>
#include <unistd.h>
#include "bpf_load.h"
#include "libbpf.h"
#include <bpf/bpf.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <poll.h>
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_tx_iptunnel_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <unistd.h>
#include <time.h>
#include "bpf_load.h"
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_util.h"
#include "xdp_tx_iptunnel_common.h"

Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdpsock_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include "bpf_load.h"
#include "bpf_util.h"
#include "libbpf.h"
#include <bpf/bpf.h>

#include "xdpsock.h"

Expand Down

0 comments on commit 2bf3e2e

Please sign in to comment.