summaryrefslogtreecommitdiff
path: root/misc/mke2fs.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2010-12-22 18:22:40 -0500
committerTheodore Ts'o <tytso@mit.edu>2010-12-22 18:22:40 -0500
commit9b27e9cc320dd7da24356561b3b12c66f2540432 (patch)
tree4f30f92ab5132d1ead78c1d4da84014ce13736b7 /misc/mke2fs.c
parent5182ad4c2165fa807fa0a3034aaab589d6c1d577 (diff)
downloade2fsprogs-9b27e9cc320dd7da24356561b3b12c66f2540432.tar.gz
mke2fs: take the device size into account when determining the size type
If the file system size was not specified on the command line, we were always using the usage type "floppy" since we didn't determine the device size until after calling parse_fs_types(). Doh! Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc/mke2fs.c')
-rw-r--r--misc/mke2fs.c73
1 files changed, 40 insertions, 33 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index c07deba8..f453f57f 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1495,39 +1495,7 @@ profile_error:
fs_param.s_log_frag_size = fs_param.s_log_block_size;
- fs_types = parse_fs_type(fs_type, usage_types, &fs_param, fs_blocks_count,
- argv[0]);
- if (!fs_types) {
- fprintf(stderr, _("Failed to parse fs types list\n"));
- exit(1);
- }
-
- /* Figure out what features should be enabled */
-
- tmp = NULL;
- if (fs_param.s_rev_level != EXT2_GOOD_OLD_REV) {
- tmp = get_string_from_profile(fs_types, "base_features",
- "sparse_super,filetype,resize_inode,dir_index");
- edit_feature(tmp, &fs_param.s_feature_compat);
- free(tmp);
-
- for (cpp = fs_types; *cpp; cpp++) {
- tmp = NULL;
- profile_get_string(profile, "fs_types", *cpp,
- "features", "", &tmp);
- if (tmp && *tmp)
- edit_feature(tmp, &fs_param.s_feature_compat);
- if (tmp)
- free(tmp);
- }
- tmp = get_string_from_profile(fs_types, "default_features",
- "");
- }
- edit_feature(fs_features ? fs_features : tmp,
- &fs_param.s_feature_compat);
- if (tmp)
- free(tmp);
-
+ /* Determine the size of the device (if possible) */
if (noaction && fs_blocks_count) {
dev_size = fs_blocks_count;
retval = 0;
@@ -1573,6 +1541,45 @@ profile_error:
}
/*
+ * We have the file system (or device) size, so we can now
+ * determine the appropriate file system types so the fs can
+ * be appropriately configured.
+ */
+ fs_types = parse_fs_type(fs_type, usage_types, &fs_param,
+ fs_blocks_count ? fs_blocks_count : dev_size,
+ argv[0]);
+ if (!fs_types) {
+ fprintf(stderr, _("Failed to parse fs types list\n"));
+ exit(1);
+ }
+
+ /* Figure out what features should be enabled */
+
+ tmp = NULL;
+ if (fs_param.s_rev_level != EXT2_GOOD_OLD_REV) {
+ tmp = get_string_from_profile(fs_types, "base_features",
+ "sparse_super,filetype,resize_inode,dir_index");
+ edit_feature(tmp, &fs_param.s_feature_compat);
+ free(tmp);
+
+ for (cpp = fs_types; *cpp; cpp++) {
+ tmp = NULL;
+ profile_get_string(profile, "fs_types", *cpp,
+ "features", "", &tmp);
+ if (tmp && *tmp)
+ edit_feature(tmp, &fs_param.s_feature_compat);
+ if (tmp)
+ free(tmp);
+ }
+ tmp = get_string_from_profile(fs_types, "default_features",
+ "");
+ }
+ edit_feature(fs_features ? fs_features : tmp,
+ &fs_param.s_feature_compat);
+ if (tmp)
+ free(tmp);
+
+ /*
* We now need to do a sanity check of fs_blocks_count for
* 32-bit vs 64-bit block number support.
*/