summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-11-21 06:56:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-11-21 06:56:13 (GMT)
commit8939a2190f50ab42c6b59c0d2df33ac66bb625e7 (patch)
treeadd67102c16433e043e348b6ffd34544101b2b42
parent23ff0240ae18d52ac8164c7a55d698e7b2cd5dcc (diff)
downloadhdf5-8939a2190f50ab42c6b59c0d2df33ac66bb625e7.zip
hdf5-8939a2190f50ab42c6b59c0d2df33ac66bb625e7.tar.gz
hdf5-8939a2190f50ab42c6b59c0d2df33ac66bb625e7.tar.bz2
Add info_to_str and str_to_info "management" callbacks for serializing and
deserializing a connector's info object.
-rw-r--r--examples/h5_vol_external_log_native.c2
-rw-r--r--src/H5PLint.c39
-rw-r--r--src/H5PLpath.c2
-rw-r--r--src/H5PLpkg.h6
-rw-r--r--src/H5PLplugin_cache.c4
-rw-r--r--src/H5PLprivate.h15
-rw-r--r--src/H5VL.c127
-rw-r--r--src/H5VLcallback.c115
-rw-r--r--src/H5VLnative.c2
-rw-r--r--src/H5VLprivate.h8
-rw-r--r--src/H5VLpublic.h20
-rw-r--r--src/H5Z.c8
12 files changed, 295 insertions, 53 deletions
diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c
index 0d48b73..19eaa5e 100644
--- a/examples/h5_vol_external_log_native.c
+++ b/examples/h5_vol_external_log_native.c
@@ -53,6 +53,8 @@ static const H5VL_class_t H5VL_log_g = {
NULL, /* info copy */
NULL, /* info compare */
NULL, /* info free */
+ NULL, /* info to str */
+ NULL, /* str to info */
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* free_wrap_ctx */
diff --git a/src/H5PLint.c b/src/H5PLint.c
index 166b300..bbe71fe 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -30,7 +30,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
#include "H5PLpkg.h" /* Plugin */
-#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5Zprivate.h" /* Filter pipeline */
@@ -236,7 +235,7 @@ done:
*-------------------------------------------------------------------------
*/
const void *
-H5PL_load(H5PL_type_t type, H5PL_key_t key)
+H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
{
H5PL_search_params_t search_params; /* Plugin search parameters */
hbool_t found = FALSE; /* Whether the plugin was found */
@@ -263,7 +262,7 @@ H5PL_load(H5PL_type_t type, H5PL_key_t key)
/* Set up the search parameters */
search_params.type = type;
- search_params.key.id = key.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)
@@ -308,7 +307,8 @@ done:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
herr_t
-H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info)
+H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key,
+ hbool_t *success, const void **plugin_info)
{
H5PL_HANDLE handle = NULL;
H5PL_get_plugin_info_t get_plugin_info = NULL;
@@ -350,29 +350,44 @@ H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success,
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin")
/* If the filter IDs match, we're done. Set the output parameters. */
- if (filter_info->id == key.id) {
+ if (filter_info->id == key->id) {
*plugin_info = (const void *)filter_info;
*success = TRUE;
}
break;
}
+
case H5PL_TYPE_VOL:
{
- const H5VL_class_t *cls = NULL;
+ const H5VL_class_t *cls;
/* Get the plugin info */
- if (NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)()))
+ if(NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)()))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL driver info from plugin")
- /* If the plugin names match, we're done. Set the output parameters. */
- if (cls->name && !HDstrcmp(cls->name, key.name)) {
- *plugin_info = (const void *)cls;
- *success = TRUE;
- }
+ /* Which kind of key are we looking for? */
+ if(key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
+ /* If the plugin names match, we're done. Set the output parameters. */
+ if(cls->name && !HDstrcmp(cls->name, key->vol.u.name)) {
+ *plugin_info = (const void *)cls;
+ *success = TRUE;
+ } /* end if */
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE);
+
+ /* If the plugin values match, we're done. Set the output parameters. */
+ if(cls->value == key->vol.u.value) {
+ *plugin_info = (const void *)cls;
+ *success = TRUE;
+ } /* end if */
+ } /* end else */
break;
}
+
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index 972f1d0..460f19d 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -689,7 +689,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h
index dfaa4af..d60da82 100644
--- a/src/H5PLpkg.h
+++ b/src/H5PLpkg.h
@@ -134,13 +134,15 @@ H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask /*out*/);
H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask);
/* Plugin search and manipulation */
-H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, H5PL_key_t key, hbool_t *success /*out*/, const void **plugin_info /*out*/);
+H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key,
+ hbool_t *success /*out*/, const void **plugin_info /*out*/);
H5_DLL herr_t H5PL__close(H5PL_HANDLE handle);
/* Plugin cache calls */
H5_DLL herr_t H5PL__create_plugin_cache(void);
H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed /*out*/);
-H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle);
+H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key,
+ H5PL_HANDLE handle);
H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/);
/* Plugin search path calls */
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index e905ac2..7fe676d 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -216,7 +216,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle)
+H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, H5PL_HANDLE handle)
{
herr_t ret_value = SUCCEED;
@@ -229,7 +229,7 @@ H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle)
/* Store the plugin info and bump the # of plugins */
H5PL_cache_g[H5PL_num_plugins_g].type = type;
- H5PL_cache_g[H5PL_num_plugins_g].key = key;
+ H5PL_cache_g[H5PL_num_plugins_g].key = *key;
H5PL_cache_g[H5PL_num_plugins_g].handle = handle;
H5PL_num_plugins_g++;
diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h
index 2af1b70..5ce9b87 100644
--- a/src/H5PLprivate.h
+++ b/src/H5PLprivate.h
@@ -21,7 +21,8 @@
#include "H5PLpublic.h"
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/**************************/
@@ -35,8 +36,14 @@
/* The key that will be used to find the plugin */
typedef union H5PL_key_t {
- int id; /* filters */
- const char *name; /* VOL drivers */
+ int id; /* I/O filters */
+ struct {
+ H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */
+ union {
+ H5VL_class_value_t value; /* VOL connector value */
+ const char *name; /* VOL connector name */
+ } u;
+ } vol;
} H5PL_key_t;
@@ -50,7 +57,7 @@ typedef union H5PL_key_t {
/***************************************/
/* Internal API routines */
-H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, H5PL_key_t key);
+H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, const H5PL_key_t *key);
#endif /* _H5PLprivate_H */
diff --git a/src/H5VL.c b/src/H5VL.c
index 0a835a2..5eeb201 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -41,38 +41,51 @@
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
/* Information needed for iterating over the registered VOL connector hid_t IDs.
- * The name of the new VOL connector that is being registered is stored in the
- * name field and the found_id field is initialized to H5I_INVALID_HID (-1).
- * If we find a VOL connector with the same name, we set the found_id field to
- * the existing ID for return to the function.
+ * The name or value of the new VOL connector that is being registered is
+ * stored in the name (or value) field and the found_id field is initialized to
+ * H5I_INVALID_HID (-1). If we find a VOL connector with the same name / value,
+ * we set the found_id field to the existing ID for return to the function.
*/
typedef struct {
- const char *name; /* The name of the VOL connector to check */
- hid_t found_id; /* The library ID if we found a match */
+ /* IN */
+ H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */
+ union {
+ const char *name; /* The name of the VOL connector to check */
+ H5VL_class_value_t value; /* The value of the VOL connector to check */
+ } u;
+
+ /* OUT */
+ hid_t found_id; /* The connector ID, if we found a match */
} H5VL_get_connector_ud_t;
+
/********************/
/* Local Prototypes */
/********************/
static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
+
/*********************/
/* Package Variables */
/*********************/
+
/*****************************/
/* Library Private Variables */
/*****************************/
+
/*******************/
/* Local Variables */
/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__get_connector_cb
@@ -95,10 +108,19 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
FUNC_ENTER_STATIC_NOERR
- if (0 == HDstrcmp(cls->name, op_data->name)) {
- op_data->found_id = id;
- ret_value = H5_ITER_STOP;
+ if(H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) {
+ if(0 == HDstrcmp(cls->name, op_data->u.name)) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
} /* end if */
+ else {
+ HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind);
+ if(cls->value == op_data->u.value) {
+ op_data->found_id = id;
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ } /* end else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__get_connector_cb() */
@@ -139,8 +161,9 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id)
if (cls->get_wrap_ctx && !cls->free_wrap_ctx)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided")
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = cls->name;
op_data.found_id = H5I_INVALID_HID;
- op_data.name = cls->name;
/* check if connector is already registered */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
@@ -192,16 +215,17 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
if (0 == HDstrlen(name))
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed")
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
op_data.found_id = H5I_INVALID_HID;
- op_data.name = name;
/* Check if connector is already registered */
- if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
/* If connector alread registered, increment ref count on ID and return ID */
- if (op_data.found_id != H5I_INVALID_HID) {
- if (H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
ret_value = op_data.found_id;
} /* end if */
@@ -210,12 +234,13 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id)
const H5VL_class_t *cls;
/* Try loading the connector */
- key.name = name;
- if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, key)))
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ key.vol.u.name = name;
+ if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
/* Register the connector we loaded */
- if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
} /* end else */
@@ -225,6 +250,66 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VLregister_connector_by_value
+ *
+ * Purpose: Registers a new VOL connector as a member of the virtual object
+ * layer class.
+ *
+ * Return: Success: A VOL connector ID which is good until the
+ * library is closed or the connector is
+ * unregistered.
+ *
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id)
+{
+ H5VL_get_connector_ud_t op_data; /* Callback info for connector search */
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_API(H5I_INVALID_HID)
+
+ /* Check arguments */
+ if(value < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed")
+
+ op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE;
+ op_data.u.value = value;
+ op_data.found_id = H5I_INVALID_HID;
+
+ /* Check if connector is already registered */
+ if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids")
+
+ /* If connector alread registered, increment ref count on ID and return ID */
+ if(op_data.found_id != H5I_INVALID_HID) {
+ if(H5I_inc_ref(op_data.found_id, TRUE) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ ret_value = op_data.found_id;
+ } /* end if */
+ else {
+ H5PL_key_t key;
+ const H5VL_class_t *cls;
+
+ /* Try loading the connector */
+ key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ key.vol.u.value = value;
+ if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector")
+
+ /* Register the connector we loaded */
+ if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLregister_connector_by_value() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VLis_connector_registered
*
* Purpose: Tests whether a VOL class has been registered or not
@@ -246,8 +331,9 @@ H5VLis_connector_registered(const char *name)
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "*s", name);
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
op_data.found_id = H5I_INVALID_HID;
- op_data.name = name;
/* Check arguments */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
@@ -280,8 +366,9 @@ H5VLget_connector_id(const char *name)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*s", name);
- op_data.found_id = H5I_INVALID_HID;
- op_data.name = name;
+ op_data.kind = H5VL_GET_CONNECTOR_BY_NAME;
+ op_data.u.name = name;
+ op_data.found_id = H5I_INVALID_HID;
/* Check arguments */
if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0)
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index e921dea..7b67964 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -291,6 +291,37 @@ done:
} /* H5VLget_cap_flags */
+/*---------------------------------------------------------------------------
+ * Function: H5VLget_value
+ *
+ * Purpose: Retrieves the 'value' for a connector
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLget_value(hid_t connector_id, H5VL_class_value_t *value)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+
+ /* Check args */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Retrieve connector value */
+ if(value)
+ *value = cls->value;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLget_value */
+
+
/*-------------------------------------------------------------------------
* Function: H5VL_copy_connector_info
*
@@ -523,6 +554,88 @@ done:
/*---------------------------------------------------------------------------
+ * Function: H5VLconnector_info_to_str
+ *
+ * Purpose: Serialize a connector's info into a string
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+
+ /* Only serialize info object, if it's non-NULL */
+ if(info) {
+ H5VL_class_t *cls; /* VOL connector's class struct */
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allow the connector to serialize info */
+ if(cls->info_to_str) {
+ if((cls->info_to_str)(info, str) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info")
+ } /* end if */
+ else
+ *str = NULL;
+ } /* end if */
+ else
+ *str = NULL;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLconnector_info_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLconnector_str_to_info
+ *
+ * Purpose: Deserialize a string into a connector's info
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+
+ /* Only deserialize string, if it's non-NULL */
+ if(str) {
+ H5VL_class_t *cls; /* VOL connector's class struct */
+
+ /* Check args and get class pointer */
+ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Allow the connector to deserialize info */
+ if(cls->str_to_info) {
+ if((cls->str_to_info)(str, info) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info")
+ } /* end if */
+ else
+ *info = NULL;
+ } /* end if */
+ else
+ *info = NULL;
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLconnector_str_to_info() */
+
+
+/*---------------------------------------------------------------------------
* Function: H5VLget_object
*
* Purpose: Retrieves an underlying object.
@@ -658,7 +771,7 @@ H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_free_connector_info() */
+} /* end H5VL_free_wrap_ctx() */
/*---------------------------------------------------------------------------
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index e506af4..71f4276 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -130,6 +130,8 @@ static H5VL_class_t H5VL_native_cls_g = {
NULL, /* info copy */
NULL, /* info compare */
NULL, /* info free */
+ NULL, /* info to str */
+ NULL, /* str to info */
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* free_wrap_ctx */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 6b69d93..97e9119 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -45,10 +45,18 @@ typedef struct H5VL_connector_prop_t {
const void *connector_info; /* VOL connector info, for open callbacks */
} H5VL_connector_prop_t;
+/* Which kind of VOL connector field to use for searching */
+typedef enum H5VL_get_connector_kind_t {
+ H5VL_GET_CONNECTOR_BY_NAME, /* Name field is set */
+ H5VL_GET_CONNECTOR_BY_VALUE /* Value field is set */
+} H5VL_get_connector_kind_t;
+
+
/*****************************/
/* Library Private Variables */
/*****************************/
+
/******************************/
/* Library Private Prototypes */
/******************************/
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 26e841d..9fe5bcd 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -382,13 +382,15 @@ typedef struct H5VL_class_t {
herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */
herr_t (*terminate)(void); /* Connector termination callback */
size_t info_size; /* size of the vol info */
- void * (*info_copy)(const void *info); /* callback to create a copy of the vol info */
- int (*info_cmp)(const void *info1, const void *info2); /* callback to compare vol info */
- herr_t (*info_free)(void *info); /* callback to release the vol info copy */
- void * (*get_object)(const void *obj); /* callback to retrieve underlying object */
- herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* callback to retrieve the object wrapping context for the connector */
- herr_t (*free_wrap_ctx)(void *wrap_ctx); /* callback to release the object wrapping context for the connector */
- void* (*wrap_object)(void *obj, void *wrap_ctx); /* callback to wrap an object */
+ void * (*info_copy)(const void *info); /* Callback to create a copy of the vol info */
+ int (*info_cmp)(const void *info1, const void *info2); /* Callback to compare vol info */
+ herr_t (*info_free)(void *info); /* Callback to release the vol info copy */
+ herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */
+ herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */
+ void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */
+ herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
+ herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
+ void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap an object */
/* Data Model */
H5VL_attr_class_t attr_cls; /* attribute class callbacks */
@@ -422,6 +424,7 @@ extern "C" {
/* VOL Connector Functionality */
H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
+H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id);
H5_DLL htri_t H5VLis_connector_registered(const char *name);
H5_DLL hid_t H5VLget_connector_id(const char *name);
H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size);
@@ -442,10 +445,13 @@ H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connect
H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id);
H5_DLL herr_t H5VLterminate(hid_t connector_id);
H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags);
+H5_DLL herr_t H5VLget_value(hid_t connector_id, H5VL_class_value_t *conn_value);
H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info);
H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1,
const void *info2);
H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info);
+H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str);
+H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info);
H5_DLL void *H5VLget_object(void *obj, hid_t connector_id);
H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx);
H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id);
diff --git a/src/H5Z.c b/src/H5Z.c
index aeb7602..f41588f 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -697,11 +697,11 @@ H5Z_filter_avail(H5Z_filter_t id)
HGOTO_DONE(TRUE)
key.id = (int)id;
- if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
- if (H5Z_register(filter_info) < 0)
+ if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
+ if(H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter")
HGOTO_DONE(TRUE)
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1289,7 +1289,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
/* Try loading the filter */
key.id = (int)(pline->filter[idx].id);
- if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
+ if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) {
/* Register the filter we loaded */
if(H5Z_register(filter_info) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")