summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-07-05 21:58:50 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-07-05 21:58:50 (GMT)
commit12d84d4b12f4b43dc3a399fe3ffe8a8a15797b23 (patch)
tree4591ba2fe3d7fd860686310aea85715def56d81f /src/H5G.c
parent4ca9441078b3a51cec7272a6600c32eac9a5f4af (diff)
downloadhdf5-12d84d4b12f4b43dc3a399fe3ffe8a8a15797b23.zip
hdf5-12d84d4b12f4b43dc3a399fe3ffe8a8a15797b23.tar.gz
hdf5-12d84d4b12f4b43dc3a399fe3ffe8a8a15797b23.tar.bz2
[svn-r11022] Purpose:
Bug fix & code cleanup Description: Don't unmount child files from a parent file if the parent file is being held open by an object. Also, moved the mounting routines into their own source file and the superblock routines into their own file also. Solution: Moved the code for unmounting child files down in the H5F_close routine and also add checks to the file and group mounting code to unmount child files when the last object holding open a file closes. Platforms tested: FreeBSD 4.11 (sleipnir) h5committest
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/H5G.c b/src/H5G.c
index 86c541b..1f8a2ac 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -2254,6 +2254,11 @@ H5G_close(H5G_t *grp)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close");
H5FL_FREE (H5G_shared_t, grp->shared);
} else {
+ /* Check if this group was the last object holding open a mounted file
+ * hierarchy and close down the file hierarchy if so */
+ if(grp->shared->fo_count == 1)
+ H5F_check_mounts(grp->ent.file);
+
if(H5G_free_ent_name(&(grp->ent))<0)
{
H5FL_FREE (H5G_t,grp);
@@ -4094,3 +4099,29 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_get_shared_count
+ *
+ * Purpose: Queries the group object's "shared count"
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 5, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_get_shared_count(H5G_t *grp)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_get_shared_count);
+
+ /* Check args */
+ assert(grp && grp->shared);
+
+ FUNC_LEAVE_NOAPI(grp->shared->fo_count);
+} /* end H5G_get_shared_count() */
+