Commit 5f412632 authored by Yonghong Song's avatar Yonghong Song Committed by Alexei Starovoitov

bpf: change prototype for stack_map_get_build_id_offset

This patch didn't incur functionality change. The function prototype
got changed so that the same function can be reused later.
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 2c25fc9a
...@@ -262,16 +262,11 @@ static int stack_map_get_build_id(struct vm_area_struct *vma, ...@@ -262,16 +262,11 @@ static int stack_map_get_build_id(struct vm_area_struct *vma,
return ret; return ret;
} }
static void stack_map_get_build_id_offset(struct bpf_map *map, static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
struct stack_map_bucket *bucket,
u64 *ips, u32 trace_nr, bool user) u64 *ips, u32 trace_nr, bool user)
{ {
int i; int i;
struct vm_area_struct *vma; struct vm_area_struct *vma;
struct bpf_stack_build_id *id_offs;
bucket->nr = trace_nr;
id_offs = (struct bpf_stack_build_id *)bucket->data;
/* /*
* We cannot do up_read() in nmi context, so build_id lookup is * We cannot do up_read() in nmi context, so build_id lookup is
...@@ -361,8 +356,10 @@ BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map, ...@@ -361,8 +356,10 @@ BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map,
pcpu_freelist_pop(&smap->freelist); pcpu_freelist_pop(&smap->freelist);
if (unlikely(!new_bucket)) if (unlikely(!new_bucket))
return -ENOMEM; return -ENOMEM;
stack_map_get_build_id_offset(map, new_bucket, ips, new_bucket->nr = trace_nr;
trace_nr, user); stack_map_get_build_id_offset(
(struct bpf_stack_build_id *)new_bucket->data,
ips, trace_nr, user);
trace_len = trace_nr * sizeof(struct bpf_stack_build_id); trace_len = trace_nr * sizeof(struct bpf_stack_build_id);
if (hash_matches && bucket->nr == trace_nr && if (hash_matches && bucket->nr == trace_nr &&
memcmp(bucket->data, new_bucket->data, trace_len) == 0) { memcmp(bucket->data, new_bucket->data, trace_len) == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment