Convert sprintf_symbol uses to %p[Ss]
Subsystems (11)
cover Convert sprintf_symbol uses to %p[Ss]
Remove unnecessary declarations of temporary buffers. Use %pS or %ps as appropriate.
Minor reformatting in a couple of places.
Compiled, but otherwise untested.
Joe Perches (7):
arch/arm/kernel/traps.c: Convert sprintf_symbol to %pS arch/x86/kernel/pci-iommu_table.c: Convert sprintf_symbol to %pS fs/gfs2/glock.c: Convert sprintf_symbol to %pS fs/proc/base.c kernel/latencytop.c: Convert sprintf_symbol to %ps kernel/lockdep_proc.c: Convert sprintf_symbol to %pS
mm: Convert sprintf_symbol to %pS
net/sunrpc/clnt.c: Convert sprintf_symbol to %ps
arch/arm/kernel/traps.c | 5 +---- arch/x86/kernel/pci-iommu_table.c | 18 ++++-------------- fs/gfs2/glock.c | 15 +++++++-------- fs/proc/base.c | 22 ++++++++-------------- kernel/latencytop.c | 23 +++++++++-------------- kernel/lockdep_proc.c | 16 ++++++---------- mm/slub.c | 11 ++++------- mm/vmalloc.c | 9 ++------- net/sunrpc/clnt.c | 12 ++---------- 9 files changed, 43 insertions(+), 88 deletions(-)
Signature · 1 line
1.7.3.2.146.gca209
PATCH 1/7 arch/arm/kernel/traps.c: Convert sprintf_symbol to %pS
--- arch/arm/kernel/traps.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/kernel/traps.c +1 -4
@@ -53,10 +53,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);void dump_backtrace_entry (unsigned long where,unsigned long from,unsigned long frame) {#ifdef CONFIG_KALLSYMS -char sym1[KSYM_SYMBOL_LEN ], sym2[KSYM_SYMBOL_LEN ]; -sprint_symbol (sym1, where); -sprint_symbol (sym2, from); -printk ("[<%08lx>] (%s) from [<%08lx>] (%s)\n" , where, sym1, from, sym2); +printk ("[<%08lx>] (%pS) from [<%08lx>] (%pS)\n" , where, (void *)where, from, (void *)from);#else printk ("Function entered at [<%08lx>] from [<%08lx>]\n" , where, from);#endif
Signature · 1 line
1.7.3.2.146.gca209
PATCH 2/7 arch/x86/kernel/pci-iommu_table.c: Convert sprintf_symbol to %pS
In reply to Joe PerchesCoalesce format as well.
--- arch/x86/kernel/pci-iommu_table.c | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-)
arch/x86/kernel/pci-iommu_table.c +4 -14
@@ -50,20 +50,14 @@ void __init check_iommu_entries(struct iommu_table_entry *start, struct iommu_table_entry *finish) {struct iommu_table_entry *p, *q, *x; -char sym_p[KSYM_SYMBOL_LEN ]; -char sym_q[KSYM_SYMBOL_LEN ];/* Simple cyclic dependency checker. */ for (p = start; p < finish; p++) { q =find_dependents_of (start, finish, p); x =find_dependents_of (start, finish, q);if (p == x) { -sprint_symbol (sym_p, (unsigned long )p->detect); -sprint_symbol (sym_q, (unsigned long )q->detect); - -printk (KERN_ERR "CYCLIC DEPENDENCY FOUND! %s depends" \ -" on %s and vice-versa. BREAKING IT.\n" , - sym_p, sym_q); +printk (KERN_ERR "CYCLIC DEPENDENCY FOUND! %pS depends on %pS and vice-versa. BREAKING IT.\n" , + p->detect, q->detect);/* Heavy handed way..*/ x->depend =0 ; }
@@ -72,12 +66,8 @@ void __init check_iommu_entries(struct iommu_table_entry *start,for (p = start; p < finish; p++) { q =find_dependents_of (p, finish, p);if (q && q > p) { -sprint_symbol (sym_p, (unsigned long )p->detect); -sprint_symbol (sym_q, (unsigned long )q->detect); - -printk (KERN_ERR "EXECUTION ORDER INVALID! %s " \ -"should be called before %s!\n" , - sym_p, sym_q); +printk (KERN_ERR "EXECUTION ORDER INVALID! %pS should be called before %pS!\n" , + p->detect, q->detect); } } }
Signature · 1 line
1.7.3.2.146.gca209
Joerg Roedel
AppliedRe: [PATCH 2/7] arch/x86/kernel/pci-iommu_table.c: Convert sprintf_symbol to %pS
Quoted 3 lines · Joe Perches
Coalesce format as well.
Signed-off-by Joe Perches <[email protected]>
Applied, thanks.
PATCH 3/7 fs/gfs2/glock.c: Convert sprintf_symbol to %pS
In reply to Joe Perches--- fs/gfs2/glock.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
fs/gfs2/glock.c +7 -8
@@ -1627,18 +1627,17 @@ static const char *hflags2str(char *buf, unsigned flags, unsigned long iflags)static int dump_holder (struct seq_file *seq,const struct gfs2_holder *gh) {struct task_struct *gh_owner =NULL ; -char buffer[KSYM_SYMBOL_LEN ];char flags_buf[32 ]; -sprint_symbol (buffer, gh->gh_ip);if (gh->gh_owner_pid) gh_owner =pid_task (gh->gh_owner_pid,PIDTYPE_PID ); -gfs2_print_dbg (seq," H: s:%s f:%s e:%d p:%ld [%s] %s\n" , -state2str (gh->gh_state), -hflags2str (flags_buf, gh->gh_flags, gh->gh_iflags), - gh->gh_error, - gh->gh_owner_pid ? (long )pid_nr (gh->gh_owner_pid) :-1 , - gh_owner ? gh_owner->comm :"(ended)" , buffer); +gfs2_print_dbg (seq," H: s:%s f:%s e:%d p:%ld [%s] %pS\n" , +state2str (gh->gh_state), +hflags2str (flags_buf, gh->gh_flags, gh->gh_iflags), + gh->gh_error, + gh->gh_owner_pid ? (long )pid_nr (gh->gh_owner_pid) :-1 , + gh_owner ? gh_owner->comm :"(ended)" , + (void *)gh->gh_ip);return 0 ; }
Signature · 1 line
1.7.3.2.146.gca209
Re: [PATCH 3/7] fs/gfs2/glock.c: Convert sprintf_symbol to %pS
Hi,
Quoted 2 lines · Joe Perches
Signed-off-by Joe Perches <[email protected]>---
Seems like a good idea:
Steve.
Quoted 33 lines
fs/gfs2/glock.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)fs/gfs2/glock.c +7
-8@@ -1627,18 +1627,17 @@ static const char *hflags2str(char *buf, unsigned flags, unsigned long iflags)static int dump_holder (struct seq_file *seq,const struct gfs2_holder *gh) {struct task_struct *gh_owner =NULL ; -char buffer[KSYM_SYMBOL_LEN ];char flags_buf[32 ]; -sprint_symbol (buffer, gh->gh_ip);if (gh->gh_owner_pid) gh_owner =pid_task (gh->gh_owner_pid,PIDTYPE_PID ); -gfs2_print_dbg (seq," H: s:%s f:%s e:%d p:%ld [%s] %s\n" , -state2str (gh->gh_state), -hflags2str (flags_buf, gh->gh_flags, gh->gh_iflags), - gh->gh_error, - gh->gh_owner_pid ? (long )pid_nr (gh->gh_owner_pid) :-1 , - gh_owner ? gh_owner->comm :"(ended)" , buffer); +gfs2_print_dbg (seq," H: s:%s f:%s e:%d p:%ld [%s] %pS\n" , +state2str (gh->gh_state), +hflags2str (flags_buf, gh->gh_flags, gh->gh_iflags), + gh->gh_error, + gh->gh_owner_pid ? (long )pid_nr (gh->gh_owner_pid) :-1 , + gh_owner ? gh_owner->comm :"(ended)" , + (void *)gh->gh_ip);return 0 ; }
PATCH 4/7 fs/proc/base.c kernel/latencytop.c: Convert sprintf_symbol to %ps
In reply to Joe PerchesUse temporary lr for struct latency_record for improved readability and fewer columns used. Removed trailing space from output.
--- fs/proc/base.c | 22 ++++++++-------------- kernel/latencytop.c | 23 +++++++++-------------- 2 files changed, 17 insertions(+), 28 deletions(-)
fs/proc/base.c +8 -14
@@ -373,24 +373,18 @@ static int lstats_show_proc(struct seq_file *m, void *v)return -ESRCH ;seq_puts (m,"Latency Top version : v0.1\n" );for (i =0 ; i <32 ; i++) { -if (task->latency_record[i].backtrace[0 ]) { +struct latency_record *lr = &task->latency_record[i]; +if (lr->backtrace[0 ]) {int q; -seq_printf (m,"%i %li %li " , - task->latency_record[i].count, - task->latency_record[i].time, - task->latency_record[i].max); +seq_printf (m,"%i %li %li" , + lr->count, lr->time, lr->max);for (q =0 ; q <LT_BACKTRACEDEPTH ; q++) { -char sym[KSYM_SYMBOL_LEN ]; -char *c; -if (!task->latency_record[i].backtrace[q]) +unsigned long bt = lr->backtrace[q]; +if (!bt)break ; -if (task->latency_record[i].backtrace[q] ==ULONG_MAX ) +if (bt ==ULONG_MAX )break ; -sprint_symbol (sym, task->latency_record[i].backtrace[q]); - c =strchr (sym,'+' ); -if (c) - *c =0 ; -seq_printf (m,"%s " , sym); +seq_printf (m," %ps" , (void *)bt); }seq_printf (m,"\n" ); }
kernel/latencytop.c +9 -14
@@ -242,24 +242,19 @@ static int lstats_show(struct seq_file *m, void *v)seq_puts (m,"Latency Top version : v0.1\n" );for (i =0 ; i <MAXLR ; i++) { -if (latency_record[i].backtrace[0 ]) { +struct latency_record *lr = &latency_record[i]; + +if (lr->backtrace[0 ]) {int q; -seq_printf (m,"%i %lu %lu " , - latency_record[i].count, - latency_record[i].time, - latency_record[i].max); +seq_printf (m,"%i %lu %lu" , + lr->count, lr->time, lr->max);for (q =0 ; q <LT_BACKTRACEDEPTH ; q++) { -char sym[KSYM_SYMBOL_LEN ]; -char *c; -if (!latency_record[i].backtrace[q]) +unsigned long bt = lr->backtrace[q]; +if (!bt)break ; -if (latency_record[i].backtrace[q] ==ULONG_MAX ) +if (bt ==ULONG_MAX )break ; -sprint_symbol (sym, latency_record[i].backtrace[q]); - c =strchr (sym,'+' ); -if (c) - *c =0 ; -seq_printf (m,"%s " , sym); +seq_printf (m," %ps" , (void *)bt); }seq_printf (m,"\n" ); }
Signature · 1 line
1.7.3.2.146.gca209
PATCH 5/7 kernel/lockdep_proc.c: Convert sprintf_symbol to %pS
In reply to Joe Perches--- kernel/lockdep_proc.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-)
kernel/lockdep_proc.c +6 -10
@@ -494,7 +494,6 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data) namelen +=2 ;for (i =0 ; i <LOCKSTAT_POINTS ; i++) { -char sym[KSYM_SYMBOL_LEN ];char ip[32 ];if (class->contention_point[i] ==0 )
@@ -503,15 +502,13 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)if (!i)seq_line (m,'-' ,40 -namelen, namelen); -sprint_symbol (sym, class->contention_point[i]);snprintf (ip,sizeof (ip),"[<%p>]" , (void *)class->contention_point[i]); -seq_printf (m,"%40s %14lu %29s %s\n" , name, - stats->contention_point[i], - ip, sym); +seq_printf (m,"%40s %14lu %29s %pS\n" , + name, stats->contention_point[i], + ip, (void *)class->contention_point[i]); }for (i =0 ; i <LOCKSTAT_POINTS ; i++) { -char sym[KSYM_SYMBOL_LEN ];char ip[32 ];if (class->contending_point[i] ==0 )
@@ -520,12 +517,11 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)if (!i)seq_line (m,'-' ,40 -namelen, namelen); -sprint_symbol (sym, class->contending_point[i]);snprintf (ip,sizeof (ip),"[<%p>]" , (void *)class->contending_point[i]); -seq_printf (m,"%40s %14lu %29s %s\n" , name, - stats->contending_point[i], - ip, sym); +seq_printf (m,"%40s %14lu %29s %pS\n" , + name, stats->contending_point[i], + ip, (void *)class->contending_point[i]); }if (i) {seq_puts (m,"\n" );
Signature · 1 line
1.7.3.2.146.gca209
PATCH 6/7 mm: Convert sprintf_symbol to %pS
In reply to Joe Perches--- mm/slub.c | 11 ++++------- mm/vmalloc.c | 9 ++------- 2 files changed, 6 insertions(+), 14 deletions(-)
mm/slub.c +4 -7
@@ -3660,7 +3660,7 @@ static int list_locations(struct kmem_cache *s, char *buf, len +=sprintf (buf + len,"%7ld " , l->count);if (l->addr) - len +=sprint_symbol (buf + len, (unsigned long )l->addr); + len +=sprintf (buf + len,"%pS" , (void *)l->addr);else len +=sprintf (buf + len,"<not-available>" );
@@ -3969,12 +3969,9 @@ SLAB_ATTR(min_partial);static ssize_t ctor_show (struct kmem_cache *s,char *buf) { -if (s->ctor) { -int n =sprint_symbol (buf, (unsigned long )s->ctor); - -return n +sprintf (buf + n,"\n" ); - } -return 0 ; +if (!s->ctor) +return 0 ; +return sprintf (buf,"%pS\n" , s->ctor); }SLAB_ATTR_RO (ctor);
mm/vmalloc.c +2 -7
@@ -2450,13 +2450,8 @@ static int s_show(struct seq_file *m, void *p)seq_printf (m,"0x%p-0x%p %7ld" , v->addr, v->addr + v->size, v->size); -if (v->caller) { -char buff[KSYM_SYMBOL_LEN ]; - -seq_putc (m,' ' ); -sprint_symbol (buff, (unsigned long )v->caller); -seq_puts (m, buff); - } +if (v->caller) +seq_printf (m," %pS" , v->caller);if (v->nr_pages)seq_printf (m," pages=%d" , v->nr_pages);
Signature · 8 lines
1.7.3.2.146.gca209 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 6/7] mm: Convert sprintf_symbol to %pS
Quoted 1 line · Joe Perches
Signed-off-by Joe Perches<[email protected]>
I think this ought to go through Andrew's tree rather than the trivial tree.
Quoted 54 lines
--- mm/slub.c | 11 ++++------- mm/vmalloc.c | 9 ++------- 2 files changed, 6 insertions(+), 14 deletions(-)mm/slub.c +4
-7@@ -3660,7 +3660,7 @@ static int list_locations(struct kmem_cache *s, char *buf, len +=sprintf (buf + len,"%7ld " , l->count);if (l->addr) - len +=sprint_symbol (buf + len, (unsigned long )l->addr); + len +=sprintf (buf + len,"%pS" , (void *)l->addr);else len +=sprintf (buf + len,"<not-available>" );@@ -3969,12 +3969,9 @@ SLAB_ATTR(min_partial);static ssize_t ctor_show (struct kmem_cache *s,char *buf) { -if (s->ctor) { -int n =sprint_symbol (buf, (unsigned long )s->ctor); - -return n +sprintf (buf + n,"\n" ); - } -return 0 ; +if (!s->ctor) +return 0 ; +return sprintf (buf,"%pS\n" , s->ctor); }SLAB_ATTR_RO (ctor);mm/vmalloc.c +2
-7@@ -2450,13 +2450,8 @@ static int s_show(struct seq_file *m, void *p)seq_printf (m,"0x%p-0x%p %7ld" , v->addr, v->addr + v->size, v->size); -if (v->caller) { -char buff[KSYM_SYMBOL_LEN ]; - -seq_putc (m,' ' ); -sprint_symbol (buff, (unsigned long )v->caller); -seq_puts (m, buff); - } +if (v->caller) +seq_printf (m," %pS" , v->caller);if (v->nr_pages)seq_printf (m," pages=%d" , v->nr_pages);
PATCH 7/7 net/sunrpc/clnt.c: Convert sprintf_symbol to %ps
In reply to Joe Perches--- net/sunrpc/clnt.c | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-)
net/sunrpc/clnt.c +2 -10
@@ -1824,23 +1824,15 @@ static void rpc_show_task(const struct rpc_clnt *clnt, const struct rpc_task *task) {const char *rpc_waitq ="none" ; -char *p, action[KSYM_SYMBOL_LEN ];if (RPC_IS_QUEUED (task)) rpc_waitq =rpc_qname (task->tk_waitqueue); -/* map tk_action pointer to a function name; then trim off -* the "+0x0 [sunrpc]" */ -sprint_symbol (action, (unsigned long )task->tk_action); - p =strchr (action,'+' ); -if (p) - *p ='\0' ; - -printk (KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%s q:%s\n" , +printk (KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%ps q:%s\n" , task->tk_pid, task->tk_flags, task->tk_status, clnt, task->tk_rqstp, task->tk_timeout, task->tk_ops, clnt->cl_protname, clnt->cl_vers,rpc_proc_name (task), - action, rpc_waitq); + task->tk_action, rpc_waitq); }void rpc_show_tasks (void )
Signature · 6 lines
1.7.3.2.146.gca209 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html