Skip to content

Commit

Permalink
udf: Neaten logging output, use vsprintf extension %pV
Browse files Browse the repository at this point in the history
Use %pV and remove a static buffer to save some text space and fix possible
issues when several processes call error reporting function in parallel. Also
change error level from KERN_CRIT to KERN_ERR.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Joe Perches authored and Jan Kara committed Oct 31, 2011
1 parent 78ace70 commit c2bff36
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions fs/udf/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@

#define UDF_DEFAULT_BLOCKSIZE 2048

static char error_buf[1024];

/* These are the "meat" - everything else is stuffing */
static int udf_fill_super(struct super_block *, void *, int);
static void udf_put_super(struct super_block *);
Expand Down Expand Up @@ -2077,29 +2075,37 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
void _udf_err(struct super_block *sb, const char *function,
const char *fmt, ...)
{
struct va_format vaf;
va_list args;

if (!(sb->s_flags & MS_RDONLY)) {
/* mark sb error */
/* mark sb error */
if (!(sb->s_flags & MS_RDONLY))
sb->s_dirt = 1;
}

va_start(args, fmt);
vsnprintf(error_buf, sizeof(error_buf), fmt, args);

vaf.fmt = fmt;
vaf.va = &args;

pr_err("error (device %s): %s: %pV", sb->s_id, function, &vaf);

va_end(args);
pr_crit("error (device %s): %s: %s",
sb->s_id, function, error_buf);
}

void _udf_warn(struct super_block *sb, const char *function,
const char *fmt, ...)
{
struct va_format vaf;
va_list args;

va_start(args, fmt);
vsnprintf(error_buf, sizeof(error_buf), fmt, args);

vaf.fmt = fmt;
vaf.va = &args;

pr_warn("warning (device %s): %s: %pV", sb->s_id, function, &vaf);

va_end(args);
pr_warn("warning (device %s): %s: %s",
sb->s_id, function, error_buf);
}

static void udf_put_super(struct super_block *sb)
Expand Down

0 comments on commit c2bff36

Please sign in to comment.