lkml.org 
[lkml]   [2018]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] tools bpftool: Display license GPL compatible in prog show/list
Date
Display the license GPL NON/compatible string in bpftool
prog command, like:

# bpftool prog list
3: kprobe name func_begin tag 57cd311f2e27366b license GPL NON compatible
loaded_at Apr 25/11:20 uid 0
xlated 16B not jited memlock 4096B

# bpftool prog list
4: kprobe name func_begin tag 57cd311f2e27366b license GPL compatible
loaded_at Apr 25/11:20 uid 0
xlated 16B not jited memlock 4096B

# bpftool prog show --json
[{"id":3,"type":"kprobe","name":"func ... ,"gpl_compatible":false,"loade...

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/bpf/bpftool/prog.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 548adb9b7317..b8b4341a1342 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -235,6 +235,8 @@ static void print_prog_json(struct bpf_prog_info *info, int fd)
info->tag[0], info->tag[1], info->tag[2], info->tag[3],
info->tag[4], info->tag[5], info->tag[6], info->tag[7]);

+ jsonw_bool_field(json_wtr, "gpl_compatible", info->gpl_compatible);
+
print_dev_json(info->ifindex, info->netns_dev, info->netns_ino);

if (info->load_time) {
@@ -295,6 +297,7 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
printf("tag ");
fprint_hex(stdout, info->tag, BPF_TAG_SIZE, "");
print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino);
+ printf(" license GPL %scompatible", info->gpl_compatible ? "" : "NON ");
printf("\n");

if (info->load_time) {
--
2.13.6
\
 
 \ /
  Last update: 2018-04-25 19:41    [W:0.062 / U:1.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site