diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-08-27 06:34:54 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-08-27 06:39:35 -0400 |
commit | 1b0053a0f0893e6bbaaee0d28f5f6269459d8d14 (patch) | |
tree | c2cb5aeacb480992b4c92ea7a08283672cada6bb /sound/core | |
parent | 422bef879e84104fee6dc68ded0e371dbeb5f88e (diff) |
ALSA: core - strip too long file names in snd_print*()
When modules are built with M= option, they pass long file paths to
__FILE__. This results in ugly outputs of snd_print*() when
CONFIG_SND_VERBOSE_PRINTK is set.
This patch adds a check of the path and strips the leading path dirs
if the file name is an absolute path to improve the readability of logs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/misc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sound/core/misc.c b/sound/core/misc.c index a9710e0c97af..1d29e678369e 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c | |||
@@ -35,8 +35,17 @@ void release_and_free_resource(struct resource *res) | |||
35 | EXPORT_SYMBOL(release_and_free_resource); | 35 | EXPORT_SYMBOL(release_and_free_resource); |
36 | 36 | ||
37 | #ifdef CONFIG_SND_VERBOSE_PRINTK | 37 | #ifdef CONFIG_SND_VERBOSE_PRINTK |
38 | void snd_verbose_printk(const char *file, int line, const char *format, ...) | 38 | static const char *sanity_file_name(const char *path) |
39 | { | 39 | { |
40 | if (*path == '/') | ||
41 | return strrchr(path, '/') + 1; | ||
42 | else | ||
43 | return path; | ||
44 | } | ||
45 | |||
46 | void snd_verbose_printk(const char *path, int line, const char *format, ...) | ||
47 | { | ||
48 | const char *file = sanity_file_name(path); | ||
40 | va_list args; | 49 | va_list args; |
41 | 50 | ||
42 | if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') { | 51 | if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') { |
@@ -56,8 +65,9 @@ EXPORT_SYMBOL(snd_verbose_printk); | |||
56 | #endif | 65 | #endif |
57 | 66 | ||
58 | #if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK) | 67 | #if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK) |
59 | void snd_verbose_printd(const char *file, int line, const char *format, ...) | 68 | void snd_verbose_printd(const char *path, int line, const char *format, ...) |
60 | { | 69 | { |
70 | const char *file = sanity_file_name(path); | ||
61 | va_list args; | 71 | va_list args; |
62 | 72 | ||
63 | if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') { | 73 | if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') { |