summaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
authorDaniel Borkmann2018-05-23 12:03:33 +0200
committerDaniel Borkmann2018-05-23 12:03:34 +0200
commitff4fb475cea8580eb0490d0a5d55ee02d95d26e1 (patch)
tree10cf3d584e25f564d0cbc3653eb428dd21962f1d /tools/lib/bpf/libbpf.c
parentMerge branch 'bpf-fib-mtu-check' (diff)
parentbpf: btf: Add tests for the btf uapi changes (diff)
downloadkernel-qcow2-linux-ff4fb475cea8580eb0490d0a5d55ee02d95d26e1.tar.gz
kernel-qcow2-linux-ff4fb475cea8580eb0490d0a5d55ee02d95d26e1.tar.xz
kernel-qcow2-linux-ff4fb475cea8580eb0490d0a5d55ee02d95d26e1.zip
Merge branch 'btf-uapi-cleanups'
Martin KaFai Lau says: ==================== This patch set makes some changes to cleanup the unused bits in BTF uapi. It also makes the btf_header extensible. Please see individual patches for details. v2: - Remove NR_SECS from patch 2 - Remove "unsigned" check on array->index_type from patch 3 - Remove BTF_INT_VARARGS and further limit BTF_INT_ENCODING from 8 bits to 4 bits in patch 4 - Adjustments in test_btf.c to reflect changes in v2 ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r--tools/lib/bpf/libbpf.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 3dbe217bf23e..8f1707dbfcfa 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -216,8 +216,8 @@ struct bpf_map {
size_t offset;
int map_ifindex;
struct bpf_map_def def;
- uint32_t btf_key_id;
- uint32_t btf_value_id;
+ uint32_t btf_key_type_id;
+ uint32_t btf_value_type_id;
void *priv;
bpf_map_clear_priv_t clear_priv;
};
@@ -1074,8 +1074,8 @@ static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf)
return -EINVAL;
}
- map->btf_key_id = key_id;
- map->btf_value_id = value_id;
+ map->btf_key_type_id = key_id;
+ map->btf_value_type_id = value_id;
return 0;
}
@@ -1100,24 +1100,24 @@ bpf_object__create_maps(struct bpf_object *obj)
create_attr.value_size = def->value_size;
create_attr.max_entries = def->max_entries;
create_attr.btf_fd = 0;
- create_attr.btf_key_id = 0;
- create_attr.btf_value_id = 0;
+ create_attr.btf_key_type_id = 0;
+ create_attr.btf_value_type_id = 0;
if (obj->btf && !bpf_map_find_btf_info(map, obj->btf)) {
create_attr.btf_fd = btf__fd(obj->btf);
- create_attr.btf_key_id = map->btf_key_id;
- create_attr.btf_value_id = map->btf_value_id;
+ create_attr.btf_key_type_id = map->btf_key_type_id;
+ create_attr.btf_value_type_id = map->btf_value_type_id;
}
*pfd = bpf_create_map_xattr(&create_attr);
- if (*pfd < 0 && create_attr.btf_key_id) {
+ if (*pfd < 0 && create_attr.btf_key_type_id) {
pr_warning("Error in bpf_create_map_xattr(%s):%s(%d). Retrying without BTF.\n",
map->name, strerror(errno), errno);
create_attr.btf_fd = 0;
- create_attr.btf_key_id = 0;
- create_attr.btf_value_id = 0;
- map->btf_key_id = 0;
- map->btf_value_id = 0;
+ create_attr.btf_key_type_id = 0;
+ create_attr.btf_value_type_id = 0;
+ map->btf_key_type_id = 0;
+ map->btf_value_type_id = 0;
*pfd = bpf_create_map_xattr(&create_attr);
}
@@ -2085,14 +2085,14 @@ const char *bpf_map__name(struct bpf_map *map)
return map ? map->name : NULL;
}
-uint32_t bpf_map__btf_key_id(const struct bpf_map *map)
+uint32_t bpf_map__btf_key_type_id(const struct bpf_map *map)
{
- return map ? map->btf_key_id : 0;
+ return map ? map->btf_key_type_id : 0;
}
-uint32_t bpf_map__btf_value_id(const struct bpf_map *map)
+uint32_t bpf_map__btf_value_type_id(const struct bpf_map *map)
{
- return map ? map->btf_value_id : 0;
+ return map ? map->btf_value_type_id : 0;
}
int bpf_map__set_priv(struct bpf_map *map, void *priv,