f2fs-tools: reuse feature_table to clean up print_sb_state()
PATCH v3 2/2 f2fs-tools: reuse feature_table to clean up print_sb_state()
reuse feature_table in print_sb_state() for cleanup.
Signed-off-by Chao Yu <[email protected]>
---
v3:
- fix a bug in feature_map()
fsck/mount.c | 56 +++++++++++++---------------------------------- include/f2fs_fs.h | 52 +++++++++++++++++++++++++++++-------------- 2 files changed, 50 insertions(+), 58 deletions(-)
fsck/mount.c +15 -41
@@ -599,54 +599,28 @@ void print_cp_state(u32 flag)MSG (0 ,"\n" ); } +extern struct feature feature_table[];void print_sb_state (struct f2fs_super_block *sb) {unsigned int f =get_sb (feature); +char *name;int i;MSG (0 ,"Info: superblock features = %x : " , f); -if (f &F2FS_FEATURE_ENCRYPT ) { -MSG (0 ,"%s" ," encrypt" ); - } -if (f &F2FS_FEATURE_VERITY ) { -MSG (0 ,"%s" ," verity" ); - } -if (f &F2FS_FEATURE_BLKZONED ) { -MSG (0 ,"%s" ," blkzoned" ); - } -if (f &F2FS_FEATURE_EXTRA_ATTR ) { -MSG (0 ,"%s" ," extra_attr" ); - } -if (f &F2FS_FEATURE_PRJQUOTA ) { -MSG (0 ,"%s" ," project_quota" ); - } -if (f &F2FS_FEATURE_INODE_CHKSUM ) { -MSG (0 ,"%s" ," inode_checksum" ); - } -if (f &F2FS_FEATURE_FLEXIBLE_INLINE_XATTR ) { -MSG (0 ,"%s" ," flexible_inline_xattr" ); - } -if (f &F2FS_FEATURE_QUOTA_INO ) { -MSG (0 ,"%s" ," quota_ino" ); - } -if (f &F2FS_FEATURE_INODE_CRTIME ) { -MSG (0 ,"%s" ," inode_crtime" ); - } -if (f &F2FS_FEATURE_LOST_FOUND ) { -MSG (0 ,"%s" ," lost_found" ); - } -if (f &F2FS_FEATURE_SB_CHKSUM ) { -MSG (0 ,"%s" ," sb_checksum" ); - } -if (f &F2FS_FEATURE_CASEFOLD ) { -MSG (0 ,"%s" ," casefold" ); - } -if (f &F2FS_FEATURE_COMPRESSION ) { -MSG (0 ,"%s" ," compression" ); - } -if (f &F2FS_FEATURE_RO ) { -MSG (0 ,"%s" ," ro" ); + +for (i =0 ; i <32 ; i++) { +unsigned int bit =1 << i; + +if (!(f & bit)) +continue ; + + name =feature_name (feature_table, bit); +if (!name) +continue ; + +MSG (0 ," %s" , name); } +MSG (0 ,"\n" );MSG (0 ,"Info: superblock encrypt level = %d, salt = " , sb->encryption_level);
include/f2fs_fs.h +35 -17
70 lines not on this page · raw message
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel