summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorCsaba Henk <csaba@redhat.com>2012-06-01 15:00:16 +0530
committerAnand Avati <avati@redhat.com>2012-06-01 15:18:26 -0700
commited6aba9463e2d247edef0eaa6248d6036fbb810b (patch)
tree73601b29b225702770b16bd984cde73c14e56a81 /libglusterfs
parent0ebe766bd4211466c4f89b7d48baa0cdaaac08ed (diff)
core: xlator option framework cleanups
- Upon init/reconf, if an option is not in the opt dict, and a default value is neither specified, null it out. With this, the xlator config data that comes out of init/reconf becomes deterministic in terms of the xlator option declarations and the incoming option value dictionary. (Needed for correct operation of volume reset.) - We can rely bravely on the guarantee given by init/reconf as of which no NULL value is passed to the converter functions. Drop the spurious null check of not_null(), and rebaptize it to pass(). Change-Id: Ifa068bcc0275456c01ed00a3a315a985eb262e49 BUG: 765147 Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3505 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/options.c13
-rw-r--r--libglusterfs/src/options.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index 0cec59fdb06..6ec1478cee3 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -988,11 +988,8 @@ out:
static int
-not_null (char *in, char **out)
+pass (char *in, char **out)
{
- if (!in || !out)
- return -1;
-
*out = in;
return 0;
}
@@ -1031,7 +1028,7 @@ pc_or_size (char *in, uint64_t *out)
}
-DEFINE_INIT_OPT(char *, str, not_null);
+DEFINE_INIT_OPT(char *, str, pass);
DEFINE_INIT_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_INIT_OPT(int64_t, int64, gf_string2int64);
DEFINE_INIT_OPT(uint32_t, uint32, gf_string2uint32);
@@ -1041,11 +1038,11 @@ DEFINE_INIT_OPT(uint32_t, percent, gf_string2percent);
DEFINE_INIT_OPT(uint64_t, percent_or_size, pc_or_size);
DEFINE_INIT_OPT(gf_boolean_t, bool, gf_string2boolean);
DEFINE_INIT_OPT(xlator_t *, xlator, xl_by_name);
-DEFINE_INIT_OPT(char *, path, not_null);
+DEFINE_INIT_OPT(char *, path, pass);
-DEFINE_RECONF_OPT(char *, str, not_null);
+DEFINE_RECONF_OPT(char *, str, pass);
DEFINE_RECONF_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_RECONF_OPT(int64_t, int64, gf_string2int64);
DEFINE_RECONF_OPT(uint32_t, uint32, gf_string2uint32);
@@ -1055,4 +1052,4 @@ DEFINE_RECONF_OPT(uint32_t, percent, gf_string2percent);
DEFINE_RECONF_OPT(uint64_t, percent_or_size, pc_or_size);
DEFINE_RECONF_OPT(gf_boolean_t, bool, gf_string2boolean);
DEFINE_RECONF_OPT(xlator_t *, xlator, xl_by_name);
-DEFINE_RECONF_OPT(char *, path, not_null);
+DEFINE_RECONF_OPT(char *, path, pass);
diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h
index 01d2a9d5f1b..8c0ff2499c9 100644
--- a/libglusterfs/src/options.h
+++ b/libglusterfs/src/options.h
@@ -131,6 +131,7 @@ xlator_option_init_##type (xlator_t *this, dict_t *options, char *key, \
if (!value) { \
gf_log (this->name, GF_LOG_TRACE, "option %s not set", \
key); \
+ *val_p = (type_t)0; \
return 0; \
} \
if (value == def_value) { \
@@ -209,6 +210,7 @@ xlator_option_reconf_##type (xlator_t *this, dict_t *options, char *key, \
if (!value) { \
gf_log (this->name, GF_LOG_TRACE, "option %s not set", \
key); \
+ *val_p = (type_t)0; \
return 0; \
} \
if (value == def_value) { \