summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2016-11-29 20:06:37 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2016-11-29 20:06:37 (GMT)
commitd3dbe9d90ee71b231b3264e1d62d3efbae3242ef (patch)
treeb8d706ac89af0822c0ac5cf0e1ab78fa5c3b5b1e /src/H5F.c
parent8fd8115715a2890da432cf2708109a35ea1c33e5 (diff)
parent3d2beeec1fb63c8c2bac4658df382ea7a9d61e05 (diff)
downloadhdf5-d3dbe9d90ee71b231b3264e1d62d3efbae3242ef.zip
hdf5-d3dbe9d90ee71b231b3264e1d62d3efbae3242ef.tar.gz
hdf5-d3dbe9d90ee71b231b3264e1d62d3efbae3242ef.tar.bz2
Merge branch 'develop' into eoc_valgrind_bugfix
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/H5F.c b/src/H5F.c
index f663036..6b087ce 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1367,6 +1367,103 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Fget_metadata_read_retry_info
+ *
+ * Purpose: To retrieve the collection of read retries for metadata items with checksum.
+ *
+ * Return: Success: non-negative on success
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi; October 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
+{
+ H5F_t *file; /* File object for file ID */
+ unsigned i, j; /* Local index variable */
+ size_t tot_size; /* Size of each retries[i] */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*x", file_id, info);
+
+ /* Check args */
+ if(!info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Get the file pointer */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* Copy the # of bins for "retries" array */
+ info->nbins = file->shared->retries_nbins;
+
+ /* Initialize the array of "retries" */
+ HDmemset(info->retries, 0, sizeof(info->retries));
+
+ /* Return if there are no bins -- no retries */
+ if(!info->nbins)
+ HGOTO_DONE(SUCCEED);
+
+ /* Calculate size for each retries[i] */
+ tot_size = info->nbins * sizeof(uint32_t);
+
+ /* Map and copy information to info's retries for metadata items with tracking for read retries */
+ j = 0;
+ for(i = 0; i < H5AC_NTYPES; i++) {
+ switch(i) {
+ case H5AC_OHDR_ID:
+ case H5AC_OHDR_CHK_ID:
+ case H5AC_BT2_HDR_ID:
+ case H5AC_BT2_INT_ID:
+ case H5AC_BT2_LEAF_ID:
+ case H5AC_FHEAP_HDR_ID:
+ case H5AC_FHEAP_DBLOCK_ID:
+ case H5AC_FHEAP_IBLOCK_ID:
+ case H5AC_FSPACE_HDR_ID:
+ case H5AC_FSPACE_SINFO_ID:
+ case H5AC_SOHM_TABLE_ID:
+ case H5AC_SOHM_LIST_ID:
+ case H5AC_EARRAY_HDR_ID:
+ case H5AC_EARRAY_IBLOCK_ID:
+ case H5AC_EARRAY_SBLOCK_ID:
+ case H5AC_EARRAY_DBLOCK_ID:
+ case H5AC_EARRAY_DBLK_PAGE_ID:
+ case H5AC_FARRAY_HDR_ID:
+ case H5AC_FARRAY_DBLOCK_ID:
+ case H5AC_FARRAY_DBLK_PAGE_ID:
+ case H5AC_SUPERBLOCK_ID:
+ HDassert(j < H5F_NUM_METADATA_READ_RETRY_TYPES);
+ if(file->shared->retries[i] != NULL) {
+ /* Allocate memory for retries[i]
+ *
+ * This memory should be released by the user with
+ * the H5free_memory() call.
+ */
+ if(NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Copy the information */
+ HDmemcpy(info->retries[j], file->shared->retries[i], tot_size);
+ } /* end if */
+
+ /* Increment location in info->retries[] array */
+ j++;
+ break;
+
+ default:
+ break;
+ } /* end switch */
+ } /* end for */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fget_metadata_read_retry_info() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Fget_free_sections
*
* Purpose: To get free-space section information for free-space manager with