Skip to content

Commit febb6f3

Browse files
name2965anakryiko
authored andcommitted
bpf: Remove __btf_name_valid() and change to btf_name_valid_identifier()
__btf_name_valid() can be completely replaced with btf_name_valid_identifier, and since most of the time you already call btf_name_valid_identifier instead of __btf_name_valid , it would be appropriate to rename the __btf_name_valid function to btf_name_valid_identifier and remove __btf_name_valid. Signed-off-by: Jeongjun Park <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Reviewed-by: Alan Maguire <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 35ec1cd commit febb6f3

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

kernel/bpf/btf.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ const char *btf_str_by_offset(const struct btf *btf, u32 offset)
790790
return NULL;
791791
}
792792

793-
static bool __btf_name_valid(const struct btf *btf, u32 offset)
793+
static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
794794
{
795795
/* offset must be valid */
796796
const char *src = btf_str_by_offset(btf, offset);
@@ -811,11 +811,6 @@ static bool __btf_name_valid(const struct btf *btf, u32 offset)
811811
return !*src;
812812
}
813813

814-
static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
815-
{
816-
return __btf_name_valid(btf, offset);
817-
}
818-
819814
/* Allow any printable character in DATASEC names */
820815
static bool btf_name_valid_section(const struct btf *btf, u32 offset)
821816
{
@@ -4629,7 +4624,7 @@ static s32 btf_var_check_meta(struct btf_verifier_env *env,
46294624
}
46304625

46314626
if (!t->name_off ||
4632-
!__btf_name_valid(env->btf, t->name_off)) {
4627+
!btf_name_valid_identifier(env->btf, t->name_off)) {
46334628
btf_verifier_log_type(env, t, "Invalid name");
46344629
return -EINVAL;
46354630
}

0 commit comments

Comments
 (0)