Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fatfs: add FAT messages to printk index

In order for end users to quickly react to new issues that come up in
production, it is proving useful to leverage the printk indexing system.
This printk index enables kernel developers to use calls to printk() with
changeable ad-hoc format strings (as they always have; no change of
expectations), while enabling end users to examine format strings to
detect changes.

Since end users are using regular expressions to match messages printed
through printk(), being able to detect changes in chosen format strings
from release to release provides a useful signal to review
printk()-matching regular expressions for any necessary updates.

So that detailed FAT messages are captured by this printk index, this
patch wraps fat_msg with a macro.

[akpm@linux-foundation.org: coding-style cleanups]
Link: https://lkml.kernel.org/r/8aaa2dd7995e820292bb40d2120ab69756662c65.1648688136.git.jof@thejof.com
Signed-off-by: Jonathan Lassoff <jof@thejof.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Jonathan Lassoff and committed by
akpm
e057aaec 3fbb6b78

+18 -5
+8 -1
fs/fat/fat.h
··· 433 433 __fat_fs_error(sb, 1, fmt , ## args) 434 434 #define fat_fs_error_ratelimit(sb, fmt, args...) \ 435 435 __fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args) 436 + 437 + #define FAT_PRINTK_PREFIX "%sFAT-fs (%s): " 438 + #define fat_msg(sb, level, fmt, args...) \ 439 + do { \ 440 + printk_index_subsys_emit(FAT_PRINTK_PREFIX, level, fmt, ##args);\ 441 + _fat_msg(sb, level, fmt, ##args); \ 442 + } while (0) 436 443 __printf(3, 4) __cold 437 - void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...); 444 + void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...); 438 445 #define fat_msg_ratelimit(sb, level, fmt, args...) \ 439 446 do { \ 440 447 if (__ratelimit(&MSDOS_SB(sb)->ratelimit)) \
+10 -4
fs/fat/misc.c
··· 42 42 EXPORT_SYMBOL_GPL(__fat_fs_error); 43 43 44 44 /** 45 - * fat_msg() - print preformated FAT specific messages. Every thing what is 46 - * not fat_fs_error() should be fat_msg(). 45 + * _fat_msg() - Print a preformatted FAT message based on a superblock. 46 + * @sb: A pointer to a &struct super_block 47 + * @level: A Kernel printk level constant 48 + * @fmt: The printf-style format string to print. 49 + * 50 + * Everything that is not fat_fs_error() should be fat_msg(). 51 + * 52 + * fat_msg() wraps _fat_msg() for printk indexing. 47 53 */ 48 - void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...) 54 + void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...) 49 55 { 50 56 struct va_format vaf; 51 57 va_list args; ··· 59 53 va_start(args, fmt); 60 54 vaf.fmt = fmt; 61 55 vaf.va = &args; 62 - printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf); 56 + _printk(FAT_PRINTK_PREFIX "%pV\n", level, sb->s_id, &vaf); 63 57 va_end(args); 64 58 } 65 59