diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-04-03 17:50:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:21:25 -0400 |
commit | dac52fc1826a788d2591a4f77e3c482b30f577e2 (patch) | |
tree | 8285a85761dd57e71497cd53482cd38031c677de /fs/befs/debug.c | |
parent | 91a52ab7d664a1c8972a0ecb30955d34aea54d7f (diff) |
BEFS: logging cleanup
Summary:
- all printk(KERN_foo converted to pr_foo()
- add pr_fmt and remove redundant prefixes
- convert befs_() to va_format (based on patch by Joe Perches)
- remove non standard %Lu
- use __func__ for all debugging
[akpm@linux-foundation.org: fix printk warnings, reported by Fengguang]
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Joe Perches <joe@perches.com>
Cc: Fengguang Wu <fengguang.wu@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/befs/debug.c')
-rw-r--r-- | fs/befs/debug.c | 74 |
1 files changed, 25 insertions, 49 deletions
diff --git a/fs/befs/debug.c b/fs/befs/debug.c index 622e73775c83..4de7cffcd662 100644 --- a/fs/befs/debug.c +++ b/fs/befs/debug.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * debug functions | 10 | * debug functions |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
14 | 15 | ||
15 | #include <stdarg.h> | 16 | #include <stdarg.h> |
@@ -23,43 +24,30 @@ | |||
23 | 24 | ||
24 | #include "befs.h" | 25 | #include "befs.h" |
25 | 26 | ||
26 | #define ERRBUFSIZE 1024 | ||
27 | |||
28 | void | 27 | void |
29 | befs_error(const struct super_block *sb, const char *fmt, ...) | 28 | befs_error(const struct super_block *sb, const char *fmt, ...) |
30 | { | 29 | { |
30 | struct va_format vaf; | ||
31 | va_list args; | 31 | va_list args; |
32 | char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); | ||
33 | if (err_buf == NULL) { | ||
34 | printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); | ||
35 | return; | ||
36 | } | ||
37 | 32 | ||
38 | va_start(args, fmt); | 33 | va_start(args, fmt); |
39 | vsnprintf(err_buf, ERRBUFSIZE, fmt, args); | 34 | vaf.fmt = fmt; |
35 | vaf.va = &args; | ||
36 | pr_err("(%s): %pV\n", sb->s_id, &vaf); | ||
40 | va_end(args); | 37 | va_end(args); |
41 | |||
42 | printk(KERN_ERR "BeFS(%s): %s\n", sb->s_id, err_buf); | ||
43 | kfree(err_buf); | ||
44 | } | 38 | } |
45 | 39 | ||
46 | void | 40 | void |
47 | befs_warning(const struct super_block *sb, const char *fmt, ...) | 41 | befs_warning(const struct super_block *sb, const char *fmt, ...) |
48 | { | 42 | { |
43 | struct va_format vaf; | ||
49 | va_list args; | 44 | va_list args; |
50 | char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); | ||
51 | if (err_buf == NULL) { | ||
52 | printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); | ||
53 | return; | ||
54 | } | ||
55 | 45 | ||
56 | va_start(args, fmt); | 46 | va_start(args, fmt); |
57 | vsnprintf(err_buf, ERRBUFSIZE, fmt, args); | 47 | vaf.fmt = fmt; |
48 | vaf.va = &args; | ||
49 | pr_warn("(%s): %pV\n", sb->s_id, &vaf); | ||
58 | va_end(args); | 50 | va_end(args); |
59 | |||
60 | printk(KERN_WARNING "BeFS(%s): %s\n", sb->s_id, err_buf); | ||
61 | |||
62 | kfree(err_buf); | ||
63 | } | 51 | } |
64 | 52 | ||
65 | void | 53 | void |
@@ -67,25 +55,13 @@ befs_debug(const struct super_block *sb, const char *fmt, ...) | |||
67 | { | 55 | { |
68 | #ifdef CONFIG_BEFS_DEBUG | 56 | #ifdef CONFIG_BEFS_DEBUG |
69 | 57 | ||
58 | struct va_format vaf; | ||
70 | va_list args; | 59 | va_list args; |
71 | char *err_buf = NULL; | 60 | va_start(args, fmt); |
72 | 61 | vaf.fmt = fmt; | |
73 | if (BEFS_SB(sb)->mount_opts.debug) { | 62 | vaf.va = &args; |
74 | err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); | 63 | pr_debug("(%s): %pV\n", sb->s_id, &vaf); |
75 | if (err_buf == NULL) { | 64 | va_end(args); |
76 | printk(KERN_ERR "could not allocate %d bytes\n", | ||
77 | ERRBUFSIZE); | ||
78 | return; | ||
79 | } | ||
80 | |||
81 | va_start(args, fmt); | ||
82 | vsnprintf(err_buf, ERRBUFSIZE, fmt, args); | ||
83 | va_end(args); | ||
84 | |||
85 | printk(KERN_DEBUG "BeFS(%s): %s\n", sb->s_id, err_buf); | ||
86 | |||
87 | kfree(err_buf); | ||
88 | } | ||
89 | 65 | ||
90 | #endif //CONFIG_BEFS_DEBUG | 66 | #endif //CONFIG_BEFS_DEBUG |
91 | } | 67 | } |
@@ -109,9 +85,9 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode) | |||
109 | befs_debug(sb, " gid %u", fs32_to_cpu(sb, inode->gid)); | 85 | befs_debug(sb, " gid %u", fs32_to_cpu(sb, inode->gid)); |
110 | befs_debug(sb, " mode %08x", fs32_to_cpu(sb, inode->mode)); | 86 | befs_debug(sb, " mode %08x", fs32_to_cpu(sb, inode->mode)); |
111 | befs_debug(sb, " flags %08x", fs32_to_cpu(sb, inode->flags)); | 87 | befs_debug(sb, " flags %08x", fs32_to_cpu(sb, inode->flags)); |
112 | befs_debug(sb, " create_time %Lu", | 88 | befs_debug(sb, " create_time %llu", |
113 | fs64_to_cpu(sb, inode->create_time)); | 89 | fs64_to_cpu(sb, inode->create_time)); |
114 | befs_debug(sb, " last_modified_time %Lu", | 90 | befs_debug(sb, " last_modified_time %llu", |
115 | fs64_to_cpu(sb, inode->last_modified_time)); | 91 | fs64_to_cpu(sb, inode->last_modified_time)); |
116 | 92 | ||
117 | tmp_run = fsrun_to_cpu(sb, inode->parent); | 93 | tmp_run = fsrun_to_cpu(sb, inode->parent); |
@@ -137,7 +113,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode) | |||
137 | tmp_run.allocation_group, tmp_run.start, | 113 | tmp_run.allocation_group, tmp_run.start, |
138 | tmp_run.len); | 114 | tmp_run.len); |
139 | } | 115 | } |
140 | befs_debug(sb, " max_direct_range %Lu", | 116 | befs_debug(sb, " max_direct_range %llu", |
141 | fs64_to_cpu(sb, | 117 | fs64_to_cpu(sb, |
142 | inode->data.datastream. | 118 | inode->data.datastream. |
143 | max_direct_range)); | 119 | max_direct_range)); |
@@ -147,7 +123,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode) | |||
147 | tmp_run.allocation_group, | 123 | tmp_run.allocation_group, |
148 | tmp_run.start, tmp_run.len); | 124 | tmp_run.start, tmp_run.len); |
149 | 125 | ||
150 | befs_debug(sb, " max_indirect_range %Lu", | 126 | befs_debug(sb, " max_indirect_range %llu", |
151 | fs64_to_cpu(sb, | 127 | fs64_to_cpu(sb, |
152 | inode->data.datastream. | 128 | inode->data.datastream. |
153 | max_indirect_range)); | 129 | max_indirect_range)); |
@@ -158,12 +134,12 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode) | |||
158 | tmp_run.allocation_group, tmp_run.start, | 134 | tmp_run.allocation_group, tmp_run.start, |
159 | tmp_run.len); | 135 | tmp_run.len); |
160 | 136 | ||
161 | befs_debug(sb, " max_double_indirect_range %Lu", | 137 | befs_debug(sb, " max_double_indirect_range %llu", |
162 | fs64_to_cpu(sb, | 138 | fs64_to_cpu(sb, |
163 | inode->data.datastream. | 139 | inode->data.datastream. |
164 | max_double_indirect_range)); | 140 | max_double_indirect_range)); |
165 | 141 | ||
166 | befs_debug(sb, " size %Lu", | 142 | befs_debug(sb, " size %llu", |
167 | fs64_to_cpu(sb, inode->data.datastream.size)); | 143 | fs64_to_cpu(sb, inode->data.datastream.size)); |
168 | } | 144 | } |
169 | 145 | ||
@@ -191,8 +167,8 @@ befs_dump_super_block(const struct super_block *sb, befs_super_block * sup) | |||
191 | befs_debug(sb, " block_size %u", fs32_to_cpu(sb, sup->block_size)); | 167 | befs_debug(sb, " block_size %u", fs32_to_cpu(sb, sup->block_size)); |
192 | befs_debug(sb, " block_shift %u", fs32_to_cpu(sb, sup->block_shift)); | 168 | befs_debug(sb, " block_shift %u", fs32_to_cpu(sb, sup->block_shift)); |
193 | 169 | ||
194 | befs_debug(sb, " num_blocks %Lu", fs64_to_cpu(sb, sup->num_blocks)); | 170 | befs_debug(sb, " num_blocks %llu", fs64_to_cpu(sb, sup->num_blocks)); |
195 | befs_debug(sb, " used_blocks %Lu", fs64_to_cpu(sb, sup->used_blocks)); | 171 | befs_debug(sb, " used_blocks %llu", fs64_to_cpu(sb, sup->used_blocks)); |
196 | 172 | ||
197 | befs_debug(sb, " magic2 %08x", fs32_to_cpu(sb, sup->magic2)); | 173 | befs_debug(sb, " magic2 %08x", fs32_to_cpu(sb, sup->magic2)); |
198 | befs_debug(sb, " blocks_per_ag %u", | 174 | befs_debug(sb, " blocks_per_ag %u", |
@@ -206,8 +182,8 @@ befs_dump_super_block(const struct super_block *sb, befs_super_block * sup) | |||
206 | befs_debug(sb, " log_blocks %u, %hu, %hu", | 182 | befs_debug(sb, " log_blocks %u, %hu, %hu", |
207 | tmp_run.allocation_group, tmp_run.start, tmp_run.len); | 183 | tmp_run.allocation_group, tmp_run.start, tmp_run.len); |
208 | 184 | ||
209 | befs_debug(sb, " log_start %Ld", fs64_to_cpu(sb, sup->log_start)); | 185 | befs_debug(sb, " log_start %lld", fs64_to_cpu(sb, sup->log_start)); |
210 | befs_debug(sb, " log_end %Ld", fs64_to_cpu(sb, sup->log_end)); | 186 | befs_debug(sb, " log_end %lld", fs64_to_cpu(sb, sup->log_end)); |
211 | 187 | ||
212 | befs_debug(sb, " magic3 %08x", fs32_to_cpu(sb, sup->magic3)); | 188 | befs_debug(sb, " magic3 %08x", fs32_to_cpu(sb, sup->magic3)); |
213 | 189 | ||