summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/xlator.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r--libglusterfs/src/xlator.c154
1 files changed, 16 insertions, 138 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 13213d55994..3dc0c648177 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -214,26 +214,16 @@ xlator_volopt_dynload(char *xlator_type, void **dl_handle,
/* check new struct first, and then check this */
xlapi = dlsym(handle, "xlator_api");
if (!xlapi) {
- gf_msg("xlator", GF_LOG_DEBUG, 0, LG_MSG_DLSYM_ERROR,
- "dlsym(xlator_api) on %s. "
- "Fall back to old symbols",
- dlerror());
- /* This case is not an error for now, so allow it
- to fall back to old methods. */
- opt_list->given_opt = dlsym(handle, "options");
- if (!opt_list->given_opt) {
- dlerror();
- gf_msg("xlator", GF_LOG_ERROR, 0, LG_MSG_LOAD_FAILED,
- "Failed to load xlator opt table");
- goto out;
- }
- } else {
- opt_list->given_opt = xlapi->options;
- if (!opt_list->given_opt) {
- gf_msg("xlator", GF_LOG_ERROR, 0, LG_MSG_LOAD_FAILED,
- "Failed to load xlator options table");
- goto out;
- }
+ gf_msg("xlator", GF_LOG_ERROR, 0, LG_MSG_DLSYM_ERROR,
+ "dlsym(xlator_api) missing: %s", dlerror());
+ goto out;
+ }
+
+ opt_list->given_opt = xlapi->options;
+ if (!opt_list->given_opt) {
+ gf_msg("xlator", GF_LOG_ERROR, 0, LG_MSG_LOAD_FAILED,
+ "Failed to load xlator options table");
+ goto out;
}
*dl_handle = handle;
@@ -249,110 +239,8 @@ out:
return ret;
}
-int
-xlator_dynload_oldway(xlator_t *xl)
-{
- int i = 0;
- int ret = -1;
- void *handle = NULL;
- volume_opt_list_t *vol_opt = NULL;
- class_methods_t *vtbl = NULL;
-
- handle = xl->dlhandle;
-
- xl->fops = dlsym(handle, "fops");
- if (!xl->fops) {
- gf_msg("xlator", GF_LOG_WARNING, 0, LG_MSG_DLSYM_ERROR,
- "dlsym(fops) on %s", dlerror());
- goto out;
- }
-
- xl->cbks = dlsym(handle, "cbks");
- if (!xl->cbks) {
- gf_msg("xlator", GF_LOG_WARNING, 0, LG_MSG_DLSYM_ERROR,
- "dlsym(cbks) on %s", dlerror());
- goto out;
- }
-
- /*
- * If class_methods exists, its contents override any definitions of
- * init or fini for that translator. Otherwise, we fall back to the
- * older method of looking for init and fini directly.
- */
- vtbl = dlsym(handle, "class_methods");
- if (vtbl) {
- xl->init = vtbl->init;
- xl->fini = vtbl->fini;
- xl->reconfigure = vtbl->reconfigure;
- xl->notify = vtbl->notify;
- } else {
- if (!(*VOID(&xl->init) = dlsym(handle, "init"))) {
- gf_msg("xlator", GF_LOG_WARNING, 0, LG_MSG_DLSYM_ERROR,
- "dlsym(init) on %s", dlerror());
- goto out;
- }
-
- if (!(*VOID(&(xl->fini)) = dlsym(handle, "fini"))) {
- gf_msg("xlator", GF_LOG_WARNING, 0, LG_MSG_DLSYM_ERROR,
- "dlsym(fini) on %s", dlerror());
- goto out;
- }
- if (!(*VOID(&(xl->reconfigure)) = dlsym(handle, "reconfigure"))) {
- gf_msg_trace("xlator", 0,
- "dlsym(reconfigure) on %s "
- "-- neglecting",
- dlerror());
- }
- if (!(*VOID(&(xl->notify)) = dlsym(handle, "notify"))) {
- gf_msg_trace("xlator", 0,
- "dlsym(notify) on %s -- "
- "neglecting",
- dlerror());
- }
- }
-
- if (!(xl->dumpops = dlsym(handle, "dumpops"))) {
- gf_msg_trace("xlator", 0,
- "dlsym(dumpops) on %s -- "
- "neglecting",
- dlerror());
- }
-
- if (!(*VOID(&(xl->mem_acct_init)) = dlsym(handle, "mem_acct_init"))) {
- gf_msg_trace(xl->name, 0,
- "dlsym(mem_acct_init) on %s -- "
- "neglecting",
- dlerror());
- }
-
- vol_opt = GF_CALLOC(1, sizeof(volume_opt_list_t),
- gf_common_mt_volume_opt_list_t);
-
- if (!vol_opt) {
- goto out;
- }
-
- INIT_LIST_HEAD(&vol_opt->list);
- vol_opt->given_opt = dlsym(handle, "options");
- if (!vol_opt->given_opt) {
- vol_opt->given_opt = default_options;
- }
- list_add_tail(&vol_opt->list, &xl->volume_options);
-
- /* make sure 'min' is set to high value, so it would be
- properly set later */
- for (i = 0; i < GF_FOP_MAXVALUE; i++) {
- xl->stats.interval.latencies[i].min = 0xffffffff;
- }
-
- ret = 0;
-
-out:
- return ret;
-}
-
-int
-xlator_dynload_newway(xlator_t *xl)
+static int
+xlator_dynload_apis(xlator_t *xl)
{
int ret = -1;
void *handle = NULL;
@@ -363,13 +251,9 @@ xlator_dynload_newway(xlator_t *xl)
xlapi = dlsym(handle, "xlator_api");
if (!xlapi) {
- gf_msg("xlator", GF_LOG_INFO, 0, LG_MSG_DLSYM_ERROR,
- "dlsym(xlator_api) on %s. "
- "Fall back to old symbols",
- dlerror());
- /* This case is not an error for now, so allow it
- to fall back to old methods. */
- ret = 1;
+ gf_msg("xlator", GF_LOG_ERROR, 0, LG_MSG_DLSYM_ERROR,
+ "dlsym(xlator_api) missing: %s", dlerror());
+ ret = -1;
goto out;
}
@@ -492,15 +376,9 @@ xlator_dynload(xlator_t *xl)
}
xl->dlhandle = handle;
- ret = xlator_dynload_newway(xl);
+ ret = xlator_dynload_apis(xl);
if (-1 == ret)
goto out;
- if (1 == ret) {
- /* it means we don't find the new symbol in xlator code */
- ret = xlator_dynload_oldway(xl);
- if (-1 == ret)
- goto out;
- }
fill_defaults(xl);