aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/syscall.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2018-05-22 17:57:21 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-05-23 06:03:32 -0400
commit9b2cf328b2eccf761537a06bef914d2a0700fba7 (patch)
tree136dc187e3f62e0becbe0a5c8271e02fe522696d /kernel/bpf/syscall.c
parentaea2f7b8911617d7a8c23fb73d69e78764f91b58 (diff)
bpf: btf: Rename btf_key_id and btf_value_id in bpf_map_info
In "struct bpf_map_info", the name "btf_id", "btf_key_id" and "btf_value_id" could cause confusion because the "id" of "btf_id" means the BPF obj id given to the BTF object while "btf_key_id" and "btf_value_id" means the BTF type id within that BTF object. To make it clear, btf_key_id and btf_value_id are renamed to btf_key_type_id and btf_value_type_id. Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r--kernel/bpf/syscall.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 2b29ef84ded3..0b4c94551001 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -422,7 +422,7 @@ static int bpf_obj_name_cpy(char *dst, const char *src)
422 return 0; 422 return 0;
423} 423}
424 424
425#define BPF_MAP_CREATE_LAST_FIELD btf_value_id 425#define BPF_MAP_CREATE_LAST_FIELD btf_value_type_id
426/* called via syscall */ 426/* called via syscall */
427static int map_create(union bpf_attr *attr) 427static int map_create(union bpf_attr *attr)
428{ 428{
@@ -457,10 +457,10 @@ static int map_create(union bpf_attr *attr)
457 atomic_set(&map->usercnt, 1); 457 atomic_set(&map->usercnt, 1);
458 458
459 if (bpf_map_support_seq_show(map) && 459 if (bpf_map_support_seq_show(map) &&
460 (attr->btf_key_id || attr->btf_value_id)) { 460 (attr->btf_key_type_id || attr->btf_value_type_id)) {
461 struct btf *btf; 461 struct btf *btf;
462 462
463 if (!attr->btf_key_id || !attr->btf_value_id) { 463 if (!attr->btf_key_type_id || !attr->btf_value_type_id) {
464 err = -EINVAL; 464 err = -EINVAL;
465 goto free_map_nouncharge; 465 goto free_map_nouncharge;
466 } 466 }
@@ -471,16 +471,16 @@ static int map_create(union bpf_attr *attr)
471 goto free_map_nouncharge; 471 goto free_map_nouncharge;
472 } 472 }
473 473
474 err = map->ops->map_check_btf(map, btf, attr->btf_key_id, 474 err = map->ops->map_check_btf(map, btf, attr->btf_key_type_id,
475 attr->btf_value_id); 475 attr->btf_value_type_id);
476 if (err) { 476 if (err) {
477 btf_put(btf); 477 btf_put(btf);
478 goto free_map_nouncharge; 478 goto free_map_nouncharge;
479 } 479 }
480 480
481 map->btf = btf; 481 map->btf = btf;
482 map->btf_key_id = attr->btf_key_id; 482 map->btf_key_type_id = attr->btf_key_type_id;
483 map->btf_value_id = attr->btf_value_id; 483 map->btf_value_type_id = attr->btf_value_type_id;
484 } 484 }
485 485
486 err = security_bpf_map_alloc(map); 486 err = security_bpf_map_alloc(map);
@@ -2013,8 +2013,8 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map,
2013 2013
2014 if (map->btf) { 2014 if (map->btf) {
2015 info.btf_id = btf_id(map->btf); 2015 info.btf_id = btf_id(map->btf);
2016 info.btf_key_id = map->btf_key_id; 2016 info.btf_key_type_id = map->btf_key_type_id;
2017 info.btf_value_id = map->btf_value_id; 2017 info.btf_value_type_id = map->btf_value_type_id;
2018 } 2018 }
2019 2019
2020 if (bpf_map_is_dev_bound(map)) { 2020 if (bpf_map_is_dev_bound(map)) {