summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-12 02:38:08 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-12 02:38:08 (GMT)
commita64589450e5b41dc55b1c6f2e42e837fb0c72bba (patch)
tree1171b47d4ac3aadeaa87b1df69a95c9ee3054c9d /src/H5O.c
parente6b818134e24b1d4d99a612218e0a50ffa08bd28 (diff)
downloadhdf5-a64589450e5b41dc55b1c6f2e42e837fb0c72bba.zip
hdf5-a64589450e5b41dc55b1c6f2e42e837fb0c72bba.tar.gz
hdf5-a64589450e5b41dc55b1c6f2e42e837fb0c72bba.tar.bz2
[svn-r13498] Description:
Eliminate storing # of links in "link info" message, regenerate it when the object is opened instead. Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 10.4.8 (amazon)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 5f3e507..f02a7f5 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -2046,3 +2046,43 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_create_plist() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_nlinks
+ *
+ * Purpose: Retrieve the number of link messages read in from the file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * March 11 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks)
+{
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_get_nlinks, FAIL)
+
+ /* Check args */
+ HDassert(oloc);
+ HDassert(nlinks);
+
+ /* Get the object header */
+ if(NULL == (oh = H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+
+ /* Retrieve the # of link messages seen when the object header was loaded */
+ *nlinks = oh->link_msgs_seen;
+
+done:
+ if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_get_nlinks() */
+