summaryrefslogtreecommitdiff
path: root/misc/mke2fs.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-06-14 14:17:56 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-06-14 14:32:41 -0400
commit4c2b28ab67dec1e1c4173a0e7e785dae09d161d2 (patch)
treeab966cf3833205b3091c4a1157d401613a8d410e /misc/mke2fs.c
parent8f36e6925f817ed5086550c97796e09905fbb234 (diff)
downloade2fsprogs-4c2b28ab67dec1e1c4173a0e7e785dae09d161d2.tar.gz
mke2fs: Add support for [devices] stanza in mke2fs.conf
Add the [devices] stanza which allows device-specific defaults to be specified in the mke2fs.conf file. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc/mke2fs.c')
-rw-r--r--misc/mke2fs.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 5ff3f9fe..69f94f07 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1190,8 +1190,8 @@ static void PRS(int argc, char *argv[])
errcode_t retval;
char * oldpath = getenv("PATH");
char * extended_opts = 0;
- const char * fs_type = 0;
- const char * usage_types = 0;
+ char * fs_type = 0;
+ char * usage_types = 0;
blk64_t dev_size;
blk64_t fs_blocks_count = 0;
#ifdef __linux__
@@ -1448,10 +1448,10 @@ profile_error:
super_only = 1;
break;
case 't':
- fs_type = optarg;
+ fs_type = strdup(optarg);
break;
case 'T':
- usage_types = optarg;
+ usage_types = strdup(optarg);
break;
case 'U':
fs_uuid = optarg;
@@ -1589,6 +1589,13 @@ profile_error:
proceed_question();
}
+ if (!fs_type)
+ profile_get_string(profile, "devices", device_name,
+ "fs_type", 0, &fs_type);
+ if (!usage_types)
+ profile_get_string(profile, "devices", device_name,
+ "usage_types", 0, &usage_types);
+
/*
* We have the file system (or device) size, so we can now
* determine the appropriate file system types so the fs can
@@ -1946,6 +1953,9 @@ profile_error:
*/
ext2fs_r_blocks_count_set(&fs_param, reserved_ratio *
ext2fs_blocks_count(&fs_param) / 100.0);
+
+ free(fs_type);
+ free(usage_types);
}
static int should_do_undo(const char *name)