bpf: Remove __btf_name_valid() and change to btf_name_valid_identifier()

JIRA: https://issues.redhat.com/browse/RHEL-63880

commit febb6f3e3ac196602cca5738d8a189d57392324a
Author: Jeongjun Park <aha310510@gmail.com>
Date:   Wed Aug 7 23:31:10 2024 +0900

    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 <aha310510@gmail.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
    Link: https://lore.kernel.org/bpf/20240807143110.181497-1-aha310510@gmail.com

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
Jerome Marchand 2024-12-18 11:58:09 +01:00
parent a3f363eda2
commit b082ad8cdb
1 changed files with 2 additions and 7 deletions

View File

@ -789,7 +789,7 @@ const char *btf_str_by_offset(const struct btf *btf, u32 offset)
return NULL;
}
static bool __btf_name_valid(const struct btf *btf, u32 offset)
static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
{
/* offset must be valid */
const char *src = btf_str_by_offset(btf, offset);
@ -810,11 +810,6 @@ static bool __btf_name_valid(const struct btf *btf, u32 offset)
return !*src;
}
static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
{
return __btf_name_valid(btf, offset);
}
/* Allow any printable character in DATASEC names */
static bool btf_name_valid_section(const struct btf *btf, u32 offset)
{
@ -4636,7 +4631,7 @@ static s32 btf_var_check_meta(struct btf_verifier_env *env,
}
if (!t->name_off ||
!__btf_name_valid(env->btf, t->name_off)) {
!btf_name_valid_identifier(env->btf, t->name_off)) {
btf_verifier_log_type(env, t, "Invalid name");
return -EINVAL;
}