Commit cdec2685 authored by simran singhal's avatar simran singhal Committed by Pablo Neira Ayuso

netfilter: Use seq_puts()/seq_putc() where possible

For string without format specifiers, use seq_puts(). For
seq_printf("\n"), use seq_putc('\n').
Signed-off-by: default avatarsimran singhal <singhalsimran0@gmail.com>
Acked-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 68ad546a
...@@ -2130,8 +2130,8 @@ static int ip_vs_stats_show(struct seq_file *seq, void *v) ...@@ -2130,8 +2130,8 @@ static int ip_vs_stats_show(struct seq_file *seq, void *v)
/* 01234567 01234567 01234567 0123456701234567 0123456701234567 */ /* 01234567 01234567 01234567 0123456701234567 0123456701234567 */
seq_puts(seq, seq_puts(seq,
" Total Incoming Outgoing Incoming Outgoing\n"); " Total Incoming Outgoing Incoming Outgoing\n");
seq_printf(seq, seq_puts(seq,
" Conns Packets Packets Bytes Bytes\n"); " Conns Packets Packets Bytes Bytes\n");
ip_vs_copy_stats(&show, &net_ipvs(net)->tot_stats); ip_vs_copy_stats(&show, &net_ipvs(net)->tot_stats);
seq_printf(seq, "%8LX %8LX %8LX %16LX %16LX\n\n", seq_printf(seq, "%8LX %8LX %8LX %16LX %16LX\n\n",
...@@ -2178,8 +2178,8 @@ static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) ...@@ -2178,8 +2178,8 @@ static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v)
/* 01234567 01234567 01234567 0123456701234567 0123456701234567 */ /* 01234567 01234567 01234567 0123456701234567 0123456701234567 */
seq_puts(seq, seq_puts(seq,
" Total Incoming Outgoing Incoming Outgoing\n"); " Total Incoming Outgoing Incoming Outgoing\n");
seq_printf(seq, seq_puts(seq,
"CPU Conns Packets Packets Bytes Bytes\n"); "CPU Conns Packets Packets Bytes Bytes\n");
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
struct ip_vs_cpu_stats *u = per_cpu_ptr(cpustats, i); struct ip_vs_cpu_stats *u = per_cpu_ptr(cpustats, i);
......
...@@ -549,7 +549,7 @@ static int exp_seq_show(struct seq_file *s, void *v) ...@@ -549,7 +549,7 @@ static int exp_seq_show(struct seq_file *s, void *v)
seq_printf(s, "%ld ", timer_pending(&expect->timeout) seq_printf(s, "%ld ", timer_pending(&expect->timeout)
? (long)(expect->timeout.expires - jiffies)/HZ : 0); ? (long)(expect->timeout.expires - jiffies)/HZ : 0);
else else
seq_printf(s, "- "); seq_puts(s, "- ");
seq_printf(s, "l3proto = %u proto=%u ", seq_printf(s, "l3proto = %u proto=%u ",
expect->tuple.src.l3num, expect->tuple.src.l3num,
expect->tuple.dst.protonum); expect->tuple.dst.protonum);
...@@ -559,7 +559,7 @@ static int exp_seq_show(struct seq_file *s, void *v) ...@@ -559,7 +559,7 @@ static int exp_seq_show(struct seq_file *s, void *v)
expect->tuple.dst.protonum)); expect->tuple.dst.protonum));
if (expect->flags & NF_CT_EXPECT_PERMANENT) { if (expect->flags & NF_CT_EXPECT_PERMANENT) {
seq_printf(s, "PERMANENT"); seq_puts(s, "PERMANENT");
delim = ","; delim = ",";
} }
if (expect->flags & NF_CT_EXPECT_INACTIVE) { if (expect->flags & NF_CT_EXPECT_INACTIVE) {
......
...@@ -250,7 +250,7 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -250,7 +250,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
goto release; goto release;
if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status)))
seq_printf(s, "[UNREPLIED] "); seq_puts(s, "[UNREPLIED] ");
print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
l3proto, l4proto); l3proto, l4proto);
...@@ -261,7 +261,7 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -261,7 +261,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
goto release; goto release;
if (test_bit(IPS_ASSURED_BIT, &ct->status)) if (test_bit(IPS_ASSURED_BIT, &ct->status))
seq_printf(s, "[ASSURED] "); seq_puts(s, "[ASSURED] ");
if (seq_has_overflowed(s)) if (seq_has_overflowed(s))
goto release; goto release;
...@@ -350,7 +350,7 @@ static int ct_cpu_seq_show(struct seq_file *seq, void *v) ...@@ -350,7 +350,7 @@ static int ct_cpu_seq_show(struct seq_file *seq, void *v)
const struct ip_conntrack_stat *st = v; const struct ip_conntrack_stat *st = v;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete search_restart\n"); seq_puts(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete search_restart\n");
return 0; return 0;
} }
......
...@@ -376,13 +376,13 @@ static int seq_show(struct seq_file *s, void *v) ...@@ -376,13 +376,13 @@ static int seq_show(struct seq_file *s, void *v)
logger = nft_log_dereference(loggers[*pos][i]); logger = nft_log_dereference(loggers[*pos][i]);
seq_printf(s, "%s", logger->name); seq_printf(s, "%s", logger->name);
if (i == 0 && loggers[*pos][i + 1] != NULL) if (i == 0 && loggers[*pos][i + 1] != NULL)
seq_printf(s, ","); seq_puts(s, ",");
if (seq_has_overflowed(s)) if (seq_has_overflowed(s))
return -ENOSPC; return -ENOSPC;
} }
seq_printf(s, ")\n"); seq_puts(s, ")\n");
if (seq_has_overflowed(s)) if (seq_has_overflowed(s))
return -ENOSPC; return -ENOSPC;
......
...@@ -287,9 +287,9 @@ static int synproxy_cpu_seq_show(struct seq_file *seq, void *v) ...@@ -287,9 +287,9 @@ static int synproxy_cpu_seq_show(struct seq_file *seq, void *v)
struct synproxy_stats *stats = v; struct synproxy_stats *stats = v;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_printf(seq, "entries\t\tsyn_received\t" seq_puts(seq, "entries\t\tsyn_received\t"
"cookie_invalid\tcookie_valid\t" "cookie_invalid\tcookie_valid\t"
"cookie_retrans\tconn_reopened\n"); "cookie_retrans\tconn_reopened\n");
return 0; return 0;
} }
......
...@@ -532,7 +532,7 @@ static int recent_seq_show(struct seq_file *seq, void *v) ...@@ -532,7 +532,7 @@ static int recent_seq_show(struct seq_file *seq, void *v)
&e->addr.in6, e->ttl, e->stamps[i], e->index); &e->addr.in6, e->ttl, e->stamps[i], e->index);
for (i = 0; i < e->nstamps; i++) for (i = 0; i < e->nstamps; i++)
seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]); seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]);
seq_printf(seq, "\n"); seq_putc(seq, '\n');
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment