Skip to content

Commit 81ac21d

Browse files
oleremOGAWAHirofumi
authored andcommitted
fat: Add fat_msg() function for preformated FAT messages
Add fat_msg() to replace not cosequent used printk() in fs/fat/* New message format should be as fallow: FAT-fs (sda1): some thing happened. Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
1 parent 2c8a5ff commit 81ac21d

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎fs/fat/fat.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
331331
__fat_fs_error(sb, 1, fmt , ## args)
332332
#define fat_fs_error_ratelimit(sb, fmt, args...) \
333333
__fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
334+
void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
335+
__attribute__ ((format (printf, 3, 4))) __cold;
334336
extern int fat_clusters_flush(struct super_block *sb);
335337
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
336338
extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,

‎fs/fat/misc.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
4444
}
4545
EXPORT_SYMBOL_GPL(__fat_fs_error);
4646

47+
/**
48+
* fat_msg() - print preformated FAT specific messages. Every thing what is
49+
* not fat_fs_error() should be fat_msg().
50+
*/
51+
void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
52+
{
53+
struct va_format vaf;
54+
va_list args;
55+
56+
va_start(args, fmt);
57+
vaf.fmt = fmt;
58+
vaf.va = &args;
59+
printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
60+
va_end(args);
61+
}
62+
4763
/* Flushes the number of free clusters on FAT32 */
4864
/* XXX: Need to write one per FSINFO block. Currently only writes 1 */
4965
int fat_clusters_flush(struct super_block *sb)

0 commit comments

Comments
 (0)