summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/xlator.c
diff options
context:
space:
mode:
authorHarshavardhana <harsha@zresearch.com>2009-02-19 04:59:06 -0800
committerAnand V. Avati <avati@amp.gluster.com>2009-02-21 21:14:41 +0530
commita2131aeafa94d671b0121631922d823c8a7ab988 (patch)
tree637e748d679061f3b291051fcb35bc84ac9f2a2a /libglusterfs/src/xlator.c
parentb5e0ee918fdff566e45bb255130b9efa6b8fb7b0 (diff)
attritbute and entry timeout values under volume now support float/double values
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r--libglusterfs/src/xlator.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 2b17cc7f6..19f6a7f38 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -286,6 +286,7 @@ _volume_option_value_validate (xlator_t *xl,
{
uint32_t percent = 0;
+
/* Check if the value is valid percentage */
if (gf_string2percent (pair->value->data,
&percent) != 0) {
@@ -341,13 +342,45 @@ _volume_option_value_validate (xlator_t *xl,
ret = 0;
}
break;
+ case GF_OPTION_TYPE_DOUBLE:
+ {
+ double input_time = 0.0;
+
+ /* Check if the value is valid double */
+ if (gf_string2double (pair->value->data,
+ &input_time) != 0) {
+ gf_log (xl->name,
+ GF_LOG_ERROR,
+ "invalid time format \"%s\" in \"option %s\"",
+ pair->value->data, pair->key);
+ goto out;
+ }
+
+ if (input_time < 0.0) {
+ gf_log (xl->name,
+ GF_LOG_ERROR,
+ "invalid time format \"%s\" in \"option %s\"",
+ pair->value->data, pair->key);
+ goto out;
+ }
+
+ if ((opt->min == 0) && (opt->max == 0)) {
+ gf_log (xl->name, GF_LOG_DEBUG,
+ "no range check required for 'option %s %s'",
+ pair->key, pair->value->data);
+ ret = 0;
+ goto out;
+ }
+ ret = 0;
+ }
+ break;
case GF_OPTION_TYPE_ANY:
/* NO CHECK */
ret = 0;
break;
}
-
- out:
+
+out:
return ret;
}