diff mbox series

[f2fs-dev] dump.f2fs: support to show hex of filename

Message ID 20250305111451.2117478-1-chao@kernel.org (mailing list archive)
State New
Headers show
Series [f2fs-dev] dump.f2fs: support to show hex of filename | expand

Commit Message

Chao Yu March 5, 2025, 11:14 a.m. UTC
It can be used to dump hex of unicode/emoji/invisible filename.

i_name                                  [❤]
i_name(hex)                             [0xe2 0x9d 0xa4 0x0]

i_name                                  [❤️]
i_name(hex)                             [0xe2 0x9d 0xa4 0xef 0xb8 0x8f 0x0]

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/mount.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/fsck/mount.c b/fsck/mount.c
index a189ba7..e493f22 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -318,6 +318,11 @@  void print_inode_info(struct f2fs_sb_info *sbi,
 	if (en[0]) {
 		DISP_u32(inode, i_namelen);
 		printf("%-30s\t\t[%s]\n", "i_name", en);
+
+		printf("%-30s\t\t[", "i_name(hex)");
+		for (i = 0; i < F2FS_NAME_LEN && en[i]; i++)
+			printf("0x%x ", (unsigned char)en[i]);
+		printf("0x%x]\n", (unsigned char)en[i]);
 	}
 
 	printf("i_ext: fofs:%x blkaddr:%x len:%x\n",