summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSongyu Lu <songyulu@hdfgroup.org>2019-04-04 16:03:05 (GMT)
committerSongyu Lu <songyulu@hdfgroup.org>2019-04-04 16:03:05 (GMT)
commit50d9a397ab4bcbeaa6466eabe1c2ec6e2cf61f89 (patch)
treee20fb6dd1745060836a29b020dd5d9bfcab84dd7 /src
parente09e2fc4ad7aadef1a99573ee6d3cec9bea3becb (diff)
downloadhdf5-50d9a397ab4bcbeaa6466eabe1c2ec6e2cf61f89.zip
hdf5-50d9a397ab4bcbeaa6466eabe1c2ec6e2cf61f89.tar.gz
hdf5-50d9a397ab4bcbeaa6466eabe1c2ec6e2cf61f89.tar.bz2
This commit basically has the following changes:
1. restored the datatype, dataspace, and LCPL of the dataset for VOL connector back to the properties. 2. splitted external.c and vds.c because they called HDsetenv in the program, instead using shell scripts to set the environment variables. 3. changed H5CX_get_vds_prefix and H5CX_get_ext_file_prefix to use H5P_peek instead of H5P_get.
Diffstat (limited to 'src')
-rw-r--r--src/H5CX.c54
-rw-r--r--src/H5Dint.c8
2 files changed, 54 insertions, 8 deletions
diff --git a/src/H5CX.c b/src/H5CX.c
index 08e8c3f..94d1f32 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -2390,18 +2390,41 @@ H5CX_get_ext_file_prefix(char **extfile_prefix)
FUNC_ENTER_NOAPI(FAIL)
+ /* Sanity check */
HDassert(extfile_prefix);
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
- H5CX_RETRIEVE_PROP_VALID(dapl, H5P_DATASET_ACCESS_DEFAULT, H5D_ACS_EFILE_PREFIX_NAME, extfile_prefix);
+ /* Check if the value has been retrieved already */
+ if(!(*head)->ctx.extfile_prefix_valid) {
+ /* Check for default DAPL */
+ if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ (*head)->ctx.extfile_prefix = H5CX_def_dapl_cache.extfile_prefix;
+ else {
+ /* Check if the property list is already available */
+ if(NULL == (*head)->ctx.dapl)
+ /* Get the dataset access property list pointer */
+ if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+
+ /* Get the prefix for the external file */
+ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
+ * to copy it and free this in the H5CX pop routine. -QAK)
+ */
+ if(H5P_peek((*head)->ctx.dapl, H5D_ACS_EFILE_PREFIX_NAME, &(*head)->ctx.extfile_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve external file prefix")
+ } /* end else */
+
+ /* Mark the value as valid */
+ (*head)->ctx.extfile_prefix_valid = TRUE;
+ } /* end if */
/* Get the value */
*extfile_prefix = (*head)->ctx.extfile_prefix;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_ext_file_prefix */
+} /* end H5CX_get_ext_file_prefix() */
/*-------------------------------------------------------------------------
@@ -2424,18 +2447,41 @@ H5CX_get_vds_prefix(char **vds_prefix)
FUNC_ENTER_NOAPI(FAIL)
+ /* Sanity check */
HDassert(vds_prefix);
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
- H5CX_RETRIEVE_PROP_VALID(dapl, H5P_DATASET_ACCESS_DEFAULT, H5D_ACS_VDS_PREFIX_NAME, vds_prefix);
+ /* Check if the value has been retrieved already */
+ if(!(*head)->ctx.vds_prefix_valid) {
+ /* Check for default DAPL */
+ if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ (*head)->ctx.vds_prefix = H5CX_def_dapl_cache.vds_prefix;
+ else {
+ /* Check if the property list is already available */
+ if(NULL == (*head)->ctx.dapl)
+ /* Get the dataset access property list pointer */
+ if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+
+ /* Get the prefix for the VDS */
+ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
+ * to copy it and free this in the H5CX pop routine. -QAK)
+ */
+ if(H5P_peek((*head)->ctx.dapl, H5D_ACS_VDS_PREFIX_NAME, &(*head)->ctx.vds_prefix) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VDS prefix")
+ } /* end else */
+
+ /* Mark the value as valid */
+ (*head)->ctx.vds_prefix_valid = TRUE;
+ } /* end if */
/* Get the value */
*vds_prefix = (*head)->ctx.vds_prefix;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5CX_get_vds_prefix */
+} /* end H5CX_get_vds_prefix() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 7367613..bdd43cf 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -120,8 +120,8 @@ static hbool_t H5D_top_package_initialize_s = FALSE;
/* Prefixes of VDS and external file from the environment variables
* HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */
-static char *H5D_prefix_ext_env = NULL;
-static char *H5D_prefix_vds_env = NULL;
+const static char *H5D_prefix_ext_env = NULL;
+const static char *H5D_prefix_vds_env = NULL;
/*-------------------------------------------------------------------------
@@ -1116,14 +1116,14 @@ H5D__build_file_prefix(const H5D_t *dset, H5D_prefix_type_t prefix_type, char **
* to be reentrant.
*/
if(H5D_PREFIX_TYPE_VDS == prefix_type) {
- prefix = H5D_prefix_vds_env;
+ prefix = (char *)H5D_prefix_vds_env;
if(prefix == NULL || *prefix == '\0') {
if(H5CX_get_vds_prefix(&prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file")
}
} else if(H5D_PREFIX_TYPE_EXT == prefix_type) {
- prefix = H5D_prefix_ext_env;
+ prefix = (char *)H5D_prefix_ext_env;
if(prefix == NULL || *prefix == '\0') {
if(H5CX_get_ext_file_prefix(&prefix) < 0)