From: Akira Fujita Date: Sun, 6 Jul 2014 02:34:07 +0000 (-0400) Subject: mke2fs: add get_uint_from_profile to mke2fs.c X-Git-Tag: v1.42.11~26 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d0de4c95404bf12f70ff0ab01bd8497c5de60c6e;p=tools%2Fe2fsprogs.git mke2fs: add get_uint_from_profile to mke2fs.c We can set flex_bg count only up to 2^30 with profile because get_int_from_profile can handle it to 2^31-1. Add get_uint_from_profile to read unsigned int value so that mke2fs with profile can handle up to 2^31 flex_bg same as -G option. Signed-off-by: Akira Fujita Signed-off-by: Theodore Ts'o --- diff --git a/misc/mke2fs.c b/misc/mke2fs.c index a08709d..ecd47e6 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1310,6 +1310,18 @@ int get_int_from_profile(char **types, const char *opt, int def_val) return ret; } +static unsigned int get_uint_from_profile(char **types, const char *opt, + unsigned int def_val) +{ + unsigned int ret; + char **cpp; + + profile_get_uint(profile, "defaults", opt, 0, def_val, &ret); + for (cpp = types; *cpp; cpp++) + profile_get_uint(profile, "fs_types", *cpp, opt, ret, &ret); + return ret; +} + static double get_double_from_profile(char **types, const char *opt, double def_val) { @@ -2217,8 +2229,8 @@ profile_error: inode_size = get_int_from_profile(fs_types, "inode_size", 0); if (!flex_bg_size && (fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG)) - flex_bg_size = get_int_from_profile(fs_types, - "flex_bg_size", 16); + flex_bg_size = get_uint_from_profile(fs_types, + "flex_bg_size", 16); if (flex_bg_size) { if (!(fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG)) {