summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Hogan <chogan@hdfgroup.org>2019-11-27 22:16:45 (GMT)
committerChris Hogan <chogan@hdfgroup.org>2019-11-27 22:16:45 (GMT)
commit6f5e5243c789c74086623c16828e7ff55197c3a3 (patch)
tree5861ab33e673a348479d781d47205be0accbef6c
parent5c50be3c0f3158a04564d4340cad1bd5eeb03799 (diff)
downloadhdf5-6f5e5243c789c74086623c16828e7ff55197c3a3.zip
hdf5-6f5e5243c789c74086623c16828e7ff55197c3a3.tar.gz
hdf5-6f5e5243c789c74086623c16828e7ff55197c3a3.tar.bz2
Add DCPL to H5CX
-rw-r--r--src/H5CX.c138
-rw-r--r--src/H5CXprivate.h5
-rw-r--r--src/H5Dint.c11
-rw-r--r--src/H5Oint.c13
4 files changed, 159 insertions, 8 deletions
diff --git a/src/H5CX.c b/src/H5CX.c
index 587f6d2..3101e64 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -190,6 +190,10 @@ typedef struct H5CX_t {
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
+ /* DCPL */
+ 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 */
@@ -289,6 +293,12 @@ typedef struct H5CX_t {
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 */
+ /* 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 */
+ uint8_t ohdr_flags; /* Object header flags */
+ hbool_t ohdr_flags_valid; /* Whether the object headers flags are valid */
+
/* Cached DAPL properties */
char *extfile_prefix; /* Prefix for external file */
hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */
@@ -356,6 +366,13 @@ typedef struct H5CX_lapl_cache_t {
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
} H5CX_lapl_cache_t;
+/* Typedef for cached default dataset creation property list information */
+/* (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 */
+ uint8_t ohdr_flags; /* Object header flags */
+} 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 {
@@ -404,6 +421,9 @@ 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;
+/* 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;
@@ -431,6 +451,7 @@ 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 */
H5P_genplist_t *fa_plist; /* File access property list */
herr_t ret_value = SUCCEED; /* Return value */
@@ -549,6 +570,23 @@ H5CX__init_package(void)
if(H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse")
+ /* Reset the "default DCPL cache" information */
+ HDmemset(&H5CX_def_dcpl_cache, 0, sizeof(H5CX_dcpl_cache_t));
+
+ /* Get the default DCPL cache information */
+
+ /* Get the default link access property list */
+ if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
+
+ /* Get flag to indicate whether to minimize dataset object header */
+ 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")
+
+ /* Get object header flags */
+ if(H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0)
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags")
+
/* Reset the "default DAPL cache" information */
HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t));
@@ -840,6 +878,35 @@ H5CX_set_dxpl(hid_t dxpl_id)
/*-------------------------------------------------------------------------
+ * Function: H5CX_set_dcpl
+ *
+ * Purpose: Sets the DCPL for the current API call context.
+ *
+ * Return: <none>
+ *
+ * Programmer: Quincey Koziol
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5CX_set_dcpl(hid_t dcpl_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 DCPL to a new value */
+ (*head)->ctx.dcpl_id = dcpl_id;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5CX_set_dcpl() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_set_libver_bounds
*
* Purpose: Sets the low/high bounds according to "f" for the current API call context.
@@ -2119,6 +2186,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_dset_min_ohdr_flag
+ *
+ * Purpose: Retrieves the flag that indicates whether the dataset object
+ * header should be minimized
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * March 6, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag)
+{
+ 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_min_ohdr_flag);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, do_min_dset_ohdr)
+
+ /* Get the value */
+ *dset_min_ohdr_flag = (*head)->ctx.do_min_dset_ohdr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_get_dset_min_ohdr_flag() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX_get_libver_bounds
*
* Purpose: Retrieves the low/high bounds for the current API call context.
@@ -2961,6 +3064,41 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5CX_get_ohdr_flags
+ *
+ * Purpose: Retrieves the object header flags for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Chris Hogan
+ * November 15, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_get_ohdr_flags(uint8_t *ohdr_flags)
+{
+ 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(ohdr_flags);
+ HDassert(head && *head);
+ HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
+
+ H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5O_CRT_OHDR_FLAGS_NAME, ohdr_flags)
+
+ /* Get the value */
+ *ohdr_flags = (*head)->ctx.ohdr_flags;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* End H5CX_get_ohdr_flags() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5CX__pop_common
*
* Purpose: Common code for popping the context for an API call.
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 124b7f7..3d1ee5a 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -61,6 +61,7 @@ H5_DLL hbool_t H5CX_is_def_dxpl(void);
H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
H5_DLL void H5CX_set_lcpl(hid_t lcpl_id);
H5_DLL void H5CX_set_lapl(hid_t lapl_id);
+H5_DLL void H5CX_set_dcpl(hid_t dcpl_id);
H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f);
H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
hid_t loc_id, hbool_t is_collective);
@@ -107,6 +108,10 @@ H5_DLL herr_t H5CX_get_intermediate_group(unsigned* crt_intermed_group);
/* "Getter" routines for LAPL properties cached in API context */
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_ohdr_flags(uint8_t *ohdr_flags);
+
/* "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);
diff --git a/src/H5Dint.c b/src/H5Dint.c
index a54333f..8313d9a 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -459,6 +459,9 @@ 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;
@@ -657,11 +660,9 @@ H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize)
HDassert(dset);
HDassert(minimize);
- plist = H5P_object_verify(dset->shared->dcpl_id, H5P_DATASET_CREATE);
- if(NULL == plist)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "problem getting dcpl")
- if(H5P_get(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, minimize) == FAIL)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get minimize value from dcpl")
+ /* Get the dataset object header minimize flag for this call */
+ if(H5CX_get_dset_min_ohdr_flag(minimize) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset object header minimize flag from API context")
if(FALSE == *minimize)
*minimize = H5F_get_min_dset_ohdr(file);
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 09e6bb8..543637c 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -352,9 +352,16 @@ H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
if(NULL == oc_plist)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list")
- /* Get any object header status flags set by properties */
- if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ if(H5P_DATASET_CREATE_DEFAULT == ocpl_id) {
+ /* If the OCPL is the default DCPL, we can get the header flags from the
+ * API context. Otherwise we have to call H5P_get */
+ if(H5CX_get_ohdr_flags(&oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ }
+ else {
+ if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
+ }
if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header")