Skip to content

Commit

Permalink
fat: Add fat_msg() function for preformated FAT messages
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: OGAWA Hirofumi <[email protected]>
  • Loading branch information
olerem authored and OGAWAHirofumi committed Apr 12, 2011
1 parent 2c8a5ff commit 81ac21d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/fat/fat.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
__fat_fs_error(sb, 1, fmt , ## args)
#define fat_fs_error_ratelimit(sb, fmt, args...) \
__fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
__attribute__ ((format (printf, 3, 4))) __cold;
extern int fat_clusters_flush(struct super_block *sb);
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
Expand Down
16 changes: 16 additions & 0 deletions fs/fat/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
}
EXPORT_SYMBOL_GPL(__fat_fs_error);

/**
* fat_msg() - print preformated FAT specific messages. Every thing what is
* not fat_fs_error() should be fat_msg().
*/
void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
{
struct va_format vaf;
va_list args;

va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
va_end(args);
}

/* Flushes the number of free clusters on FAT32 */
/* XXX: Need to write one per FSINFO block. Currently only writes 1 */
int fat_clusters_flush(struct super_block *sb)
Expand Down

0 comments on commit 81ac21d

Please sign in to comment.