From ed6aba9463e2d247edef0eaa6248d6036fbb810b Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Fri, 1 Jun 2012 15:00:16 +0530 Subject: 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 Reviewed-on: http://review.gluster.com/3505 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/options.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'libglusterfs/src/options.c') diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c index 0cec59fdb..6ec1478ce 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); -- cgit