BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: remove __btf_name_valid() and change to btf_name_valid_identifier()
@ 2024-08-07 14:31 Jeongjun Park
  2024-08-07 16:53 ` Alan Maguire
  2024-08-15 23:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jeongjun Park @ 2024-08-07 14:31 UTC (permalink / raw)
  To: martin.lau
  Cc: ast, daniel, andrii, eddyz87, song, yonghong.song, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, bpf, linux-kernel, Jeongjun Park

__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>
---
 kernel/bpf/btf.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 520f49f422fe..674b38c33c74 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -790,7 +790,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);
@@ -811,11 +811,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)
 {
@@ -4629,7 +4624,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;
 	}
--

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: remove __btf_name_valid() and change to btf_name_valid_identifier()
  2024-08-07 14:31 [PATCH bpf-next] bpf: remove __btf_name_valid() and change to btf_name_valid_identifier() Jeongjun Park
@ 2024-08-07 16:53 ` Alan Maguire
  2024-08-15 23:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Maguire @ 2024-08-07 16:53 UTC (permalink / raw)
  To: Jeongjun Park, martin.lau
  Cc: ast, daniel, andrii, eddyz87, song, yonghong.song, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, bpf, linux-kernel

On 07/08/2024 15:31, Jeongjun Park wrote:
> __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>

Looks good to me

Reviewed-by: Alan Maguire <alan.maguire@oracle.com>

> ---
>  kernel/bpf/btf.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: remove __btf_name_valid() and change to btf_name_valid_identifier()
  2024-08-07 14:31 [PATCH bpf-next] bpf: remove __btf_name_valid() and change to btf_name_valid_identifier() Jeongjun Park
  2024-08-07 16:53 ` Alan Maguire
@ 2024-08-15 23:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-15 23:00 UTC (permalink / raw)
  To: Jeongjun Park
  Cc: martin.lau, ast, daniel, andrii, eddyz87, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Wed,  7 Aug 2024 23:31:10 +0900 you wrote:
> __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>
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf: remove __btf_name_valid() and change to btf_name_valid_identifier()
    https://git.kernel.org/bpf/bpf-next/c/febb6f3e3ac1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-15 23:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 14:31 [PATCH bpf-next] bpf: remove __btf_name_valid() and change to btf_name_valid_identifier() Jeongjun Park
2024-08-07 16:53 ` Alan Maguire
2024-08-15 23:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox