* [Cluster-devel] [PATCH 0/9] treewide: convert vprintk uses to %pV
@ 2010-11-10 0:35 Joe Perches
2010-11-10 0:35 ` [Cluster-devel] [PATCH 6/9] fs/gfs2/glock.c: Use printf extension %pV Joe Perches
[not found] ` <AANLkTinhcbdm8YQOrFVdONODo6K6PcxHYtx5vqnap_3T@mail.gmail.com>
0 siblings, 2 replies; 6+ messages in thread
From: Joe Perches @ 2010-11-10 0:35 UTC (permalink / raw)
To: cluster-devel.redhat.com
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(-)
--
1.7.3.1.g432b3.dirty
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 6/9] fs/gfs2/glock.c: Use printf extension %pV
2010-11-10 0:35 [Cluster-devel] [PATCH 0/9] treewide: convert vprintk uses to %pV Joe Perches
@ 2010-11-10 0:35 ` Joe Perches
2010-11-10 20:55 ` Steven Whitehouse
[not found] ` <AANLkTinhcbdm8YQOrFVdONODo6K6PcxHYtx5vqnap_3T@mail.gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2010-11-10 0:35 UTC (permalink / raw)
To: cluster-devel.redhat.com
Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.
Signed-off-by: Joe Perches <joe@perches.com>
---
fs/gfs2/glock.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 8777885..d30b39c 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -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);
}
--
1.7.3.1.g432b3.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 6/9] fs/gfs2/glock.c: Use printf extension %pV
2010-11-10 0:35 ` [Cluster-devel] [PATCH 6/9] fs/gfs2/glock.c: Use printf extension %pV Joe Perches
@ 2010-11-10 20:55 ` Steven Whitehouse
2010-11-10 21:19 ` [Cluster-devel] [PATCH] fs/gfs2/glock.h: Add __attribute__((format(printf, 2, 3)) to gfs2_print_dbg Joe Perches
0 siblings, 1 reply; 6+ messages in thread
From: Steven Whitehouse @ 2010-11-10 20:55 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Now in my -nmw GFS2 git tree along with the previous patch. Thanks,
Steve.
On Tue, 2010-11-09 at 16:35 -0800, Joe Perches wrote:
> Using %pV reduces the number of printk calls and
> eliminates any possible message interleaving from
> other printk calls.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> fs/gfs2/glock.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index 8777885..d30b39c 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -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);
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH] fs/gfs2/glock.h: Add __attribute__((format(printf, 2, 3)) to gfs2_print_dbg
2010-11-10 20:55 ` Steven Whitehouse
@ 2010-11-10 21:19 ` Joe Perches
2010-11-10 21:35 ` Steven Whitehouse
0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2010-11-10 21:19 UTC (permalink / raw)
To: cluster-devel.redhat.com
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 <joe@perches.com>
---
No current uses report any error in an allyesconfig build.
fs/gfs2/glock.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index db1c26d..a12d117 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -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, ...);
/**
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH] fs/gfs2/glock.h: Add __attribute__((format(printf, 2, 3)) to gfs2_print_dbg
2010-11-10 21:19 ` [Cluster-devel] [PATCH] fs/gfs2/glock.h: Add __attribute__((format(printf, 2, 3)) to gfs2_print_dbg Joe Perches
@ 2010-11-10 21:35 ` Steven Whitehouse
0 siblings, 0 replies; 6+ messages in thread
From: Steven Whitehouse @ 2010-11-10 21:35 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Now in the GFS2 -nmw git tree. Thanks,
Steve.
On Wed, 2010-11-10 at 13:19 -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
> No current uses report any error in an allyesconfig build.
>
> fs/gfs2/glock.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
> index db1c26d..a12d117 100644
> --- a/fs/gfs2/glock.h
> +++ b/fs/gfs2/glock.h
> @@ -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, ...);
>
> /**
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] [PATCH 0/9] treewide: convert vprintk uses to %pV
[not found] ` <AANLkTinhcbdm8YQOrFVdONODo6K6PcxHYtx5vqnap_3T@mail.gmail.com>
@ 2010-11-10 23:01 ` Joe Perches
0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2010-11-10 23:01 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, 2010-11-10 at 14:48 -0800, Luis R. Rodriguez wrote:
> When was this added upstream BTW? I ask for backport considerations.
commit 7db6f5fb65a82af03229eef104dc9899c5eecf33
Author: Joe Perches <joe@perches.com>
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(...))).
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-11-10 23:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-10 0:35 [Cluster-devel] [PATCH 0/9] treewide: convert vprintk uses to %pV Joe Perches
2010-11-10 0:35 ` [Cluster-devel] [PATCH 6/9] fs/gfs2/glock.c: Use printf extension %pV Joe Perches
2010-11-10 20:55 ` Steven Whitehouse
2010-11-10 21:19 ` [Cluster-devel] [PATCH] fs/gfs2/glock.h: Add __attribute__((format(printf, 2, 3)) to gfs2_print_dbg Joe Perches
2010-11-10 21:35 ` Steven Whitehouse
[not found] ` <AANLkTinhcbdm8YQOrFVdONODo6K6PcxHYtx5vqnap_3T@mail.gmail.com>
2010-11-10 23:01 ` [Cluster-devel] [PATCH 0/9] treewide: convert vprintk uses to %pV Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).