Skip to content

Commit 0ee352f

Browse files
Jinghao JiaAlexei Starovoitov
authored andcommitted
samples/bpf: syscall_tp_user: Rename num_progs into nr_tests
The variable name num_progs causes confusion because that variable really controls the number of rounds the test should be executed. Rename num_progs into nr_tests for the sake of clarity. Signed-off-by: Jinghao Jia <jinghao@linux.ibm.com> Signed-off-by: Ruowen Qin <ruowenq2@illinois.edu> Signed-off-by: Jinghao Jia <jinghao7@illinois.edu> Link: https://lore.kernel.org/r/20230917214220.637721-3-jinghao7@illinois.edu Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent cf67d28 commit 0ee352f

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

samples/bpf/syscall_tp_user.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
static void usage(const char *cmd)
1919
{
20-
printf("USAGE: %s [-i num_progs] [-h]\n", cmd);
21-
printf(" -i num_progs # number of progs of the test\n");
22-
printf(" -h # help\n");
20+
printf("USAGE: %s [-i nr_tests] [-h]\n", cmd);
21+
printf(" -i nr_tests # rounds of test to run\n");
22+
printf(" -h # help\n");
2323
}
2424

2525
static void verify_map(int map_id)
@@ -45,14 +45,14 @@ static void verify_map(int map_id)
4545
}
4646
}
4747

48-
static int test(char *filename, int num_progs)
48+
static int test(char *filename, int nr_tests)
4949
{
50-
int map0_fds[num_progs], map1_fds[num_progs], fd, i, j = 0;
51-
struct bpf_link *links[num_progs * 4];
52-
struct bpf_object *objs[num_progs];
50+
int map0_fds[nr_tests], map1_fds[nr_tests], fd, i, j = 0;
51+
struct bpf_link *links[nr_tests * 4];
52+
struct bpf_object *objs[nr_tests];
5353
struct bpf_program *prog;
5454

55-
for (i = 0; i < num_progs; i++) {
55+
for (i = 0; i < nr_tests; i++) {
5656
objs[i] = bpf_object__open_file(filename, NULL);
5757
if (libbpf_get_error(objs[i])) {
5858
fprintf(stderr, "opening BPF object file failed\n");
@@ -101,7 +101,7 @@ static int test(char *filename, int num_progs)
101101
close(fd);
102102

103103
/* verify the map */
104-
for (i = 0; i < num_progs; i++) {
104+
for (i = 0; i < nr_tests; i++) {
105105
verify_map(map0_fds[i]);
106106
verify_map(map1_fds[i]);
107107
}
@@ -117,13 +117,13 @@ static int test(char *filename, int num_progs)
117117

118118
int main(int argc, char **argv)
119119
{
120-
int opt, num_progs = 1;
120+
int opt, nr_tests = 1;
121121
char filename[256];
122122

123123
while ((opt = getopt(argc, argv, "i:h")) != -1) {
124124
switch (opt) {
125125
case 'i':
126-
num_progs = atoi(optarg);
126+
nr_tests = atoi(optarg);
127127
break;
128128
case 'h':
129129
default:
@@ -134,5 +134,5 @@ int main(int argc, char **argv)
134134

135135
snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
136136

137-
return test(filename, num_progs);
137+
return test(filename, nr_tests);
138138
}

0 commit comments

Comments
 (0)