From 415a6057f14d31f4e1d90140e31a4e61ac7f172c Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sat, 2 Feb 2008 01:56:07 -0700 Subject: [PATCH] e2fsprogs-debugfs-supported_features.patch Print out the currently supported features of e2fsprogs/libext2fs via a new "debugfs supported_features" command. Signed-off-by: Kalpak Shah Signed-off-by: Andreas Dilger --- debugfs/debug_cmds.ct | 3 +++ debugfs/debugfs.c | 38 ++++++++++++++++++++++++++++++++++++++ lib/ext2fs/ext2_fs.h | 3 +-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/debugfs/debug_cmds.ct b/debugfs/debug_cmds.ct index a4a5a4c15..59314b81d 100644 --- a/debugfs/debug_cmds.ct +++ b/debugfs/debug_cmds.ct @@ -154,5 +154,8 @@ request do_dump_unused, "Dump unused blocks", request do_set_current_time, "Set current time to use when setting filesystme fields", set_current_time; +request do_supported_features, "Print features supported by this version of e2fsprogs", + supported_features; + end; diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 9ebd92481..9f0bfc21d 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -1773,6 +1773,44 @@ void do_set_current_time(int argc, char *argv[]) } } +void do_supported_features(int argc, char *argv[]) +{ + FILE *out = stdout; + int i, j, ret; + __u32 supp[3] = { EXT2_LIB_FEATURE_COMPAT_SUPP, + EXT2_LIB_FEATURE_INCOMPAT_SUPP, + EXT2_LIB_FEATURE_RO_COMPAT_SUPP }; + __u32 m; + int compat; + unsigned int feature_flag; + + if (argc >= 1) { + ret = e2p_string2feature(argv[1], &compat, &feature_flag); + if (ret) + goto err; + + if (!(supp[compat] & feature_flag)) + goto err; + + fprintf(out, "Supported feature: %s\n", argv[1]); + } else { + fprintf(out, "Supported features:"); + for (i = 0; i < 3; i++) { + for (j = 0, m = 1; j < 32; j++, m <<= 1) { + if (supp[i] & m) + fprintf(out, " %s", + e2p_feature2string(i, m)); + } + } + fprintf(out, "\n"); + } + + return; + +err: + com_err(argv[0], 0, "Unknown feature: %s\n", argv[1]); +} + static int source_file(const char *cmd_file, int sci_idx) { FILE *f; diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 51cecfa02..9218e4228 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -669,8 +669,7 @@ struct ext2_super_block { #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \ - EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE| \ - EXT2_FEATURE_RO_COMPAT_BTREE_DIR) + EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) /* * Default values for user and/or group using reserved blocks -- 2.47.2