diff options
Diffstat (limited to 'samples')
| -rw-r--r-- | samples/bpf/libbpf.c | 21 | ||||
| -rw-r--r-- | samples/bpf/libbpf.h | 3 |
2 files changed, 0 insertions, 24 deletions
diff --git a/samples/bpf/libbpf.c b/samples/bpf/libbpf.c index 3391225ad7e9..d9af876b4a2c 100644 --- a/samples/bpf/libbpf.c +++ b/samples/bpf/libbpf.c | |||
| @@ -11,27 +11,6 @@ | |||
| 11 | #include <arpa/inet.h> | 11 | #include <arpa/inet.h> |
| 12 | #include "libbpf.h" | 12 | #include "libbpf.h" |
| 13 | 13 | ||
| 14 | int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type) | ||
| 15 | { | ||
| 16 | union bpf_attr attr = { | ||
| 17 | .target_fd = target_fd, | ||
| 18 | .attach_bpf_fd = prog_fd, | ||
| 19 | .attach_type = type, | ||
| 20 | }; | ||
| 21 | |||
| 22 | return syscall(__NR_bpf, BPF_PROG_ATTACH, &attr, sizeof(attr)); | ||
| 23 | } | ||
| 24 | |||
| 25 | int bpf_prog_detach(int target_fd, enum bpf_attach_type type) | ||
| 26 | { | ||
| 27 | union bpf_attr attr = { | ||
| 28 | .target_fd = target_fd, | ||
| 29 | .attach_type = type, | ||
| 30 | }; | ||
| 31 | |||
| 32 | return syscall(__NR_bpf, BPF_PROG_DETACH, &attr, sizeof(attr)); | ||
| 33 | } | ||
| 34 | |||
| 35 | int open_raw_sock(const char *name) | 14 | int open_raw_sock(const char *name) |
| 36 | { | 15 | { |
| 37 | struct sockaddr_ll sll; | 16 | struct sockaddr_ll sll; |
diff --git a/samples/bpf/libbpf.h b/samples/bpf/libbpf.h index cf7d2386d1f9..cc815624aacf 100644 --- a/samples/bpf/libbpf.h +++ b/samples/bpf/libbpf.h | |||
| @@ -6,9 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | struct bpf_insn; | 7 | struct bpf_insn; |
| 8 | 8 | ||
| 9 | int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type); | ||
| 10 | int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type); | ||
| 11 | |||
| 12 | /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ | 9 | /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ |
| 13 | 10 | ||
| 14 | #define BPF_ALU64_REG(OP, DST, SRC) \ | 11 | #define BPF_ALU64_REG(OP, DST, SRC) \ |
