summaryrefslogtreecommitdiffstats
path: root/src/H5HF.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-08-22 03:08:43 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-08-22 03:08:43 (GMT)
commitde324a50f8e5cc2e07595232dc33908e6560d490 (patch)
tree398e4df5c250cccba28d06ddfb0443a1d6c71b42 /src/H5HF.c
parentab7d724ffd5749c1e3666fd1be0b92f41613af1e (diff)
downloadhdf5-de324a50f8e5cc2e07595232dc33908e6560d490.zip
hdf5-de324a50f8e5cc2e07595232dc33908e6560d490.tar.gz
hdf5-de324a50f8e5cc2e07595232dc33908e6560d490.tar.bz2
[svn-r27549] Description:
Update the file format debugging routines to match the recent changes to the metadata cache, along with a few other cleanups and miscellaneous enhancements. Tested on: MacOSX/64 10.10.5 (amazon) (h5committest forthcoming)
Diffstat (limited to 'src/H5HF.c')
-rw-r--r--src/H5HF.c66
1 files changed, 64 insertions, 2 deletions
diff --git a/src/H5HF.c b/src/H5HF.c
index 0464da4..4a0ad07 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -451,8 +451,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length")
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
- HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
done:
@@ -461,6 +461,68 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_get_obj_off
+ *
+ * Purpose: Get the offset of an entry in a fractal heap
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 20 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_get_obj_off(H5HF_t *fh, hid_t dxpl_id, const void *_id, hsize_t *obj_off_p)
+{
+ const uint8_t *id = (const uint8_t *)_id; /* Object ID */
+ uint8_t id_flags; /* Heap ID flag bits */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(fh);
+ HDassert(id);
+ HDassert(obj_off_p);
+
+ /* Get the ID flags */
+ id_flags = *id;
+
+ /* Check for correct heap ID version */
+ if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR)
+ HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version")
+
+ /* Set the shared heap header's file context for this operation */
+ fh->hdr->f = fh->f;
+
+ /* Check type of object in heap */
+ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
+ H5HF__man_get_obj_off(fh->hdr, id, obj_off_p);
+ } /* end if */
+ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
+ /* Huge objects are located directly in the file */
+ if(H5HF__huge_get_obj_off(fh->hdr, dxpl_id, id, obj_off_p) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's offset")
+ } /* end if */
+ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) {
+ /* Tiny objects are not stored in the heap */
+ *obj_off_p = (hsize_t)0;
+ } /* end if */
+ else {
+HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_get_obj_off() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_read
*
* Purpose: Read an object from a fractal heap into a buffer