libbpf: Add bpf_program__get_{type, expected_attach_type) APIs
There are bpf_program__set_type() and bpf_program__set_expected_attach_type(), but no corresponding getters, which seems rather incomplete. Fix this. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20191021033902.3856966-3-andriin@fb.com
This commit is contained in:
committed by
Daniel Borkmann
parent
bc3f2956f2
commit
f1eead9e3c
@ -4463,6 +4463,11 @@ int bpf_program__nth_fd(const struct bpf_program *prog, int n)
|
||||
return fd;
|
||||
}
|
||||
|
||||
enum bpf_prog_type bpf_program__get_type(struct bpf_program *prog)
|
||||
{
|
||||
return prog->type;
|
||||
}
|
||||
|
||||
void bpf_program__set_type(struct bpf_program *prog, enum bpf_prog_type type)
|
||||
{
|
||||
prog->type = type;
|
||||
@ -4497,6 +4502,12 @@ BPF_PROG_TYPE_FNS(raw_tracepoint, BPF_PROG_TYPE_RAW_TRACEPOINT);
|
||||
BPF_PROG_TYPE_FNS(xdp, BPF_PROG_TYPE_XDP);
|
||||
BPF_PROG_TYPE_FNS(perf_event, BPF_PROG_TYPE_PERF_EVENT);
|
||||
|
||||
enum bpf_attach_type
|
||||
bpf_program__get_expected_attach_type(struct bpf_program *prog)
|
||||
{
|
||||
return prog->expected_attach_type;
|
||||
}
|
||||
|
||||
void bpf_program__set_expected_attach_type(struct bpf_program *prog,
|
||||
enum bpf_attach_type type)
|
||||
{
|
||||
|
Reference in New Issue
Block a user