Skip to content

Commit 173c57b

Browse files
elfringanakryiko
authored andcommitted
bpf: Replace 8 seq_puts() calls by seq_putc() calls
Single line breaks should occasionally be put into a sequence. Thus use the corresponding function “seq_putc”. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent b037f33 commit 173c57b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

kernel/bpf/arraymap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static void array_map_seq_show_elem(struct bpf_map *map, void *key,
494494
if (map->btf_key_type_id)
495495
seq_printf(m, "%u: ", *(u32 *)key);
496496
btf_type_seq_show(map->btf, map->btf_value_type_id, value, m);
497-
seq_puts(m, "\n");
497+
seq_putc(m, '\n');
498498

499499
rcu_read_unlock();
500500
}
@@ -515,7 +515,7 @@ static void percpu_array_map_seq_show_elem(struct bpf_map *map, void *key,
515515
seq_printf(m, "\tcpu%d: ", cpu);
516516
btf_type_seq_show(map->btf, map->btf_value_type_id,
517517
per_cpu_ptr(pptr, cpu), m);
518-
seq_puts(m, "\n");
518+
seq_putc(m, '\n');
519519
}
520520
seq_puts(m, "}\n");
521521

@@ -993,7 +993,7 @@ static void prog_array_map_seq_show_elem(struct bpf_map *map, void *key,
993993
prog_id = prog_fd_array_sys_lookup_elem(ptr);
994994
btf_type_seq_show(map->btf, map->btf_value_type_id,
995995
&prog_id, m);
996-
seq_puts(m, "\n");
996+
seq_putc(m, '\n');
997997
}
998998
}
999999

kernel/bpf/bpf_struct_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ static void bpf_struct_ops_map_seq_show_elem(struct bpf_map *map, void *key,
837837
btf_type_seq_show(st_map->btf,
838838
map->btf_vmlinux_value_type_id,
839839
value, m);
840-
seq_puts(m, "\n");
840+
seq_putc(m, '\n');
841841
}
842842

843843
kfree(value);

kernel/bpf/hashtab.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ static void htab_map_seq_show_elem(struct bpf_map *map, void *key,
15861586
btf_type_seq_show(map->btf, map->btf_key_type_id, key, m);
15871587
seq_puts(m, ": ");
15881588
btf_type_seq_show(map->btf, map->btf_value_type_id, value, m);
1589-
seq_puts(m, "\n");
1589+
seq_putc(m, '\n');
15901590

15911591
rcu_read_unlock();
15921592
}
@@ -2450,7 +2450,7 @@ static void htab_percpu_map_seq_show_elem(struct bpf_map *map, void *key,
24502450
seq_printf(m, "\tcpu%d: ", cpu);
24512451
btf_type_seq_show(map->btf, map->btf_value_type_id,
24522452
per_cpu_ptr(pptr, cpu), m);
2453-
seq_puts(m, "\n");
2453+
seq_putc(m, '\n');
24542454
}
24552455
seq_puts(m, "}\n");
24562456

kernel/bpf/local_storage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,15 @@ static void cgroup_storage_seq_show_elem(struct bpf_map *map, void *key,
431431
seq_puts(m, ": ");
432432
btf_type_seq_show(map->btf, map->btf_value_type_id,
433433
&READ_ONCE(storage->buf)->data[0], m);
434-
seq_puts(m, "\n");
434+
seq_putc(m, '\n');
435435
} else {
436436
seq_puts(m, ": {\n");
437437
for_each_possible_cpu(cpu) {
438438
seq_printf(m, "\tcpu%d: ", cpu);
439439
btf_type_seq_show(map->btf, map->btf_value_type_id,
440440
per_cpu_ptr(storage->percpu_buf, cpu),
441441
m);
442-
seq_puts(m, "\n");
442+
seq_putc(m, '\n');
443443
}
444444
seq_puts(m, "}\n");
445445
}

0 commit comments

Comments
 (0)