treewide: convert vprintk uses to %pV
Subsystems (11)
cover treewide: convert vprintk uses to %pV
Multiple secessive calls to printk can be interleaved. Avoid this possible interleaving by using %pV
Joe Perches (9):
drivers/gpu/drm/drm_stub.c: Use printf extension %pV drivers/isdn/mISDN: Use printf extension %pV drivers/net/wireless/ath/debug.c: Use printf extension %pV drivers/net/wireless/b43/main.c: Use printf extension %pV drivers/net/wireless/b43legacy/main.c: Use printf extension %pV fs/gfs2/glock.c: Use printf extension %pV fs/nilfs2/super.c: Use printf extension %pV fs/quota/dquot.c: Use printf extension %pV net/sunrpc/svc.c: Use printf extension %pV
drivers/gpu/drm/drm_stub.c | 14 +++++++-- drivers/isdn/mISDN/layer1.c | 10 +++++-- drivers/isdn/mISDN/layer2.c | 12 ++++++-- drivers/isdn/mISDN/tei.c | 23 +++++++++++---- drivers/net/wireless/ath/debug.c | 9 +++++- drivers/net/wireless/b43/main.c | 48 ++++++++++++++++++++++++-------- drivers/net/wireless/b43legacy/main.c | 47 ++++++++++++++++++++++++-------- fs/gfs2/glock.c | 9 +++++- fs/nilfs2/super.c | 23 +++++++++++----- fs/quota/dquot.c | 12 +++++--- net/sunrpc/svc.c | 12 +++++--- 11 files changed, 161 insertions(+), 58 deletions(-)
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 1/9 drivers/gpu/drm/drm_stub.c: Use printf extension %pV
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- drivers/gpu/drm/drm_stub.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_stub.c +11 -3
@@ -57,13 +57,21 @@ void drm_ut_debug_printk(unsigned int request_level,const char *function_name, const char *format, ...) { + struct va_format vaf;va_list args;if (drm_debug & request_level) { -if (function_name) -printk (KERN_DEBUG "[%s:%s], " , prefix, function_name);va_start (args, format); -vprintk (format, args); + + vaf.fmt = format; + vaf.va = &args; + +if (function_name) +printk (KERN_DEBUG "[%s:%s], %pV" , + prefix, function_name, &vaf); +else +printk (KERN_DEBUG "%pV" , &vaf); +va_end (args); } }
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV
Quoted 24 lines · Joe Perches
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.Signed-off-by Joe Perches <[email protected]>---
drivers/gpu/drm/drm_stub.c | 14 +++++++++++---1 files changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_stub.c +1
-2@@ -57,13 +57,21 @@ void drm_ut_debug_printk(unsigned int request_level, const char *function_name, const char *format, ...) { + struct va_format vaf; va_list args; if (drm_debug & request_level) { - if (function_name) - printk(KERN_DEBUG "[%s:%s], ", prefix, function_name); va_start(args, format);
drivers/gpu/drm/drm_stub.c void drm_ut_debug_printk(unsigned int request_level, · line 73
Quoted 10 lines
drivers/gpu/drm/drm_stub.c +9
-1- vprintk(format, args); + + vaf.fmt = format; + vaf.va = &args; + + if (function_name) + printk(KERN_DEBUG "[%s:%s], %pV", + prefix, function_name, &vaf); + else + printk(KERN_DEBUG "%pV", &vaf);
Wouldn't it be easier and more convenient to just make the %pV format specifier just expect a format string and the va_arg list? Like this
printk(KERN_DEBUG "%pV", format, &args);
I mean, the %pV is kernel specific and we can just change how it works.
Kristian
Re: [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV
Quoted 9 lines · Kristian Høgsberg
Quoted 3 lines · Joe Perches
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.Wouldn't it be easier and more convenient to just make the %pV format specifier just expect a format string and the
va_arglist? Like this
printk(KERN_DEBUG "%pV", format, &args);
I mean, the %pV is kernel specific and we can just change how it works.
No it wouldn't.
gcc would now warn about a mismatch between format and arguments.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/9 drivers/isdn/mISDN: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- drivers/isdn/mISDN/layer1.c | 10 +++++++--- drivers/isdn/mISDN/layer2.c | 12 +++++++++--- drivers/isdn/mISDN/tei.c | 23 +++++++++++++++++------ 3 files changed, 33 insertions(+), 12 deletions(-)
drivers/isdn/mISDN/layer1.c +7 -3
@@ -99,12 +99,16 @@ static void l1m_debug(struct FsmInst *fi, char *fmt, ...) { struct layer1 *l1 = fi->userdata; +struct va_format vaf;va_list va;va_start (va, fmt); -printk (KERN_DEBUG "%s: " ,dev_name (&l1->dch->dev.dev)); -vprintk (fmt, va); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &va; + +printk (KERN_DEBUG "%s: %pV\n" ,dev_name (&l1->dch->dev.dev), &vaf); +va_end (va); }
drivers/isdn/mISDN/layer2.c +9 -3
@@ -95,14 +95,20 @@ static void l2m_debug(struct FsmInst *fi, char *fmt, ...) { struct layer2 *l2 = fi->userdata; +struct va_format vaf;va_list va;if (!(*debug &DEBUG_L2_FSM ))return ; +va_start (va, fmt); -printk (KERN_DEBUG "l2 (sapi %d tei %d): " , l2->sapi, l2->tei); -vprintk (fmt, va); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &va; + +printk (KERN_DEBUG "l2 (sapi %d tei %d): %pV\n" , + l2->sapi, l2->tei, &vaf); +va_end (va); }
drivers/isdn/mISDN/tei.c +17 -6
@@ -79,14 +79,19 @@ static void da_debug(struct FsmInst *fi, char *fmt, ...) { struct manager *mgr = fi->userdata; +struct va_format vaf;va_list va;if (!(*debug &DEBUG_L2_TEIFSM ))return ; +va_start (va, fmt); -printk (KERN_DEBUG "mgr(%d): " , mgr->ch.st->dev->id); -vprintk (fmt, va); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &va; + +printk (KERN_DEBUG "mgr(%d): %pV\n" , mgr->ch.st->dev->id, &vaf); +va_end (va); }
@@ -223,14 +228,20 @@ static void tei_debug(struct FsmInst *fi, char *fmt, ...) { struct teimgr *tm = fi->userdata; +struct va_format vaf;va_list va;if (!(*debug &DEBUG_L2_TEIFSM ))return ; +va_start (va, fmt); -printk (KERN_DEBUG "sapi(%d) tei(%d): " , tm->l2->sapi, tm->l2->tei); -vprintk (fmt, va); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &va; + +printk (KERN_DEBUG "sapi(%d) tei(%d): %pV\n" , + tm->l2->sapi, tm->l2->tei, &vaf); +va_end (va); }
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 2/9] drivers/isdn/mISDN: Use printf extension %pV
From: Joe Perches <[email protected]>
Date: Tue, 9 Nov 2010 16:35:16 -0800
Quoted 5 lines
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.Signed-off-by Joe Perches <[email protected]>
Applied, thanks.
PATCH 3/9 drivers/net/wireless/ath/debug.c: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- drivers/net/wireless/ath/debug.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/debug.c +7 -2
@@ -19,14 +19,19 @@void ath_print (struct ath_common *common,int dbg_mask,const char *fmt, ...) { +struct va_format vaf;va_list args;if (likely (!(common->debug_mask & dbg_mask)))return ;va_start (args, fmt); -printk (KERN_DEBUG "ath: " ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_DEBUG "ath: %pV" , &vaf); +va_end (args); }EXPORT_SYMBOL (ath_print);
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 4/9 drivers/net/wireless/b43/main.c: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- drivers/net/wireless/b43/main.c | 48 +++++++++++++++++++++++++++++--------- 1 files changed, 36 insertions(+), 12 deletions(-)
drivers/net/wireless/b43/main.c +36 -12
@@ -322,59 +322,83 @@ static int b43_ratelimit(struct b43_wl *wl)void b43info (struct b43_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;if (b43_modparam_verbose <B43_VERBOSITY_INFO )return ;if (!b43_ratelimit (wl))return ; +va_start (args, fmt); -printk (KERN_INFO "b43-%s: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_INFO "b43-%s: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }void b43err (struct b43_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;if (b43_modparam_verbose <B43_VERBOSITY_ERROR )return ;if (!b43_ratelimit (wl))return ; +va_start (args, fmt); -printk (KERN_ERR "b43-%s ERROR: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_ERR "b43-%s ERROR: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }void b43warn (struct b43_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;if (b43_modparam_verbose <B43_VERBOSITY_WARN )return ;if (!b43_ratelimit (wl))return ; +va_start (args, fmt); -printk (KERN_WARNING "b43-%s warning: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_WARNING "b43-%s warning: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }void b43dbg (struct b43_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;if (b43_modparam_verbose <B43_VERBOSITY_DEBUG )return ; +va_start (args, fmt); -printk (KERN_DEBUG "b43-%s debug: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_DEBUG "b43-%s debug: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 5/9 drivers/net/wireless/b43legacy/main.c: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- drivers/net/wireless/b43legacy/main.c | 47 ++++++++++++++++++++++++-------- 1 files changed, 35 insertions(+), 12 deletions(-)
drivers/net/wireless/b43legacy/main.c +35 -12
@@ -181,52 +181,75 @@ static int b43legacy_ratelimit(struct b43legacy_wl *wl)void b43legacyinfo (struct b43legacy_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;if (!b43legacy_ratelimit (wl))return ; +va_start (args, fmt); -printk (KERN_INFO "b43legacy-%s: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_INFO "b43legacy-%s: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }void b43legacyerr (struct b43legacy_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;if (!b43legacy_ratelimit (wl))return ; +va_start (args, fmt); -printk (KERN_ERR "b43legacy-%s ERROR: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_ERR "b43legacy-%s ERROR: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }void b43legacywarn (struct b43legacy_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;if (!b43legacy_ratelimit (wl))return ; +va_start (args, fmt); -printk (KERN_WARNING "b43legacy-%s warning: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_WARNING "b43legacy-%s warning: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }#if B43legacy_DEBUGvoid b43legacydbg (struct b43legacy_wl *wl,const char *fmt, ...) { +struct va_format vaf;va_list args;va_start (args, fmt); -printk (KERN_DEBUG "b43legacy-%s debug: " , - (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" ); -vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_DEBUG "b43legacy-%s debug: %pV" , + (wl && wl->hw) ?wiphy_name (wl->hw->wiphy) :"wlan" , &vaf); +va_end (args); }#endif /* DEBUG */
Signature · 1 line
1.7.3.1.g432b3.dirty
PATCH 6/9 fs/gfs2/glock.c: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- fs/gfs2/glock.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
fs/gfs2/glock.c +7 -2
@@ -952,17 +952,22 @@ int gfs2_glock_wait(struct gfs2_holder *gh)void gfs2_print_dbg (struct seq_file *seq,const char *fmt, ...) { +struct va_format vaf;va_list args;va_start (args, fmt); +if (seq) {struct gfs2_glock_iter *gi = seq->private;vsprintf (gi->string, fmt, args);seq_printf (seq, gi->string); }else { -printk (KERN_ERR " " ); -vprintk (fmt, args); + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_ERR " %pV" , &vaf); } +va_end (args); }
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 6/9] fs/gfs2/glock.c: Use printf extension %pV
Hi,
Now in my -nmw GFS2 git tree along with the previous patch. Thanks,
Steve.
Quoted 38 lines · Joe Perches
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.Signed-off-by Joe Perches <[email protected]>--- fs/gfs2/glock.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)fs/gfs2/glock.c +7
-2@@ -952,17 +952,22 @@ int gfs2_glock_wait(struct gfs2_holder *gh)void gfs2_print_dbg (struct seq_file *seq,const char *fmt, ...) { +struct va_format vaf;va_list args;va_start (args, fmt); +if (seq) {struct gfs2_glock_iter *gi = seq->private;vsprintf (gi->string, fmt, args);seq_printf (seq, gi->string); }else { -printk (KERN_ERR " " ); -vprintk (fmt, args); + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_ERR " %pV" , &vaf); } +va_end (args); }
PATCH 1/1 fs/gfs2/glock.h: Add __attribute__((format(printf,2,3)) to gfs2_print_dbg
Functions that use printf formatting, especially those that use %pV, should have their uses of printf format and arguments checked by the compiler.
---
No current uses report any error in an allyesconfig build.
fs/gfs2/glock.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/gfs2/glock.h +2 -0
@@ -212,6 +212,8 @@ int gfs2_glock_nq_num(struct gfs2_sbd *sdp,int gfs2_glock_nq_m (unsigned int num_gh,struct gfs2_holder *ghs);void gfs2_glock_dq_m (unsigned int num_gh,struct gfs2_holder *ghs);void gfs2_glock_dq_uninit_m (unsigned int num_gh,struct gfs2_holder *ghs); + +__attribute__ ((format (printf,2 ,3 )))void gfs2_print_dbg (struct seq_file *seq,const char *fmt, ...);/**
Re: [PATCH] fs/gfs2/glock.h: Add __attribute__((format(printf,2,3)) to gfs2_print_dbg
Hi,
Now in the GFS2 -nmw git tree. Thanks,
Steve.
Quoted 26 lines · Joe Perches
Functions that use printf formatting, especially those that use %pV, should have their uses of printf format and arguments checked by the compiler.
Signed-off-by Joe Perches <[email protected]>---
No current uses report any error in an allyesconfig build.fs/gfs2/glock.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/gfs2/glock.h +2
-0@@ -212,6 +212,8 @@ int gfs2_glock_nq_num(struct gfs2_sbd *sdp,int gfs2_glock_nq_m (unsigned int num_gh,struct gfs2_holder *ghs);void gfs2_glock_dq_m (unsigned int num_gh,struct gfs2_holder *ghs);void gfs2_glock_dq_uninit_m (unsigned int num_gh,struct gfs2_holder *ghs); + +__attribute__ ((format (printf,2 ,3 )))void gfs2_print_dbg (struct seq_file *seq,const char *fmt, ...);/**
PATCH 7/9 fs/nilfs2/super.c: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- fs/nilfs2/super.c | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-)
fs/nilfs2/super.c +16 -7
@@ -111,12 +111,17 @@ void nilfs_error(struct super_block *sb, const char *function, const char *fmt, ...) {struct nilfs_sb_info *sbi =NILFS_SB (sb); +struct va_format vaf;va_list args;va_start (args, fmt); -printk (KERN_CRIT "NILFS error (device %s): %s: " , sb->s_id, function); -vprintk (fmt, args); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_CRIT "NILFS error (device %s): %s: %pV\n" , + sb->s_id, function, &vaf); +va_end (args);if (!(sb->s_flags &MS_RDONLY )) {
@@ -136,13 +141,17 @@ void nilfs_error(struct super_block *sb, const char *function,void nilfs_warning (struct super_block *sb,const char *function,const char *fmt, ...) { +struct va_format vaf;va_list args;va_start (args, fmt); -printk (KERN_WARNING "NILFS warning (device %s): %s: " , - sb->s_id, function); -vprintk (fmt, args); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_WARNING "NILFS warning (device %s): %s: %pV\n" , + sb->s_id, function, &vaf); +va_end (args); }
Signature · 6 lines
1.7.3.1.g432b3.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
AppliedRe: [PATCH 7/9] fs/nilfs2/super.c: Use printf extension %pV
Quoted 8 lines · Joe Perches
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.Signed-off-by Joe Perches <[email protected]>--- fs/nilfs2/super.c | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-)
Applied to the nilfs tree.
Thank you.
Ryusuke Konishi
Quoted 55 lines
fs/nilfs2/super.c +16
-7@@ -111,12 +111,17 @@ void nilfs_error(struct super_block *sb, const char *function, const char *fmt, ...) {struct nilfs_sb_info *sbi =NILFS_SB (sb); +struct va_format vaf;va_list args;va_start (args, fmt); -printk (KERN_CRIT "NILFS error (device %s): %s: " , sb->s_id, function); -vprintk (fmt, args); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_CRIT "NILFS error (device %s): %s: %pV\n" , + sb->s_id, function, &vaf); +va_end (args);if (!(sb->s_flags &MS_RDONLY )) {@@ -136,13 +141,17 @@ void nilfs_error(struct super_block *sb, const char *function,void nilfs_warning (struct super_block *sb,const char *function,const char *fmt, ...) { +struct va_format vaf;va_list args;va_start (args, fmt); -printk (KERN_WARNING "NILFS warning (device %s): %s: " , - sb->s_id, function); -vprintk (fmt, args); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_WARNING "NILFS warning (device %s): %s: %pV\n" , + sb->s_id, function, &vaf); +va_end (args); }Signature · 7 lines
1.7.3.1.g432b3.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/9 fs/quota/dquot.c: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- fs/quota/dquot.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
fs/quota/dquot.c +8 -4
@@ -135,14 +135,18 @@ EXPORT_SYMBOL(dq_data_lock);void __quota_error (struct super_block *sb,const char *func,const char *fmt, ...) { +struct va_format vaf;va_list args;if (printk_ratelimit ()) {va_start (args, fmt); -printk (KERN_ERR "Quota error (device %s): %s: " , - sb->s_id, func); -vprintk (fmt, args); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_ERR "Quota error (device %s): %s: %pV\n" , + sb->s_id, func, &vaf); +va_end (args); } }
Signature · 1 line
1.7.3.1.g432b3.dirty
Re: [PATCH 8/9] fs/quota/dquot.c: Use printf extension %pV
Quoted 3 lines · Joe Perches
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
Thanks. Merged.
Honza
Quoted 36 lines
Signed-off-by Joe Perches <[email protected]>--- fs/quota/dquot.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)fs/quota/dquot.c +8
-4@@ -135,14 +135,18 @@ EXPORT_SYMBOL(dq_data_lock);void __quota_error (struct super_block *sb,const char *func,const char *fmt, ...) { +struct va_format vaf;va_list args;if (printk_ratelimit ()) {va_start (args, fmt); -printk (KERN_ERR "Quota error (device %s): %s: " , - sb->s_id, func); -vprintk (fmt, args); -printk ("\n" ); + + vaf.fmt = fmt; + vaf.va = &args; + +printk (KERN_ERR "Quota error (device %s): %s: %pV\n" , + sb->s_id, func, &vaf); +va_end (args); } }Signature · 1 line
1.7.3.1.g432b3.dirty
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 9/9 net/sunrpc/svc.c: Use printf extension %pV
In reply to Joe PerchesUsing %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
--- net/sunrpc/svc.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
net/sunrpc/svc.c +8 -4
@@ -962,6 +962,7 @@ static int __attribute__ ((format (printf,2 ,3 ))) svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) { + struct va_format vaf;va_list args;int r;char buf[RPC_MAX_ADDRBUFLEN ];
@@ -969,11 +970,14 @@ svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)if (!net_ratelimit ())return 0 ; -printk (KERN_WARNING "svc: %s: " , -svc_print_addr (rqstp, buf,sizeof (buf))); -va_start (args, fmt); - r =vprintk (fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + + r =printk (KERN_WARNING "svc: %s: %pV" , +svc_print_addr (rqstp, buf,sizeof (buf)), &vaf); +va_end (args);return r;
Signature · 6 lines
1.7.3.1.g432b3.dirty -- 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
Quoted 25 lines · Joe Perches
Multiple secessive calls to printk can be interleaved. Avoid this possible interleaving by using %pV
Joe Perches (9):
drivers/gpu/drm/drm_stub.c: Use printf extension %pVdrivers/isdn/mISDN: Use printf extension %pVdrivers/net/wireless/ath/debug.c: Use printf extension %pVdrivers/net/wireless/b43/main.c: Use printf extension %pVdrivers/net/wireless/b43legacy/main.c: Use printf extension %pVfs/gfs2/glock.c: Use printf extension %pVfs/nilfs2/super.c: Use printf extension %pVfs/quota/dquot.c: Use printf extension %pVnet/sunrpc/svc.c: Use printf extension %pVdrivers/gpu/drm/drm_stub.c | 14 +++++++--
drivers/isdn/mISDN/layer1.c| 10 +++++--drivers/isdn/mISDN/layer2.c| 12 ++++++--drivers/isdn/mISDN/tei.c| 23 +++++++++++----drivers/net/wireless/ath/debug.c| 9 +++++-drivers/net/wireless/b43/main.c| 48 ++++++++++++++++++++++++--------drivers/net/wireless/b43legacy/main.c| 47 ++++++++++++++++++++++++--------fs/gfs2/glock.c| 9 +++++-fs/nilfs2/super.c| 23 +++++++++++-----fs/quota/dquot.c| 12 +++++---net/sunrpc/svc.c| 12 +++++---
Quoted 1 line
11 files changed, 161 insertions(+), 58 deletions(-)
When was this added upstream BTW? I ask for backport considerations.
Luis
--
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
Joe Perches
Acked-by Greg Kroah-HartmanQuoted 1 line · Luis R. Rodriguez
When was this added upstream BTW? I ask for backport considerations.
commit 7db6f5fb65a82af03229eef104dc9899c5eecf33
Author: Joe Perches <[email protected]> Date: Sun Jun 27 01:02:33 2010 +0000
vsprintf: Recursive vsnprintf: Add "%pV", struct va_format
Add the ability to print a format and va_list from a structure pointer
Allows __dev_printk to be implemented as a single printk while minimizing string space duplication.
%pV should not be used without some mechanism to verify the format and argument use ala __attribute__(format (printf(...))).