Skip to content

Commit

Permalink
samples: bpf: rename libbpf.h to bpf_insn.h
Browse files Browse the repository at this point in the history
The libbpf.h file in samples is clashing with libbpf's header.
Since it only includes a subset of filter.h instruction helpers
rename it to bpf_insn.h.  Drop the unnecessary include of bpf/bpf.h.

Signed-off-by: Jakub Kicinski <[email protected]>
Acked-by: Jesper Dangaard Brouer <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
  • Loading branch information
Jakub Kicinski authored and Alexei Starovoitov committed May 15, 2018
1 parent 2bf3e2e commit 8d93045
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
8 changes: 3 additions & 5 deletions samples/bpf/libbpf.h → samples/bpf/bpf_insn.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* eBPF mini library */
#ifndef __LIBBPF_H
#define __LIBBPF_H

#include <bpf/bpf.h>
/* eBPF instruction mini library */
#ifndef __BPF_INSN_H
#define __BPF_INSN_H

struct bpf_insn;

Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/cookie_uid_helper_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <bpf/bpf.h>
#include "libbpf.h"
#include "bpf_insn.h"

#define PORT 8888

Expand Down
4 changes: 3 additions & 1 deletion samples/bpf/fds_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#include <sys/types.h>
#include <sys/socket.h>

#include <bpf/bpf.h>

#include "bpf_insn.h"
#include "bpf_load.h"
#include "libbpf.h"
#include "sock_example.h"

#define BPF_F_PIN (1 << 0)
Expand Down
3 changes: 2 additions & 1 deletion samples/bpf/sock_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#include <linux/if_ether.h>
#include <linux/ip.h>
#include <stddef.h>
#include "libbpf.h"
#include <bpf/bpf.h>
#include "bpf_insn.h"
#include "sock_example.h"

char bpf_log_buf[BPF_LOG_BUF_SIZE];
Expand Down
3 changes: 2 additions & 1 deletion samples/bpf/test_cgrp2_attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
#include <fcntl.h>

#include <linux/bpf.h>
#include <bpf/bpf.h>

#include "libbpf.h"
#include "bpf_insn.h"

enum {
MAP_KEY_PACKETS,
Expand Down
3 changes: 2 additions & 1 deletion samples/bpf/test_cgrp2_attach2.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
#include <unistd.h>

#include <linux/bpf.h>
#include <bpf/bpf.h>

#include "libbpf.h"
#include "bpf_insn.h"
#include "cgroup_helpers.h"

#define FOO "/foo"
Expand Down
3 changes: 2 additions & 1 deletion samples/bpf/test_cgrp2_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
#include <net/if.h>
#include <inttypes.h>
#include <linux/bpf.h>
#include <bpf/bpf.h>

#include "libbpf.h"
#include "bpf_insn.h"

char bpf_log_buf[BPF_LOG_BUF_SIZE];

Expand Down
3 changes: 2 additions & 1 deletion samples/bpf/test_cgrp2_sock2.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include <fcntl.h>
#include <net/if.h>
#include <linux/bpf.h>
#include <bpf/bpf.h>

#include "libbpf.h"
#include "bpf_insn.h"
#include "bpf_load.h"

static int usage(const char *argv0)
Expand Down

0 comments on commit 8d93045

Please sign in to comment.