diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5CX.c | 13 | ||||
-rw-r--r-- | src/H5VLconnector_passthru.h | 24 |
2 files changed, 35 insertions, 2 deletions
@@ -1621,12 +1621,20 @@ H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) H5CX_node_t **head = NULL; /* Pointer to head of API context list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(vol_wrap_ctx); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + + /* No error is expected at this point. But in case an application calls H5VLwrap_register + * which doesn't reset the API context and there is no context, returns a relevant error here + */ + if (!head) + HGOTO_ERROR(H5E_CONTEXT, H5E_UNINITIALIZED, FAIL, "the API context isn't available") + + if (!(*head)) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "unable to get the current API context") /* Check for value that was set */ if ((*head)->ctx.vol_wrap_ctx_valid) @@ -1635,6 +1643,7 @@ H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) else *vol_wrap_ctx = NULL; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_get_vol_wrap_ctx() */ diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h index 079a869..68dd33a 100644 --- a/src/H5VLconnector_passthru.h +++ b/src/H5VLconnector_passthru.h @@ -56,6 +56,30 @@ extern "C" { /* Helper routines for VOL connector authors */ H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2); +/** + * \ingroup H5VL + * + * \brief Wrap an internal object with a "wrap context" and register an + * hid_t for the resulting object. + * + * \param[in] obj VOL object. + * \param[in] type VOL-managed object class. Allowable values are: + * - #H5I_FILE + * - #H5I_GROUP + * - #H5I_DATATYPE + * - #H5I_DATASET + * - #H5I_MAP + * - #H5I_ATTR + * + * \return \hid_t + * + * \note This routine is mainly targeted toward wrapping objects for + * iteration routine callbacks (i.e. the callbacks from H5Aiterate*, + * H5Literate* / H5Lvisit*, and H5Ovisit* ). Using it in an application + * will return an error indicating the API context isn't available or + * can't be retrieved. + * + */ H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type); H5_DLL herr_t H5VLretrieve_lib_state(void **state); H5_DLL herr_t H5VLstart_lib_state(void); |