summaryrefslogtreecommitdiffstats
path: root/src/H5Fio.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-11-20 12:24:57 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-11-20 12:24:57 (GMT)
commit3b0c2b24da5689990c4bc0fcd3afecdf063086c8 (patch)
tree242d3501c98bef92e6befd920e8a9efdf2f1715b /src/H5Fio.c
parentf6ad126673553838df0dec514c5d2c1b4b70df1a (diff)
downloadhdf5-3b0c2b24da5689990c4bc0fcd3afecdf063086c8.zip
hdf5-3b0c2b24da5689990c4bc0fcd3afecdf063086c8.tar.gz
hdf5-3b0c2b24da5689990c4bc0fcd3afecdf063086c8.tar.bz2
Bring over support for retrying metadata cache entry loads, along with all the
supporting metadata cache callback changes, etc.
Diffstat (limited to 'src/H5Fio.c')
-rw-r--r--src/H5Fio.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 2ccd3f3..273ee74 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -282,3 +282,46 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5F_evict_tagged_metadata */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_checksums
+ *
+ * Purpose: Decode checksum stored in the buffer
+ * Calculate checksum for the data in the buffer
+ *
+ * Note: Assumes that the checksum is the last data in the buffer
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi
+ * Sept 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_get_checksums(const uint8_t *buf, size_t buf_size, uint32_t *s_chksum/*out*/, uint32_t *c_chksum/*out*/)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(buf);
+ HDassert(buf_size);
+
+ /* Return the stored checksum */
+ if(s_chksum) {
+ const uint8_t *chk_p; /* Pointer into raw data buffer */
+
+ /* Offset to the checksum in the buffer */
+ chk_p = buf + buf_size - H5_SIZEOF_CHKSUM;
+
+ /* Decode the checksum stored in the buffer */
+ UINT32DECODE(chk_p, *s_chksum);
+ } /* end if */
+
+ /* Return the computed checksum for the buffer */
+ if(c_chksum)
+ *c_chksum = H5_checksum_metadata(buf, buf_size - H5_SIZEOF_CHKSUM, 0);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5F_get_chksums() */
+