]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
bpf: align and clean bpf_{map,prog}_get helpers
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 29 Oct 2015 13:58:07 +0000 (14:58 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Nov 2015 03:48:39 +0000 (22:48 -0500)
commitc210129760a010b555372ef74f4e1a46d4eb8a22
tree89e51ef793586fa8a752674d59aea233f1a68283
parentaa79781b65b9cf79807ade78f2703f5e9402c336
bpf: align and clean bpf_{map,prog}_get helpers

Add a bpf_map_get() function that we're going to use later on and
align/clean the remaining helpers a bit so that we have them a bit
more consistent:

  - __bpf_map_get() and __bpf_prog_get() that both work on the fd
    struct, check whether the descriptor is eBPF and return the
    pointer to the map/prog stored in the private data.

    Also, we can return f.file->private_data directly, the function
    signature is enough of a documentation already.

  - bpf_map_get() and bpf_prog_get() that both work on u32 user fd,
    call their respective __bpf_map_get()/__bpf_prog_get() variants,
    and take a reference.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/bpf.h
kernel/bpf/syscall.c
kernel/bpf/verifier.c