mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 07:08:07 +00:00
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:
parent
bc3f2956f2
commit
f1eead9e3c
3 changed files with 18 additions and 0 deletions
|
@ -4463,6 +4463,11 @@ int bpf_program__nth_fd(const struct bpf_program *prog, int n)
|
||||||
return fd;
|
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)
|
void bpf_program__set_type(struct bpf_program *prog, enum bpf_prog_type type)
|
||||||
{
|
{
|
||||||
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(xdp, BPF_PROG_TYPE_XDP);
|
||||||
BPF_PROG_TYPE_FNS(perf_event, BPF_PROG_TYPE_PERF_EVENT);
|
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,
|
void bpf_program__set_expected_attach_type(struct bpf_program *prog,
|
||||||
enum bpf_attach_type type)
|
enum bpf_attach_type type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -302,8 +302,13 @@ LIBBPF_API int bpf_program__set_sched_cls(struct bpf_program *prog);
|
||||||
LIBBPF_API int bpf_program__set_sched_act(struct bpf_program *prog);
|
LIBBPF_API int bpf_program__set_sched_act(struct bpf_program *prog);
|
||||||
LIBBPF_API int bpf_program__set_xdp(struct bpf_program *prog);
|
LIBBPF_API int bpf_program__set_xdp(struct bpf_program *prog);
|
||||||
LIBBPF_API int bpf_program__set_perf_event(struct bpf_program *prog);
|
LIBBPF_API int bpf_program__set_perf_event(struct bpf_program *prog);
|
||||||
|
|
||||||
|
LIBBPF_API enum bpf_prog_type bpf_program__get_type(struct bpf_program *prog);
|
||||||
LIBBPF_API void bpf_program__set_type(struct bpf_program *prog,
|
LIBBPF_API void bpf_program__set_type(struct bpf_program *prog,
|
||||||
enum bpf_prog_type type);
|
enum bpf_prog_type type);
|
||||||
|
|
||||||
|
LIBBPF_API enum bpf_attach_type
|
||||||
|
bpf_program__get_expected_attach_type(struct bpf_program *prog);
|
||||||
LIBBPF_API void
|
LIBBPF_API void
|
||||||
bpf_program__set_expected_attach_type(struct bpf_program *prog,
|
bpf_program__set_expected_attach_type(struct bpf_program *prog,
|
||||||
enum bpf_attach_type type);
|
enum bpf_attach_type type);
|
||||||
|
|
|
@ -195,4 +195,6 @@ LIBBPF_0.0.6 {
|
||||||
global:
|
global:
|
||||||
bpf_object__open_file;
|
bpf_object__open_file;
|
||||||
bpf_object__open_mem;
|
bpf_object__open_mem;
|
||||||
|
bpf_program__get_expected_attach_type;
|
||||||
|
bpf_program__get_type;
|
||||||
} LIBBPF_0.0.5;
|
} LIBBPF_0.0.5;
|
||||||
|
|
Loading…
Add table
Reference in a new issue