diff options
author | Gaurav <gaurav@gluster.com> | 2011-03-23 00:50:17 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-23 04:55:29 -0700 |
commit | 9bd4f25b6b0ea8103324b685fcc21525a29849a8 (patch) | |
tree | 7b0e0b875934521dea0c6fdd3412ac61972a527e /xlators/performance/quick-read | |
parent | 6f6c817314a2a867be996c2ad6d9a1337617ded4 (diff) |
CLI : Validate options farmework.
Signed-off-by: Gaurav <gaurav@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2064 (NFS options are removed upon glusterd restart)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2064
Diffstat (limited to 'xlators/performance/quick-read')
-rw-r--r-- | xlators/performance/quick-read/src/quick-read.c | 63 |
1 files changed, 14 insertions, 49 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 044b00fd5..465881080 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -3172,64 +3172,29 @@ mem_acct_init (xlator_t *this) int -validate_options (xlator_t *this, dict_t *options, char **op_errstr) +validate_options (xlator_t *this, char **op_errstr) { - char *str = NULL; - int32_t ret = -1; - int32_t cache_timeout = 0; - uint64_t cache_size = 0; + int ret = 0; + volume_opt_list_t *vol_opt = NULL; + volume_opt_list_t *tmp; if (!this) { + gf_log (this->name, GF_LOG_DEBUG, "'this' not a valid ptr"); + ret =-1; goto out; } - ret = dict_get_str (this->options, "cache-timeout", &str); - if (ret == 0) { - ret = gf_string2uint_base10 (str, - (unsigned int *)&cache_timeout); - if (ret != 0) { - gf_log (this->name, GF_LOG_ERROR, - "invalid cache-timeout value %s", str); - *op_errstr = "Invalid Format!!"; - ret = -1; - goto out; - } - if (ret < 1 || ret > 60) { - gf_log (this->name, GF_LOG_ERROR, - "invalid cache-timeout value %s", str); - *op_errstr = "Range 1 <= value <= 60"; - ret = -1; - goto out; - } - } - - ret = dict_get_str (this->options, "cache-size", &str); - if (ret == 0) { - ret = gf_string2bytesize (str, &cache_size); - if (ret != 0) { - gf_log (this->name, GF_LOG_ERROR, - "invalid cache-size value %s", str); - ret = -1; - goto out; - } - if (cache_size > 6 * GF_UNIT_GB) { - gf_log (this->name, GF_LOG_ERROR, - "invalid cache-size value %s", str); - *op_errstr = "Range 4mb <= value <= 6gb"; - ret = -1; - goto out; - } - if (cache_size < 4* GF_UNIT_MB) { - gf_log (this->name, GF_LOG_ERROR, - "invalid cache-size value %s", str); - *op_errstr = "Range 4mb <= value <= 6gb"; - ret = -1; - goto out; - } + if (list_empty (&this->volume_options)) + goto out; + vol_opt = list_entry (this->volume_options.next, + volume_opt_list_t, list); + list_for_each_entry_safe (vol_opt, tmp, &this->volume_options, list) { + ret = validate_xlator_volume_options_attacherr (this, + vol_opt->given_opt, + op_errstr); } - ret =0; out: return ret; } |