diff options
author | Quincey Koziol <koziol@koziol.gov> | 2019-03-12 16:49:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@koziol.gov> | 2019-03-12 16:49:03 (GMT) |
commit | e6b8ebe95472fff931878beffe936edcacf5f122 (patch) | |
tree | 8fd20b12141b5bf52c6729206fe1eedd01db2aa5 /src/H5VL.c | |
parent | deeb302747fe186d18bbf3e47d750ce6e47aef62 (diff) | |
parent | 07baf44a86de400c170006557e7595ea6ba9c20a (diff) | |
download | hdf5-e6b8ebe95472fff931878beffe936edcacf5f122.zip hdf5-e6b8ebe95472fff931878beffe936edcacf5f122.tar.gz hdf5-e6b8ebe95472fff931878beffe936edcacf5f122.tar.bz2 |
Merge remote-tracking branch 'origin/develop' into env_vol_load
Diffstat (limited to 'src/H5VL.c')
-rw-r--r-- | src/H5VL.c | 159 |
1 files changed, 159 insertions, 0 deletions
@@ -344,6 +344,9 @@ done: * * Purpose: Compares two connector classes (based on their value field) * + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. + * * Return: Success: Non-negative, *cmp set to a value like strcmp * * Failure: Negative, *cmp unset @@ -443,3 +446,159 @@ done: FUNC_LEAVE_API(ret_value) } /* H5VLobject() */ + +/*--------------------------------------------------------------------------- + * Function: H5VLretrieve_lib_state + * + * Purpose: Retrieves a copy of the internal state of the HDF5 library, + * so that it can be restored later. + * + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. + * + * Return: Success: Non-negative, *state set + * Failure: Negative, *state unset + * + * Programmer: Quincey Koziol + * Thursday, January 10, 2019 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLretrieve_lib_state(void **state) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */ + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "**x", state); + + /* Check args */ + if(NULL == state) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer") + + /* Retrieve the library state */ + if(H5VL_retrieve_lib_state(state) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve library state") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLretrieve_lib_state() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLrestore_lib_state + * + * Purpose: Restores the internal state of the HDF5 library. + * + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, January 10, 2019 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLrestore_lib_state(const void *state) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */ + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "*x", state); + + /* Check args */ + if(NULL == state) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer") + + /* Restore the library state */ + if(H5VL_restore_lib_state(state) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't restore library state") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLrestore_lib_state() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLreset_lib_state + * + * Purpose: Resets the internal state of the HDF5 library, undoing the + * affects of H5VLrestore_lib_state. + * + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. + * + * Note: This routine must be called as a "pair" with + * H5VLrestore_lib_state. It can be called before / after / + * independently of H5VLfree_lib_state. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Saturday, February 23, 2019 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLreset_lib_state(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */ + FUNC_ENTER_API_NOINIT + H5TRACE0("e",""); + + /* Reset the library state */ + if(H5VL_reset_lib_state() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLreset_lib_state() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_lib_state + * + * Purpose: Free a retrieved library state. + * + * Note: This routine is _only_ for HDF5 VOL connector authors! It is + * _not_ part of the public API for HDF5 application developers. + * + * Note: This routine must be called as a "pair" with + * H5VLretrieve_lib_state. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, January 10, 2019 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_lib_state(void *state) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "*x", state); + + /* Check args */ + if(NULL == state) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer") + + /* Free the library state */ + if(H5VL_free_lib_state(state) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free library state") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLfree_lib_state() */ + |