diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-09-09 21:35:35 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-09-09 21:35:35 (GMT) |
commit | 7fed33ae490989642156aae633d2139058e55429 (patch) | |
tree | a2021c5e787b478c0d518cc50262ce095c2176f4 /src | |
parent | 3b9e143ea32517797f0c50c89cbeedeceb200757 (diff) | |
download | hdf5-7fed33ae490989642156aae633d2139058e55429.zip hdf5-7fed33ae490989642156aae633d2139058e55429.tar.gz hdf5-7fed33ae490989642156aae633d2139058e55429.tar.bz2 |
[svn-r25582] Dynamic VOL plugin loading:
- add support for searching for plugins by name in the H5PL interface
- add support for searching for VOL plugins and returning the plugin structure
- implement H5VLregister_by_name
- add tests similar to the filter plugin tests
- still needs some refactoring and better test framework and cmake support.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5PL.c | 218 | ||||
-rw-r--r-- | src/H5PLextern.h | 3 | ||||
-rw-r--r-- | src/H5PLprivate.h | 2 | ||||
-rw-r--r-- | src/H5Pocpl.c | 2 | ||||
-rw-r--r-- | src/H5VL.c | 129 | ||||
-rw-r--r-- | src/H5VLpublic.h | 2 | ||||
-rw-r--r-- | src/H5Z.c | 32 |
7 files changed, 275 insertions, 113 deletions
@@ -27,6 +27,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5MMprivate.h" /* Memory management */ #include "H5PLprivate.h" /* Plugin */ +#include "H5VLprivate.h" /* VOL */ #include "H5Zprivate.h" /* Filter pipeline */ @@ -96,9 +97,10 @@ typedef const void *(*H5PL_get_plugin_info_t)(void); /* Type for the list of info for opened plugin libraries */ typedef struct H5PL_table_t { - H5PL_type_t pl_type; /* plugin type */ - int pl_id; /* ID for the plugin */ - H5PL_HANDLE handle; /* plugin handle */ + H5PL_type_t pl_type; /* plugin type */ + int pl_id; /* ID for the plugin */ + const char *pl_name; /* name of the plugin */ + H5PL_HANDLE handle; /* plugin handle */ } H5PL_table_t; @@ -107,9 +109,9 @@ typedef struct H5PL_table_t { /********************/ static herr_t H5PL__init_path_table(void); -static htri_t H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info); -static htri_t H5PL__open(H5PL_type_t pl_type, char *libname, int plugin_id, const void **pl_info); -static htri_t H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info); +static htri_t H5PL__find(H5PL_type_t plugin_type, int type_id, const char *plugin_name, char *dir, const void **info); +static htri_t H5PL__open(H5PL_type_t pl_type, char *libname, int plugin_id, const char *plugin_name, const void **pl_info); +static htri_t H5PL__search_table(H5PL_type_t plugin_type, int type_id, const char *plugin_name, const void **info); static herr_t H5PL__close(H5PL_HANDLE handle); @@ -132,6 +134,11 @@ static size_t H5PL_table_alloc_g = 0; static size_t H5PL_table_used_g = 0; static H5PL_table_t *H5PL_table_g = NULL; +/* Table for opened vol plugin libraries */ +static size_t H5PL_vol_table_alloc_g = 0; +static size_t H5PL_vol_table_used_g = 0; +static H5PL_table_t *H5PL_vol_table_g = NULL; + /* Table of location paths for plugin libraries */ static char *H5PL_path_table_g[H5PL_MAX_PATH_NUM]; static size_t H5PL_num_paths_g = 0; @@ -231,10 +238,20 @@ H5PL_term_interface(void) for(u = 0; u < H5PL_table_used_g; u++) H5PL__close((H5PL_table_g[u]).handle); + /* Close opened dynamic vol libraries */ + for(u = 0; u < H5PL_vol_table_used_g; u++) { + H5PL__close((H5PL_vol_table_g[u]).handle); + HDfree(H5PL_vol_table_g[u].pl_name); + } + /* Free the table of dynamic libraries */ H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g); H5PL_table_used_g = H5PL_table_alloc_g = 0; + /* Free the table of dynamic vol libraries */ + H5PL_vol_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_vol_table_g); + H5PL_vol_table_used_g = H5PL_vol_table_alloc_g = 0; + /* Free the table of search paths */ for(u = 0; u < H5PL_num_paths_g; u++) if(H5PL_path_table_g[u]) @@ -253,9 +270,9 @@ H5PL_term_interface(void) /*------------------------------------------------------------------------- * Function: H5PL_load * - * Purpose: Given the plugin type and identifier, this function searches - * and/or loads a dynamic plugin library first among the already - * opened libraries then in the designated location paths. + * Purpose: Given the plugin type and identifier and/or name, this function + * searches and/or loads a dynamic plugin library first among the + * already opened libraries then in the designated location paths. * * Return: Non-NULL on success/NULL on failure * @@ -265,7 +282,7 @@ H5PL_term_interface(void) *------------------------------------------------------------------------- */ const void * -H5PL_load(H5PL_type_t type, int id) +H5PL_load(H5PL_type_t type, int id, const char *name) { htri_t found; /* Whether the plugin was found */ const void *plugin_info = NULL; @@ -285,7 +302,7 @@ H5PL_load(H5PL_type_t type, int id) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINIT, NULL, "can't initialize search path table") /* Search in the table of already loaded plugin libraries */ - if((found = H5PL__search_table(type, id, &plugin_info)) < 0) + if((found = H5PL__search_table(type, id, name, &plugin_info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in table failed") /* If not found, iterate through the path table to find the right dynamic library */ @@ -293,7 +310,7 @@ H5PL_load(H5PL_type_t type, int id) size_t i; /* Local index variable */ for(i = 0; i < H5PL_num_paths_g; i++) { - if((found = H5PL__find(type, id, H5PL_path_table_g[i], &plugin_info)) < 0) + if((found = H5PL__find(type, id, name, H5PL_path_table_g[i], &plugin_info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in paths failed") /* Break out if found */ @@ -387,7 +404,7 @@ done: */ #ifndef H5_HAVE_WIN32_API static htri_t -H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) +H5PL__find(H5PL_type_t plugin_type, int type_id, const char *plugin_name, char *dir, const void **info) { char *pathname = NULL; DIR *dirp = NULL; @@ -425,8 +442,8 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) if(S_ISDIR(my_stat.st_mode)) continue; - /* Attempt to open the dynamic library as a filter library */ - if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, info)) < 0) + /* Attempt to open the dynamic library */ + if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, plugin_name, info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") if(found_in_dir) { /* Indicate success */ @@ -449,7 +466,7 @@ done: } /* end H5PL__find() */ #else /* H5_HAVE_WIN32_API */ static htri_t -H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) +H5PL__find(H5PL_type_t plugin_type, int type_id, const char *plugin_name, char *dir, const void **info) { WIN32_FIND_DATA fdFile; HANDLE hFind; @@ -482,7 +499,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) if(fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; - if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, info)) < 0) + if((found_in_dir = H5PL__open(plugin_type, pathname, type_id, plugin_name, info)) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") if(found_in_dir) { /* Indicate success */ @@ -522,7 +539,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info) +H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const char *pl_name, const void **pl_info) { H5PL_HANDLE handle = NULL; htri_t ret_value = FALSE; @@ -546,45 +563,108 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, const void **pl_info) HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") } /* end if */ else { - const H5Z_class2_t *plugin_info; - - /* Invoke H5PLget_plugin_info to verify this is the right library we are looking for. - * Move on if it isn't. - */ - if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)())) { - if(H5PL__close(handle) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") - } /* end if */ - - /* Successfully found plugin library, check if it's the right one */ - if(plugin_info->id == pl_id) { - /* Expand the table if it is too small */ - if(H5PL_table_used_g >= H5PL_table_alloc_g) { - size_t n = MAX(H5Z_MAX_NFILTERS, 2 * H5PL_table_alloc_g); - H5PL_table_t *table = (H5PL_table_t *)H5MM_realloc(H5PL_table_g, n * sizeof(H5PL_table_t)); - - if(!table) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend dynamic library table") - - H5PL_table_g = table; - H5PL_table_alloc_g = n; - } /* end if */ - - (H5PL_table_g[H5PL_table_used_g]).handle = handle; - (H5PL_table_g[H5PL_table_used_g]).pl_type = pl_type; - (H5PL_table_g[H5PL_table_used_g]).pl_id = plugin_info->id; - H5PL_table_used_g++; - - /* Set the plugin info to return */ - *pl_info = (const void *)plugin_info; - - /* Indicate success */ - ret_value = TRUE; - } /* end if */ - else - if(H5PL__close(handle) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") + switch(pl_type) { + case H5PL_TYPE_FILTER: + { + const H5Z_class2_t *plugin_info; + + /* Invoke H5PLget_plugin_info to verify this is the right library we are looking for. + * Move on if it isn't. + */ + if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)())) { + if(H5PL__close(handle) < 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") + } /* end if */ + + /* Successfully found plugin library, check if it's the right one */ + if(plugin_info->id == pl_id) { + /* Expand the table if it is too small */ + if(H5PL_table_used_g >= H5PL_table_alloc_g) { + size_t n = MAX(H5Z_MAX_NFILTERS, 2 * H5PL_table_alloc_g); + H5PL_table_t *table = (H5PL_table_t *)H5MM_realloc(H5PL_table_g, n * sizeof(H5PL_table_t)); + + if(!table) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend dynamic library table") + + H5PL_table_g = table; + H5PL_table_alloc_g = n; + } /* end if */ + + (H5PL_table_g[H5PL_table_used_g]).handle = handle; + (H5PL_table_g[H5PL_table_used_g]).pl_type = pl_type; + (H5PL_table_g[H5PL_table_used_g]).pl_id = plugin_info->id; + H5PL_table_used_g++; + + /* Set the plugin info to return */ + *pl_info = (const void *)plugin_info; + + /* Indicate success */ + ret_value = TRUE; + } /* end if */ + else + if(H5PL__close(handle) < 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") + + break; + } + case H5PL_TYPE_VOL: + { + const H5VL_class_t *plugin_info; + + /* Invoke H5PLget_plugin_info to verify this is the right library we are looking for. + * Move on if it isn't. + */ + if(NULL == (plugin_info = (const H5VL_class_t *)(*get_plugin_info)())) { + if(H5PL__close(handle) < 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") + } /* end if */ + + /* Successfully found plugin library, check if it's the right one */ + if((pl_id > MAX_VOL_LIB_VALUE && plugin_info->value == pl_id) || + (pl_name && !strcmp(pl_name, plugin_info->name))) { + /* Expand the table if it is too small */ + if(H5PL_vol_table_used_g >= H5PL_vol_table_alloc_g) { + size_t n; + H5PL_table_t *table = NULL; + + if(0 == H5PL_vol_table_alloc_g) + n = 16; + else + n = 2 * H5PL_vol_table_alloc_g; + + table = (H5PL_table_t *)H5MM_realloc(H5PL_vol_table_g, n * sizeof(H5PL_table_t)); + if(!table) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend dynamic library table for vol plugins") + + H5PL_vol_table_g = table; + H5PL_vol_table_alloc_g = n; + } /* end if */ + + (H5PL_vol_table_g[H5PL_vol_table_used_g]).handle = handle; + (H5PL_vol_table_g[H5PL_vol_table_used_g]).pl_type = pl_type; + (H5PL_vol_table_g[H5PL_vol_table_used_g]).pl_id = plugin_info->value; + (H5PL_vol_table_g[H5PL_vol_table_used_g]).pl_name = HDstrdup(pl_name); + H5PL_vol_table_used_g++; + + /* Set the plugin info to return */ + *pl_info = (const void *)plugin_info; + + /* Indicate success */ + ret_value = TRUE; + } /* end if */ + else + if(H5PL__close(handle) < 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") + + break; + } + case H5PL_TYPE_ERROR: + case H5PL_TYPE_NONE: + default: + HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, FAIL, "invalid plugin type") + } /* end switch */ } /* end if */ } /* end else */ @@ -609,14 +689,14 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info) +H5PL__search_table(H5PL_type_t plugin_type, int type_id, const char *plugin_name, const void **info) { htri_t ret_value = FALSE; FUNC_ENTER_STATIC /* Search in the table of already opened dynamic libraries */ - if(H5PL_table_used_g > 0) { + if(H5PL_TYPE_FILTER == plugin_type && H5PL_table_used_g > 0) { size_t i; for(i = 0; i < H5PL_table_used_g; i++) { @@ -635,6 +715,26 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info) } /* end if */ } /* end for */ } /* end if */ + else if(H5PL_TYPE_VOL == plugin_type && H5PL_vol_table_used_g > 0) { + size_t i; + + for(i = 0; i < H5PL_vol_table_used_g; i++) { + if((plugin_type == (H5PL_vol_table_g[i]).pl_type) && + (type_id == (H5PL_vol_table_g[i]).pl_id || !strcmp(plugin_name, (H5PL_vol_table_g[i]).pl_name))) { + H5PL_get_plugin_info_t get_plugin_info; + const H5VL_class_t *plugin_info; + + if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_vol_table_g[i]).handle, "H5PLget_plugin_info"))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") + + if(NULL == (plugin_info = (const H5VL_class_t *)(*get_plugin_info)())) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info") + + *info = plugin_info; + HGOTO_DONE(TRUE) + } /* end if */ + } /* end for */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5PLextern.h b/src/H5PLextern.h index 943e3aa..b5563e4 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -30,7 +30,8 @@ typedef enum H5PL_type_t { H5PL_TYPE_ERROR = -1, /*error */ H5PL_TYPE_FILTER = 0, /*filter */ - H5PL_TYPE_NONE = 1 /*this must be last! */ + H5PL_TYPE_VOL = 1, /*vol plugin */ + H5PL_TYPE_NONE = 2 /*this must be last! */ } H5PL_type_t; diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index b117613..237408d 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -46,7 +46,7 @@ /***************************************/ /* Internal API routines */ -H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, int type_id); +H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, int type_id, const char *plugin_name); H5_DLL htri_t H5PL_no_plugin(void); #endif /* _H5PLprivate_H */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 37beb90..94fb5b2 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -834,7 +834,7 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, if(!filter_avail) { const H5Z_class2_t *filter_info; - if(NULL == (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)filter))) + if(NULL == (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)filter, NULL))) HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, FAIL, "failed to load dynamically loaded plugin") if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") @@ -40,6 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ +#include "H5PLprivate.h" /* Plugins */ #include "H5VLpkg.h" /* VOL package header */ #include "H5VLprivate.h" /* VOL */ @@ -205,6 +206,39 @@ H5VL_free_cls(H5VL_class_t *cls) /*------------------------------------------------------------------------- + * Function: H5VL__get_plugin_cb + * + * Purpose: Callback routine to search through registered VLs + * + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, March 30, 2012 + * + *------------------------------------------------------------------------- + */ +static int +H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) +{ + H5VL_get_plugin_ud_t *op_data = (H5VL_get_plugin_ud_t *)_op_data; /* User data for callback */ + H5VL_class_t *cls = (H5VL_class_t *)obj; + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + if(0 == strcmp(cls->name, op_data->name)) { + op_data->ret_id = id; + ret_value = H5_ITER_STOP; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__get_plugin_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5VLregister * * Purpose: Registers a new vol plugin as a member of the virtual object @@ -240,7 +274,7 @@ H5VLregister(const H5VL_class_t *cls) /* MSC - check if required callback are defined?? */ /* Create the new class ID */ - if((ret_value=H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) + if((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register vol plugin ID") done: @@ -249,6 +283,66 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLregister_by_name + * + * Purpose: Registers a new vol plugin as a member of the virtual object + * layer class. + * + * Return: Success: A vol plugin ID which is good until the + * library is closed or the plugin is + * unregistered. + * + * Failure: A negative value. + * + * Programmer: Mohamad Chaarawi + * September, 2014 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLregister_by_name(const char *name) +{ + H5VL_get_plugin_ud_t op_data; + hid_t ret_value; + + FUNC_ENTER_API(FAIL) + H5TRACE1("i", "*s", name); + + /* Check arguments */ + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null plugin name is disallowed") + + op_data.ret_id = FAIL; + op_data.name = name; + + /* check if plugin is already registered */ + if(H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER,FAIL, "can't iterate over VOL ids") + + if(op_data.ret_id != FAIL) { + /* If plugin alread registered, increment ref count on ID and return ID */ + if(H5I_inc_ref(op_data.ret_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + ret_value = op_data.ret_id; + } + else { + const H5VL_class_t *cls; + + /* Try loading the plugin */ + if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, -1, name))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to load VOL plugin") + + /* Register the plugin we loaded */ + if((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register vol plugin ID") + } + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLregister() */ + + +/*------------------------------------------------------------------------- * Function: H5VLunregister * * Purpose: Removes a vol plugin ID from the library. This in no way affects @@ -353,39 +447,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL__is_registered_cb - * - * Purpose: Callback routine to search through registered VLs - * - * Return: Success: The first object in the type for which FUNC - * returns non-zero. NULL if FUNC returned zero - * for every object in the type. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Friday, March 30, 2012 - * - *------------------------------------------------------------------------- - */ -static int -H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) -{ - H5VL_get_plugin_ud_t *op_data = (H5VL_get_plugin_ud_t *)_op_data; /* User data for callback */ - H5VL_class_t *cls = (H5VL_class_t *)obj; - int ret_value = H5_ITER_CONT; /* Callback return value */ - - FUNC_ENTER_STATIC_NOERR - - if(0 == strcmp(cls->name, op_data->name)) { - op_data->ret_id = id; - ret_value = H5_ITER_STOP; - } - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__get_plugin_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5VLis_registered * * Purpose: Tests whether a VOL class has been registered or not diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 35c4c46..bf3517c 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -420,13 +420,13 @@ H5_DLL herr_t H5VLterminate(hid_t plugin_id, hid_t vtpl_id); H5_DLL hid_t H5VLget_plugin_id(const char *name); H5_DLL herr_t H5VLclose(hid_t plugin_id); H5_DLL hid_t H5VLregister(const H5VL_class_t *cls); +H5_DLL hid_t H5VLregister_by_name(const char *plugin_name); H5_DLL herr_t H5VLunregister(hid_t plugin_id); H5_DLL htri_t H5VLis_registered(const char *name); H5_DLL ssize_t H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size); H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id); H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj); #if 0 -H5_DLL hid_t H5VLregister_by_name(const char *plugin_name); H5_DLL herr_t H5VLioctl(hid_t loc_id or vol_id, <class enum>, ...); #endif @@ -668,8 +668,8 @@ H5Zfilter_avail(H5Z_filter_t id) else if(ret_value == FALSE) { const H5Z_class2_t *filter_info; - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) - ret_value = TRUE; + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id, NULL))) + ret_value = TRUE; } /* end if */ done: @@ -1330,20 +1330,20 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, */ if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { hbool_t issue_error = FALSE; - const H5Z_class2_t *filter_info; - - /* Try loading the filter */ - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { - /* Register the filter we loaded */ - if(H5Z_register(filter_info) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") - - /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ - if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) - issue_error = TRUE; - } /* end if */ - else - issue_error = TRUE; + const H5Z_class2_t *filter_info; + + /* Try loading the filter */ + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id), NULL))) { + /* Register the filter we loaded */ + if(H5Z_register(filter_info) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + + /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ + if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) + issue_error = TRUE; + } /* end if */ + else + issue_error = TRUE; /* Check for error */ if(issue_error) { |