return 0;
}
+errcode_t
+profile_get_double(profile_t profile, const char *name, const char *subname,
+ const char *subsubname, double def_val, double *ret_double)
+{
+ const char *value;
+ errcode_t retval;
+ char *end_value;
+ double double_val;
+
+ *ret_double = def_val;
+ if (profile == 0)
+ return 0;
+
+ retval = profile_get_value(profile, name, subname, subsubname, &value);
+ if (retval == PROF_NO_SECTION || retval == PROF_NO_RELATION) {
+ *ret_double = def_val;
+ return 0;
+ } else if (retval)
+ return retval;
+
+ if (value[0] == 0)
+ /* Empty string is no good. */
+ return PROF_BAD_INTEGER;
+ errno = 0;
+ double_val = strtod(value, &end_value);
+
+ /* Overflow or underflow. */
+ if (errno != 0)
+ return PROF_BAD_INTEGER;
+ /* Garbage in string. */
+ if (end_value != value + strlen(value))
+ return PROF_BAD_INTEGER;
+
+ *ret_double = double_val;
+ return 0;
+}
+
static const char *const conf_yes[] = {
"y", "yes", "true", "t", "1", "on",
0,
const char *subsubname, unsigned int def_val,
unsigned int *ret_int);
+long profile_get_double
+ (profile_t profile, const char *name, const char *subname,
+ const char *subsubname, double def_val,
+ double *ret_float);
+
long profile_get_boolean
(profile_t profile, const char *name, const char *subname,
const char *subsubname, int def_val,
return ret;
}
+static double get_double_from_profile(char **fs_types, const char *opt,
+ double def_val)
+{
+ double ret;
+ char **cpp;
+
+ profile_get_double(profile, "defaults", opt, 0, def_val, &ret);
+ for (cpp = fs_types; *cpp; cpp++)
+ profile_get_double(profile, "fs_types", *cpp, opt, ret, &ret);
+ return ret;
+}
+
static int get_bool_from_profile(char **fs_types, const char *opt, int def_val)
{
int ret;
int inode_ratio = 0;
int inode_size = 0;
unsigned long flex_bg_size = 0;
- double reserved_ratio = 5.0;
+ double reserved_ratio = -1.0;
int lsector_size = 0, psector_size = 0;
int show_version_only = 0;
unsigned long long num_inodes = 0; /* unsigned long long to catch too-large input */
EXT3_FEATURE_COMPAT_HAS_JOURNAL;
}
+ /* Get reserved_ratio from profile if not specified on cmd line. */
+ if (reserved_ratio < 0.0) {
+ reserved_ratio = get_double_from_profile(
+ fs_types, "reserved_ratio", 5.0);
+ if (reserved_ratio > 50 || reserved_ratio < 0) {
+ com_err(program_name, 0,
+ _("invalid reserved blocks percent - %lf"),
+ reserved_ratio);
+ exit(1);
+ }
+ }
+
if (fs_param.s_feature_incompat &
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
reserved_ratio = 0;
specific section of the configuration file does not specify a default
inode size.
.TP
+.I reserved_ratio
+This relation specifies the default percentage of filesystem blocks
+reserved for the super-user, if the user does not
+specify one on the command line, and the filesystem-type
+specific section of the configuration file does not specify a default
+reserved ratio. This value can be a floating point number.
+.TP
.I undo_dir
This relation specifies the directory where the undo file should be
stored. It can be overridden via the
This relation specifies the default inode size if the user does not
specify one on the command line.
.TP
+.I reserved_ratio
+This relation specifies the default percentage of filesystem blocks
+reserved for the super-user, if the user does not specify one on the command
+line.
+.TP
.I hash_alg
This relation specifies the default hash algorithm used for the
new filesystems with hashed b-tree directories. Valid algorithms
blocksize = 4096
inode_size = 256
inode_ratio = 16384
+ reserved_ratio = 5.0
enable_periodic_fsck = true
lazy_itable_init = false
default_mntopts = ^acl