* [PATCH v1] libbpf: remove unused args in parse_usdt_note
@ 2025-09-04 3:05 Jiawei Zhao
2025-09-04 5:30 ` Yonghong Song
2025-09-04 18:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jiawei Zhao @ 2025-09-04 3:05 UTC (permalink / raw)
To: ast; +Cc: daniel, andrii, yonghong.song, bpf, linux-kselftest, linux-kernel
Remove unused 'elf' and 'path' parameters from parse_usdt_note function
signature. These parameters are not referenced within the function body
and only add unnecessary complexity.
The function only requires the note header, data buffer, offsets, and
output structure to perform USDT note parsing.
Update function declaration, definition, and the single call site in
collect_usdt_targets() to match the simplified signature.
This is a safe internal cleanup as parse_usdt_note is a static function.
Signed-off-by: Jiawei Zhao <phoenix500526@163.com>
---
tools/lib/bpf/usdt.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
index e5eeac0b0fa4..deaea4bd13a6 100644
--- a/tools/lib/bpf/usdt.c
+++ b/tools/lib/bpf/usdt.c
@@ -581,9 +581,8 @@ static struct elf_seg *find_vma_seg(struct elf_seg *segs, size_t seg_cnt, long o
return NULL;
}
-static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,
- const char *data, size_t name_off, size_t desc_off,
- struct usdt_note *usdt_note);
+static int parse_usdt_note(GElf_Nhdr *nhdr, const char *data, size_t name_off,
+ size_t desc_off, struct usdt_note *usdt_note);
static int parse_usdt_spec(struct usdt_spec *spec, const struct usdt_note *note, __u64 usdt_cookie);
@@ -637,7 +636,7 @@ static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char *
struct elf_seg *seg = NULL;
void *tmp;
- err = parse_usdt_note(elf, path, &nhdr, data->d_buf, name_off, desc_off, ¬e);
+ err = parse_usdt_note(&nhdr, data->d_buf, name_off, desc_off, ¬e);
if (err)
goto err_out;
@@ -1143,8 +1142,7 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct
/* Parse out USDT ELF note from '.note.stapsdt' section.
* Logic inspired by perf's code.
*/
-static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,
- const char *data, size_t name_off, size_t desc_off,
+static int parse_usdt_note(GElf_Nhdr *nhdr, const char *data, size_t name_off, size_t desc_off,
struct usdt_note *note)
{
const char *provider, *name, *args;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] libbpf: remove unused args in parse_usdt_note
2025-09-04 3:05 [PATCH v1] libbpf: remove unused args in parse_usdt_note Jiawei Zhao
@ 2025-09-04 5:30 ` Yonghong Song
2025-09-04 18:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2025-09-04 5:30 UTC (permalink / raw)
To: Jiawei Zhao, ast; +Cc: daniel, andrii, bpf, linux-kselftest, linux-kernel
On 9/3/25 8:05 PM, Jiawei Zhao wrote:
> Remove unused 'elf' and 'path' parameters from parse_usdt_note function
> signature. These parameters are not referenced within the function body
> and only add unnecessary complexity.
>
> The function only requires the note header, data buffer, offsets, and
> output structure to perform USDT note parsing.
>
> Update function declaration, definition, and the single call site in
> collect_usdt_targets() to match the simplified signature.
>
> This is a safe internal cleanup as parse_usdt_note is a static function.
>
> Signed-off-by: Jiawei Zhao <phoenix500526@163.com>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] libbpf: remove unused args in parse_usdt_note
2025-09-04 3:05 [PATCH v1] libbpf: remove unused args in parse_usdt_note Jiawei Zhao
2025-09-04 5:30 ` Yonghong Song
@ 2025-09-04 18:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-04 18:40 UTC (permalink / raw)
To: Jiawei Zhao
Cc: ast, daniel, andrii, yonghong.song, bpf, linux-kselftest,
linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Thu, 4 Sep 2025 03:05:23 +0000 you wrote:
> Remove unused 'elf' and 'path' parameters from parse_usdt_note function
> signature. These parameters are not referenced within the function body
> and only add unnecessary complexity.
>
> The function only requires the note header, data buffer, offsets, and
> output structure to perform USDT note parsing.
>
> [...]
Here is the summary with links:
- [v1] libbpf: remove unused args in parse_usdt_note
https://git.kernel.org/bpf/bpf-next/c/b338cf849ec8
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:[~2025-09-04 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 3:05 [PATCH v1] libbpf: remove unused args in parse_usdt_note Jiawei Zhao
2025-09-04 5:30 ` Yonghong Song
2025-09-04 18:40 ` 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