Skip to content

Commit 698584d

Browse files
DanielTimLeeborkmann
authored andcommitted
samples, bpf: Replace bpf_program__title() with bpf_program__section_name()
From commit 5210958 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name""), the term title has been replaced with section name in libbpf. Since the bpf_program__title() has been deprecated, this commit switches this function to bpf_program__section_name(). Due to this commit, the compilation warning issue has also been resolved. Fixes: 5210958 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"") Signed-off-by: Daniel T. Lee <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 8eb6295 commit 698584d

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

samples/bpf/sockex3_user.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ int main(int argc, char **argv)
2929
struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
3030
struct bpf_program *prog;
3131
struct bpf_object *obj;
32+
const char *section;
3233
char filename[256];
33-
const char *title;
3434
FILE *f;
3535

3636
snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
@@ -58,8 +58,8 @@ int main(int argc, char **argv)
5858
bpf_object__for_each_program(prog, obj) {
5959
fd = bpf_program__fd(prog);
6060

61-
title = bpf_program__title(prog, false);
62-
if (sscanf(title, "socket/%d", &key) != 1) {
61+
section = bpf_program__section_name(prog);
62+
if (sscanf(section, "socket/%d", &key) != 1) {
6363
fprintf(stderr, "ERROR: finding prog failed\n");
6464
goto cleanup;
6565
}

samples/bpf/spintest_user.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int main(int ac, char **argv)
1717
long key, next_key, value;
1818
struct bpf_program *prog;
1919
int map_fd, i, j = 0;
20-
const char *title;
20+
const char *section;
2121
struct ksym *sym;
2222

2323
if (setrlimit(RLIMIT_MEMLOCK, &r)) {
@@ -51,8 +51,8 @@ int main(int ac, char **argv)
5151
}
5252

5353
bpf_object__for_each_program(prog, obj) {
54-
title = bpf_program__title(prog, false);
55-
if (sscanf(title, "kprobe/%s", symbol) != 1)
54+
section = bpf_program__section_name(prog);
55+
if (sscanf(section, "kprobe/%s", symbol) != 1)
5656
continue;
5757

5858
/* Attach prog only when symbol exists */

samples/bpf/tracex5_user.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ int main(int ac, char **argv)
3939
struct bpf_program *prog;
4040
struct bpf_object *obj;
4141
int key, fd, progs_fd;
42+
const char *section;
4243
char filename[256];
43-
const char *title;
4444
FILE *f;
4545

4646
setrlimit(RLIMIT_MEMLOCK, &r);
@@ -78,9 +78,9 @@ int main(int ac, char **argv)
7878
}
7979

8080
bpf_object__for_each_program(prog, obj) {
81-
title = bpf_program__title(prog, false);
81+
section = bpf_program__section_name(prog);
8282
/* register only syscalls to PROG_ARRAY */
83-
if (sscanf(title, "kprobe/%d", &key) != 1)
83+
if (sscanf(section, "kprobe/%d", &key) != 1)
8484
continue;
8585

8686
fd = bpf_program__fd(prog);

samples/bpf/xdp_redirect_cpu_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static void print_avail_progs(struct bpf_object *obj)
111111

112112
bpf_object__for_each_program(pos, obj) {
113113
if (bpf_program__is_xdp(pos))
114-
printf(" %s\n", bpf_program__title(pos, false));
114+
printf(" %s\n", bpf_program__section_name(pos));
115115
}
116116
}
117117

0 commit comments

Comments
 (0)