diff options
author | Joe Perches <joe@perches.com> | 2011-10-31 20:11:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-31 20:30:54 -0400 |
commit | b9075fa968a0a4347aef35e235e2995c0e57dddd (patch) | |
tree | cf9f9716784e790d8a43339653256d9cf9178ff3 /fs/partitions | |
parent | ae29bc92da01a2e9d278a9a58c3b307d41cc0254 (diff) |
treewide: use __printf not __attribute__((format(printf,...)))
Standardize the style for compiler based printf format verification.
Standardized the location of __printf too.
Done via script and a little typing.
$ grep -rPl --include=*.[ch] -w "__attribute__" * | \
grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'
[akpm@linux-foundation.org: revert arch bits]
Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/partitions')
-rw-r--r-- | fs/partitions/ldm.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index af9fdf046769..bd8ae788f689 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
@@ -49,18 +49,20 @@ | |||
49 | #define ldm_error(f, a...) _ldm_printk (KERN_ERR, __func__, f, ##a) | 49 | #define ldm_error(f, a...) _ldm_printk (KERN_ERR, __func__, f, ##a) |
50 | #define ldm_info(f, a...) _ldm_printk (KERN_INFO, __func__, f, ##a) | 50 | #define ldm_info(f, a...) _ldm_printk (KERN_INFO, __func__, f, ##a) |
51 | 51 | ||
52 | __attribute__ ((format (printf, 3, 4))) | 52 | static __printf(3, 4) |
53 | static void _ldm_printk (const char *level, const char *function, | 53 | void _ldm_printk(const char *level, const char *function, const char *fmt, ...) |
54 | const char *fmt, ...) | ||
55 | { | 54 | { |
56 | static char buf[128]; | 55 | struct va_format vaf; |
57 | va_list args; | 56 | va_list args; |
58 | 57 | ||
59 | va_start (args, fmt); | 58 | va_start (args, fmt); |
60 | vsnprintf (buf, sizeof (buf), fmt, args); | ||
61 | va_end (args); | ||
62 | 59 | ||
63 | printk ("%s%s(): %s\n", level, function, buf); | 60 | vaf.fmt = fmt; |
61 | vaf.va = &args; | ||
62 | |||
63 | printk("%s%s(): %pV\n", level, function, &vaf); | ||
64 | |||
65 | va_end(args); | ||
64 | } | 66 | } |
65 | 67 | ||
66 | /** | 68 | /** |