From: Andrii Nakryiko <andriin@fb.com>
To: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <ast@fb.com>,
<daniel@iogearbox.net>
Cc: <andrii.nakryiko@gmail.com>, <kernel-team@fb.com>,
Andrii Nakryiko <andriin@fb.com>,
Quentin Monnet <quentin.monnet@netronome.com>
Subject: [PATCH v2 bpf-next 15/15] bpftool: add `gen skeleton` BASH completions
Date: Thu, 12 Dec 2019 08:41:28 -0800 [thread overview]
Message-ID: <20191212164129.494329-16-andriin@fb.com> (raw)
In-Reply-To: <20191212164129.494329-1-andriin@fb.com>
Add BASH completions for gen sub-command.
Cc: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/bpf/bpftool/bash-completion/bpftool | 11 +++++++++++
tools/bpf/bpftool/main.c | 2 +-
tools/testing/selftests/bpf/prog_tests/skeleton.c | 6 ++++--
tools/testing/selftests/bpf/progs/test_skeleton.c | 3 ++-
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index 70493a6da206..986519cc58d1 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -716,6 +716,17 @@ _bpftool()
;;
esac
;;
+ gen)
+ case $command in
+ skeleton)
+ _filedir
+ ;;
+ *)
+ [[ $prev == $object ]] && \
+ COMPREPLY=( $( compgen -W 'skeleton help' -- "$cur" ) )
+ ;;
+ esac
+ ;;
cgroup)
case $command in
show|list|tree)
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 758b294e8a7d..1fe91c558508 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -58,7 +58,7 @@ static int do_help(int argc, char **argv)
" %s batch file FILE\n"
" %s version\n"
"\n"
- " OBJECT := { prog | map | cgroup | perf | net | feature | btf }\n"
+ " OBJECT := { prog | map | cgroup | perf | net | feature | btf | gen }\n"
" " HELP_SPEC_OPTIONS "\n"
"",
bin_name, bin_name, bin_name);
diff --git a/tools/testing/selftests/bpf/prog_tests/skeleton.c b/tools/testing/selftests/bpf/prog_tests/skeleton.c
index d65a0203e1df..94e0300f437a 100644
--- a/tools/testing/selftests/bpf/prog_tests/skeleton.c
+++ b/tools/testing/selftests/bpf/prog_tests/skeleton.c
@@ -39,8 +39,10 @@ void test_skeleton(void)
CHECK(bss->out2 != 2, "res2", "got %lld != exp %d\n", bss->out2, 2);
CHECK(bss->out3 != 3, "res3", "got %d != exp %d\n", (int)bss->out3, 3);
CHECK(bss->out4 != 4, "res4", "got %lld != exp %d\n", bss->out4, 4);
- CHECK(bss->out5.a != 5, "res5", "got %d != exp %d\n", bss->out5.a, 5);
- CHECK(bss->out5.b != 6, "res6", "got %lld != exp %d\n", bss->out5.b, 6);
+ CHECK(bss->handler_out5.a != 5, "res5", "got %d != exp %d\n",
+ bss->handler_out5.a, 5);
+ CHECK(bss->handler_out5.b != 6, "res6", "got %lld != exp %d\n",
+ bss->handler_out5.b, 6);
cleanup:
test_skeleton__destroy(skel);
diff --git a/tools/testing/selftests/bpf/progs/test_skeleton.c b/tools/testing/selftests/bpf/progs/test_skeleton.c
index 303a841c4d1c..db4fd88f3ecb 100644
--- a/tools/testing/selftests/bpf/progs/test_skeleton.c
+++ b/tools/testing/selftests/bpf/progs/test_skeleton.c
@@ -16,7 +16,6 @@ long long in4 __attribute__((aligned(64))) = 0;
struct s in5 = {};
long long out2 = 0;
-struct s out5 = {};
char out3 = 0;
long long out4 = 0;
int out1 = 0;
@@ -25,6 +24,8 @@ int out1 = 0;
SEC("raw_tp/sys_enter")
int handler(const void *ctx)
{
+ static volatile struct s out5;
+
out1 = in1;
out2 = in2;
out3 = in3;
--
2.17.1
next prev parent reply other threads:[~2019-12-12 16:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 16:41 [PATCH v2 bpf-next 00/15] Add code-generated BPF object skeleton support Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 01/15] libbpf: don't require root for bpf_object__open() Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 02/15] libbpf: add generic bpf_program__attach() Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 03/15] libbpf: move non-public APIs from libbpf.h to libbpf_internal.h Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 04/15] libbpf: add BPF_EMBED_OBJ macro for embedding BPF .o files Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 05/15] libbpf: expose field/var declaration emitting API internally Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 06/15] libbpf: expose BPF program's function name Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 07/15] libbpf: refactor global data map initialization Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 08/15] libbpf: postpone BTF ID finding for TRACING programs to load phase Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 09/15] libbpf: reduce log level of supported section names dump Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 10/15] libbpf: add experimental BPF object skeleton support Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 11/15] bpftool: add skeleton codegen command Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 12/15] selftests/bpf: add BPF skeletons selftests and convert attach_probe.c Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 13/15] selftests/bpf: convert few more selftest to skeletons Andrii Nakryiko
2019-12-12 16:41 ` [PATCH v2 bpf-next 14/15] selftests/bpf: add test validating data section to struct convertion layout Andrii Nakryiko
2019-12-12 16:41 ` Andrii Nakryiko [this message]
2019-12-12 21:12 ` [PATCH v2 bpf-next 15/15] bpftool: add `gen skeleton` BASH completions Quentin Monnet
2019-12-12 21:49 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191212164129.494329-16-andriin@fb.com \
--to=andriin@fb.com \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=quentin.monnet@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).