From a06a074b8cf3444acabca9003ae98539029453b0 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Mon, 3 Sep 2012 15:53:40 +0530 Subject: glusterd: Removed pattern match lookup logic on volume options In light of the comments received on the following patch, http://review.gluster.com/#change,3860 this change knocks off the pattern match lookup logic that once enabled wildcard entries to be used for volume options. Here's a bit on the history of the macro "pattern_match_options", coming straight from the author's(Csaba) mouth: "So, the history of pattern_match_options is as follows: i. In the volume option table we used to be able to have wildcard entries like auth.addr.*.allow and there was a special lookup logic to support that, cf. http://github.com/gluster/glusterfs/commit/v3.1.0qa40~19 ii. However, later on we stopped using this mechanism: http://github.com/gluster/glusterfs/commit/v3.1.0qa40~9 iii. Later on we added the code that allowed the usage of option names both in fully qualified (.) and short ()forms: http://github.com/gluster/glusterfs/commit/v3.1.0qa41~10. At this point, maintaining support for wildcard table entries became more difficult (~ error prone), so that part was placed under the macro pattern_match_options and -- given that we made no use of the feature -- a simple direct lookup logic was introduced. I chose to keep the pattern matching logic in the code because I was not really sure about the future of it and thought we might want wildcarded table entries later. ..." Change-Id: I261735143891931e8150c36fe5b33ae74b1c663d BUG: 847846 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/3893 Tested-by: Gluster Build System Reviewed-by: Csaba Henk --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 43 ----------------------------- 1 file changed, 43 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index ba6c61259..28f480a31 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -649,9 +649,6 @@ struct opthandler_data { void *param; }; -#define pattern_match_options 0 - - static void process_option (dict_t *dict, char *key, data_t *value, void *param) { @@ -660,10 +657,6 @@ process_option (dict_t *dict, char *key, data_t *value, void *param) if (odt->rv) return; -#if pattern_match_options - if (fnmatch (odt->vme->key, key, 0) != 0) - return; -#endif odt->found = _gf_true; vme.key = key; @@ -702,14 +695,10 @@ volgen_graph_set_options_generic (volgen_graph_t *graph, dict_t *dict, odt.found = _gf_false; odt.data_t_fake = _gf_false; -#if pattern_match_options - dict_foreach (dict, process_option, &odt); -#else data = dict_get (dict, vme->key); if (data) process_option (dict, vme->key, data, &odt); -#endif if (odt.rv) return odt.rv; @@ -988,14 +977,12 @@ glusterd_check_voloption (char *key) int glusterd_check_option_exists (char *key, char **completion) { - dict_t *dict = NULL; struct volopt_map_entry vme = {0,}; struct volopt_map_entry *vmep = NULL; int ret = 0; (void)vme; (void)vmep; - (void)dict; if (!strchr (key, '.')) { if (completion) { @@ -1014,42 +1001,12 @@ glusterd_check_option_exists (char *key, char **completion) return 0; } -#if !pattern_match_options for (vmep = glusterd_volopt_map; vmep->key; vmep++) { if (strcmp (vmep->key, key) == 0) { ret = 1; break; } } -#else - vme.key = key; - - /* We are getting a bit anal here to avoid typing - * fnmatch one more time. Orthogonality foremost! - * The internal logic of looking up in the volopt_map table - * should be coded exactly once. - * - * [[Ha-ha-ha, so now if I ever change the internals then I'll - * have to update the fnmatch in this comment also :P ]] - */ - dict = get_new_dict (); - if (!dict || dict_set_str (dict, key, "")) { - gf_log ("", GF_LOG_ERROR, "Out of memory"); - - return -1; - } - - ret = volgen_graph_set_options_generic (NULL, dict, &vme, - &optget_option_handler); - dict_destroy (dict); - if (ret) { - gf_log ("", GF_LOG_ERROR, "Out of memory"); - - return -1; - } - - ret = !!vme.value; -#endif if (ret || !completion) return ret; -- cgit