[bpf-next,4/5] bpftool: Add struct_ops map name
diff mbox series

Message ID 20200114224419.3028615-1-kafai@fb.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series
  • bpftool: Support dumping a map with btf_vmlinux_value_type_id
Related show

Commit Message

Martin KaFai Lau Jan. 14, 2020, 10:44 p.m. UTC
This patch adds BPF_MAP_TYPE_STRUCT_OPS to "struct_ops" name mapping
so that "bpftool map show" can print the "struct_ops" map type
properly.

[root@arch-fb-vm1 bpf]# ~/devshare/fb-kernel/linux/tools/bpf/bpftool/bpftool map show id 8
8: struct_ops  name dctcp  flags 0x0
	key 4B  value 256B  max_entries 1  memlock 4096B
	btf_id 7

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
 tools/bpf/bpftool/map.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrii Nakryiko Jan. 15, 2020, 1:45 a.m. UTC | #1
On Tue, Jan 14, 2020 at 2:45 PM Martin KaFai Lau <kafai@fb.com> wrote:
>
> This patch adds BPF_MAP_TYPE_STRUCT_OPS to "struct_ops" name mapping
> so that "bpftool map show" can print the "struct_ops" map type
> properly.
>
> [root@arch-fb-vm1 bpf]# ~/devshare/fb-kernel/linux/tools/bpf/bpftool/bpftool map show id 8
> 8: struct_ops  name dctcp  flags 0x0
>         key 4B  value 256B  max_entries 1  memlock 4096B
>         btf_id 7
>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> ---

Acked-by: Andrii Nakryiko <andriin@fb.com>

>  tools/bpf/bpftool/map.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index 45c1eda6512c..4c5b15d736b6 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -48,6 +48,7 @@ const char * const map_type_name[] = {
>         [BPF_MAP_TYPE_QUEUE]                    = "queue",
>         [BPF_MAP_TYPE_STACK]                    = "stack",
>         [BPF_MAP_TYPE_SK_STORAGE]               = "sk_storage",
> +       [BPF_MAP_TYPE_STRUCT_OPS]               = "struct_ops",
>  };
>
>  const size_t map_type_name_size = ARRAY_SIZE(map_type_name);
> --
> 2.17.1
>

Patch
diff mbox series

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 45c1eda6512c..4c5b15d736b6 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -48,6 +48,7 @@  const char * const map_type_name[] = {
 	[BPF_MAP_TYPE_QUEUE]			= "queue",
 	[BPF_MAP_TYPE_STACK]			= "stack",
 	[BPF_MAP_TYPE_SK_STORAGE]		= "sk_storage",
+	[BPF_MAP_TYPE_STRUCT_OPS]		= "struct_ops",
 };
 
 const size_t map_type_name_size = ARRAY_SIZE(map_type_name);