Those files under /proc/net/stat/ don't have vertical alignment, it looks
very difficult. Modify the seq_printf statement, keep vertical alignment.
use seq_puts() instead of seq_printf(), avoid the warning.
Signed-off-by: Yajun Deng <[email protected]>
---
net/core/neighbour.c | 7 ++++---
net/ipv4/route.c | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index c294addb7818..c018a27fc36b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -3315,12 +3315,13 @@ static int neigh_stat_seq_show(struct seq_file *seq, void *v)
struct neigh_statistics *st = v;
if (v == SEQ_START_TOKEN) {
- seq_printf(seq, "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs unresolved_discards table_fulls\n");
+ seq_puts(seq, "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs unresolved_discards table_fulls\n");
return 0;
}
- seq_printf(seq, "%08x %08lx %08lx %08lx %08lx %08lx %08lx "
- "%08lx %08lx %08lx %08lx %08lx %08lx\n",
+ seq_puts(seq, "%08x %08lx %08lx %08lx %08lx %08lx %08lx "
+ "%08lx %08lx %08lx "
+ "%08lx %08lx %08lx\n",
atomic_read(&tbl->entries),
st->allocs,
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 04754d55b3c1..68ca0e4072c1 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -276,12 +276,13 @@ static int rt_cpu_seq_show(struct seq_file *seq, void *v)
struct rt_cache_stat *st = v;
if (v == SEQ_START_TOKEN) {
- seq_printf(seq, "entries in_hit in_slow_tot in_slow_mc in_no_route in_brd in_martian_dst in_martian_src out_hit out_slow_tot out_slow_mc gc_total gc_ignored gc_goal_miss gc_dst_overflow in_hlist_search out_hlist_search\n");
+ seq_puts(seq, "entries in_hit in_slow_tot in_slow_mc in_no_route in_brd in_martian_dst in_martian_src out_hit out_slow_tot out_slow_mc gc_total gc_ignored gc_goal_miss gc_dst_overflow in_hlist_search out_hlist_search\n");
return 0;
}
- seq_printf(seq,"%08x %08x %08x %08x %08x %08x %08x %08x "
- " %08x %08x %08x %08x %08x %08x %08x %08x %08x \n",
+ seq_puts(seq, "%08x %08x %08x %08x %08x %08x %08x "
+ "%08x %08x %08x %08x %08x %08x %08x "
+ "%08x %08x %08x\n",
dst_entries_get_slow(&ipv4_dst_ops),
0, /* st->in_hit */
st->in_slow_tot,
--
2.32.0
Hi Yajun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Yajun-Deng/net-Keep-vertical-alignment/20210802-131102
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git aae950b189413ed3201354600d44223da0bcf63c
config: powerpc-sam440ep_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/895e15bdf966d3c440d9e2e4cc0c9de89d899420
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yajun-Deng/net-Keep-vertical-alignment/20210802-131102
git checkout 895e15bdf966d3c440d9e2e4cc0c9de89d899420
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
net/core/neighbour.c: In function 'neigh_stat_seq_show':
>> net/core/neighbour.c:3322:2: error: too many arguments to function 'seq_puts'
3322 | seq_puts(seq, "%08x %08lx %08lx %08lx %08lx %08lx %08lx "
| ^~~~~~~~
In file included from include/linux/seq_file_net.h:5,
from include/net/net_namespace.h:183,
from include/linux/netdevice.h:37,
from net/core/neighbour.c:22:
include/linux/seq_file.h:120:6: note: declared here
120 | void seq_puts(struct seq_file *m, const char *s);
| ^~~~~~~~
--
net/ipv4/route.c: In function 'rt_cpu_seq_show':
>> net/ipv4/route.c:283:2: error: too many arguments to function 'seq_puts'
283 | seq_puts(seq, "%08x %08x %08x %08x %08x %08x %08x "
| ^~~~~~~~
In file included from include/linux/seq_file_net.h:5,
from include/net/net_namespace.h:183,
from include/linux/inet.h:42,
from net/ipv4/route.c:75:
include/linux/seq_file.h:120:6: note: declared here
120 | void seq_puts(struct seq_file *m, const char *s);
| ^~~~~~~~
net/ipv4/route.c: In function 'ip_rt_send_redirect':
net/ipv4/route.c:863:6: warning: variable 'log_martians' set but not used [-Wunused-but-set-variable]
863 | int log_martians;
| ^~~~~~~~~~~~
vim +/seq_puts +3322 net/core/neighbour.c
3311
3312 static int neigh_stat_seq_show(struct seq_file *seq, void *v)
3313 {
3314 struct neigh_table *tbl = PDE_DATA(file_inode(seq->file));
3315 struct neigh_statistics *st = v;
3316
3317 if (v == SEQ_START_TOKEN) {
3318 seq_puts(seq, "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs unresolved_discards table_fulls\n");
3319 return 0;
3320 }
3321
> 3322 seq_puts(seq, "%08x %08lx %08lx %08lx %08lx %08lx %08lx "
3323 "%08lx %08lx %08lx "
3324 "%08lx %08lx %08lx\n",
3325 atomic_read(&tbl->entries),
3326
3327 st->allocs,
3328 st->destroys,
3329 st->hash_grows,
3330
3331 st->lookups,
3332 st->hits,
3333
3334 st->res_failed,
3335
3336 st->rcv_probes_mcast,
3337 st->rcv_probes_ucast,
3338
3339 st->periodic_gc_runs,
3340 st->forced_gc_runs,
3341 st->unres_discards,
3342 st->table_fulls
3343 );
3344
3345 return 0;
3346 }
3347
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Hi Yajun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Yajun-Deng/net-Keep-vertical-alignment/20210802-131102
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git aae950b189413ed3201354600d44223da0bcf63c
config: x86_64-randconfig-a002-20210802 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/895e15bdf966d3c440d9e2e4cc0c9de89d899420
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yajun-Deng/net-Keep-vertical-alignment/20210802-131102
git checkout 895e15bdf966d3c440d9e2e4cc0c9de89d899420
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=x86_64 SHELL=/bin/bash net/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
>> net/core/neighbour.c:3325:6: error: too many arguments to function call, expected 2, have 15
atomic_read(&tbl->entries),
^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/seq_file.h:120:6: note: 'seq_puts' declared here
void seq_puts(struct seq_file *m, const char *s);
^
1 error generated.
--
>> net/ipv4/route.c:286:6: error: too many arguments to function call, expected 2, have 19
dst_entries_get_slow(&ipv4_dst_ops),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/seq_file.h:120:6: note: 'seq_puts' declared here
void seq_puts(struct seq_file *m, const char *s);
^
1 error generated.
vim +3325 net/core/neighbour.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 3311
^1da177e4c3f41 Linus Torvalds 2005-04-16 3312 static int neigh_stat_seq_show(struct seq_file *seq, void *v)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3313 {
71a5053a41fd8d Christoph Hellwig 2018-04-15 3314 struct neigh_table *tbl = PDE_DATA(file_inode(seq->file));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3315 struct neigh_statistics *st = v;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3316
^1da177e4c3f41 Linus Torvalds 2005-04-16 3317 if (v == SEQ_START_TOKEN) {
895e15bdf966d3 Yajun Deng 2021-08-02 3318 seq_puts(seq, "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs unresolved_discards table_fulls\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 3319 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3320 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3321
895e15bdf966d3 Yajun Deng 2021-08-02 3322 seq_puts(seq, "%08x %08lx %08lx %08lx %08lx %08lx %08lx "
895e15bdf966d3 Yajun Deng 2021-08-02 3323 "%08lx %08lx %08lx "
895e15bdf966d3 Yajun Deng 2021-08-02 3324 "%08lx %08lx %08lx\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 @3325 atomic_read(&tbl->entries),
^1da177e4c3f41 Linus Torvalds 2005-04-16 3326
^1da177e4c3f41 Linus Torvalds 2005-04-16 3327 st->allocs,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3328 st->destroys,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3329 st->hash_grows,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3330
^1da177e4c3f41 Linus Torvalds 2005-04-16 3331 st->lookups,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3332 st->hits,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3333
^1da177e4c3f41 Linus Torvalds 2005-04-16 3334 st->res_failed,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3335
^1da177e4c3f41 Linus Torvalds 2005-04-16 3336 st->rcv_probes_mcast,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3337 st->rcv_probes_ucast,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3338
^1da177e4c3f41 Linus Torvalds 2005-04-16 3339 st->periodic_gc_runs,
9a6d276e85aa3d Neil Horman 2008-07-16 3340 st->forced_gc_runs,
fb811395cd5a71 Rick Jones 2015-08-07 3341 st->unres_discards,
fb811395cd5a71 Rick Jones 2015-08-07 3342 st->table_fulls
^1da177e4c3f41 Linus Torvalds 2005-04-16 3343 );
^1da177e4c3f41 Linus Torvalds 2005-04-16 3344
^1da177e4c3f41 Linus Torvalds 2005-04-16 3345 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3346 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3347
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]