diff options
author | Songyu Lu <songyulu@hdfgroup.org> | 2019-03-13 15:20:30 (GMT) |
---|---|---|
committer | Songyu Lu <songyulu@hdfgroup.org> | 2019-03-13 15:20:30 (GMT) |
commit | 594cd935435d36801bee3dbb7fc531df7d398bcc (patch) | |
tree | 13a93c2caae9c96a684d8852ddc82a2071821b65 /src | |
parent | 07baf44a86de400c170006557e7595ea6ba9c20a (diff) | |
download | hdf5-594cd935435d36801bee3dbb7fc531df7d398bcc.zip hdf5-594cd935435d36801bee3dbb7fc531df7d398bcc.tar.gz hdf5-594cd935435d36801bee3dbb7fc531df7d398bcc.tar.bz2 |
HDFFV-10658: setting and getting properties in API context:
1. external file prefix and VDS prefix.
2. the datatype, dataspace, and LCPL of the dataset for VOL connector.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5CX.c | 342 | ||||
-rw-r--r-- | src/H5CXprivate.h | 12 | ||||
-rw-r--r-- | src/H5D.c | 21 | ||||
-rw-r--r-- | src/H5Ddeprec.c | 12 | ||||
-rw-r--r-- | src/H5Dint.c | 36 | ||||
-rw-r--r-- | src/H5VLnative_dataset.c | 10 |
6 files changed, 391 insertions, 42 deletions
@@ -189,6 +189,10 @@ typedef struct H5CX_t { hid_t dcpl_id; /* DCPL ID for API operation */ H5P_genplist_t *dcpl; /* Dataset Creation Property List */ + /* DAPL */ + hid_t dapl_id; /* DAPL ID for API operation */ + H5P_genplist_t *dapl; /* Dataset Access Property List */ + /* Internal: Object tagging info */ haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */ @@ -275,8 +279,20 @@ typedef struct H5CX_t { hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ /* Cached DCPL properties */ - hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */ - hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */ + hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */ + hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */ + hid_t vl_prop_dset_type_id; + hbool_t vl_prop_dset_type_id_valid; + hid_t vl_prop_dset_space_id; + hbool_t vl_prop_dset_space_id_valid; + hid_t vl_prop_dset_lcpl_id; + hbool_t vl_prop_dset_lcpl_id_valid; + + /* Cached DAPL properties */ + char *extfile_prefix; + hbool_t extfile_prefix_valid; + char *vds_prefix; + hbool_t vds_prefix_valid; /* Cached VOL settings */ H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */ @@ -336,8 +352,17 @@ typedef struct H5CX_lapl_cache_t { /* (Same as the cached DXPL struct, above, except for the default DCPL) */ typedef struct H5CX_dcpl_cache_t { hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */ + hid_t vl_prop_dset_type_id; + hid_t vl_prop_dset_space_id; + hid_t vl_prop_dset_lcpl_id; } H5CX_dcpl_cache_t; +/* Typedef for cached default dataset access property list information */ +/* (Same as the cached DXPL struct, above, except for the default DXPL) */ +typedef struct H5CX_dapl_cache_t { + char *extfile_prefix; + char *vds_prefix; +} H5CX_dapl_cache_t; /********************/ /* Local Prototypes */ @@ -374,6 +399,9 @@ static H5CX_lapl_cache_t H5CX_def_lapl_cache; /* Define a "default" dataset creation property list cache structure to use for default DCPLs */ static H5CX_dcpl_cache_t H5CX_def_dcpl_cache; +/* Define a "default" dataset access property list cache structure to use for default DAPLs */ +static H5CX_dapl_cache_t H5CX_def_dapl_cache; + /* Declare a static free list to manage H5CX_node_t structs */ H5FL_DEFINE_STATIC(H5CX_node_t); @@ -398,6 +426,7 @@ H5CX__init_package(void) H5P_genplist_t *dx_plist; /* Data transfer property list */ H5P_genplist_t *la_plist; /* Link access property list */ H5P_genplist_t *dc_plist; /* Dataset creation property list */ + H5P_genplist_t *da_plist; /* Dataset access property list */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -511,6 +540,32 @@ H5CX__init_package(void) if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + if(H5P_get(dc_plist, H5VL_PROP_DSET_TYPE_ID, &H5CX_def_dcpl_cache.vl_prop_dset_type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for datatype id") + if(H5P_get(dc_plist, H5VL_PROP_DSET_SPACE_ID, &H5CX_def_dcpl_cache.vl_prop_dset_space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for space id") + if(H5P_get(dc_plist, H5VL_PROP_DSET_LCPL_ID, &H5CX_def_dcpl_cache.vl_prop_dset_lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for lcpl id") + + + + /* Reset the "default DAPL cache" information */ + HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t)); + + /* Get the default DAPL cache information */ + + /* Get the default dataset access property list */ + if(NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list") + + /* Get the prefix for the external file */ + if(H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file") + + /* Get the prefix for the VDS file */ + if(H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__init_package() */ @@ -634,6 +689,8 @@ H5CX__push_common(H5CX_node_t *cnode) /* Set non-zero context info */ cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT; + cnode->ctx.dcpl_id = H5P_DATASET_CREATE_DEFAULT; + cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT; cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT; cnode->ctx.tag = H5AC__INVALID_TAG; cnode->ctx.ring = H5AC_RING_USER; @@ -1083,6 +1140,7 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, *acspl_id = *libclass->def_plist_id; else { htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property list */ + htri_t is_dapl; /* Whether the access property list is (or is derived from) a dataset access property list */ #ifdef H5CX_DEBUG /* Sanity check the access property list class */ @@ -1096,6 +1154,12 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, else if(is_lapl) (*head)->ctx.lapl_id = *acspl_id; + /* Check for dataset access property and set API context if so */ + if((is_dapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_DACC->pclass)) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for dataset access class") + else if(is_dapl) + (*head)->ctx.dapl_id = *acspl_id; + #ifdef H5_HAVE_PARALLEL /* If this routine is not guaranteed to be collective (i.e. it doesn't * modify the structural metadata in a file), check if the application @@ -2324,6 +2388,180 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_get_vl_prop_dset_type_id + * + * Purpose: Retrieves the datatype ID of the dataset for VOL connector + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 12, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vl_prop_dset_type_id(hid_t *dset_type_id) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(dset_type_id); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id); + + H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5VL_PROP_DSET_TYPE_ID, vl_prop_dset_type_id); + + /* Get the value */ + *dset_type_id = (*head)->ctx.vl_prop_dset_type_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vl_prop_dset_type_id */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_get_vl_prop_dset_space_id + * + * Purpose: Retrieves the space ID of the dataset for VOL connector + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 12, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vl_prop_dset_space_id(hid_t *dset_space_id) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(dset_space_id); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id); + + H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5VL_PROP_DSET_SPACE_ID, vl_prop_dset_space_id); + + /* Get the value */ + *dset_space_id = (*head)->ctx.vl_prop_dset_space_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vl_prop_dset_space_id */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_get_vl_prop_dset_space_id + * + * Purpose: Retrieves the LCPL ID of the dataset for VOL connector + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 12, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vl_prop_dset_lcpl_id(hid_t *dset_lcpl_id) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(dset_lcpl_id); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id); + + H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5VL_PROP_DSET_TYPE_ID, vl_prop_dset_lcpl_id); + + /* Get the value */ + *dset_lcpl_id = (*head)->ctx.vl_prop_dset_lcpl_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vl_prop_dset_lcpl_id */ + + + +/*------------------------------------------------------------------------- + * Function: H5CX_get_ext_file_prefix + * + * Purpose: Retrieves the prefix for external file + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 6, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_ext_file_prefix(char **extfile_prefix) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + 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); + + /* Get the value */ + *extfile_prefix = (*head)->ctx.extfile_prefix; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_ext_file_prefix */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_get_vds_prefix + * + * Purpose: Retrieves the prefix for VDS + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 6, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vds_prefix(char **vds_prefix) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + 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); + + /* Get the value */ + *vds_prefix = (*head)->ctx.vds_prefix; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vds_prefix */ + + +/*------------------------------------------------------------------------- * Function: H5CX_set_tag * * Purpose: Sets the object tag for the current API call context. @@ -2639,6 +2877,106 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_set_nlinks() */ + +/*------------------------------------------------------------------------- + * Function: H5CX_set_vl_prop_dset_type_id + * + * Purpose: Sets the datatype ID of the dataset for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 12, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vl_prop_dset_type_id(hid_t dset_type_id) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.vl_prop_dset_type_id = dset_type_id; + + /* Mark the value as valid */ + (*head)->ctx.vl_prop_dset_type_id_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_vl_prop_dset_type_id */ + +/*------------------------------------------------------------------------- + * Function: H5CX_set_vl_prop_dset_space_id + * + * Purpose: Sets the data space ID of the dataset for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 12, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vl_prop_dset_space_id(hid_t dset_space_id) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.vl_prop_dset_space_id = dset_space_id; + + /* Mark the value as valid */ + (*head)->ctx.vl_prop_dset_space_id_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_vl_prop_dset_space_id */ + +/*------------------------------------------------------------------------- + * Function: H5CX_set_vl_prop_dset_lcpl_id + * + * Purpose: Sets the LCPL ID of the dataset for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 12, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vl_prop_dset_lcpl_id(hid_t dset_lcpl_id) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.vl_prop_dset_lcpl_id = dset_lcpl_id; + + /* Mark the value as valid */ + (*head)->ctx.vl_prop_dset_lcpl_id_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 80f1ac4..f022d8e 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -126,6 +126,13 @@ H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks); /* "Getter" routines for DCPL properties cached in API context */ H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag); +H5_DLL herr_t H5CX_get_vl_prop_dset_type_id(hid_t *dset_type_id); +H5_DLL herr_t H5CX_get_vl_prop_dset_space_id(hid_t *dset_space_id); +H5_DLL herr_t H5CX_get_vl_prop_dset_lcpl_id(hid_t *dset_lcpl_id); + +/* "Getter" routines for DAPL properties cached in API context */ +H5_DLL herr_t H5CX_get_ext_file_prefix(char **prefix_extfile); +H5_DLL herr_t H5CX_get_vds_prefix(char **prefix_vds); /* "Setter" routines for API context info */ H5_DLL void H5CX_set_tag(haddr_t tag); @@ -145,6 +152,11 @@ H5_DLL herr_t H5CX_set_io_xfer_mode(H5FD_mpio_xfer_t io_xfer_mode); H5_DLL herr_t H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); +/* "Setter" routines for DCPL properties cached in API context */ +H5_DLL herr_t H5CX_set_vl_prop_dset_type_id(hid_t dset_type_id); +H5_DLL herr_t H5CX_set_vl_prop_dset_space_id(hid_t dset_space_id); +H5_DLL herr_t H5CX_set_vl_prop_dset_lcpl_id(hid_t dset_lcpl_id); + /* "Setter" routines for LAPL properties cached in API context */ H5_DLL herr_t H5CX_set_nlinks(size_t nlinks); @@ -135,6 +135,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID") + /* Set the DCPL for the API context */ + H5CX_set_dcpl(dcpl_id); + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") @@ -148,12 +151,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Set creation properties */ - if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") - if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") - if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id") + H5CX_set_vl_prop_dset_type_id(type_id); + H5CX_set_vl_prop_dset_space_id(space_id); + H5CX_set_vl_prop_dset_lcpl_id(lcpl_id); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -228,6 +228,9 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") + /* Set the DCPL for the API context */ + H5CX_set_dcpl(dcpl_id); + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") @@ -241,10 +244,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") /* set creation properties */ - if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") - if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + H5CX_set_vl_prop_dset_type_id(type_id); + H5CX_set_vl_prop_dset_space_id(space_id); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 76827b4..70e6f70 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -136,6 +136,9 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") + /* Set the DCPL for the API context */ + H5CX_set_dcpl(dcpl_id); + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") @@ -145,12 +148,9 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") /* set creation properties */ - if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") - if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") - if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id") + H5CX_set_vl_prop_dset_type_id(type_id); + H5CX_set_vl_prop_dset_space_id(space_id); + H5CX_set_vl_prop_dset_lcpl_id(lcpl_id); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; diff --git a/src/H5Dint.c b/src/H5Dint.c index 384c66b..ae9a40e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -488,9 +488,6 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) new_dset->dcpl_id = H5P_copy_plist(plist, FALSE); } /* end else */ - /* Set the DCPL for the API context */ - H5CX_set_dcpl(new_dset->dcpl_id); - /* Set return value */ ret_value = new_dset; @@ -1083,8 +1080,7 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, - char **file_prefix /*out*/) +H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix /*out*/) { char *prefix = NULL; /* prefix used to look for the file */ char *filepath = NULL; /* absolute path of directory the HDF5 file is in */ @@ -1105,20 +1101,22 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type /* XXX: Future thread-safety note - getenv is not required * to be reentrant. */ - if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) + if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) { prefix = HDgetenv("HDF5_VDS_PREFIX"); - else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) + + 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(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) { prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); - else - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") - if(prefix == NULL || *prefix == '\0') { - /* Set prefix to value of prefix_type property */ - if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_peek(plist, prefix_type, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix") - } /* end if */ + if(prefix == NULL || *prefix == '\0') { + if(H5CX_get_ext_file_prefix(&prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file") + } + } else + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") /* Prefix has to be checked for NULL / empty string again because the * code above might have updated it. @@ -1552,8 +1550,10 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) ret_value = dataset; done: - extfile_prefix = (char *)H5MM_xfree(extfile_prefix); - vds_prefix = (char *)H5MM_xfree(vds_prefix); + if(extfile_prefix) + extfile_prefix = (char *)H5MM_xfree(extfile_prefix); + if(vds_prefix) + vds_prefix = (char *)H5MM_xfree(vds_prefix); if(ret_value == NULL) { /* Free the location--casting away const*/ diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c index 8f7351c..ac25c55 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -18,6 +18,7 @@ #define H5D_FRIEND /* Suppress error about including H5Dpkg */ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ @@ -62,12 +63,9 @@ H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") /* Get creation properties */ - if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id") - if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id") - if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id") + H5CX_get_vl_prop_dset_type_id(&type_id); + H5CX_get_vl_prop_dset_space_id(&space_id); + H5CX_get_vl_prop_dset_lcpl_id(&lcpl_id); /* Check arguments */ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) |