summaryrefslogtreecommitdiffstats
path: root/libglusterfs
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
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')
-rw-r--r--libglusterfs/src/glusterfs.h4
-rw-r--r--libglusterfs/src/xlator.c37
-rw-r--r--libglusterfs/src/xlator.h1
3 files changed, 38 insertions, 4 deletions
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 76891f5b0..6ec8a2a63 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -225,8 +225,8 @@ struct _cmd_args {
/* fuse options */
int fuse_direct_io_mode_flag;
- unsigned int fuse_entry_timeout;
- unsigned int fuse_attribute_timeout;
+ double fuse_entry_timeout;
+ double fuse_attribute_timeout;
char *volume_name;
int non_local; /* Used only by darwin os,
used for '-o local' option */
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;
}
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index eadc9fd1a..a24184ab8 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -752,6 +752,7 @@ typedef enum {
GF_OPTION_TYPE_XLATOR,
GF_OPTION_TYPE_PATH,
GF_OPTION_TYPE_TIME,
+ GF_OPTION_TYPE_DOUBLE,
} volume_option_type_t;
#define ZR_VOLUME_MAX_NUM_KEY 4