From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 4/6] f2fs-tools: add DISP_u8() macro
Date: Fri, 5 May 2023 18:02:03 +0800 [thread overview]
Message-ID: <20230505100205.1921708-4-chao@kernel.org> (raw)
In-Reply-To: <20230505100205.1921708-1-chao@kernel.org>
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>
---
fsck/mount.c | 6 +++---
include/f2fs_fs.h | 11 +++++++++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index b314756..5e475a3 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 dca4cd8..e5d5d13 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); \
--
2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2023-05-05 10:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 10:02 [f2fs-dev] [PATCH 1/6] f2fs-tools: add packed attribute for struct f2fs_super_block Chao Yu
2023-05-05 10:02 ` [f2fs-dev] [PATCH 2/6] f2fs-tools: rename i_padding to i_compress_flag Chao Yu
2023-05-05 10:02 ` [f2fs-dev] [PATCH 3/6] f2fs-tools: fix typo in f2fs_inode structure Chao Yu
2023-05-05 10:02 ` Chao Yu [this message]
2023-05-05 10:02 ` [f2fs-dev] [PATCH 5/6] f2fs-tools: print more raw sb info Chao Yu
2023-05-05 10:02 ` [f2fs-dev] [PATCH 6/6] f2fs-tools: use f2fs_init_inode() to clean up codes Chao Yu
2023-05-08 19:42 ` Jaegeuk Kim
2023-05-17 2:02 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230505100205.1921708-4-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).