linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] ntfs3: Use more common logging function names and style
Date: Fri, 21 Aug 2020 15:16:38 -0700	[thread overview]
Message-ID: <1e246c968ee9e4fec03094ace92b4076c297ff80.1598047822.git.joe@perches.com> (raw)
In-Reply-To: <cover.1598047822.git.joe@perches.com>

Convert the ntfs_<foo>_trace function names to _printk.

Miscellanea:

o Change the macros that use these functions
o Use the more common ..., ##__VA_ARGS__ style

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/ntfs3/debug.h   | 30 +++++++++++++++++-------------
 fs/ntfs3/ntfs_fs.h |  4 ++--
 fs/ntfs3/super.c   | 31 ++++++++++++++++++++-----------
 3 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/fs/ntfs3/debug.h b/fs/ntfs3/debug.h
index ee348daeb7a9..b8f09f41508a 100644
--- a/fs/ntfs3/debug.h
+++ b/fs/ntfs3/debug.h
@@ -23,23 +23,27 @@
 #define WordAlign(n) (((n) + 1u) & (~1u))
 #define IsWordAligned(n) (!((size_t)(n)&1u))
 
-__printf(3, 4) void __ntfs_trace(const struct super_block *sb,
-				 const char *level, const char *fmt, ...);
+__printf(2, 3)
+void ntfs_printk(const struct super_block *sb,
+				const char *fmt, ...);
 __printf(3, 4) void __ntfs_fs_error(struct super_block *sb, int report,
 				    const char *fmt, ...);
-__printf(3, 4) void __ntfs_inode_trace(struct inode *inode, const char *level,
-				       const char *fmt, ...);
+__printf(2, 3)
+void ntfs_inode_printk(struct inode *inode, const char *fmt, ...);
 
-#define ntfs_trace(sb, fmt, args...) __ntfs_trace(sb, KERN_NOTICE, fmt, ##args)
-#define ntfs_error(sb, fmt, args...) __ntfs_trace(sb, KERN_ERR, fmt, ##args)
-#define ntfs_warning(sb, fmt, args...)                                         \
-	__ntfs_trace(sb, KERN_WARNING, fmt, ##args)
+#define ntfs_trace(sb, fmt, ...)					\
+	ntfs_printk(sb, KERN_NOTICE fmt, ##__VA_ARGS__)
+#define ntfs_error(sb, fmt, ...)					\
+	ntfs_printk(sb, KERN_ERR fmt, ##__VA_ARGS__)
+#define ntfs_warning(sb, fmt, ...)					\
+	ntfs_printk(sb, KERN_WARNING fmt, ##__VA_ARGS__)
 
-#define ntfs_fs_error(sb, fmt, args...) __ntfs_fs_error(sb, 1, fmt, ##args)
-#define ntfs_inode_error(inode, fmt, args...)                                  \
-	__ntfs_inode_trace(inode, KERN_ERR, fmt, ##args)
-#define ntfs_inode_warning(inode, fmt, args...)                                \
-	__ntfs_inode_trace(inode, KERN_WARNING, fmt, ##args)
+#define ntfs_fs_error(sb, fmt, ...)					\
+	__ntfs_fs_error(sb, 1, fmt, ##__VA_ARGS__)
+#define ntfs_inode_error(inode, fmt, ...)				\
+	ntfs_inode_printk(inode, KERN_ERR fmt, ##__VA_ARGS__)
+#define ntfs_inode_warning(inode, fmt, ...)				\
+	ntfs_inode_printk(inode, KERN_WARNING fmt, ##__VA_ARGS__)
 
 static inline void *ntfs_alloc(size_t size, int zero)
 {
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 0024fcad3b89..4609467e211c 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -857,8 +857,8 @@ static inline struct buffer_head *ntfs_bread(struct super_block *sb,
 	if (bh)
 		return bh;
 
-	__ntfs_trace(sb, KERN_ERR, "failed to read volume at offset 0x%llx",
-		     (u64)block << sb->s_blocksize_bits);
+	ntfs_error(sb, "failed to read volume at offset 0x%llx",
+		   (u64)block << sb->s_blocksize_bits);
 	return NULL;
 }
 
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index af41aec384b1..3a8a0a6c2cb8 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -31,35 +31,40 @@
 #include "ntfs_fs.h"
 
 /**
- * ntfs_trace() - print preformated ntfs specific messages.
+ * ntfs_printk() - print preformatted ntfs specific messages.
  */
-void __ntfs_trace(const struct super_block *sb, const char *level,
-		  const char *fmt, ...)
+void ntfs_printk(const struct super_block *sb, const char *fmt, ...)
 {
 	struct va_format vaf;
 	va_list args;
+	int level;
 
 	va_start(args, fmt);
-	vaf.fmt = fmt;
+
+	level = printk_get_level(fmt);
+	vaf.fmt = printk_skip_level(fmt);
 	vaf.va = &args;
 	if (!sb)
-		printk("%sntfs3: %pV", level, &vaf);
+		printk("%c%cntfs3: %pV",
+		       KERN_SOH_ASCII, level, &vaf);
 	else
-		printk("%sntfs3: %s: %pV", level, sb->s_id, &vaf);
+		printk("%c%cntfs3: %s: %pV",
+		       KERN_SOH_ASCII, level, sb->s_id, &vaf);
+
 	va_end(args);
 }
 
 /* prints info about inode using dentry case if */
-void __ntfs_inode_trace(struct inode *inode, const char *level, const char *fmt,
-			...)
+void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
 {
 	struct super_block *sb = inode->i_sb;
 	ntfs_sb_info *sbi = sb->s_fs_info;
 	struct dentry *dentry;
 	const char *name = "?";
 	char buf[48];
-	va_list args;
 	struct va_format vaf;
+	va_list args;
+	int level;
 
 	if (!__ratelimit(&sbi->ratelimit))
 		return;
@@ -74,9 +79,13 @@ void __ntfs_inode_trace(struct inode *inode, const char *level, const char *fmt,
 	}
 
 	va_start(args, fmt);
-	vaf.fmt = fmt;
+
+	level = printk_get_level(fmt);
+	vaf.fmt = printk_skip_level(fmt);
 	vaf.va = &args;
-	printk("%s%s on %s: %pV", level, name, sb->s_id, &vaf);
+	printk("%c%c%s on %s: %pV",
+	       KERN_SOH_ASCII, level, name, sb->s_id, &vaf);
+
 	va_end(args);
 
 	if (dentry) {
-- 
2.26.0


  reply	other threads:[~2020-08-21 22:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 22:16 [PATCH 0/3] ntfs3: Update logging Joe Perches
2020-08-21 22:16 ` Joe Perches [this message]
2020-08-21 22:16 ` [PATCH 2/3] ntfs3: Rename logging macros and uses Joe Perches
2020-08-21 22:16 ` [PATCH 3/3] ntfs3: Rename ntfs_trace to ntfs_notice Joe Perches

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=1e246c968ee9e4fec03094ace92b4076c297ff80.1598047822.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linux-kernel@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).