mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] erofs: using macro instead of definition of log functions
@ 2024-10-16 15:24 Gou Hao
  2024-10-16 15:24 ` [PATCH 2/2] erofs: simplify declaration of the " Gou Hao
  2024-10-17  3:39 ` [PATCH 1/2] erofs: using macro instead of definition of " Gao Xiang
  0 siblings, 2 replies; 4+ messages in thread
From: Gou Hao @ 2024-10-16 15:24 UTC (permalink / raw)
  To: xiang, chao; +Cc: linux-erofs, linux-kernel, gouhaojake

No functional change intended.

Signed-off-by: Gou Hao <gouhao@uniontech.com>
---
 fs/erofs/super.c | 51 ++++++++++++++++++------------------------------
 1 file changed, 19 insertions(+), 32 deletions(-)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 666873f745da..b04f888c8123 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -18,39 +18,26 @@
 
 static struct kmem_cache *erofs_inode_cachep __read_mostly;
 
-void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start(args, fmt);
-
-	vaf.fmt = fmt;
-	vaf.va = &args;
-
-	if (sb)
-		pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
-	else
-		pr_err("%s: %pV", func, &vaf);
-	va_end(args);
-}
-
-void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start(args, fmt);
-
-	vaf.fmt = fmt;
-	vaf.va = &args;
+#define _erofs_log_def(name) \
+	void _erofs_##name(struct super_block *sb, const char *func, const char *fmt, ...) \
+	{ \
+		struct va_format vaf; \
+		va_list args; \
+		\
+		va_start(args, (fmt)); \
+		\
+		vaf.fmt = (fmt); \
+		vaf.va = &args; \
+		\
+		if ((sb)) \
+			pr_##name("(device %s): %s: %pV", (sb)->s_id, (func), &vaf); \
+		else \
+			pr_##name("%s: %pV", (func), &vaf); \
+		va_end(args); \
+	}
 
-	if (sb)
-		pr_info("(device %s): %pV", sb->s_id, &vaf);
-	else
-		pr_info("%pV", &vaf);
-	va_end(args);
-}
+_erofs_log_def(err);
+_erofs_log_def(info);
 
 static int erofs_superblock_csum_verify(struct super_block *sb, void *sbdata)
 {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-17  3:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-16 15:24 [PATCH 1/2] erofs: using macro instead of definition of log functions Gou Hao
2024-10-16 15:24 ` [PATCH 2/2] erofs: simplify declaration of the " Gou Hao
2024-10-17  3:42   ` Gao Xiang
2024-10-17  3:39 ` [PATCH 1/2] erofs: using macro instead of definition of " Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®