Skip to contentSkip to conversation

bpf: use str_plural() in diag_print_history()

PATCH NAK Lalit Shankar Chowdhury 2 participants 2 messages Sep 17 – Sep 18 BPF

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: use str_plural() in diag_print_history()

Use the string choice helper function to simplify the code.

---
 kernel/bpf/diagnostics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/diagnostics.c +1 -1
index 0abbbe177e31..ff139777ac64 100644
@@ -2354,6 +2354,6 @@ static void diag_print_history(struct bpf_verifier_env *env,
 	if (log->first_seq)
 		diag_write(env, "  %llu older causal-history event%s not retained because diagnostic "
 			   "event storage reached capacity\n",
-			   log->first_seq, log->first_seq == 1 ? "" : "s");
+			   log->first_seq, str_plural(log->first_seq));
 	diag_fmt_restore(env, mark);
 }
Signature · 1 line
2.53.0
#1 lore raw
Quoted 12 lines · Lalit Shankar Chowdhury

Use the string choice helper function to simplify the code.

---
 kernel/bpf/diagnostics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/diagnostics.c +0 -0
index 0abbbe177e31..ff139777ac64 100644

kernel/bpf/diagnostics.c static void diag_print_history(struct bpf_verifier_env *env, · line 2357

Quoted 5 lines
kernel/bpf/diagnostics.c +1 -1
@@ -2354,6 +2354,6 @@ static void diag_print_history(struct bpf_verifier_env *env,
 	if (log->first_seq)
 		diag_write(env, "  %llu older causal-history event%s not retained because diagnostic "
 			   "event storage reached capacity\n",
-			   log->first_seq, log->first_seq == 1 ? "" : "s");
+			   log->first_seq, str_plural(log->first_seq));

Nack.

Instead propose a revert of commit 9ca5facd0400f I will be fully supporitve to delete this obfuscation garbage.

pw-bot: cr