mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
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>
This commit is contained in:
parent
422bef879e
commit
1b0053a0f0
1 changed files with 12 additions and 2 deletions
|
@ -35,8 +35,17 @@ void release_and_free_resource(struct resource *res)
|
||||||
EXPORT_SYMBOL(release_and_free_resource);
|
EXPORT_SYMBOL(release_and_free_resource);
|
||||||
|
|
||||||
#ifdef CONFIG_SND_VERBOSE_PRINTK
|
#ifdef CONFIG_SND_VERBOSE_PRINTK
|
||||||
void snd_verbose_printk(const char *file, int line, const char *format, ...)
|
static const char *sanity_file_name(const char *path)
|
||||||
{
|
{
|
||||||
|
if (*path == '/')
|
||||||
|
return strrchr(path, '/') + 1;
|
||||||
|
else
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void snd_verbose_printk(const char *path, int line, const char *format, ...)
|
||||||
|
{
|
||||||
|
const char *file = sanity_file_name(path);
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') {
|
if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') {
|
||||||
|
@ -56,8 +65,9 @@ EXPORT_SYMBOL(snd_verbose_printk);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK)
|
#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK)
|
||||||
void snd_verbose_printd(const char *file, int line, const char *format, ...)
|
void snd_verbose_printd(const char *path, int line, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
const char *file = sanity_file_name(path);
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') {
|
if (format[0] == '<' && format[1] >= '0' && format[1] <= '7' && format[2] == '>') {
|
||||||
|
|
Loading…
Reference in a new issue