summaryrefslogtreecommitdiffstats
path: root/src/H5PLint.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-11-17 23:21:49 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-11-17 23:21:49 (GMT)
commit3b1728736840e25d5cd1b048f09025e7c0f22123 (patch)
tree3c1a2423acbe136af0caa9631fd6316944a3bbe2 /src/H5PLint.c
parentf3fd3f293f2734fea98f508f190bf531edc72f7a (diff)
downloadhdf5-3b1728736840e25d5cd1b048f09025e7c0f22123.zip
hdf5-3b1728736840e25d5cd1b048f09025e7c0f22123.tar.gz
hdf5-3b1728736840e25d5cd1b048f09025e7c0f22123.tar.bz2
Brings H5Z and H5PL packages in sync with VOL integration branch.
Diffstat (limited to 'src/H5PLint.c')
-rw-r--r--src/H5PLint.c62
1 files changed, 36 insertions, 26 deletions
diff --git a/src/H5PLint.c b/src/H5PLint.c
index c887f86..b190746 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -235,11 +235,11 @@ done:
*-------------------------------------------------------------------------
*/
const void *
-H5PL_load(H5PL_type_t type, int id)
+H5PL_load(H5PL_type_t type, H5PL_key_t key)
{
- H5PL_search_params_t search_params;
+ H5PL_search_params_t search_params; /* Plugin search parameters */
hbool_t found = FALSE; /* Whether the plugin was found */
- const void *plugin_info = NULL;
+ const void *plugin_info = NULL; /* Information from the plugin */
const void *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
@@ -248,18 +248,17 @@ H5PL_load(H5PL_type_t type, int id)
switch (type) {
case H5PL_TYPE_FILTER:
if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled")
break;
-
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Invalid plugin type specified")
}
/* Set up the search parameters */
search_params.type = type;
- search_params.id = id;
+ search_params.key.id = key.id;
/* Search in the table of already loaded plugin libraries */
if(H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0)
@@ -304,11 +303,11 @@ done:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
herr_t
-H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const void **plugin_info)
+H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info)
{
H5PL_HANDLE handle = NULL;
H5PL_get_plugin_info_t get_plugin_info = NULL;
- htri_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -326,35 +325,46 @@ H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const v
*/
if (NULL == (handle = H5PL_OPEN_DLIB(path))) {
H5PL_CLR_ERROR; /* clear error */
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
}
/* Return a handle for the function H5PLget_plugin_info in the dynamic library.
* The plugin library is suppose to define this function.
*/
- if (NULL != (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info"))) {
-
- const H5Z_class2_t *info;
+ if (NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info")))
+ HGOTO_DONE(SUCCEED)
- /* Get the plugin info */
- if (NULL == (info = (const H5Z_class2_t *)(*get_plugin_info)()))
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info")
+ /* Get the plugin information */
+ switch (type) {
+ case H5PL_TYPE_FILTER:
+ {
+ const H5Z_class2_t *filter_info;
- /* Check if the filter IDs match */
- if (info->id == id) {
+ /* Get the plugin info */
+ if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info)()))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin")
- /* Store the plugin in the cache */
- if (H5PL__add_plugin(type, id, handle))
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache")
+ /* If the filter IDs match, we're done. Set the output parameters. */
+ if (filter_info->id == key.id) {
+ *plugin_info = (const void *)filter_info;
+ *success = TRUE;
+ }
- /* Set output parameters */
- *success = TRUE;
- *plugin_info = (const void *)info;
+ break;
}
- }
+ case H5PL_TYPE_ERROR:
+ case H5PL_TYPE_NONE:
+ default:
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified")
+ } /* end switch */
+
+ /* If we found the correct plugin, store it in the cache */
+ if (*success)
+ if (H5PL__add_plugin(type, key, handle))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache")
done:
- if (!success && handle)
+ if (!(*success) && handle)
if (H5PL__close(handle) < 0)
HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library")