summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-04-03 02:18:16 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-04-03 02:18:16 (GMT)
commitea1bb348c5da7195e7767bad66707a0dd1c18de1 (patch)
tree243369b3d67a60a909661fc3aff0ffdb156b6af2 /src/H5D.c
parentf5694482bdc66db6f4946bc709cbfbe92f193980 (diff)
downloadhdf5-ea1bb348c5da7195e7767bad66707a0dd1c18de1.zip
hdf5-ea1bb348c5da7195e7767bad66707a0dd1c18de1.tar.gz
hdf5-ea1bb348c5da7195e7767bad66707a0dd1c18de1.tar.bz2
Incorporate patch from GE Heathcare (HDFFV-9934)
1) Integrate the patch 2) Fix bugs when debugging the patch 3) Add test to hl/test/test_dset_opt.c Tested on moohan, ostrich, platypus, emu, osx1010test, quail, kituo, mayll.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/H5D.c b/src/H5D.c
index cd3d989..7f2a96d 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -416,7 +416,7 @@ H5Dclose(hid_t dset_id)
/*
* Decrement the counter on the dataset. It will be freed if the count
- * reaches zero.
+ * reaches zero.
*
* Pass in TRUE for the 3rd parameter to tell the function to remove
* dataset's ID even though the freeing function might fail. Please
@@ -1002,3 +1002,44 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dset_extent() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dget_chunk_storage_size
+ *
+ * Purpose: Returns the size of an allocated of chunk.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Matthew Strong (GE Healthcare)
+ * 20 October 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes)
+{
+ H5D_t *dset = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("h", "i", dset_id);
+
+ /* Check arguments */
+ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if( NULL == offset )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ if( NULL == chunk_nbytes )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if(H5D__get_chunk_storage_size(dset, H5AC_ind_dxpl_id, offset, chunk_nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
+
+done:
+ FUNC_LEAVE_API(ret_value);
+}
+