[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1519778024-3113-1-git-send-email-tushar.n.dave@oracle.com>
Date: Tue, 27 Feb 2018 16:33:44 -0800
From: Tushar Dave <tushar.n.dave@...cle.com>
To: ast@...nel.org, daniel@...earbox.net, shuah@...nel.org,
netdev@...r.kernel.org, linux-selftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] selftests/bpf: Add bpf_probe_read_str to bpf_helpers.h
Using bpf_probe_read_str() from samples/bpf causes compiler warning.
e.g.
warning: implicit declaration of function 'bpf_probe_read_str' is invalid in C99
[-Wimplicit-function-declaration]
num = bpf_probe_read_str(buf, sizeof(buf), ctx->di);
^
1 warning generated.
Add bpf_probe_read_str() to bpf_helpers.h so it can be used by
samples/bpf programs.
Signed-off-by: Tushar Dave <tushar.n.dave@...cle.com>
---
tools/testing/selftests/bpf/bpf_helpers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
index dde2c11..65a266d 100644
--- a/tools/testing/selftests/bpf/bpf_helpers.h
+++ b/tools/testing/selftests/bpf/bpf_helpers.h
@@ -65,6 +65,8 @@ static int (*bpf_xdp_adjust_head)(void *ctx, int offset) =
(void *) BPF_FUNC_xdp_adjust_head;
static int (*bpf_xdp_adjust_meta)(void *ctx, int offset) =
(void *) BPF_FUNC_xdp_adjust_meta;
+static int (*bpf_probe_read_str)(void *dst, int size, void *unsafe_ptr) =
+ (void *) BPF_FUNC_probe_read_str;
static int (*bpf_setsockopt)(void *ctx, int level, int optname, void *optval,
int optlen) =
(void *) BPF_FUNC_setsockopt;
--
1.9.1
Powered by blists - more mailing lists