tc, bpf: use bind/type macros from gelf
Don't reimplement them and rather use the macros from the gelf header, that is, GELF_ST_BIND()/GELF_ST_TYPE(). Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
a576c6b977
commit
5230a2ede0
|
|
@ -1162,9 +1162,6 @@ static int bpf_map_attach(const char *name, const struct bpf_elf_map *map,
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __ELF_ST_BIND(x) ((x) >> 4)
|
|
||||||
#define __ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
|
|
||||||
|
|
||||||
static const char *bpf_str_tab_name(const struct bpf_elf_ctx *ctx,
|
static const char *bpf_str_tab_name(const struct bpf_elf_ctx *ctx,
|
||||||
const GElf_Sym *sym)
|
const GElf_Sym *sym)
|
||||||
{
|
{
|
||||||
|
|
@ -1180,8 +1177,8 @@ static const char *bpf_map_fetch_name(struct bpf_elf_ctx *ctx, int which)
|
||||||
if (gelf_getsym(ctx->sym_tab, i, &sym) != &sym)
|
if (gelf_getsym(ctx->sym_tab, i, &sym) != &sym)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (__ELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
|
if (GELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
|
||||||
__ELF_ST_TYPE(sym.st_info) != STT_NOTYPE ||
|
GELF_ST_TYPE(sym.st_info) != STT_NOTYPE ||
|
||||||
sym.st_shndx != ctx->sec_maps ||
|
sym.st_shndx != ctx->sec_maps ||
|
||||||
sym.st_value / sizeof(struct bpf_elf_map) != which)
|
sym.st_value / sizeof(struct bpf_elf_map) != which)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue