Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965562AbcLTTe0 (ORCPT ); Tue, 20 Dec 2016 14:34:26 -0500 Received: from terminus.zytor.com ([198.137.202.10]:36556 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936454AbcLTTeV (ORCPT ); Tue, 20 Dec 2016 14:34:21 -0500 Date: Tue, 20 Dec 2016 11:33:15 -0800 From: tip-bot for Joe Stringer Message-ID: Cc: wangnan0@huawei.com, hpa@zytor.com, tglx@linutronix.de, joe@ovn.org, acme@redhat.com, linux-kernel@vger.kernel.org, daniel@iogearbox.net, ast@fb.com, mingo@kernel.org Reply-To: linux-kernel@vger.kernel.org, acme@redhat.com, mingo@kernel.org, ast@fb.com, daniel@iogearbox.net, tglx@linutronix.de, hpa@zytor.com, wangnan0@huawei.com, joe@ovn.org In-Reply-To: <20161209024620.31660-8-joe@ovn.org> References: <20161209024620.31660-8-joe@ovn.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] samples/bpf: Move open_raw_sock to separate header Git-Commit-ID: 9899694a7f67714216665b87318eb367e2c5c901 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4242 Lines: 137 Commit-ID: 9899694a7f67714216665b87318eb367e2c5c901 Gitweb: http://git.kernel.org/tip/9899694a7f67714216665b87318eb367e2c5c901 Author: Joe Stringer AuthorDate: Thu, 8 Dec 2016 18:46:20 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 20 Dec 2016 12:00:40 -0300 samples/bpf: Move open_raw_sock to separate header This function was declared in libbpf.c and was the only remaining function in this library, but has nothing to do with BPF. Shift it out into a new header, sock_example.h, and include it from the relevant samples. Signed-off-by: Joe Stringer Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Wang Nan Link: http://lkml.kernel.org/r/20161209024620.31660-8-joe@ovn.org Signed-off-by: Arnaldo Carvalho de Melo --- samples/bpf/Makefile | 2 +- samples/bpf/fds_example.c | 1 + samples/bpf/libbpf.h | 3 --- samples/bpf/sock_example.c | 1 + samples/bpf/{libbpf.c => sock_example.h} | 3 +-- samples/bpf/sockex1_user.c | 1 + samples/bpf/sockex2_user.c | 1 + samples/bpf/sockex3_user.c | 1 + 8 files changed, 7 insertions(+), 6 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 5a73f5a..f01b66f 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -36,7 +36,7 @@ hostprogs-y += lwt_len_hist hostprogs-y += xdp_tx_iptunnel # Libbpf dependencies -LIBBPF := libbpf.o ../../tools/lib/bpf/bpf.o +LIBBPF := ../../tools/lib/bpf/bpf.o test_lru_dist-objs := test_lru_dist.o $(LIBBPF) sock_example-objs := sock_example.o $(LIBBPF) diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c index a5cddc9..e29bd52 100644 --- a/samples/bpf/fds_example.c +++ b/samples/bpf/fds_example.c @@ -14,6 +14,7 @@ #include "bpf_load.h" #include "libbpf.h" +#include "sock_example.h" #define BPF_F_PIN (1 << 0) #define BPF_F_GET (1 << 1) diff --git a/samples/bpf/libbpf.h b/samples/bpf/libbpf.h index 09aedc3..3705fba 100644 --- a/samples/bpf/libbpf.h +++ b/samples/bpf/libbpf.h @@ -185,7 +185,4 @@ struct bpf_insn; .off = 0, \ .imm = 0 }) -/* create RAW socket and bind to interface 'name' */ -int open_raw_sock(const char *name); - #endif diff --git a/samples/bpf/sock_example.c b/samples/bpf/sock_example.c index 5546f8a..6fc6e19 100644 --- a/samples/bpf/sock_example.c +++ b/samples/bpf/sock_example.c @@ -27,6 +27,7 @@ #include #include #include "libbpf.h" +#include "sock_example.h" char bpf_log_buf[BPF_LOG_BUF_SIZE]; diff --git a/samples/bpf/libbpf.c b/samples/bpf/sock_example.h similarity index 92% rename from samples/bpf/libbpf.c rename to samples/bpf/sock_example.h index bee473a..09f7fe7 100644 --- a/samples/bpf/libbpf.c +++ b/samples/bpf/sock_example.h @@ -1,4 +1,3 @@ -/* eBPF mini library */ #include #include #include @@ -11,7 +10,7 @@ #include #include "libbpf.h" -int open_raw_sock(const char *name) +static inline int open_raw_sock(const char *name) { struct sockaddr_ll sll; int sock; diff --git a/samples/bpf/sockex1_user.c b/samples/bpf/sockex1_user.c index 9454448..6cd2feb 100644 --- a/samples/bpf/sockex1_user.c +++ b/samples/bpf/sockex1_user.c @@ -3,6 +3,7 @@ #include #include "libbpf.h" #include "bpf_load.h" +#include "sock_example.h" #include #include diff --git a/samples/bpf/sockex2_user.c b/samples/bpf/sockex2_user.c index 6a40600..0e0207c 100644 --- a/samples/bpf/sockex2_user.c +++ b/samples/bpf/sockex2_user.c @@ -3,6 +3,7 @@ #include #include "libbpf.h" #include "bpf_load.h" +#include "sock_example.h" #include #include #include diff --git a/samples/bpf/sockex3_user.c b/samples/bpf/sockex3_user.c index 9099c42..b5524d4 100644 --- a/samples/bpf/sockex3_user.c +++ b/samples/bpf/sockex3_user.c @@ -3,6 +3,7 @@ #include #include "libbpf.h" #include "bpf_load.h" +#include "sock_example.h" #include #include #include