• Daniel Borkmann's avatar
    bpf: align and clean bpf_{map,prog}_get helpers · c2101297
    Daniel Borkmann authored
    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: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c2101297
verifier.c 62.2 KB