lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Aug 2020 15:16:38 -0700
From:   Joe Perches <joe@...ches.com>
To:     Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] ntfs3: Use more common logging function names and style

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@...ches.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ