From: Jan Kara <jack@suse.cz>
To: linux-fsdevel@vger.kernel.org
Cc: Joe Perches <joe@perches.com>, NamJae Jeon <linkinjeon@gmail.com>,
Jan Kara <jack@suse.cz>
Subject: [PATCH 5/6] udf: Neaten logging output, use vsprintf extension %pV
Date: Mon, 10 Oct 2011 19:50:41 +0200 [thread overview]
Message-ID: <1318269042-16806-6-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1318269042-16806-1-git-send-email-jack@suse.cz>
From: Joe Perches <joe@perches.com>
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>
---
fs/udf/super.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 39e3f35..926228e 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -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 *);
@@ -2077,29 +2075,37 @@ error_out:
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)
--
1.7.1
next prev parent reply other threads:[~2011-10-10 17:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 17:50 [PATCH 0/6] udf: Message printing cleanup (v2) Jan Kara
2011-10-10 17:50 ` [PATCH 1/6] udf: Promote some debugging messages to udf_error Jan Kara
2011-10-10 17:50 ` [PATCH 2/6] udf: Rename udf_error to udf_err Jan Kara
2011-10-10 17:50 ` [PATCH 3/6] udf: Rename udf_warning to udf_warn Jan Kara
2011-10-10 17:50 ` [PATCH 4/6] udf: Convert printks to pr_<level> Jan Kara
2011-10-10 17:50 ` Jan Kara [this message]
2011-10-10 17:50 ` [PATCH 6/6] udf: Neaten udf_debug uses Jan Kara
2011-10-10 18:16 ` [PATCH 0/6] udf: Message printing cleanup (v2) Joe Perches
2011-10-10 18:24 ` Jan Kara
2011-10-10 23:02 ` NamJae Jeon
2011-10-10 23:17 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318269042-16806-6-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=joe@perches.com \
--cc=linkinjeon@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).