summaryrefslogtreecommitdiffstats
path: root/src/H5Pdcpl.c
diff options
context:
space:
mode:
authorJacob Smith <jake.smith@hdfgroup.org>2018-09-11 21:37:14 (GMT)
committerJacob Smith <jake.smith@hdfgroup.org>2018-09-11 21:37:14 (GMT)
commit602dd3ac15c9f5cd47fc78985266ce66a68a8789 (patch)
tree149023d5992abebe5a5a36e45e8132ab478a8c63 /src/H5Pdcpl.c
parent5647dea421be9dc8429f08632aa72a8a22904292 (diff)
downloadhdf5-602dd3ac15c9f5cd47fc78985266ce66a68a8789.zip
hdf5-602dd3ac15c9f5cd47fc78985266ce66a68a8789.tar.gz
hdf5-602dd3ac15c9f5cd47fc78985266ce66a68a8789.tar.bz2
Stash work on object header reduction code and tests.
CMake stuff is not verified.
Diffstat (limited to 'src/H5Pdcpl.c')
-rw-r--r--src/H5Pdcpl.c126
1 files changed, 126 insertions, 0 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index cb13ff3..a1799ad 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -119,6 +119,11 @@
#define H5D_CRT_EXT_FILE_LIST_COPY H5P__dcrt_ext_file_list_copy
#define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp
#define H5D_CRT_EXT_FILE_LIST_CLOSE H5P__dcrt_ext_file_list_close
+/* Definitions for dataset object header minimization */
+#define H5D_CRT_MIN_DSET_HDR_SIZE_SIZE sizeof(hbool_t)
+#define H5D_CRT_MIN_DSET_HDR_SIZE_DEF FALSE
+#define H5D_CRT_MIN_DSET_HDR_SIZE_ENC H5P__encode_hbool_t
+#define H5D_CRT_MIN_DSET_HDR_SIZE_DEC H5P__decode_hbool_t
/******************/
@@ -211,6 +216,7 @@ static const H5O_layout_t H5D_def_layout_g = H5D_CRT_LAYOUT_DEF; /* Defau
static const H5O_fill_t H5D_def_fill_g = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
static const unsigned H5D_def_alloc_time_state_g = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */
static const H5O_efl_t H5D_def_efl_g = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
+static const H5O_ohdr_min_g = H5D_CRT_MIN_DSET_HDR_SIZE_DEF; /* Default object header minimization */
/* Defaults for each type of layout */
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
@@ -270,6 +276,26 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the object header minimization property */
+ if (0 > H5P_register_real(
+ pclass, /* class */
+ H5D_CRT_MIN_DSET_HDR_SIZE_NAME, /* name */
+ H5D_CRT_MIN_DSET_HDR_SIZE_SIZE, /* size */
+ &H5O_ohdr_min_g, /* default */
+ NULL, /* create */
+ NULL, /* set */
+ NULL, /* get */
+ H5D_CRT_MIN_DSET_HDR_SIZE_ENC, /* encode */
+ H5D_CRT_MIN_DSET_HDR_SIZE_DEC, /* decode */
+ NULL, /* delete */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL)) /* close */
+ {
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class")
+ }
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_reg_prop() */
@@ -3733,3 +3759,103 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fill_time() */
+
+/*-----------------------------------------------------------------------------
+ * Function: H5Pget_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Access the flag for whether or not datasets created by the given dcpl
+ * will be created with a "minimized" object header.
+ *
+ * Return:
+ *
+ * Failure: Negative value (FAIL)
+ * Success: Non-negative value (SUCCEED)
+ *
+ * Programmer: Jacob Smith
+ * 14 August 2018
+ *
+ * Modifications: None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_dset_no_attrs_hint(hid_t dcpl_id,
+ hbool_t *minimize)
+{
+ hbool_t setting = FALSE;
+ H5P_genplist_t *plist = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", dcpl_id, minimize);
+
+ if (NULL == minimize)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "receiving pointer cannot be NULL")
+
+ plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
+ if (NULL == plist)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL,
+ "can't find object for ID")
+
+ if (0 > H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &setting))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get dset oh minimize flag value")
+
+ *minimize = setting;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pget_dset_no_attrs_hint */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5Pset_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Set the dcpl to minimize (or explicitly to not minimized) dataset object
+ * headers upon creation.
+ *
+ * Return:
+ *
+ * Failure: Negative value (FAIL)
+ * Success: Non-negative value (SUCCEED)
+ *
+ * Programmer: Jacob Smith
+ * 14 August 2018
+ *
+ * Modifications: None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_dset_no_attrs_hint(hid_t dcpl_id,
+ hbool_t minimize)
+{
+ H5P_genplist_t *plist = NULL;
+ hbool_t prev_set = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", dcpl_id, minimize);
+
+ plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
+ if (NULL == plist)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL,
+ "can't find object for ID")
+
+ if (0 > H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &prev_set))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get extant dset oh minimize flag value")
+
+ if (0 > H5P_poke(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &minimize))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't get dset oh minimize flag value")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pset_dset_no_attrs_hint */
+