summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2012-09-03 15:53:40 +0530
committerVijay Bellur <vbellur@redhat.com>2012-09-05 07:42:14 -0700
commita06a074b8cf3444acabca9003ae98539029453b0 (patch)
tree9b4a821e0883c150244e0dd662734d1b6c6b5747 /xlators/mgmt
parentb80158698405f198a3d2b77ee5817d1096740600 (diff)
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 (<domain>.<specifier>) and short (<specifier>)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 <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/3893 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Csaba Henk <csaba@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index ba6c61259b3..28f480a3142 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;