diff options
author | Chris Hogan <chogan@hdfgroup.org> | 2019-10-28 21:24:54 (GMT) |
---|---|---|
committer | Chris Hogan <chogan@hdfgroup.org> | 2019-10-29 16:46:48 (GMT) |
commit | f8ab081b1f1abcbf76c151d7960ee97a556b4be9 (patch) | |
tree | d973514a5217823c70b29499f569dccb709afa7e /src/H5CX.c | |
parent | afd4b291315e39e3966eadaf8ae9894b30e9504e (diff) | |
download | hdf5-f8ab081b1f1abcbf76c151d7960ee97a556b4be9.zip hdf5-f8ab081b1f1abcbf76c151d7960ee97a556b4be9.tar.gz hdf5-f8ab081b1f1abcbf76c151d7960ee97a556b4be9.tar.bz2 |
Use API context to store/retrieve LCPL when creating intermediate groups
Diffstat (limited to 'src/H5CX.c')
-rw-r--r-- | src/H5CX.c | 130 |
1 files changed, 130 insertions, 0 deletions
@@ -181,6 +181,10 @@ typedef struct H5CX_t { hid_t dxpl_id; /* DXPL ID for API operation */ H5P_genplist_t *dxpl; /* Dataset Transfer Property List */ + /* LCPL */ + hid_t lcpl_id; /* LCPL ID for API operation */ + H5P_genplist_t *lcpl; /* Link Creation Property List */ + /* LAPL */ hid_t lapl_id; /* LAPL ID for API operation */ H5P_genplist_t *lapl; /* Link Access Property List */ @@ -278,6 +282,10 @@ typedef struct H5CX_t { #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ #endif /* H5_HAVE_PARALLEL */ + /* Cached LCPL properties */ + unsigned create_intermediate_group; /* Whether to create intermediate groups */ + hbool_t create_intermediate_group_valid; /* Whether create intermediate group flag is valid */ + /* Cached LAPL properties */ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ @@ -346,6 +354,12 @@ typedef struct H5CX_dxpl_cache_t { H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */ } H5CX_dxpl_cache_t; +/* Typedef for cached default link creation property list information */ +/* (Same as the cached DXPL struct, above, except for the default LCPL) */ +typedef struct H5CX_lcpl_cache_t { + unsigned create_intermediate_group; /* Whether to create intermediate groups */ +} H5CX_lcpl_cache_t; + /* Typedef for cached default link access property list information */ /* (Same as the cached DXPL struct, above, except for the default LAPL) */ typedef struct H5CX_lapl_cache_t { @@ -401,6 +415,9 @@ static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context st /* Define a "default" dataset transfer property list cache structure to use for default DXPLs */ static H5CX_dxpl_cache_t H5CX_def_dxpl_cache; +/* Define a "default" link creation property list cache structure to use for default LCPLs */ +static H5CX_lcpl_cache_t H5CX_def_lcpl_cache; + /* Define a "default" link access property list cache structure to use for default LAPLs */ static H5CX_lapl_cache_t H5CX_def_lapl_cache; @@ -435,6 +452,7 @@ herr_t H5CX__init_package(void) { H5P_genplist_t *dx_plist; /* Data transfer property list */ + H5P_genplist_t *lc_plist; /* Link creation 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 */ @@ -528,6 +546,19 @@ H5CX__init_package(void) /* Reset the "default LAPL cache" information */ HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t)); + /* Reset the "default LCPL cache" information */ + HDmemset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t)); + + /* Get the default LCPL cache information */ + + /* Get the default link creation property list */ + if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT))) + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list") + + /* Get flag whether to create intermediate groups */ + if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.create_intermediate_group) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag") + /* Get the default LAPL cache information */ /* Get the default link access property list */ @@ -710,6 +741,7 @@ H5CX__push_common(H5CX_node_t *cnode) 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.lcpl_id = H5P_LINK_CREATE_DEFAULT; cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT; cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT; cnode->ctx.tag = H5AC__INVALID_TAG; @@ -1119,6 +1151,35 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_set_lcpl + * + * Purpose: Sets the LCPL for the current API call context. + * + * Return: <none> + * + * Programmer: Chris Hogan + * October 28, 2019 + * + *------------------------------------------------------------------------- + */ +void +H5CX_set_lcpl(hid_t lcpl_id) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(*head); + + /* Set the API context's LCPL to a new value */ + (*head)->ctx.lcpl_id = lcpl_id; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5CX_set_lcpl() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_set_lapl * * Purpose: Sets the LAPL for the current API call context. @@ -2371,6 +2432,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_get_create_intermediate_group + * + * Purpose: Retrieves the create intermediate group flag for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Gerd Heber + * October 21, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_create_intermediate_group(unsigned* crt_intermed_group) +{ + 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(crt_intermed_group); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + + H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5L_CRT_INTERMEDIATE_GROUP_NAME, create_intermediate_group) + + /* Get the value */ + *crt_intermed_group = (*head)->ctx.create_intermediate_group; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_create_intermediate_group() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_nlinks * * Purpose: Retrieves the # of soft / UD links to traverse for the current API call context. @@ -2876,6 +2972,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_set_create_intermediate_group + * + * Purpose: Sets the create intermediate group flag for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Gerd Heber + * October 21, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_create_intermediate_group(unsigned crt_intermed_group) +{ + 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.create_intermediate_group = crt_intermed_group; + + /* Mark the value as valid */ + (*head)->ctx.create_intermediate_group_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_create_intermediate_group() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_set_nlinks * * Purpose: Sets the # of soft / UD links to traverse for the current API call context. |