diff --git a/map-common.go b/map-common.go index aafcb5f6..6526e28b 100644 --- a/map-common.go +++ b/map-common.go @@ -95,6 +95,10 @@ func (t MapType) String() string { return str } +func (t MapType) Name() string { + return C.GoString(C.libbpf_bpf_map_type_str(C.enum_bpf_map_type(t))) +} + // // MapFlag // diff --git a/prog-common.go b/prog-common.go index 7afe311c..a1f4d88a 100644 --- a/prog-common.go +++ b/prog-common.go @@ -96,6 +96,10 @@ func (t BPFProgType) String() string { return str } +func (t BPFProgType) Name() string { + return C.GoString(C.libbpf_bpf_prog_type_str(C.enum_bpf_prog_type(t))) +} + // // BPFAttachType // @@ -197,12 +201,16 @@ var bpfAttachTypeToString = map[BPFAttachType]string{ func (t BPFAttachType) String() string { str, ok := bpfAttachTypeToString[t] if !ok { - return "Unspecified" + return "BPFAttachType unspecified" } return str } +func (t BPFAttachType) Name() string { + return C.GoString(C.libbpf_bpf_attach_type_str(C.enum_bpf_attach_type(t))) +} + // // BPFCgroupIterOrder //