[Concept,04/12] ext4l: Use EXT4L_PRINTF to enable ext4 diagnostic messages

Message ID 20251223011632.380026-5-sjg@u-boot.org
State New
Headers
Series ext4l: Add support for listing directoties (Part H) |

Commit Message

Simon Glass Dec. 23, 2025, 1:16 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Enable EXT4L_PRINTF when CONFIG_EXT4L_DEBUG is set so that ext4_msg()
and other diagnostic macros print full messages instead of empty
strings.

Use EXT4L_PRINTF instead of CONFIG_PRINTK since U-Boot requires CONFIG_
options to be defined in Kconfig.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4.h       |  2 +-
 fs/ext4l/ext4_uboot.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
  

Patch

diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h
index 5c37fcd76f9..b2f75437bbc 100644
--- a/fs/ext4l/ext4.h
+++ b/fs/ext4l/ext4.h
@@ -3237,7 +3237,7 @@  void __ext4_grp_locked_error(const char *, unsigned int,
 #define ext4_abort(sb, err, fmt, a...)					\
 	__ext4_error((sb), __func__, __LINE__, true, (err), 0, (fmt), ## a)
 
-#ifdef CONFIG_PRINTK
+#ifdef EXT4L_PRINTF
 
 #define ext4_error_inode(inode, func, line, block, fmt, ...)		\
 	__ext4_error_inode(inode, func, line, block, 0, fmt, ##__VA_ARGS__)
diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 6dd498c8f52..5c6e65b6e76 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -37,6 +37,17 @@ 
 #include <linux/rbtree.h>	/* Real rbtree implementation */
 #include <u-boot/crc.h>		/* For crc32() used by crc32_be */
 
+/*
+ * Enable ext4_msg() and other diagnostic macros to print full messages.
+ * This is needed for CONFIG_EXT4L_DEBUG to show useful error messages.
+ *
+ * Use EXT4L_PRINTF instead of CONFIG_PRINTK since U-Boot requires CONFIG_
+ * options to be defined in Kconfig.
+ */
+#ifdef CONFIG_EXT4L_DEBUG
+#define EXT4L_PRINTF		1
+#endif
+
 /*
  * Override no_printk to avoid format warnings in disabled debug prints.
  * The Linux kernel uses sector_t as u64, but U-Boot uses unsigned long.