Skip to content

Commit b338cf8

Browse files
Phoenix500526anakryiko
authored andcommitted
libbpf: Remove unused args in parse_usdt_note
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 <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 2d92ef7 commit b338cf8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tools/lib/bpf/usdt.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,8 @@ static struct elf_seg *find_vma_seg(struct elf_seg *segs, size_t seg_cnt, long o
581581
return NULL;
582582
}
583583

584-
static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,
585-
const char *data, size_t name_off, size_t desc_off,
586-
struct usdt_note *usdt_note);
584+
static int parse_usdt_note(GElf_Nhdr *nhdr, const char *data, size_t name_off,
585+
size_t desc_off, struct usdt_note *usdt_note);
587586

588587
static int parse_usdt_spec(struct usdt_spec *spec, const struct usdt_note *note, __u64 usdt_cookie);
589588

@@ -637,7 +636,7 @@ static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char *
637636
struct elf_seg *seg = NULL;
638637
void *tmp;
639638

640-
err = parse_usdt_note(elf, path, &nhdr, data->d_buf, name_off, desc_off, &note);
639+
err = parse_usdt_note(&nhdr, data->d_buf, name_off, desc_off, &note);
641640
if (err)
642641
goto err_out;
643642

@@ -1143,8 +1142,7 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct
11431142
/* Parse out USDT ELF note from '.note.stapsdt' section.
11441143
* Logic inspired by perf's code.
11451144
*/
1146-
static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,
1147-
const char *data, size_t name_off, size_t desc_off,
1145+
static int parse_usdt_note(GElf_Nhdr *nhdr, const char *data, size_t name_off, size_t desc_off,
11481146
struct usdt_note *note)
11491147
{
11501148
const char *provider, *name, *args;

0 commit comments

Comments
 (0)