aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2023-05-05 18:02:03 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2023-05-17 18:13:02 -0700
commita794fd2690f79bc502ac0d6a9ad57823961c4d14 (patch)
tree2d578482cb09c8344fd25cad3f50ca493eaba9d5
parent980fb3dfc46244a23102f372191bdb02cc2c7a27 (diff)
downloadf2fs-tools-a794fd2690f79bc502ac0d6a9ad57823961c4d14.tar.gz
f2fs-tools: add DISP_u8() macro
Introduce DISP_u8(), and use DISP_u16() and DISP_u8() to print below fields: - i_compress_algorithm - i_log_cluster_size - i_compress_flag Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fsck/mount.c6
-rw-r--r--include/f2fs_fs.h11
2 files changed, 14 insertions, 3 deletions
diff --git a/fsck/mount.c b/fsck/mount.c
index e490990..f8daab8 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -302,9 +302,9 @@ void print_inode_info(struct f2fs_sb_info *sbi,
}
if (c.feature & cpu_to_le32(F2FS_FEATURE_COMPRESSION)) {
DISP_u64(inode, i_compr_blocks);
- DISP_u32(inode, i_compress_algorithm);
- DISP_u32(inode, i_log_cluster_size);
- DISP_u32(inode, i_compress_flag);
+ DISP_u8(inode, i_compress_algorithm);
+ DISP_u8(inode, i_log_cluster_size);
+ DISP_u16(inode, i_compress_flag);
}
}
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index b8426e2..7d6cb2d 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -282,6 +282,17 @@ static inline uint64_t bswap_64(uint64_t val)
printf("%-30s" fmt, #member, ((ptr)->member)); \
} while (0)
+#define DISP_u8(ptr, member) \
+ do { \
+ assert(sizeof((ptr)->member) == 1); \
+ if (c.layout) \
+ printf("%-30s %u\n", \
+ #member":", ((ptr)->member)); \
+ else \
+ printf("%-30s" "\t\t[0x%8x : %u]\n", \
+ #member, ((ptr)->member), ((ptr)->member)); \
+ } while (0)
+
#define DISP_u16(ptr, member) \
do { \
assert(sizeof((ptr)->member) == 2); \