diff options
author | Joe Perches <joe@perches.com> | 2011-11-28 13:40:46 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2012-01-05 11:51:44 -0500 |
commit | 5d3851530d6d68564e4e0ce04d0547d4d106fc72 (patch) | |
tree | d47065fcc1f93f00070afe597a98ab185fd13859 /net/9p/mod.c | |
parent | a0ea787b027b79cf2e01c6758e5246db06520158 (diff) |
9p: Reduce object size with CONFIG_NET_9P_DEBUG
Reduce object size by deduplicating formats.
Use vsprintf extension %pV.
Rename P9_DPRINTK uses to p9_debug, align arguments.
Add function for _p9_debug and macro to add __func__.
Add missing "\n"s to p9_debug uses.
Remove embedded function names as p9_debug adds it.
Remove P9_EPRINTK macro and convert use to pr_<level>.
Add and use pr_fmt and pr_<level>.
$ size fs/9p/built-in.o*
text data bss dec hex filename
62133 984 16000 79117 1350d fs/9p/built-in.o.new
67342 984 16928 85254 14d06 fs/9p/built-in.o.old
$ size net/9p/built-in.o*
text data bss dec hex filename
88792 4148 22024 114964 1c114 net/9p/built-in.o.new
94072 4148 23232 121452 1da6c net/9p/built-in.o.old
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/mod.c')
-rw-r--r-- | net/9p/mod.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/net/9p/mod.c b/net/9p/mod.c index 2664d1292291..6ab36aea7727 100644 --- a/net/9p/mod.c +++ b/net/9p/mod.c | |||
@@ -24,7 +24,11 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
28 | |||
27 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/errno.h> | ||
31 | #include <linux/sched.h> | ||
28 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
29 | #include <net/9p/9p.h> | 33 | #include <net/9p/9p.h> |
30 | #include <linux/fs.h> | 34 | #include <linux/fs.h> |
@@ -39,6 +43,29 @@ unsigned int p9_debug_level = 0; /* feature-rific global debug level */ | |||
39 | EXPORT_SYMBOL(p9_debug_level); | 43 | EXPORT_SYMBOL(p9_debug_level); |
40 | module_param_named(debug, p9_debug_level, uint, 0); | 44 | module_param_named(debug, p9_debug_level, uint, 0); |
41 | MODULE_PARM_DESC(debug, "9P debugging level"); | 45 | MODULE_PARM_DESC(debug, "9P debugging level"); |
46 | |||
47 | void _p9_debug(enum p9_debug_flags level, const char *func, | ||
48 | const char *fmt, ...) | ||
49 | { | ||
50 | struct va_format vaf; | ||
51 | va_list args; | ||
52 | |||
53 | if ((p9_debug_level & level) != level) | ||
54 | return; | ||
55 | |||
56 | va_start(args, fmt); | ||
57 | |||
58 | vaf.fmt = fmt; | ||
59 | vaf.va = &args; | ||
60 | |||
61 | if (level == P9_DEBUG_9P) | ||
62 | pr_notice("(%8.8d) %pV", task_pid_nr(current), &vaf); | ||
63 | else | ||
64 | pr_notice("-- %s (%d): %pV", func, task_pid_nr(current), &vaf); | ||
65 | |||
66 | va_end(args); | ||
67 | } | ||
68 | EXPORT_SYMBOL(_p9_debug); | ||
42 | #endif | 69 | #endif |
43 | 70 | ||
44 | /* | 71 | /* |
@@ -147,7 +174,7 @@ static int __init init_p9(void) | |||
147 | int ret = 0; | 174 | int ret = 0; |
148 | 175 | ||
149 | p9_error_init(); | 176 | p9_error_init(); |
150 | printk(KERN_INFO "Installing 9P2000 support\n"); | 177 | pr_info("Installing 9P2000 support\n"); |
151 | p9_trans_fd_init(); | 178 | p9_trans_fd_init(); |
152 | 179 | ||
153 | return ret; | 180 | return ret; |
@@ -160,7 +187,7 @@ static int __init init_p9(void) | |||
160 | 187 | ||
161 | static void __exit exit_p9(void) | 188 | static void __exit exit_p9(void) |
162 | { | 189 | { |
163 | printk(KERN_INFO "Unloading 9P2000 support\n"); | 190 | pr_info("Unloading 9P2000 support\n"); |
164 | 191 | ||
165 | p9_trans_fd_exit(); | 192 | p9_trans_fd_exit(); |
166 | } | 193 | } |