Staging: lustre: obdclass: Use seq_puts/seq_putc
PATCH 1/1 Staging: lustre: obdclass: Use seq_puts/seq_putc
This patch converts the seq_printf output with constant strings to seq_puts and also use seq_putc for seq_printf(...,"\n"). Done using coccinelle:
@@
identifier a;
constant b;
@@
(
- seq_printf(a,"\n");
+ seq_putc(a,'\n');
|
- seq_printf(a,b);
+ seq_puts(a,b);
)
--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 10 +++++----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 17 ++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-)
drivers/staging/lustre/lustre/obdclass/cl_object.c +5 -5
@@ -462,19 +462,19 @@ locks: ...... ...... ...... ...... ...... [...... ...... ...... ...... ......]*/ lu_site_stats_print (&site->cs_lu, m);cache_stats_print (&site->cs_pages, m,1 ); -seq_printf (m," [" ); +seq_puts (m," [" );for (i =0 ; i <ARRAY_SIZE (site->cs_pages_state); ++i)seq_printf (m,"%s: %u " , pstate[i],atomic_read (&site->cs_pages_state[i])); -seq_printf (m,"]\n" ); +seq_puts (m,"]\n" );cache_stats_print (&site->cs_locks, m,0 ); -seq_printf (m," [" ); +seq_puts (m," [" );for (i =0 ; i <ARRAY_SIZE (site->cs_locks_state); ++i)seq_printf (m,"%s: %u " , lstate[i],atomic_read (&site->cs_locks_state[i])); -seq_printf (m,"]\n" ); +seq_puts (m,"]\n" );cache_stats_print (&cl_env_stats, m,0 ); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }EXPORT_SYMBOL (cl_site_stats_print);
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +6 -11
@@ -584,7 +584,7 @@ static int obd_import_flags2str(struct obd_import *imp, struct seq_file *m)bool first = true;if (imp->imp_obd->obd_no_recov) { -seq_printf (m,"no_recov" ); +seq_puts (m,"no_recov" ); first = false; }
@@ -648,15 +648,10 @@ int lprocfs_rd_import(struct seq_file *m, void *data)ptlrpc_import_state_name (imp->imp_state), imp->imp_connect_data.ocd_instance);obd_connect_seq_flags2str (m, imp->imp_connect_data.ocd_connect_flags,", " ); -seq_printf (m, -" ]\n" -" import_flags: [ " ); +seq_puts (m," ]\n import_flags: [ " );obd_import_flags2str (imp, m); -seq_printf (m, -" ]\n" -" connection:\n" -" failover_nids: [ " ); +seq_puts (m," ]\n connection:\n failover_nids: [ " );spin_lock (&imp->imp_lock); j =0 ;list_for_each_entry (conn, &imp->imp_conn_list, oic_item) {
@@ -788,7 +783,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data)seq_printf (m,"current_state: %s\n" ,ptlrpc_import_state_name (imp->imp_state)); -seq_printf (m,"state_history:\n" ); +seq_puts (m,"state_history:\n" ); k = imp->imp_state_hist_idx;for (j =0 ; j <IMP_STATE_HIST_LEN ; j++) { struct import_state_hist *ish =
@@ -810,7 +805,7 @@ int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at)for (i =0 ; i <AT_BINS ; i++)seq_printf (m,"%3u " , at->at_hist[i]); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }EXPORT_SYMBOL (lprocfs_at_hist_helper);
@@ -878,7 +873,7 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags;seq_printf (m,"flags=%#llx\n" , flags);obd_connect_seq_flags2str (m, flags,"\n" ); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );up_read (&obd->u.cli.cl_sem);return 0 ; }
Signature · 1 line
1.9.1
Quoted 4 lines · Bhumika Goyal
This patch converts the
seq_printfoutput with constant strings toseq_putsand also useseq_putcforseq_printf(...,"\n"). Done using coccinelle:
Quoted 10 lines
@@
identifier a;
constant b;
@@
(
-seq_printf(a,"\n");
+seq_putc(a,'\n');
|
-seq_printf(a,b);
+seq_puts(a,b);
You sem to get a good nmber of results with the first argument being an identifier, but I'm not sure why that has to be the case. Unless you see a reason not to, you could allow it to be an expression. Note that even a->b is not an identifier. It is an expression. An identifier is only a single word.
julia
Quoted 105 lines
)
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 10 +++++----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 17 ++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-)drivers/staging/lustre/lustre/obdclass/cl_object.c +5
-5@@ -462,19 +462,19 @@ locks: ...... ...... ...... ...... ...... [...... ...... ...... ...... ......]*/ lu_site_stats_print (&site->cs_lu, m);cache_stats_print (&site->cs_pages, m,1 ); -seq_printf (m," [" ); +seq_puts (m," [" );for (i =0 ; i <ARRAY_SIZE (site->cs_pages_state); ++i)seq_printf (m,"%s: %u " , pstate[i],atomic_read (&site->cs_pages_state[i])); -seq_printf (m,"]\n" ); +seq_puts (m,"]\n" );cache_stats_print (&site->cs_locks, m,0 ); -seq_printf (m," [" ); +seq_puts (m," [" );for (i =0 ; i <ARRAY_SIZE (site->cs_locks_state); ++i)seq_printf (m,"%s: %u " , lstate[i],atomic_read (&site->cs_locks_state[i])); -seq_printf (m,"]\n" ); +seq_puts (m,"]\n" );cache_stats_print (&cl_env_stats, m,0 ); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }EXPORT_SYMBOL (cl_site_stats_print);drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +6
-11@@ -584,7 +584,7 @@ static int obd_import_flags2str(struct obd_import *imp, struct seq_file *m)bool first = true;if (imp->imp_obd->obd_no_recov) { -seq_printf (m,"no_recov" ); +seq_puts (m,"no_recov" ); first = false; }@@ -648,15 +648,10 @@ int lprocfs_rd_import(struct seq_file *m, void *data)ptlrpc_import_state_name (imp->imp_state), imp->imp_connect_data.ocd_instance);obd_connect_seq_flags2str (m, imp->imp_connect_data.ocd_connect_flags,", " ); -seq_printf (m, -" ]\n" -" import_flags: [ " ); +seq_puts (m," ]\n import_flags: [ " );obd_import_flags2str (imp, m); -seq_printf (m, -" ]\n" -" connection:\n" -" failover_nids: [ " ); +seq_puts (m," ]\n connection:\n failover_nids: [ " );spin_lock (&imp->imp_lock); j =0 ;list_for_each_entry (conn, &imp->imp_conn_list, oic_item) {@@ -788,7 +783,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data)seq_printf (m,"current_state: %s\n" ,ptlrpc_import_state_name (imp->imp_state)); -seq_printf (m,"state_history:\n" ); +seq_puts (m,"state_history:\n" ); k = imp->imp_state_hist_idx;for (j =0 ; j <IMP_STATE_HIST_LEN ; j++) { struct import_state_hist *ish =@@ -810,7 +805,7 @@ int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at)for (i =0 ; i <AT_BINS ; i++)seq_printf (m,"%3u " , at->at_hist[i]); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }EXPORT_SYMBOL (lprocfs_at_hist_helper);@@ -878,7 +873,7 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags;seq_printf (m,"flags=%#llx\n" , flags);obd_connect_seq_flags2str (m, flags,"\n" ); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );up_read (&obd->u.cli.cl_sem);return 0 ; }Signature · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1456559840-7193-1-git-send-email-bhumirks%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Quoted 17 lines · Julia Lawall
Quoted 4 lines · Bhumika Goyal
This patch converts the
seq_printfoutput with constant strings toseq_putsand also useseq_putcforseq_printf(...,"\n"). Done using coccinelle:Quoted 10 lines
@@
identifier a;
constant b;
@@
(
-seq_printf(a,"\n");
+seq_putc(a,'\n');
|
-seq_printf(a,b);
+seq_puts(a,b);
Quoted 9 lines
You sem to get a good nmber of results with the first argument being an identifier, but I'm not sure why that has to be the case. Unless you see a reason not to, you could allow it to be an expression. Note that even
a->bis not an identifier. It is an expression. An identifier is only a single word.julia
I actually tried using both expression and identifier but got the same results in this case as I guess the first argument here is always an identifier. So I used identifier here and I found no more cases for this semantic patch.
Thanks,
Bhumika
Quoted 119 lines
Quoted 6 lines
)
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 10 +++++----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 17++++++-----------
Review
Quoted 3 lines
2 files changed, 11 insertions(+), 16 deletions(-)(quoted diff) +0
-0
b/drivers/staging/lustre/lustre/obdclass/cl_object.cdrivers/staging/lustre/lustre/obdclass/cl_object.c locks: ...... ...... ...... ...... ...... [......
Quoted 4 lines
index b56dfb6..a0d8cce 100644
drivers/staging/lustre/lustre/obdclass/cl_object.c +0
-0@@ -462,19 +462,19 @@ locks: ...... ...... ...... ...... ...... [............ ...... ...... ......]
Review
Quoted 25 lines
drivers/staging/lustre/lustre/obdclass/cl_object.c +5
-5*/ lu_site_stats_print (&site->cs_lu, m);cache_stats_print (&site->cs_pages, m,1 ); -seq_printf (m," [" ); +seq_puts (m," [" );for (i =0 ; i <ARRAY_SIZE (site->cs_pages_state); ++i)seq_printf (m,"%s: %u " , pstate[i],atomic_read (&site->cs_pages_state[i])); -seq_printf (m,"]\n" ); +seq_puts (m,"]\n" );cache_stats_print (&site->cs_locks, m,0 ); -seq_printf (m," [" ); +seq_puts (m," [" );for (i =0 ; i <ARRAY_SIZE (site->cs_locks_state); ++i)seq_printf (m,"%s: %u " , lstate[i],atomic_read (&site->cs_locks_state[i])); -seq_printf (m,"]\n" ); +seq_puts (m,"]\n" );cache_stats_print (&cl_env_stats, m,0 ); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }EXPORT_SYMBOL (cl_site_stats_print);(quoted diff) +0
-0
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.cdrivers/staging/lustre/lustre/obdclass/lprocfs_status.c static int obd_import_flags2str(struct obd_import
Quoted 4 lines
index 28bb4e5..82a1fab 100644
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +0
-0@@ -584,7 +584,7 @@ static int obd_import_flags2str(struct obd_import*imp, struct
seq_file*m)drivers/staging/lustre/lustre/obdclass/lprocfs_status.c int lprocfs_rd_import(struct seq_file *m, void
Quoted 9 lines
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1
-1bool first = true;if (imp->imp_obd->obd_no_recov) { -seq_printf (m,"no_recov" ); +seq_puts (m,"no_recov" ); first = false; }@@ -648,15 +648,10 @@ int lprocfs_rd_import(struct seq_file *m, void*data)
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c int lprocfs_rd_import(struct seq_file *m, void *data)
Quoted 3 lines
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +0
-0ptlrpc_import_state_name (imp->imp_state), imp->imp_connect_data.ocd_instance); obd_connect_seq_flags2str(m,
imp->imp_connect_data.ocd_connect_flags, ", ");drivers/staging/lustre/lustre/obdclass/lprocfs_status.c int lprocfs_at_hist_helper(struct seq_file *m,
Quoted 24 lines
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +3
-8-seq_printf (m, -" ]\n" -" import_flags: [ " ); +seq_puts (m," ]\n import_flags: [ " );obd_import_flags2str (imp, m); -seq_printf (m, -" ]\n" -" connection:\n" -" failover_nids: [ " ); +seq_puts (m," ]\n connection:\n failover_nids: [ " );spin_lock (&imp->imp_lock); j =0 ;list_for_each_entry (conn, &imp->imp_conn_list, oic_item) {@@ -788,7 +783,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data)seq_printf (m,"current_state: %s\n" ,ptlrpc_import_state_name (imp->imp_state)); -seq_printf (m,"state_history:\n" ); +seq_puts (m,"state_history:\n" ); k = imp->imp_state_hist_idx;for (j =0 ; j <IMP_STATE_HIST_LEN ; j++) { struct import_state_hist *ish =@@ -810,7 +805,7 @@ int lprocfs_at_hist_helper(struct seq_file *m,struct
adaptive_timeout*at)drivers/staging/lustre/lustre/obdclass/lprocfs_status.c int lprocfs_rd_connect_flags(struct seq_file *m,
Quoted 9 lines
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1
-1for (i =0 ; i <AT_BINS ; i++)seq_printf (m,"%3u " , at->at_hist[i]); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );return 0 ; }EXPORT_SYMBOL (lprocfs_at_hist_helper);@@ -878,7 +873,7 @@ int lprocfs_rd_connect_flags(struct seq_file *m,void *data)
Quoted 11 lines
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1
-2flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags;seq_printf (m,"flags=%#llx\n" , flags);obd_connect_seq_flags2str (m, flags,"\n" ); -seq_printf (m,"\n" ); +seq_putc (m,'\n' );up_read (&obd->u.cli.cl_sem);return 0 ; } --1.9.1
Quoted 2 lines
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Greg KH
maintainerQuoted 16 lines · Bhumika Goyal
This patch converts the
seq_printfoutput with constant strings toseq_putsand also useseq_putcforseq_printf(...,"\n"). Done using coccinelle:@@
identifier a;
constant b;
@@
(
-seq_printf(a,"\n");
+seq_putc(a,'\n');
|
-seq_printf(a,b);
+seq_puts(a,b);
)
Quoted 5 lines
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 10 +++++----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 17 ++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-)
Doesn't apply to my tree :(
Greg KH
maintainerQuoted 16 lines · Bhumika Goyal
This patch converts the
seq_printfoutput with constant strings toseq_putsand also useseq_putcforseq_printf(...,"\n"). Done using coccinelle:@@
identifier a;
constant b;
@@
(
-seq_printf(a,"\n");
+seq_putc(a,'\n');
|
-seq_printf(a,b);
+seq_puts(a,b);
)
Quoted 5 lines
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 10 +++++----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 17 ++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-)
Doesn't apply to my tree :(