summaryrefslogtreecommitdiffstats
path: root/src/H5VLpassthru.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2019-03-10 03:41:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2019-03-10 03:41:38 (GMT)
commitdeeb302747fe186d18bbf3e47d750ce6e47aef62 (patch)
treeeb74d361608c829e7a531165378a5af873ff7ad2 /src/H5VLpassthru.c
parent679b49d43d744f0cc34054944e827326f17a6f3d (diff)
downloadhdf5-deeb302747fe186d18bbf3e47d750ce6e47aef62.zip
hdf5-deeb302747fe186d18bbf3e47d750ce6e47aef62.tar.gz
hdf5-deeb302747fe186d18bbf3e47d750ce6e47aef62.tar.bz2
Specify the default VOL connector to use with an environment variable.
This implicitly adds support for changing the VOL connector for command-line tools or any application linked with the library. Also, add 'make check-vol' support for all directories, clearing up necessary issues in testing scripts, etc.
Diffstat (limited to 'src/H5VLpassthru.c')
-rw-r--r--src/H5VLpassthru.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index fe72000..a4c85cc 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -20,6 +20,11 @@
* include _any_ private HDF5 header files. This connector should
* therefore only make public HDF5 API calls and use standard C /
* POSIX calls.
+ *
+ * Note that the HDF5 error stack must be preserved on code paths
+ * that could be invoked when the underlying VOL connector's
+ * callback can fail.
+ *
*/
@@ -297,6 +302,9 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
*
* Purpose: Release a pass through object
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -308,7 +316,14 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
static herr_t
H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
{
+ hid_t err_id;
+
+ err_id = H5Eget_current_stack();
+
H5Idec_ref(obj->under_vol_id);
+
+ H5Eset_current_stack(err_id);
+
free(obj);
return 0;
@@ -332,11 +347,8 @@ H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
hid_t
H5VL_pass_through_register(void)
{
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
/* Singleton register the pass-through VOL connector ID */
- if(H5I_VOL != H5Iget_type(H5VL_PASSTHRU_g))
+ if(H5VL_PASSTHRU_g < 0)
H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT);
return H5VL_PASSTHRU_g;
@@ -476,6 +488,9 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info
*
* Purpose: Release an info object for the connector.
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -485,16 +500,21 @@ static herr_t
H5VL_pass_through_info_free(void *_info)
{
H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info;
+ hid_t err_id;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL INFO Free\n");
#endif
+ err_id = H5Eget_current_stack();
+
/* Release underlying VOL ID and info */
if(info->under_vol_info)
H5VLfree_connector_info(info->under_vol_id, info->under_vol_info);
H5Idec_ref(info->under_vol_id);
+ H5Eset_current_stack(err_id);
+
/* Free pass through info object itself */
free(info);
@@ -695,6 +715,9 @@ H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
*
* Purpose: Release a "wrapper context" for an object
*
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
* Return: Success: 0
* Failure: -1
*
@@ -704,16 +727,21 @@ static herr_t
H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
{
H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
+ hid_t err_id;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL WRAP CTX Free\n");
#endif
+ err_id = H5Eget_current_stack();
+
/* Release underlying VOL ID and wrap context */
if(wrap_ctx->under_wrap_ctx)
H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id);
H5Idec_ref(wrap_ctx->under_vol_id);
+ H5Eset_current_stack(err_id);
+
/* Free pass through wrap context object itself */
free(wrap_ctx);