Libbpf userspace function btf__add_enum
Append new BTF_KIND_ENUM type to BTF object.
Definition
int btf__add_enum(struct btf *btf, const char *name, __u32 bytes_sz);
Parameters
btf
: pointer to astruct btf
objectname
: name of the enum, can beNULL
or empty for anonymous enums;bytes_sz
: size of the enum, in bytes.
Return
>0
, type ID of newly added BTF type; <0
, on error.
Usage
Enum initially has no enum values in it (and corresponds to enum forward declaration). Enumerator values can be added by btf__add_enum_value
immediately after btf__add_enum
succeeds.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome